Upgrade 3CX to v18 and get it hosted free!

Asterisk howto dial plan

Author image

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 Asterisk 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 Asterisk cmd Macro).
  • exten: Keyword, must be followed by either = or =>
  • id: Alphanumeric extension, that is either dialed by callee or called by a Asterisk cmd 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 Asterisk – documentation of application commands 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 Asterisk channels, 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

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.