Objective
This article explains how to build a custom voicemail solution that first attempts to reach a user via a SIP endpoint and then falls back to a recorded message. It addresses common issues where customers miss calls and need an automated SMS notification with a direct link to the voicemail recording. By following this guide, you will configure a Studio Flow, handle A2P 10DLC compliance, and adjust security settings to ensure seamless media playback.
Product
Programmable Voice
Environment
Twilio Console
User Account Permission/Role(s) Required
Owner, Administrator
Procedure
1. Pre-Configuration and Compliance
Before building the workflow, you must prepare your environment to ensure messages are delivered and recordings are accessible.
- A2P 10DLC Registration: Ensure your Twilio Phone Number is associated with an approved A2P 10DLC Brand and Campaign. Without this, the SMS notification containing the voicemail link may be filtered by carriers.
- Disable Media Authentication: To allow the SMS recipient to click and listen to the voicemail without logging into Twilio, navigate to Voice > Settings > General. Locate Enforce HTTP Auth on Media and set it to Disabled, then click Save.
2. Creating the Studio Flow
- Navigate to Studio > Flows and click Create new Flow.
- Name the flow (e.g.,
Voicemail_Logic) and select Start from scratch. -
Connect Caller Widget: Drag a Connect Call To widget onto the canvas and connect it to the Incoming Call trigger.
- Noun: SIP
-
SIP Endpoint: Enter your URI (e.g.,
sip:yourname@yourdomain.sip.twilio.com). - Timeout: Set to 30 seconds (this determines how long the system rings before going to voicemail).
-
Say/Play Widget: Drag a Say/Play widget and connect the Connected Call Ended transitions from the previous widget to it.
- Text to Say: "Hi! We can't take your call right now. Please leave a message after the beep."
-
Record Voicemail Widget: Drag a Record widget and connect it to the Audio Complete transition of the Say/Play widget.
- Trim: Select Trim Silence.
- Max Length: Set as desired (e.g., 300 seconds).
-
Send Message Widget: Drag a Send Message widget and connect the Recording Complete transition from the Record widget to it.
- In advance settings in the "To" field: Enter the mobile number that should receive the notification.
-
Message Body: Copy and paste the following code:
New Voicemail from: {{trigger.call.From}}. Listen here: {{widgets.record_voicemail_1.RecordingUrl}}
3. Linking the Flow to a Phone Number
- Navigate to Phone Numbers > Active Numbers.
- Click on the number you wish to use.
- Under the Voice & Fax section, set Configure With to Studio Flow.
- Select your new flow from the dropdown and click Save.
4. Accessing Recordings without SMS
If you choose not to use the SMS notification, or need to review historical messages:
- Navigate to Monitor > Logs > Recordings.
- All captured voicemails will be listed here with the date, caller ID, and a play button for direct browser playback.
Additional Information
- Formatting: Ensure the "To" number in the Send Message widget uses E.164 format (e.g., +15551234567).
- Troubleshooting: If the link in the SMS prompts for a login, double-check that Enforce HTTP Auth on Media is truly disabled in the Voice Settings.
- Documentation: For more advanced configurations, refer to the Twilio Studio Widget Library.