Friday, September 17, 2010

Asterisk Digit Manipulation

Pattern Matching
To be able to allow people dial through Asterisk and have connect the caller to an outsite resources.

Pattern Matching Syntax
Pattern with underscore (_), tells the asterisk that we're matching on a pattern. After the underscore, we can use one or more of the following characters

X = Matches any single digit from 0 to 9.
Z = Matches any single digit from 1 to 9.
N = Matches any single digit from 2 to 9.
[15-7] = Matches a single digit from the range of digits specified. In this case, the pattern
matches a single 1, 5, 6, or 7.
. (period) = Wildcard match; matches one or more characters, no matter what they are.
! (bang) = Wildcard match; matches zero or more characters, no matter what they are.

Samples
_NXXXXXX = This pattern would match any seven-digit number, as long as the first digit was two or higher. This pattern would be compatible with any North American Numbering Plan
local seven-digit number.

_1NXXNXXXXXX = This one is slightly more difficult. This would match the number 1, followed by an area code between 200 and 999, then any 7-digit number. In the NANP calling area, you
would use this pattern to match any long-distance number

_011. = This pattern matches any number that starts with 011 and has at least one
more digit. In the NANP, this indicates an international phone number.

Outbound Dialing Capabilities in Dialplan
exten => _XXX,1,SayDigits(${EXTEN}) = SayDigits() application will read back to you the three-digit extension you dialed.

${EXTEN:x} = where x is where you want the returned string to start, from left to right.
exten => _XXX,1,SayDigits(${EXTEN:1}) = the SayDigits() application would start at the second digit, and thus read back only the last two digits of the dialed extension

1 comment:

Unknown said...

Your post is really good providing good information.. I liked it and enjoyed reading it. Keep sharing such important posts.
professional voice over services