John Fawcett
2009-May-09 08:42 UTC
[asterisk-users] Incompatible changes to asterisk 1.6 MYSQL addon query syntax
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
Tilghman Lesher
2009-May-10 05:33 UTC
[asterisk-users] Incompatible changes to asterisk 1.6 MYSQL addon query syntax
On Saturday 09 May 2009 03:42:04 John Fawcett wrote:> 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+MYSQLRemember the first time you had to do this and thought it was incredibly stupid how you had to escape commas and spaces? Well, nobody will think that anymore. What changed was in the process of making the comma the real separator, we made the insane amount of escaping go away completely. Yes, it's a one-time PITA that you have to change this, but it's wonderful for all of the people who come to Asterisk starting with 1.6 and never have to have seen the ugly amount of escaping. -- Tilghman