[asterisk-users] Incompatible changes to asterisk 1.6 MYSQL addon query syntax

John Fawcett john.ml at erba.tv
Sat May 9 03:42:04 CDT 2009


I'm on asterisk 1.6.1.0 and asterisk addons 1.6.1.0 (also using freepbx
2.5 with cidlookup module from mysql database).

There are some incompatible changes in asterisk 1.6 about MYSQL addon
application syntax for querying a mysql database.
It seems that escaping of space and single quotes is no longer needed -
see 3rd line of attached example from
http://www.voip-info.org/wiki/view/Asterisk+cmd+MYSQL

I'd like to make sure the fix I submitted to freepbx is ok. Two
questions I cannot find answers to in the upgrade notes are:
- where the changes introduced from passing from 1.4 to 1.6 or where
they introduced during 1.6 branch?
- by experiment I saw that it's not necessary to quote spaces or single
quotes but can all escaping be removed? what still needs to be escaped
if anything?

exten => 888,1,MYSQL(Connect connid localhost ipcontact passwd ipcontact)
exten => 888,n,GotoIf($["${connid}" = ""]?error,1)
exten => 888,n,MYSQL(Query resultid ${connid} SELECT\ `number`\ FROM\
`phones`\ WHERE\ `channel`=\'${chan}\')
exten => 888,n(fetchrow),MYSQL(Fetch *foundRow* ${resultid} number) /;
fetch row/
exten => 888,n,*GotoIf($["${foundRow}" = "1"]?done)* /; leave loop if no
row found/
exten => 888,n,NoOp(${number})
exten => 888,n,*Goto(fetchrow)* /; continue loop if row found/
exten => 888,n(done),MYSQL(Clear ${resultid})
exten => 888,n,MYSQL(Disconnect ${connid})

thanks
John



More information about the asterisk-users mailing list