[asterisk-users] dialplan number matching

John A. Sullivan III jsullivan at opensourcedevel.com
Fri Jul 17 15:20:19 CDT 2009


On Fri, 2009-07-17 at 12:56 -0700, Vieri wrote:
> 
> --- On Fri, 7/17/09, John A. Sullivan III <jsullivan at opensourcedevel.com> wrote:
> 
> > > Hi,
> > > 
> > > How can I match an extension "ending with 3" (just an
> > example but applicable to any other digit, including * or
> > #)?
> > > 
> > > exten => _ZX.3,n,...
> > > 
> > > exten => _ZX.#,n,...
> > > 
> > > (the above does not work)
> > > 
> > > Can regular expressions be used in the standard
> > dialplan (end with: "$")?
> > > 
> > > Thanks,
> > > 
> > > Vieri
> > <snip>
> > I haven't tried it but I wonder if one could use a regex
> > pattern match
> > in a GotoIf statement and then pass the result to another
> > context using
> > ${EXTEN}? Just a thought - John
> 
> Thanks, I'll think about it but I don't think it will apply efficiently to the goal I describe here:
> http://www.mail-archive.com/asterisk-users@lists.digium.com/msg227054.html
> 
> Anyway, I "solved" my "early-dial" issue by creating a special context where I "Read()" the user's input until he/she presses #. It's not as elegant as having Asterisk match regular expressions or do something like "exten => _00ZX.#,n,..." but I'll settle with it.
> 
<snip>
I am very new to Asterisk so you probably know far more than I and I
have never used the regex logic but what about something like:

exten => _00ZX.,n,GotoIf($[${EXTEN}:.*3$]?:no3)
exten => _00ZX.,n,DO SOMETHING
exten => _00ZX.,n(no3),NoOp()

-- 
John A. Sullivan III
Open Source Development Corporation
+1 207-985-7880
jsullivan at opensourcedevel.com

http://www.spiritualoutreach.com
Making Christianity intelligible to secular society




More information about the asterisk-users mailing list