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/branches/1.8@312949 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2011-04-05 18:45:24 +00:00
parent ddc3fac28b
commit 4242cb82f4
3 changed files with 10 additions and 7 deletions

View File

@@ -12677,9 +12677,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)

View File

@@ -159,8 +159,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);
@@ -4695,7 +4702,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);
@@ -4724,7 +4730,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);
@@ -7565,7 +7570,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) {

View File

@@ -507,6 +507,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);