[asterisk-users] Long extensions that contain dashes

Daniel Tryba daniel at tryba.nl
Thu May 31 05:05:47 CDT 2018


On Tue, May 29, 2018 at 08:32:39PM -0700, David P wrote:
> We would like to use 20-char extension values that use dashes and alphanums
> after the first four digits. In order to handle these via pattern-matching,
> how can I define a pattern that allows dashes? There seems to be no option
> at http://the-asterisk-book.com/1.6/einleitung-regex.html#re
> gular-expression-syntax However, when I try a period, it seems to match the
> long suffix including the dashes. I want to know whether to depend on this
> continuing to work.

You should read some more up to date documentation I guess.
https://wiki.asterisk.org/wiki/display/AST/Pattern+Matching
mentions the significance of - in a character class and the way to
escape. I'm to lazy to try this myself, but in any regexp parser I ever
used a litteral - in a charclass is defined by simply putting it as the
last character in the class (but above url leads me to think this
doesn't work in asterisk): 

[0-9] matches 0,1,2,3,4,5,6,7,8 and 9
[09-] matchers 0,9 and -
 
> Also, we're not sure whether our automated members can handle extensions
> longer than 4 digits. I'd like to pass a substring of our
> extension/destination_number in the call to Queue(). I couldn't find
> documention of any Queue() option like this. Is it possible to control the
> extension that the member receives?

You are looking to modify the callerid? e.g.:
Set(CALLERID(num)=${CALLERID(num):4})



More information about the asterisk-users mailing list