O'Reilly logo

Asterisk: The Future of Telephony by Leif Madsen, Jared Smith, Jim Van Meggelen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Simple Dialplan

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 to the [incoming]context. If you’re using other types of channels, you may need to adjust these examples to fit your particular circumstances.

The s Extension

Before we get started with our dialplan, we ought to explain a special extension called s. When 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 the 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 called 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,application()

Now all we need to do is fill in the applications, and we’ve ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required