4. Asterisk Voicemail     ( Back to Tutorials Page )

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

voicemail.png

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



User Comments

Raheel <raheel213 at yahoo dot com>
20 March 2006 09:27:09
can any one teel me how these voice messages will be forwarded to email address..
mbergen <mbergen at here dot ca>
04 March 2006 15:28:12
The @context tip was great.
Thanks.
andy <endocrantz at yahoo dot com>
26 January 2006 01:36:04
The above specifies the voicemail context "mb_tutorial" in both voicemail.conf and extensions.conf

As the voicemail is located in this special context asterisk VoicemailMain will only find it if you specify that context in extensions.conf:

exten => 2468,1,VoicemailMain(777@mb_tutorial)
exten => 2468,n,Goto(s,6)

Dialing 2468 will call the 777 voice mailbox now

Without a context specified asterisk only searches [default]
A few other tricks can be accomplished, See:
http://www.voip-info.org/wiki-Asterisk+cmd+VoiceMailMain
ortega <ortega at codinet dot com dot mx>
13 November 2005 15:55:42
Try changing the value dtmfmode in sip.conf
borghart <borghart at gmx dot de>
06 November 2005 12:44:07
@Alex: i'm having the same problem: although i enter the correct password (asterisk -vvv shows stuff like "Sending dtmf: 42 (*), at ip.address") asterisk does not react to the input. do you know how to fix this?
Alex <blanc dot noire at gmail dot com>
17 October 2005 05:06:41
Yeap i read it... but still can't seem to figure out why i can't access it...

thanks for your help Lacho
Lacho <support at asteriskguru dot com>
13 October 2005 14:42:45
Hi Alex. Did you read our tutorial about the VoicemailMain application. Perhaps you can find there the solution. There you can find more detailed information about this application.
Alex <blanc dot noire at gmail dot com>
13 October 2005 06:55:00
Hi there... can dial the VoiceMailMain, but the server tells me to "please enter password". even though i enter the correct password for the particular mailbox, nothing happens...what could be the reason? anyway to rectify it?
athanase <webmaster at esgis dot tg>
08 September 2005 14:44:33
i think that is cool but if you can be more clear in the email that record the voice in the server that can be interesthing.
i dont no that if my linux acount is athanase@athanase, i can use it like my mail in my voicemail configuration .
please explane it to me.
balvinder <balvinderjassar at gmail dot com>
05 August 2005 14:13:03
helped me out newbees must try this

Add Comment

Name:
Email:
Comment:
 

contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™