[Asterisk-cvs] asterisk/channels chan_zap.c,1.478,1.479

mattf at lists.digium.com mattf at lists.digium.com
Thu Jul 21 10:59:40 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv30990/channels

Modified Files:
	chan_zap.c 
Log Message:
Get rid of DSP after we don't need it anymore in MF mode


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.478
retrieving revision 1.479
diff -u -d -r1.478 -r1.479
--- chan_zap.c	19 Jul 2005 13:30:37 -0000	1.478
+++ chan_zap.c	21 Jul 2005 15:06:50 -0000	1.479
@@ -531,6 +531,7 @@
 	unsigned int faxhandled:1;			/* Has a fax tone already been handled? */
 	unsigned int firstradio:1;
 	unsigned int hanguponpolarityswitch:1;
+	unsigned int hardwaredtmf:1;
 	unsigned int hidecallerid;
 	unsigned int ignoredtmf:1;
 	unsigned int immediate:1;			/* Answer before getting digits? */
@@ -4793,10 +4794,16 @@
 		}
 #ifdef ZT_TONEDETECT
 		x = ZT_TONEDETECT_ON | ZT_TONEDETECT_MUTE;
-		if (ioctl(i->subs[index].zfd, ZT_TONEDETECT, &x) || NEED_MFDETECT(i))
+		if (ioctl(i->subs[index].zfd, ZT_TONEDETECT, &x)) {
 #endif		
+			i->hardwaredtmf = 0;
 			features |= DSP_FEATURE_DTMF_DETECT;
-
+#ifdef ZT_TONEDETECT
+		} else if (NEED_MFDETECT(i)) {
+			i->hardwaredtmf = 1;
+			features |= DSP_FEATURE_DTMF_DETECT;
+		}
+#endif
 		if (features) {
 			if (i->dsp) {
 				ast_log(LOG_DEBUG, "Already have a dsp on %s?\n", tmp->name);
@@ -5192,8 +5199,17 @@
 			zt_wink(p, index);
 		}
 		zt_enable_ec(p);
-		if ((p->sig == SIG_FEATDMF) || (p->sig == SIG_E911) || (p->sig == SIG_FEATB)) 
-			if (p->dsp) ast_dsp_digitmode(p->dsp,DSP_DIGITMODE_DTMF | p->dtmfrelax); 
+		if (NEED_MFDETECT(p)) {
+			if (p->dsp) {
+				if (!p->hardwaredtmf)
+					ast_dsp_digitmode(p->dsp,DSP_DIGITMODE_DTMF | p->dtmfrelax); 
+				else {
+					ast_dsp_free(p->dsp);
+					p->dsp = NULL;
+				}
+			}
+		}
+
 		if (ast_exists_extension(chan, chan->context, exten, 1, chan->cid.cid_num)) {
 			ast_copy_string(chan->exten, exten, sizeof(chan->exten));
 			if (p->dsp) ast_dsp_digitreset(p->dsp);




More information about the svn-commits mailing list