[asterisk-commits] moy: branch moy/mfcr2-1.2 r154137 - /team/moy/mfcr2-1.2/channels/chan_zap.c

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


Author: moy
Date: Mon Nov  3 21:16:13 2008
New Revision: 154137

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

Modified:
    team/moy/mfcr2-1.2/channels/chan_zap.c

Modified: team/moy/mfcr2-1.2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2-1.2/channels/chan_zap.c?view=diff&rev=154137&r1=154136&r2=154137
==============================================================================
--- team/moy/mfcr2-1.2/channels/chan_zap.c (original)
+++ team/moy/mfcr2-1.2/channels/chan_zap.c Mon Nov  3 21:16:13 2008
@@ -1371,11 +1371,24 @@
 	ast_log(LOG_NOTICE, "New MFC/R2 call detected on chan %d.\n", openr2_chan_get_number(r2chan));
 }
 
+static int get_alarms(struct zt_pvt *p);
 static void zt_r2_on_hardware_alarm(openr2_chan_t *r2chan, int alarm)
 {
+	int res;
 	struct zt_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);
+		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);
+	} else {
+		ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
+		manager_event(EVENT_FLAG_SYSTEM, "AlarmClear", "Channel: %d\r\n", p->channel);
+	}	
 	ast_mutex_unlock(&p->lock);
 	ast_log(LOG_WARNING, "Zap alarm on chan %d.\n", openr2_chan_get_number(r2chan));
 }
@@ -4257,6 +4270,10 @@
 								"Alarm: %s\r\n"
 								"Channel: %d\r\n",
 								alarm2str(res), p->channel);
+#ifdef HAVE_OPENR2
+			if (p->sig == SIG_MFCR2)
+				break;
+#endif
 			/* fall through intentionally */
 		case ZT_EVENT_ONHOOK:
 			if (p->radio)




More information about the asterisk-commits mailing list