]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Warning message gets displayed only once
authorMatthias Nick <mnick@digium.com>
Fri, 4 Dec 2009 15:17:03 +0000 (15:17 +0000)
committerMatthias Nick <mnick@digium.com>
Fri, 4 Dec 2009 15:17:03 +0000 (15:17 +0000)
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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@233014 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/dsp.c

index fd4bc9b73988fbd496d94af7ffd949c996dd4fb0..877feab60b9fb99f5e6738ce0af9ce77ffce1b3b 100644 (file)
@@ -353,6 +353,7 @@ struct ast_dsp {
        int tcount;
        int digitmode;
        int thinkdigit;
+       int display_inband_dtmf_warning;
        float genergy;
        union {
                dtmf_detect_state_t dtmf;
@@ -1478,7 +1479,10 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
                        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 @@ struct ast_dsp *ast_dsp_new(void)
                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 */