[asterisk-commits] jpeeler: branch jpeeler/asterisk-sigwork-trunk r193045 - /team/jpeeler/asteri...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 7 13:38:09 CDT 2009


Author: jpeeler
Date: Thu May  7 13:38:02 2009
New Revision: 193045

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=193045
Log:
add polarity_in to the analog signalling module for CID

Modified:
    team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c
    team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c?view=diff&rev=193045&r1=193044&r2=193045
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c Thu May  7 13:38:02 2009
@@ -170,6 +170,8 @@
 		return ANALOG_CID_START_RING;
 	} else if (!strcasecmp(value, "polarity")) {
 		return ANALOG_CID_START_POLARITY;
+	} else if (!strcasecmp(value, "polarity_in")) {
+		return ANALOG_CID_START_POLARITY_IN;
 	}
 
 	return 0;
@@ -182,6 +184,8 @@
 		return "Ring";
 	case ANALOG_CID_START_POLARITY:
 		return "Polarity";
+	case ANALOG_CID_START_POLARITY_IN:
+		return "Polarity_In";
 	}
 
 	return "Unknown";
@@ -1799,7 +1803,7 @@
 		/* If we want caller id, we're in a prering state due to a polarity reversal
 		 * and we're set to use a polarity reversal to trigger the start of caller id,
 		 * grab the caller id and wait for ringing to start... */
-		if (p->use_callerid && (chan->_state == AST_STATE_PRERING && p->cid_start == ANALOG_CID_START_POLARITY)) {
+		if (p->use_callerid && (chan->_state == AST_STATE_PRERING && (p->cid_start == ANALOG_CID_START_POLARITY || p->cid_start == ANALOG_CID_START_POLARITY_IN))) {
 			/* If set to use DTMF CID signalling, listen for DTMF */
 			if (p->cid_signalling == CID_SIG_DTMF) {
 				int i = 0;
@@ -2231,24 +2235,7 @@
 			p->inalarm = 1;
 #if 0
 			res = get_alarms(p);
-			do {
-				const char *alarm_str = alarm2str(res);
-
-				/* hack alert! Zaptel 1.4 and DAHDI expose FXO battery as an alarm, but Asterisk 1.4
-				 * doesn't know what to do with it.  Don't confuse users with log messages. */
-				if (!strcasecmp(alarm_str, "No Alarm") || !strcasecmp(alarm_str, "Unknown Alarm")) {
-					p->unknown_alarm = 1;
-					break;
-				} else {
-					p->unknown_alarm = 0;
-				}
-					
-				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);
-			} while (0);
+			handle_alarms(p, res);	
 #endif
 		case ANALOG_EVENT_ONHOOK:
 			switch (p->sig) {
@@ -2530,7 +2517,7 @@
 			case ANALOG_SIG_FXOGS:
 			case ANALOG_SIG_FXOKS:
 #if 0
-				ast_log(LOG_DEBUG, "Winkflash, index: %d, normal: %d, callwait: %d, thirdcall: %d\n",
+				ast_debug(1, "Winkflash, index: %d, normal: %d, callwait: %d, thirdcall: %d\n",
 					index, p->subs[ANALOG_SUB_REAL].dfd, p->subs[ANALOG_SUB_CALLWAIT].dfd, p->subs[ANALOG_SUB_THREEWAY].dfd);
 #endif
 				p->callwaitcas = 0;
@@ -3035,7 +3022,11 @@
 		case ANALOG_SIG_SF_FEATB:
 		case ANALOG_SIG_SF:
 				/* Check for callerid, digits, etc */
-				chan = analog_new_ast_channel(i, AST_STATE_RING, 0, ANALOG_SUB_REAL);
+				if (i->cid_start == ANALOG_CID_START_POLARITY_IN) {
+					chan = analog_new_ast_channel(i, AST_STATE_PRERING, 0, ANALOG_SUB_REAL);
+				} else {
+					chan = analog_new_ast_channel(i, AST_STATE_RING, 0, ANALOG_SUB_REAL);
+				}
 				i->ss_astchan = chan;
 				if (chan && ast_pthread_create(&threadid, &attr, __analog_ss_thread, i)) {
 					ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
@@ -3069,24 +3060,7 @@
 		i->inalarm = 1;
 #if 0
 		res = get_alarms(i);
-		do {
-			const char *alarm_str = alarm2str(res);
-
-			/* hack alert!  DAHDI 1.4 now exposes FXO battery as an alarm, but asterisk 1.4
-			 * doesn't know what to do with it.  Don't confuse users with log messages. */
-			if (!strcasecmp(alarm_str, "No Alarm") || !strcasecmp(alarm_str, "Unknown Alarm")) {
-				i->unknown_alarm = 1;
-				break;
-			} else {
-				i->unknown_alarm = 0;
-			}
-
-			ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", i->channel, alarm_str);
-			manager_event(EVENT_FLAG_SYSTEM, "Alarm",
-				"Alarm: %s\r\n"
-				"Channel: %d\r\n",
-				alarm_str, i->channel);
-		} while (0);
+		handle_alarms(i, res);	
 #endif
 		/* fall thru intentionally */
 	case ANALOG_EVENT_ONHOOK:
@@ -3144,7 +3118,7 @@
 			if (i->hanguponpolarityswitch)
 				i->polarity = POLARITY_REV;
 
-			if (i->cid_start == ANALOG_CID_START_POLARITY) {
+			if (i->cid_start == ANALOG_CID_START_POLARITY || i->cid_start == ANALOG_CID_START_POLARITY_IN) {
 				i->polarity = POLARITY_REV;
 				ast_verbose(VERBOSE_PREFIX_2 "Starting post polarity "
 					    "CID detection on channel %d\n",

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h?view=diff&rev=193045&r1=193044&r2=193045
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h Thu May  7 13:38:02 2009
@@ -76,6 +76,7 @@
 
 enum analog_cid_start {
 	ANALOG_CID_START_POLARITY = 1,
+	ANALOG_CID_START_POLARITY_IN,
 	ANALOG_CID_START_RING,
 };
 




More information about the asterisk-commits mailing list