Asterisk Config Examples

The configuration file "extensions.conf" contains the "dial plan" of Asterisk, the master plan of control or execution flow for all of its operations. It controls how incoming and outgoing calls are handled and routed. This is where you configure the behavior of all connections through your PBX.

The content of "extensions.conf" is organized in sections, which can be either for static settings and definitions, or for executable dialplan components in which case they are referred to as contexts. The settings sections are general and globals and the names of contexts are entirely defined by the system administrator. A special type of contexts are macros, label by a userdefined name prefixed with macro-. These are reusable execution patterns, alike procedures in a programming language. Every section in extensions.conf starts with the name of the sections contained within square brackets. This gives the extensions.conf file a similar structure to the traditional .ini file format of the Windows world.

Tip: With the help of vim syntax highlighting you can ease your dialplan work considerably, and - most importantly - make it less error prone to typos.

Asterisk Dialplan Planning - General discussion about organizing a dialplan

New in Asterisk v1.2: By default, there is a new option called "autofallthrough" in extensions.conf that is set to yes. Asterisk 1.0 (and earlier) behavior was to wait for an extension to be dialed after there were no more extensions to execute. "autofallthrough" changes this behavior so that the call will immediately be terminated with BUSY, CONGESTION, or HANGUP based on Asterisk's best guess. If you are writing an extension for IVR, you must use the WaitExten application if "autofallthrough" is set to yes.


At the top of your extensions.conf file, you configure a few general settings in the section headed general. For details, see:
Dialplan General Settings


Next, in the globals section, you may define global variables (or constants) and their initial values. For details, see:
Dialplan Global Variables
Using Variables in Asterisk Dialplans

Contexts and Extensions

After the general and globals categories, the remainder of the extensions.conf file is taken up by the definition of the Dialplan. The Dialplan consists of a collection of contexts. Each context consists of a collection of extensions. For an introduction to these topics, see:
Introducing Contexts and Extensions

Extension Patterns

When you define the extensions within a context, you may not only use literal numbers, not only alphanumeric names, but also you may define extensions that match whole sets of dialed numbers by using extension patterns. For more information about this, see:
Extension Names and Patterns

Created by: netexperts, Last modification: Sat 28 of Apr, 2007 (07:51 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+