On Monday 28 December 2009 18:09:15 JR Richardson wrote:
> I turned on console debug to see the actual mysql queries and to my
> surprise and concern, I see every query for an extension priority
> repeated 3 or more times prior to dialplan execution.  For instance my
> first dialplan activity is all extracted from the database:
>
> context               exten   pri     app     appdata
> dpdefault14   _991X   1       NoOp    INBOUND CALL FROM SIPP
> dpdefault14   _991X   2       NoOp    TRUNK-${EXTEN:0:2} DID-${EXTEN:2}
> dpdefault14   _991X   3       Set     CALLERID(number)=600
> dpdefault14   _991X   4       Answer
> dpdefault14   _991X   5       Goto    ${EXTEN:2}|1
>
> Each priority is queried several times before executing.  Here is a
> sample of the first 2 priorities on a pastebin:
>
> http://pastebin.com/m54c9c41e
>
> I would not think this is normal activity as I can query the database
> directly once and get a valid response.  I don't have any realtime
> mysql connections issues that I can see, no errors in the logs and
> console status is:

No, that's normal.  The order of queries done is 1) check if the extension
exists, 2) on spawn, retrieve the extension to populate information about
the application into the channel structure, and 3) actually execute the
application.  There are 3 queries done for each extension actually executed
in order of priorities and a few more when the extension changes (or
originates).  It's not optimal, but it's the way that it works.

At some point, a slight optimization could certainly be done to narrow this
down to a single query from the database, followed by a fairly short caching
period (1 second would be plenty), but that optimization has never been
done.

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to