问题
How can put on hold a live call?
And respect that,
I'm using Javascript SDK.
How can put on hold a live call with Twilio.Device or Twilio.Comunication?
For example:
Customer phones to Company.
Agent of Company response the call
Agent and Customer are Speaking
Agent puts on hold a call
Customer listen a sound
Agent is joins again on the call to continue speaking
The call ending
I hope I've explained myself well
Sorry for my english!
Thanks
回答1:
Twilio evangelist here.
There is no way to put a call "on hold" directly from the Javascript SDK. What you could do is redirect the ongoing call to a new set of TwiML which provides an "on hold" experience like playing an audio file, or putting the call into a Queue.
We have a Twimlet that provides the ability to loop over an audio file as a "hold" experience here:
https://www.twilio.com/labs/twimlets/holdmusic
As an example doing this, you would use some TwiML that looks something like this:
<Response>
<Say> Thank you for calling, a representative will be with you shortly</Say>
<Play loop="100">http://www.mydomain.foo/hold-music.mp3</Play>
</Response>
This would loop indefinitely. To move the caller back out of hold, you use the REST API to redirect the call:
POST https://api.twilio.com/2010-04-01/Account/{YourAccountSid}/Calls/{WaitingCallersCallSid}
CurrentUrl=http://www.example.com/dial-representitive
Those samples contain code from a blog post that walks you through this scenario:
https://www.twilio.com/blog/2009/09/call-queueing-putting-callers-on-hold-calll-redirect-new-url-new-feature.html
Hope that helps.
来源:https://stackoverflow.com/questions/34677501/try-put-on-hold-a-call-and-then-retrieve-that