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

VoIPCarib voipcarib at hotmail.com
Tue Dec 14 09:20:08 MST 2004


Nicolas,

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 |
+---------+------------+---------+----------+-------------+-----------------+------+

It shows a few other routes before the USA, but ASTCC is written to use the 
first row in the result table, which in this case wiould be Bangladesh 
(880). But this would be incorrect since I am dialing USA.

I am not a MYSQL expert, so I am not sure how to make the query return the 
result with the first digit of the dialed number as the first row, which 
would be the USA route.

Thanks,

Voipcarib

----- Original Message ----- 
> Message: 9
> Date: Tue, 14 Dec 2004 10:04:08 -0300
> From: Nicol?s Gudi?o <asternic at gmail.com>
> Subject: Re: [Asterisk-Users] ASTCC
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> <asterisk-users at lists.digium.com>
> Message-ID: <e7d413aa04121405042f00bcf4 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi,
>
>> I have a problem with ASTCC. When I create all my routes, I not able to 
>> get
>> the destination pattern I desire. I see it come up, but ASTCC seems to
>> select the first available pattern, and not necessarily the exact one I
>> want. I  found the MYSQL statement in astcc.agi:
>>
>> SELECT * FROM routes WHERE "$number" RLIKE pattern ORDER BY 
>> LENGTH(pattern)
>> DESC;
>>
>> This returns the desired route, but also other routes that may be first 
>> in
>> the select, and ASTCC uses that instead fo the exact matching route.
>>
>> How do I get ASTCC to select the routes starting at the begining of 
>> $number
>> and not just anything that matches an expression in $number?
>>
>
> Try with:
>
> ^01154.*
>
> being 54 the country code for Argentina and 011 the internacional prefix.
>
> -- 
> Nicolás Gudiño
> Buenos Aires - Argentina
>
>



More information about the asterisk-users mailing list