Imagine there is an incoming call currently enqueued via Twilio.
I want to transfer this call a new conference line.
Currently, my app "updates" the call with a redirect URL that responds with the following TwiML.
Unfortunately, it just hangs there, listening to music, and I never enter the conference.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Conference endConferenceOnExit="true" startConferenceOnEnter="true" waitUrl="http://example.com/music">
{{CallSid}}
</Conference>
</Dial>
</Response>
Note that the {{CallSid}} is dynamically updated with the call identifier (aka Call SID). Also, I have not tried this with a second phone (because maybe it won't connect to the conference line until there is more than one person?)
Twilio developer evangelist here.
First up, your question in parentheses was indeed correct, a conference will not start with one person in, so will just play the hold music until someone else joins.
Secondly, once you added a second call you were still hearing hold music. However, for the <Conference> identifier, you said you were using the CallSid. That identifier is unique per call leg, so each of your calls would have different CallSids and thus would join different conference calls. To first ensure that this is the issue, I would test your code with a static identifier for the conference (<Conference>Test</Conference> for example). If you can get callers talking together like that, then you will need to find a way to identify a conference independent of the individual CallSids and use that as the identifier so that you can join the calls together.
Let me know if that helps at all.
Related
I have a task with this description:
Implement the call button:
When call icon is clicked, first Twilio calls the phone number #1 (Admin)
Once admin picked up the phone, the number #2 (provider) is called.
Both connected.
At this moment I figured out how to call through browser to phone numbers (like Admin can call to the provider in browser).
But I can't find any information, how to connect people through Twilio accordingly the task.
Is there any way to implement this solution?
I do not completely understand if you want to click a phone number on the website or if you want to completely connect two phone numbers automatically.
Scenario 1: User calls a number of your Twilio account
You setup a callback URL for that number and setup a web endpoint which generates a response similar to the following (XML, TwiML):
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callerId="${callerId}">${targetNumber}</Dial>
</Response>
In my example I use TypeScript/JavaScript templating to replace the callerId and targetNumber variables according to our systems logic.
Secenario 2: You want to connect two phone numbers via Twilio
In this scenario your software first makes sure that Twilio calls your Admin. This can be done via a REST call or Twilio's API. There are so many options depending on which programming language you use and if you want to use a library from Twilio. But the basic idea is documented here:
https://www.twilio.com/docs/voice/make-calls
And you would always end up making a REST call against /2010-04-01/Accounts/{AccountSid}/Calls to initiate the call.
In the request you again specify a URL where Twilio then can read back XML / TwiML to understand what it should do with the call one it is connected. And again here you can use almost the same TwiML as above:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Just a second you are going to be connected to your provider.</Say>
<Dial callerId="${callerId}">${targetNumber}</Dial>
</Response>
In the above example I also added a <Say> statement such that the administrator knows, that they are going to be connected and need to be patient until the call is finally connected.
Important Notes:
In our application scenarios we are attempting to hide the phone numbers of the connected parties. The purpose is that the caller which dials into our system should have the opportunity to remain completely anonymous if desired. So we specify with callerId which caller id we want to send with outbound phone call. Bear in mind that this must be a phone number which you do own (is a number rented via Twilio or is a phone number you registered with Twilio).
After following this document I can successfully add PSTN callers to a video room (Small Room type). What I haven't been able to do is to detect DTMF tones from the person calling in.
I tried two different approaches, both have failed
1) The one that I used before with a different provider and worked, but not with Twilio, was to have one of the other users in the room (not the PSTN caller but a javascript client) detect the DTMF client-side. This doesn't work with twilio because it sounds to me like twilio is manipulating the audio stream to remove the DTMFs before they reach the other users in the room (when the PSTN caller presses a number, you only hear a short "click" on the other side)
2) Inspired by this answer, I tried to reply with a TWIML
<Response>
<Connect>
<Room>my-room</Room>
</Connect>
<Gather input="dtmf">
</Gather>
</Response>
This would not be ideal since it wouldn't detect the DTMF while in the room; you would have to leave the room, but I tried it anyway to see if I could come up with a way to terminate the call to move on to the gather verb like in the linked answer. It looks like the call doesn't move to the gather part after the room ends (i tried completing the room and the PSTN call immediately ends)
Are there any other approaches that anyone has used for this? The simplest to me would be a way to tell twilio not to remove the DTMFs from the audio stream so my solution #1 would work, but I'm open to other ideas maybe leveraging twilio's gather
Twilio developer evangelist here.
It doesn't look like it's currently directly possible to detect DTMF tones in a phone call that has been connected to a video room.
One possibility is to use the new Media Stream capability to direct the live audio to your own server to detect the tones.
I have asked the team to see if there are other options though.
I am new to twilio. I am trying to setup a phone number that rings multiple destinations.
I followed this blog and set up a twiML script like so.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Number>+1-777-777-7777</Number>
<Sip>sip:1777xxxxxxxxxx#in.callcentric.com;region=us2</Sip>
<Sip>sip:1777xxxxxxxxxx#in.callcentric.com;region=us2</Sip>
</Dial>
</Response>
However as reported by other users in the comments this does not seem to work for scenarios where the destinations are a mix of sip and numbers. In my case only the phone number rings. The sip destinations don't receive the call at all.
Is there a way to make this work? either with bins or the new twilio functions?
Twilio developer evangelist here.
It is not possible to use multiple <Sip> nouns in a <Dial>. From the documentation:
Currently, only one <Sip> noun may be specified per <Dial>, and the INVITE message may be sent to only one SIP endpoint. Also, you cannot add any other nouns (eg <Number>, <Client>) in the same <Dial> as the SIP. If you want to use another noun, set up a callback on the <Dial> to use alternate methods.
You could, instead, add the incoming caller to a queue with <Enqueue> and dial each of the numbers/SIP addresses using the REST API. Then, when one connects, connect it to the call in the queue and disconnect the other calls. You'd need to keep a reference to the original call SID so that could connect directly to it and to each of the generated call SIDs so that you can terminate them with the REST API too.
Let me know if that helps at all.
I have a twilio app that provides an on-call list of phone numbers that our customer's can call and speak to one of our on-support developers.
I need to find a solution that will allow the caller to press a key to bypass the voicemail of a the calling party and be redirected to the next person in the on-call list. Right now, if I call my twilio app using my number and I get the calling party voicemail, I don't have an option to move onto the next person in the call list.
Is there a way to mimic the hangupOnStar feature when a caller gets a person voicemail in twilio?
Thanks,
I had a look into this and unfortunately it does not look like you can nest <Dial> within <Gather> otherwise this might be possible.
What I would recommend is when you receive an inbound call, play a message along the lines of "Please wait a moment while we connect an available developer", then <Enqueue> the call.
At this point your application can start calling the developers and when the line connects ask them to press #, when this happens you can <Dial> the developers call into the queue ID Twilio proved in the last call to you app, and the calls will be bridged. If the developer did not press # then you can assume that it went to voicemail, at which point <Hangup> and initiate a call to the next dev on call.
Hope that helps.
I have an app that creates outbound calls to set up simple conferences.
I am having difficulty dealing with dialing out to Google Voice numbers as I use IfMachine to be able to determine if the call goes to voicemail for one or more participants so that I can "fail" the conference call attempt.
Here's the issue that I am having...
Google Voice answers the call attempt and asks you to say your name before forwarding your call onto the configured endpoint for that user.
I can use IfMachine to detect this and I can automate this portion and get Google Voice to forward the call, but then I can no longer detect if the call ultimately goes to voicemail or if an actual person picks up on the other end.
any ideas?
Twilio Evangelist here,
I think given that there are 2 points you need machine detection, you may want to use a <Gather> as secondary call screening before connecting the person to a conference.
When you make the outbound call to a number, you're using IfMachine to find out if you get to Google Voice. So that's great. But because you're passed that hurdle, it won't be triggered again.
What you could do is to use call screening, to manually detect a human with some TwiML like this:
<Response>
<Gather numDigits="1" timeout="15" action="/some-conference-path">
<Say>Press any key to be connected to the Something Something Conference</Say>
</Gather>
</Response>
Then, if the call is answered by a human, they can press any key on their keypad and be redirect to the actual conference call, or if the Gather times out, you most likely got their voicemail.
You're basically combining automatic and manual machine detection as you need to do it twice at different points of the same call.
Hope this helps!