[asterisk-users] Pattern matching....
Mike Trest - Personal
Mike at Trest.COM
Thu Feb 21 12:34:07 CST 2008
[746][704][048]
[At 01:21 PM 2/21/2008, you wrote:
>On Thu, 2008-02-21 at 12:44 -0500, Michael Munger wrote:
> > Will this work to match any number from the 770,404, or 678 area
> > codes?
> >
> >
> >
> > _[404|770|678]NXXXXXX
> >
> >
> >
> > If this wonât work, is there a pattern that will do this?
> >
> >
>
>No, it won't work, there's no '|' for alternative matches, and no parens
>available for grouping, either. And your usage of char sets is off.
>Try something like this:
>
>_404NXXXXXX
>
>_770NXXXXXX
>
>_678NXXXXXX
>
>
>as three separate extensions.
>
>If you REALLY want to keep that as one extension, then you could:
>
>_NXXNXXXXXX => {
> Set(areacode=${EXTEN:0:3})
> if ('${areacode}' = '404') {
> <things to do here>
> } else if ('${areacode}' = '770') {
> <things to do here>
> } else if ('${areacode}' = '678') {
> <things to do here>
> }
>
>
>OR, you could do it this way, also:
>
>_NXXNXXXXXX => {
> Set(areacode=${EXTEN:0:3})
> switch(${areacode})
> {
> case 404:
> <things to do here>
> break;
> case 770:
> <things to do here>
> break;
> case 678:
> <things to do here>
> break;
> }
>
>This is, of course AEL code, and this stuff would be inside a context
>construct...
>
>murf
>
>
>
>
>
>
> >
> >
> > Yours,
> >
> > Michael Munger, dCAP
> >
> > 404-438-2128
> >
> > michael at highpoweredhelp.com
> >
> >
> >
> > Attachment encrypted? click here.
> >
> >
> >
> >
> > _______________________________________________
> > -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> >
> > asterisk-users mailing list
> > To UNSUBSCRIBE or update options visit:
> > http://lists.digium.com/mailman/listinfo/asterisk-users
>--
>Steve Murphy
>Software Developer
>Digium
>
>
>_______________________________________________
>-- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
>asterisk-users mailing list
>To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list