[asterisk-dev] Realtime behavior questions ...
Tilghman Lesher
tilghman at mail.jeffandtilghman.com
Tue Aug 18 09:18:47 CDT 2009
On Tuesday 18 August 2009 08:21:27 Jeff LaCoursiere wrote:
> On Tue, 18 Aug 2009, Kai Hoerner wrote:
> > Tilghman Lesher schrieb:
> >>> 1- Same query is performed more than once:
> >>>
> >>> For example: the query below regarding the priority "3" from extension
> >>> "102" of context "sip" gets performed 3 times... and the same happens
> >>> with prior steps(priorities).
> >>>
> >>> SELECT * FROM extensions WHERE exten = '102' AND context = 'sip' AND
> >>> priority = '3'
> >>
> >> Yes, that's correct. It's not optimal, but due to the dialplan
> >> architecture,
> >> it's somewhat unavoidable. A possible optimization would be to cache
> >> the results of queries for some short period of time.
> >
> > I still can't grasp why a query like this must be performed three (or
> > more) times.
> > It will always return the same set of results, if the row was not changed
> > in the meanwhile.
> >
> > Executing this query more than once for a single lookup is pointless and
> > clearly a waste of resources.
> >
> > The "a" extension could be looked up at the point when a caller actually
> > pressed '*', there's no need to look it up if the caller does not press
> > '*'. This behaviour can only be altered in app_voicemail and not in
> > res_mysql, i think.
>
> Another point can be made here. Having just implemented realtime myself
> for the first time, the various docs are still fresh in my mind:
>
> "Just because you *can* implement the dialplan in the database doesn't
> mean you *should* implement it that way".
>
> I take this as some parts lend themselves to DB lookup well (like
> specific phone number matching at an ITSP), and others should still exist
> in extensions.{conf,ael}.
An excellent point, Jeff. The module pbx_realtime is based upon a very early
concept for moving extensions into a database. I don't know if it was ever
the best way. The way I recommend is to use a fairly static extensions.conf
that relies upon tools like func_odbc to put most of the data into a database,
while keeping the logic in a flat file.
--
Tilghman & Teryl
with Peter, Cottontail, Midnight, Thumper, & Johnny (bunnies)
and Harry, BB, & George (dogs)
More information about the asterisk-dev
mailing list