Skip to Content
Asterisk: The Future of Telephony
book

Asterisk: The Future of Telephony

by Jim Van Meggelen, Jared Smith, Leif Madsen
September 2005
Intermediate to advanced
408 pages
16h 20m
English
O'Reilly Media, Inc.
Content preview from Asterisk: The Future of Telephony

Adding Logic to the Dialplan

The dialplan we just built was static—it always performs the same actions on every call. Now we’ll start adding some logic to our dialplan so that it will perform different actions based on input from the user. We’ll start by introducing a few more applications.

The Background() and Goto() Applications

One important key to building interactive Asterisk systems is the Background() 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 file 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,Background(hello-world)

Another useful application is Goto(). As its name implies, it is used to send the call to another context, extension, and priority. The Goto() application makes it easy to programmatically move a call between different parts of the dialplan. The syntax for the Goto() application calls for us to pass the destination context, ...

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, 2nd Edition

Asterisk: The Future of Telephony, 2nd Edition

Jim Van Meggelen, Jared Smith, Leif Madsen
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz

Publisher Resources

ISBN: 0596009623Supplemental ContentCatalog PageErrata