System information

or from the shell with:
$ sudo /usr/sbin/asterisk -rx "dialplan reload"
Calling extension 200 from either of your configured phones should reward you with
the voice of Allison Smith saying “Hello World.”
If it doesn’t work, check the Asterisk console for error messages, and make sure your
channels are assigned to the LocalSets context.
We do not recommend that you move forward in this book until you
have verified the following:
1. Calls between extension 100 and 101 are working
2. Calling extension 200 plays “Hello World”
Even though this example is very short and simple, it emphasizes the core concepts of
contexts, extensions, priorities, and applications. You now have the fundamental
knowledge on which all dialplans are built.
Building an Interactive Dialplan
The dialplan we just built was static; it will always perform the same actions on every
call. Many dialplans will also need logic to perform different actions based on input
from the user, so let’s take a look at that now.
The Goto(), Background(), and WaitExten() Applications
As its name implies, the Goto() application is used to send a call to another part of the
dialplan. The syntax for the Goto() application requires us to pass the destination con-
text, extension, and priority on as arguments to the application, like this:
same => n,Goto(context,extension,priority)
We’re going to create a new context called TestMenu, and create an extension in our
LocalSets context that will pass calls to that context using Goto():
exten => 201,1,Goto(TestMenu,start,1) ; add this to the end of the
; [LocalSets] context
[TestMenu]
exten => start,1,Answer()
Now, whenever a device enters the LocalSets context and dials 201, the call will be
passed to the start extension in the TestMenu context (which currently won’t do any-
thing interesting because we still have more code to write).
116 | Chapter 6:Dialplan Basics