A Simple Dialplan
Now we’re ready to create our first dialplan. We’ll start with a very simple example. We are going to instruct Asterisk to answer a call, play a sound file, and hang up. 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 channel (either Zap, SIP, or IAX2) has been created
and configured (as described in the previous chapter), and that all
calls coming into that channel enter the dialplan at the [incoming] context. If you have been creative
with any previous examples, you may need to make adjustments to fit your
particular channel names.
The s Extension
Because of the technology we are using in our channels, we need to
cover one more thing before we get started with our dialplan. We need
to explain extension s. When calls
enter a context without a specific destination extension (for example,
a ringing FXO line), they are passed to the s extension. (The s stands for “start,” as this is where a
call will start if no extension information was passed with the
call.)
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 our extension
called s will need three
priorities. We’ll place the three priorities below [incoming], because we have decided that all incoming calls should
start in this context.[72]
[incoming] exten => s,1, ...