Voicemail
Description
Voicemail (or voice mail, voice-mail, vmail or VMS, sometimes called messagebank) is a centralized system of managing telephone messages for a large group of people. The term is also used more broadly, to denote any system of conveying voice messages, including the answering machine. (http://en.wikipedia.org/wiki/Voicemail)
Voicemail is automatically sent to a user's email if the email address is specified in the device details.
An audio recording in WAV format is attached to the email.
One minute of audio takes approx. 100 Kb.
Configuration
This section can be found in ADDONS –> PBX Functions –> External DIDs –> VoiceMail:
- VoiceMail Extension (local) - describes which local extensions a local user can dial to retrieve his voicemail (the system will ask him to enter his voicemail password, which can be set in the device's details).
If you want to setup VoiceMail (VM) on a different server, then the following settings are important:
- VoiceMail Server active - turns VM server on/off. When on, all VM requests will go to distant VM server; when off, VM will be handled locally on Asterisk.
- VoiceMail Server connection/device - describes connection to VM server.
- VoiceMail Retrieve Extension (local) - which extension to dial on a distant VM server to retrieve voicemail for an extension.
Example:
- Let's say we have our server on IP 23.45.67.89 connected with SIP to our Asterisk.
- We create a separate user/device (vm_device) to describe this connection. Device's type is SIP, IP = 23.45.67.89; set other settings also (codecs/etc).
- VoiceMail Retrieve Extension (local) = 999.
First action is when VM is recorded
So now when the VM server is ON and the user with device 201 gets a VM, the call is redirected like this:
Dial(SIP/vm_device/201)
This means that the server on 23.45.67.89 will receive a call to extension 201. The server SHOULD BE configured so that it will process VM correctly when it receives such a call.
Second action - retrieving VM
When user wants to retrieve his VM on a distant machine he dials VoiceMail Extension (local).
He is redirected like this:
Dial(SIP/vm_device/999#201)
Again, the distant server should know how to process such a request.
Let's say we have a distant VM server based on Asterisk.
So in our example its configuration in /etc/asterisk/extensions.conf should look like this:
[incoming] # to retrieve VM exten => _999#.,1,VoiceMailMain(${EXTEN:4}) exten => _999#.,2,Hangup
# to record VM exten => _X.,1,VoiceMail(${EXTEN}) exten => _X.,2,Hangup
Retrieve VoiceMail from outside over DID
- In PBX functions create new function with type: check_voicemail.
- Assign this PBX Function to a DID by editing the DID number.
FROM string
To change the Voicemail email sending FROM field, edit the /etc/asterisk/voicemail.conf file line:
;fromstring=The Asterisk PBX
to:
fromstring=SOME OTHER LINE
... and reload Asterisk.
Email sending when VM is received
- Go to Device settings
- Locate the Voicemail field
- Fill in Email – where to send received Voicemail.
- Fill in Password – the digital password the user enters when he calls the Voicemail number to hear his messages.
End User can change email field if User have VoiceMail email edit and Devices permissions enabled.
serveremail
This setting can be used to identify the source of a voicemail notification message.
;serveremail=asterisk
to:
serveremail=SOME OTHER LINE
OR:
;serveremail=asterisk@linux-support.net
to
serveremail=YOUR COMPANY@YOUR COMPANY.net
... and reload Asterisk.
Leave only one of those settings, not both.
Change Email template
Email subject line and body text can be configured only globally in Asterisk configuration file /etc/asterisk/voicemail.conf directly. Open this file with your favorite editor, and find the following lines:
;emailsubject=[PBX]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX} ; The following definition is very close to the default, but the default shows ; just the CIDNAME, if it is not null, otherwise just the CIDNUM, or "an unknown ; caller", if they are both null. ;emailbody=Dear ${VM_NAME}:\n\n\tjust wanted to let you know you were just left a ${VM_DUR} long message (number ${VM_MSGNUM})\nin mailbox ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE}, so you might\nwant to check it when you get a chance. Thanks!\n\n\t\t\t\t--Asterisk\n
Here you change template of Email subject line and Email body. Just uncomment (delete ; in the beginning of line) option name and change option content to your liking. After this is done reload voicemail settings with the following command:
asterisk -rx 'voicemail reload'
Asterisk variables related to Voicemail are explained here: https://docs.asterisk.org/Configuration/Dialplan/Variables/Channel-Variables/Asterisk-Standard-Channel-Variables/VoiceMail-Channel-Variables
Voicemail timezone
To configure specific timezone for Voicemail box, set label in the Timezone field (max 10 characters):
Then configure this label in /etc/asterisk/voicemail.conf under [zonemessages]:
[zonemessages] central=America/Chicago|'vm-received' Q 'digits/at' IMp eastern=America/New_York|'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
Here central, eastern, central24, military, european are default labels. Set your custom label below and configure by these rules:
'filename' filename of a soundfile (single ticks around the filename required) A or a Day of week (Saturday, Sunday, ...) B or b or h Month name (January, February, ...) d or e numeric day of month (first, second, ..., thirty-first) Y Year I or l Hour, 12 hour clock H Hour, 24 hour clock (single digit hours preceded by "oh") k Hour, 24 hour clock (single digit hours NOT preceded by "oh") M Minute, with 00 pronounced as "o'clock" N Minute, with 00 pronounced as "hundred" (US military time) P or p AM or PM Q "today", "yesterday" or ABdY q "" (for today), "yesterday", weekday, or ABdY R 24 hour time, including minute
After changes, restart Asterisk or execute command asterisk -rx 'voicemail reload'
Default timezone for all Voicemail boxes is central.
More info on Asterisk Voicemails: https://www.voip-info.org/asterisk-config-voicemailconf
Change UNAVAILABLE message
Dial Voicemail access number (default *97) and press 01; then, after the signal, dictate your UNAVAILABLE message. UNAVAILABLE message is played when call to your device is forwarded to Voicemail by "Failed" or "No Answer" Call states in Call Flow.
UNAVAILABLE message can be only set by using method mentioned above.
If default UNAVAILABLE message is changed, it is recommended to turn off intro message (http://wiki.kolmisoft.com/index.php/Call_Flow#Voicemail)
Change BUSY message
Dial Voicemail access number (default *97) and press 02; then, after the signal, dictate your BUSY message. BUSY message is played when call to your device is forwarded to Voicemail by "Busy" Call state in Call Flow.
BUSY message can be only set by using method mentioned above.
If default BUSY message is changed, it is recommended to turn off intro message (http://wiki.kolmisoft.com/index.php/Call_Flow#Voicemail)
MWI - Message Waiting Indication
This option is available starting from MOR 9
In telephony, a Message Waiting Indicator (MWI) is a telephone calling feature that illuminates a LED on selected telephones to notify a user of waiting voicemail messages. It works on most telephone networks and PBXs. (Wikipedia)
MWI is supported automatically starting from MOR 9.
Most phones support this feature.
Change encoding on voicemail emails
If you use, for e.g. Greek language in Voicemail text or in Users details in MOR you need to enable the UTF-8 Encoding.
To do so, first of all enable it on Ast.Voicemail side. Edit /etc/asterisk/voicemail.conf, uncomment charset and make it UTF-8 :
charset=UTF-8
To apply changes reload the Voicemail in Asterisk CLI:
VM*CLI> voicemail reload
This will lead to send Voicemail emails in UTF-8 Encoding. However, if you have User with details which are in, for e.g. Greek language, Asterisk should read the data from DB using UTF-8 Encoding.
For this, edit the /etc/asterisk/res_config_mysql.conf, uncomment dbcharset and set it to UTF-8:
dbcharset = utf8
Once changes are applied, reload Asterisk:
VM*CLI> reload
Now, Asterisk will correctly send text in UTF-8 Encoding even if, for e.g., Greek text is used in Voicemail email text or in DB.
Change Voicemail language
Set language in Device Edit window.
Delete Voicemail in mass
You can delete unwanted voicemails directly from the server.
The main directory where voicemails are saved is:
/var/spool/asterisk/voicemail
Maximum length of a voicemail message
Uncomment variable maxsecs in /etc/asterisk/voicemail.conf This defines the maximum amount of time in seconds of an incoming message.
For example, this will set max duration to 5 minutes
maxsecs = 300
For changes to take effect, reload voicemail configuration
asterisk -rx 'voicemail reload'
Custom email server for Voicemail emails
By default, a local email relay is used. If some other email server needs to be used, then:
Install additional packages:
yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain
Add these lines to the bottom of /etc/postfix/main.cf
relayhost = smtp.yourmailserver.com:587 smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_security_options = noanonymous smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt smtp_generic_maps = hash:/etc/postfix/generic smtp_tls_security_level = secure smtp_tls_mandatory_protocols = TLSv1 smtp_tls_mandatory_ciphers = high smtp_tls_secure_cert_match = nexthop
Create /etc/postfix/sasl_passwd with content
smtp.yourmailserver.com user@yourmailserver.com:passwordofuser
run
postmap /etc/postfix/sasl_passwd
secure file
chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
Add this line to the bottom of /etc/postfix/generic
root@CentOS-68-64-minimal.localdomain sender@yourmailserver.com
replace "CentOS-68-64-minimal.localdomai" with your servers hostname; replace sender@yourmailserver.com with suitable sender address.
Run
postmap /etc/postfix/generic service postfix restart
Testing Voicemail emails
This command sends email same way as Asterisk does:
mail -s "Test Subject" yourmailbox@domain.com < /dev/null
Upload prerecorded Voicemail messages
The location of the WAV file: /var/spool/asterisk/voicemail/default/1234/
where 1234 is an extension number.
2 files can be replaced: busy.wav and unavail.wav (names must be the same)
Should be changed on all asterisk servers if there are several of them.
Make sure to: Convert WAV file to Asterisk playable format before uploading.