Asterisk howto dial plan

How to build a dial plan in Asterisk


The dial plan is built in extensions.conf and included files.

Basic terms

A dial plan consists of a number of extensions. Each extensions consists of a number of priorities. Extensions are grouped in contexts. For each priority, an application is called.

Syntax example:


[context]
exten => id, priority, command


  • Context: Is the name of the context. Names are alphanumerical. Reserved is contexts that start with macro- (See macro).
  • exten: Keyword, must be followed by either = or =>
  • id: Alphanumeric extension, that is either dialed by callee or called by a goto.
  • priority: Numeric, starts with 1 and steps upward. Each extensions can have many priorities, grouped with the extension id
  • command: What to do on this priority, which application to run

Some applications change the priority for the next execution step. Depending on the result, execution of the extension continues at priority+1 or something else. Check the application documentation.

There are also a number of standard extensions

Context inclusion

Contexts may be included in other contexts with the include command.
include => contextname
Inclusion may depend of date and time with arguments
include => daytime|9:00-17:00|mon-fri|*|*

Contexts and channels

For each channel, there is a definition of a default context. This means that calls from this channel start in the context given as the default, if no routing information is received, at extension s.

For peers, phones defined in the channel configuration files, there may be a standard context defined. This overrides the standard context for the channel. This way, registred users can place call with other rules than incoming calls.



To add:

  • Macros
  • Extension matching _XNN constructs
  • Expressions in goto $[]
  • Variables ${}


Examples:


See also:


If you are not so familiar with Asterisk dialplan syntax, dialplan priorities, or you simply do not prefer coding using text editors, you may find Visual Dialplan for Asterisk useful tool for your dialplan development. Visual Dialplan for Asterisk is modern rapid application development platform for Asterisk dialplan development, it provides similar interface and approach like Visual Basic provides for rapid application development and comes with real world dialplan examples (extensions.conf files that can be used without visual dialplan) .
Image
Download Visual Dialplan for Asterisk


Created by: oej, Last modification: Sun 30 of Nov, 2008 (18:52 UTC) by mich.davis


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+

Page Changes | Comments

 

Featured -

Search: