How to put Twilio call on hold

不羁岁月 提交于 2019-12-08 09:45:14

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!