Blogs
Take a look at the things that interest us.
Asterisk voicemail dial plan
In this post, I would like to go in-depth with how to set up an answering machine-like system in Asterisk. For our system, we will use the Asterisk feature called Voicemail.
Requirements
- Asterisk 16 or [18]
- [Basic Sip Account set up]
What is a voicemail
A voicemail system is a system for sending, storing, and retrieving audio messages, just like an answering machine would do at home.
How to set up voicemail for Asterisk
To be able to use the Asterisk voicemail feature, we'll need to add a few parameters to our voicemail.conf file. First, let's move to our Asterisk directory and open the voicemail.conf file.
$ cd /etc/asterisk
$ vi /voicemail.conf
Now let's add the following parameters to the file and save it.
[general]
format=wav49|gsm|wav ; Format of audio files
maxmsg=100 ; The maximum number of messages (standard 100, maximum 9999)
maxsecs=120 ; Maximum message time in seconds
maxgreet=60 ; Maximum greeting time in seconds
maxsilence=10 ; Number of seconds of silence before recording is complete
silencethreshold=128 ; Threshold sensitivity to silence, the lower the sensitivity, the value from 0 to 256, standard 128
maxlogins=3 ; Maximum number of failed connection attempts
[voicemailcontext]
1001 => 1111,Username,test@example.com,,attach=yes|tz=ua|delete=yes
1002 => 1111,Username,test@example.com,,attach=yes|tz=ua|delete=yes
1003 => 1111,Username,test@example.com,,attach=yes|tz=ua|delete=yes
1004 => 1111,Username,test@example.com,,attach=yes|tz=ua|delete=yes
Setting up voicemail dial plan in Asterisk
The next step is setting up the voicemail for our dial plan. Let's open the file extensions.conf.
$ vi /extensions.conf
Here we will add the following parameters to the file and save it.
[extensions]
exten => _1XXX,1,Ringing
exten => _1XXX,n,Dial(PJSIP/${EXTEN},60,tT)
exten => _1XXX,n,Answer
exten => _1XXX,n,VoiceMail(${EXTEN}@voicemailcontext)
exten => 500,1,Log(NOTICE, Dialing out from ${CALLERID(all)} to VoiceMail (500))
exten => 500,n,VoiceMailMain(0${CALLERID(num)}@voicemailcontext,s)
exten => 500,n,Hangup
Now let's restart Asterisk with the following command.
$ systemctl restart asterisk
Our voicemail example has been set up and you are ready to test it out.
The recorded messages are stored in the directory
/var/spool/asterisk/voicemail/
Sound files are stored in
/usr/share/asterisk/sounds
Listening to voicemail can be done by dialing 500.
There are no comments.