Asterisk cmd VoiceMail
Synopsis
Leave a voicemail message in one or more mailboxes.Description
VoiceMail([flags]boxnumber[@context][&boxnumber2[@context]][&boxnumber3])
or
VoiceMail(boxnumber[@context][&boxnumber2[@context]][&boxnumber3],[flags])
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.
VoiceMail(boxnumber[@context][&boxnumber2[@context]][&boxnumber3]|[flags])
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 1.6.1.1).
VoiceMail(boxnumber[@context][&boxnumber2[@context]][&boxnumber3],[flags])
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:
- s: Play nothing.
- (no flags): Play instructions.
- su: Play unavailable message.
- u: Play unavailable message, then instructions.
- sb: Play busy message.
- b: Play busy message, then instructions.
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 | USEREXIT | FAILED
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.
Example:
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
Examples
Voicemail(1)
Voicemail(b1234@default)
Voicemail(b1234&1704@home)
Voicemail(su${EXTEN})
Old version:
See also
- Asterisk config voicemail.conf
- Asterisk cmd VoiceMailMain
- Asterisk VoiceMail
- Asterisk RealTime Voicemail
- Asterisk cmd Hasnewvoicemail
- Asterisk cmd MailboxExists
- Asterisk Voicemail ODBC storage: Voicemail file storage via ODBC
- Asterisk Voicemail IMAP storage: Voicemail file storage via IMAP
- Tip: Voicemail live: Answering machine mimic: Listen while caller is leaving voicemail for you, with pick-up option
- Tip: Script to Age/Delete old Voicemails: Perl script that deletes voicemails older than a selectable number of days.
Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Comments
333Deprecation in 1.4-trunk
333pipe flags into voicemail command, which versions?
333problem with app_voicemail.c in asterisk-1.4.1
I've a problem with app_voicemail.c in version 1.2.15. I was trying to configure voicemailbox with mysql realtime, but I can't get the playing of vm-intro, just the beep.
Best regards,
Orion
333problem with app_voicemail.c in asterisk-1.4.1
I've a problem with app_voicemail.c in version 1.2.15. I was trying to configure voicemailbox with mysql realtime, but I can't get the playing of vm-intro, just the beep.
Best regards,
Orion
333new syntax
Using this sintax :
Voicemail(u${MACRO_EXTEN})
my ${MACRO_EXTEN} will be jhon.doe or smith.agent .
So if the boxnumber start with the letter s that macro will not work, 'smith.agent' will become 'mith.agent'
— Executing VoiceMail("SIP/jhon.doe-c4a4", "usmith.agent ") in new stack
Aug 16 15:22:19 WARNING30241: app_voicemail.c:2410 leave_voicemail: No entry in voicemail config file for 'mith.agent '
To fix use the new syntax :
VoiceMail(mailbox@context[&mailbox@context]...[|options])
In my case
Voicemail(${MACRO_EXTEN}|u)
333Re: 'a' extension in current context
333jump to other context without specifying mailbox
VoiceMail([flags][boxnumber][@context])
as
VoiceMail(@nondefault)
and let the caller to select the mailbox number. Seems you cannot. So how to let caller to enter mailbo in a nondefault context?
333drop to voicemailmain
Use a macro:
exten => s,1,Dial(SIP/${MACRO_EXTEN})
exten => s,2,Voicemail(u${MACRO_EXTEN})
exten => s,3,Hangup() ; I always add hangup everywhere
exten => s,102,Voicemail(b${MACRO_EXTEN})
exten => s,103,Hangup()
exten => a,1,VoiceMailMain(${MACRO_EXTEN})
exten => a,2,Hangup()
[other-context]
exten => 1234,1,Macro(sip-vm)
exten => 1234,2,Hangup()
333'a' extension in current context
'*' - the call jumps to extension 'a' in the current voicemail context.
'#' - the greeting and/or instructions are stopped and recording starts immediately."
Anyone know what the 'a' extension refers too? I'm trying to allow a caller to call his own mailbox and interrupt the announcement with '*' and go to VoiceMailmain to access his messages. This avoids the need for a dedicated access number.
Anyone know how to do that?
333context?