[asterisk-commits] mmichelson: branch mmichelson/queue-reset r101770 - in /team/mmichelson/queue...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 1 09:09:07 CST 2008


Author: mmichelson
Date: Fri Feb  1 09:09:07 2008
New Revision: 101770

URL: http://svn.digium.com/view/asterisk?view=rev&rev=101770
Log:
Resolve conflict and reset automerge property


Modified:
    team/mmichelson/queue-reset/   (props changed)
    team/mmichelson/queue-reset/apps/app_queue.c
    team/mmichelson/queue-reset/channels/chan_sip.c

Propchange: team/mmichelson/queue-reset/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/mmichelson/queue-reset/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Feb  1 09:09:07 2008
@@ -1,1 +1,1 @@
-/trunk:1-101545
+/trunk:1-101600

Modified: team/mmichelson/queue-reset/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-reset/apps/app_queue.c?view=diff&rev=101770&r1=101769&r2=101770
==============================================================================
--- team/mmichelson/queue-reset/apps/app_queue.c (original)
+++ team/mmichelson/queue-reset/apps/app_queue.c Fri Feb  1 09:09:07 2008
@@ -1427,14 +1427,33 @@
 
 	/* Create a new queue if an in-core entry does not exist yet. */
 	if (!q) {
+		struct ast_variable *tmpvar = NULL;
 		if (!(q = alloc_queue(queuename)))
 			return NULL;
 		ao2_lock(q);
 		clear_queue(q);
 		q->realtime = 1;
 		q->membercount = 0;
+		/*Before we initialize the queue, we need to set the strategy, so that linear strategy
+		 * will allocate the members properly
+		 */
+		for (tmpvar = queue_vars; tmpvar; tmpvar = tmpvar->next) {
+			if (!strcasecmp(tmpvar->name, "strategy")) {
+				q->strategy = strat2int(tmpvar->value);
+				if (q->strategy < 0) {
+					ast_log(LOG_WARNING, "'%s' isn't a valid strategy for queue '%s', using ringall instead\n",
+					tmpvar->value, q->name);
+					q->strategy = QUEUE_STRATEGY_RINGALL;
+				}
+				break;
+			}
+		}
+		/* We traversed all variables and didn't find a strategy */
+		if (!tmpvar)
+			q->strategy = QUEUE_STRATEGY_RINGALL;
 		init_queue(q);		/* Ensure defaults for all parameters not set explicitly. */
 		ao2_link(queues, q);
+		ast_variables_destroy(tmpvar);
 	}
 
 	memset(tmpbuf, 0, sizeof(tmpbuf));
@@ -1463,10 +1482,10 @@
 
 	while ((interface = ast_category_browse(member_config, interface))) {
 		rt_handle_member_record(q, interface,
-			ast_variable_retrieve(member_config, interface, "membername"),
+			S_OR(ast_variable_retrieve(member_config, interface, "membername"),interface),
 			ast_variable_retrieve(member_config, interface, "penalty"),
 			ast_variable_retrieve(member_config, interface, "paused"),
-			ast_variable_retrieve(member_config, interface, "state_interface"));
+			S_OR(ast_variable_retrieve(member_config, interface, "state_interface"),interface));
 	}
 
 	/* Delete all realtime members that have been deleted in DB. */
@@ -1584,7 +1603,7 @@
 			S_OR(ast_variable_retrieve(member_config, interface, "membername"), interface),
 			ast_variable_retrieve(member_config, interface, "penalty"),
 			ast_variable_retrieve(member_config, interface, "paused"),
-			ast_variable_retrieve(member_config, interface, "state_interface"));
+			S_OR(ast_variable_retrieve(member_config, interface, "state_interface"), interface));
 	}
 
 	/* Delete all realtime members that have been deleted in DB. */

Modified: team/mmichelson/queue-reset/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-reset/channels/chan_sip.c?view=diff&rev=101770&r1=101769&r2=101770
==============================================================================
--- team/mmichelson/queue-reset/channels/chan_sip.c (original)
+++ team/mmichelson/queue-reset/channels/chan_sip.c Fri Feb  1 09:09:07 2008
@@ -17903,8 +17903,10 @@
 	AST_LIST_TRAVERSE(&threadl, th, list) {
 		if ((s->sin_family == th->ser->requestor.sin_family) &&
 			(s->sin_addr.s_addr == th->ser->requestor.sin_addr.s_addr) &&
-			(s->sin_port == th->ser->requestor.sin_port)) 
+			(s->sin_port == th->ser->requestor.sin_port))  {
+				AST_LIST_UNLOCK(&threadl);
 				return th->ser;
+			}
 	}
 	AST_LIST_UNLOCK(&threadl);
 	return NULL;




More information about the asterisk-commits mailing list