[asterisk-dev] [design] Matching algorithm
Leif Madsen
leif.madsen at asteriskdocs.org
Tue Jun 3 12:02:09 CDT 2008
Tony Mountifield wrote:
>> My opinion is that treating _x and _X is probably an accidental
>> oversight, and the code should be updated to treat them the same.
>
> I originally got bitten by not realizing that lower-case n, x and z were
> special (all the examples in extensions.conf use upper-case). I would use
> lower-case alpha prefixes to extension numbers for certain kinds of dialplan
> processing, and the found this didn't do at all what I expected it to:
>
> exten => _main-X.,1,Set(CONF=${EXTEN:5})
>
> So my preference would be for only upper case N, X and Z to be special,
> and lower case to be literal characters. I don't know how many Asterisk
> users do _nxxnxxxxxx instead of _NXXNXXXXXX
I originally agreed that 'n', 'x', and 'z' should be treated exactly the
same as 'N', 'X', and 'Z', but I can certainly see the argument about
using the lowercase as literal characters. I've been bitten on this
before until Jared told me that I was using a 'reserved' character in my
string. Using your example, you'd have to do:
exten => _mai[n]-X.,1,Set(CONF=${EXTEN:5})
in order to get what you expected.
I always find it weird to read through dialplans that use lowercase
characters for the pattern match, but have only seen it VERY rarely (and
I don't think they were ever a production system, but rather were a test
system someone was having me help them with -- which of course doesn't
mean they don't exist).
--
Leif Madsen
http://www.leifmadsen.com
http://www.oreilly.com/catalog/asterisk
More information about the asterisk-dev
mailing list