Now we’re ready to create our first dialplan. We’ll start with a very simple example. We will design this dialplan so that as a call comes in, Asterisk will answer the call, play a sound file, and then hang up the call. We’ll use this simple example to point out the most important dialplan fundamentals.
For the examples in this chapter to work correctly, we’re assuming
that at least one Zap channel has been created and configured (as
described in the previous chapter), and that all incoming calls are sent
[incoming]context. If you’re
using other types of channels, you may need to adjust these examples to
fit your particular circumstances.
Before we get started with our dialplan, we ought to explain a
special extension called
calls enter a context without a specific destination extension (for
example, a ringing FXO line), they are handled automatically by the
s extension. (The
s stands for “start,” as most calls start in
s extension.) Since this is
exactly what we need for our dialplan, let’s begin to fill in the
pieces. We will be performing three actions on the call (answer it,
play a sound file, and hang it up), so we need to create an extension
s with three priorities.
We’ll place the three priorities inside
[incoming], as all incoming calls should
start in this context:
[incoming] exten => s,1,
application()exten => s,2,
application()exten => s,3,
Now all we need to do is fill in the applications, and we’ve ...