In this lesson we will create a new voicemail.conf file and move the sample one to use for reference. The new voicemail.conf file will setup the voicemail configuration for the two sip accounts.
Creating the voicemail.conf file
To move the voicemail.conf file use the following command:
sudo mv /etc/asterisk/voicemail.conf /etc/asterisk/voicemail.conf.sample
Now to create a new voicemail.conf file use the following command:
sudo touch /etc/asterisk/voicemail.conf
Adding the [general] context info
It is now time to modify the voicemail.conf file. The first sections will be the [general] context. We will use the default settings from the original voicemail.conf file. They can be altered as you see fit. To edit the file use the command:
sudo nano /etc/asterisk/voicemail.conf
Add the following information to the voicemail.conf file:
[general]
format=wav49|gsm|wav
serveremail=asterisk
attach=yes
skipms=3000
maxsilence=10
silencethreshold=128
maxlogins=3
emaildateformat=%A, %B %d, %Y at %r
pagerdateformat=%A, %B %d, %Y at %r
sendvoicemail=yes
Adding the [zonemessages] context info
The information may need to be adjusted for your time zone. If you will not be setting timezones for your users, this information is not needed. Below are some examples of timezones that can be defined:
[zonemessages]
eastern=America/New_York|'vm-received' Q 'digits/at' IMp
central=America/Chicago|'vm-received' Q 'digits/at' IMp
central24=America/Chicago|'vm-received' q 'digits/at' H N 'hours'
military=Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p'
european=Europe/Copenhagen|'vm-received' a d b 'digits/at' HM
Adding the [default] context for our users
We will now add the context to setup the voice mailbox of each user. In the previous lessons we used extension 100 for matthew and extension 101 for eva. For simplicity we will use the same extension numbers for voicemail. The settings will consist of a password, mailbox, and email address.
We will create a context named [default] and add the information for the sip accounts. The passwords are set to the same the extension. This tells Asterisk that the voice mailbox needs setup. A mailbox is created with the same name as the account and the emails will send voicemail notifications to the inbox of the email address listed. Add the following information to voicemail.conf and save the file:
[default]
100 => 100,matthew,[email protected]
101 => 101,eva,[email protected],,tz=eastern
Looking at the code above, the first parameter after the => defines the password, followed by the name of the user, which is then followed by the email addresses associated with the voice mailbox. The second account also sets the timezone for the user.
If you want the users to be able to change their password and encourage them to change it add the following settings to the [general] context of the voicemail.conf file:
forcename=yes
forcegreeting=yes
Anytime changes are made the voicemail.conf file, it will need to reloaded in the Asterisk console. Open the asterisk console and use the command:
voicemail reload
To see the list of voice mailboxes use the following command in the Asterisk console:
voicemail show users