Asterisk howto dial plan
Created by: oej,Last modification on Sun 30 of Nov, 2008 [18:52 UTC] by mich.davis
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:
- Asterisk dial plan - working example: Real world example
- An expanded example showing integrations with a Panasonic KSU
See also:
- Asterisk config extensions.conf: The dial plan
- Asterisk contexts: About contexts
- FAQ | Introduction | Tips & Tricks | Asterisk
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) .
Download Visual Dialplan for Asterisk
Download Visual Dialplan for Asterisk

Comments
333Weird Invalid Extension error
exten => JOIN_MEETME-.-.-.-.,1,NoOp($CHANNEL is joining the meetme)
exten => JOIN_MEETME-.-.-.-.,n,MeetMe(AGENT${CUT(EXTEN,,2)}-LEAD${CUT(EXTEN,,3)})
exten => ECHO_TEST-.-.-.-.,1,NoOp(Echo test for $CHANNEL)
exten => ECHO_TEST-.-.-.-.,n,Echo()
The extensions "JOIN_MEETME-.-.-.-." and "ECHO_TEST-.-.-.-." was successfully loaded by 'extensions reload' in the CLI> and it also listed in show dialplan. But when I'm dialing JOIN_MEETME-123-456-789-012, my soft-phone prompts me an "Invalid Extensions" error. But the "ECHO_TEST-123-456-789-012" works....
I tried to change...
exten => JOIN_MEETME-.-.-.-.,1,NoOp($CHANNEL is joining the meetme)
exten => JOIN_MEETME-.-.-.-.,n,MeetMe(AGENT${CUT(EXTEN,,2)}-LEAD${CUT(EXTEN,,3)})
to...
exten => 999-.-.-.-.,1,NoOp($CHANNEL is joining the meetme)
exten => 999-.-.-.-.,n,MeetMe(AGENT${CUT(EXTEN,,2)}-LEAD${CUT(EXTEN,,3)})
and it works....
Does anyone also encounter this bug in 1.4? I'v been using this dialplan method ever since 1.0.x but I never experienced such error until using version 1.4
Thanks to your response...
333