[asterisk-users] Match one OR two digit extension not working as expected without using "dangerous" _. pattern (Ast 14)

Jonathan H lardconcepts at gmail.com
Fri Oct 14 07:55:54 CDT 2016


On 13 October 2016 at 13:18, Tony Mountifield <tony at softins.co.uk> wrote:

> exten => _X,1,NoOp(Matching single digit)
> exten => _X.,1,NoOp(Matching multiple digits)
> exten => _X!,2,SayNumber(${EXTEN})
> exten => _X!,3,Etc..

Thanks - I appreciate the idea, but it matches more than 2 digits.

But, thanks to your info, I cobbled together something that works, and
matches only 1 or 2 digits in what I think is the most compact way, by
sending a 1 digit extension to the 2 digit matcher, prefixed with a 0.
Example which works:

[extentest]
exten => s,1,Set(TIMEOUT(digit)=1)
    same => n,BackGround(extension)
    same => n,WaitExten(5)
exten => _X,1,Goto(0${EXTEN},1)
exten => _XZ,1,SayNumber(${EXTEN})
    same => n,Goto(s,1)
exten => e,1,Goto(s,1)

***HOWEVER!!!!*** Do I need to report a bug?

Either:

A: All the documentation is wrong and ". (period) Wildcard match;
matches one or more characters" is NOT actually how Asterisk works.
or
B: The documentation is correct and Asterisk's "one of more character
matching" routine is wrong
or
C: I've completely misunderstood what "matches one of more characters" means :)

What's the consensus? Thanks!



More information about the asterisk-users mailing list