[asterisk-commits] tilghman: trunk r94795 - /trunk/channels/chan_zap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 26 12:05:29 CST 2007


Author: tilghman
Date: Wed Dec 26 12:05:28 2007
New Revision: 94795

URL: http://svn.digium.com/view/asterisk?view=rev&rev=94795
Log:
Convert raw bits for callprogress bitfield to use constants, for greater code clarity
Reported by: dimas
Patch by: dimas
(Closes issue #11280)

Modified:
    trunk/channels/chan_zap.c

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=94795&r1=94794&r2=94795
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Wed Dec 26 12:05:28 2007
@@ -222,6 +222,12 @@
 #define ZAP_OVERLAPDIAL_OUTGOING 1
 #define ZAP_OVERLAPDIAL_INCOMING 2
 #define ZAP_OVERLAPDIAL_BOTH (ZAP_OVERLAPDIAL_INCOMING|ZAP_OVERLAPDIAL_OUTGOING)
+
+
+#define CALLPROGRESS_PROGRESS		1
+#define CALLPROGRESS_FAX_OUTGOING	2
+#define CALLPROGRESS_FAX_INCOMING	4
+#define CALLPROGRESS_FAX		(CALLPROGRESS_FAX_INCOMING | CALLPROGRESS_FAX_OUTGOING)
 
 static char defaultcic[64] = "";
 static char defaultozz[64] = "";
@@ -4172,7 +4178,7 @@
 		*dest = &p->subs[index].f;
 	} else if (f->subclass == 'f') {
 		/* Fax tone -- Handle and return NULL */
-		if ((p->callprogress & 0x6) && !p->faxhandled) {
+		if ((p->callprogress & CALLPROGRESS_FAX) && !p->faxhandled) {
 			p->faxhandled++;
 			if (strcmp(ast->exten, "fax")) {
 				const char *target_context = S_OR(ast->macrocontext, ast->context);
@@ -4313,7 +4319,7 @@
 						}
 					}
 					if (ast->_state == AST_STATE_DIALING) {
-						if ((p->callprogress & 1) && CANPROGRESSDETECT(p) && p->dsp && p->outgoing) {
+						if ((p->callprogress & CALLPROGRESS_PROGRESS) && CANPROGRESSDETECT(p) && p->dsp && p->outgoing) {
 							ast_debug(1, "Done dialing, but waiting for progress detection before doing more...\n");
 						} else if (p->confirmanswer || (!p->dialednone && ((mysig == SIG_EM) || (mysig == SIG_EM_E1) ||  (mysig == SIG_EMWINK) || (mysig == SIG_FEATD) || (mysig == SIG_FEATDMF_TA) || (mysig == SIG_FEATDMF) || (mysig == SIG_E911) || (mysig == SIG_FGC_CAMA) || (mysig == SIG_FGC_CAMAMF) || (mysig == SIG_FEATB) || (mysig == SIG_SF) || (mysig == SIG_SFWINK) || (mysig == SIG_SF_FEATD) || (mysig == SIG_SF_FEATDMF) || (mysig == SIG_SF_FEATB)))) {
 							ast_setstate(ast, AST_STATE_RINGING);
@@ -5819,10 +5825,10 @@
 	if (index == SUB_REAL) {
 		if (i->busydetect && CANBUSYDETECT(i))
 			features |= DSP_FEATURE_BUSY_DETECT;
-		if ((i->callprogress & 1) && CANPROGRESSDETECT(i))
+		if ((i->callprogress & CALLPROGRESS_PROGRESS) && CANPROGRESSDETECT(i))
 			features |= DSP_FEATURE_CALL_PROGRESS;
-		if ((!i->outgoing && (i->callprogress & 4)) || 
-		    (i->outgoing && (i->callprogress & 2))) {
+		if ((!i->outgoing && (i->callprogress & CALLPROGRESS_FAX_INCOMING)) || 
+		    (i->outgoing && (i->callprogress & CALLPROGRESS_FAX_OUTGOING))) {
 			features |= DSP_FEATURE_FAX_DETECT;
 		}
 #ifdef ZT_TONEDETECT
@@ -12877,21 +12883,17 @@
 				ast_log(LOG_ERROR, "busypattern= expects busypattern=tonelength,quietlength\n");
 			}
 		} else if (!strcasecmp(v->name, "callprogress")) {
+			confp->chan.callprogress &= ~CALLPROGRESS_PROGRESS;
 			if (ast_true(v->value))
-				confp->chan.callprogress |= 1;
-			else
-				confp->chan.callprogress &= ~1;
+				confp->chan.callprogress |= CALLPROGRESS_PROGRESS;
 		} else if (!strcasecmp(v->name, "faxdetect")) {
+			confp->chan.callprogress &= ~CALLPROGRESS_FAX;
 			if (!strcasecmp(v->value, "incoming")) {
-				confp->chan.callprogress |= 4;
-				confp->chan.callprogress &= ~2;
+				confp->chan.callprogress |= CALLPROGRESS_FAX_INCOMING;
 			} else if (!strcasecmp(v->value, "outgoing")) {
-				confp->chan.callprogress &= ~4;
-				confp->chan.callprogress |= 2;
+				confp->chan.callprogress |= CALLPROGRESS_FAX_OUTGOING;
 			} else if (!strcasecmp(v->value, "both") || ast_true(v->value))
-				confp->chan.callprogress |= 6;
-			else
-				confp->chan.callprogress &= ~6;
+				confp->chan.callprogress |= CALLPROGRESS_FAX_INCOMING | CALLPROGRESS_FAX_OUTGOING;
 		} else if (!strcasecmp(v->name, "echocancel")) {
 			if (!ast_strlen_zero(v->value)) {
 				y = atoi(v->value);




More information about the asterisk-commits mailing list