It seems like it should be simple, but how do you pattern match zero or more characters like ! does, but without matching immediately?
What we really want to do is:
_[*#0-9]!
And match any extension beginning with a number, * or #, followed by any number of other characters. However the ! matches immediately on transfers, so it doesn’t work for our purpose.
The OP ones 0 or more. I think knowing the use case would help, as it sounds like they have a badly designed numbering plan. I think they would have overlap dialling with a timeout to determine end of number.
Do you really want to match any number of any character? In my dial plan I have places where I need to match numbers but depending where they came from they might be between 7 and 10 numbers long. To do that I have 4 exten lines, one for each length followed by a goto() line to get to the code that handles them all. As long as the number of lengths is not to many, that’s workable.
It looks like the only solution is to have different extensions for different lengths; at least one for extensions of length 1 and another for 2 or more as penguin suggested above. It’s a shame we can’t do it in one extension, as our extension has many priorities and it’s a bit of a pain to repeat them. It would be nice if Asterisk added a pattern character for this in the future - I suggest maybe “?” to mean 0 or more characters, not matching immediately.
Thanks for all the input!
exten = _[*#0-9],1,Goto(matched)
exten = _[*#0-9].,1,Goto(matched)
exten = _[*#0-9]!,n(matched),NoOp(matched ${EXTEN})
same = n,NoOp(something common to all matches)
same = n,Answer()
same = n,Playback(tt-monkeys)