Skip to main content
  • What: Detects answering machines and voicemail on outbound calls so your app can react automatically (e.g., leave a voicemail instead of connecting to an agent)
  • How: Add machine_detection parameter to the Call API. Detection runs asynchronously in the background and posts Machine=true to your machine_detection_url
  • Action on detection: Use the Transfer API to reroute the call based on the result
  • Requires: A hosted web server to receive the machine_detection_url callback; a Plivo phone number for caller ID
  • Limitation: Detection is asynchronous only. It does not block the call flow while analyzing
You can enable answering machine or voicemail detection by including the machine_detection parameter when you make an outbound call using the Call API. Plivo runs machine detection in the background. When it finds a machine, Plivo makes an HTTP request, sending a Machine parameter with the value true to the machine_detection_url you specify. Your application can then make a decision based on this parameter. Chances are you’ll use the Transfer API to change the flow of the call. See the Asynchronous machine detection page of our API reference documentation for details on the parameters sent.

Getting started

  1. Sign up for a free Plivo trial account.
  2. Check out our server SDKs page and install the SDK for the programming language you want to use.
  3. Buy a Plivo phone number (optional). You need a Plivo phone number to receive calls. You can buy a Plivo phone number in more than 20 countries by visiting Phone Numbers > Buy Numbers in the Plivo console. Check the Voice API coverage page to see the supported countries.
  4. Use a web hosting service to host your web application. Many inexpensive cloud hosting providers cost just a few dollars a month. Follow the instructions of your hosting provider to host your web application.

Implementation

  1. Copy the code below into a text file and save it.
  2. Replace the placeholders <auth_id> and <auth_token> with your account’s Auth ID and Auth Token, which you can find on the overview page of the Plivo console.
  3. Add your from (source) phone number, which will show up as your caller ID. All phone numbers should include country code, area code, and phone number without spaces or dashes (e.g., 14153336666).
  4. Add your to (destination) phone number. To place bulk calls to more than one number, separate the destination phone numbers with the < character (e.g., 14156667777<14157778888<14158889999).
Note: If you’re using a trial account, your destination number needs to be verified with Plivo. Phone numbers can be verified at the Phone Numbers > Sandbox Numbers page of the console.
  1. Edit the answer_url field and supply a URL for Plivo to request when the call is answered. This URL supplies XML code that Plivo what to do with the call.
  2. Give the answer_method field a value of either GET or POST.
  3. Edit the machine_detection_url field and supply a URL for Plivo to request if an answering machine or voicemail is detected on the call.
  4. Give the machine_detection_method field a value of either GET or POST.

Code

Sample Response

Make Outbound call

XML returned by the answer_url

Machine Detection URL output