Home / Guides / Tutorial

How to Set Up Voicemail on Asterisk PBX

A complete walkthrough of Asterisk voicemail configuration, from basic mailbox setup to email notifications and visual voicemail integration.

Sign up now or see the full rate table

Tutorial · · 8 min read

Voicemail Overview

Asterisk includes a powerful built-in voicemail application (app_voicemail) that supports multiple mailboxes, email delivery of messages, custom greetings, and integration with visual voicemail clients. Whether you have 5 extensions or 500, the setup process follows the same pattern.

Configuring voicemail.conf

The main voicemail configuration file is /etc/asterisk/voicemail.conf. It has two key sections: [general] for global settings and [default] (or custom context names) for mailbox definitions.

/etc/asterisk/voicemail.conf
[general]
; Format to store voicemail recordings
format=wav49|wav
; Maximum message length in seconds
maxmsg=100
maxsecs=300
minsecs=3
; Maximum greeting length
maxgreet=60
; Skip [instructions] prompt
skipms=3000
; Maximum silence before ending recording
maxsilence=10
; Silence threshold (adjust for noisy environments)
silencethreshold=128
; Send voicemail via email
serveremail=voicemail@yourdomain.com
attach=yes
; Email settings
emailsubject=New voicemail from ${VM_CALLERID}
emailbody=Hi ${VM_NAME},\n\nYou have a new voicemail:\n\nFrom: ${VM_CALLERID}\nDate: ${VM_DATE}\nDuration: ${VM_DUR}\n\nMessage is attached.\n
emaildateformat=%A, %B %d, %Y at %r
; Delete voicemail after emailing (optional)
; delete=yes
[default]
; Format: mailbox => password,name,email,pager,options
100 => 4589,John Smith,john@company.com,,tz=eastern|attach=yes
101 => 7832,Jane Doe,jane@company.com,,tz=eastern|attach=yes
102 => 2941,Bob Wilson,bob@company.com,,tz=central|attach=yes
103 => 6127,Alice Brown,alice@company.com,,tz=pacific|attach=yes

Dialplan Integration

You need to connect voicemail to your dialplan in two ways: sending unanswered calls to voicemail, and allowing users to check their messages.

/etc/asterisk/extensions.conf
[internal]
; Dial extension, send to voicemail after 20 seconds
exten => _1XX,1,NoOp(Dialing extension ${EXTEN})
 same => n,Dial(PJSIP/${EXTEN},20)
 same => n,GotoIf($["${DIALSTATUS}"="BUSY"]?busy:unavail)
 same => n(busy),VoiceMail(${EXTEN}@default,b)
 same => n,Hangup()
 same => n(unavail),VoiceMail(${EXTEN}@default,u)
 same => n,Hangup()
; Check voicemail - dial *97
exten => *97,1,NoOp(Checking voicemail)
 same => n,VoiceMailMain(${CALLERID(num)}@default)
 same => n,Hangup()
; Check voicemail for specific mailbox - dial *98
exten => *98,1,NoOp(Checking voicemail - any mailbox)
 same => n,VoiceMailMain(@default)
 same => n,Hangup()

The key applications are:

  • VoiceMail(mailbox@context,options) - Records a voicemail. Use b for busy greeting, u for unavailable greeting, or s to skip the greeting.
  • VoiceMailMain(mailbox@context) - Opens the voicemail menu for checking and managing messages.

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.

More numbers, porting and E911 in the portal

Outbound US and Canada
$0.010 /min
Inbound
$0.009 /min
Local number
$1.50 /mo
Per channel
$0 no set limits

Sign up now or see the full rate table. No contracts.

Email Notifications

For email delivery to work, your Asterisk server needs a working mail transfer agent (MTA). Postfix is the most common choice:

Install and configure Postfix
# Install Postfix
apt install postfix    # Debian/Ubuntu
yum install postfix    # CentOS/RHEL
# Configure as satellite system pointing to your mail relay
# Edit /etc/postfix/main.cf:
relayhost = [smtp.yourdomain.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
# Restart Postfix
systemctl restart postfix

Visual Voicemail

Visual voicemail lets users see a list of messages and play them in any order, rather than navigating the phone menu. Asterisk supports this through the MWI (Message Waiting Indicator) and IMAP integration.

MWI (Message Waiting Indicator)

MWI lights up the voicemail indicator on SIP phones when new messages arrive. It works automatically with PJSIP:

pjsip.conf - MWI for endpoint
[100]
type=endpoint
; ... other settings ...
mailboxes=100@default
[100]
type=aor
max_contacts=1
; Subscribe to MWI
mailbox_subscribe=yes

IMAP Storage

For full visual voicemail with IMAP-capable clients, compile Asterisk with IMAP support and configure storage:

voicemail.conf - IMAP storage
[general]
imapserver=mail.yourdomain.com
imapport=993
imapflags=ssl
authuser=asterisk
authpassword=secretpassword
imapfolder=INBOX/Voicemail
imapgreetings=yes

Advanced Options

Timezone Settings

Configure per-mailbox timezones so message timestamps are announced correctly. Set tz=eastern in the mailbox options.

Operator Transfer

Let callers press 0 during the greeting to reach an operator. Set operator=yes in [general] and define the o extension.

Voicemail Groups

Send a single voicemail to multiple mailboxes using the VoiceMail app with comma-separated mailboxes: VoiceMail(100&101&102@default)

Custom Greetings

Users can record busy and unavailable greetings through the VoiceMailMain menu (option 0, then 1 for unavailable, 2 for busy).

Troubleshooting

Common voicemail issues and their solutions:

  • Emails not sending: Check that Postfix is running (systemctl status postfix) and review /var/log/mail.log for delivery errors.
  • MWI light not working: Verify the mailboxes= setting in PJSIP matches the mailbox number in voicemail.conf.
  • Recordings too quiet: Adjust the silencethreshold value or check your phone's microphone gain settings.
  • Wrong timezone announced: Ensure the tz= option is set in the mailbox definition and that zonemessages is configured in [zonemessages].
Debug voicemail from Asterisk CLI
asterisk -rvvv
CLI> voicemail show users
CLI> voicemail show zones
CLI> core set verbose 5
; Now make a test call and watch the output

Need SIP Trunks for Your Asterisk PBX?

IPComms provides reliable SIP trunking with full Asterisk compatibility. Get crystal-clear calls with your voicemail system backed by enterprise-grade infrastructure.

Get Started Asterisk SIP Trunking

Stop worrying about SIP trunk capacity. We have you covered.

SIP trunking from a US carrier since 2002: $0.009 per minute inbound, $0.010 outbound, numbers from $1.50 a month, $0 per channel, no contracts.

Sign up now or see the full rate table