System information
Table 8-4. VoiceMail() optional arguments
Argument Purpose
b Instructs Asterisk to play the busy greeting for the mailbox (if no busy greeting is found, the unavailable greeting
will be played).
d([c]) Accepts digits to be processed by context c. If the context is not specified, it will default to the current context.
g(#) Applies the specified amount of gain (in decibels) to the recording. Only works on DAHDI channels.
s Suppresses playback of instructions to the callers after playing the greeting.
u Instructs Asterisk to play the unavailable greeting for the mailbox (this is the default behavior).
U Indicates that this message is to be marked as urgent. The most notable effect this has is when voicemail is stored
on an IMAP server. In that case, the email will be marked as urgent. When the mailbox owner calls in to the
Asterisk voicemail system, he should also be informed that the message is urgent.
P Indicates that this message is to be marked as priority.
The VoiceMail() application sends the caller to the specified mailbox, so that he can
leave a message. The mailbox should be specified as mailbox@context, where context
is the name of the voicemail context. The option letters b or u can be added to request
the type of greeting. If the letter b is used, the caller will hear the mailbox owner’s
busy message. If the letter u is used, the caller will hear the mailbox owner’s unavaila-
ble message (if one exists).
Consider this simple example extension 101, which allows people to call John:
exten => 101,1,Dial(${JOHN})
Let’s add an unavailable message that the caller will be played if John doesn’t answer
the phone. Remember, the second argument to the Dial() application is a timeout. If
the call is not answered before the timeout expires, the call is sent to the next priority.
Let’s add a 10-second timeout, and a priority to send the caller to voicemail if John
doesn’t answer in time:
exten => 101,1,Dial(${JOHN},10)
exten => 101,n,VoiceMail(101@default,u)
Now, let’s change it so that if John is busy (on another call), the caller will be sent to
his voicemail, where he will hear John’s busy message. To do this, we will make use of
the ${DIALSTATUS} variable, which contains one of several status values (type core show
application dial at the Asterisk console for a listing of all the possible values):
exten => 101,1,Dial(${JOHN},10)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
same => n(unavail),VoiceMail(101@default,u)
same => n,Hangup()
same => n(busy),VoiceMail(101@default,b)
same => n,Hangup()
Now callers will get John’s voicemail (with the appropriate greeting) if John is either
busy or unavailable. A slight problem remains, however, in that John has no way of
retrieving his messages. We will remedy that in the next section.
170 | Chapter 8: Voicemail