0
votes

I have developed a small application using twilio api to make call to any phone number from my twilio number. After dialing call is establishing and a specific audio clip is playing in mobile end. But I am not getting any real voice in any side of the call. Please help me or give me some information regarding how can i get voice in voice call using twilio api. Thanks, Tanim

Code snippet:

$client = new Services_Twilio($AccountSid, $AuthToken);
$call = $client->account->calls->create("My Twilio Number", "Outgoing number", "demo.twilio.com/docs/voice.xml";, array());
var_dump($call->sid);
$response = new Services_Twilio_Twiml();
$response->say('Hello');
$response->play('api.twilio.com/cowbell.mp3';, array("loop" => 5));
1
Can you share the code you've used so far? It's hard to help when we don't have a baseline of what you've done.philnash
Thanks for your reply. Here is a code snippet which I have used. $client = new Services_Twilio($AccountSid, $AuthToken); $call = $client->account->calls->create("My Twilio Number", "Outgoing number", "demo.twilio.com/docs/voice.xml", array()); var_dump($call->sid); $response = new Services_Twilio_Twiml(); $response->say('Hello'); $response->play('api.twilio.com/cowbell.mp3', array("loop" => 5));tanim

1 Answers

2
votes

Twilio developer evangelist here.

When you create a call through the Twilio REST API you pass three parameters, your Twilio number, the number you're trying to call and a URL.

When the number you're calling picks up, Twilio requests the URL to ask what to do with the call. In your example, the URL you have sent is our demo URL "demo.twilio.com/docs/voice.xml". You need to pass a URL that is also controlled by you, in your application, to tell Twilio what to do with the call. That URL needs to return TwiML, which is an XML description of what to do with a phone call (or text message).

In your code snippet that you provided, you are generating a TwiML response, but I can't see how you're using it.

I recommend you work through the Quickstart guide for making phone calls with Twilio which should get you up to speed on how these things fit together. Then check out the Twilio Tutorials section to learn about certain use cases in more depth with the code to perform those use cases.

Let me know if that helps at all.