With twilio, on an existing call (2 legs - caller leg and called leg), I want to move the call into a conference room. Both legs have to be present into the room How to bridge the both legs without losing one or the other leg ?
Thank you
Regards
Configuring your Twilio number Click on the number you'd like to use. On the next screen, scroll down to “Voice & Fax.” Under “A Call Comes In”, select “Studio Flow” and “conference call” from the dropdown menus. Click “Save” and you're ready to test.
Twilio's Voice Conference is a flexible way for developers to manage multi party calls from 2 participants to 250 participants. Voice Conferences can be used for standard multi party audio bridges, for inbound contact centers, or for outbound dialers.
The Twilio Programmable Voice API gives developers programmatic control over their calls, with APIs built for a wide variety of uses from basic phone to phone calling, app to phone calling, Interactive Voice Response (IVR), conference calling, SIP interfacing, call recording, transcription, call tracking, and more.
Implementing call whisper with Twilio The <Dial> verb in TwiML makes it very easy to add a call whisper feature to your Twilio voice application by providing a call screening URL that controls the call once the callee picks up while the caller continues to hear ringing (required answerOnBridge set to true).
The trick to prevent the call being dropped is by using “action” url for parent leg to dial into conference and modifying the child leg to move in the same conference.
Here’s the detailed flow to start calls between 2 person and then upgrade that to a conference
(1) Create a TwiML Response API to dial calls in conference(based suited to your business logic ) . Here’s a simple example TwiML (http://www.mocky.io/v2/584ac0f81000002b14fb0205)
<Response>
<Dial>
<Conference>letItGoSimple</Conference>
</Dial>
</Response>
(2) When you initiate the call , your Url parameter should be set to return TwiML like the one below (example Twiml : http://www.mocky.io/v2/584ac8a3100000c914fb0214 )
<Response>
<Dial action="http://www.mocky.io/v2/584ac0f81000002b14fb0205" method="GET">
<Number>+44xxxxxxxx</Number>
</Dial>
</Response>
Note that the action url has been set to TwiML from step one . It is very important in this flow as this would prevent the call from being dropped when you modify the Child Leg of the call .
(3) After step 2 is executed, the two parties would be on a direct call (no conference)
(4) When you want to upgrade the call to a conference , POST to the child call SID with Url set to Twiml To Dial into conference ,
Example :
curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACxxxxxxxxxxxx/Calls/CAyyyyyyyyyyyyyy -d "Url=http://www.mocky.io/v2/584ac0f81000002b14fb0205" -d "Method=GET" -u ‘accountSID:authToken'
It is important that you modify the child leg of the call .
(5) Here is what will happen when you execute step 4
Hope this helps.
Twilio evangelist here.
So the best answer is to just put both calls into a conference to start. Its a little more difficult since you have to use the API to initiate the second leg, but it gives you a lot more flexibility to move call legs around.
If thats not possible, then it gets a bit more challenging since there isn't a great way today to get the SID of the second call. What you would likely need to do is use the Calls list resource in the REST API to find the SID of that second call. You can use the list filter parameters To and Status to find the specific call. Once you have the call resource of the second leg, it contains a parameter called parent_call_sid which is the SID of the original incoming call.
Now that you have the SID's for both call legs you can use the REST API to redirect both calls to new Voice Urls which return TwiML containing the <Conference>
noun.
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With