Setting up custom voicemail greetings in Asterisk

asterisk voice mail

Asterisk is a popular free and open source software implementation of a telephone private branch exchange (PBX) system available for many versions of Unix.

The software allows attached telephones to make calls to one another, connect to Public Switched Telephone Network (PSTN) systems, and connect to Voice Over Internet Protocol (VoIP) services. Additionally, users can set up voice mailing, conference calling, interactive phone menus, and automatic call distribution.

Asterisk is available in several pre-packaged distributions (including a Linux operating system, Asterisk, all relevant hardware drivers, and a User Interface), the most popular of which is Trixbox.

Voicemail greetings in Trixbox

Although Trixbox offers a lot of Asterisk customization options through its user interface and allows users to easily record / upload / manage custom voice greetings for IVRs (digital receptionists) and Ring Groups, setting up custom voicemail greetings for individual extensions isn’t catered for in the UI.

By default, Trixbox uses generic voicemail greetings (“The person at extension 123 is on the phone, please leave your message after the tone. When done, hang up or press the pound key.”) for all extensions. There are two ways to change these greetings:

Changing a voicemail greeting from a telephone connected to the Asterisk network:

A user can access their voice mailbox by calling “*97“, select “0” for Advanced Mailbox Options, and then select a number from “1” to “4” to record a specific type of greeting:

  • 1: Unavailable
  • 2: Busy
  • 3: User’s Name
  • 4: Temporary Greeting

This method, however, doesn’t cater for uploading custom-made sound files.

Uploading custom voicemail greetings:

Sound files added to Asterisk should be in the .wav format, PCM Encoded, 16 bits, at 8000Hz. These files can either be uploaded / recorded using the Trixbox Administrative User Interface or copied directly to the Asterisk server.

Open the IP Address (or hostname) of the Trixbox server in a web browser, then check in the top right-hand corner whether the interface is in “User Mode” or “Admin Mode“. If the interface is in “User Mode“, click on the “switch” link and enter the administrative login details (default username: “maint”).

Move the mouse over the “PBX” menu item, then click on “PBX Settings“.

Click on “System Recordings” in the left-side menu, then upload a sound file. Alternatively, enter an extension number on the System Recordings page to have Asterisk call that extension so the user can record a voicemail greeting.

Enter a name for the recording and click on the “Save” button. It’s a good idea to give all System Recordings easily recognizable names, for example “vm_personal_willem“, “vm_personal_eric“, “vm_personal_carla“, etc.

After you’ve uploaded or recorded all the voicemail greetings you need, open a Terminal window and log into the Trixbox server via SSH as the “root” user. On the server, System Recordings are stored in the “/var/lib/asterisk/sounds/custom/” directory and personal recordings are stored in the “/var/spool/asterisk/voicemail/default/…” directories.

Enter the following command to switch to the personal recordings directory and take a look at the contents:

cd /var/spool/asterisk/voicemail/default
ls -l

You should see a directory for each extension you have in Asterisk:

drwx------ 9 asterisk asterisk 4096 Oct 13 08:45 111
drwx------ 8 asterisk asterisk 4096 Oct 13 14:22 121
drwx------ 4 asterisk asterisk 4096 Oct  9 20:38 122
drwx------ 9 asterisk asterisk 4096 Oct 13 09:07 131
drwx------ 9 asterisk asterisk 4096 Oct 10 01:08 132
drwx------ 4 asterisk asterisk 4096 Oct  9 21:02 133
drwx------ 9 asterisk asterisk 4096 Oct 14 10:16 151
drwx------ 7 asterisk asterisk 4096 Oct 14 10:09 152
drwx------ 8 asterisk asterisk 4096 Oct 10 01:13 161

… with each extension directory containing a directory structure like this:

drwx------ 2 asterisk asterisk   4096 Oct 14 10:03 busy
drwx------ 2 asterisk asterisk   4096 Oct 14 10:03 greet
drwx------ 2 asterisk asterisk   4096 Oct 14 10:12 INBOX
drwx------ 2 asterisk asterisk   4096 Oct 14 10:11 Old
drwx------ 2 asterisk asterisk   4096 Oct 10 01:12 temp
drwx------ 2 asterisk asterisk   4096 Oct 14 10:07 tmp
drwx------ 2 asterisk asterisk   4096 Oct 14 10:03 unavail

Voicemail greetings uploaded or recorded as System Recordings should be copied to these extension directories as “busy.wav” and “unavail.wav” using commands similar to the following:

cp /var/lib/asterisk/sounds/custom/vm_personal_willem.wav /var/spool/asterisk/voicemail/default/151/busy.wav
cp /var/lib/asterisk/sounds/custom/vm_personal_willem.wav /var/spool/asterisk/voicemail/default/151/unavail.wav

After all of the extensions’ custom voicemail greetings have been copied into their relevant folders, run the following commands to set the correct file ownerships:

cd /var/spool/asterisk/voicemail/default/
chown -R asterisk:asterisk *.wav

Initiate a test call to one of the modified extensions to hear if the new voicemail greeting plays.

Persistant generic voicemail greetings

If you hear the new voicemail greeting but it’s followed by a “Please leave your message after the tone. When done, hang up or press the pound key.” message, you’ll need to check the “Do Not Play ‘please leave message after tone’ to caller” checkbox in Trixbox‘ settings:

Open the Trixbox Administrative User Interface in your web browser (see above), click on “General Settings” in the left-side menu, then make sure that the “Do Not Play ‘please leave message after tone’ to caller” checkbox is checked.

Next, click on “Extensions” in the left-side menu, select the extension that’s playing the additional message, and check the “Voicemail Instructions” checkbox in the VmX Locator section.

Click on the “Submit Changes” button at the bottom of the screen, then click on the orange “Apply Configuration Changes” bar at the top of the screen, and finally click on the “Continue with reload” link to have Asterisk activate your changes.

Mike The Situation

Mike The Situation

Geek Master at Geekology
Master of programming and general geekness.
Mike The Situation
About Mike The Situation
Master of programming and general geekness.

No Comments, Be The First!

Your email address will not be published.