Twilio answering machine detection not leaving message - twilio
We are leaving a voice message (using an MP3) using Twilio's answering machine detection. We are seeing in our logs the correct calls to/from the API (answered by answering machine, post of our recorded message)...no error.
But the persons were are testing on, only 1/4 are actually getting a voicemail. The rest receive no voicemail, even though the logs show the correct API calls...? What is happening here?
Here is the code to call the twiml.
if (Request.Form["AnsweredBy"] != null)
{
switch (Request.Form["AnsweredBy"])
{
case "machine_end_beep":
case "machine_end_silence":
case "machine_end_other":
SaveTwilioMessage(transaction.Campaign.Id.ToString());
//var machineResponse = new VoiceResponse();
if (!string.IsNullOrWhiteSpace(transaction.Campaign.VoicemailMessageUrl))
{
response.Play(transaction.Campaign.VoicemailMessageUrl);
}
else
{
response.Say(transaction.Campaign.VoicemailMessage, voice: _voice);
}
return new TwiMLResult(response);
case "human":
case "fax":
case "unknown":
default:
break;
}
And here is the call that generates this:
var call = await CallResource.CreateAsync(url: callbackUrl, to: new PhoneNumber(phoneNumber), from: new PhoneNumber(fromPhone),machineDetection: "DetectMessageEnd");
var result = new TelephonicResource(call.Sid);
return result;
Any thoughts?
Twilio developer evangelist here.
When using Twilio's answering machine detection you have two options for detecting a machine. You set answering machine detection to on by supplying a MachineDetection parameter to the REST API request to make a call.
The MachineDetection parameter can be either Enable or DetectMessageEnd. If you want to leave a message after the answering machine message is complete you need to use DetectMessageEnd.
Then, when you get the webhook callback for the start of the call you get an extra parameter, AnsweredBy, which is either machine_end_beep, machine_end_silence, machine_end_other, human, fax or unknown.
If you get machine_end_beep, machine_end_silence or machine_end_other then you should be able to leave your message then. For other results you can handle them as you would a normal call.
If you just use MachineDetection=Enable then Twilio will attempt to connect you to the call with the result as soon as it has figured out if it is human or machine. If you want to leave a message, I would not choose this option.
Let me know if this helps at all.
Answering my own question here. Finally got some support from Twilio after pushing up through sales - after ticket remained open and unworked for days.
Basically, if you want to pull off AMD successfully, you need to be able to respond within 150ms. On our calls, the voice mails were starting, detecting no sound, and saying "we're sorry, but you're not talking...then our message would start". The correction was to do less DB lookups in our API calls by changing programming practice, and moving our MP3 to somewhere on the East coast (AWS preferred).
We investigated this...and found that while our API response was taking ~1 second, the AMD was sometimes waiting 15+ seconds after the beep to play the message. Still confused.
We are using Twilio AMD to broadcast phone appointment reminders, and have similar difficulty with leaving voicemail messages. Having tested this on about 50 calls, we see cases where the AMD detects a 'machine_end_silence' well before the 'beep' that should trigger the PLAY. So when you listen to the recorded call, the PLAY is occurring at the same time as the "your call has been forwarded to an automated voice messaging service...please leave a message...". So the API calls all look correct, but the user doesn't receive a voicemail (as the play message wav file ends just before the beep).
We saw other cases where the AMD doesn't hear the beep - and instead waits for the machineDetectionTimeout before playing the wav - leaving a long gap of dead air on the receivers voicemail. Even within my small development team we saw differences in behavior. For instance, we made test calls to a few iphones that all had the same default voicemail setup (the setup you get when you haven't recorded a custom greeting) on the same Verizon service plan. So the AMD should be hearing the exact same answer. Yet, AMD would detect the 'beep' on some of our phones, but not all of them.
Given all these challenges, we found that it's a good idea to leave a 'longer' version of the message (repeating the critical information a few times). Assuming your message is longer than the machineDetectinTimeout - you at least get some of your message saved on the voicemail.
Related
Say "one moment" after a Gather finishes
I can't seem to find any documentation on this, but I'd like to say "one moment" in a Gather block in between when a user stops speaking and when the speech recognition processor delivers the words they said (since anecdotally this can take a few seconds and result in dead air in the meantime). I can't seem to find anything like that in the documentation. All of the examples are for things like: <Response> <Gather> <Say>Voice prompt to read to the user before collection</Say> <Say>Say more things if you want</Say> </Gather> <Say>Something to say if the user doesn't provide feedback</Say> </Response> Having around 5 seconds of dead air isn't the worst thing ever, but it lacks polish.
Twilio developer evangelist here. There is nothing to provide for a message after the user finishes speaking to the <Gather> and after the speech result is ready and sent to the action URL, however I think you might be characterising the delay wrong. Twilio streams the voice to the speech detection service, so we get real time results (you can get partial results by setting a partialResultCallback URL). Instead, the time that elapses between the end of the caller speaking and the action being called is based on the timeout which is 5 seconds by default. What I would suggest is that you try different values for the speechTimout attribute including auto, which "will stop speech recognition when there is a pause in speech and return the results immediately." Let me know if that helps at all.
How to call 200 UK cell phones simultaneously and deliver a recorded message?
Working on a fun element for a big company event. I would like to find a way to call 200 UK cell/mobile numbers as simultaneously as possible and deliver the same recorded message to each of them. All of the target devices belong to people attending the event. Anybody managed to do something similar? I think I could do this with Twilio's APIs, but a more packaged solution is preferred. Any risk of overwhelming the local cells by trying to start a call with so many devices in the same area at once?
Twilio Evangelist here. This is totally possible with Twilio and some simple programming logic. With the numbers you have, you can loop through them and create phone calls like so (in Python): for num in number: # Create a phone call client.calls.create( to=num, from_='MY_TWILIO_NUMBER', url='http://mywebsite.com/instructions.xml' ) The url here (final line) will provide some basic TwiML to play an MP3 file. There are solutions for this available, but it is likely you'll be able to build this in software faster than you will be able to get the solution running, especially if this is for a one-time event and you have some software people handy. If you need any help, let me know!
Sending tones via a manual process with Twilio
Our call center deals with businesses and we use Twilio to make our calls. However, many businesses have a menu to navigate before we get to talk to someone. How can I create a 10-key pad on our end and use it to send menu selections to the call we are connected with? I know about the senddigits attribute on Dialing numbers with Twilio, but this sends preprogrammed tones. We have no way of knowing what the tones need to be until we are connected and in the menu, so this won't work. I've been through the API pretty thoroughly and can't seem to find anything relating to this. If there is nothing, is there another software that anyone can recommend that allows for making calls out, generating recordings of calls and allows me to send keytones manually after the call has been started?
Check out the digits attribute of the 'Play' tag. https://www.twilio.com/docs/api/twiml/play#attributes-digits Each 'w' character tells Twilio to wait 0.5 seconds instead of playing a digit.
Assuming I am understanding your problem, could you not us MP3s of DTMF tones (http://jetcityorange.com/dtmf/) and PLAY to send the tones after the call has started?
Twilio Detecting When On Hold
I've used Twilio to detect whether an outbound call gets a human or answering machine response, but now I'm trying to determine when I'm on hold and when the rep eventually picks up. The goal is to have a flag to know when I'm no longer on hold with the party I called. Is this simply impossible with Twilio? Do you know of any work-arounds or other services that I might explore?
There's nothing built into the Twilio API specific to this. You could maybe get away with playing a repeating prompt for someone to press a digit. The on hold time would never complete the prompt, but when a human picks up they would be able to and it would indicate their presence.
How to recognize fax numbers?
What should be the best way to recognize that a number is connected to a fax without actually sending faxes around ? I suppose that a short phone call can be made: the goal is to determine if a number that is declared as a fax line is really a fax line, working and available.
If you can make a phone call, many faxes create a "Fax Identification tone". This signal may be sent by the Terminating FAX machine anywhere between 1.8 to 2.5 seconds AFTER answering the call. The CED signal consists of a 2100 Hz tone that is from 2.6 to 4 seconds in duration. The CED tone is useful for disabling any echo cancellers on the line. The CED also incorporates a "silent" interval following the 2100 Hz tone. This interval lasts from 55 to 95 (75 +/- 20) mS. Following this interval, the Terminating FAX machine will initiate the Pre-Message Identification procedures by transmitting a 300 BPS "Line Turn-around" preamble. Some older faxes do not support that though, no idea how they can be triggered (i.e. by you sending a tone first, but that could be really annoying if you have a phone instead of a fax number)
I understand your question as that you have a list of fax-numbers in your customer database and want to verify that those numbers still are valid. Then you could use TAPI to programatically call those numbers and check if its a fax that answering, no need to actually send any fax, just connect and ask the device (fax) what capabilities it has. Here are Microsofts information about their TAPI An easier way could be to have a fax modem on the com-port and using ATI-commands to call the device and send ATX3D and see if the device answers with ATA. (Or something similar, it was ages ago I programmed modems..)
It's essentially impossible. They make line-sharing switch devices. For example, visit http://www.faxswitch.com/ to see their offerings. The line appears like a voice line until you send a fax recognition tone. Then the line switches to a fax machine, if one exists. So, a single number can be voice and fax.
A quick and dirty way of testing if a number is a fax number would be to google (using some API) for "Fax [number]". e.g. http://www.google.co.uk/search?q="Fax+01422+329262"
Not in New Zealand at least. Here, Fax-Numbers do not differ from normal numbers in terms of namespacing. A fax number may be only 1 digit ( the rightmost ) different from their normal line, or even a company may not have distinct FAX/Phone lines, and they just share a line and use tone detection to initiate fax protocol instead. Also, you don't need to register with anybody to have fax services work on your phone line, so there's no index you can look up to see if its a fax or not. The only way to know is initiate a call, and see if you get a fax response, and even then, if the Fax happens to be turned off, you'll get a false negative. I think your question may turn out to result in hunting for phantoms. Oh, and for additional fun, you may have desktops with their dialup modem plugged into the wall merely emulating a fax device :). If you don't want to include these as "fax machines". you will be most likely out-of-luck.
First, there isn't anything inherent in the number that identifies it as a fax line. Even the phone company doesn't know - it's just a device attached to the wall jack, by the customer. At some point you just have to trust the user. However, try the following ideas as well: On each fax, publish a number (preferably toll-free) where the recipient can call to cancel. In some localities this might be a requirement anyway - "unsolicited" faxes are considered abusive in much the same way as spam since they can entail both material and bandwidth costs for the recipient. This will protect you in the eventuality that someone subscribes a number that doesn't belong to them. Add some kind of error threshold to your software that will halt fax attempts once n attempts fail, and flag the number as inoperative. If you have some other way to contact the user, you could notify them of this event. The same principle works for e-mail addresses - I've received snail-mail notifications from companies when I changed e-mail addresses and forgot to notify them; once the e-mail had bounced a few times, they sent a courtesy letter to remind me to update it.
Many old fax lines are set to automatically pick up even on a voice call, so you could just call and check. On the other hand, it won't work on a lot of new ones, so while you could tell that one is a fax line, you couldn't tell it wasn't.
I'm sure a fax is a modem, so if you connected to it - using AT codes maybe (how 1990's!), you could determine from the response codes that there was a fax there - but you still have to make the call, make the negotiation etc - just dont send a page.