[Asterisk-Users] options for mysql query from dialplan

Damon Estep damon at suburbanbroadband.net
Thu Aug 18 10:00:28 MST 2005



> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
> bounces at lists.digium.com] On Behalf Of Roger Gulbranson
> Sent: Thursday, August 18, 2005 10:25 AM
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> Cc: Roger Gulbranson
> Subject: Re: [Asterisk-Users] options for mysql query from dialplan
> 
> 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?
> 
> _______________________________________________

Yep, but all the indexing in the world is not going to change the fact
that realtime extensions pulls ALL records in where the context matches,
the priority is 1, and the extension starts with an underscore!

We have over 100k extension in one table that start with an _



More information about the asterisk-users mailing list