Voice Mail Detection

Voicemail is basically a digital answering machine. When you can’t pick up, callers can leave a message so you don’t miss anything important. It’s especially handy if you’re in a meeting, driving, or just can’t get to the phone in time.

The Main Problem

If a lot of your calls are landing in voicemail, you could be spending too much time and money on calls that never connect to a real person. This leads to wasted resources, and sometimes missed business opportunities.

The Solution: Early Voicemail Detection

By detecting voicemail right away, your VAPI Assistant can either hang up (if leaving a message isn’t necessary) or smoothly play a recorded message. This cuts down on useless call time and makes your entire call flow more efficient.

Two Ways to Detect Voicemail

1. Using Twilio’s Voicemail Detection

Twilio has built-in features to detect when a machine picks up. You configure these settings in your VAPI Assistant so it knows when a voicemail system has answered instead of a live person.

1voicemailDetection: {
2 provider: "twilio",
3 voicemailDetectionTypes: [
4 "machine_start",
5 "machine_end_beep",
6 "machine_end_silence",
7 "unknown",
8 "machine_end_other"
9 ],
10 enabled: true,
11 machineDetectionTimeout: 15,
12 machineDetectionSpeechThreshold: 2500,
13 machineDetectionSpeechEndThreshold: 2050,
14 machineDetectionSilenceTimeout: 2000
15}
  • provider: Tells VAPI to use Twilio’s system.
  • voicemailDetectionTypes: Defines the events that mean “voicemail.”
  • machineDetectionTimeout: How many seconds to wait to confirm a machine.
  • The other settings let you fine-tune how quickly or accurately Twilio identifies a machine based on speech or silence.

Quick Reference

SettingTypeValid RangeDefault
machineDetectionTimeoutnumber3 – 59 (sec)30 (sec)
machineDetectionSpeechThresholdnumber1000–6000 ms2400 ms
machineDetectionSpeechEndThresholdnumber500–5000 ms1200 ms
machineDetectionSilenceTimeoutnumber2000–10000 ms5000 ms

2. Using VAPI’s Built-In Voicemail Tool

VAPI also has an LLM-powered tool that listens for typical voicemail greetings or prompts in the call’s audio transcription. If you prefer an approach that relies more on phrasing and context clues, this is a great option.

1{
2 ...yourExistingSettings,
3 "model": {
4 "tools": [{ type: "voicemail" }]
5 }
6}

Here, tools: [{ type: "voicemail" }] signals that your VAPI Assistant should look for keywords or patterns indicating a voicemail greeting.

Combining Both Approaches

For the best of both worlds, you can enable Twilio’s detection and the built-in voicemail tool at the same time:

1{
2 ...yourExistingSettings,
3 voicemailDetection: {
4 provider: "twilio",
5 voicemailDetectionTypes: [
6 "machine_start",
7 "machine_end_beep",
8 "unknown"
9 ],
10 enabled: true,
11 machineDetectionTimeout: 15
12 },
13 model: {
14 tools: [{ type: "voicemail" }]
15 }
16}

When one method doesn’t catch it, the other might—boosting your overall detection accuracy.

Tips for Better Voicemail Handling

  1. Adjust Detection Timing

    Lower machineDetectionTimeout (e.g., to 5 seconds) if you want the system to decide faster. But remember, shorter timeouts can lead to occasional false positives.

  2. Fine-Tune Speech and Silence Thresholds

    For example:

    1{
    2 "provider": "twilio",
    3 "enabled": true,
    4 "machineDetectionTimeout": 5,
    5 "machineDetectionSpeechThreshold": 2400,
    6 "machineDetectionSpeechEndThreshold": 1000,
    7 "machineDetectionSilenceTimeout": 3000
    8}

    These values tweak how quickly Twilio “listens” for human speech or background silence.

  3. Think Through Your Call Flow

    • Give It Time: If you’re leaving a message, you might want to increase startSpeakingPlan.waitSeconds so the detection has enough time before the tone.
    • firstMessageMode: Setting it to assistant-waits-for-user can also give you smoother call handling—your assistant won’t barge in if someone unexpectedly picks up late

What Happens When a Call Ends?

  • Detected Voicemail + No Message: The call will end, and you’ll see a reason like customer-did-not-answer.
  • Detected Voicemail + Have a Message: Your assistant leaves the recorded message, and the call ends with a reason like voicemail.

Testing and Next Steps

  1. Make a Test Call: Dial a known voicemail number and watch how quickly (and accurately) your VAPI Assistant identifies the machine.
  2. Tweak Settings: Adjust your timeout and threshold values based on real-world performance.
  3. Repeat: Keep testing until you’re confident your configuration is catching voicemail reliably without cutting off real people.

By following these steps, you’ll save time, improve call-handling efficiency, and ensure your system feels more professional. If you need to fine-tune or add new features later, you can always revisit these settings and make quick adjustments.

Built with