Take a look at the things that interest us.

Asterisk voicemail dial plan

Wesley Wesley 2 years

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.


  • 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.

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

1001 => 1111,Username,,,attach=yes|tz=ua|delete=yes
1002 => 1111,Username,,,attach=yes|tz=ua|delete=yes
1003 => 1111,Username,,,attach=yes|tz=ua|delete=yes
1004 => 1111,Username,,,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.

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


Sound files are stored in


Listening to voicemail can be done by dialing 500.

Asterisk voicemail dial plan 2021-08-24 08:02:12

There are no comments.


Have questions about our services?

Contact our Sales team to get answers.

Contact Us