Learn how to configure Asterisk voicemail from scratch -- including voicemail to email, MWI notifications, custom greetings, and seamless integration with your SIP trunk for professional call handling.
Voicemail is an essential component of any business phone system. When callers cannot reach an extension -- whether the user is on another call, away from their desk, or outside business hours -- a properly configured voicemail system ensures no message is lost. Asterisk voicemail setup provides a powerful, flexible solution that can deliver messages via email, integrate with visual voicemail clients, and support complex multi-tenant environments.
In this guide, we walk through the complete asterisk voicemail configuration process: from the base voicemail.conf settings, through voicemail to email asterisk integration, to dialplan logic that gracefully routes unanswered calls to the correct mailbox.
Configuring voicemail.conf
The voicemail.conf file is the heart of the Asterisk voicemail setup. It defines global settings, email delivery options, and individual mailbox configurations.
The [general] Section
/etc/asterisk/voicemail.conf - [general]
[general]
; Audio formats - wav49 for email, gsm for storage, wav for playback
format=wav49|gsm|wav
; Message limits
maxmsg=100 ; Maximum messages per mailbox
maxsecs=300 ; Maximum message length (5 minutes)
minsecs=3 ; Minimum message length (skip short recordings)
maxsilence=10 ; Seconds of silence before ending recording
silencethreshold=128 ; Audio threshold for silence detection
; Greeting behavior
skipms=3000 ; Skip forward/backward in milliseconds
maxgreet=60 ; Maximum greeting length in seconds
maxlogins=3 ; Failed login attempts before lockout
; Playback options
saycid=yes ; Announce caller ID before message
envelope=yes ; Play date/time envelope
sayduration=yes ; Announce message duration
saydurationm=2 ; Only announce if longer than 2 minutes
; Navigation
moveheard=yes ; Move heard messages to Old folder
forward_urgent_auto=yes ; Auto-forward urgent messages
; Timezone for message timestamps
tz=eastern
One of the most requested features in any asterisk voicemail configuration is email delivery. The voicemail to email feature sends notifications (with optional audio attachment) whenever a new message arrives.
Email Template Configuration
/etc/asterisk/voicemail.conf - Email settings
[general]
; From address
serveremail=voicemail@company.com
fromstring=Company Voicemail
; Email subject line
; Variables: ${VM_NAME}, ${VM_MAILBOX}, ${VM_CALLERID}, ${VM_DUR}, ${VM_DATE}
emailsubject=New Voicemail from ${VM_CALLERID} (${VM_DUR} seconds)
; Email body template
emailbody=Hi ${VM_NAME},\n\nYou have a new voicemail message:\n\n From: ${VM_CALLERID}\n Date: ${VM_DATE}\n Duration: ${VM_DUR} seconds\n Mailbox: ${VM_MAILBOX}\n\n--\nCompany Phone System
; Date format for emails
emaildateformat=%A, %B %d, %Y at %I:%M %p
; Attach audio file to email
attach=yes
; Character set
charset=UTF-8
Building this? Your PBX will need a number
Find a phone number for your trunk
Local numbers $1.50 a month, toll-free $2.00, $1.00 one-time setup. Pick one here and it carries into signup.
Enter an area code, or wait a moment for numbers near you.
The asterisk voicemail setup is only useful when properly integrated into your dialplan. Asterisk provides two key applications: VoiceMail() for sending callers to voicemail, and VoiceMailMain() for retrieving messages.
Dial with Voicemail Fallback
/etc/asterisk/extensions.conf
[internal]
; Extension 100 - Ring for 20 seconds, voicemail on no answer or busy
exten => 100,1,NoOp(Calling extension 100 - John Smith)
same => n,Set(TIMEOUT(ring)=20)
same => n,Dial(PJSIP/100,20,tTr)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
same => n(busy),VoiceMail(100@default,b)
same => n,Hangup()
same => n(unavail),VoiceMail(100@default,u)
same => n,Hangup()
; Voicemail access
exten => *97,1,Answer()
same => n,VoiceMailMain(${CALLERID(num)}@default)
same => n,Hangup()
Inbound Call Flow with IPComms Trunk
When using an IPComms SIP trunk (server: s1.ipcomms.net, IP: 34.23.59.14), inbound DID calls arrive in a specific context. Here is a complete dialplan that routes calls to extensions with voicemail fallback:
[from-ipcomms]
; Context for inbound calls from IPComms trunk
; Main DID - Route to extension 100 with voicemail
exten => 2125551000,1,NoOp(Inbound call to main DID from ${CALLERID(num)})
same => n,Dial(PJSIP/100,20,tTr)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
same => n(busy),VoiceMail(100@default,b)
same => n,Hangup()
same => n(unavail),VoiceMail(100@default,u)
same => n,Hangup()
; Sales DID - Ring group then voicemail
exten => 2125551001,1,NoOp(Inbound to Sales DID)
same => n,Dial(PJSIP/110&PJSIP/111&PJSIP/112,25,tTr)
same => n,VoiceMail(110@default,u)
same => n,Hangup()
; Catch-all for unmatched DIDs
exten => _X.,1,NoOp(Unmatched DID: ${EXTEN})
same => n,VoiceMail(100@default,u)
same => n,Hangup()
Advanced Voicemail Features
MWI (Message Waiting Indicator) with PJSIP
MWI lights up the voicemail indicator on SIP phones when new messages arrive: