1. VoiceMailMain - this application allows you to enter in the Asterisk’s voicemail system.
NOTE: This application is valid for Asterisk version 1.0.9 and above.
Syntax:
VoiceMailMain([[options]mailbox][@vm-context])
List with the possible options
s - this option will cancel the password check and the user will enter in the mailbox without entering password. p - this option will cause the supplied mailbox to be prepended to the user's entry and the resulting string is used as the mailbox number. This is useful for virtual hosting of voicemail boxes.
Purpose and usage
The purpose of this application is to give you an access to the Asterisk’s voicemail system. You will be asked to enter a voicemail number and password.
The usage is obvious. Thanks to this application you can check your voicemail box for new messages. Once you have entered the system, you can also manage your messages and folders. You can even record your own greeting message. The Asterisk system will guide you through the menus.
Below we will show you how you can use this application
To see how the application works we recommend to use our IAX softphone Idefisk. You can download it from here. Please also read our tutorial to learn how to configure it to work with Asterisk PBX.
Asterisk PBX configurations
NOTE: This is only an example of what for you can use this application. Of course you can use it and for other things.
iax.conf Configurations
We need one registered user in iax.conf file. This is because we are going to use the IAX2 protocol. If you want to use other protocol such as SIP or MGCP, you have to do the configurations below respectively in sip.conf or mgcp.conf.
So, we have registered the user user1
Type=friend means that this user can make and receive calls. Host=dynamic means that the IP is not static but dynamic through a DHCP server. Allow=all means that the line which this user will use, could support all audio codecs. Context=test - this shows that this user is working with the extensions in this context of the configuration file extensions.conf.
voicemail.conf Configurations
We have to create the mailboxes in the voicemail.conf file. Below we will show you a screenshot from our voicemail.conf file.
We will create two contexts. The first one is named [testmail] and the second one is named [testa].
In the first context we will define three mailboxes. In the second we will create one mailbox. The way of creating a mailbox is the following:
First you write the mailbox number. It is not necessary to be a number it could be also a name. In our case it would be numbers. They are followed by the => character. After this character the first argument is the desired password for the mailbox. The password is followed by the name and family name of the user and then his/her e-mail address. You can add and some other options, but we do not need them now. You can learn more about this options in our voicemail.conf tutorial.
In our example in the context [testmail] we will create one mailbox for the user Anatoliy Kun with mailbox number 1515 and password 1111. One for the user John Dowe with mailbox number 5678 and password 2222. One for the user Ivan Tse with mailbox number 9101 and password 3333.
In the context [testa] we will create one mailbox for the user Mama Mia with mailbox number 2233 and password 2211
We are ready with our voicemail boxes. Now, lets take a look at the extensions.conf file.
When somebody dials 5455, the call will be answered by the Answer application. The next executed extension will be the one which contains the VoiceMailMain application. There are several different combinations of arguments which you can use in the brackets of this application.
You can leave the space between the brackets blank. In this case the system will ask you to enter a mailbox number. This number could be from any context in the voicemail.conf file. In our case it could be from the context [testmail] or from the context [testa].
Another variant is to specify only the desired context. If we specify in the brackets, the context @testmail, the system will accept mailboxes only from this context in the voicemail.conf file. If you enter the mailbox number from the context [testa], the system will say that this mailbox is incorrect.
The third variant is to specify the mailbox number and context. In this case the Asterisk will ask you directly for the password of the specified mailbox number.
With all this variants you can use the s or the p option. With the s option, the prompt for password will be skipped. With the p option, the supplied mailbox will be prepended to the user's entry and the resulting string will be used as the mailbox number. This is useful for virtual hosting of voicemail boxes.
We will show you the all three variants.
1) Variant 1
In this variant, when somebody dials 5455, the call will be answered by the Answer application. The next executed extension will be the one which contains the VoiceMailMain application. Because there are no arguments, the system will ask the caller to enter a mailbox number and then to enter the password for this number. The caller will hear whether it has new messages or not. The caller could leave the mailbox either by hanging up the line or by pressing the pound key(#).
2) Variant 2
In this variant, when somebody dials 5455, the call will be answered by the Answer application. The next executed extension will be the one which contains the VoiceMailMain application. The argument in the brackets is desired context. In this case @testmail. The system will ask the caller to enter a mailbox number and then to enter the password for this number. Numbers from other contexts won’t be accepted. If the entered mailbox number is from the context [testmail] and the password is correct, the caller will hear, whether it has new messages or not. The caller could leave the mailbox either by hanging up the line or by pressing the pound key(#).
3) Variant 3
In this case, when somebody dials 5455, the call will be answered by the Answer application. The next executed extension will be the one which contains the VoiceMailMain application. As arguments in the brackets, we have the desired mailbox number and the context, at which is this number, in the voicemail.conf file. In our example this are 1515@testmail. The system won’t ask the caller to enter a mailbox number. It will ask directly for the password of the mailbox 1515. Numbers from other contexts won’t be accepted. If the entered password is correct, the caller will hear, whether it has new messages or not. The caller could leave the mailbox either by hanging up the line or by pressing the pound key(#).
As we have mentioned above, this applications will allow the user to manage its messages and folders and also it can change the recorded greeting and busy/unavailable messages. This could be done thanks to the Asterisk’s built-in voicemail menu. The menu has the following structure:
Press 0. New messages folder
Press 1. Old messages folder
Press 2. Work messages folder
Press 3. Family messages folder
Press 4. friend messages folder
Press #. Cancel
Press 3. Advanced options
Press 1. Send reply
Press 3. Hear the message envelope
Press 5. Leave a message
Press *. Return to the main menu
Press 4. Play previous message
Press 5. Repeat current message
Press 6. Play next message
Press 7. Delete current message
Press 8. Forward message to another mailbox
Press 9. Save message in a folder
Press 0. Mailbox options
Press 1. Record your unavailable message
Press 2. Record your busy message
Press 3. Record your name
Press 4. Change your password
Press *. Return to the main menu
Press *. Help
Press #. Exit
2. Screenshots of what you can see on the CLI of the Asterisk PBX
1) Without arguments
2) With context for argument
3. Additional information
For more information about extensions.conf you can check here.
For more information about iax.conf you can check here.
This application is tested with our IAX softphone Idefisk. You can download it from here. For more information about this softphone please read our tutorial.
If you would like to test this application with the SIP channel you can read our tutorials about the SIP Softphones to learn how to configure them to work with Asterisk PBX
sean browne (sb at seanbrowne dot com) 15 August 2008 19:51:43 Pravin,
You need to set DTMFMode correctly in sip.conf entry for your softphone.
Sean
Pravin (dabhade_pravin at yahoo dot com) 26 July 2006 09:29:50 Hi All
I install Voicemail sucessfully and tested it the voicemail message files are cretad at /var/spool/asterisk/voicemail/default/pravin/INBOX
and I create a voice mail extension like this
;voice mail main menu
exten => 1231,1,Answer
exten => 1231,2,VoiceMailMain(222@default)
exten => 1231,3,HangUp()
when I dial extension 1231 from xlite sip phone
on asterisk console I get following thing
*CLI> -- Executing Answer("SIP/222-08188db0", "") in new stack
-- Executing VoiceMailMain("SIP/222-08188db0", "222@default") in new stack
-- Playing 'vm-youhave' (language 'en')
-- Playing 'digits/11' (language 'en')
-- Playing 'vm-INBOX' (language 'en')
-- Playing 'vm-messages' (language 'en')
-- Playing 'vm-onefor' (language 'en')
-- Playing 'vm-INBOX' (language 'en')
-- Playing 'vm-messages' (language 'en')
-- Playing 'vm-opts' (language 'en')
-- Playing 'vm-helpexit' (language 'en')
but when I press 1 for entering into mailbox for new messgae I got noting no key press is detected by asterisk