chirag satapara
chirag satapara

Reputation: 1947

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.

CLICK HERE

Can anyone help me.

Upvotes: 0

Views: 776

Answers (2)

am1704
am1704

Reputation: 857

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}'

Upvotes: 1

chirag satapara
chirag satapara

Reputation: 1947

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

Upvotes: 1

Related Questions