login | register
Fri 25 of Jul, 2008 [11:51 UTC]

voip-info.org

Discuss [2] History

Asterisk howto dial plan

Created by: oej,Last modification on Mon 12 of May, 2008 [21:25 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:


See also:





Comments

Comments Filter
222

333Weird Invalid Extension error

by macoykolokoy, Tuesday 06 of March, 2007 [05:32:29 UTC]
I'm using Asterisk 1.4 and my extensions.conf looks like this....


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...
222

333

by derdanielder, Monday 28 of August, 2006 [21:40:43 UTC]
Changed Information about the s-extension. This is not a general "start" extension acording to digium.