Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Place a Twilio call on hold and retrieve it later

Tags:

twilio

I am creating a Twilio application using JavaScript SDK.

I want to implement call hold functionality but I am having trouble implementing it.

What is the process to put a call on hold, when it is initiated by the soft-phone? Also, what is the process when the soft-phone is receiving the call?

like image 454
ashishcloud Avatar asked Oct 13 '13 12:10

ashishcloud


People also ask

How do you hold a call on twilio?

Putting a call on hold is easy provided you have already set the call up via a conference bridge as described above. To put the caller on hold, simply POST to the Participants Resource. If you are using TaskRouter's conference instruction, all the SIDs you need will be within the Task Attributes.

How does twilio handle incoming calls?

Twilio makes answering a phone call as easy as responding to an HTTP request. When a Twilio phone number receives an incoming call, Twilio will send an HTTP request to your web application, asking for instructions on how to handle the call. Your web application will respond with an XML document containing TwiML.

How do I make a call from twilio?

Make an outbound call For any Function using the built-in Twilio Client, the "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" option on the Settings > Environment Variables tab must be enabled. You can use a Function to make a call from your Twilio phone number via Programmable Voice.


2 Answers

Twilio evangelist here.

There are different ways to place a call on "hold". Normally it does not matter whether the call originated from Client or from a PSTN number, the process is generally the same:

  1. Provide Twilio some TwiML that places the call into "hold" then
  2. when you are ready, use that calls CallSid and the REST API to redirect the live call to a new experience.

Now, for placing the call on "hold" there are a couple of options I can suggest:

One is to use the <Play> verb and set the loop attribute to zero, which will tell Twilio to loop over that audio indefinitely. When you are ready to move the call out from "hold", you simply redirect the call.

Another option is to use the <Enqueue> verb and place the call into a call queue. Then when you are ready simply redirect that call back out of the queue to a new experience.

Hope that helps.

like image 163
Devin Rader Avatar answered Jan 03 '23 11:01

Devin Rader


When the user of the soft phone press Hold you can use the REST API to update that call, sending the call to a queue.

You can do that redirecting the call to a TML file with the <Enqueue> tag.

To retrieve the call to the soft phone you can use the CallSid to update the call and sending it back to the soft phone user.

I already implemented that feature in my app, so let me know if you need some help.

like image 24
Maxi Capodacqua Avatar answered Jan 03 '23 12:01

Maxi Capodacqua