[asterisk-users] Re: mySQL and to many connections with SQL statement UPDATE

JR Richardson jmr.richardson at gmail.com
Sun Dec 24 08:53:00 MST 2006


>
> If Iam doing UPDATE SQL statements I got an overload for connection.
> am doing everytime an Disconnect ${connid}) but this is ignored.
>
> any idea?
>

You must clear the resut ID and also issue a disconnect to the
connection ID, see priority 4 and 5.

exten => _X.,1,MYSQL(Connect connid 10.10.10.110 asteriskdb password db)
exten => _X.,2,MYSQL(Query resultid ${connid} SELECT\ fullcontact\
from\ sip\ where\ name=${EXTEN})
exten => _X.,3,MYSQL(Fetch fetchid ${resultid} var1)
exten => _X.,4,MYSQL(Clear ${resultid})
exten => _X.,5,MYSQL(Disconnect ${connid})
exten => _X.,6,GotoIf($["${var1}" = ""]?invalid,i,1:${EXTEN},8)
exten => _X.,8,Set(direct=${var1:4}) ;(strip off 'sip:' from fullcontact info)
exten => _X.,9,Dial(SIP/${direct},15,r)
exten => _X.,10,Goto(sendtovm,${EXTEN},1)
exten => _X.,11,Hangup

Or a simpler method is to setup realtime access to the database and
use the realtime cmd, this will control the mysql access and you won't
have to worry about the connections.

http://www.voip-info.org/wiki/view/Asterisk+cmd+RealTime

-- 
JR Richardson
Engineering for the Masses


More information about the asterisk-users mailing list