VoiceMail is used to leave a message if no one is
answering your call. The configuration in Asterisk is again in
/etc/asterisk and the file is
voicemail.conf.
You can declare the mailbox in the
default mailbox context – [default] or create others. Note that the
mailbox contexts and those in extensions.conf have no relation in
between. They are just some kind of separators in two different
files.
The command looks like this:
mailbox_number => password, name,
email
mailbox_number is the number you use in
extension.conf for VoiceMail() command and to register a user in
sip.conf or iax.conf
password is the pass used to register
a user in sip.conf or iax.conf
name is the name which to
be associated with the mailbox
email is where a
notification for the voicemail will come
Ex.
(voicemail.conf)
[mb_tutorial]
777 => 1212, ivan,
ivan@asteriskguru.com
here I create mailbox context named
mb_tutorial, mailbox number 777 with password
1212, owned by ivan with email
ivan@asteriskguru.com
When dialing any user
you can leave message at this mailbox
VoiceMail(mailbox_number@context)Ex.
(extensions.conf)
exten => 1234,1,Dial(SIP/ivan, 30)
exten
=> 1234,2,VoiceMail(777@mb_tutorial)
exten =>
1234,3,PlayBack(vm-goodbye)
exten =>
1234,4,HangUp()
This example will try
dialing SIP user ivan at number 1234 for 30 seconds and after this
if nobody picks up the extension with next priority level is to be
executed i.e. the asterisk will open the 777 mailbox at context
mb_tutorial. Then playback will run and the asterisk will hang you
up. PlayBack (vm-goodbye) plays the vm-goodbye file which has to be
in /var/lib/asterisk/sounds/.
The recorder voicemail messages
are recorder in
/var/spool/asterisk/voicemail/<context>/<mailbox>/INBOX/
so here the path will be
/var/spool/asterisk/voicemail/mb_tutorial/777/INBOX/.
To
listen to your mailbox you have to use the VoiceMailMain
command.
Synopsis :
VoiceMailMain(mailbox@context)
Here is what you can do with
your mailbox using VoiceMailMain.
1 Old Messages
3 Advanced options
1 Send reply
2 Call back
3 Envelope
4
Outgoing call
5 Leave message
* Return to main
menu
4 Play previous message
5 Repeat current
message
6 Play next message
7 Delete current message
8
Forward message to another mailbox
9 Save message in a folder
* Help; during msg playback: Rewind
# Exit; during msg
playback: Fastforward
2 Change folders
3 Advanced
options
0 Mailbox options
1 Record your unavailable message
2 Record
your busy message
3 Record your name
4 Change your password
* Return to the main menu
* Help
# Exit
While you listen to any recorded voicemail message you
can user the following keys for navigation:
# to
fastforward
* to rewind
Note :'#' and '*' keys only
work when the message is in the process of being played
back.
Ex. exten =>
9999,1,VoiceMailMain(777@mb_tutorial)
dialing 9999 you will enter the 777
mailbox after
typing the correct password for the mailbox
(1212).
Here is how our VoiceMail example looks
like:
1. Create voicemail context and mailbox at
voicemail.conf

We created mailbox context
[mb_tutorial]
and also mailbox number
777 with password
1212 for
user
ivan with email
ivan@asteriskguru.com.
2.
SIP users in sip.conf

If you are using voip hardphone which supports
voicemail messaging, then you can check your mailbox from the phone.
As the harphones communicate with asterisk through session
initiation protocol (SIP) this feature have to be adjusted in
sip.conf. When you receive a message MWI indication (message waiting
indication) will appear on the phone.
3. We will also format
a little extensions.conf
exten => 1234,1,Dial(SIP/ivan, 45)
Dial user ivan with SIP for 45
sec
exten =>
1234,2,VoiceMail(777@mb_tutorial)
If nobody answers or the line is busy or congested
you enter VoiceMail to leave message on 777
exten
=> 1234,3,PlayBack(vm-goodbye)
When done asterisk plays ‘goodbye’
message
exten => 1234,4,Wait(2)
Wait 2 more seconds
exten =>
1234,5,HangUp()
Asterisk closes the
connection