Skip to main content

TeXML Answering Machine Detection Support

TeXML is an XML-based data structure you can use to control calls with Telnyx and is the quickest way to get started with Programmable Voice using a simple .xml file, allowing you to specify call instructions in your file using commands called verbs and nouns.

Initiating a TeXML outbound call using REST endpoint with AMD enabled

There are 2 possible options for using Answering Machine Detection for outbound calls:

  1. Synchronous mode: In this case, the TeXML instructions are not executed until the results of AMD process are provided in the status callback. The new instructions can be sent back as response to be processed by the TeXML engine.
  2. Asynchronous mode: Here, the TeXML instructions are processed in parallel to the AMD process. The results of the AMD analysis are being provided in the AsyncAmdStatusCallback callback.

Synchronous mode request

The outbound TeXML call with AMD support enable in the synchronous mode can be requested in the following way:

Note

Don't forget to update YOUR_API_KEY here.

    curl --request POST \
--url https://api.telnyx.com/v2/texml/calls/1773070540731319841 \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"From": "+13127367421",
"To": "marcin94919@sip.telnyx.com",
"Url": "http://90e9-89-64-38-85.ngrok.io/test/scenario/conference",
"FallbackUrl": "http://90e9-89-64-38-85.ngrok.io/test/scenario/conference",
"StatusCallback": "http://90e9-89-64-38-85.ngrok.io/test/callback/status",
"StatusCallbackMethod": "POST | GET",
"Method": "POST | GET",
"MachineDetection": "Enable | Disable (default) | DetectMessageEnd",
"DetectionMode" : "Regular (default) | Premium"
"AsyncAmd": "false"
}'

The results of the analysis will be sent as a value of the AnsweredBy parameter of the StatusCallback request.

Asynchronous mode request

Similarly, the asynchronous AMD processing can be requested for outgoing TeXML calls:

    curl --request POST \
--url https://api.telnyx.com/v2/texml/calls/1773070540731319841 \
--header 'Authorization: Bearer {TOKEN}' \
--header 'Content-Type: application/json' \
--data '{
"From": "+13127367421",
"To": "marcin94919@sip.telnyx.com",
"Url": "http://90e9-89-64-38-85.ngrok.io/test/scenario/conference",
"FallbackUrl": "http://90e9-89-64-38-85.ngrok.io/test/scenario/conference",
"Method": "POST",
"StatusCallback": "http://90e9-89-64-38-85.ngrok.io/test/callback/status",
"StatusCallbackMethod": "POST",
"MachineDetection": "Enable | Disable (default) | DetectMessageEnd",
"DetectionMode" : "Regular (default) | Premium"
"AsyncAmd": "true",
"AsyncAmdStatusCallback": "http://90e9-89-64-38-85.ngrok.io/test/callback/status",
"AsyncAMDStatusCallbackMethod": "POST",
}'

The results of the AMD analysis will be sent as callback requests to the address provided as AsyncAmdStatusCallback parameter. Note that this can be used for basic and premium AMD.

And that's it! If you have any questions about this tutorial or any of our products, reach out to our support team through the chat in the bottom right hand corner.