[asterisk-users] Pattern matching....

Eric Wieling eric at fnords.org
Thu Feb 21 14:05:09 CST 2008


That will match the following as well

770
700
740
400
470
670
600
604
608
etc.

You example says:

The first digit can be 7 or 4 or 6.  The 2nd digit can be 7 or 0 or 4. 
The 3rd digit can be 0 or 4 or 8.

Mike Trest - Personal wrote:
>     [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
> 
> 
> _______________________________________________
> -- 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
> 
> 

-- 
Consulting for Asterisk, Polycom, Sangoma, Digium, Cisco, LAN, WAN, QoS, 
T-1, PRI, Frame Relay, Linux, and network design.  Based near 
Birmingham, AL.  Now accepting clients worldwide.




More information about the asterisk-users mailing list