VoIPCarib
2004-Dec-14 09:20 UTC
[Asterisk-Users] Re: Asterisk-Users Digest, Vol 5, Issue 192
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@gmail.com> > Subject: Re: [Asterisk-Users] ASTCC > To: Asterisk Users Mailing List - Non-Commercial Discussion > <asterisk-users@lists.digium.com> > Message-ID: <e7d413aa04121405042f00bcf4@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 > >
Mike Mattice
2004-Dec-14 09:38 UTC
[Asterisk-Users] Re: Asterisk-Users Digest, Vol 5, Issue 192
On Tue, Dec 14, 2004 at 11:20:08AM -0500, VoIPCarib wrote:> mysql> SELECT * FROM routes WHERE "^13237309880" RLIKE pattern ORDER BY > LENGTH(pattern) DESC; > 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.Your pattern needs to actually be in the pattern field. IE. have the ^ in it. Remove the ^ from the phone number too. :) -- Mike Mattice - Systems Programmer and Administrator
Nicolás Gudiño
2004-Dec-14 10:27 UTC
[Asterisk-Users] Re: Asterisk-Users Digest, Vol 5, Issue 192
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