The dialplan is the routing core of an Asterisk server. Its sole role is to look at what is dialed, and route the call to its destination. This is the core of any telephony system and Asterisk is no different.
The dialplan is made up of three elements—extensions, contexts, and priorities. An extension is number or pattern that the dialed number is to be matched against and a context is a collection of extensions (and possibly other included contexts too). Each extension will have one or more priorities, each of which appear on a separate line, and the priority sequence always starts with the priority "1".
If you have read Building Telephony Systems with Asterisk, you will know how to use extensions, priorities, contexts, and included contexts to handle incoming and outgoing calls as well as to set up features such as:
Call Queues
Call Parking
Direct Inward Dialling
Voicemail
Automated Phone Directory
Conference Rooms
In this chapter, we will build on this knowledge by looking at:
Significant updates since Asterisk 1.2
Pattern ordering within and between contexts
Extending the dialplan with variables
The
DEVSTATE()
functionThe
SYSTEM
application
We will then use this knowledge to provide examples of:
Advanced call routing with the
DEVSTATE()
functionCall routing based on the time of the day
Using multiple ADSL lines within Asterisk to boost call capacity
The dialplan is primarily defined in the extensions.conf
file. This can also include additional files that are added into it using the #include
directive. For instance, systems using the FreePBX GUI will have extensions_additional.conf, extensions_custom.conf
, and extensions_override_freepbx.conf
as standard files, which have been added using #include
into the extensions.conf
file. We must also remain aware of files such as the features.conf
file, as they also include numbers that can be dialed such as codes for Pickup and Call Parking, and so form part of the dialplan.
A list of standard and optional Asterisk configuration files can be found at http://www.voip-info.org/wiki/view/Asterisk+config+files.