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	
