'Put caller on hold and retrive back from hold using javascript in twilio
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.
Can anyone help me.
Solution 1:[1]
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
Solution 2:[2]
In a two party call , as soon as one of the party goes off the call , the call ends. Hence your 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}'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | chirag satapara |
Solution 2 | philnash |