[asterisk-users] Can Asterisk match a literal "*" in extensions.conf

Steve Murphy murf at digium.com
Fri Sep 14 18:19:54 CDT 2007


On Sat, 2007-09-15 at 00:12 +0300, Atis wrote:
> On 9/14/07, Jared Smith <jsmith at digium.com> wrote:
> > On Fri, 2007-09-14 at 10:51 -0600, Anthony Francis wrote:
> > > . matches any number of the preceding character, change it to _X.*X.
> >
> > That still won't help.  Once the Asterisk pattern matching parser sees a
> > period in the pattern, it ignores anything after it.  (I'm not exactly
> > happy about that, but that's the way it is.)  In short, Asterisk doesn't
> > currently have a good way of handling this situation.  Hopefully
> > somebody infinitely smarter than I am will take pity on our plight and
> > give us a some more advanced pattern-matching tools.  (Hint, hint)
> 
> Well, you can have some 10 or so patterns (how long can the number
> before be), with X, as X means one digit..
> 
> For example:
> 
> exten => _X*.,1,Goto(default-wildcard|${EXTEN}|1)
> exten => _XX*.,1,Goto(default-wildcard|${EXTEN}|1)
> exten => _XXX*.,1,Goto(default-wildcard|${EXTEN}|1)
> exten => _XXXX*.,1,Goto(default-wildcard|${EXTEN}|1)
> exten => _XXXXX*.,1,Goto(default-wildcard|${EXTEN}|1)
> exten => _XXXXXX*.,1,Goto(default-wildcard|${EXTEN}|1)
> exten => _XXXXXXX*.,1,Goto(default-wildcard|${EXTEN}|1)
> exten => _XXXXXXXX*.,1,Goto(default-wildcard|${EXTEN}|1)
> exten => _XXXXXXXXX*.,1,Goto(default-wildcard|${EXTEN}|1)
> exten => _XXXXXXXXXX*.,1,Goto(default-wildcard|${EXTEN}|1)
> 

Atis--

People are spoiled by regex's, and they want to able to make a match vs.
something I call "trailing context". What they don't realize is that
such 
matches take (possibly) large amounts of time to complete, because they
loop
or are recursive, depending on the implementation.

Thus, a regex like  X+\*  (which would mean "1 or more X's followed by
an asterisk." would expand out to the 10 (actually perhaps many more)
lines above-- and run (unexpectedly) slower.

The trouble is, the pattern matcher wouldn't know how long an
expression 
like X+\* should be, and could generate hundreds of entries. (if the
pattern 
length is limited to 256 chars, say).

It is far better to explode out the entries yourself, as you outlined
above.
You know the max size of incoming stream....

murf


> [default-wildcard]
> exten => _X.,1,Macro(whatever)
> 
> Regards,
> Atis
> 
-- 
Steve Murphy
Software Developer
Digium
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3227 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20070914/af22cd1f/attachment.bin 


More information about the asterisk-users mailing list