[asterisk-commits] kpfleming: branch 1.6.0 r132729 - in /branches/1.6.0: ./ channels/chan_dahdi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 22 16:23:42 CDT 2008
Author: kpfleming
Date: Tue Jul 22 16:23:41 2008
New Revision: 132729
URL: http://svn.digium.com/view/asterisk?view=rev&rev=132729
Log:
Merged revisions 132721 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r132721 | kpfleming | 2008-07-22 16:21:56 -0500 (Tue, 22 Jul 2008) | 14 lines
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
........
................
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/channels/chan_dahdi.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_dahdi.c?view=diff&rev=132729&r1=132728&r2=132729
==============================================================================
--- branches/1.6.0/channels/chan_dahdi.c (original)
+++ branches/1.6.0/channels/chan_dahdi.c Tue Jul 22 16:23:41 2008
@@ -4251,6 +4251,17 @@
dahdi_confmute(p, 0);
}
+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)
{
int res, x;
@@ -4400,11 +4411,7 @@
#endif
p->inalarm = 1;
res = get_alarms(p);
- ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", p->channel, alarm2str(res));
- manager_event(EVENT_FLAG_SYSTEM, "Alarm",
- "Alarm: %s\r\n"
- "Channel: %d\r\n",
- alarm2str(res), p->channel);
+ handle_alarms(p, res);
#ifdef HAVE_PRI
if (!p->pri || !p->pri->pri || pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0) {
/* fall through intentionally */
@@ -7340,11 +7347,7 @@
case DAHDI_EVENT_ALARM:
mtd->pvt->inalarm = 1;
res = get_alarms(mtd->pvt);
- ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", mtd->pvt->channel, alarm2str(res));
- manager_event(EVENT_FLAG_SYSTEM, "Alarm",
- "Alarm: %s\r\n"
- "Channel: %d\r\n",
- alarm2str(res), mtd->pvt->channel);
+ handle_alarms(mtd->pvt, res);
break; /* What to do on channel alarm ???? -- fall thru intentionally?? */
default:
ast_log(LOG_NOTICE, "Got event %d (%s)... Passing along to ss_thread\n", res, event2str(res));
@@ -7558,11 +7561,7 @@
case DAHDI_EVENT_ALARM:
i->inalarm = 1;
res = get_alarms(i);
- ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", i->channel, alarm2str(res));
- manager_event(EVENT_FLAG_SYSTEM, "Alarm",
- "Alarm: %s\r\n"
- "Channel: %d\r\n",
- alarm2str(res), i->channel);
+ handle_alarms(i, res);
/* fall thru intentionally */
case DAHDI_EVENT_ONHOOK:
if (i->radio)
@@ -8555,16 +8554,11 @@
/* the dchannel is down so put the channel in alarm */
if (tmp->pri && !pri_is_up(tmp->pri))
tmp->inalarm = 1;
- else
- tmp->inalarm = 0;
#endif
- memset(&si, 0, sizeof(si));
- if (ioctl(tmp->subs[SUB_REAL].zfd,DAHDI_SPANSTAT,&si) == -1) {
- ast_log(LOG_ERROR, "Unable to get span status: %s\n", strerror(errno));
- destroy_dahdi_pvt(&tmp);
- return NULL;
- }
- if (si.alarms) tmp->inalarm = 1;
+ if ((res = get_alarms(tmp)) != DAHDI_ALARM_NONE) {
+ tmp->inalarm = 1;
+ handle_alarms(tmp, res);
+ }
}
tmp->polarityonanswerdelay = conf->chan.polarityonanswerdelay;
More information about the asterisk-commits
mailing list