VoIPowering Your Office with Asterisk: SOHO VoIP, Part 6

Last week we set up a very simple digital receptionist and installed Zgsmplay for reviewing Asterisk’s GSM-formatted soundfiles. Today we’re going to build a better custom recorder for creating our own custom prompts and greetings.

A better way to record custom prompts
In Part 4 we set up a simple context for recording custom prompts. This might be all you’ll ever need. But for folks who have greetings that change a lot, or who want to delegate prompt maintenance to users, or who like to do things the cool way, it’s pretty clunky. You might want to record cheery holiday greetings, do a message of the day, announce schedule changes, announce your latest specials, remind callers that it’s your birthday and they darn well better make a fuss—you are limited only by your imagination, because using Asterisk for voicemail gives you the power to do just about anything you want.

First create a directory to store your custom prompts in, like /var/lib/asterisk/sounds/local/. Then record some instructional prompts using the context created Part 4:

r-record-motd-welcome.gsm, “Welcome to the Message of the Day management menu. Please enter your password.”

r-listen-or-record.gsm, “To listen to the current message of the day, press 1. To go directly to the recording menu press 2.”

r-record-at-tone.gsm, “To record a new message begin speaking after the beep. When you’re finished press the pound key.”

r-accept-or-record.gsm, “To re-record your message, press 2. If you are finished press 3. ”

r-thankyou-new-prompt.gsm, “Thank you for updating the prompt, and have a pleasant day.”

r-invalid-option.gsm, “I’m sorry, that is not a valid option, so I’m sending you back to the beginning.”

This is a complete example [record-motd] context:

;options menu
exten => s,1,Playback(r-record-motd-welcome)
exten => s,2,DigitTimeout,5
exten => s,3,ResponseTimeout,10
exten => s,4,Authenticate(2345)
exten => s,5,Background(local/r-listen-or-record)
exten => s,6,Background(local/r-accept-or-record)
;play existing MOTD
exten => 1,1,Wait(1)
exten => 1,2,Playback(local/motd)
exten => 1,3,Goto(s,6)
;record Message of the Day
exten => 2,1,Wait(1)
exten => 2,2,Playback(local/r-record-at-tone)
exten => 2,3,Wait(2)
exten => 2,4,Record(local/motd:gsm)
exten => 2,5,Wait(1)
exten => 2,6,Playback(local/motd)
exten => 2,7,Wait(1)
exten => 2,8,Goto(s,6)
;accept the new prompt
exten => 3,1,Playback(local/r-thankyou-new-prompt)
exten => 3,2,Hangup
;hangup if the timeouts are exceeded
exten => t,1,Hangup
;send the caller back to the beginning
;if they enter an invalid option
exten => i,1,Playback(local/r-invalid-option)
exten => i,2,Goto(s,2)

Using the new context
Put it in your [local-users] context like this, assigning it an unused extension number:

exten => 505,1,Goto(record-motd,s,1)

Now any of your local users who have the password can change the Message of the Day.

Fixing sound problems
A common problem with modern Linux distributions is muted sound. I don’t know why they do this, but the default installation on a lot of distributions mutes all the sound channels. If your Asterisk server isn’t running X Windows you have even fewer options for figuring out why everyone but you is having fun with Asterisk sound files.

Prod interface

Figure 1

Your best bet is to install alsamixer. Alsamixer runs in the console and uses NCURSES to provide a nice graphical interface. On Fedora, Red Hat, CentOS, and so forth, yum install alsa-utils will take care of it. On Debian and its derivatives, such as the Ubuntu family, apt-get install alsa-base alsa-utils.

Once it’s installed, fire it up by running the alsamixer command. You’ll see something like Figure 1.

This shows all of your different playback and recording channels. I don’t even pretend to understand most of it. I do know that I want the Master and PCM channels working for playback. If you see MM, that means the channel is muted, as Figure 2 shows:

Prod interface

Figure 2

And the legend at the top says “Master [Off]”. To mute or un-mute a channel, select it by navigating with the arrow keys, then press the letter M. To adjust the channel volume, use the up and down arrow keys, or the Page Up/Down keys. To see the help menu, press F1. There is also a helpful man page, man alsamixer.

Now that we’ve covered the fundamentals of Interactive Voice Recording and managing custom sound files, the next step is to construct more elaborate voicemail trees. Come back next week to learn how to setup efficient nested voice menus, and how to torture telemarketers and other unpleasant callers.

VoIPowering Your Office with Asterisk: SOHO VoIP; terminology explained
VoIPowering Your Office with Asterisk: SOHO VoIP part 2; connecting legacy PSTN lines to Asterisk, inbound calling
VoIPowering Your Office with Asterisk: SOHO VoIP, Part 3; setting up outbound calls safely
VoIPowering Your Office with Asterisk: SOHO VoIP, Part 4; set up voicemail
VoIPowering Your Office with Asterisk: SOHO VoIP, Part 5; interactive voice response systems

Latest Articles

Follow Us On Social Media

Explore More