[asterisk-commits] moy: branch moy/mfcr2-1.4 r154136 - /team/moy/mfcr2-1.4/channels/chan_dahdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 3 21:00:40 CST 2008


Author: moy
Date: Mon Nov  3 21:00:39 2008
New Revision: 154136

URL: http://svn.digium.com/view/asterisk?view=rev&rev=154136
Log:
handle alarm state more properly

Modified:
    team/moy/mfcr2-1.4/channels/chan_dahdi.c

Modified: team/moy/mfcr2-1.4/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2-1.4/channels/chan_dahdi.c?view=diff&rev=154136&r1=154135&r2=154136
==============================================================================
--- team/moy/mfcr2-1.4/channels/chan_dahdi.c (original)
+++ team/moy/mfcr2-1.4/channels/chan_dahdi.c Mon Nov  3 21:00:39 2008
@@ -993,11 +993,26 @@
 	ast_log(LOG_NOTICE, "New MFC/R2 call detected on chan %d.\n", openr2_chan_get_number(r2chan));
 }
 
+static void handle_alarms(struct dahdi_pvt *p, int alarms);
+static int get_alarms(struct dahdi_pvt *p);
 static void dahdi_r2_on_hardware_alarm(openr2_chan_t *r2chan, int alarm)
 {
+	int res;
 	struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
 	ast_mutex_lock(&p->lock);
 	p->inalarm = alarm ? 1 : 0;
+	if (p->inalarm) {
+		res = get_alarms(p);
+		/* unknown_alarm may be set here */
+		handle_alarms(p, res);
+	} else {
+		if (!p->unknown_alarm) {
+			ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
+			manager_event(EVENT_FLAG_SYSTEM, "AlarmClear", "Channel: %d\r\n", p->channel);
+		} else {
+			p->unknown_alarm = 0;
+		}
+	}
 	ast_mutex_unlock(&p->lock);
 	ast_log(LOG_WARNING, "Zap alarm on chan %d.\n", openr2_chan_get_number(r2chan));
 }
@@ -4466,6 +4481,10 @@
 			} else {
 				break;
 			}
+#endif
+#ifdef HAVE_OPENR2
+			if (p->sig == SIG_MFCR2)
+				break;
 #endif
 		case DAHDI_EVENT_ONHOOK:
 			if (p->radio) {




More information about the asterisk-commits mailing list