Problems with verb Record timeout when calling an IVR - twilio

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.

Related

Testing our IVR - Twilio send_digits

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>

Twilio Stream only when the call has been received

I am using twiml bin attached to one of my twilio numbers.
When a person calls that number it should be able to dial multiple numbers. I want to stream the call only when the call has been picked up. There can be multiple ongoing streams associated with a twilio number.
<Response>
<Start>
<Stream track="both_tracks" url="wss://XXXX.ngrok.io /twilio-stream">
</Stream>
</Start>
<Dial answerOnBridge="true" >
<Number>+91XXXXXXXXX</Number>
<Number>+91XXXXXXXXX</Number>
</Dial>
</Response>
The above twiml starts the stream as soon as the number is dialed. I want it to start the stream only when the call is received at the other end.
Unfortunately, there isn't a way to do this today, without REST API endpoint control.
You can use the REST API Calls resource to initiate calls intead. The approach you are taking doesn't work very well when the dialed parties are mobile end-points in poor coverage areas and/or devices with voicemail enabled.

Forwarding to multiple destinations with Twilio functions

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.

Clarification on Twilio's Record and Transcribe Feature

I'm looking at Twilio's API documentation for Record and wanted some clarification.
1) I saw that transcribe currently is limited to recordings of 2 minutes, so if I set Transcribe to true, if the call goes on longer than 2 minutes there won't be a transcript but the recording will be saved?
2) Is it possible to just dial a number and record the audio without having to be connected to an "agent"?
Twilio developer evangelist here.
Yes, you're right. The recording will still be saved and you will receive a warning written to your debug log. You can transcribe entire calls up to 4 hours long using a couple of add-ons that are available in the Twilio add-on marketplace.
There are a number of ways to record a call.
<Record> in TwiML
<Dial record> in TwiML
<Conference record> in TwiML
Record=true in Outbound REST API
Enabling recording on elastic SIP Trunk in Console
If you are looking to record a whole call, then setting Record=true when creating a call.
If you are doing this for an incoming call, then you can't record the entire call, but that's where setting record on <Dial> or <Conference> or using the <Record> element comes into play. <Dial> or <Conference> likely include an agent, so <Record> is still what you're looking for here.
Let me know if that helps at all.

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