4.2. Example implementations

The examples which follow should give you a quick overview of typical configurations. Specifics and special features are covered in the following section Section 4.3, “Dialplan applications”.

The Robinson Family

In the course of modernizing their home, the Robinson family has decided to install an Asterisk system, including a voicemail system with a mailbox for every family member.

Tasks

Each family member needs a mailbox:
NameExtensionNotes
Dave Robinson200Standard voice mailbox
Colleen Robinson201Standard voice mailbox
Matthew Robinson202Normal voice mailbox with e-mail notification (in this case, voice messages are attached as an audio file to a an e-mail and sent to a specified e-mail address)
Lisa Robinson203Normal voice mailbox with e-mail notification with deletion (in this case, voice messages are attached as an audio file to an e-mail, sent to a specified e-mail address, but the original message is deleted from the Comedian Mail system immediately)

Configuration

The voicemail.conf looks like this:
[general]
format = wav
attach = yes

[default]
; Syntax for new entries looks like this:
; MailboxNumber => password,name,e-mail,pager,options
; (usually, the MailboxNumber is the same as the Extension)
200 => 1234,Dave Robinson
201 => 1234,Colleen Robinson
202 => 1234,Matthew Robinson,matt@robinsonfamily.name
203 => 1234,Lisa Robinson,lisa@robinsonfamily.name,,delete=yes
In extensions.conf, we send an unanswered call to voicemail like so:
[robinson-family]
; If nobody picks up within 30 seconds, the call is sent to voicemail
; If the extension is busy, the call is sent to voicemail
exten => _20[0-3],1,Set(TARGETNO=${EXTEN})
exten => _20[0-3],n,Dial(SIP/${EXTEN},30)
exten => _20[0-3],n,Goto(s-${DIALSTATUS},1)  ; routes the call to the status priority (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => s-NOANSWER,1,VoiceMail(${TARGETNO},u) ; Person at extension "is unavailable" message
exten => s-BUSY,1,VoiceMail(${TARGETNO},b)     ; Person at extension "is busy" message
exten => s-ANSWER,1,Hangup()                 ; To be safe, clean up the call after an answer by hanging up
exten => _s-.,1,Goto(s-NOANSWER,1)           ; Handle any unhandled status the same way we handle NOANSWER

; Check your voicemail from your own extension by dialling "250"
exten => 250,1,VoiceMailMain(${CALLERID(num)})
A more elegant implementation can use a macro:
[robinson-family]
exten => _20[0-3],1,Macro(normal|SIP/${EXTEN}|${EXTEN})

exten => 250,1,VoiceMailMain(${CALLERID(num)})

[macro-normal];
;  ${ARG1} - extension(s) being called (e.g. SIP/123&SIP/124)
;  ${ARG2} - Mailbox (usually the same as ${MACRO_EXTEN})
exten => s,1,Dial(${ARG1},30)               ; ring extension for a maximum of 30 seconds
exten => s,n,Goto(s-${DIALSTATUS},1)        ; go to status priority (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => s-NOANSWER,1,VoiceMail(${ARG2},u)  ; Person at extension "is unavailable" message
exten => s-BUSY,1,VoiceMail(${ARG2},b)      ; Person at extension "is busy" message
exten => s-ANSWER,1,Hangup()                ; To be safe, clean up the call after an answer by hanging up
exten => _s-.,1,Goto(s-NOANSWER,1)          ; Handle any unhandled status the same way we handle NOANSWER

Widgets, Inc.

A business like Widgets, Inc. will need a more comprehensive voicemail system. In this example, you'll be able to see how much you can do with Comedian Mail.

Tasks

The default settings for each voice mailbox are:
  • Voicemails are saved in WAV format.
  • Each mailbox is limited to a maximum of 200 messages.
  • The maximum length of a voice message is 5 minutes.
  • Voice messages are stored on the system and also sent to the user as an e-mail attachment.
Beyond these default settings, individual departments have additional needs and wants for their mailboxes:
MailboxDepartment/TitleNotes
150Building manager on duty
  • Message notifications are sent only to a pager, not e-mail
  • Callers may listen to their messages before sending and, if necessary, re-record them.
  • After the recipient has listened to the message, she can return the call directly from the voicemail menu.
160 - 169IT
  • In the IT department, every staff member has his own mailbox.
  • Calls route to voice mail only if nobody in the department answers. No messages can be left if all extensions are busy.[a]
802Sales (Domestic)
  • No e-mail notifications are sent.[b]
  • No password is required to listen to messages.
803Sales (International)
  • No e-mail notifications are sent.
  • No password is required to listen to messages.
201Division Manager
  • Callers may listen to their messages before sending and, if necessary, re-record them.
  • After the recipient has listened to the message, she can return the call directly from the voicemail menu.
202Assistant Manager
  • Callers may listen to their messages before sending and, if necessary, re-record them.
  • After the recipient has listened to the message, she can return the call directly from the voicemail menu.
804Reception
  • After the recipient has listened to the message, she can return the call directly from the voicemail menu.
This is a safety measure to prevent a complete denial of service in the event of a major IT outage; if the entire company staff call in and leave a message, the IT department would never be able to listen to them all.
We don't want e-mail sent to a specific person because there is more than one staff member in the sales group. We might, however, configure all the extensions in the group to illuminate the Message Waiting Indicator light if there are new messages in the mailbox.

Configuration

The voicemail.conf for Widgets, Inc. looks like this:
[general]
; Messages are stored in higher-quality WAV format.
format = wav

; E-mail notifications sent by the system have voicemail@widgets-inc.biz
; as the From: address
serveremail = voicemail@widgets-inc.biz

; We set a maximum of 200 messages per mailbox.
maxmsg = 200

; The maximum message length is 5 minutes. The message length is set in seconds (5 x 60 = 300)
maxmessage = 300

; We set the text for the e-mail notifications.
; The entire text must fit on one line!
emailbody = Hello, ${VM_NAME},\n\nyou have a new voicemail message from ${VM_CALLERID} in your mailbox ${VM_MAILBOX}. To listen to your new messages, dial 800.\n\n-- Asterisk Voicemail System\n

; Text for the pager notifications.
; The entire text must fit on one line!
pagerbody = New voicemail from ${VM_CALLERID} at ${VM_DATE}.

; Attach messages to e-mail notifications?
attach = yes

[default]
; Syntax for new entries looks like this:
; MailboxNumber => password,name,e-mail,pager,options
150 => 1234,Building Manager,,pager.buildingmgr@widgets-inc.biz,review=yes|callback=internal-extensions
802 => 1234,Sales (Domestic)
803 => 1234,Sales (International)
201 => 1234,Chelsea Important,bob.important@widgets-inc.biz,,review=yes|callback=internal-extensions
202 => 1234,Rick Important,rick.important@widgets-inc.biz,,review=yes|callback=internal-extensions
804 => 1234,Reception,reception@widgets-inc.biz,,review=yes
Calls are sent to voicemail in extensions.conf like so:
[building-mgr]
include => internal-extensions
include => voicemail-buildingmgr

[it]
include => internal-extensions
include => voicemail-easyaccess
include => voicemail-generalaccess

[managers]
include => internal-extensions
include => voicemail-easyaccess

[reception]
include => internal-extensions
include => voicemail-easyaccess

[sales-domestic]
include => internal-extensions
include => voicemail-sales-domestic

[sales-international]
include => internal-extensions
include => voicemail-sales-international

[shipping]
include => internal-extensions
include => voicemail-easyaccess

[production]
include => internal-extensions
include => voicemail-easyaccess

[others]

[macro-simple];
;  ${ARG1} - extension(s) being called (e.g. SIP/123&SIP/124)
;  ${ARG2} - Mailbox (usually the same as ${MACRO_EXTEN})
exten => s,1,Dial(${ARG1},30)               ; ring extension for a maximum of 30 seconds
exten => s,n,Goto(s-${DIALSTATUS},1)        ; go to status priority (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => s-NOANSWER,1,VoiceMail(${ARG2},u)  ; Person at extension "is unavailable" message
exten => s-BUSY,1,VoiceMail(${ARG2},b)      ; Person at extension "is busy" message
exten => s-ANSWER,1,Hangup()                ; To be safe, clean up the call after an answer by hanging up
exten => _s-.,1,Goto(s-NOANSWER,1)          ; Handle any unhandled status the same way we handle NOANSWER

[internal-extensions]
; If the building manager on duty does not answer the phone,
; the call is routed to mailbox 150:
exten => _15X,1,Macro(simple|SIP/${EXTEN}|150)

; IT has normal mailboxes:
exten => _16X,1,Macro(simple|SIP/${EXTEN}|${EXTEN})

; Each manager has his or her own mailbox:
exten => _20[1-2],1,Macro(simple|SIP/${EXTEN}|${EXTEN})

; The reception staff have a common mailbox:
exten => _2[3-6]X,1,Macro(simple|SIP/${EXTEN}|804)

; The domestic sales group has a common mailbox:
exten => _3[0-4]X,1,Macro(simple|SIP/${EXTEN}|802)

; The international sales group has a common mailbox:
exten => _3[5-9]X,1,Macro(simple|SIP/${EXTEN}|803)

; No voice mail on the other extensions.
exten => _[4-5]XX,1,Dial(SIP/${EXTEN},30)

[voicemail-easyaccess]
exten => 800,1,VoiceMailMain(${CALLERID(num)})

[voicemail-generalaccess]
exten => 801,1,VoiceMailMain()

[voicemail-buildingmgr]
exten => 800,1,VoiceMailMain(150)

[voicemail-sales-domestic]
exten => 800,1,VoiceMailMain(802,s)

[voicemail-sales-international]
exten => 800,1,VoiceMailMain(803,s)

Special considerations

The extensions.conf for Widgets, Inc. is already starting to look a bit more complicated. This is because we are using different mailbox features for different users and departments. There are normal individual mailboxes for some staff and group mailboxes for sales and reception; on top of that, sales staff must be able to access messages without having to enter a password. This must be as easy and transparent as possible for individual staff members, so we set the standard voice mailbox access number to 800 for everyone.