Telecom

Asterisk Voicemail: Voicemail Dialplan Config (Latest Versions)

MYLINEHUB Team • 2026-02-10 • 10 min

Updated guide for modern Asterisk (PJSIP era): voicemail dialplan config with real configs, common mistakes, and troubleshooting steps.

Asterisk Voicemail: Voicemail Dialplan Config (Latest Versions)

Setting up voicemail is not only about creating mailboxes. The real production work is in the dialplan configuration: deciding when voicemail triggers, which greeting plays, how missed calls are handled, and how users access their voicemail safely.

This guide explains how to configure voicemail properly in the dialplan for modern Asterisk (PJSIP), with clean patterns that scale.

You will learn the exact dialplan structures businesses use: inbound voicemail fallback, busy/unavailable greetings, voicemail access extensions, and call-flow safety checks.

Voicemail Dialplan Components

A production voicemail dialplan typically includes:

  • Inbound call routing with voicemail fallback
  • DIALSTATUS-based greeting selection (busy vs unavailable)
  • Direct-to-voicemail feature codes (optional)
  • Voicemail access number for employees
  • Message waiting indication support (optional)

Step 1 — Define Mailboxes in voicemail.conf

Voicemail dialplan only works if mailboxes exist. Example:

/etc/asterisk/voicemail.conf

[default]
1001 => 1234,Agent 1001,agent1001@example.com
1002 => 4321,Agent 1002,agent1002@example.com

Mailbox format:

mailbox => PIN,Name,Email

Step 2 — Basic Voicemail Fallback After Dial()

Simple (works, but not perfect):

[from-trunk]
exten => s,1,Answer()
 same => n,Dial(PJSIP/1001,20)
 same => n,Voicemail(1001@default)
 same => n,Hangup()

This sends all failures to voicemail, even BUSY. In production, you usually want separate greetings.

Step 3 — Correct Voicemail Logic Using DIALSTATUS

This is the recommended pattern:

[from-trunk]
exten => s,1,Answer()
 same => n,Set(__CALLED_EXT=1001)
 same => n,Dial(PJSIP/${CALLED_EXT},20,tT)

 ; After Dial(), route based on result
 same => n,GotoIf($["${DIALSTATUS}"="BUSY"]?vm_busy)
 same => n,GotoIf($["${DIALSTATUS}"="NOANSWER"]?vm_unavail)
 same => n,GotoIf($["${DIALSTATUS}"="CHANUNAVAIL"]?vm_unavail)
 same => n,GotoIf($["${DIALSTATUS}"="CONGESTION"]?vm_unavail)

 ; Default fallback
 same => n,Goto(vm_unavail)

 same => n(vm_busy),Voicemail(${CALLED_EXT}@default,b)
 same => n,Hangup()

 same => n(vm_unavail),Voicemail(${CALLED_EXT}@default,u)
 same => n,Hangup()

Benefits:

  • Busy greeting plays when agent is busy
  • Unavailable greeting plays when no answer / unreachable
  • More professional caller experience

Step 4 — Voicemail Access Extension for Employees

Employees need a fixed number to check messages. Example: 500.

[from-internal]
exten => 500,1,Answer()
 same => n,VoiceMailMain(@default)
 same => n,Hangup()

The user will enter:

  • Mailbox number (e.g., 1001)
  • PIN (e.g., 1234)

Step 5 — Direct-to-Voicemail (Optional Feature Code)

Many businesses want a “send to voicemail” feature. Example: dial *98 + extension.

[from-internal]
exten => _*98XXXX,1,Answer()
 same => n,Set(TARGET=${EXTEN:3})
 same => n,Voicemail(${TARGET}@default,u)
 same => n,Hangup()

Example usage:

  • Dial *981001 to send directly to 1001 voicemail

Step 6 — Add Logging Around Voicemail (Production Practice)

For reporting / CRM integration, log the event:

same => n,NoOp(Voicemail event for ${CALLED_EXT} caller ${CALLERID(num)} status ${DIALSTATUS})

This is where advanced systems trigger:

  • Missed call tracking
  • CRM task creation
  • WhatsApp follow-up automation
  • AI summaries of voicemail

Common Voicemail Dialplan Problems

Voicemail Plays But Caller Hears Nothing

  • RTP/NAT issue (media path broken)
  • Firewall blocks RTP UDP range

Voicemail Never Triggers

  • Dialplan hits Hangup before Voicemail()
  • Wrong labels or wrong context

Wrong Greeting Plays

  • Not using DIALSTATUS logic
  • Using wrong option letter (b vs u)

For many extensions, use patterns:

[from-internal]
exten => _10XX,1,Dial(PJSIP/${EXTEN},20)
 same => n,GotoIf($["${DIALSTATUS}"="BUSY"]?vm_busy)
 same => n,GotoIf($["${DIALSTATUS}"="NOANSWER"]?vm_unavail)
 same => n,Goto(vm_unavail)

 same => n(vm_busy),Voicemail(${EXTEN}@default,b)
 same => n,Hangup()

 same => n(vm_unavail),Voicemail(${EXTEN}@default,u)
 same => n,Hangup()

This automatically applies voicemail behavior to every extension 1000–1099.

Key Takeaway

Voicemail becomes reliable only when dialplan is designed correctly. Always:

  • Define mailboxes in voicemail.conf
  • Use DIALSTATUS to select greeting type
  • Provide a voicemail access extension (VoiceMailMain())
  • Use patterns for scalability

With this foundation, you can move to: voicemail greetings, email delivery, message waiting indication, and AI-based voicemail automation.

Try it

Want to see API-driven CRM + Telecom workflows in action? Try the WhatsApp bot or explore the demos.

💬 Try WhatsApp Bot ▶️ Watch CRM YouTube Demos
Tip: Comment “Try the bot” on our YouTube videos to see automation in action.
M
MYLINEHUB Team
Published: 2026-02-10
Quick feedback
Was this helpful? (Yes 0 • No 0)
Reaction

Comments (0)

Be the first to comment.