[asterisk-users] Matching *, + and # in the dialplan
Karl Fife
asterisk-users at kfife.mailworks.org
Wed Oct 15 21:59:02 CDT 2008
On Wed, 15 Oct 2008 14:22:09 -0600, "Steve Murphy" <murf at digium.com>
said:
> the real killer is trailing context... for instance...
>
> XX[58]*ZZ
>
> If you give it the pattern 3358, it has to decide that
> the [58]* part is empty and the 58 is matched by ZZ.
> And this makes the whole algorithm pretty hairy.
> The current notation lends itself to a fast left-to-right
> evaluation, without multiple recursive attempts to find
> a path that would lead to a match.
>
> But, if you are willing to forego trailing context,
> and make it so any *,+, {x,z}, or ? is at the end of an expression,
> like . is now, this could be implemented fairly straightforwardly in our
> current pattern matchers.
So how would one route calls differently if they're ISN formatted i.e.
'6565*696'. I can't get my head around any way to do that using the
existing rules.
Freenum.org suggests an ISN Prefix such as _012. to disambiguate ISN's
this is a total kludge because ISN-formatted numbers are already
perfectly unambiguous (not to mention the obvious limitation that
DIALING an ISN from a given system would first involve an query to the
admin).
The obvious problem is that the disambiguating character is located
anywhere between the second and fourth-from-last character. (one or more
digits followed by *, followed by three or more digits). Cursed
trailing contexts!
The only thing I can think of is to categorically exclude it from all
other possiblities: for example:
_NXXXXXX local number
_1NXXNXXXXXX non-local number
_011XX. international
_*XX supplemental service codes
_+XX. international
_X. ISN ???
...if that would even work.
Is there a better way to do this?
Is how 'expensive' would it be to disambiguate based on the unique
characteristics of an ISN?
It seems like there should be a inexpensive, non-recursive, one-pass way
to do it, but without getting my head inside the parser like Steve
has...
Thanks!
-Karl
More information about the asterisk-users
mailing list