Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Answering Machine Detection

Public Beta: Answering Machine Detection

Answering Machine Detection, often called AMD, 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. Twilio's Public Beta Answering Machine Detection system is powered by an algorithm trained on thousands of call samples. We have tuned the system defaults to balance recognition speed and accuracy, but also provide a way for you to tune the performance of the engine based on your use case, via optional API parameters. AMD is priced at $.0075 per call.

Please see the following API parameters for configuring AMD on your outbound call.

Making A Call with AMD

REST API Parameters

Required Parameters

Values : Enable or DetectMessageEnd
Default : none

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 take a specific action (e.g. connect to an agent, play a message) for a human but hang up on a machine.

If you would like to leave a voicemail on an answering machine, specify DetectMessageEnd. In that case, Twilio will return AnsweredBy immediately when a human is detected but for an answering machine, AnsweredBy is returned only once the end of the greeting is reached. If both SendDigits and MachineDetection parameters are provided, then MachineDetection will be ignored.
Optional Parameters

Values: 3-120
Default: 30

The number of seconds that Twilio should attempt to perform answering machine detection before timing out and returning AnsweredBy as unknown.

Values: 1000-6000
Default: 2400

The number of milliseconds that is used as the measuring stick for the length of the speech activity, where durations lower than this value will be interpreted as a human and longer than this value as a machine.

Values: 500-5000
Default: 1200

The number of milliseconds of silence after speech activity at which point the speech activity is considered complete.

Values: 2000-10000
Default: 5000

The number of milliseconds of initial silence after which an unknown AnsweredBy result will be returned.
        Create a call with AMD

        Webhook Parameters

        AMD results are returned in the AnsweredBy parameter of the webhook issued to the URL you provide in the outbound call request.

        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


        Answering Machine Detection will be charged at $.0075 per call where enabled and the called party picks up. Busy or Failed calls may engage our AMD system but will not be charged.

        AMD Best Practices

        The life cycle 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 pick 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.

        Twilio 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 its 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.

        Benchmark Response Time with the 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.

        Fetch Time with the Request Inspector

        Backwards Compatibility

        Our Public Beta Answering Machine Detection solution is not backwards compatible with our legacy solution, IfMachine. It accepts different POST parameters and AnsweredBy returns different values. IfMachine is considered deprecated and will be removed from the documentation.

        Rate this page:

        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.