"Press 1 at any time" in Twilio - twilio

I'm trying to make a Twilio workflow that allows for a user to press 1 at any time to cancel out (as long as a <Dial> hasn't connected yet) and leave a voicemail instead. The TwiML documentation offers a <Gather> option, but this is for a specific time and it supposedly won't let me run a <Dial> command during a <Gather>. Is there a trick to getting this to work?

Twilio evangelist here.
You should be able to Dial another number after gathering input.
<Gather action="[your_gather_processing_url]">
When the <Gather> completes (eg the user presses one), then Twilio will make a request for the URL you've set in the action parameter. In there you can use <Dial> to connect to another number.
It sounds like what you want to do is have Twilio <Gather> for input while the <Dial> is ringing. I believe in that case you are correct, thats something we cannot do today.
One option might be to use <Dial>s timeout property to set a finite limit on the length of time Twilio will wait for the call to be answered (its 30 seconds by default), and then in the action URL, check the DialCallStatus to see if the call was not-answered and send to voicemail when appropriate.
Hope that helps.

Related

twilio conference - get dialedin participants phone input

All the participants to my twilio conference are muted except the presenter.
I need to implement a feature where the dialed in participant wants to ask a question by dialing a key on his phone.
Essentially a 'raise hand' feature. He can then be unmuted by the moderator and allowed to ask his question.
I already have a build in dashboard to mute/unmute the participants.
is there a way that the caller can hit *1 or some combination of keys that I can then use in my callback.
I've tried using * with hanguponstar functionality but it basically exits the caller from the conference.
Thanks,
Amit
Twilio developer evangelist here.
If you use hangupOnStar and add further TwiML after the <Dial> then the call will continue for the user. So, you could do something like:
<Response>
<Dial hangupOnStar="true">
<Conference>MyConferenceRoom</Conference>
</Dial>
<Redirect>/handUp</Redirect>
</Response>
You would redirect the caller through a /handup action. In this action you could register the caller's question and respond with TwiML to dial them back into the <Conference>.
Note, if you have an action attribute for your <Dial> then the call will follow that rather than carry on with the TwiML in the original action.
Let me know if that helps at all.

Twilio - Is there a way to bypass voicemail

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.

Twilio checking if human representative is on the line

I'm thinking of a scenario where web app with twilio api first makes an outbound call to a customer service number, send digits to get transferred to the agent, and instead of waiting on hold, I would like the web app to detect when human picks up the call and calls the user's phone number. Is there a way to do this?
Twilio evangelist here.
There isn't an automated way to detect that a human has answered the call. You could put a prompt in the phone call that the agent can input in order to indicate that they have answered the call. Something like:
<Response>
<Gather action="process/" numDigits="1">
<Say>Please press one to connect to the incoming call</Say>
</Gather>
</Response>
Hope that helps.

Can Twilio detect if a call to a Google Voice number gets forwarded to voicemail or an actual person?

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!

How to change caller id during call in twilio

I have 2 phone numbers registered as caller ids in my twilio account.
Is is possible to change the caller id during call. Lets say i am using Phone 1 as a caller id but during call if user presses 1 he will be connected to other user. But Before connecting to other user i want that Phone 2 works as caller id.
Is it possible? Please help
Twilio evangelist here.
Based on your description of the workflow, I believe this is possible.
I assume you are using <Gather> to listen for Caller1 to indicate he wants to be connected to another call. If thats the case, in the URL thats requested once Caller1 had pressed one, you're going to return some TwiML that includes the <Dial> verb to tell Twilio to dial Caller2 and bridge them with Caller1. The <Dial> verb has a callerID attribute that you can set to one of your verified caller ID's, and that is what will be shown to Caller2 when Twilio rings them.
https://www.twilio.com/docs/voice/twiml/dial#dial-attributes
Hope that helps.

Resources