VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
murf at digium.com Guest
|
Posted: Thu Feb 21, 2008 1:21 pm Post subject: [asterisk-users] Pattern matching.... |
|
|
On Thu, 2008-02-21 at 12:44 -0500, Michael Munger wrote:
Quote: | 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
--
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/20080221/d3cb268a/attachment.bin |
|
Back to top |
|
|
Mike at Trest.COM Guest
|
Posted: Thu Feb 21, 2008 1:34 pm Post subject: [asterisk-users] Pattern matching.... |
|
|
[746][704][048]
[At 01:21 PM 2/21/2008, you wrote:
Quote: | On Thu, 2008-02-21 at 12:44 -0500, Michael Munger wrote:
Quote: | 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
--
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 |
|
|
Back to top |
|
|
jsmith at digium.com Guest
|
Posted: Thu Feb 21, 2008 1:45 pm Post subject: [asterisk-users] Pattern matching.... |
|
|
On Thu, 2008-02-21 at 13:34 -0500, Mike Trest - Personal wrote:
Nope, that's not going to do exactly what you want either... that
pattern would match a lot of area codes besides the ones you're looking
for. (For example, you could have 7 as the first digit and 0 as the
second digit and 0 as the third digit.)
You really need to have three separate patters; one for each area code.
--
Jared Smith
Community Relations Manager
Digium, Inc. |
|
Back to top |
|
|
eric at fnords.org Guest
|
Posted: Thu Feb 21, 2008 3:00 pm Post subject: [asterisk-users] Pattern matching.... |
|
|
No that will not work. You would want three exten => lines, one for
each area code.
Michael Munger wrote:
Quote: | 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?
Yours,
Michael Munger, dCAP
404-438-2128
michael at highpoweredhelp.com <mailto:michael at highpoweredhelp.com>
Attachment encrypted? click here
<http://www.highpoweredhelp.com/tutorials/wincrypt/> .
------------------------------------------------------------------------
_______________________________________________
-- 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. |
|
Back to top |
|
|
eric at fnords.org Guest
|
Posted: Thu Feb 21, 2008 3:05 pm Post subject: [asterisk-users] Pattern matching.... |
|
|
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:
Quote: | [746][704][048]
[At 01:21 PM 2/21/2008, you wrote:
Quote: | On Thu, 2008-02-21 at 12:44 -0500, Michael Munger wrote:
Quote: | 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
--
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. |
|
Back to top |
|
|
tony at softins.clara.... Guest
|
Posted: Fri Feb 22, 2008 6:20 am Post subject: [asterisk-users] Pattern matching.... |
|
|
In article <47BDD86E.1090005 at fnords.org>, Eric Wieling <eric at fnords.org> wrote:
Quote: | No that will not work. You would want three exten => lines, one for
each area code.
|
And if you have a lot of common dialplan that you don't want to duplicate
between the three extension patterns, put the common stuff up at a higher
priority and use Goto to get there:
exten => _404NXXXXXX,1,Goto(200)
exten => _770NXXXXXX,1,Goto(200)
exten => _678NXXXXXX,1,Goto(200)
exten => _NXXNXXXXXX,200,NoOp(Start of common instructions)
exten => _NXXNXXXXXX,n,etc....
Cheers
Tony
Quote: | Michael Munger wrote:
Quote: | 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?
Yours,
Michael Munger, dCAP
404-438-2128
michael at highpoweredhelp.com <mailto:michael at highpoweredhelp.com>
Attachment encrypted? click here
<http://www.highpoweredhelp.com/tutorials/wincrypt/> .
------------------------------------------------------------------------
_______________________________________________
-- 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.
_______________________________________________
-- 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
| --
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org |
|
Back to top |
|
|
michael at highpowered... Guest
|
Posted: Fri Feb 22, 2008 7:34 am Post subject: [asterisk-users] Pattern matching.... |
|
|
That's what I figured, and the way I've always done it. I was just
*hoping* someone knew of a better way that I didn't know about.
Yours,
Michael Munger, dCAP
404-438-2128
michael at highpoweredhelp.com
-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Jared
Smith
Sent: Thursday, February 21, 2008 1:46 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Pattern matching....
On Thu, 2008-02-21 at 13:34 -0500, Mike Trest - Personal wrote:
Nope, that's not going to do exactly what you want either... that
pattern would match a lot of area codes besides the ones you're looking
for. (For example, you could have 7 as the first digit and 0 as the
second digit and 0 as the third digit.)
You really need to have three separate patters; one for each area code.
--
Jared Smith
Community Relations Manager
Digium, Inc.
_______________________________________________
-- 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 |
|
Back to top |
|
|
kpfleming at digium.com Guest
|
Posted: Fri Feb 29, 2008 9:20 am Post subject: [asterisk-users] Pattern matching.... |
|
|
Tony Mountifield wrote:
Quote: | In article <47BDD86E.1090005 at fnords.org>, Eric Wieling <eric at fnords.org> wrote:
Quote: | No that will not work. You would want three exten => lines, one for
each area code.
|
And if you have a lot of common dialplan that you don't want to duplicate
between the three extension patterns, put the common stuff up at a higher
priority and use Goto to get there:
exten => _404NXXXXXX,1,Goto(200)
exten => _770NXXXXXX,1,Goto(200)
exten => _678NXXXXXX,1,Goto(200)
exten => _NXXNXXXXXX,200,NoOp(Start of common instructions)
exten => _NXXNXXXXXX,n,etc....
|
Actually you can do this a lot more simply without using Goto (which
might mess with your CDR):
exten => _404NXXXXXX,1,NoOp
exten => _770NXXXXXX,1,NoOp
exten => _678NXXXXXX,1,NoOp
exten => _NXXNXXXXXX,2,NoOp(Start of common instructions)
exten => _NXXNXXXXXX,n,etc....
Since there is an implicit 'Goto' from priority 1 to priority 2 anyway,
you might as well take advantage of it
--
Kevin P. Fleming
Director of Software Technologies
Digium, Inc. - "The Genuine Asterisk Experience" (TM) |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|