Put caller on hold and retrive back from hold using javascript in twilio

坚强是说给别人听的谎言 提交于 2019-12-25 08:26:03

问题


How can I put a caller on hold using a javascript. And retrive back to caller from the hold.

I tried using below stackoverflow link , but it put me on hold not to the caller and cut the call of the caller.

CLICK HERE

Can anyone help me.


回答1:


In a two party call , as soon as one of the party goes off the call , the call ends. Hence you're experience. If you want both the callers to be on the call and whilst they are on call ,have one go to hold and then bring him back - Use conference. .

The flow should be something like:

  • Caller calls a Twilio number
  • When call is answered use TwiML to place the caller in conference.
  • Initiate a REST API to do a outbound dial to other party

Here is an example of the Twiml that puts the caller into a conference:

<Response>
  <Dial>
    <Conference beep="false" waitUrl="" startConferenceOnEnter="true" endConferenceOnExit="true">NoMusicNoBeepRoom
    </Conference>
  </Dial>
</Response>

When you want to put caller on hold, post to /conference and you can put required participant on hold/unhold using details described here.

$POST /Conference/CFbbe46ff1274e283f7e3ac1df0097ab39/Participants/CA386025c9bf5d6052a1d1ea42b4d16662
    -d "Hold=True" \
    -d "HoldUrl=https://myapp.com/hold" \
    -u 'AC123:{AuthToken}'



回答2:


I ask same question to the twilio support center and they give below answer.

It is much easier to use conference..

The following example shows how you can put the first conference participant on hold, and then unhold them once the agent is ready to talk with them: https://www.twilio.com/docs/api/twiml/conference#examples-6



来源:https://stackoverflow.com/questions/39425978/put-caller-on-hold-and-retrive-back-from-hold-using-javascript-in-twilio

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