Would you like to learn how to configure Asterisk Voicemail feature on Ubuntu Linux? In this tutorial, we are going to show you how to install the Asterisk VoIP server, how to configure a SIP extension and how to enable the Voicemail feature on Ubuntu Linux version 16.

Ubuntu 17 was not able to compile the required packages.

Hardware List:

The following section presents the list of equipment used to create this Asterisk tutorial.

Every piece of hardware listed above can be found at Amazon website.

Asterisk Playlist:

On this page, we offer quick access to a list of videos related to Ubuntu Linux.

Don’t forget to subscribe to our youtube channel named FKIT.

Asterisk Related Tutorial:

On this page, we offer quick access to a list of tutorials related to Asterisk.

Tutorial – Asterisk Installation on Linux

On the Linux console, use the following commands to set the correct timezone.

# dpkg-reconfigure tzdata

Install the Ntpdate package and set the correct date and time immediately.

# apt-get install ntpdate
# ntpdate pool.ntp.br

In our example, the Ntpdate command was used to set the correct date and time using the Brazilian server pool.ntp.br

Let’s install the NTP service.

# apt-get install ntp

NTP is the service that will keep our server updated.

Use the command date to check the date and time configured on your Ubuntu Linux.

# date

If the system shown the correct date and time, this means that you followed all the steps correctly.

Use the following commands to install the required packages.

# apt-get update
# apt-get install linux-headers-`uname -r`
# apt-get install build-essential

Download, compile and install the DAHDI package.

# mkdir /downloads
# cd /downloads
# wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
# tar -zxvf dahdi-linux-complete-current.tar.gz
# cd dahdi-linux-complete-2.11.1+2.11.1/
# make all
# make install

Download, compile and install the LIBPRI package.

# cd /downloads
# wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
# tar -zxvf libpri-current.tar.gz
# cd libpri-1.6.0
# make all
# make install

Download the Asterisk software and install the required packages.

# cd /downloads
# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-15-current.tar.gz
# tar -zxvf asterisk-15-current.tar.gz
# cd asterisk-15.4.0/contrib/scripts/
# ./install_prereq install

Compile and install the ASTERISK software.

# cd /downloads/asterisk-15.4.0
# ./configure
# make menuselect
# make
# make install

The make menuselect command will open a menu where you can select modules that should be installed.

If you don’t know what to do, leave default modules and click on the Save and Exit button.

Use the following commands to install configuration files samples:

# make samples

Use the following commands to install the configuration files:

# make config
# make install-logrotate

Use the following commands to start the asterisk service:

# /etc/init.d/asterisk start

Tutorial – Asterisk VoiceMail

After finishing the Asterisk Installation we need to create the Sip extensions.

Delete the content of the sip.conf configuration file.

# echo > /etc/asterisk/sip.conf

Edit the sip.conf configuration file.

# vi /etc/asterisk/sip.conf

Here is the file content.

[general]

allowguest=no
srvlookup=no
udpbindaddr=0.0.0.0
tcpenable=no
canreinvite = no
dtmfmode=auto

;

[ramal-voip](!)

type=friend
context=INTERNO
host=dynamic
disallow=all
allow=ulaw
allow=alaw
allow=g729

;

[100](ramal-voip)

secret=pass100
callerid=”Vegeto” <100>

;

[200](ramal-voip)

secret=pass200
callerid=”Kakarot” <200>

Next, we need to create the dial plan.

Delete the content of the extensions.conf configuration file

# echo > /etc/asterisk/extensions.conf

Edit the extensions.conf configuration file.

# vi /etc/asterisk/extensions.conf

Here is the file content.

[general]

[INTERNO]

;
;VOICEMAIL MENU
;
exten => 500,1,VoiceMailMain()
exten => 500,2,HangUp()
exten => 500,3,PlayBack(vm-goodbye)
exten => 500,4,HangUp()
;
; EXTENSION 100 + VOICEMAIL (FOR TEST ONLY)
;
exten => 100,1,Dial(SIP/100,5)
exten => 100,2,VoiceMail(100)
;
; EXTENSION 200 (FOR TEST ONLY)
;
exten => 200,1,Dial(SIP/200)

In our example, the extension 100 will redirect an unanswered call to the voicemail after 5 seconds.

In our example, the extension 200 does not have voicemail.

In our example, if any extension dial 500 it will be sent to the Voicemail menu.

Delete the content of the voicemail.conf configuration file.

# echo > /etc/asterisk/voicemail.conf

Edit the voicemail.conf configuration file.

# vi /etc/asterisk/voicemail.conf

Here is the file content.

[general]

format=wav
maxmsg=100
maxsecs=60
minsecs=3
skipms=3000
maxsilence=10
silencethreshold=128
maxlogins=3

[default]

100 => 777,Prince Vegeto,vegeto.blue@gmail.com

In our example, the extension 100 was configured to use the Voicemail password 777.

In our example, the extension 100 was configured to use the email vegeto.blue@gmail.com.

You should restart Asterisk manually and verify the service status.

# service asterisk stop
# service asterisk start
# service asterisk status

Here is an example of the Asterisk service status output.

● asterisk.service – LSB: Asterisk PBX
Loaded: loaded (/etc/init.d/asterisk; bad; vendor preset: enabled)
Active: active (running) since Thu 2018-05-03 11:16:27 -03; 4s ago
Docs: man:systemd-sysv-generator(8)
Process: 28268 ExecStop=/etc/init.d/asterisk stop (code=exited, status=0/SUCCESS)
Process: 28318 ExecStart=/etc/init.d/asterisk start (code=exited, status=0/SUCCESS)
Tasks: 82
Memory: 34.1M
CPU: 645ms
CGroup: /system.slice/asterisk.service
└─28332 /usr/sbin/asterisk

Now, you can use a SIP VoIP Client to connect to the Asterisk Server.

I like to use the Zoiper VoIP Client.

• Username – 100
• Password – pass100
• Host – Asterisk server IP address
• Domain – Asterisk server IP address

Zoiper VoIP client SIP

Time to test your Asterisk installation.

Use the 200 extension you should call the 100 extension and leave a message.

Use the 100 extension and call the 500 extension to access the Voicemail menu.

After entering the 777 password you will be able to hear the voicemail.

The Voicemail message needs to have at least 3 seconds to be accepted.

If you want to debug the asterisk communication, stop the Asterisk service and start it using the following command.

# service asterisk stop
# asterisk -vvvvvv -g -dddddd -c