What is a dialplan?

The core of any Asterisk system is the dialplan. A dialplan controls how incoming and outgoing calls are handled and routed. It contains instructions that tell Asterisk how to respond when it receives a call or when someone dials an extension. The dialplan is usually stored in the /etc/asterisk/extensions.conf file.

The dialplan is a form of scripting language and is made up of contexts, extensions, priorities, and applications. For example, the following is a valid dialplan configuration:

[local]
exten => 100,1,Dial(SIP/alice)

This simple dialplan above consists of the following components:

  • [local] – the context. Contexts are used to keep different parts of the dialplan from interacting with one another. An extension defined in one context is isolated from extensions in other contexts.
  • exten => – the syntax for the extension.
  • 100 – the extension itself.
  • 1 – the priority of the extension. An extension can have multiple steps (priorities), which are executed in order.
  • Dial(SIP/alice) – the action that will be performed. In our case, the SIP channel for the peer alice will be dialed.

Since a good understanding of dialplans concepts and code is necessary to become a great Asterisk administrator, we will describe each section of a dialplan in more details.

Geek University 2022