[asterisk-users] link to MySQL connection

Don Kelly dk at donkelly.biz
Tue Dec 3 09:11:46 CST 2013

> In the php routines, I would like to use the persistent connection 
> that is established in the dialplan, rather than creating a new 
> connection each time they run. How can I do this?

You can't, they are completely separate processes and code.
Joshua Colp

Thanks--that's not the answer I wanted, but it sure was quick. :) Is there
anything that would enable me to use a persistent connection in the agi?

Yes.  Use func_odbc in your PHP AGI.   In Asterisk dialplan functions are
treated like dialplan variables so you can get and set them just like you
would other dialplan variables.

If it takes 5 seconds to open a PDO DB connection inside PHP you have some
OTHER problem.
Eric Wieling

Thanks, Eric. If I can't figure out why the connection takes so long, I'll
try the func_ODBC approach.


More information about the asterisk-users mailing list