VMware ESXi and vSphere Cluster Management

Voicemail in Asterisk: Configuration, Mailboxes, Greetings, and Notifications

Learn how to configure Asterisk voicemail, define mailboxes, route calls with the dialplan, manage greetings, enable email and MWI, and troubleshoot delivery.

Asterisk is an open-source PBX and communications platform. Its built-in voicemail service accepts and stores recorded messages when a subscriber does not answer, is busy, or cannot be reached. The service has traditionally been associated with the name Comedian Mail.

Voicemail is useful in businesses for individual employees, departments, after-hours service, and on-call teams. In residential systems, it provides a private message box for each household member. Asterisk voicemail combines password-protected mailboxes, telephone-based message management, greetings, email notifications, audio attachments, and Message Waiting Indicator (MWI) support.

How Asterisk voicemail works

A voicemail mailbox is a password-protected destination for messages. A mailbox is identified by a number and a mailbox context, such as 1000@default. The number identifies the mailbox inside the context; the context is a logical namespace that prevents similarly numbered mailboxes from being confused.

Voicemail configuration alone does not send callers to voicemail. The dialplan must invoke VoiceMail() when a call is unanswered, busy, or otherwise unavailable. Subscribers use VoiceMailMain() to log in, listen to messages, record greetings, and manage their mailbox.

FeatureWhat it doesTypical user or administrator benefitRelated configuration area
Password-protected mailboxRequires a PIN for subscriber accessPrevents unauthorized message retrievalvoicemail.conf and VoiceMailMain()
Message recordingStores a caller's recorded messagePreserves calls that cannot be answeredVoiceMail() and voicemail storage
GreetingsPlays default or personal unavailable, busy, and temporary promptsExplains what the caller should doMailbox settings and subscriber menu
Email notificationSends an alert when a message arrivesAllows remote awareness of new messagesMailbox email fields and [general]
Audio attachmentIncludes a copy of the recording in emailAllows playback without calling the PBXGlobal attachment behavior and mail transport
MWIPublishes waiting-message stateLights a phone lamp or supplies stutter dial toneEndpoint subscription and mailbox identity
ForwardingSends an existing message to another mailboxLets users share or delegate messagesSubscriber voicemail interface
Group voicemailDelivers one recording to several mailboxesSupports team announcements and on-call noticesRecipient grouping and dialplan or installed feature

Configuring voicemail.conf

The primary voicemail configuration file is /etc/asterisk/voicemail.conf. It normally contains system-wide settings, mailbox contexts, mailbox entries, email templates, and optional advanced behavior. The exact available options can vary by Asterisk version, so confirm names and defaults with the documentation installed for your system.

touch /etc/asterisk/voicemail.conf

Do not overwrite an existing file merely to create it. First inspect the current configuration and preserve any distribution-specific settings.

SectionPurposeTypical contentsExample use
[general]Defines system-wide voicemail behaviorServer sender address, attachment behavior, defaults, and other global optionsSet the sender address used for notifications
[default]Provides a common mailbox namespaceMailbox entriesStore employee mailboxes such as 1000
[sales]Provides a separate logical namespaceDepartment mailbox entriesIdentify a shared mailbox as 1000@sales
[engineering]Provides another namespaceEngineering mailbox entriesUse the same number independently from another context
Template-related sectionsCustomize notification subjects and message bodies when supportedEmail templates and substitutionsBrand or localize notification text

Context names matter because dialplan applications refer to the complete mailbox identity. A call to VoiceMail(1000@default,u) is not necessarily directed to the same mailbox as VoiceMail(1000@sales,u).

Mailbox entry syntax

The basic mailbox format is:

mailbox_number => password,subscriber_name,email_address,pager_address,options
[default]
1000 => 7391,Alice Example,alice@example.com
Field orderField nameRequired or optionalMeaningExample value
1Mailbox numberRequiredUnique mailbox identifier within its context1000
2Password or PINRequired in normal useInitial subscriber authentication value; the user may change it when permitted7391
3Subscriber nameOptional but recommendedDisplay or spoken identification associated with the mailboxAlice Example
4Email addressOptionalRecipient of voicemail notificationsalice@example.com
5Pager addressOptionalLegacy or separate notification destination where supportedpager@example.com
6OptionsOptionalAdditional mailbox-specific behavior, depending on the installed versionVersion-specific

Use unique mailbox numbers within each context and nontrivial initial PINs. A short sequential PIN is easy to guess. Configure password policy and require subscribers to replace administrative or initial PINs.

Email settings

A mailbox email address enables notifications, but the host must also be able to deliver outbound mail through a functioning local mail transfer agent or configured relay. Global settings commonly control the sender address, subject and body templates, and whether the recorded audio is attached.

[general]
serveremail=pbx@example.com
attach=yes

Notification-only email tells the recipient that a message exists. Attachment-enabled email includes a copy of the recording. Sending recordings by email creates privacy and retention risks: messages may be copied to multiple devices, stored by third-party providers, or forwarded outside organizational control. Disable attachments where policy requires telephone-only retrieval, and protect both mailboxes and email transport.

Dialplan integration

ApplicationPrimary purposeTypical call flow positionKey inputs
VoiceMail()Plays a greeting and records a caller's messageAfter busy, no-answer, or unavailable handlingMailbox number, context, and options
VoiceMailMain()Provides subscriber login and management menusDedicated internal access extension or direct feature codeOptional context and caller or prompted credentials

Send unanswered calls to a mailbox

This example rings endpoint 1000 for 20 seconds and then deposits the call into mailbox 1000@default. The u option requests unavailable-greeting behavior. A busy route can use the corresponding busy-greeting behavior; option names and additional choices should be checked against the installed version.

exten => 1000,1,Dial(PJSIP/1000,20)
 same => n,VoiceMail(1000@default,u)
 same => n,Hangup()

Common routing designs include sending a direct extension to voicemail after a timeout, sending busy calls directly to voicemail, using a dedicated voicemail access extension, and offering a direct-to-mailbox or voicemail escape option from an IVR. Options can also allow a caller to skip parts of the greeting or instructions where that behavior is appropriate. Test the exact caller experience after choosing options.

Provide subscriber access

exten => *97,1,VoiceMailMain(@default)
 same => n,Hangup()

From the phone, a subscriber selects the access extension, enters a mailbox number when prompted, and authenticates with the mailbox password. A deployment with several contexts may provide separate access routes or otherwise ensure that the correct context is selected. Menu prompts and key behavior vary with Asterisk version, language, and configuration.

Typical subscriber tasks include listening to new or saved messages, replaying, saving, deleting, forwarding to another mailbox, changing folders, recording or replacing greetings, changing the PIN, and exiting. Users should be shown the actual menu sequence used by their system rather than relying on a key map from another version.

Greetings and the caller recording flow

Greeting typeWhen playedWho records itFallback behavior
UnavailableThe subscriber cannot answer or is unreachableSubscriber or administratorAsterisk uses the default unavailable prompt if no personal greeting exists
BusyThe subscriber is busySubscriber or administratorAsterisk uses the default busy prompt if no personal greeting exists
TemporaryA temporary condition, such as vacation or closure, should be announcedSubscriberNormal greeting behavior resumes when the temporary greeting is removed
Name recordingUsed by menus or prompts that identify the subscriberSubscriberA system or mailbox default may be used if no name is recorded
  1. The dialplan invokes VoiceMail() for the target mailbox.
  2. Asterisk selects the busy, unavailable, temporary, or fallback greeting.
  3. The caller hears instructions and records a message.
  4. The caller may review or confirm the recording, depending on configuration.
  5. Asterisk stores the message, updates mailbox state, and may send notification email.

Subscribers normally record or replace greetings through the VoiceMailMain() menus. A temporary greeting is useful because it can override the normal greeting without permanently replacing it.

Message Waiting Indicator

MWI means Message Waiting Indicator. Asterisk publishes mailbox state when new or urgent messages exist. Compatible phones may show a visual message lamp, and some systems provide a stutter dial tone, an interrupted dial tone that signals waiting voicemail.

Endpoint configuration must subscribe to or monitor the correct mailbox identifier. The mailbox used by VoiceMail(), the mailbox monitored by the endpoint, and the context portion of that identity must agree. For example, monitoring 1000@sales will not necessarily show messages deposited into 1000@default.

One endpoint or user can be associated with more than one mailbox. This is useful when an assistant monitors an executive mailbox or several staff members monitor a shared departmental inbox. MWI associations determine which states appear on the phone; they do not change the mailbox target selected by dialplan routing.

Forwarding, shared mailboxes, and group voicemail

Forwarding an existing message

Voicemail forwarding sends a recorded message from one mailbox to another through the subscriber interface. A user can listen to a message and select the forwarding function, then identify one or more permitted destination mailboxes. Forwarding should be controlled when messages contain confidential information.

Shared departmental mailbox

A shared sales mailbox is a single mailbox that several staff members access or monitor. Calls can be routed to it after a sales queue or extension group goes unanswered. This is different from giving every salesperson an individual mailbox: the message is stored in one shared destination, while several endpoints may monitor its MWI state or authorized users may log in to retrieve it.

Group voicemail or broadcast

Group voicemail delivers one recorded message to multiple subscriber mailboxes. It is appropriate for service announcements, on-call teams, emergency notices, or departmental messages. Recipient groups must be explicit and narrowly scoped; an overly broad group can disclose sensitive information or create unnecessary notifications.

Group voicemail is not the same as a shared mailbox. A shared mailbox stores one message in one common destination. Group voicemail creates delivery to multiple individual destinations. The exact implementation depends on the Asterisk version and installed dialplan or feature set, so test duplicate delivery, permissions, retries, and MWI behavior before production use.

Scalable dialplans with extension patterns

An extension pattern is a reusable dialplan expression that matches a family of dialed numbers. Patterns begin with an underscore. This can avoid writing a separate route for every employee, but a pattern must be constrained so that callers cannot reach nonexistent or unintended mailboxes.

SymbolMatchesVoicemail routing exampleCaution
_Marks the expression as a pattern_1XXX matches four-digit extensions beginning with 1Without the prefix, Asterisk treats the text as a literal extension
XAny digit from 0 through 9_1XXX can derive a four-digit mailboxMay match numbers that have no mailbox
ZAny digit from 1 through 9Use where a position must not be zeroDo not assume it matches every digit
NAny digit from 2 through 9Use where a position must be at least 2Excludes 0 and 1
[...]One digit from a specified set or range_10[0-5] matches 100 through 105Define the intended range precisely
.One or more remaining charactersCan match variable-length destinationsBroad matches can capture unintended calls
!Zero or more characters in immediate-match behavior where supportedSpecial applications may use it for early matchingCan seize calls before a more specific route; use carefully
exten => _1XXX,1,VoiceMail(${EXTEN}@default,u)
 same => n,Hangup()

Here, the dialed extension is used as the mailbox number. In a real system, validate that the matched extension has an endpoint and a corresponding mailbox. Prefer an explicit list, a narrower pattern, or a lookup and fallback route that plays an error message instead of sending callers to an invalid mailbox.

Reloading and operational maintenance

After editing voicemail.conf, reload voicemail configuration. After editing the dialplan, reload the dialplan separately.

asterisk -rx "voicemail reload"
asterisk -rx "dialplan reload"
asterisk -rx "voicemail show users"

The last command is available on versions that provide that CLI operation. Use the Asterisk CLI help system and version-specific documentation when a command is unavailable.

Voicemail recordings and metadata are stored under the Asterisk voicemail storage area, commonly within the Asterisk spool hierarchy. Avoid manually renaming, deleting, or editing message files and metadata while Asterisk is using them. Uncoordinated changes can make messages disappear from menus or leave inconsistent state.

  • Monitor free disk capacity and alert before recording storage is exhausted.
  • Back up recordings and configuration according to business requirements.
  • Define retention and deletion rules for old messages.
  • Keep storage ownership and permissions compatible with the Asterisk service account.
  • Check mail transport permissions and logs when notifications fail.
  • Test restore procedures, not only backup creation.

Security and privacy

  • Use nontrivial mailbox PINs and require users to change initial credentials.
  • Limit direct external access to VoiceMailMain(), or protect it with additional authentication and access controls.
  • Do not enable audio attachments when organizational or regulatory policy prohibits sending recordings through email.
  • Protect voicemail directories, backups, administrative files, and mail transport credentials.
  • Use retention limits because voicemail recordings may contain personal, financial, or confidential business information.
  • Avoid placing unnecessary personal or organizational details in greetings and spoken mailbox names.
  • Restrict group voicemail recipient lists and forwarding permissions where supported.

Troubleshooting checklist

SymptomLikely causeVerification stepCorrective action
Calls ring indefinitely or disconnectNo voicemail priority, incorrect timeout, or wrong targetTrace the executed dialplan and inspect the Dial() resultAdd busy or no-answer handling and verify the mailbox context
Invalid mailbox messageMailbox does not exist, context is mistyped, or pattern matched an unprovisioned extensionCompare VoiceMail() with the entry in voicemail.confCorrect the identity or add validation and a fallback route
MWI lamp stays offUnsupported or disabled subscription, wrong mailbox identity, or no new messageCheck endpoint MWI configuration and mailbox stateMonitor the correct number and context and verify message state
No email arrivesMissing address, disabled notification, broken mail transport, spam filtering, or rejected senderInspect mailbox fields, global settings, and mail logsFix recipient and sender settings and restore outbound delivery
Email has no recordingAttachments disabled, configuration not reloaded, or version-specific behaviorReview attachment settings and create a fresh test messageEnable the intended behavior, reload, and retest
Subscriber cannot log inWrong mailbox, context, PIN, or access routeConfirm VoiceMailMain() context and credentialsCorrect the route or perform a controlled PIN reset
Recordings fail or disappearLow disk space, bad permissions, cleanup, filesystem, or backup failureCheck capacity, ownership, logs, retention jobs, and storage healthRepair capacity or permissions and review retention and backup procedures

End-to-end configuration checklist

  1. Create or review /etc/asterisk/voicemail.conf.
  2. Set global behavior in [general], including email and attachment policy if required.
  3. Create the required mailbox contexts.
  4. Define unique mailbox numbers, secure initial PINs, subscriber names, and email addresses.
  5. Reload voicemail configuration.
  6. Add VoiceMail() to busy and no-answer call paths.
  7. Add an internal VoiceMailMain() access extension.
  8. Configure endpoint MWI monitoring with the exact mailbox number and context.
  9. Reload the dialplan.
  10. Test greeting selection, message recording, login, playback, deletion, forwarding, MWI, and email.
  11. Confirm disk monitoring, permissions, backups, and retention policy.

For a compact reference to this lesson, see Voicemail in Asterisk.