Merged revisions 312949 via svnmerge from
authorRichard Mudgett <rmudgett@digium.com>
Tue, 5 Apr 2011 18:47:11 +0000 (18:47 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 5 Apr 2011 18:47:11 +0000 (18:47 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r312949 | rmudgett | 2011-04-05 13:45:24 -0500 (Tue, 05 Apr 2011) | 6 lines

  Crash if ISDN span layer 1 is down on initial load.

  Regression from -r312575 B channel shifting during negotiation.

  * Also combine updating the alarm flag with clearing the resetting flag.
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@312950 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_dahdi.c
channels/sig_pri.c
channels/sig_pri.h

index e1c4a26..04105ad 100644 (file)
@@ -12757,9 +12757,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
                                switch (tmp->sig) {
 #ifdef HAVE_PRI
                                case SIG_PRI_LIB_HANDLE_CASES:
-                                       ast_mutex_lock(&tmp->lock);
-                                       sig_pri_chan_alarm_notify(tmp->sig_pvt, si.alarms);
-                                       ast_mutex_unlock(&tmp->lock);
+                                       sig_pri_set_alarm(tmp->sig_pvt, !si.alarms);
                                        break;
 #endif
 #if defined(HAVE_SS7)
index 0e76fda..197caec 100644 (file)
@@ -178,8 +178,15 @@ static void sig_pri_set_digital(struct sig_pri_chan *p, int is_digital)
        }
 }
 
-static void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
+void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
 {
+       /*
+        * Clear the channel restart flag when the channel alarm changes
+        * to prevent the flag from getting stuck when the link goes
+        * down.
+        */
+       p->resetting = 0;
+
        p->inalarm = in_alarm;
        if (p->calls->set_alarm) {
                p->calls->set_alarm(p->chan_pvt, in_alarm);
@@ -5555,7 +5562,6 @@ static void *pri_dchannel(void *vpri)
                                for (i = 0; i < pri->numchans; i++) {
                                        if (pri->pvts[i]) {
                                                sig_pri_set_alarm(pri->pvts[i], 0);
-                                               pri->pvts[i]->resetting = 0;
                                        }
                                }
                                sig_pri_span_devstate_changed(pri);
@@ -5584,7 +5590,6 @@ static void *pri_dchannel(void *vpri)
                                                                        p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
                                                        }
                                                        sig_pri_set_alarm(p, 1);
-                                                       p->resetting = 0;
                                                }
                                        }
                                        sig_pri_span_devstate_changed(pri);
@@ -8488,7 +8493,6 @@ int sig_pri_start_pri(struct sig_pri_span *pri)
 void sig_pri_chan_alarm_notify(struct sig_pri_chan *p, int noalarm)
 {
        pri_grab(p, p->pri);
-       p->resetting = 0;
        sig_pri_set_alarm(p, !noalarm);
        if (!noalarm) {
                if (pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0) {
index f75646e..148397f 100644 (file)
@@ -581,6 +581,7 @@ int sig_pri_digit_begin(struct sig_pri_chan *pvt, struct ast_channel *ast, char
 void sig_pri_stop_pri(struct sig_pri_span *pri);
 int sig_pri_start_pri(struct sig_pri_span *pri);
 
+void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm);
 void sig_pri_chan_alarm_notify(struct sig_pri_chan *p, int noalarm);
 
 void pri_event_alarm(struct sig_pri_span *pri, int index, int before_start_pri);