问题
I am trying to implement following on Twilio, but not sure why I am not able to get it done correctly. I have initiated a call using standard Twilio procedures from twilio.device.connect
. After a call is initiated, I am updating the call to new url in order to put it on hold.
$client = new Services_Twilio($accountSid, $authToken);
$call = $client->account->calls->get($call_sid);
$call->update(
array(
"Url" => "http://localhost/voice.xml",
"Method" => "POST",
)
);
Now here instead of putting end user on hold it just disconnects the call, and play music on my side. Why it is happening?
回答1:
Twilio evangelist here.
I'd suggest checking to see if Twilio is logging any errors:
https://www.twilio.com/user/account/monitor/alerts
If you are trying to redirect Twilio to "http://localhost", thats not going to work because Twilio obviously does not know how to reach the localhost running on your own machine.
If you want to expose a web server running on your own local machine to the internet via a public URL check out an awesome tool called ngrok.
回答2:
the reason is that after the <Play>
tag in your
"http://localhost/voice.xml" file.. there is no further TwiML that gets executed.
The solution is to redirect the call back to its original state.
来源:https://stackoverflow.com/questions/32233250/how-to-put-twilio-call-on-hold