Upgrade 3CX to v18 and get it hosted free!

Asterisk cmd VoiceMail

Author image

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 separated by a comma. The usage of the pipe (|) symbol is deprecated. The following format is right for 1.6 and higher (tested on 16th of July 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 preceded 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 Asterisk cmd 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 attachments)

You may not specify both u and b flags together. You may, however, combine them with s, giving six possibilities:

  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.

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 irrelevant, it’s the context for the voicemail box that we’re looking for in the dialplan for the jump to the ‘a’ or ‘o’ Extension.

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 jumped 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, the 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})

See Also


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


Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.