Skip to Content
Asterisk: The Future of Telephony, 2nd Edition
book

Asterisk: The Future of Telephony, 2nd Edition

by Jim Van Meggelen, Jared Smith, Leif Madsen
August 2007
Intermediate to advanced
608 pages
20h 33m
English
O'Reilly Media, Inc.
Content preview from Asterisk: The Future of Telephony, 2nd Edition

Building an Interactive Dialplan

The dialplan we just built was static; it will always perform the same actions on every call. We are going to start adding some logic to our dialplan so that it will perform different actions based on input from the user. To do this, we’re going to need to introduce a few more applications.

The Background(), WaitExten(), and Goto() Applications

One of the most important keys to building interactive Asterisk dialplans is the Background()[75] application. Like Playback(), it plays a recorded sound file. Unlike Playback(), however, when the caller presses a key (or series of keys) on her telephone keypad, it interrupts the playback and goes to the extension that corresponds with the pressed digit(s). If a caller presses 5, for example, Asterisk will stop playing the sound prompt and send control of the call to the first priority of extension 5.

The most common use of the Background() application is to create voice menus (often called auto-attendants or phone trees). Many companies use voice menus to direct callers to the proper extensions, thus relieving their receptionists from having to answer every single call.

Background() has the same syntax as Playback():

exten => 123,1,Answer()
exten => 123,n,Background(main-menu)

In earlier versions of Asterisk, if the Background() application finished playing the sound prompt and there were no more priorities in the current extension, Asterisk would sit and wait for input from the caller. Asterisk no longer does ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Asterisk: The Future of Telephony

Asterisk: The Future of Telephony

Jim Van Meggelen, Jared Smith, Leif Madsen
Switching to VoIP

Switching to VoIP

Theodore Wallingford

Publisher Resources

ISBN: 9780596510480Errata Page