0% found this document useful (0 votes)
79 views2 pages

Asterisk Dialplan Patterns: Extension Names and Patterns

The document discusses extension patterns in Asterisk dialplans. Extension patterns use special characters to match multiple extensions based on patterns, rather than individual numbers. Examples are given of common extension patterns like _NXXXXXX to match 7-digit phone numbers and _61XX, _63XX to route calls from certain extensions to different offices. The document also outlines special characters that have meaning in extension patterns like X, Z, N, and #.

Uploaded by

Dragan Petrovic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views2 pages

Asterisk Dialplan Patterns: Extension Names and Patterns

The document discusses extension patterns in Asterisk dialplans. Extension patterns use special characters to match multiple extensions based on patterns, rather than individual numbers. Examples are given of common extension patterns like _NXXXXXX to match 7-digit phone numbers and _61XX, _63XX to route calls from certain extensions to different offices. The document also outlines special characters that have meaning in extension patterns like X, Z, N, and #.

Uploaded by

Dragan Petrovic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

voip-info.

org : Asterisk Dialplan Patterns Page 1 of 2

Asterisk Dialplan Patterns


Extension Names and Patterns
Extension Names
Dialplan extensions can be simple numbers like "412" or "0". They can be alphanumeric names like "john" or
"A93*". Although a typical telephone can't dial an extension called "john" (some can though), often your
Dialplan logic will involve jumping from one extension to a different extension, and for those jumps you may
define exension names with any name you like, as you don't wish them to be dialed directly.

Of course, touchtone telephones don't just have the digits 0 through 9, they also have * (star) and #
("pound" or "hash", depending on where in the world you live). And some touchtone (DTMF) telephones
have the extra four "digits", A, B, C and D. If you have such handsets within your organization, there's
nothing stopping you making use of those extra buttons for some special purpose of your own.

Note: To have an extension that is triggered by dialing the # symbol, you must use an extension pattern
(see below). Asterisk does not recognize # as an ordinary 'digit', even though it appears on all DTMF
telephones.

Why do people in the US call the # symbol "pound"? It doesn't seem to have anything to do with either money (e.g. the UK
Pound Sterling) or with weight (lb). Answer: Pound Sign

Extension Patterns
Extension names are not limited to single specific extension "numbers". A single extension can also match
patterns. In the extensions.conf file, an extension name is a pattern if it starts with the underscore symbol
(_). In an extension pattern, the following characters have special meanings:

Special Characters for Pattern Matching

X matches any digit from 0-9


Z matches any digit form 1-9
N matches any digit from 2-9
[1237-9] matches any digit or letter in the brackets (in this example, 1,2,3,7,8,9)
. wildcard, matches one or more characters

Example
Consider the following context:

Context "routing":
Extension Description
_61XX Dallas Office
_63XX Dallas Office
_62XX Huntsville Office
_7[1-3]XX San Jose Office
_7[04-9]XX Los Angeles Office

This context, given the name "routing", sends calls to various servers according to their extension. This
organization has decided that all of their telephone extensions will be 4 digits long. If a user dials an
extension beginning with 61 or 63, it would be sent to the Dallas office; 62 would go to the Huntsville office;
anything starting with 71, 72, or 73 would go to San Jose, and anything starting with 70, 74, 75, 76, 77, 78
or 79 would go to the Los Angeles office.

More Example Patterns

http://www.voip-info.org/tiki-print.php?page=Asterisk+Dialplan+Patterns 1/29/2005
voip-info.org : Asterisk Dialplan Patterns Page 2 of 2

_NXXXXXX matches a normal 7 digit telephone number


_1NXXNXXXXXX matches an area code and phone number preceeded by a one
_9011. matches any string of at least five characters that starts with 9011,
but it does not match the four-character string 9011 itself.
_# matches a single # keypress

Warning

Do not use a pattern of _. as this will match everything including Asterisk special extensions like i, t, h, etc. Instead use
something like _X. or _X which will not match special extensions..

Sort Order

If more than one pattern matches a dialed number, Asterisk may not use the one you expect. See:

z Sort Order of Extension Patterns

See Also
z Introducing Contexts and Extensions

Asterisk | Configuration | The Dialplan - extensions.conf

Please update this page with new information (you'll have to login first), or without logging in, you can leave
a comment on this page -- click on the comment tab above. Thanks! - [email protected]

Created by: JazEzork last modification: Saturday 19 of June, 2004 [20:42:04 UTC] by jht2

Sponsored by:

http://www.voip-info.org/tiki-print.php?page=Asterisk+Dialplan+Patterns 1/29/2005

You might also like