In article <caeebynv+64csk0n5+jwn-c1qgt9ai7e-ymu_oamayavgq5t...@mail.gmail.com>, Jonathan H <lardconce...@gmail.com> wrote: > Back to basics here. I want to match on one OR two digits. > > The following two both work, but ONLY for more than one digit, which > is not as expected from the docs (see below). > > exten => _X.,1,SayNumber(${EXTEN}) > exten => _[0-9].,1,SayNumber(${EXTEN}) > > > This next one will ONLY match 2 digits, as expected, but the first two > SHOULD match one or more, right? > > exten => _XX,1,SayNumber(${EXTEN}) > > The following pattern works, but I thought it was "dangerous" and to > be discouraged? > exten => _.,1,SayNumber(${EXTEN}) > > So, again, if someone dials 1 and a one second delay passes, I want it to say > 1. > If someone dials 1 then another 1 within a second then I want it to be > 11, and 111 should be invalid. > > (I've Set(TIMEOUT(digit)=1) ) > > Yes, I can do this with multiple lines, but the docs suggest this > should be easily do-able in 1 line, and I don't want to double the > amount of dialplan (there'll be a few of these!).
When matching an extension being dialled, Asterisk is only concerned about priority 1, so that's the only priority you need to double. You should be able to use ! safely in priority 2 upwards: exten => _X,1,NoOp(Matching single digit) exten => _X.,1,NoOp(Matching multiple digits) exten => _X!,2,SayNumber(${EXTEN}) exten => _X!,3,Etc.. Disclaimer: I haven't tested this. Cheers Tony -- Tony Mountifield Work: t...@softins.co.uk - http://www.softins.co.uk Play: t...@mountifield.org - http://tony.mountifield.org -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Join the Asterisk Community at the 13th AstriCon, September 27-29, 2016 http://www.asterisk.org/community/astricon-user-conference New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users