Asterisk cmd VoiceMail


Leave a voicemail message in one or more mailboxes.



Deprecation in 1.4-trunk
As of 1.4-trunk, flags must be passed after the | (pipe). The ability to pass the flags after a comma or before the box number has been removed.

As of 1.6
As of version 1.6 flags must be passed after the box number seperated by a comma. The usage of the pipe (|) symbol is deprecated. Following format is right for 1.6 and higher (tested on 16th of juli 2009 in version

Records the channel, saving an audio file in a given voicemail boxnumber, which must be configured in voicemail.conf. The boxnumber may be preceeded by one or more flags or these may be specified as the second argument:

  • s: The letter s, if present, causes the instructions ("Please leave your message after the tone. When done, hang up, or press the pound key.") to be skipped.

  • u: The letter u, if present, causes the unavailable message to be played. By default, the message says, "The person at extension ... 1234 ... is unavailable," but the mailbox owner may record their own unavailable message with the VoicemailMain command.

  • b: The letter b, if present, causes the busy message to be played. By default, the message says, "The person at extension ... 1234 ... is busy."

  • g(#): (Only when specifying the flags as the second argument) Adjust the gain of the recording. The # is an integer representing the amount of gain in decibels. (This actually sets a channel option to increase the RX gain, this option is unfortunately only supported on Zap, see the volgain voicemail.conf option to have asterisk call sox to adjust the gain on voicemails sent as email attachements)

You may not specify both u and b flags together. You may, however, combine them with s, giving six possibiities:
  1. s: Play nothing.
  2. (no flags): Play instructions.
  3. su: Play unavailable message.
  4. u: Play unavailable message, then instructions.
  5. sb: Play busy message.
  6. b: Play busy message, then instructions.
In all cases, the beep.gsm file will also be played, prior to starting to record.

This application will set the following channel variable upon completion:
VMSTATUS - This indicates the status of the execution of the VoiceMail application.
The possible values are:
  • SUCCESS: Caller left message successfully
  • USEREXIT: Caller exited VM by keypress
  • FAILED: Caller did not leave message or any issue to cause a message to not be left

The voicemail messages will be saved into the inbox directory for that voicemail boxnumber:
  • /var/spool/asterisk/voicemail/context/boxnumber/INBOX/

If the caller presses 0 (zero) during the announcement, and the option 'operator=yes' is set in voicemail.conf either in the general section or for this mailbox then he will be moved to extension 'o' (as in "Out") in the current voicemail context. This could be used as an escape for a receptionist. If you don't want it, just configure extension o to go back to voicemail, or configure operator=no, otherwise the call will be hangup due to the fact that extension 'o' doesn't exist.

Also. during the prompt if the caller presses:
'*' - the call jumps to extension 'a' in the current voicemail context.
Exten => a, 1, VoicemailMain(@default)
Exten => a, 2, Hangup
'#' - the greeting and/or instructions are stopped and recording starts immediately.

NOTE: The below information is not correct in version 1.2.x. The a and o extensions must exist within the current context.

When using the zero '0' and star '*' it's important to note that the context you placed the application voicemail in is irrelvant, it's the context for the voicemail box that we're looking for in the dialplan for the jump to the 'a' or 'o' extention.
I tested this using a macro to call voicemail and pressing '0' and/or '*' first jumped back to the macro that called voicemail, to look for 'o' and/or 'a' in that macro, if it failed it jumpted to the context defined in voicemail.conf. I'm running CVS version 1.07

If the requested mailbox does not exist, and there exists a priority n+101, then that priority will be taken next.

If, during the recording the caller presses:
'#' - or the defined silence limit is exceeded, recording is stopped and the call continues at priority n+1.

Be sure you do something with the caller after they come back from Voicemail(), at the very least:

exten => somewhere,5,Playback(Goodbye)
exten => somewhere,6,Hangup



Old version:

See also

Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: oej, Last modification: Thu 12 of May, 2011 (23:32 UTC) by JustRumours
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+