[svn-commits] oej: branch oej/moremanager r89569 - in /team/oej/moremanager: ./ apps/ build...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Nov 26 05:28:52 CST 2007


Author: oej
Date: Mon Nov 26 05:28:51 2007
New Revision: 89569

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89569
Log:
Updates

Modified:
    team/oej/moremanager/   (props changed)
    team/oej/moremanager/apps/app_queue.c
    team/oej/moremanager/apps/app_voicemail.c
    team/oej/moremanager/build_tools/make_buildopts_h
    team/oej/moremanager/channels/chan_misdn.c
    team/oej/moremanager/configs/agents.conf.sample
    team/oej/moremanager/configs/res_odbc.conf.sample
    team/oej/moremanager/doc/localchannel.txt
    team/oej/moremanager/doc/queues-with-callback-members.txt
    team/oej/moremanager/include/asterisk/module.h
    team/oej/moremanager/include/asterisk/res_odbc.h
    team/oej/moremanager/main/app.c
    team/oej/moremanager/main/loader.c
    team/oej/moremanager/main/manager.c
    team/oej/moremanager/main/pbx.c
    team/oej/moremanager/res/res_adsi.c
    team/oej/moremanager/res/res_config_odbc.c
    team/oej/moremanager/res/res_features.c
    team/oej/moremanager/res/res_odbc.c

Propchange: team/oej/moremanager/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Nov 26 05:28:51 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-89408
+/branches/1.4:1-89568

Modified: team/oej/moremanager/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/apps/app_queue.c?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/apps/app_queue.c (original)
+++ team/oej/moremanager/apps/app_queue.c Mon Nov 26 05:28:51 2007
@@ -2296,7 +2296,7 @@
 	
 		if (qe->parent->strategy == QUEUE_STRATEGY_RINGALL) {
 			if (option_debug)
-				ast_log(LOG_DEBUG, "Even though there are %d available members, the strategy is ringall so only the head call is allowed in\n", avl);
+				ast_log(LOG_DEBUG, "Even though there may be multiple members available, the strategy is ringall so only the head call is allowed in\n");
 			avl = 1;
 		} else {
 			struct ao2_iterator mem_iter = ao2_iterator_init(qe->parent->members, 0);

Modified: team/oej/moremanager/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/apps/app_voicemail.c?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/apps/app_voicemail.c (original)
+++ team/oej/moremanager/apps/app_voicemail.c Mon Nov 26 05:28:51 2007
@@ -4611,7 +4611,10 @@
 	if (!res) {
 		make_file(vms->fn, sizeof(vms->fn), vms->curdir, vms->curmsg);
 		vms->heard[vms->curmsg] = 1;
-		res = wait_file(chan, vms, vms->fn);
+		if ((res = wait_file(chan, vms, vms->fn)) < 0) {
+			ast_log(LOG_WARNING, "Playback of message %s failed\n", vms->fn);
+			res = 0;
+		}
 	}
 	DISPOSE(vms->curdir, vms->curmsg);
 	return res;

Modified: team/oej/moremanager/build_tools/make_buildopts_h
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/build_tools/make_buildopts_h?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/build_tools/make_buildopts_h (original)
+++ team/oej/moremanager/build_tools/make_buildopts_h Mon Nov 26 05:28:51 2007
@@ -14,4 +14,16 @@
 if ${GREP} AST_DEVMODE makeopts | ${GREP} -q yes
 then
 	echo "#define AST_DEVMODE 1"
+	TMP="${TMP} AST_DEVMODE"
 fi
+
+case ${OSARCH} in	# actually we should check build_os
+*BSD|mingw|darwin*)
+	BUILDSUM=`echo ${TMP} | md5 | cut -c1-32`
+	;;
+*)
+	BUILDSUM=`echo ${TMP} | md5sum | cut -c1-32`
+	;;
+esac
+
+echo "#define AST_BUILDOPT_SUM \"${BUILDSUM}\""

Modified: team/oej/moremanager/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/chan_misdn.c?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/channels/chan_misdn.c (original)
+++ team/oej/moremanager/channels/chan_misdn.c Mon Nov 26 05:28:51 2007
@@ -3143,16 +3143,12 @@
 			if (!rr->port)
 				rr->port = misdn_cfg_get_next_port_spin(rr->port);
 			
-			for (; rr->port > 0 && rr->port != port_start;
-				 rr->port = misdn_cfg_get_next_port_spin(rr->port)) {
+			for (; rr->port > 0; rr->port = misdn_cfg_get_next_port_spin(rr->port)) {
 				int port_up;
 				int check;
 				int max_chan;
 				int last_chance = 0;
 
-				if (!port_start)
-					port_start = rr->port;
-
 				misdn_cfg_get(rr->port, MISDN_CFG_GROUPNAME, cfg_group, BUFFERSIZE);
 				if (strcasecmp(cfg_group, group))
 					continue;
@@ -3165,6 +3161,12 @@
 
 				if (check && port_up < 0)
 					ast_log(LOG_WARNING,"This port (%d) is blocked\n", rr->port);
+
+				if ((port_start == rr->port) && (port_up <= 0))
+					break;
+
+				if (!port_start)
+					port_start = rr->port;
 
 				if (port_up <= 0)
 					continue;

Modified: team/oej/moremanager/configs/agents.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/configs/agents.conf.sample?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/configs/agents.conf.sample (original)
+++ team/oej/moremanager/configs/agents.conf.sample Mon Nov 26 05:28:51 2007
@@ -10,8 +10,8 @@
 ;
 persistentagents=yes
 
-;enable or disable a single extension from longing in as multiple
-;agents, defaults to enabled
+; Enable or disable a single extension from logging in as multiple agents.
+; The default value is "yes".
 ;multiplelogin=yes
 
 [agents]

Modified: team/oej/moremanager/configs/res_odbc.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/configs/res_odbc.conf.sample?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/configs/res_odbc.conf.sample (original)
+++ team/oej/moremanager/configs/res_odbc.conf.sample Mon Nov 26 05:28:51 2007
@@ -35,6 +35,9 @@
 username => oscar
 password => thegrouch
 pre-connect => yes
+; Many databases have a default of '\' to escape special characters.  MS SQL
+; Server does not.
+backslash_is_escape => no
 
 
 

Modified: team/oej/moremanager/doc/localchannel.txt
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/doc/localchannel.txt?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/doc/localchannel.txt (original)
+++ team/oej/moremanager/doc/localchannel.txt Mon Nov 26 05:28:51 2007
@@ -7,7 +7,7 @@
 
  Local/extension at context[/n]
 
-Adding "/n" at the end of the string will make the Local channel not do a native transfer (the "n" stands for "n"o release) upon the remote end answering the line. This is an esoteric, but important feature if you expect the Local channel to handle calls exactly like a normal channel. If you do not have the "no release" feature set, then as soon as the destination (inside of the Local channel) answers the line, the variables and dial plan will revert back to that of the original call, and the Local channel will become a zombie and be removed from the active channels list. This is desirable in some circumstances, but can result in unexpected dialplan behavior if you are doing fancy things with variables in your call handling.
+Adding "/n" at the end of the string will make the Local channel not do a native transfer (the "n" stands for "n"o release) upon the remote end answering the line. This is an esoteric, but important feature if you expect the Local channel to handle calls exactly like a normal channel. If you do not have the "no release" feature set, then as soon as the destination (inside of the Local channel) answers the line and one audio frame passes, the variables and dial plan will revert back to that of the original call, and the Local channel will become a zombie and be removed from the active channels list. This is desirable in some circumstances, but can result in unexpected dialplan behavior if you are doing fancy things with variables in your call handling.
 
 * Purpose:
 

Modified: team/oej/moremanager/doc/queues-with-callback-members.txt
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/doc/queues-with-callback-members.txt?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/doc/queues-with-callback-members.txt (original)
+++ team/oej/moremanager/doc/queues-with-callback-members.txt Mon Nov 26 05:28:51 2007
@@ -354,9 +354,11 @@
                 case I:
                         Playback(agent-loginok);
                         Hangup();
+						break;
                 case O:
                         Playback(agent-loggedoff);
                         Hangup();
+						break;
                 }
         }
 }
@@ -369,25 +371,20 @@
         switch(${MACRO_EXTEN:0:1})
         {
         case I:  // Login
-                {
                 AddQueueMember(${queuename},Local/${MACRO_EXTEN:1}@agents,${penalty});
-                }
+				break;
         case O:  // Logout
-                {
                 RemoveQueueMember(${queuename},Local/${MACRO_EXTEN:1}@agents);
-                }
+				break;
         case P:  // Pause
-                {
                 PauseQueueMember(${queuename},Local/${MACRO_EXTEN:1}@agents);
-                }
+				break;
         case U:  // Unpause
-                {
                 UnpauseQueueMember(${queuename},Local/${MACRO_EXTEN:1}@agents);
-                }
+				break;
         default: // Invalid
-                {
                 Playback(invalid);
-                }
+				break;
         }
 }
 

Modified: team/oej/moremanager/include/asterisk/module.h
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/include/asterisk/module.h?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/include/asterisk/module.h (original)
+++ team/oej/moremanager/include/asterisk/module.h Mon Nov 26 05:28:51 2007
@@ -183,10 +183,11 @@
 
 struct ast_module_info {
 
-	/* The 'self' pointer for a module; it will be set by the loader before
-	   it calls the module's load_module() entrypoint, and used by various
-	   other macros that need to identify the module.
-	*/
+	/*!
+	 * The 'self' pointer for a module; it will be set by the loader before
+	 * it calls the module's load_module() entrypoint, and used by various
+	 * other macros that need to identify the module.
+	 */
 
 	struct ast_module *self;
 	enum ast_module_load_result (*load)(void);	/* register stuff etc. Optional. */
@@ -203,6 +204,9 @@
 
 	const char *key;
 	unsigned int flags;
+
+	/*! The value of AST_BUILDOPT_SUM when this module was compiled */
+	const char buildopt_sum[33];
 };
 
 void ast_module_register(const struct ast_module_info *);
@@ -232,7 +236,8 @@
 		AST_MODULE,				\
 		desc,					\
 		keystr,					\
-		flags_to_set				\
+		flags_to_set,				\
+		AST_BUILDOPT_SUM,			\
 	};						\
 	static void  __attribute__ ((constructor)) __reg_module(void) \
 	{ \
@@ -262,6 +267,7 @@
 		.flags = flags_to_set,				\
 		.description = desc,				\
 		.key = keystr,					\
+		.buildopt_sum = AST_BUILDOPT_SUM,		\
 		fields						\
 	};							\
 	static void  __attribute__ ((constructor)) __reg_module(void) \

Modified: team/oej/moremanager/include/asterisk/res_odbc.h
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/include/asterisk/res_odbc.h?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/include/asterisk/res_odbc.h (original)
+++ team/oej/moremanager/include/asterisk/res_odbc.h Mon Nov 26 05:28:51 2007
@@ -85,6 +85,12 @@
  */
 int ast_odbc_sanity_check(struct odbc_obj *obj);
 
+/*! \brief Checks if the database natively supports backslash as an escape character.
+ * \param obj The ODBC object
+ * \return Returns 1 if an ESCAPE clause is needed to support '\', 0 otherwise
+ */
+int ast_odbc_backslash_is_escape(struct odbc_obj *obj);
+
 /*! \brief Prepares, executes, and returns the resulting statement handle.
  * \param obj The ODBC object
  * \param prepare_cb A function callback, which, when called, should return a statement handle prepared, with any necessary parameters or result columns bound.

Modified: team/oej/moremanager/main/app.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/main/app.c?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/main/app.c (original)
+++ team/oej/moremanager/main/app.c Mon Nov 26 05:28:51 2007
@@ -689,8 +689,6 @@
 		} else {
 			ast_frfree(f);
 		}
-		if (end == start)
-			end = time(NULL);
 	} else {
 		ast_log(LOG_WARNING, "Error creating writestream '%s', format '%s'\n", recordfile, sfmt[x]);
 	}
@@ -699,7 +697,17 @@
 		if (silgen)
 			ast_channel_stop_silence_generator(chan, silgen);
 	}
-	*duration = end - start;
+
+	/*!\note
+	 * Instead of asking how much time passed (end - start), calculate the number
+	 * of seconds of audio which actually went into the file.  This fixes a
+	 * problem where audio is stopped up on the network and never gets to us.
+	 *
+	 * Note that we still want to use the number of seconds passed for the max
+	 * message, otherwise we could get a situation where this stream is never
+	 * closed (which would create a resource leak).
+	 */
+	*duration = ast_tellstream(others[0]) / 8000;
 
 	if (!prepend) {
 		for (x = 0; x < fmtcnt; x++) {

Modified: team/oej/moremanager/main/loader.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/main/loader.c?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/main/loader.c (original)
+++ team/oej/moremanager/main/loader.c Mon Nov 26 05:28:51 2007
@@ -76,6 +76,8 @@
 { 0x87, 0x76, 0x79, 0x35, 0x23, 0xea, 0x3a, 0xd3,
   0x25, 0x2a, 0xbb, 0x35, 0x87, 0xe4, 0x22, 0x24 };
 
+static char buildopt_sum[33] = AST_BUILDOPT_SUM;
+
 static unsigned int embedding = 1; /* we always start out by registering embedded modules,
 				      since they are here before we dlopen() any
 				   */
@@ -615,6 +617,13 @@
 
 	if (verify_key((unsigned char *) mod->info->key)) {
 		ast_log(LOG_WARNING, "Module '%s' did not provide a valid license key.\n", mod->resource);
+		return 1;
+	}
+
+	if (!ast_strlen_zero(mod->info->buildopt_sum) &&
+	    strcmp(buildopt_sum, mod->info->buildopt_sum)) {
+		ast_log(LOG_WARNING, "Module '%s' was not compiled with the same compile-time options as this version of Asterisk.\n", mod->resource);
+		ast_log(LOG_WARNING, "Module '%s' will not be initialized as it may cause instability.\n", mod->resource);
 		return 1;
 	}
 

Modified: team/oej/moremanager/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/main/manager.c?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/main/manager.c (original)
+++ team/oej/moremanager/main/manager.c Mon Nov 26 05:28:51 2007
@@ -70,6 +70,7 @@
 #include "asterisk/linkedlists.h"
 #include "asterisk/version.h"
 #include "asterisk/term.h"
+#include "asterisk/astobj2.h"
 
 struct fast_originate_helper {
 	char tech[AST_MAX_EXTENSION];
@@ -275,6 +276,47 @@
 	}
 }
 
+struct variable_count {
+	char *varname;
+	int count;
+};
+
+static int compress_char(char c)
+{
+	c &= 0x7f;
+	if (c < 32)
+		return 0;
+	else if (c >= 'a' && c <= 'z')
+		return c - 64;
+	else if (c > 'z')
+		return '_';
+	else
+		return c - 32;
+}
+
+static int variable_count_hash_fn(const void *vvc, const int flags)
+{
+	const struct variable_count *vc = vvc;
+	int res = 0, i;
+	for (i = 0; i < 5; i++) {
+		if (vc->varname[i] == '\0')
+			break;
+		res += compress_char(vc->varname[i]) << (i * 6);
+	}
+	return res;
+}
+
+static int variable_count_cmp_fn(void *obj, void *vstr, int flags)
+{
+	/* Due to the simplicity of struct variable_count, it makes no difference
+	 * if you pass in objects or strings, the same operation applies. This is
+	 * due to the fact that the hash occurs on the first element, which means
+	 * the address of both the struct and the string are exactly the same. */
+	struct variable_count *vc = obj;
+	char *str = vstr;
+	return !strcmp(vc->varname, str) ? CMP_MATCH : 0;
+}
+
 static char *xml_translate(char *in, struct ast_variable *vars)
 {
 	struct ast_variable *v;
@@ -288,7 +330,9 @@
 	int escaped = 0;
 	int inobj = 0;
 	int x;
-	
+	struct variable_count *vc = NULL;
+	struct ao2_container *vco = NULL;
+
 	for (v = vars; v; v = v->next) {
 		if (!dest && !strcasecmp(v->name, "ajaxdest"))
 			dest = v->value;
@@ -304,7 +348,7 @@
 			colons++;
 		else if (in[x] == '\n')
 			breaks++;
-		else if (strchr("&\"<>", in[x]))
+		else if (strchr("&\"<>\'", in[x]))
 			escaped++;
 	}
 	len = (size_t) (strlen(in) + colons * 5 + breaks * (40 + strlen(dest) + strlen(objtype)) + escaped * 10); /* foo="bar", "<response type=\"object\" id=\"dest\"", "&amp;" */
@@ -320,6 +364,10 @@
 			if ((count > 3) && inobj) {
 				ast_build_string(&tmp, &len, " /></response>\n");
 				inobj = 0;
+
+				/* Entity is closed, so close out the name cache */
+				ao2_ref(vco, -1);
+				vco = NULL;
 			}
 			count = 0;
 			while (*in && (*in < 32)) {
@@ -334,19 +382,39 @@
 				if (*val == ' ')
 					val++;
 				if (!inobj) {
+					vco = ao2_container_alloc(37, variable_count_hash_fn, variable_count_cmp_fn);
 					ast_build_string(&tmp, &len, "<response type='object' id='%s'><%s", dest, objtype);
 					inobj = 1;
 				}
-				ast_build_string(&tmp, &len, " ");				
+
+				/* Check if the var has been used already */
+				if ((vc = ao2_find(vco, var, 0)))
+					vc->count++;
+				else {
+					/* Create a new entry for this one */
+					vc = ao2_alloc(sizeof(*vc), NULL);
+					vc->varname = var;
+					vc->count = 1;
+					/* Increment refcount, because we're going to deref once later */
+					ao2_ref(vc, 1);
+					ao2_link(vco, vc);
+				}
+
+				ast_build_string(&tmp, &len, " ");
 				xml_copy_escape(&tmp, &len, var, 1);
+				if (vc->count > 1)
+					ast_build_string(&tmp, &len, "-%d", vc->count);
 				ast_build_string(&tmp, &len, "='");
 				xml_copy_escape(&tmp, &len, val, 0);
 				ast_build_string(&tmp, &len, "'");
+				ao2_ref(vc, -1);
 			}
 		}
 	}
 	if (inobj)
 		ast_build_string(&tmp, &len, " /></response>\n");
+	if (vco)
+		ao2_ref(vco, -1);
 	return out;
 }
 

Modified: team/oej/moremanager/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/main/pbx.c?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/main/pbx.c (original)
+++ team/oej/moremanager/main/pbx.c Mon Nov 26 05:28:51 2007
@@ -2002,6 +2002,7 @@
 {
 	struct ast_hint *hint;
 
+	ast_mutex_lock(&conlock);
 	AST_LIST_LOCK(&hints);
 
 	AST_LIST_TRAVERSE(&hints, hint, list) {
@@ -2039,6 +2040,7 @@
 	}
 
 	AST_LIST_UNLOCK(&hints);
+	ast_mutex_unlock(&conlock);
 }
 
 /*! \brief  ast_extension_state_add: Add watcher for extension states */

Modified: team/oej/moremanager/res/res_adsi.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/res/res_adsi.c?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/res/res_adsi.c (original)
+++ team/oej/moremanager/res/res_adsi.c Mon Nov 26 05:28:51 2007
@@ -168,6 +168,7 @@
 			/* Read a voice frame */
 			if (inf->subclass != AST_FORMAT_ULAW) {
 				ast_log(LOG_WARNING, "Channel not in ulaw?\n");
+				ast_frfree(inf);
 				return -1;
 			}
 			/* Send no more than they sent us */
@@ -182,6 +183,7 @@
 			outf.samples = amt;
 			if (ast_write(chan, &outf)) {
 				ast_log(LOG_WARNING, "Failed to carefully write frame\n");
+				ast_frfree(inf);
 				return -1;
 			}
 			/* Update pointers and lengths */
@@ -256,6 +258,7 @@
 						if (!chan->adsicpe)
 							chan->adsicpe = AST_ADSI_UNAVAILABLE;
 						errno =	ENOSYS;
+						ast_frfree(f);
 						return -1;
 					}
 				}

Modified: team/oej/moremanager/res/res_config_odbc.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/res/res_config_odbc.c?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/res/res_config_odbc.c (original)
+++ team/oej/moremanager/res/res_config_odbc.c Mon Nov 26 05:28:51 2007
@@ -136,11 +136,12 @@
 		return NULL;
 	newval = va_arg(aq, const char *);
 	op = !strchr(newparam, ' ') ? " =" : "";
-	snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?", table, newparam, op);
+	snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?%s", table, newparam, op,
+		strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : "");
 	while((newparam = va_arg(aq, const char *))) {
 		op = !strchr(newparam, ' ') ? " =" : "";
 		snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " AND %s%s ?%s", newparam, op,
-			strcasestr(newparam, "LIKE") ? " ESCAPE '\\'" : "");
+			strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : "");
 		newval = va_arg(aq, const char *);
 	}
 	va_end(aq);
@@ -266,11 +267,12 @@
 		*op = '\0';
 	newval = va_arg(aq, const char *);
 	op = !strchr(newparam, ' ') ? " =" : "";
-	snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?", table, newparam, op);
+	snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?%s", table, newparam, op,
+		strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : "");
 	while((newparam = va_arg(aq, const char *))) {
 		op = !strchr(newparam, ' ') ? " =" : "";
 		snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " AND %s%s ?%s", newparam, op,
-			strcasestr(newparam, "LIKE") ? " ESCAPE '\\'" : "");
+			strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : "");
 		newval = va_arg(aq, const char *);
 	}
 	if (initfield)

Modified: team/oej/moremanager/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/res/res_features.c?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/res/res_features.c (original)
+++ team/oej/moremanager/res/res_features.c Mon Nov 26 05:28:51 2007
@@ -305,10 +305,7 @@
 		return AST_DEVICE_INUSE;
 }
 
-/*! \brief Park a call 
- 	\note We put the user in the parking list, then wake up the parking thread to be sure it looks
-	after these channels too */
-int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout)
+static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout, char *orig_chan_name)
 {
 	struct parkeduser *pu, *cur;
 	int i, x = -1, parking_range;
@@ -375,8 +372,9 @@
 	pu->parkingtime = (timeout > 0) ? timeout : parkingtime;
 	if (extout)
 		*extout = x;
-
-	if (peer) 
+	if (!ast_strlen_zero(orig_chan_name))
+		ast_copy_string(pu->peername, orig_chan_name, sizeof(pu->peername));
+	else if (peer) 
 		ast_copy_string(pu->peername, peer->name, sizeof(pu->peername));
 
 	/* Remember what had been dialed, so that if the parking
@@ -422,7 +420,7 @@
 	if (!con)	/* Still no context? Bad */
 		ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con);
 	/* Tell the peer channel the number of the parking space */
-	if (peer && pu->parkingnum != -1) { /* Only say number if it's a number */
+	if ((peer && pu->parkingnum != -1 && ast_strlen_zero(orig_chan_name)) || (strlen(orig_chan_name) == strlen(peer->name) && !strncasecmp(peer->name, orig_chan_name, strlen(peer->name)))) { /* Only say number if it's a number and the channel hasn't been masqueraded away */
 		/* Make sure we don't start saying digits to the channel being parked */
 		ast_set_flag(peer, AST_FLAG_MASQ_NOSTREAM);
 		ast_say_digits(peer, pu->parkingnum, "", peer->language);
@@ -441,6 +439,14 @@
 		pthread_kill(parking_thread, SIGURG);
 	}
 	return 0;
+}
+
+/*! \brief Park a call 
+ 	\note We put the user in the parking list, then wake up the parking thread to be sure it looks
+	after these channels too */
+int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout)
+{
+	return park_call_full(chan, peer, timeout, extout, NULL);
 }
 
 int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int timeout, int *extout)
@@ -1800,6 +1806,10 @@
 /*! \brief Park a call */
 static int park_call_exec(struct ast_channel *chan, void *data)
 {
+	/* Cache the original channel name in case we get masqueraded in the middle
+	 * of a park--it is still theoretically possible for a transfer to happen before
+	 * we get here, but it is _really_ unlikely */
+	char *orig_chan_name = ast_strdupa(chan->name);
 	/* Data is unused at the moment but could contain a parking
 	   lot context eventually */
 	int res = 0;
@@ -1819,7 +1829,7 @@
 		res = ast_safe_sleep(chan, 1000);
 	/* Park the call */
 	if (!res)
-		res = ast_park_call(chan, chan, 0, NULL);
+		res = park_call_full(chan, chan, 0, NULL, orig_chan_name);
 
 	ast_module_user_remove(u);
 
@@ -2249,7 +2259,7 @@
 				parkingtime = parkingtime * 1000;
 		} else if (!strcasecmp(var->name, "parkpos")) {
 			if (sscanf(var->value, "%d-%d", &start, &end) != 2) {
-				ast_log(LOG_WARNING, "Format for parking positions is a-b, where a and b are numbers at line %d of parking.conf\n", var->lineno);
+				ast_log(LOG_WARNING, "Format for parking positions is a-b, where a and b are numbers at line %d of features.conf\n", var->lineno);
 			} else {
 				parking_start = start;
 				parking_stop = end;

Modified: team/oej/moremanager/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/res/res_odbc.c?view=diff&rev=89569&r1=89568&r2=89569
==============================================================================
--- team/oej/moremanager/res/res_odbc.c (original)
+++ team/oej/moremanager/res/res_odbc.c Mon Nov 26 05:28:51 2007
@@ -66,6 +66,7 @@
 	unsigned int limit:10;          /* Gives a limit of 1023 maximum */
 	unsigned int count:10;          /* Running count of pooled connections */
 	unsigned int delme:1;			/* Purge the class */
+	unsigned int backslash_is_escape:1;	/* On this database, the backslash is a native escape sequence */
 	AST_LIST_HEAD(, odbc_obj) odbc_obj;
 };
 
@@ -212,7 +213,7 @@
 	struct ast_config *config;
 	struct ast_variable *v;
 	char *cat, *dsn, *username, *password;
-	int enabled, pooling, limit;
+	int enabled, pooling, limit, bse;
 	int connect = 0, res = 0;
 
 	struct odbc_class *new;
@@ -235,6 +236,7 @@
 			connect = 0;
 			pooling = 0;
 			limit = 0;
+			bse = 1;
 			for (v = ast_variable_browse(config, cat); v; v = v->next) {
 				if (!strcasecmp(v->name, "pooling")) {
 					if (ast_true(v->value))
@@ -259,6 +261,8 @@
 					username = v->value;
 				} else if (!strcasecmp(v->name, "password")) {
 					password = v->value;
+				} else if (!strcasecmp(v->name, "backslash_is_escape")) {
+					bse = ast_true(v->value);
 				}
 			}
 
@@ -298,6 +302,8 @@
 					}
 				}
 
+				new->backslash_is_escape = bse ? 1 : 0;
+
 				odbc_register_class(new, connect);
 				ast_log(LOG_NOTICE, "Registered ODBC class '%s' dsn->[%s]\n", cat, dsn);
 			}
@@ -377,6 +383,11 @@
 	/* For pooled connections, this frees the connection to be
 	 * reused.  For non-pooled connections, it does nothing. */
 	obj->used = 0;
+}
+
+int ast_odbc_backslash_is_escape(struct odbc_obj *obj)
+{
+	return obj->parent->backslash_is_escape;
 }
 
 struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
@@ -533,7 +544,7 @@
 	struct ast_config *config;
 	struct ast_variable *v;
 	char *cat, *dsn, *username, *password;
-	int enabled, pooling, limit;
+	int enabled, pooling, limit, bse;
 	int connect = 0, res = 0;
 
 	struct odbc_class *new, *class;
@@ -560,6 +571,7 @@
 				connect = 0;
 				pooling = 0;
 				limit = 0;
+				bse = 1;
 				for (v = ast_variable_browse(config, cat); v; v = v->next) {
 					if (!strcasecmp(v->name, "pooling")) {
 						pooling = 1;
@@ -583,6 +595,8 @@
 						username = v->value;
 					} else if (!strcasecmp(v->name, "password")) {
 						password = v->value;
+					} else if (!strcasecmp(v->name, "backslash_is_escape")) {
+						bse = ast_true(v->value);
 					}
 				}
 
@@ -637,6 +651,8 @@
 						}
 					}
 
+					new->backslash_is_escape = bse;
+
 					if (class) {
 						ast_log(LOG_NOTICE, "Refreshing ODBC class '%s' dsn->[%s]\n", cat, dsn);
 					} else {




More information about the svn-commits mailing list