Answering Machine Detection

Beta: Enhanced Answering Machine Detection

Answering Machine Detection enables you to determine if a human, answering machine or fax machine has picked up an outbound voice API call and tailor your call flow accordingly. This feature allows you to leave a message on an answering machine if you desire. The public beta for Answering Machine Detection supports calling to the US, Canada, United Kingdom, Netherlands, Finland and Sweden. If you desire to use the new AMD system in a country that is not listed, please contact support and we will add that country to our backlog.

Twilio's Answering Machine Detection system is powered by a machine learning algorithm trained on thousands of call samples. We have tuned the system to balance recognition speed and accuracy. Our AMD system has a 94% accuracy rate across a large call sample set, and is tuned with a bias towards recognizing humans, which prioritizes the experience for human callers over answering machines. AMD is priced at $.0075 per call.

Making A Call with AMD

New REST API Parameters
Parameter Allowed Values Default Value
MachineDetection Enable or DetectMessageEnd none
MachineDetectionTimeout 1-120 30

MachineDetection

Use Enable if you would like Twilio to return an AnsweredBy value as soon as it identifies the called party. This is useful if you would like to leave a message to a human but hang up on a machine. If you would like to leave a message on an answering machine specify DetectMessageEnd. In that case, Twilio will return a AnsweredBy value once the end of the answering machine greeting is reached. If both SendDigits and MachineDetection parameters are provided, then MachineDetection will be ignored.

MachineDetectionTimeout

The number of seconds that Twilio should attempt to perform answering machine detection before timing out and firing the Answered webhook with AnsweredBy as unknown. If you are receiving too many unknown responses, increase this value.

Loading Code Samples...
Language
Format:
  • JSON
curl 'https://api.twilio.com/2010-04-01/Accounts/AC22ef5e6f64bf40a6ac84123ae4fb9fa7/Calls.json' -X POST \
--data-urlencode 'To=+1562300000' \
--data-urlencode 'From=+18180000000' \
--data-urlencode 'MachineDetection=Enable' \
--data-urlencode 'Url=https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16' \
-u AC22ef5e6f64bf40a6ac84123ae4fb9fa7:[AuthToken]
{
  "sid": "CA2ee3a4bce40452c7f7a0a43fcd24b301",
  "date_created": null,
  "date_updated": null,
  "parent_call_sid": null,
  "account_sid": "AC22ef5e6f64bf40a6ac84123ae4fb9fa7",
  "to": "+1562300000",
  "to_formatted": "(562) 300-0000",
  "from": "+18180000000",
  "from_formatted": "(818) 000-0000",
  "phone_number_sid": "PNe8bab76ac59a79c26b3f6490d8075a91",
  "status": "queued",
  "start_time": null,
  "end_time": null,
  "duration": null,
  "price": null,
  "price_unit": "USD",
  "direction": "outbound-api",
  "answered_by": null,
  "api_version": "2010-04-01",
  "annotation": null,
  "forwarded_from": null,
  "group_sid": null,
  "caller_name": null,
  "uri": "\/2010-04-01\/Accounts\/AC22ef5e6f64bf40a6ac84123ae4fb9fa7\/Calls\/CA2ee3a4bce40452c7f7a0a43fcd24b301.json",
  "subresource_uris": {
    "notifications": "\/2010-04-01\/Accounts\/AC22ef5e6f64bf40a6ac84123ae4fb9fa7\/Calls\/CA2ee3a4bce40452c7f7a0a43fcd24b301\/Notifications.json",
    "recordings": "\/2010-04-01\/Accounts\/AC22ef5e6f64bf40a6ac84123ae4fb9fa7\/Calls\/CA2ee3a4bce40452c7f7a0a43fcd24b301\/Recordings.json"
  }
}
Create a call with enhanced AMD
Make Call with AMD

Create a call with enhanced AMD

New Webhook Parameters
Parameter Description
AnsweredBy The result of answering machine detection. If Enable was specified, results can be: machine_start, human, fax, unknown. If DetectMessageEnd was specified, results can be: machine_end_beep, machine_end_silence, machine_end_other, human, fax, unknown.

Pricing

Enhanced Answering Machine Detection will be charged at $.0075 per call where enabled and the called party picks up (either a human, fax, or an answering machine). Busy or Failed calls may engage our AMD system but will not be charged.

Best Practices

The lifecycle of a call using AMD is below. The user experience for a recipient of a call using AMD is impacted if there is a delay from the time they picks up the phone to the first packet of audio they hear. Twilio has optimized our AMD system to quickly classify calls, it is important to also optimize your application to respond quickly to TwiML requests.

 

AMD Call Progress

 

Optimize TwiML Responses

To minimize delay, ensure you benchmark your application to ensure that webhooks from Twilio are processed and responded in a timely manner. In test applications running in EC2 we can get this time under 150ms, TwiML served from TwiMLBins can come in under 100ms.

Cache Static TwiML and Media for Play Verbs

If you are using Play verbs we recommend hosting your media in AWS S3 in US East 1. No matter where you host your media files, ensure that you're setting appropriate Cache Control headers. Twilio uses a caching proxy in it's webhook pipeline and will cache media files that have cache headers. Serving media out of Twilio's cache can take 10ms or less, keep in mind that we run a fleet of caching proxies so it may take 10 or so requests before all of the proxies have a copy of your file in cache.

Request Inspector

To help you benchmark your server's response time to Twilio, we expose the request duration in milliseconds for every request in the request inspector. You can view these clicking into the call detail page in the console.

Request Inspector Fetch Time

 

Backwards Compatibility

Enhanced Answering Machine Detection is not backwards compatible with IfMachine. It accepts different POST parameters and AnsweredBy returns different values. IfMachine is considered deprecated and will be removed from the documentation.

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.

1 / 1
Loading Code Samples...
Format:
  • JSON
curl 'https://api.twilio.com/2010-04-01/Accounts/AC22ef5e6f64bf40a6ac84123ae4fb9fa7/Calls.json' -X POST \
--data-urlencode 'To=+1562300000' \
--data-urlencode 'From=+18180000000' \
--data-urlencode 'MachineDetection=Enable' \
--data-urlencode 'Url=https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16' \
-u AC22ef5e6f64bf40a6ac84123ae4fb9fa7:[AuthToken]
{
  "sid": "CA2ee3a4bce40452c7f7a0a43fcd24b301",
  "date_created": null,
  "date_updated": null,
  "parent_call_sid": null,
  "account_sid": "AC22ef5e6f64bf40a6ac84123ae4fb9fa7",
  "to": "+1562300000",
  "to_formatted": "(562) 300-0000",
  "from": "+18180000000",
  "from_formatted": "(818) 000-0000",
  "phone_number_sid": "PNe8bab76ac59a79c26b3f6490d8075a91",
  "status": "queued",
  "start_time": null,
  "end_time": null,
  "duration": null,
  "price": null,
  "price_unit": "USD",
  "direction": "outbound-api",
  "answered_by": null,
  "api_version": "2010-04-01",
  "annotation": null,
  "forwarded_from": null,
  "group_sid": null,
  "caller_name": null,
  "uri": "\/2010-04-01\/Accounts\/AC22ef5e6f64bf40a6ac84123ae4fb9fa7\/Calls\/CA2ee3a4bce40452c7f7a0a43fcd24b301.json",
  "subresource_uris": {
    "notifications": "\/2010-04-01\/Accounts\/AC22ef5e6f64bf40a6ac84123ae4fb9fa7\/Calls\/CA2ee3a4bce40452c7f7a0a43fcd24b301\/Notifications.json",
    "recordings": "\/2010-04-01\/Accounts\/AC22ef5e6f64bf40a6ac84123ae4fb9fa7\/Calls\/CA2ee3a4bce40452c7f7a0a43fcd24b301\/Recordings.json"
  }
}