Ronald Wiplinger
2005-Mar-12 09:31 UTC
[Asterisk-Users] ASTCC - Regex: How to "Country" but "special City" different?
I am trying to figure out a way to add something like: 61 100 pennies (Everything what is not listed below) 61 78 150 61 5 130 61 342 180 How could I do these (four) regex? bye Ronald
Ronald Wiplinger
2005-Mar-14 16:25 UTC
[Asterisk-Users] ASTCC - Regex: How to "Country" but "special City" different?
Ronald Wiplinger wrote:> I am trying to figure out a way to add something like: > > 61 100 pennies (Everything what is not > listed below) > 61 78 150 > 61 5 130 > 61 342 180 > > How could I do these (four) regex?Since nobody answered to my question, I tried to find it in the agi: my $sth = $dbh->prepare("SELECT * FROM routes WHERE " . $dbh->quote($num ber) . " RLIKE pattern ORDER BY LENGTH(pattern) DESC"); Does it mean I just need to use: ^61.* 100 ^6178.* 150 ^615.* 130 ^61342.* 180 would already work? A number of ^6154333231 would be considered as the first case and cost 100 pennies ??? bye Ronald
Karl H. Putz
2005-Mar-15 07:10 UTC
[Asterisk-Users] ASTCC - Regex: How to "Country" but "special City" different?
>my $sth = $dbh->prepare("SELECT * FROM routes WHERE " . $dbh->quote($num >ber) . " RLIKE pattern ORDER BY LENGTH(pattern) DESC"); > >Does it mean I just need to use: >^61.* 100 >^6178.* 150 >^615.* 130 >^61342.* 180Ronald, The ASTCC sql SELECT used will return the routes entry that matches the longest route pattern that you have entered into the table. I.e it will return the most specific match possible. I believe you can drop the "." and the "*" from the end of the routes entries as these are redundant and add length to a Regex that is simply looking to match the first N characters of the dialed number. Your assumption is correct in your example that you can create separate entries for specific city codes and also have a default "else" route that rates the remainder of the country.> >would already work? A number of ^6154333231 would be considered as the >first case and cost 100 pennies ???No, the 615 would be recognized as your third entry and billed at 130. Karl Putz> > >bye > >Ronald >