Skip to content
Phone Guides

Asterisk voicemail: mailboxes, deposit and retrieval

A voicemail path needs a mailbox, a route for leaving a message and a protected route for retrieving it. A phone extension and a mailbox can share a number, but creating one does not automatically create the other.

Source-reviewed, 18 October 2026. Prepared from the cited documentation. These examples have not been independently tested by Phone Guides. Scope: Asterisk 22 voicemail applications, a deliberately configured mailbox, and direct file-based dialplan examples. Storage backend and mail delivery are installation-specific.

Establish the mailbox before the route

Use the matching release's voicemail configuration sample to understand the installed backend and mailbox format. For this guide's dialplan, configure mailbox 6001 in voicemail context pg-mailboxes, with a privately generated PIN and an appropriate display name. Do not reuse the SIP account password or publish the PIN.

Mailbox contexts belong to voicemail configuration. They are distinct from dialplan contexts such as pg-internal. Always show mailbox@voicemail-context explicitly in an instructional example so the reader does not have to guess which namespace is intended.

Confirm that the voicemail application/backend is installed and that the runtime account can access the chosen storage. Set limits and retention deliberately. Mail attachments require a working mail-delivery path; that is separate from local message storage.

Add a deposit route

This original illustration calls an already-created mailbox directly:


[pg-voicemail-deposit]
exten => 7201,1,Answer()
 same => n,VoiceMail(6001@pg-mailboxes,u)
 same => n,Hangup()

The u option selects the unavailable greeting. The VoiceMail application reference documents its options and VMSTATUS. It also states what happens when a specified mailbox does not exist. Do not add an email or recording claim based only on reaching the greeting.

Keep this as a separate example route until you decide how an unanswered/busy phone call should reach it. A real extension's fallback should distinguish the relevant Dial() outcome, preserve the intended greeting and handle a caller who has already hung up. Do not blindly send every internal routing failure to an unrelated mailbox.

Add protected retrieval

Place this route only in a dialplan context reachable by authorised users:


[pg-voicemail-access]
exten => 7299,1,Answer()
 same => n,VoiceMailMain(@pg-mailboxes)
 same => n,Hangup()

This form lets the user enter a mailbox in the named voicemail context. Retain PIN checking. The VoiceMailMain reference lists an option that bypasses the passcode; it is deliberately absent here. A hard-to-guess retrieval extension is not a replacement for authentication.

Check each outcome separately

Reader check Evidence to collect
Leave a message Correct greeting, recording and resulting mailbox entry
Retrieve a message Correct mailbox, PIN prompt and playback
Wrong PIN Access refused under the configured policy
Full/unwritable storage Defined failure behaviour and an operational alert
Email notification Mail handoff and delivery evidence, independently of local deposit
Message-waiting indicator Actual phone notification behaviour on the exact client/firmware

Do not delete stored messages as an incidental setup check. Include mailbox data in recovery planning and restrict access to recordings and backups. Use the installed application's CLI help if an option differs from the cited release.

Apply changes through the configuration owner's supported process, inspect the loaded dialplan and read application errors. Return to Asterisk documentation.