[asterisk-dev] Realtime behavior questions ...

Jeff LaCoursiere jeff at jeff.net
Tue Aug 18 08:21:27 CDT 2009


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.
>
>
> Best Regards,
>
> Kai Hoerner
>

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}.

j



More information about the asterisk-dev mailing list