Domanda

I am using twillio to make a call to a specific number.

$client = new Services_Twilio($sid, $token);
$call = $client->account->calls->create($from,$to, URL to response, array());

The response comes as output to given url to response as follow:

 header("content-type: text/xml");
     echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     echo "<Response>
     <Say>
           Hello buddy, here is the call you had requested now, it is up to you how long you can fake it.
     </Say>
     </Response>";

Twilio calls given number and if a user responds to phone call he gets defined text as voice in response.

Can we use a recorded sound in place of given XML as response

È stato utile?

Soluzione

Twilio employee here.

TwHello Inc already answered in comments, but just to clarify:

Yes, you can use the <Play> tag to play back an mp3 file, which could be a recorded voice:

https://www.twilio.com/docs/api/twiml/play

It's as simple as this:

<Response>
    <Play>http://mywebsite.com/mysong.mp3</Play>
</Response>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top