Twilio checking if human representative is on the line - twilio

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.

Related

Twilio Programmable Voice - How to prevent <Gather> prompt from playing if the call is picked up by an answering machine

We started using Twilio Programmable Voice for appointment reminders, and we are using AMD with the MachineDetection parameter set to "DetectMessageEnd" so we can leave voicemail messages on the recipients answering machine. We are also using a Gather tag in our TwiML to get user input (Ex. "Press 1 to confirm your appointment").
However, we noticed that if the call goes to a voicemail box, the Gather prompts still get triggered. We'd like to be able to prevent this from occurring so the recipient doesn't hear the prompts in their voicemail message.
Is this even possible? Here's an example of our current TwiML:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="Polly.Joanna">
<prosody rate="95%">Hello, you have an appointment tomorrow at 10:30AM</prosody>
</Say>
<Pause length="1" />
<Gather action="https://example.com" timeout="5">
<Say voice="Polly.Joanna">
<prosody rate="95%">Press 1 to confirm your appointment, Press 2 to repeat the message</prosody>
</Say>
</Gather>
</Response>
The AMD AnsweredBy parameter would be used to determine which TwiML you want to return.
If it is a Machine, you would not return the TwiML with the Gather (since it is a machine and you will wait for the DetectMessageEnd event to drop the announcement). If it is a human (AnsweredBy=human), you can use the Gather to get their response around their availability for their appointment.

Twilio call diverting call to personal cellphone answering machine instead of twimlet

I am trying to use twimlbin code to forward calls to the voicemail box for my current twilio number. The goal is to have a call come in, then it is split to call multiple numbers at the same time. If none of the numbers pick up, then forwards it to voicemail where it is emailed to an email address using a twimlet link. Currently this is my setup:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial action="https://twimlets.com/forward?FailUrl=https%3A%2F%2Ftwimlets.com%2Fvoicemail%3FEmail%myemail%2540gmail.com%26Message%3DSorry%2520we%2520are%2520unavailable%252C%2520please%2520leave%2520a%2520voicemail%2520here%2520and%2520let%2520us%2520know%2520what%2520you%2520need%2520and%2520we%2520will%2520get%2520back%2520to%2520you%2520shortly%252C%2520thank%2520you.%26Transcribe%3Dtrue&Dial=true" record="record-from-answer" callerId="+13151234567">
<Number url="https://handler.twilio.com/twiml/EH8253d4550bfdaf385b2b2ac15e0a4392">3155554444</Number>
<Number url="https://handler.twilio.com/twiml/EH8253d4550bfdaf385b2b2ac15e0a4392">7165554444</Number>
</Dial>
</Response>
Currently it routes the numbers properly and the phones receive the call, but when no one picks up, it just goes to the voicemail on the personal phones of the numbers where the call is being forwarded to. Is there a way I can get the twimlet to work with this style of routing in Twilio?
Take a look at this blog.
Outsmart Voice Mail with Human Detection Using Keypress Prompts
https://www.twilio.com/blog/voice-mail-human-detection-studio-functions

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.

Does Twilio have any plan to implement simultaneous calling with machine filter correctly?

In Twilio - simultaneous ring is broken with airplane mode.
Since first call that connects will cancel all the other attempts, if there is a line that is on airplane mode, it will pick up immediately and take user to voicemail.
The fix would be to cancel all other attempts only when the call is successfully CONNECTED instead of PICKED-UP. In this example if 111-111-1111 picks up but doesn't press 1, the call to 222-222-2222 shouldn't be cancelled:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Number url="/screen">
111-111-1111
</Number>
<Number url="/screen">
222-222-2222
</Number>
</Dial>
</Response>
--- /screen
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather action="/complete_call">
<Say>Press any key to accept this call</Say>
</Gather>
<Hangup/>
</Response>
Any plan to fix this?
In your document it seems that you are aware of this issue. Here is except from Twilio document:
Simultaneous dialing is useful when you have several phones (or
several people) that you want to ring when you receive an incoming
call. Keep in mind that the first call that connects will cancel all
the other attempts. If you dial an office phone system or a cellphone
in airplane mode, it may pick up after a single ring, preventing the
other phone numbers from ringing long enough for a human to ever
answer.
Hence you should take care to use simultaneous dialing in situations
where you know the behavior of the called parties.
https://www.twilio.com/docs/api/twiml/number
I ran into a similar problem recently.
Devin's solution, if I'm understanding it correctly, is to present a prompt to whomever picks up first and, if they don't respond within the timeout, to then redial the remaining numbers in the group.
That creates a bad experience for the caller -- they end up waiting longer to connect to a human -- and for the call targets -- who may have their phones ring briefly multiple times.
Being able to present a prompt to everyone dialed and connect whomever responds to the prompt first would solve this problem, but it doesn't appear to be possible to do with the API as it stands, currently.
Twilio evangelist here.
So today you are right that in a simul-dial situation if one of the callers voicemail picks up immediately we don't distinguish between that and an a real person answering. The reality is that answering machine detection is pretty unreliable anyway which is why our existing AMD functionality is considered experimental and not done in this scenario.
One way I've seen this done is by placing a human check right at the beginning of a connected call. By using the <Gather> verb you basically prompt the caller to enter a value ("Press 1 if you are a human"), and if nothing happens you assume its not a human who answered. Once you know that you can remove then from the call group you are simul-dialing and then retry the others in the group.
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!

Resources