[asterisk-commits] jpeeler: branch jpeeler/bug16709 r246123 - /team/jpeeler/bug16709/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 10 12:14:32 CST 2010


Author: jpeeler
Date: Wed Feb 10 12:14:28 2010
New Revision: 246123

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=246123
Log:
commit this for historical purposes, i'm going to revert it as i'm not comfortable creating fake events instead of the channel actually being in alarm

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=246123&r1=246122&r2=246123
==============================================================================
--- team/jpeeler/bug16709/channels/chan_dahdi.c (original)
+++ team/jpeeler/bug16709/channels/chan_dahdi.c Wed Feb 10 12:14:28 2010
@@ -6877,6 +6877,11 @@
 	struct dahdi_spaninfo zi;
 	struct dahdi_params params;
 
+	/* this is used only for unit testing purposes */
+	if (p->fake_event) {
+		return p->fake_event;
+	}
+
 	memset(&zi, 0, sizeof(zi));
 	zi.spanno = p->span;
 
@@ -7002,7 +7007,7 @@
 
 	if(report_alarms & REPORT_SPAN_ALARMS && p->manages_span_alarms) {
 		if ((res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SPANSTAT, &di)) >= 0) {
-			if (di.alarms != DAHDI_ALARM_NONE) {
+			if (di.alarms != DAHDI_ALARM_NONE || p->fake_event) {
 				ast_log(LOG_WARNING, "Detected alarm on span %d: %s\n", p->span, alarm_str);
 				manager_event(EVENT_FLAG_SYSTEM, "SpanAlarm",
 							  "Alarm: %s\r\n"
@@ -10354,6 +10359,7 @@
 	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) {
@@ -14580,6 +14586,16 @@
 				} else {
 					ast_cli(a->fd, "Hookstate (FXS only): %s\n", ps.rxisoffhook ? "Offhook" : "Onhook");
 				}
+ast_log(LOG_WARNING, "jpeeler: about to set fake event\n");
+tmp->fake_event = DAHDI_ALARM_RED;
+handle_init_event(tmp, DAHDI_EVENT_ALARM);
+/*
+ast_log(LOG_WARNING, "jpeeler: about to set params\n");
+ps.chan_alarms = DAHDI_ALARM_RED;
+if (ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_SET_PARAMS, &ps) < 0) {
+	ast_log(LOG_WARNING, "Failed to set parameters on channel %d: %s\n", tmp->channel, strerror(errno));
+}
+*/
 			}
 			ast_mutex_unlock(&iflock);
 			return CLI_SUCCESS;




More information about the asterisk-commits mailing list