[asterisk-commits] rmudgett: branch rmudgett/bch_shift_v1.6.2 r311797 - in /team/rmudgett/bch_sh...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 28 17:49:24 CDT 2011
Author: rmudgett
Date: Mon Mar 28 17:49:20 2011
New Revision: 311797
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311797
Log:
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.6.2/ (props changed)
team/rmudgett/bch_shift_v1.6.2/channels/chan_dahdi.c
Propchange: team/rmudgett/bch_shift_v1.6.2/
------------------------------------------------------------------------------
--- bch_shift_v1.8-integrated (original)
+++ bch_shift_v1.8-integrated Mon Mar 28 17:49:20 2011
@@ -1,1 +1,1 @@
-/team/rmudgett/bch_shift_v1.8:1-311684
+/team/rmudgett/bch_shift_v1.8:1-311753
Modified: team/rmudgett/bch_shift_v1.6.2/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bch_shift_v1.6.2/channels/chan_dahdi.c?view=diff&rev=311797&r1=311796&r2=311797
==============================================================================
--- team/rmudgett/bch_shift_v1.6.2/channels/chan_dahdi.c (original)
+++ team/rmudgett/bch_shift_v1.6.2/channels/chan_dahdi.c Mon Mar 28 17:49:20 2011
@@ -6159,12 +6159,10 @@
/* 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");
}
@@ -6172,11 +6170,17 @@
p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
}
}
- if (p->bearer)
+ if (p->bearer) {
p->bearer->inalarm = 1;
- else
-#endif
- p->inalarm = 1;
+ p->bearer->resetting = 0;
+ } else
+#endif
+ {
+ 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
@@ -6528,9 +6532,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
ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
@@ -9855,12 +9862,18 @@
break;
case DAHDI_EVENT_NOALARM:
i->inalarm = 0;
+#if defined(HAVE_PRI)
+ i->resetting = 0;
+#endif /* defined(HAVE_PRI) */
ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", i->channel);
manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
"Channel: %d\r\n", i->channel);
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 */
@@ -11061,11 +11074,16 @@
ioctl(tmp->subs[SUB_REAL].dfd,DAHDI_SETTONEZONE,&tmp->tonezone);
#ifdef HAVE_PRI
/* the dchannel is down so put the channel in alarm */
- if (tmp->pri && !pri_is_up(tmp->pri))
+ 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);
}
}
@@ -13556,18 +13574,25 @@
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)) {
+ if (pri->sig == SIG_BRI_PTMP) {
+ /* For PTMP connections with non persistent layer 2 we want
+ * to *not* declare inalarm unless there actually is an alarm */
+ break;
+ }
+ /* 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) {
@@ -13578,18 +13603,15 @@
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);
} else if (p->owner)
p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
}
- /* For PTMP connections with non persistent layer 2 we want
- * to *not* declare inalarm unless there actually is an alarm */
- if (p->sig != SIG_BRI_PTMP) {
- p->inalarm = 1;
- }
+ p->inalarm = 1;
+ p->resetting = 0;
}
}
}
@@ -14486,27 +14508,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;
- pri->pvts[chanpos]->inservice = 1;
- ast_verb(3,
- "Span %d: Channel %d/%d successfully restarted\n",
+ 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);
- ast_mutex_unlock(&pri->pvts[chanpos]->lock);
- if (pri->resetting)
- pri_check_restart(pri);
+ pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
}
+ pri->pvts[chanpos]->resetting = 0;
+ pri->pvts[chanpos]->inservice = 1;
+ ast_verb(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