Andreas Sikkema wrote:
[EMAIL PROTECTED] wrote:

  
I would like to store these seetings in a mysql database, so
that they are more easily accessible from a user
configuration page on a webserver. Since these settings need
to be checked in the dialplan for each call to the extension,
it seems a bit to much to have to connect, query and
disconnect from mysql every time. Is there any way to keep a
persistent connection to mysql that can be queried from the
dialplan? 
    

Well, if you do this before answering, nobody is going to 
notice. Even querying during an answered call will have 
hardly any outside consequences... 

  
Using the MYSQL functions from asterisk-addons....

extensions.conf

[macro-open-connection]

exten => s,1,MYSQL(Connect connid .....
exten => s,2,SetVar(OPEN-CON=1)

[macro-close-connection]

exten => s,1,GotoIf(${OPEN-CON}?5)
exten => s,5,MYSQL(Close ${connid})

Then call the open macro when you first receive a call, and make sure in your hangup (exten => h) function you call the close macro.  If you have an include => hangup in all your contexts, the close macro will be called anytime a hangup is received and it will close any connection you opened for that call.
_______________________________________________
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to