[svn-commits] oej: branch oej/pinequeue-trunk r364016 - in /team/oej/pinequeue-trunk: ./ ap...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Apr 26 09:34:23 CDT 2012


Author: oej
Date: Thu Apr 26 09:34:16 2012
New Revision: 364016

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=364016
Log:
Reset

Modified:
    team/oej/pinequeue-trunk/   (props changed)
    team/oej/pinequeue-trunk/apps/app_queue.c
    team/oej/pinequeue-trunk/channels/chan_sip.c

Propchange: team/oej/pinequeue-trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Propchange: team/oej/pinequeue-trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Apr 26 09:34:16 2012
@@ -1,1 +1,1 @@
-/trunk:1-363972
+/trunk:1-364012

Modified: team/oej/pinequeue-trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/apps/app_queue.c?view=diff&rev=364016&r1=364015&r2=364016
==============================================================================
--- team/oej/pinequeue-trunk/apps/app_queue.c (original)
+++ team/oej/pinequeue-trunk/apps/app_queue.c Thu Apr 26 09:34:16 2012
@@ -1340,8 +1340,9 @@
 	int x;
 
 	for (x = 0; x < ARRAY_LEN(strategies); x++) {
-		if (strategy == strategies[x].strategy)
+		if (strategy == strategies[x].strategy) {
 			return strategies[x].name;
+		}
 	}
 
 	return "<unknown>";
@@ -1352,8 +1353,9 @@
 	int x;
 
 	for (x = 0; x < ARRAY_LEN(strategies); x++) {
-		if (!strcasecmp(strategy, strategies[x].name))
+		if (!strcasecmp(strategy, strategies[x].name)) {
 			return strategies[x].strategy;
+		}
 	}
 
 	return -1;
@@ -1363,16 +1365,19 @@
 {
 	int x;
 	/*This 'double check' that default value is OFF */
-	if (ast_strlen_zero(autopause))
+	if (ast_strlen_zero(autopause)) {
 		return QUEUE_AUTOPAUSE_OFF;
+	}
 
 	/*This 'double check' is to ensure old values works */
-	if(ast_true(autopause))
+	if(ast_true(autopause)) {
 		return QUEUE_AUTOPAUSE_ON;
+	}
 
 	for (x = 0; x < ARRAY_LEN(autopausesmodes); x++) {
-		if (!strcasecmp(autopause, autopausesmodes[x].name))
+		if (!strcasecmp(autopause, autopausesmodes[x].name)) {
 			return autopausesmodes[x].autopause;
+		}
 	}
 
 	/*This 'double check' that default value is OFF */
@@ -1442,8 +1447,9 @@
 
 	if (q->setqueuevar) {
 		sl = 0;
-		if (q->callscompleted > 0) 
+		if (q->callscompleted > 0) {
 			sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
+		}
 
 		snprintf(interfacevar, sizeof(interfacevar),
 			"QUEUENAME=%s,QUEUEMAX=%d,QUEUESTRATEGY=%s,QUEUECALLS=%d,QUEUEHOLDTIME=%d,QUEUETALKTIME=%d,QUEUECOMPLETED=%d,QUEUEABANDONED=%d,QUEUESRVLEVEL=%d,QUEUESRVLEVELPERF=%2.1f",
@@ -1573,8 +1579,9 @@
 {
 	m->status = status;
 
-	if (q->maskmemberstatus)
+	if (q->maskmemberstatus) {
 		return 0;
+	}
 
 	manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus",
 		"Queue: %s\r\n"
@@ -1612,9 +1619,11 @@
 		for (; (m = ao2_iterator_next(&miter)); ao2_ref(m, -1)) {
 			ast_copy_string(interface, m->state_interface, sizeof(interface));
 
-			if ((slash_pos = strchr(interface, '/')))
-				if (!strncasecmp(interface, "Local/", 6) && (slash_pos = strchr(slash_pos + 1, '/')))
+			if ((slash_pos = strchr(interface, '/'))) {
+				if (!strncasecmp(interface, "Local/", 6) && (slash_pos = strchr(slash_pos + 1, '/'))) {
 					*slash_pos = '\0';
+				}
+			}
 
 			if (!strcasecmp(interface, sc->dev)) {
 				found = 1;
@@ -3343,10 +3352,11 @@
 	macrocontext = pbx_builtin_getvar_helper(qe->chan, "MACRO_CONTEXT");
 	ast_channel_dialcontext_set(tmp->chan, ast_strlen_zero(macrocontext) ? ast_channel_context(qe->chan) : macrocontext);
 	macroexten = pbx_builtin_getvar_helper(qe->chan, "MACRO_EXTEN");
-	if (!ast_strlen_zero(macroexten))
+	if (!ast_strlen_zero(macroexten)) {
 		ast_channel_exten_set(tmp->chan, macroexten);
-	else
+	} else {
 		ast_channel_exten_set(tmp->chan, ast_channel_exten(qe->chan));
+	}
 	if (ast_cdr_isset_unanswered()) {
 		/* they want to see the unanswered dial attempts! */
 		/* set up the CDR fields on all the CDRs to give sensical information */
@@ -3746,8 +3756,9 @@
 				numlines++;
 			}
 			if (pos > 1 /* found */ || !stillgoing /* nobody listening */ ||
-				(qe->parent->strategy != QUEUE_STRATEGY_RINGALL) /* ring would not be delivered */)
+				(qe->parent->strategy != QUEUE_STRATEGY_RINGALL) /* ring would not be delivered */) {
 				break;
+			}
 			/* On "ringall" strategy we only move to the next penalty level
 			   when *all* ringing phones are done in the current penalty level */
 			ring_one(qe, outgoing, &numbusies);
@@ -4228,8 +4239,9 @@
 
 		/* Make a position announcement, if enabled */
 		if (qe->parent->announcefrequency &&
-			(res = say_position(qe,ringing)))
+			(res = say_position(qe,ringing))) {
 			break;
+		}
 
 		/* If we have timed out, break out */
 		if (qe->expire && (time(NULL) >= qe->expire)) {
@@ -4687,10 +4699,12 @@
 		ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_PARKCALL);
 	}
 	if (ast_test_flag(&opts, OPT_NO_RETRY)) {
-		if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY || qe->parent->strategy == QUEUE_STRATEGY_LINEAR || qe->parent->strategy == QUEUE_STRATEGY_RRORDERED)
+		if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY || qe->parent->strategy == QUEUE_STRATEGY_LINEAR 
+			|| qe->parent->strategy == QUEUE_STRATEGY_RRORDERED) {
 			(*tries)++;
-		else
+		} else {
 			*tries = ao2_container_count(qe->parent->members);
+		}
 		*noption = 1;
 	}
 	if (ast_test_flag(&opts, OPT_IGNORE_CALL_FW)) {
@@ -4720,10 +4734,12 @@
 	ast_debug(1, "%s is trying to call a queue member.\n",
 							ast_channel_name(qe->chan));
 	ast_copy_string(queuename, qe->parent->name, sizeof(queuename));
-	if (!ast_strlen_zero(qe->announce))
+	if (!ast_strlen_zero(qe->announce)) {
 		announce = qe->announce;
-	if (!ast_strlen_zero(announceoverride))
+	}
+	if (!ast_strlen_zero(announceoverride)) {
 		announce = announceoverride;
+	}
 
 	memi = ao2_iterator_init(qe->parent->members, 0);
 	while ((cur = ao2_iterator_next(&memi))) {
@@ -4830,10 +4846,11 @@
 
 	if (qe->parent->timeoutpriority == TIMEOUT_PRIORITY_APP) {
 		/* Application arguments have higher timeout priority (behaviour for <=1.6) */
-		if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout))
+		if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout)) {
 			to = (qe->expire - now) * 1000;
-		else
+		} else {
 			to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1;
+		}
 	} else {
 		/* Config timeout is higher priority thatn application timeout */
 		if (qe->expire && qe->expire<=now) {
@@ -4879,8 +4896,9 @@
 			/* User exited by pressing a digit */
 			res = digit;
 		}
-		if (res == -1)
+		if (res == -1) {
 			ast_debug(1, "%s: Nobody answered.\n", ast_channel_name(qe->chan));
+		}
 		if (ast_cdr_isset_unanswered()) {
 			/* channel contains the name of one of the outgoing channels
 			   in its CDR; zero out this CDR to avoid a dual-posting */
@@ -4904,10 +4922,12 @@
 		/* Ah ha!  Someone answered within the desired timeframe.  Of course after this
 		   we will always return with -1 so that it is hung up properly after the
 		   conversation.  */
-		if (!strcmp(ast_channel_tech(qe->chan)->type, "DAHDI"))
+		if (!strcmp(ast_channel_tech(qe->chan)->type, "DAHDI")) {
 			ast_channel_setoption(qe->chan, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0);
-		if (!strcmp(ast_channel_tech(peer)->type, "DAHDI"))
+		}
+		if (!strcmp(ast_channel_tech(peer)->type, "DAHDI")) {
 			ast_channel_setoption(peer, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0);
+		}
 		/* Update parameters for the queue */
 		time(&now);
 		recalc_holdtime(qe, (now - qe->start));
@@ -5006,8 +5026,9 @@
 
 		/* Play announcement to the caller telling it's his turn if defined */
 		if (!ast_strlen_zero(qe->parent->sound_callerannounce)) {
-			if (play_file(qe->chan, qe->parent->sound_callerannounce, ringing, qe->moh))
+			if (play_file(qe->chan, qe->parent->sound_callerannounce, ringing, qe->moh)) {
 				ast_log(LOG_WARNING, "Announcement file '%s' is unavailable, continuing anyway...\n", qe->parent->sound_callerannounce);
+			}
 		}
 
 		ao2_lock(qe->parent);
@@ -5054,9 +5075,9 @@
 				if ((monexec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC")) || pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS")) {
 					which = qe->chan;
 					monexec = monexec ? ast_strdupa(monexec) : NULL;
+				} else {
+					which = peer;
 				}
-				else
-					which = peer;
 				ast_channel_unlock(qe->chan);
 				if (monitorfilename) {
 					ast_monitor_start(which, qe->parent->monfmt, monitorfilename, 1, X_REC_IN | X_REC_OUT);
@@ -5129,21 +5150,24 @@
 							default:
 								*p = *m;
 							}
-							if (*m == '\0')
+							if (*m == '\0') {
 								break;
+							}
 						}
-						if (p == meid2 + sizeof(meid2))
+						if (p == meid2 + sizeof(meid2)) {
 							meid2[sizeof(meid2) - 1] = '\0';
+						}
 
 						pbx_substitute_variables_helper(qe->chan, meid2, meid, sizeof(meid) - 1);
 					}
 	
 					snprintf(tmpid2, sizeof(tmpid2), "%s.%s", tmpid, qe->parent->monfmt);
 
-					if (!ast_strlen_zero(monitor_exec))
+					if (!ast_strlen_zero(monitor_exec)) {
 						snprintf(mixmonargs, sizeof(mixmonargs), "%s,b%s,%s", tmpid2, monitor_options, monitor_exec);
-					else
+					} else {
 						snprintf(mixmonargs, sizeof(mixmonargs), "%s,b%s", tmpid2, monitor_options);
+					}
 					
 					ast_debug(1, "Arguments being passed to MixMonitor: %s\n", mixmonargs);
 					/* We purposely lock the CDR so that pbx_exec does not update the application data */
@@ -5169,10 +5193,11 @@
 		/* run a macro for this connection if defined. The macro simply returns, no action is taken on the result */
 		/* use macro from dialplan if passed as a option, otherwise use the default queue macro */
 		if (!ast_strlen_zero(macro)) {
-				macroexec = ast_strdupa(macro);
+			macroexec = ast_strdupa(macro);
 		} else {
-			if (qe->parent->membermacro)
+			if (qe->parent->membermacro) {
 				macroexec = ast_strdupa(qe->parent->membermacro);
+			}
 		}
 
 		if (!ast_strlen_zero(macroexec)) {
@@ -5183,10 +5208,11 @@
 		/* run a gosub for this connection if defined. The gosub simply returns, no action is taken on the result */
 		/* use gosub from dialplan if passed as a option, otherwise use the default queue gosub */
 		if (!ast_strlen_zero(gosub)) {
-				gosubexec = ast_strdupa(gosub);
+			gosubexec = ast_strdupa(gosub);
 		} else {
-			if (qe->parent->membergosub)
+			if (qe->parent->membergosub) {
 				gosubexec = ast_strdupa(qe->parent->membergosub);
+			}
 		}
 
 		if (!ast_strlen_zero(gosubexec)) {
@@ -5233,8 +5259,9 @@
 			if (application) {
 				agiexec = ast_strdupa(agi);
 				pbx_exec(qe->chan, application, agiexec);
-			} else
+			} else {
 				ast_log(LOG_WARNING, "Asked to execute an AGI on this channel, but could not find application (agi)!\n");
+			}
 		}
 		qe->handled++;
 		ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "CONNECT", "%ld|%s|%ld", (long) time(NULL) - qe->start, ast_channel_uniqueid(peer),
@@ -5376,8 +5403,9 @@
 	int res;
 
 	res = ast_waitfordigit(qe->chan, retrywait);
-	if (res > 0 && !valid_exit(qe, res))
+	if (res > 0 && !valid_exit(qe, res)) {
 		res = 0;
+	}
 
 	return res;
 }
@@ -5418,8 +5446,9 @@
 
 	memset(value, 0, sizeof(value));
 
-	if (!pm_queue)
+	if (!pm_queue) {
 		return;
+	}
 
 	mem_iter = ao2_iterator_init(pm_queue->members, 0);
 	while ((cur_member = ao2_iterator_next(&mem_iter))) {
@@ -5443,10 +5472,11 @@
 	
 	if (value_len && !cur_member) {
 		if (ast_db_put(pm_family, pm_queue->name, value))
-			ast_log(LOG_WARNING, "failed to create persistent dynamic entry!\n");
-	} else
+		ast_log(LOG_WARNING, "failed to create persistent dynamic entry!\n");
+	} else {
 		/* Delete the entry if the queue is empty or there is an error */
 		ast_db_del(pm_family, pm_queue->name);
+	}
 }
 
 /*! \brief Remove member from queue 
@@ -5485,8 +5515,9 @@
 			ao2_unlink(q->members, mem);
 			ao2_ref(mem, -1);
 
-			if (queue_persistent_members)
+			if (queue_persistent_members) {
 				dump_queue_members(q);
+			}
 			
 			res = RES_OKAY;
 		} else {
@@ -5597,8 +5628,9 @@
 				found++;
 				mem->paused = paused;
 
-				if (queue_persistent_members)
+				if (queue_persistent_members) {
 					dump_queue_members(q);
+				}
 
 				ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", S_OR(reason, ""));
 
@@ -5818,8 +5850,9 @@
 
 		cur_ptr = queue_data;
 		while ((member = strsep(&cur_ptr, ",|"))) {
-			if (ast_strlen_zero(member))
+			if (ast_strlen_zero(member)) {
 				continue;
+			}
 
 			interface = strsep(&member, ";");
 			penalty_tok = strsep(&member, ";");
@@ -5961,8 +5994,9 @@
 	if (ast_strlen_zero(args.interface)) {
 		args.interface = ast_strdupa(ast_channel_name(chan));
 		temppos = strrchr(args.interface, '-');
-		if (temppos)
+		if (temppos) {
 			*temppos = '\0';
+		}
 	}
 
 	ast_debug(1, "queue: %s, member: %s\n", args.queuename, args.interface);
@@ -6033,8 +6067,9 @@
 	if (ast_strlen_zero(args.interface)) {
 		args.interface = ast_strdupa(ast_channel_name(chan));
 		temppos = strrchr(args.interface, '-');
-		if (temppos)
+		if (temppos) {
 			*temppos = '\0';
+		}
 	}
 
 	if (!ast_strlen_zero(args.penalty)) {
@@ -6483,10 +6518,11 @@
 	qe.start = time(NULL);
 
 	/* set the expire time based on the supplied timeout; */
-	if (!ast_strlen_zero(args.queuetimeoutstr))
+	if (!ast_strlen_zero(args.queuetimeoutstr)) {
 		qe.expire = qe.start + atoi(args.queuetimeoutstr);
-	else
+	} else {
 		qe.expire = 0;
+	}
 
 	/* Get the priority from the variable ${QUEUE_PRIO} */
 	ast_channel_lock(chan);
@@ -6636,9 +6672,11 @@
 		makeannouncement = 1;
 
 		/* Make a periodic announcement, if enabled */
-		if (qe.parent->periodicannouncefrequency)
-			if ((res = say_periodic_announcement(&qe,ringing)))
+		if (qe.parent->periodicannouncefrequency) {
+			if ((res = say_periodic_announcement(&qe,ringing))) {
 				goto stop;
+			}
+		}
 	
 		/* Leave if we have exceeded our queuetimeout */
 		if (qe.expire && (time(NULL) >= qe.expire)) {
@@ -6695,8 +6733,9 @@
 		update_realtime_members(qe.parent);
 		/* OK, we didn't get anybody; wait for 'retry' seconds; may get a digit to exit with */
 		res = wait_a_bit(&qe);
-		if (res)
+		if (res) {
 			goto stop;
+		}
 
 		/* Since this is a priority queue and
 		 * it is not sure that we are still at the head
@@ -7069,8 +7108,9 @@
 		 */
 		count = 0;
 		ast_variables_destroy(var);
-	} else
+	} else {
 		ast_log(LOG_WARNING, "queue %s was not found\n", data);
+	}
 
 	snprintf(buf, len, "%d", count);
 
@@ -7152,8 +7192,9 @@
 
 	penalty = get_member_penalty (args.queuename, args.interface);
 	
-	if (penalty >= 0) /* remember that buf is already '\0' */
+	if (penalty >= 0) { /* remember that buf is already '\0' */
 		snprintf (buf, len, "%d", penalty);
+	}
 
 	return 0;
 }
@@ -7510,8 +7551,7 @@
 	 */
 	if (!q->weight && prev_weight) {
 		ast_atomic_fetchadd_int(&use_weight, -1);
-	}
-	else if (q->weight && !prev_weight) {
+	} else if (q->weight && !prev_weight) {
 		ast_atomic_fetchadd_int(&use_weight, +1);
 	}
 
@@ -7671,10 +7711,11 @@
 /*! \brief direct ouput to manager or cli with proper terminator */
 static void do_print(struct mansession *s, int fd, const char *str)
 {
-	if (s)
+	if (s) {
 		astman_append(s, "%s\r\n", str);
-	else
+	} else {
 		ast_cli(fd, "%s\n", str);
+	}
 }
 
 /*! 
@@ -7745,13 +7786,15 @@
 		found = 1;
 
 		ast_str_set(&out, 0, "%s has %d calls (max ", q->name, q->count);
-		if (q->maxlen)
+		if (q->maxlen) {
 			ast_str_append(&out, 0, "%d", q->maxlen);
-		else
+		} else {
 			ast_str_append(&out, 0, "unlimited");
+		}
 		sl = 0;
-		if (q->callscompleted > 0)
+		if (q->callscompleted > 0) {
 			sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
+		}
 		ast_str_append(&out, 0, ") in '%s' strategy (%ds holdtime, %ds talktime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds",
 			int2strat(q->strategy), q->holdtime, q->talktime, q->weight,
 			q->callscompleted, q->callsabandoned,sl,q->servicelevel);
@@ -7846,8 +7889,9 @@
 
 static char *complete_queue_show(const char *line, const char *word, int pos, int state)
 {
-	if (pos == 2)
+	if (pos == 2) {
 		return complete_queue(line, word, pos, state);
+	}
 	return NULL;
 }
 
@@ -7899,8 +7943,9 @@
 			AST_LIST_TRAVERSE(&rl_iter->rules, pr_iter, list) {
 				astman_append(s, "Rule: %d,%s%d,%s%d\r\n", pr_iter->time, pr_iter->max_relative && pr_iter->max_value >= 0 ? "+" : "", pr_iter->max_value, pr_iter->min_relative && pr_iter->min_value >= 0 ? "+" : "", pr_iter->min_value );
 			}
-			if (!ast_strlen_zero(rule))
+			if (!ast_strlen_zero(rule)) {
 				break;
+			}
 		}
 	}
 	AST_LIST_UNLOCK(&rule_lists);
@@ -7933,8 +7978,9 @@
 
 	astman_send_ack(s, m, "Queue summary will follow");
 	time(&now);
-	if (!ast_strlen_zero(id))
+	if (!ast_strlen_zero(id)) {
 		snprintf(idText, 256, "ActionID: %s\r\n", id);
+	}
 	queue_iter = ao2_iterator_init(queues, 0);
 	while ((q = ao2_t_iterator_next(&queue_iter, "Iterate through queues"))) {
 		ao2_lock(q);
@@ -8007,8 +8053,9 @@
 
 	astman_send_ack(s, m, "Queue status will follow");
 	time(&now);
-	if (!ast_strlen_zero(id))
+	if (!ast_strlen_zero(id)) {
 		snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
+	}
 
 	queue_iter = ao2_iterator_init(queues, 0);
 	while ((q = ao2_t_iterator_next(&queue_iter, "Iterate through queues"))) {
@@ -8114,15 +8161,17 @@
 		return 0;
 	}
 
-	if (ast_strlen_zero(penalty_s))
+	if (ast_strlen_zero(penalty_s)) {
 		penalty = 0;
-	else if (sscanf(penalty_s, "%30d", &penalty) != 1 || penalty < 0)
+	} else if (sscanf(penalty_s, "%30d", &penalty) != 1 || penalty < 0) {
 		penalty = 0;
-
-	if (ast_strlen_zero(paused_s))
+	}
+
+	if (ast_strlen_zero(paused_s)) {
 		paused = 0;
-	else
+	} else {
 		paused = abs(ast_true(paused_s));
+	}
 
 	switch (add_to_queue(queuename, interface, membername, penalty, paused, queue_persistent_members, state_interface)) {
 	case RES_OKAY:
@@ -8211,10 +8260,11 @@
 
 	paused = abs(ast_true(paused_s));
 
-	if (set_member_paused(queuename, interface, reason, paused))
+	if (set_member_paused(queuename, interface, reason, paused)) {
 		astman_send_error(s, m, "Interface not found");
-	else
+	} else {
 		astman_send_ack(s, m, paused ? "Interface paused successfully" : "Interface unpaused successfully");
+	}
 	return 0;
 }
 
@@ -8334,10 +8384,11 @@
  
 	penalty = atoi(penalty_s);
 
-	if (set_member_penalty((char *)queuename, (char *)interface, penalty))
+	if (set_member_penalty((char *)queuename, (char *)interface, penalty)) {
 		astman_send_error(s, m, "Invalid interface, queuename or penalty");
-	else
+	} else {
 		astman_send_ack(s, m, "Interface penalty set successfully");
+	}
 
 	return 0;
 }
@@ -8430,13 +8481,16 @@
 	int wordlen = strlen(word);
 
 	/* 0 - queue; 1 - remove; 2 - member; 3 - <member>; 4 - from; 5 - <queue> */
-	if (pos > 5 || pos < 3)
+	if (pos > 5 || pos < 3) {
 		return NULL;
-	if (pos == 4)   /* only one possible match, 'from' */
+	}
+	if (pos == 4) {   /* only one possible match, 'from' */
 		return (state == 0 ? ast_strdup("from") : NULL);
-
-	if (pos == 5)   /* No need to duplicate code */
+	}
+
+	if (pos == 5) {   /* No need to duplicate code */
 		return complete_queue(line, word, pos, state);
+	}
 
 	/* here is the case for 3, <member> */
 	queue_iter = ao2_iterator_init(queues, 0);
@@ -8575,18 +8629,22 @@
 
 	if (set_member_paused(queuename, interface, reason, paused) == RESULT_SUCCESS) {
 		ast_cli(a->fd, "%spaused interface '%s'", paused ? "" : "un", interface);
-		if (!ast_strlen_zero(queuename))
+		if (!ast_strlen_zero(queuename)) {
 			ast_cli(a->fd, " in queue '%s'", queuename);
-		if (!ast_strlen_zero(reason))
+		}
+		if (!ast_strlen_zero(reason)) {
 			ast_cli(a->fd, " for reason '%s'", reason);
+		}
 		ast_cli(a->fd, "\n");
 		return CLI_SUCCESS;
 	} else {
 		ast_cli(a->fd, "Unable to %spause interface '%s'", paused ? "" : "un", interface);
-		if (!ast_strlen_zero(queuename))
+		if (!ast_strlen_zero(queuename)) {
 			ast_cli(a->fd, " in queue '%s'", queuename);
-		if (!ast_strlen_zero(reason))
+		}
+		if (!ast_strlen_zero(reason)) {
 			ast_cli(a->fd, " for reason '%s'", reason);
+		}
 		ast_cli(a->fd, "\n");
 		return CLI_FAILURE;
 	}
@@ -8638,8 +8696,9 @@
 		return CLI_SHOWUSAGE;
 	}
 
-	if (a->argc == 8)
+	if (a->argc == 8) {
 		queuename = a->argv[7];
+	}
 	interface = a->argv[5];
 	penalty = atoi(a->argv[3]);
 
@@ -8694,8 +8753,9 @@
 		return complete_queue_rule_show(a->line, a->word, a->pos, a->n);
 	}
 
-	if (a->argc != 3 && a->argc != 4)
+	if (a->argc != 3 && a->argc != 4) {
 		return CLI_SHOWUSAGE;
+	}
 
 	rule = a->argc == 4 ? a->argv[3] : "";
 	AST_LIST_LOCK(&rule_lists);

Modified: team/oej/pinequeue-trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/channels/chan_sip.c?view=diff&rev=364016&r1=364015&r2=364016
==============================================================================
--- team/oej/pinequeue-trunk/channels/chan_sip.c (original)
+++ team/oej/pinequeue-trunk/channels/chan_sip.c Thu Apr 26 09:34:16 2012
@@ -5893,8 +5893,12 @@
 	}
 	if (p->udptl)
 		ast_udptl_destroy(p->udptl);
-	if (p->refer)
+	if (p->refer) {
+		if (p->refer->refer_call) {
+			p->refer->refer_call = dialog_unref(p->refer->refer_call, "unref dialog p->refer->refer_call");
+		}
 		ast_free(p->refer);
+	}
 	if (p->route) {
 		free_old_route(p->route);
 		p->route = NULL;
@@ -23310,6 +23314,7 @@
 				if (subscription->owner) {
 					ast_channel_unlock(subscription->owner);
 				}
+				subscription = dialog_unref(subscription, "unref dialog subscription");
 			}
 		}
 
@@ -23328,7 +23333,6 @@
 
 		if (p->refer->refer_call == p) {
 			ast_log(LOG_NOTICE, "INVITE with replaces into it's own call id (%s == %s)!\n", replace_id, p->callid);
-			p->refer->refer_call = dialog_unref(p->refer->refer_call, "unref dialog p->refer->refer_call");
 			transmit_response_reliable(p, "400 Bad request", req);	/* The best way to not not accept the transfer */
 			error = 1;
 		}
@@ -23356,6 +23360,7 @@
 				if (p->refer->refer_call->owner) {
 					ast_channel_unlock(p->refer->refer_call->owner);
 				}
+				p->refer->refer_call = dialog_unref(p->refer->refer_call, "unref dialog p->refer->refer_call");
 			}
 			refer_locked = 0;
 			p->invitestate = INV_COMPLETED;




More information about the svn-commits mailing list