[asterisk-commits] mnick: branch 1.4 r233014 - /branches/1.4/main/dsp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 4 09:17:09 CST 2009


Author: mnick
Date: Fri Dec  4 09:17:03 2009
New Revision: 233014

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=233014
Log:
Warning message gets displayed only once

Added additional field 'int display_inband_dtmf_warning', which when set to '1' displays the warning ('Inband DTMF is not supported on codec %s. Use RFC2833'), and when set to '0' doesn't display the warning. Otherwise you would get hundreds of warnings every second.

(closes issue #15769)
Reported by: falves11
Patches:
	patch_15769_14.txt uploaded by mnick (license 874)
Tested by: mnick, falves11


Modified:
    branches/1.4/main/dsp.c

Modified: branches/1.4/main/dsp.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/main/dsp.c?view=diff&rev=233014&r1=233013&r2=233014
==============================================================================
--- branches/1.4/main/dsp.c (original)
+++ branches/1.4/main/dsp.c Fri Dec  4 09:17:03 2009
@@ -353,6 +353,7 @@
 	int tcount;
 	int digitmode;
 	int thinkdigit;
+	int display_inband_dtmf_warning;
 	float genergy;
 	union {
 		dtmf_detect_state_t dtmf;
@@ -1478,7 +1479,10 @@
 			shortdata[x] = AST_ALAW(odata[x]);
 		break;
 	default:
-		ast_log(LOG_WARNING, "Inband DTMF is not supported on codec %s. Use RFC2833\n", ast_getformatname(af->subclass));
+		/*Display warning only once. Otherwise you would get hundreds of warnings every second */
+		if (dsp->display_inband_dtmf_warning)
+			ast_log(LOG_WARNING, "Inband DTMF is not supported on codec %s. Use RFC2833\n", ast_getformatname(af->subclass));
+		dsp->display_inband_dtmf_warning = 0;
 		return af;
 	}
 	silence = __ast_dsp_silence(dsp, shortdata, len, NULL);
@@ -1642,6 +1646,7 @@
 		dsp->threshold = DEFAULT_THRESHOLD;
 		dsp->features = DSP_FEATURE_SILENCE_SUPPRESS;
 		dsp->busycount = DSP_HISTORY;
+		dsp->display_inband_dtmf_warning = 1;
 		/* Initialize DTMF detector */
 		ast_dtmf_detect_init(&dsp->td.dtmf);
 		/* Initialize initial DSP progress detect parameters */




More information about the asterisk-commits mailing list