[Asterisk-Users] Re: Asterisk-Users Digest, Vol 5, Issue 192

Nicolás Gudiño asternic at gmail.com
Tue Dec 14 10:27:21 MST 2004


Hello,

> Thank you for your response. I had tried that before and it didn't work. I
> am trying to look up the route for a dialed number, so its a full E.164
> number. Please see my query below when I try to look up the route for a USA
> number;
> 
> mysql> SELECT * FROM routes WHERE "^13237309880" RLIKE pattern ORDER BY
> LENGTH(pattern) DESC;
> +---------+------------+---------+----------+-------------+-----------------+------+
> | pattern | country    | comment | trunks   | connectcost | includedseconds
> | cost |
> +---------+------------+---------+----------+-------------+-----------------+------+
> | 880     | Bangladesh | Proper  | Carrier |           0 |              30 |
> 0.18 |
> | 237     | Cameroon   | Proper  | Carrier |           0 |              30 |
> 0.24 |
> | 32      | Belgium    | Proper  | Carrier |           0 |              30 |
> 0.06 |
> | 1       | USA        | USA     | Carrier |           0 |              30 |
> 0.04 |
> +---------+------------+---------+----------+-------------+-----------------+------+

The pattern column should be:

^880.*
^237.*
^32.*
^1.* 

and the query:

SELECT * FROM routes WHERE "13237309880" RLIKE pattern ORDER BY
LENGTH(pattern) DESC

It works.

Best Regards,

-- 
Nicolás Gudiño
Buenos Aires - Argentina



More information about the asterisk-users mailing list