Answering Machine Detection
Integrating Answering Machine Detection (AMD) into any SPOTBuild application is easy. There are a few things to keep in mind however, and we cover them here.
Take a look at the application below. It represents an outbound campaign that plays a prompt upon answer. If the answering party is Human, they hear the Announcement prompt. If Machine, they get the Message prompt. Let’s step through the details.
Start with the Outdial node. The configuration shows how to access variables passed in during the API invocation; for this example, the destination phone number and the Id (that shows up on the called party’s phone). In the next diagram, we enable the Failed and Disconnected ports on the Outdial node; it is good practice to route them. If our dial attempt results in either of these events, we simply end the application. It is also good practice to give connections a unique name.
When the call gets connected, we asynchronously start two actions using the Fork node. Why? You might wonder…In an outbound campaign scenario, the idea is to start playing some type of human announcement once the call is answered. With this action in progress, the application tries to determine whether the party on the line is a human or machine. If it’s a machine, we typically want to stop the human prompt and leave a suitable voice message. Our asynchronous actions allow us to fulfill these requirements.
One action uses the built in AMD node to make an initial judgment about the answering party.
If the result of this is Human, we begin playing the human Announcement.
We don’t need to do anything if the result is Machine. Our other action (running in the background) will handle it. This action is a Prompt node configured with a special grammar to detect a beep.
beep.grxml - Copy and paste into file and upload as “Custom Voice” under Collect in the prompt node.
<?xml version="1.0" encoding="ISO-8859-1"?> <grammar xml:lang="en-US" version="1.0" root="Hotword_beep" tag-format="semantics/1.0.2006" xmlns="http://www.w3.org/2001/06/grammar"> <meta name="switch_license_type" content="AMD"/> <meta name="AMD_CUSTOM_INPUT_TEXT" content="beep"/> <meta name="AMD_CUSTOM_INTERPRETATION" content="beep"/> <rule id="Hotword_beep" scope="public"> <item> beep </item> </rule> </grammar>
It is important to set the Timeout property on this node to a reasonable length that covers most voice mail box greetings (could be up to 2 mins). The machine beep typically comes after the voice mail greeting, and this is what we are listening for. If the beep is Matched, we will start playing the machine Message prompt (any ongoing prompt will be interrupted at this point).
Notes: The other outcomes from the beep detect action will lead to playing the human Announcement. These cover cases where we initially thought we were connected to a machine but we never detected a beep. Also, it is important that the beep detect action is configured to last slightly longer than the Human Announcement. This will prevent an unwanted loop.
Once our prompt (human or machine) is done playing, we end our application.
We would love to hear from you; questions, suggestions for improvements, alternative approaches. Drop us a line…