[svn-commits] jpeeler: branch jpeeler/bug16709 r250300 - /team/jpeeler/bug16709/channels/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 2 22:39:30 CST 2010


Author: jpeeler
Date: Tue Mar  2 22:39:26 2010
New Revision: 250300

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=250300
Log:
remove debugging and consolidate manager clear alarm events just like alarm events

Modified:
    team/jpeeler/bug16709/channels/chan_dahdi.c

Modified: team/jpeeler/bug16709/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/jpeeler/bug16709/channels/chan_dahdi.c?view=diff&rev=250300&r1=250299&r2=250300
==============================================================================
--- team/jpeeler/bug16709/channels/chan_dahdi.c (original)
+++ team/jpeeler/bug16709/channels/chan_dahdi.c Tue Mar  2 22:39:26 2010
@@ -3032,6 +3032,18 @@
 #endif
 }
 
+static void handle_clear_alarms(struct dahdi_pvt *p)
+{
+	if(report_alarms & REPORT_CHANNEL_ALARMS) {
+		ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
+		manager_event(EVENT_FLAG_SYSTEM, "AlarmClear", "Channel: %d\r\n", p->channel);
+	}
+	if(report_alarms & REPORT_SPAN_ALARMS && p->manages_span_alarms) {
+		ast_log(LOG_NOTICE, "Alarm cleared on span %d\n", p->span);
+		manager_event(EVENT_FLAG_SYSTEM, "SpanAlarmClear", "Span: %d\r\n", p->span);
+	}
+}
+
 #ifdef HAVE_OPENR2
 
 static int dahdi_r2_answer(struct dahdi_pvt *p)
@@ -3120,14 +3132,7 @@
 		res = get_alarms(p);
 		handle_alarms(p, res);
 	} else {
-		if(report_alarms & REPORT_CHANNEL_ALARMS) {
-			ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
-			manager_event(EVENT_FLAG_SYSTEM, "AlarmClear", "Channel: %d\r\n", p->channel);
-		}
-		if(report_alarms & REPORT_SPAN_ALARMS && p->manages_span_alarms) {
-			ast_log(LOG_NOTICE, "Alarm cleared on span %d\n", p->span);
-			manager_event(EVENT_FLAG_SYSTEM, "SpanAlarmClear", "Span: %d\r\n", p->span);
-		}
+		handle_clear_alarms(p);
 	}
 	ast_mutex_unlock(&p->lock);
 }
@@ -7519,15 +7524,7 @@
 		}
 #endif
 		p->inalarm = 0;
-		if(report_alarms & REPORT_CHANNEL_ALARMS) {
-			ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
-			manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
-						  "Channel: %d\r\n", p->channel);
-		}
-		if(report_alarms & REPORT_SPAN_ALARMS && p->manages_span_alarms) {
-			ast_log(LOG_NOTICE, "Alarm cleared on span %d\n", p->span);
-			manager_event(EVENT_FLAG_SYSTEM, "SpanAlarmClear", "Span: %d\r\n", p->span);
-		}
+		handle_clear_alarms(p);
 		break;
 	case DAHDI_EVENT_WINKFLASH:
 		if (p->inalarm) break;
@@ -10035,15 +10032,7 @@
 				break;
 			case DAHDI_EVENT_NOALARM:
 				mtd->pvt->inalarm = 0;
-				if(report_alarms & REPORT_CHANNEL_ALARMS) {
-					ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", mtd->pvt->channel);
-					manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
-								  "Channel: %d\r\n", mtd->pvt->channel);
-				}
-				if(report_alarms & REPORT_SPAN_ALARMS && mtd->pvt->manages_span_alarms) {
-					ast_log(LOG_NOTICE, "Alarm cleared on span %d\n", mtd->pvt->span);
-					manager_event(EVENT_FLAG_SYSTEM, "SpanAlarmClear", "Span: %d\r\n", mtd->pvt->span);
-				}
+				handle_clear_alarms(mtd->pvt);
 				break;
 			case DAHDI_EVENT_ALARM:
 				mtd->pvt->inalarm = 1;
@@ -10354,7 +10343,6 @@
 	pthread_t threadid;
 	struct ast_channel *chan;
 
-ast_log(LOG_WARNING, "jpeeler: handle_init_event %d chan %d\n", event, i->channel);
 	/* Handle an event on a given channel for the monitor thread. */
 
 	switch (event) {
@@ -10458,17 +10446,7 @@
 		break;
 	case DAHDI_EVENT_NOALARM:
 		i->inalarm = 0;
-		if(report_alarms & REPORT_CHANNEL_ALARMS) {
-			ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", i->channel);
-			manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
-						  "Channel: %d\r\n", i->channel);
-		}
-                
-		if(report_alarms & REPORT_SPAN_ALARMS && i->manages_span_alarms) {
-			ast_log(LOG_NOTICE, "Alarm cleared on span %d\n", i->span);
-			manager_event(EVENT_FLAG_SYSTEM, "SpanAlarmClear",
-						  "Span: %d\r\n", i->span);
-		}
+		handle_clear_alarms(i);
 		break;
 	case DAHDI_EVENT_ALARM:
 		i->inalarm = 1;




More information about the svn-commits mailing list