Merged revisions 132712 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r132712 | kpfleming | 2008-07-22 16:17:23 -0500 (Tue, 22 Jul 2008) | 6 lines

ensure that if any alarms exist at channel creation time, they are handled identically to if they occurred later, so that later alarm clearing will work properly and 'make sense'

(closes issue #12160)
Reported by: tzafrir


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@132721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.1
Kevin P. Fleming 17 years ago
parent d9e31c744a
commit f9074f1d95

@ -4232,6 +4232,17 @@ static void dahdi_handle_dtmfup(struct ast_channel *ast, int index, struct ast_f
} }
} }
static void handle_alarms(struct dahdi_pvt *p, int alarms)
{
const char *alarm_str = alarm2str(alarms);
ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", p->channel, alarm_str);
manager_event(EVENT_FLAG_SYSTEM, "Alarm",
"Alarm: %s\r\n"
"Channel: %d\r\n",
alarm_str, p->channel);
}
static struct ast_frame *dahdi_handle_event(struct ast_channel *ast) static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
{ {
int res, x; int res, x;
@ -4381,11 +4392,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
#endif #endif
p->inalarm = 1; p->inalarm = 1;
res = get_alarms(p); res = get_alarms(p);
ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", p->channel, alarm2str(res)); handle_alarms(p, res);
manager_event(EVENT_FLAG_SYSTEM, "Alarm",
"Alarm: %s\r\n"
"Channel: %d\r\n",
alarm2str(res), p->channel);
#ifdef HAVE_PRI #ifdef HAVE_PRI
if (!p->pri || !p->pri->pri || pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0) { if (!p->pri || !p->pri->pri || pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0) {
/* fall through intentionally */ /* fall through intentionally */
@ -7344,11 +7351,7 @@ static void *mwi_thread(void *data)
case DAHDI_EVENT_ALARM: case DAHDI_EVENT_ALARM:
mtd->pvt->inalarm = 1; mtd->pvt->inalarm = 1;
res = get_alarms(mtd->pvt); res = get_alarms(mtd->pvt);
ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", mtd->pvt->channel, alarm2str(res)); handle_alarms(mtd->pvt, res);
manager_event(EVENT_FLAG_SYSTEM, "Alarm",
"Alarm: %s\r\n"
"Channel: %d\r\n",
alarm2str(res), mtd->pvt->channel);
break; /* What to do on channel alarm ???? -- fall thru intentionally?? */ break; /* What to do on channel alarm ???? -- fall thru intentionally?? */
default: default:
ast_log(LOG_NOTICE, "Got event %d (%s)... Passing along to ss_thread\n", res, event2str(res)); ast_log(LOG_NOTICE, "Got event %d (%s)... Passing along to ss_thread\n", res, event2str(res));
@ -7724,11 +7727,7 @@ static int handle_init_event(struct dahdi_pvt *i, int event)
case DAHDI_EVENT_ALARM: case DAHDI_EVENT_ALARM:
i->inalarm = 1; i->inalarm = 1;
res = get_alarms(i); res = get_alarms(i);
ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", i->channel, alarm2str(res)); handle_alarms(i, res);
manager_event(EVENT_FLAG_SYSTEM, "Alarm",
"Alarm: %s\r\n"
"Channel: %d\r\n",
alarm2str(res), i->channel);
/* fall thru intentionally */ /* fall thru intentionally */
case DAHDI_EVENT_ONHOOK: case DAHDI_EVENT_ONHOOK:
if (i->radio) if (i->radio)
@ -8714,16 +8713,11 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
/* the dchannel is down so put the channel in alarm */ /* 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->inalarm = 1;
else
tmp->inalarm = 0;
#endif #endif
memset(&si, 0, sizeof(si)); if ((res = get_alarms(tmp)) != DAHDI_ALARM_NONE) {
if (ioctl(tmp->subs[SUB_REAL].zfd,DAHDI_SPANSTAT,&si) == -1) { tmp->inalarm = 1;
ast_log(LOG_ERROR, "Unable to get span status: %s\n", strerror(errno)); handle_alarms(tmp, res);
destroy_dahdi_pvt(&tmp);
return NULL;
} }
if (si.alarms) tmp->inalarm = 1;
} }
tmp->polarityonanswerdelay = conf->chan.polarityonanswerdelay; tmp->polarityonanswerdelay = conf->chan.polarityonanswerdelay;

Loading…
Cancel
Save