Answering Machine Detection

Beta: Enhanced 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. 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. AMD is priced at $.0075 per call.

Update on Answering Machine Detection (AMD) Beta

We have received mixed feedback from our customers regarding the performance of Answering Machine Detection (AMD) during the beta process that includes:

  • Speed of detection when human picks up the phone; while our goal is to detect a human in shortest possible time, we have received feedback that it can take several seconds to reliably detect a human, resulting in silence on the line.
  • Inconsistency in detecting voicemail beep causing incomplete or missing voicemail messages.
  • Inconsistency in detecting fax machines.

We have taken this feedback seriously and started working on improving the performance of the AMD, which we hope to make it available for you to test by Q3 2018. While we had hoped to make AMD GA by Q2, we want to make sure that the product we release meets the quality and standards that our customers expect from us. In the interim, you can continue to use AMD if you find its performance to be acceptable to your use case, but there are no adjustments we can make to improve the performance of current state of AMD.

Making A Call with AMD

REST API Parameters

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 unknownresponses, increase this value.

Parameter Allowed Values Default Value
MachineDetection Enable or DetectMessageEnd none
MachineDetectionTimeout 1-120 30
Loading Code Samples...
Language
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// Download the helper library from https://www.twilio.com/docs/node/install
// Your Account Sid and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.calls
  .create({
     machineDetection: 'Enable',
     url: 'https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16',
     to: '+1562300000',
     from: '+18180000000'
   })
  .then(call => console.log(call.sid))
  .done();
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;


class Program 
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var call = CallResource.Create(
            machineDetection: "Enable",
            url: new Uri("https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16"),
            to: new Twilio.Types.PhoneNumber("+1562300000"),
            from: new Twilio.Types.PhoneNumber("+18180000000"),
            pathAccountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        );

        Console.WriteLine(call.Sid);
    }
}
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once '/path/to/vendor/autoload.php';

use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/console
$sid    = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token  = "your_auth_token";
$twilio = new Client($sid, $token);

$call = $twilio->calls
               ->create("+1562300000",
                        "+18180000000",
                        array(
                            "machineDetection" => "Enable",
                            "url" => "https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16"
                        )
               );

print($call->sid);
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'rubygems'
require 'twilio-ruby'

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

call = @client.calls
  .create(
     machine_detection: 'Enable',
     url: 'https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16',
     to: '+1562300000',
     from: '+18180000000'
   )

puts call.sid
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client


# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

call = client.calls \
    .create(
         machine_detection='Enable',
         url='https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16',
         to='+1562300000',
         from_='+18180000000'
     )

print(call.sid)
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Call;
import com.twilio.type.PhoneNumber;

import java.net.URI;

public class Example {
    // Find your Account Sid and Token at twilio.com/console
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Call call = Call.creator(
                new com.twilio.type.PhoneNumber("+1562300000"),
                new com.twilio.type.PhoneNumber("+18180000000"),
                URI.create("https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16"))
            .setMachineDetection("Enable").create();

        System.out.println(call.getSid());
    }
}
curl -X POST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls.json \
--data-urlencode "MachineDetection=Enable" \
--data-urlencode "Url=https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16" \
--data-urlencode "To=+1562300000" \
--data-urlencode "From=+18180000000" \
-u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
{
  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "annotation": null,
  "answered_by": null,
  "api_version": "2010-04-01",
  "caller_name": null,
  "date_created": "Tue, 31 Aug 2010 20:36:28 +0000",
  "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000",
  "direction": "inbound",
  "duration": "15",
  "end_time": "Tue, 31 Aug 2010 20:36:44 +0000",
  "forwarded_from": "+141586753093",
  "from": "+18180000000",
  "from_formatted": "(818) 000-0000",
  "group_sid": "GPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "parent_call_sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "price": "-0.03000",
  "price_unit": "USD",
  "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "start_time": "Tue, 31 Aug 2010 20:36:29 +0000",
  "status": "completed",
  "subresource_uris": {
    "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json",
    "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json",
    "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json",
    "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json"
  },
  "to": "+1562300000",
  "to_formatted": "+1562300000",
  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
  "machine_detection": "Enable",
  "url": "https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16"
}
Create a call with enhanced AMD
Make a Call with Answering Machine Detection

Create a call with enhanced AMD

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, a fax, or an answering machine). Busy or Failed calls may engage our AMD system but will not be charged.

Supported Countries

While Enhanced Answering Machine Detection works for all countries, it is specifically tuned for the following countries:

  • USA/Canada
  • UK
  • Netherlands
  • Sweden
  • Finland
  • Germany
  • France

We are working on extending this list of specifically tuned countries. If your particular country is not on the list, we encourage you to try out the different country variants to find a good fit.

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

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.

Loading Code Samples...
SDK Version:
  • 5.x
Response Format:
  • json
SDK Version:
  • 7.x
SDK Version:
  • 3.x
SDK Version:
  • 5.x
SDK Version:
  • 6.x
SDK Version:
  • 5.x
Format:
  • JSON
// Download the helper library from https://www.twilio.com/docs/node/install
// Your Account Sid and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.calls
  .create({
     machineDetection: 'Enable',
     url: 'https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16',
     to: '+1562300000',
     from: '+18180000000'
   })
  .then(call => console.log(call.sid))
  .done();
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;


class Program 
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var call = CallResource.Create(
            machineDetection: "Enable",
            url: new Uri("https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16"),
            to: new Twilio.Types.PhoneNumber("+1562300000"),
            from: new Twilio.Types.PhoneNumber("+18180000000"),
            pathAccountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        );

        Console.WriteLine(call.Sid);
    }
}
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once '/path/to/vendor/autoload.php';

use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/console
$sid    = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token  = "your_auth_token";
$twilio = new Client($sid, $token);

$call = $twilio->calls
               ->create("+1562300000",
                        "+18180000000",
                        array(
                            "machineDetection" => "Enable",
                            "url" => "https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16"
                        )
               );

print($call->sid);
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'rubygems'
require 'twilio-ruby'

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

call = @client.calls
  .create(
     machine_detection: 'Enable',
     url: 'https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16',
     to: '+1562300000',
     from: '+18180000000'
   )

puts call.sid
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client


# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

call = client.calls \
    .create(
         machine_detection='Enable',
         url='https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16',
         to='+1562300000',
         from_='+18180000000'
     )

print(call.sid)
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Call;
import com.twilio.type.PhoneNumber;

import java.net.URI;

public class Example {
    // Find your Account Sid and Token at twilio.com/console
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Call call = Call.creator(
                new com.twilio.type.PhoneNumber("+1562300000"),
                new com.twilio.type.PhoneNumber("+18180000000"),
                URI.create("https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16"))
            .setMachineDetection("Enable").create();

        System.out.println(call.getSid());
    }
}
curl -X POST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls.json \
--data-urlencode "MachineDetection=Enable" \
--data-urlencode "Url=https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16" \
--data-urlencode "To=+1562300000" \
--data-urlencode "From=+18180000000" \
-u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
{
  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "annotation": null,
  "answered_by": null,
  "api_version": "2010-04-01",
  "caller_name": null,
  "date_created": "Tue, 31 Aug 2010 20:36:28 +0000",
  "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000",
  "direction": "inbound",
  "duration": "15",
  "end_time": "Tue, 31 Aug 2010 20:36:44 +0000",
  "forwarded_from": "+141586753093",
  "from": "+18180000000",
  "from_formatted": "(818) 000-0000",
  "group_sid": "GPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "parent_call_sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "price": "-0.03000",
  "price_unit": "USD",
  "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "start_time": "Tue, 31 Aug 2010 20:36:29 +0000",
  "status": "completed",
  "subresource_uris": {
    "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json",
    "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json",
    "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json",
    "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json"
  },
  "to": "+1562300000",
  "to_formatted": "+1562300000",
  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
  "machine_detection": "Enable",
  "url": "https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16"
}