Asterisk Configuration Syntax

From JoatWiki
Jump to: navigation, search

Asterisk Configuration Syntax

(29 Jan 2008) - Following are basic rules for various parts of syntax for Asterisk:

Basic Syntax

The syntax for Asterisk configuration is a bit non-standard but is readable in any case. Here's a few things to keep in mind:

   * A setting is assigned via the "=" sign. Example: context=default
   * A variable is assigned via the "=>" signs. Example: exten => 102,1,Dial(Sip/home103)
   * A context is a sub-section of related entries (settings, variables, etc.) in a config file.
   * A directive is ?
   * An application is ?

Pattern Matching

Miscellaneous rules:

A pattern always starts with a "_"
A single digit in 0 through 9 can be matched with an X
A single digit in 1 through 9 can be matched with an Z
A single digit in 2 through 9 can be matched with an N
A single digit in a set can be matched by declaring the set within brackets [125-8]
The period wildcard (".") matches one or more characters
The bang wildcard ("!") matches zero or more characters
Digits can be trimmed from the start of the matched string via 
  "${EXTEN}", ":" and a number.  Example: if your extension 
  declaration comprises:

    exten => _81.,1,Dial(IAX2/555444:blahblah@iax2.myserv.net/${EXTEN:2},60,r

  Anyone who dials 815551212 will be connected to 5551212 on the myserv.net 
  service.  Adding ":2" to the ${EXTEN} variable tells the dialer to ignore 
  the first two digits in the variable.



Comments:

Leave a Comment

Personal tools