[Asterisk-Users] ASTCC - Regex: How to "Country" but "special City" different?

Karl H. Putz kputz at columbus.rr.com
Tue Mar 15 07:10:03 MST 2005


>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

Ronald,

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
>





More information about the asterisk-users mailing list