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.
One important key to building interactive Asterisk systems is
Background() application. Like
Playback(), it plays a recorded
sound file. Unlike
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
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, ...