VoIPowering Your Office: Asterisk 1.4�Part 2: Neat New Stuff

Last week we revisited the Asterisk 1.4 beta, which is close to a final release.
Mostly mourning all the old familiar commands and applications that have changed
or been removed. Today we’re going to look at the correct way to use some of
the changed bits, and review brand new applications and features.

Core show
One of the more challenging aspects of running Asterisk is finding out what
commands and functions are even available. The best place to get current information
is the Asterisk CLI. Now, all of these “what the heck is in there” commands
have been put under the core module. Call up the Asterisk help (and check
out my cool custom Asterisk prompt, which we talked about last week):

12:44:24, 0.03, asterisk1.alrac.net> help

Check out the core show commands—that’s where you find everything
that is on your server.

CallerID, Date, Time
These have changed quite a bit. In the olden days we had these Asterisk commands
at our disposal: DateTime, SetCIDname, and SetCIDnum. These were deprecated
in 1.2, and are removed from 1.4. Now we must use sayunixtime and the
CALLERID function.

sayunixtime speaks the current date and time, using the standard sound files that come with Asterisk. See the SayUnixTime page to see how to use it.

Caller ID is something virtually all Asterisk admins use. This example shows my Free World Dialup configuration, which has to send my login for outbound calls.

;free world dialup settings
;outgoing free world dialup
exten => _393.,1,Set(CALLERID(name)=${FWDCIDNAME})
exten => _393.,n,Dial(IAX2/${FWDNUMBER}:${FWDPASSWORD}@iax2.fwdnet.net/${EXTEN:3},60)
exten => _393.,n,Congestion

Which also shows how easy it is to spoof Caller ID.

Speech recognition API
This is quite new, but the potential is obvious—text-to-speech readers
and speech-to-text transcribers, doing complex tasks from mobile phones, and
help for the hearing-impaired are just a few of the potential applications.
It’s not a full-blown speech engine, but an API (Application Programming Interface)
that provides hooks for whatever speech engine you want to try to use with Asterisk.
The next Big Wave of Cool Stuff in computing is going to be triggered by reliable
speech recognition technology. Imagine calling home to turn on the lights and
heat, or dictating complex documents over a mobile phone, or helping people
with hearing or vision impairments. When it works right it’s going to be huge.

Answering machine detection
This is a brand-shiny-new feature included in Asterisk 1.4. (It was available
as an add-on for 1.2.) Answering machine detection attempts to figure out if
a human or machine answers your call. Obviously this is useless when you’re
making a call yourself, but it’s useful for call centers that use predictive
dialers. (I know, I have the words “evil! evil!” dancing in my head, too. But
these can be used for good, too—they’re just nice, innocent tools.)

Configuration is as easy as pie. Go take a look at /etc/asterisk/amd.conf. Here you set a number of values in milliseconds, such as the duration before the initial greeting, the silence after a greeting, and the length of a greeting. This seems like a rather iffy method, but since most folks leave over-long greetings on their answering machines and leave long gaps before the beep, it should work fairly well.

To use it in your dialplan, do something like this:

exten => s,1,AMD
exten => s,2,GotoIf($[${AMDSTATUS}=AMD_PERSON]?humn:mach)
exten => s,3(mach),WaitForSilence(2500)
exten => s,4,Hangup
exten => s,5(humn),WaitForSilence(500)
exten => s,6,Playback(message-when-human)
exten => s,7,Hangup

You’ll need additional configuration to connect it to whatever set of phone numbers or predictive dialer you’re using. This is adapted from the Asterisk command AMD page. The Asterisk Expressions page tells what the stuff between the curly braces means. In this example, AMDSTATUS is a built-in channel variable for AMD. AMD_PERSON is one possible built-in value for AMDSTATUS. ?humn:mach means “choose one of these based on whatever the previous expression decides.” humn and mach are arbitary labels that you can invent on the spot, because they are matched up in the next few lines in the context.

Then, if [${AMDSTATUS}=AMD_PERSON] evaluates to humn, it plays
the message-when-human message. If it evaluates to mach it hangs
up. WaitForSilence is an Asterisk command that pauses the call until
the specified time limit is passed.

A typical predictive-dialer phone spammer uses this sort of tactic; if the dialer determines that you answered your phone, it plays a message to keep you on the line until one of their representatives can talk to you. This tool can also be used for good, like getting out important messages. For example, volunteer fire departments and volunteer sheriff’s posses can save a bit of volunteer burnout by automating meeting announcements. In that case they would want to play a message even if a machine answers, and not play the message until the answering machine is ready to record it.

Your best source of current Asterisk information is the doc folder in your Asterisk source tree.

Latest Articles

Follow Us On Social Media

Explore More