How to Set Up Simple Voicemail

A popular and important use case is how to record a voicemail from your callers when you are unable to speak with them. This guide will show how to do exactly that!

How to Set Up Voicemail with XML Bins

The following code uses Say to play the voicemail prompt to a caller and Record to record a message. We will then redirect to a new bin when the recording is finished that will use Hangup to hang up the call.

In this bin, we will use a simple Say to play the voicemail prompt and then use Record to initiate the recording. We will also specify a max length of seconds for the recording and a key that when pressed will execute a new document of instructions. If you do not specify an action URL within the record verb, the recording prompt will loop over and over.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Say>
        Please leave a message with your name and number at the beep.
        Press the pound key when finished.
    </Say>
    <Record
        action='Path-To-Hangup-Bin'
        maxLength="15"
        finishOnKey="#"
        />
</Response>

The next bin will play a short prompt advising the caller that they will be contacted and then it will hang up the call. Even though this bin is simple, it's very important to avoid looping calls after a recording!

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say> Thank you for your message. A member of our team will contact you shortly. Goodbye!</Say> 
  <Hangup/>
</Response>

How to Assign the Bin to a SignalWire Phone Number

Read here for more information about webhooks and how they work with SignalWire!

Click the Phone Numbers tab on your lefthand side nav within your SignalWire space, and click the specific number you would like to set up call forwarding on. If you don't have a number yet, now is the time to buy one!

Make sure that Accept Calls As is set to Voice Calls, Handle Calls Using is set to LaML Webhooks, and paste your Bin URL in as the value for When a Call Comes In. Click Save, and you're done! Inbound calls to this SignalWire DID will forward to the number you specified in the of the bin.

How to Access the Recordings

To access your recordings, click the LaML tab on the left-hand side nav. Click Recordings, and you will be able to view, listen, and download your recording files. You will also see the call ID and recording ID that you can use to access recordings via our API.

How to Deal with Voicemail on Outbound Calls

On a related note is how to deal with voicemail on outbound calls rather than taking voicemail on your inbound calls. The ability to deal with this is called Answering Machine Detection!

When a call is initiated with the machine_detection parameter set to DetectMessageEnd, a parameter is posted to the webhook called AnsweredBy. The potential options here are machine_end_other, machine_end_beep, machine_end_silence, and human. You can program your webhook to respond differently for each of these settings depending on your use case and how you want to handle them.

You can read a guide about how answering machine detection works here and fork the example on GitHub or run it in docker!


Did this page help you?