[asterisk-commits] rmudgett: branch rmudgett/bch_shift_v1.8 r311556 - /team/rmudgett/bch_shift_v...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 22 17:52:20 CDT 2011


Author: rmudgett
Date: Tue Mar 22 17:52:16 2011
New Revision: 311556

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311556
Log:
Mostly restart message format changes.

Modified:
    team/rmudgett/bch_shift_v1.8/channels/sig_pri.c

Modified: team/rmudgett/bch_shift_v1.8/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bch_shift_v1.8/channels/sig_pri.c?view=diff&rev=311556&r1=311555&r2=311556
==============================================================================
--- team/rmudgett/bch_shift_v1.8/channels/sig_pri.c (original)
+++ team/rmudgett/bch_shift_v1.8/channels/sig_pri.c Tue Mar 22 17:52:16 2011
@@ -4708,11 +4708,13 @@
 				}
 				break;
 			case PRI_EVENT_RESTART:
-				if (e->restart.channel > -1) {
+				if (e->restart.channel > -1 && PRI_CHANNEL(e->ring.channel) != 0xFF) {
 					chanpos = pri_find_principle(pri, e->restart.channel, NULL);
 					if (chanpos < 0)
-						ast_log(LOG_WARNING, "Restart requested on odd/unavailable channel number %d/%d on span %d\n",
-							PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span);
+						ast_log(LOG_WARNING,
+							"Span %d: Restart requested on odd/unavailable channel number %d/%d\n",
+							pri->span, PRI_SPAN(e->restart.channel),
+							PRI_CHANNEL(e->restart.channel));
 					else {
 						int skipit = 0;
 #if defined(HAVE_PRI_SERVICE_MESSAGES)
@@ -4721,16 +4723,18 @@
 						why = pri->pvts[chanpos]->service_status;
 						if (why) {
 							ast_log(LOG_NOTICE,
-								"span '%d' channel '%d' out-of-service (reason: %s), ignoring RESTART\n",
-								pri->span, PRI_CHANNEL(e->restart.channel),
+								"Span %d: Channel %d/%d out-of-service (reason: %s), ignoring RESTART\n",
+								pri->span, PRI_SPAN(e->restart.channel),
+								PRI_CHANNEL(e->restart.channel),
 								(why & SRVST_FAREND) ? (why & SRVST_NEAREND) ? "both ends" : "far end" : "near end");
 							skipit = 1;
 						}
 #endif	/* defined(HAVE_PRI_SERVICE_MESSAGES) */
 						sig_pri_lock_private(pri->pvts[chanpos]);
 						if (!skipit) {
-							ast_verb(3, "B-channel %d/%d restarted on span %d\n",
-								PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span);
+							ast_verb(3, "Span %d: Channel %d/%d restarted\n", pri->span,
+								PRI_SPAN(e->restart.channel),
+								PRI_CHANNEL(e->restart.channel));
 							if (pri->pvts[chanpos]->call) {
 								pri_destroycall(pri->pri, pri->pvts[chanpos]->call);
 								pri->pvts[chanpos]->call = NULL;
@@ -5710,11 +5714,19 @@
 					pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause);
 					pri->pvts[chanpos]->call = NULL;
 				}
-				if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL) {
-					ast_verb(3, "Forcing restart of channel %d/%d on span %d since channel reported in use\n",
-						PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
+				if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL
+					&& pri->sig != SIG_BRI_PTMP && !pri->resetting
+					&& !pri->pvts[chanpos]->resetting) {
+					ast_verb(3,
+						"Span %d: Forcing restart of channel %d/%d since channel reported in use\n",
+						pri->span, PRI_SPAN(e->hangup.channel),
+						PRI_CHANNEL(e->hangup.channel));
+					pri->pvts[chanpos]->resetting = 1;
 					pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[chanpos]));
-					pri->pvts[chanpos]->resetting = 1;
+					if (pri->pvts[chanpos]->call) {
+						pri_destroycall(pri->pri, pri->pvts[chanpos]->call);
+						pri->pvts[chanpos]->call = NULL;
+					}
 				}
 				if (e->hangup.aoc_units > -1)
 					ast_verb(3, "Channel %d/%d, span %d received AOC-E charging %d unit%s\n",
@@ -5841,11 +5853,19 @@
 					pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause);
 					pri->pvts[chanpos]->call = NULL;
 				}
-				if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL) {
-					ast_verb(3, "Forcing restart of channel %d/%d span %d since channel reported in use\n",
-						PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
+				if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL
+					&& pri->sig != SIG_BRI_PTMP && !pri->resetting
+					&& !pri->pvts[chanpos]->resetting) {
+					ast_verb(3,
+						"Span %d: Forcing restart of channel %d/%d since channel reported in use\n",
+						pri->span, PRI_SPAN(e->hangup.channel),
+						PRI_CHANNEL(e->hangup.channel));
+					pri->pvts[chanpos]->resetting = 1;
 					pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[chanpos]));
-					pri->pvts[chanpos]->resetting = 1;
+					if (pri->pvts[chanpos]->call) {
+						pri_destroycall(pri->pri, pri->pvts[chanpos]->call);
+						pri->pvts[chanpos]->call = NULL;
+					}
 				}
 
 #ifdef SUPPORT_USERUSER
@@ -5877,7 +5897,6 @@
 				}
 				sig_pri_lock_private(pri->pvts[chanpos]);
 				pri->pvts[chanpos]->call = NULL;
-				pri->pvts[chanpos]->resetting = 0;
 				if (pri->pvts[chanpos]->owner) {
 					ast_verb(3, "Channel %d/%d, span %d got hangup ACK\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
 				}
@@ -5910,16 +5929,22 @@
 						if (pri->pvts[x] && pri->pvts[x]->resetting) {
 							chanpos = x;
 							sig_pri_lock_private(pri->pvts[chanpos]);
-							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);
+							ast_debug(1,
+								"Span %d: Assuming restart ack is for channel %d/%d\n",
+								pri->span, pri->pvts[chanpos]->logicalspan,
+								pri->pvts[chanpos]->prioffset);
 							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);
+								ast_log(LOG_WARNING,
+									"Span %d: Got restart ack on channel %d/%d with owner\n",
+									pri->span, pri->pvts[chanpos]->logicalspan,
+									pri->pvts[chanpos]->prioffset);
 								pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 							}
 							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);
+							ast_verb(3,
+								"Span %d: Channel %d/%d successfully restarted\n",
+								pri->span, pri->pvts[chanpos]->logicalspan,
+								pri->pvts[chanpos]->prioffset);
 							sig_pri_unlock_private(pri->pvts[chanpos]);
 							if (pri->resetting)
 								pri_check_restart(pri);
@@ -5927,20 +5952,26 @@
 						}
 					}
 					if (chanpos < 0) {
-						ast_log(LOG_WARNING, "Restart ACK requested on strange channel %d/%d span %d\n",
-							PRI_SPAN(e->restartack.channel), PRI_CHANNEL(e->restartack.channel), pri->span);
+						ast_log(LOG_WARNING,
+							"Span %d: Restart ACK on strange channel %d/%d\n",
+							pri->span, PRI_SPAN(e->restartack.channel),
+							PRI_CHANNEL(e->restartack.channel));
 					}
 				} else {
 					if (pri->pvts[chanpos]) {
 						sig_pri_lock_private(pri->pvts[chanpos]);
 						if (pri->pvts[chanpos]->owner) {
-							ast_log(LOG_WARNING, "Got restart ack on channel %d/%d span %d with owner\n",
-								PRI_SPAN(e->restartack.channel), PRI_CHANNEL(e->restartack.channel), pri->span);
+							ast_log(LOG_WARNING,
+								"Span %d: Got restart ack on channel %d/%d with owner\n",
+								pri->span, pri->pvts[chanpos]->logicalspan,
+								pri->pvts[chanpos]->prioffset);
 							pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 						}
 						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);
+						ast_verb(3,
+							"Span %d: Channel %d/%d successfully restarted\n",
+							pri->span, pri->pvts[chanpos]->logicalspan,
+							pri->pvts[chanpos]->prioffset);
 						sig_pri_unlock_private(pri->pvts[chanpos]);
 						if (pri->resetting)
 							pri_check_restart(pri);




More information about the asterisk-commits mailing list