[Asterisk-Users] options for mysql query from dialplan

Roger Gulbranson roger at gulbranson.com
Thu Aug 18 09:25:16 MST 2005


On Thu, 2005-08-18 at 09:41 -0600, Damon Estep wrote:
> I am using realtime mysql for extensions, sip, and voicemail.
> 
> Outbound call routing does not really perform well in realtime
> extensions due to the high number of rows in the database (300k), so I
> can not use it. It appears with my limited knowledge that the query
> method is not robust enough for large databases.
> 
> Given the fact that I already have realtime and mysql configured, what
> are my options for running a mysql query from the dialplan to find the
> provider I want to use for outbound. 
> 
> I am not looking for a complete solution, just a hint on the best way to
> query my existing mysql database from the dialplan.
> 
> I have looked at the MySQL command, and there are a lot of notes about
> connection closing and other scary stuff? Does it work?
> 
> Are there other native options given the fact that realtime is
> configured and in use?
> 
> The goal is to run a query against a database like this
> 
> SELECT provideralias FROM ldproviders WHERE npa = (digits 2 thru 4 of
> dialed number) AND nxx = (digits 5 thru 7)
> 
> Then take the provider alias returned and
> Dial(SIP/${EXTEN}@${provideralias},60).
> 
> Next step would be to add a loop for multiple providers, starting with
> the lowest cost.
> 
> Any hints or comments from the pros?

Have you added appropriate indexes to your tables?




More information about the asterisk-users mailing list