[asterisk-commits] rmudgett: branch rmudgett/bch_shift_v1.4 r311798 - in /team/rmudgett/bch_shif...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 28 18:01:46 CDT 2011


Author: rmudgett
Date: Mon Mar 28 18:01:42 2011
New Revision: 311798

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311798
Log:
Merged revisions 311797 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/rmudgett/bch_shift_v1.6.2

................
  r311797 | rmudgett | 2011-03-28 17:49:20 -0500 (Mon, 28 Mar 2011) | 19 lines
  
  Merged revisions 311747 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/team/rmudgett/bch_shift_v1.8
  
  ........
    r311747 | rmudgett | 2011-03-28 15:38:53 -0500 (Mon, 28 Mar 2011) | 12 lines
    
    RESTART and alarm interaction resulting in resetting flag getting stuck.
    
    If the D channel goes down, any channels getting RESTARTed may get lost
    because the RESTART ACKNOWLEDGEMENT may never arrive.
    
    * Clear resetting flags when the D channel goes up or down.
    
    * Clear the resetting flag when the channel alarm goes up or down.
    
    * Fixed and documented locking assumption with
    sig_pri_chan_alarm_notify().
  ........
................

Modified:
    team/rmudgett/bch_shift_v1.4/   (props changed)
    team/rmudgett/bch_shift_v1.4/channels/chan_dahdi.c

Propchange: team/rmudgett/bch_shift_v1.4/
------------------------------------------------------------------------------
--- bch_shift_v1.6.2-integrated (original)
+++ bch_shift_v1.6.2-integrated Mon Mar 28 18:01:42 2011
@@ -1,1 +1,1 @@
-/team/rmudgett/bch_shift_v1.6.2:1-311742
+/team/rmudgett/bch_shift_v1.6.2:1-311797

Modified: team/rmudgett/bch_shift_v1.4/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bch_shift_v1.4/channels/chan_dahdi.c?view=diff&rev=311798&r1=311797&r2=311798
==============================================================================
--- team/rmudgett/bch_shift_v1.4/channels/chan_dahdi.c (original)
+++ team/rmudgett/bch_shift_v1.4/channels/chan_dahdi.c Mon Mar 28 18:01:42 2011
@@ -4545,23 +4545,27 @@
 				/* T309 is not enabled : destroy calls when alarm occurs */
 				if (p->call) {
 					if (p->pri && p->pri->pri) {
-						if (!pri_grab(p, p->pri)) {
-							pri_destroycall(p->pri->pri, p->call);
-							p->call = NULL;
-							pri_rel(p->pri);
-						} else
-							ast_log(LOG_WARNING, "Failed to grab PRI!\n");
+						pri_grab(p, p->pri);
+						pri_destroycall(p->pri->pri, p->call);
+						p->call = NULL;
+						pri_rel(p->pri);
 					} else
 						ast_log(LOG_WARNING, "The PRI Call has not been destroyed\n");
 				}
 				if (p->owner)
 					p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 			}
-			if (p->bearer)
+			if (p->bearer) {
 				p->bearer->inalarm = 1;
-			else
+				p->bearer->resetting = 0;
+			} else
 #endif
-			p->inalarm = 1;
+			{
+				p->inalarm = 1;
+#if defined(HAVE_PRI)
+				p->resetting = 0;
+#endif	/* defined(HAVE_PRI) */
+			}
 			res = get_alarms(p);
 			handle_alarms(p, res);
 #ifdef HAVE_PRI
@@ -4901,9 +4905,12 @@
 		case DAHDI_EVENT_NOALARM:
 			p->inalarm = 0;
 #ifdef HAVE_PRI
+			p->resetting = 0;
 			/* Extremely unlikely but just in case */
-			if (p->bearer)
+			if (p->bearer) {
 				p->bearer->inalarm = 0;
+				p->bearer->resetting = 0;
+			}
 #endif				
 			if (!p->unknown_alarm) {
 				ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
@@ -7656,6 +7663,9 @@
 		break;
 	case DAHDI_EVENT_NOALARM:
 		i->inalarm = 0;
+#if defined(HAVE_PRI)
+		i->resetting = 0;
+#endif	/* defined(HAVE_PRI) */
 		if (!i->unknown_alarm) {
 			ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", i->channel);
 			manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
@@ -7666,6 +7676,9 @@
 		break;
 	case DAHDI_EVENT_ALARM:
 		i->inalarm = 1;
+#if defined(HAVE_PRI)
+		i->resetting = 0;
+#endif	/* defined(HAVE_PRI) */
 		res = get_alarms(i);
 		handle_alarms(i, res);
 		/* fall thru intentionally */
@@ -8551,10 +8564,14 @@
 			/* the dchannel is down so put the channel in alarm */
 			if (tmp->pri && !pri_is_up(tmp->pri)) {
 				tmp->inalarm = 1;
+				tmp->resetting = 0;
 			}
 #endif				
 			if ((res = get_alarms(tmp)) != DAHDI_ALARM_NONE) {
 				tmp->inalarm = 1;
+#if defined(HAVE_PRI)
+				tmp->resetting = 0;
+#endif	/* defined(HAVE_PRI) */
 				handle_alarms(tmp, res);
 			} else {
 				/* yes, this looks strange... the unknown_alarm flag is only used to
@@ -10056,18 +10073,20 @@
 					pri->lastreset -= pri->resetinterval;
 					pri->lastreset += 5;
 				}
+				/* Take the channels from inalarm condition */
 				pri->resetting = 0;
-				/* Take the channels from inalarm condition */
-				for (i = 0; i < pri->numchans; i++)
+				for (i = 0; i < pri->numchans; i++) {
 					if (pri->pvts[i]) {
 						pri->pvts[i]->inalarm = 0;
+						pri->pvts[i]->resetting = 0;
 					}
+				}
 				break;
 			case PRI_EVENT_DCHAN_DOWN:
 				pri_find_dchan(pri);
 				if (!pri_is_up(pri)) {
+					/* Hangup active channels and put them in alarm mode */
 					pri->resetting = 0;
-					/* Hangup active channels and put them in alarm mode */
 					for (i = 0; i < pri->numchans; i++) {
 						struct dahdi_pvt *p = pri->pvts[i];
 						if (p) {
@@ -10078,7 +10097,7 @@
 										pri_destroycall(p->pri->pri, p->call);
 										p->call = NULL;
 									} else
-										ast_log(LOG_WARNING, "The PRI Call have not been destroyed\n");
+										ast_log(LOG_WARNING, "The PRI Call has not been destroyed\n");
 								}
 								if (p->realcall) {
 									pri_hangup_all(p->realcall, pri);
@@ -10086,6 +10105,7 @@
 									p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 							}
 							p->inalarm = 1;
+							p->resetting = 0;
 						}
 					}
 				}
@@ -10993,27 +11013,25 @@
 							PRI_CHANNEL(e->restartack.channel));
 					}
 				} else {
-					if (pri->pvts[chanpos]) {
-						ast_mutex_lock(&pri->pvts[chanpos]->lock);
-						if (pri->pvts[chanpos]->realcall) 
-							pri_hangup_all(pri->pvts[chanpos]->realcall, pri);
-						else if (pri->pvts[chanpos]->owner) {
-							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;
-						if (option_verbose > 2)
-							ast_verbose(VERBOSE_PREFIX_3
-								"Span %d: Channel %d/%d successfully restarted\n",
-								pri->span, pri->pvts[chanpos]->logicalspan,
-								pri->pvts[chanpos]->prioffset);
-						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
-						if (pri->resetting)
-							pri_check_restart(pri);
+					ast_mutex_lock(&pri->pvts[chanpos]->lock);
+					if (pri->pvts[chanpos]->realcall) 
+						pri_hangup_all(pri->pvts[chanpos]->realcall, pri);
+					else if (pri->pvts[chanpos]->owner) {
+						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;
+					if (option_verbose > 2)
+						ast_verbose(VERBOSE_PREFIX_3
+							"Span %d: Channel %d/%d successfully restarted\n",
+							pri->span, pri->pvts[chanpos]->logicalspan,
+							pri->pvts[chanpos]->prioffset);
+					ast_mutex_unlock(&pri->pvts[chanpos]->lock);
+					if (pri->resetting)
+						pri_check_restart(pri);
 				}
 				break;
 			case PRI_EVENT_SETUP_ACK:




More information about the asterisk-commits mailing list