Testing our IVR - Twilio send_digits - twilio

I am building a machine to bounce with our company's IVR. For that I need a degenerated IVR and specifically I wish to have it receiving a call and sending_digits to the IVR.
I could not figure out how to send_digits without first calling the other party.
Using python for this matter.
Can someone spill light on this?

Twilio developer evangelist here.
I think you are asking how to receive a call on a Twilio number and play DTMF tones. If so, you can do that using the <Play> TwiML element.
<Play> normally expects a URL that plays an audio file. However, you can also pass the digits attribute which will direct Twilio to send the DTMF tones down the line.
You can add any digits you like as well as pauses using the w character. A single w will wait for half a second and you can use multiple in a row. For example this TwiML will direct Twilio to send the digits 123 then wait 1 second, then send 456, then end the call.
<Response>
<Play digits="123ww456"/>
</Response>

Related

How to detect Touch-tones (DTMF) in a Twilio video room

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.

Dual-Channel Recording Using Twilio?

I have been trying to record 2 channels using Twilio by setting up a conference call. This is what I have implemented:
<Response>
<Say>Your call is being recorded</Say>
<Dial record="record-from-answer-dual" timeLimit="330" trim="trim-silence">
<Conference waitUrl="">
Conference Room
</Conference>
</Dial>
</Response>
How it works is that I will call the twilio number first. then add another number to the call so its 3 way, with the twilio number being silence. I found I am not getting 2 separate channel between the 2 speaker. Instead, I think Twilio is using itself as one of the channel, and the original caller as the other. Is there a way to configure so that we can get triple channel to include or a way to set it so it doesn't consider itself as a channel?
Twilio developer evangelist here.
When you use record-from-answer-dual with a <Conference> the documentation says:
If a dual-channel recording option is used for a <Dial> with a nested <Conference>, the resulting recording file will have two channels. The parent leg (inbound caller) is represented in the first channel. The second channel includes the audio coming downstream from the conference.
There is not currently a way to make a triple channel recording.

Problems with verb Record timeout when calling an IVR

We're trying to use Twilio to create an automated test framework for those IVRs.
We do an outbound call from Twilio to the IVR, use the verb Say/Play to interact with the IVR and we're using Record to capture what the IVR is saying, latter we transcribe it and make the assertions.
When I ask Twilio to call a phone number and I pretend to be the IVR, everything works perfectly. But when I ask Twilio to call the real IVR, apparently the Record verb can't recognize the pauses, when the IVR stops talking and is waiting for some input.
We tried tweak the timeout attribute but no luck, it records everything and only when the IVR ends the call, Twilio give me the callback with the entire recording. We want each interaction with the IVR in a separate audio, the way we have when I'm pretending.
Here is an example of the TwiML with the Record verb:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Record action="http://foo/nextStep"
method="POST"
playBeep="false"
recordingStatusCallback="http://foo/recordStatus"
timeout="2"
transcribe="false"
trim="do-not-trim" />
</Response>
Twilio developer evangelist here.
Rather than using <Record> for this, I would recommend using <Gather input="speech">. The intention of speech input with <Gather> is to react to input to build a voice enabled IVR, but I can only imagine that it will work better in this testing scenario too. It will live transcribe the results for you in place of returning the recordings for you.
Let me know if that helps.

Add forwarding number to the Twilio number programmatically

How to forward the call to an US local Twilio number from any mobile to any US number?
Its seems to me that I will have to use TwiML to achieve that. Moreover, the supporting doc in https://support.twilio.com/hc/en-us/articles/223179908-Setting-up-call-forwarding#devs is not seeming to show the TwiML correctly. And also with that way I will have to use verb.
Can I not directly call from the number pad of my mobile to the Twilio number so that the call can be received from the forwarding number?
Can I not set a forwarding number to the purchased number programmatically?
Twilio evangelist here.
To forward a call made from your mobile device to a Twilio number to another US phone number you can use the <Dial> verb:
<Response>
<Dial callerId="[your_twilio_phone_number]">[target_phone_number]</Dial>
</Response>
This part of the Voice Quickstart for PHP shows this and might be useful for you:
https://www.twilio.com/docs/quickstart/php/twiml/connect-call-to-second-person
Hope that helps.
This was what I went with before getting the answer from Twilio support but after the answer from #Devin Rader and from my client.
here is a great tutorial doing call forwarding programmatically,
https://www.twilio.com/docs/tutorials/walkthrough/call-tracking/php/laravel.
Yes, you can definitely set the TwiML programmatically on the numbers,
take a look at the documentation on provisioning phone numbers,
https://www.twilio.com/docs/api/rest/incoming-phone-numbers. You can
also set the number so that Twilio makes a call to your application
and your application delivers TwiML dynamically.

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