[asterisk-commits] rmudgett: branch group/issue14068 r210188 - in /team/group/issue14068: ./ cha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 3 15:06:23 CDT 2009


Author: rmudgett
Date: Mon Aug  3 15:06:20 2009
New Revision: 210188

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=210188
Log:
Merged revisions 210154 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r210154 | rmudgett | 2009-08-03 13:05:46 -0500 (Mon, 03 Aug 2009) | 11 lines
  
  Changes from chan_dahdi that did not make it into sig_pri.
  
  *  Moved SUPPORT_USERUSER to sig_pri.c
  *  Fix PRI_DEADLOCK_AVOIDANCE parameter.
  *  Whitespace changes.
  *  Added missing unlock in pri_dchannel():PRI_EVENT_RING case.
  *  Balanced curly braces.
  *  ast_debug/ast_log changes from chan_dahdi.
  *  sig_pri_indicate() should default to return -1 if the indication is not
  handled.
........

Modified:
    team/group/issue14068/   (props changed)
    team/group/issue14068/channels/chan_dahdi.c
    team/group/issue14068/channels/sig_pri.c

Propchange: team/group/issue14068/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/issue14068/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Aug  3 15:06:20 2009
@@ -1,1 +1,1 @@
-/trunk:1-210149
+/trunk:1-210187

Modified: team/group/issue14068/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/issue14068/channels/chan_dahdi.c?view=diff&rev=210188&r1=210187&r2=210188
==============================================================================
--- team/group/issue14068/channels/chan_dahdi.c (original)
+++ team/group/issue14068/channels/chan_dahdi.c Mon Aug  3 15:06:20 2009
@@ -1993,7 +1993,7 @@
 {
 	int res;
 	struct dahdi_pvt *p = pvt;
-	
+
 	res = get_alarms(p);
 	handle_alarms(p, res);
 }
@@ -2066,7 +2066,7 @@
 
 	law = DAHDI_LAW_DEFAULT;
 	res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETLAW, &law);
-	if (res < 0) 
+	if (res < 0)
 		ast_log(LOG_WARNING, "Unable to set law on channel %d to default: %s\n", p->channel, strerror(errno));
 
 	dahdi_setlinear(p->subs[SUB_REAL].dfd, 0);
@@ -2553,7 +2553,7 @@
 	if (x) {
 		ast_log(LOG_NOTICE, "PRI got event: %s (%d) on D-channel of span %d\n", event2str(x), x, pri->span);
 	}
-	/* Keep track of alarm state */	
+	/* Keep track of alarm state */
 	if (x == DAHDI_EVENT_ALARM) {
 		pri_event_alarm(pri, index, 0);
 	} else if (x == DAHDI_EVENT_NOALARM) {
@@ -4298,7 +4298,7 @@
 	p->outgoing = 1;
 
 	set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->law);
-	
+
 #ifdef HAVE_PRI
 	if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) {
 		struct dahdi_params ps;
@@ -5202,7 +5202,7 @@
 	if (p->cidspill)
 		ast_free(p->cidspill);
 	p->cidspill = NULL;
-	
+
 	ast_mutex_unlock(&p->lock);
 	ast_module_unref(ast_module_info->self);
 	ast_verb(3, "Hungup '%s'\n", ast->name);
@@ -5613,7 +5613,7 @@
 {
 	int res;
 	char policy_str[21] = "";
-	
+
 	if ((res = sscanf(parse, "%d,%20s", num_buffers, policy_str)) != 2) {
 		ast_log(LOG_WARNING, "Parsing buffer string '%s' failed.\n", parse);
 		return 1;
@@ -5642,7 +5642,7 @@
 {
 	struct dahdi_pvt *p = chan->tech_pvt;
 	int res = 0;
-	
+
 	if (!strcasecmp(data, "buffers")) {
 		int num_bufs, policy;
 
@@ -5667,11 +5667,11 @@
 		if (!strcasecmp(value, "on")) {
 			ast_mutex_lock(&p->lock);
 			dahdi_enable_ec(p);
-			ast_mutex_unlock(&p->lock);	
+			ast_mutex_unlock(&p->lock);
 		} else if (!strcasecmp(value, "off")) {
 			ast_mutex_lock(&p->lock);
 			dahdi_disable_ec(p);
-			ast_mutex_unlock(&p->lock);	
+			ast_mutex_unlock(&p->lock);
 #ifdef HAVE_DAHDI_ECHOCANCEL_FAX_MODE
 		} else if (!strcasecmp(value, "fax")) {
 			int blah = 1;
@@ -5683,7 +5683,7 @@
 			if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_FAX_MODE, &blah)) {
 				ast_log(LOG_WARNING, "Unable to place echocan into fax mode on channel %d: %s\n", p->channel, strerror(errno));
 			}
-			ast_mutex_unlock(&p->lock);	
+			ast_mutex_unlock(&p->lock);
 		} else if (!strcasecmp(value, "voice")) {
 			int blah = 0;
 
@@ -5694,7 +5694,7 @@
 			if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_FAX_MODE, &blah)) {
 				ast_log(LOG_WARNING, "Unable to place echocan into voice mode on channel %d: %s\n", p->channel, strerror(errno));
 			}
-			ast_mutex_unlock(&p->lock);	
+			ast_mutex_unlock(&p->lock);
 #endif
 		} else {
 			ast_log(LOG_WARNING, "Unsupported value '%s' provided for '%s' item.\n", value, data);
@@ -7286,7 +7286,7 @@
 		return f;
 	}
 	f = dahdi_handle_event(ast);
- 
+
 	/* tell the cdr this zap device hung up */
 	if (f == NULL) {
 		ast_set_hangupsource(ast, ast->name, 0);
@@ -7659,7 +7659,7 @@
 	if (f && (f->frametype == AST_FRAME_DTMF)) {
 		if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
 			analog_handle_dtmfup(p->sig_pvt, ast, idx, &f);
-		} else 
+		} else
 			dahdi_handle_dtmfup(ast, idx, &f);
 	}
 
@@ -10924,7 +10924,7 @@
 		tmp->mwisend_fsk  = conf->chan.mwisend_fsk;
 		tmp->mwisend_rpas = conf->chan.mwisend_rpas;
 #endif
-		
+
 		tmp->group = conf->chan.group;
 		tmp->callgroup = conf->chan.callgroup;
 		tmp->pickupgroup= conf->chan.pickupgroup;
@@ -11044,7 +11044,7 @@
 
 				analog_config_complete(analog_p);
 			}
-		} 
+		}
 #ifdef HAVE_PRI
 		else if (pchan != NULL) {
 			pchan->channel = tmp->channel;
@@ -11334,7 +11334,7 @@
 			else if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) {
 				tmp = sig_pri_request(p->sig_pvt, SIG_PRI_DEFLAW, requestor);
 			}
-#endif   
+#endif
 			else {
 				tmp = dahdi_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0, requestor ? requestor->linkedid : "");
 			}
@@ -12610,7 +12610,7 @@
 	struct dahdi_pvt *start, *tmp = NULL;
 	struct dahdi_pri *pri = NULL;
 	ast_mutex_t *lock;
-	
+
 	lock = &iflock;
 	start = iflist;
 
@@ -12635,7 +12635,7 @@
 		}
 	} else
 		channel = atoi(a->argv[4]);
-	
+
 	if (a->argc == 6)
 		interfaceid = atoi(a->argv[5]);
 
@@ -12706,15 +12706,15 @@
 static char *handle_pri_service_enable_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
-	case CLI_INIT:	
+	case CLI_INIT:
 		e->command = "pri service enable channel";
-		e->usage = 
+		e->usage =
 			"Usage: pri service enable channel <channel> [<interface id>]\n"
 			"       Send an AT&T / NFAS / CCS ANSI T1.607 maintenance message\n"
 			"	to restore a channel to service, with optional interface id\n"
 			"	as agreed upon with remote switch operator\n";
 		return NULL;
-	case CLI_GENERATE:	
+	case CLI_GENERATE:
 		return NULL;
 	}
 	return handle_pri_service_generic(e, cmd, a, 0);
@@ -12723,15 +12723,15 @@
 static char *handle_pri_service_disable_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
-	case CLI_INIT:	
+	case CLI_INIT:
 		e->command = "pri service disable channel";
-		e->usage = 
+		e->usage =
 			"Usage: pri service disable channel <chan num> [<interface id>]\n"
 			"	Send an AT&T / NFAS / CCS ANSI T1.607 maintenance message\n"
 			"	to remove a channel from service, with optional interface id\n"
 			"	as agreed upon with remote switch operator\n";
 		return NULL;
-	case CLI_GENERATE:	
+	case CLI_GENERATE:
 		return NULL;
 	}
 	return handle_pri_service_generic(e, cmd, a, 2);

Modified: team/group/issue14068/channels/sig_pri.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/issue14068/channels/sig_pri.c?view=diff&rev=210188&r1=210187&r2=210188
==============================================================================
--- team/group/issue14068/channels/sig_pri.c (original)
+++ team/group/issue14068/channels/sig_pri.c Mon Aug  3 15:06:20 2009
@@ -587,7 +587,7 @@
 				struct sig_pri_chan *new = pri->pvts[principle], *old = pri->pvts[x];
 
 				ast_verb(3, "Moving call from channel %d to channel %d\n",
-						old->channel, new->channel);
+					old->channel, new->channel);
 				if (new->owner) {
 					ast_log(LOG_WARNING, "Can't fix up channel from %d to %d because %d is already in use\n",
 						old->channel, new->channel, new->channel);
@@ -782,9 +782,10 @@
 	int len;
 	int timeout;
 
-	/* in the bizarre case where the channel has become a zombie before we
-	   even get started here, abort safely
-	*/
+	/*
+	 * In the bizarre case where the channel has become a zombie before we
+	 * even get started here, abort safely.
+	 */
 	if (!p) {
 		ast_log(LOG_WARNING, "Channel became a zombie before simple switch could be started (%s)\n", chan->name);
 		ast_hangup(chan);
@@ -1125,7 +1126,7 @@
 			activeidles = 0;
 			for (x = pri->numchans; x >= 0; x--) {
 				if (pri->pvts[x] && !pri->pvts[x]->owner &&
-				    !pri->pvts[x]->call) {
+					!pri->pvts[x]->call) {
 					if (haveidles < pri->minunused) {
 						haveidles++;
 					} else if (!pri->pvts[x]->resetting) {
@@ -1151,7 +1152,7 @@
 					gettimeofday(&lastidle, NULL);
 				}
 			} else if ((haveidles < pri->minunused) &&
-				   (activeidles > pri->minidle)) {
+				(activeidles > pri->minidle)) {
 				/* Mark something for hangup if there is something
 				   that can be hungup */
 				for (x = pri->numchans; x >= 0; x--) {
@@ -1162,7 +1163,7 @@
 						/* Stop if we have enough idle channels or
 						  can't spare any more active idle ones */
 						if ((haveidles >= pri->minunused) ||
-						    (activeidles <= pri->minidle))
+							(activeidles <= pri->minidle))
 							break;
 					}
 				}
@@ -1241,12 +1242,12 @@
 
 			if (e->e != PRI_EVENT_DCHAN_DOWN) {
 				if (!(pri->dchanavail[which] & DCHAN_UP)) {
-						ast_verb(2, "%s D-Channel on span %d up\n", pri_order(which), pri->span);
+					ast_verb(2, "%s D-Channel on span %d up\n", pri_order(which), pri->span);
 				}
 				pri->dchanavail[which] |= DCHAN_UP;
 			} else {
 				if (pri->dchanavail[which] & DCHAN_UP) {
-						ast_verb(2, "%s D-Channel on span %d down\n", pri_order(which), pri->span);
+					ast_verb(2, "%s D-Channel on span %d down\n", pri_order(which), pri->span);
 				}
 				pri->dchanavail[which] &= ~DCHAN_UP;
 			}
@@ -1332,7 +1333,7 @@
 						if (!skipit) {
 #endif
 							ast_verb(3, "B-channel %d/%d restarted on span %d\n",
-									PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span);
+								PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span);
 							sig_pri_lock_private(pri->pvts[chanpos]);
 							if (pri->pvts[chanpos]->call) {
 								pri_destroycall(pri->pri, pri->pvts[chanpos]->call);
@@ -1704,8 +1705,8 @@
 							}
 							if (c && !ast_pbx_start(c)) {
 								ast_verb(3, "Accepting call from '%s' to '%s' on channel %d/%d, span %d\n",
-										plancallingnum, pri->pvts[chanpos]->exten,
-											pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
+									plancallingnum, pri->pvts[chanpos]->exten,
+									pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
 								sig_pri_set_echocanceller(pri->pvts[chanpos], 1);
 							} else {
 								ast_log(LOG_WARNING, "Unable to start PBX on channel %d/%d, span %d\n",
@@ -1720,8 +1721,8 @@
 						}
 					} else {
 						ast_verb(3, "Extension '%s' in context '%s' from '%s' does not exist.  Rejecting call on channel %d/%d, span %d\n",
-								pri->pvts[chanpos]->exten, pri->pvts[chanpos]->context, pri->pvts[chanpos]->cid_num, pri->pvts[chanpos]->logicalspan,
-									pri->pvts[chanpos]->prioffset, pri->span);
+							pri->pvts[chanpos]->exten, pri->pvts[chanpos]->context, pri->pvts[chanpos]->cid_num, pri->pvts[chanpos]->logicalspan,
+							pri->pvts[chanpos]->prioffset, pri->span);
 						pri_hangup(pri->pri, e->ring.call, PRI_CAUSE_UNALLOCATED);
 						pri->pvts[chanpos]->call = NULL;
 						pri->pvts[chanpos]->exten[0] = '\0';
@@ -1752,12 +1753,6 @@
 						sig_pri_set_echocanceller(pri->pvts[chanpos], 1);
 						pri_queue_control(pri->pvts[chanpos], AST_CONTROL_RINGING, pri);
 						pri->pvts[chanpos]->alerting = 1;
-#ifdef PRI_PROGRESS_MASK
-						if (e->ringing.progressmask & PRI_PROG_INBAND_AVAILABLE) {
-#else
-						if (e->ringing.progress == 8) {
-#endif
-						}
 
 #ifdef SUPPORT_USERUSER
 						if (!ast_strlen_zero(e->ringing.useruserinfo)) {
@@ -1784,11 +1779,13 @@
 					sig_pri_lock_private(pri->pvts[chanpos]);
 					sig_pri_handle_subcmds(pri, chanpos, e->e, e->proceeding.channel,
 						e->proceeding.subcmds);
+					if ((!pri->pvts[chanpos]->progress)
 #ifdef PRI_PROGRESS_MASK
-					if ((!pri->pvts[chanpos]->progress) || (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE)) {
+						|| (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE)
 #else
-					if ((!pri->pvts[chanpos]->progress) || (e->proceeding.progress == 8)) {
-#endif
+						|| (e->proceeding.progress == 8)
+#endif
+						) {
 						struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, };
 
 						if (e->proceeding.cause > -1) {
@@ -1805,14 +1802,16 @@
 							}
 						}
 
-						ast_log(LOG_DEBUG, "Queuing frame from PRI_EVENT_PROGRESS on channel %d/%d span %d\n",
-								pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
+						ast_debug(1, "Queuing frame from PRI_EVENT_PROGRESS on channel %d/%d span %d\n",
+							pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
 						pri_queue_frame(pri->pvts[chanpos], &f, pri);
+						if (
 #ifdef PRI_PROGRESS_MASK
-						if (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) {
+							e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE
 #else
-						if (e->proceeding.progress == 8) {
-#endif
+							e->proceeding.progress == 8
+#endif
+							) {
 							/* Bring voice path up */
 							f.subclass = AST_CONTROL_PROGRESS;
 							pri_queue_frame(pri->pvts[chanpos], &f, pri);
@@ -1832,14 +1831,16 @@
 					if (!pri->pvts[chanpos]->proceeding) {
 						struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROCEEDING, };
 
-						ast_log(LOG_DEBUG, "Queuing frame from PRI_EVENT_PROCEEDING on channel %d/%d span %d\n",
-								pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
+						ast_debug(1, "Queuing frame from PRI_EVENT_PROCEEDING on channel %d/%d span %d\n",
+							pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
 						pri_queue_frame(pri->pvts[chanpos], &f, pri);
+						if (
 #ifdef PRI_PROGRESS_MASK
-						if (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) {
+							e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE
 #else
-						if (e->proceeding.progress == 8) {
-#endif
+							e->proceeding.progress == 8
+#endif
+							) {
 							/* Bring voice path up */
 							f.subclass = AST_CONTROL_PROGRESS;
 							pri_queue_frame(pri->pvts[chanpos], &f, pri);
@@ -2101,8 +2102,8 @@
 						if (pri->pvts[x] && pri->pvts[x]->resetting) {
 							chanpos = x;
 							sig_pri_lock_private(pri->pvts[chanpos]);
-							ast_log(LOG_DEBUG, "Assuming restart ack is really for channel %d/%d span %d\n", pri->pvts[chanpos]->logicalspan,
-									pri->pvts[chanpos]->prioffset, pri->span);
+							ast_debug(1, "Assuming restart ack is really for channel %d/%d span %d\n", pri->pvts[chanpos]->logicalspan,
+								pri->pvts[chanpos]->prioffset, pri->span);
 							if (pri->pvts[chanpos]->owner) {
 								ast_log(LOG_WARNING, "Got restart ack on channel %d/%d with owner on span %d\n", pri->pvts[chanpos]->logicalspan,
 									pri->pvts[chanpos]->prioffset, pri->span);
@@ -2110,7 +2111,7 @@
 							}
 							pri->pvts[chanpos]->resetting = 0;
 							ast_verb(3, "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan,
-									pri->pvts[chanpos]->prioffset, pri->span);
+								pri->pvts[chanpos]->prioffset, pri->span);
 							sig_pri_unlock_private(pri->pvts[chanpos]);
 							if (pri->resetting)
 								pri_check_restart(pri);
@@ -2131,7 +2132,7 @@
 						}
 						pri->pvts[chanpos]->resetting = 0;
 						ast_verb(3, "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan,
-									pri->pvts[chanpos]->prioffset, pri->span);
+							pri->pvts[chanpos]->prioffset, pri->span);
 						sig_pri_unlock_private(pri->pvts[chanpos]);
 						if (pri->resetting)
 							pri_check_restart(pri);
@@ -2152,7 +2153,7 @@
 						pri->pvts[chanpos]->setup_ack = 1;
 						/* Send any queued digits */
 						for (x = 0;x < strlen(pri->pvts[chanpos]->dialdest); x++) {
-							ast_log(LOG_DEBUG, "Sending pending digit '%c'\n", pri->pvts[chanpos]->dialdest[x]);
+							ast_debug(1, "Sending pending digit '%c'\n", pri->pvts[chanpos]->dialdest[x]);
 							pri_information(pri->pri, pri->pvts[chanpos]->call,
 								pri->pvts[chanpos]->dialdest[x]);
 						}
@@ -2186,7 +2187,7 @@
 				}
 				break;
 			default:
-				ast_log(LOG_DEBUG, "Event: %d\n", e->e);
+				ast_debug(1, "Event: %d\n", e->e);
 			}
 		}
 		ast_mutex_unlock(&pri->lock);
@@ -2357,7 +2358,7 @@
 
 	pri_sr_set_channel(sr, PVT_TO_CHANNEL(p), exclusive, 1);
 	pri_sr_set_bearer(sr, p->digital ? PRI_TRANS_CAP_DIGITAL : ast->transfercapability,
-				(p->digital ? -1 : layer1));
+		(p->digital ? -1 : layer1));
 
 	if (p->pri->facilityenable)
 		pri_facility_enable(p->pri->pri);
@@ -2787,10 +2788,11 @@
 		default:
 			pri->dchans[i] = pri_new(pri->fds[i], pri->nodetype, pri->switchtype);
 #ifdef HAVE_PRI_SERVICE_MESSAGES
-				if (pri->enable_service_message_support) {
-					pri_set_service_message_support(pri->dchans[i], 1);
-				}
-#endif
+			if (pri->enable_service_message_support) {
+				pri_set_service_message_support(pri->dchans[i], 1);
+			}
+#endif
+			break;
 		}
 
 		/* Force overlap dial if we're doing GR-303! */




More information about the asterisk-commits mailing list