id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,confirmation,distro,engine,distro_ver,engine_version,svn_rev
3821,cidlookup fails on Asterisk 1.6,tonils,,Asterisk 1.6 parses lines in extensions.conf differently to Asterisk 1.4\r\n\r\n>As a side effect of the application delimiter change_ many places that used to need quotes in order to get the proper meaning are no longer required. You now only need to quote strings in configuration files if you literally want quotation marks within a string.\r\n\r\nThe code generated by cidlookup escapes whitespace and the the SQL command does not execute on Asterisk 1.6\r\n\r\nThe following patch should fix the problem\r\n{{{\r\n--- cidlookup/functions.inc.php.orig    2009-08-24 13:48:59.000000000 +0200\r\n+++ cidlookup/functions.inc.php 2009-08-24 14:16:46.000000000 +0200\r\n@@ -115_10 +115_11 @@\r\n\r\n function cidlookup_get_config($engine) {\r\n        // TODO: discuss if mysql and http lookup should be implemented in dialplan or in an external AGI\r\n        global $ext;  // is this the best way to pass this?\r\n        global $asterisk_conf;\r\n+       global $version;\r\n        switch($engine) {\r\n                case "asterisk":\r\n                        $sources = cidlookup_list();\r\n                        if(is_array($sources)) {\r\n                                foreach($sources as $item) {\r\n@@ -177_11 +178_15 @@\r\n                                                                ')' => '\\\\)'_\r\n                                                                '.' => '\\\\.'_\r\n                                                                '|' => '\\\\|'\r\n                                                        );\r\n\r\n-                                                       $query = str_replace(array_keys($replacements)_ array_values($replacements)_ $item['mysql_query']);\r\n+                                                       if (version_compare($version_ "1.6"_ "lt")) {\r\n+                                                               $query = str_replace(array_keys($replacements)_ array_values($replacements)_ $item['mysql_query']);\r\n+                                                       } else {\r\n+                                                               $query = $item['mysql_query'];\r\n+                                                       }\r\n                                                        $query = str_replace('[NUMBER]'_ '${CALLERID(num)}'_ $query);\r\n\r\n                                                        $ext->add('cidlookup'_ 'cidlookup_'.$item['cidlookup_id']_ ''_ new ext_mysql_connect('connid'_ $item['mysql_host']_  $item['mysql_username']_  $item['mysql_password']_  $item['mysql_dbname']));\r\n                                                        $ext->add('cidlookup'_ 'cidlookup_'.$item['cidlookup_id']_ ''_ new ext_mysql_query('resultid'_ 'connid'_ $query));\r\n                                                        $ext->add('cidlookup'_ 'cidlookup_'.$item['cidlookup_id']_ ''_ new ext_mysql_fetch('fetchid'_ 'resultid'_ 'CALLERID(name)'));\r\n\r\n}}}\r\nTony,Bugs,closed,minor,2.6,CallerID Lookup,2.5-branch,fixed,,,Unreviewed,,Asterisk 1.6,,1.6.1.2,
