]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Makes busy detection in dsp.c always allow for at least one frame (20ms) of error...
authorJonathan Rose <jrose@digium.com>
Mon, 16 May 2011 21:00:55 +0000 (21:00 +0000)
committerJonathan Rose <jrose@digium.com>
Mon, 16 May 2011 21:00:55 +0000 (21:00 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@319261 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/dsp.c

index 4c7644458b8222fdf9b8212ee874a74d27720646..0196201a03145d3312e35b2be7621a722cb29802 100644 (file)
@@ -1239,7 +1239,7 @@ int ast_dsp_busydetect(struct ast_dsp *dsp)
        }
        /* If we know the expected busy tone length, check we are in the range */
        if (res && (dsp->busy_tonelength > 0)) {
-               if (abs(avgtone - dsp->busy_tonelength) > (dsp->busy_tonelength*BUSY_PAT_PERCENT/100)) {
+               if (abs(avgtone - dsp->busy_tonelength) > MAX(dsp->busy_tonelength*BUSY_PAT_PERCENT/100, 20)) {
 #ifdef BUSYDETECT_DEBUG
                        ast_debug(5, "busy detector: avgtone of %d not close enough to desired %d\n",
                                avgtone, dsp->busy_tonelength);
@@ -1250,7 +1250,7 @@ int ast_dsp_busydetect(struct ast_dsp *dsp)
 #ifndef BUSYDETECT_TONEONLY
        /* If we know the expected busy tone silent-period length, check we are in the range */
        if (res && (dsp->busy_quietlength > 0)) {
-               if (abs(avgsilence - dsp->busy_quietlength) > (dsp->busy_quietlength*BUSY_PAT_PERCENT/100)) {
+               if (abs(avgsilence - dsp->busy_quietlength) > MAX(dsp->busy_quietlength*BUSY_PAT_PERCENT/100, 20)) {
 #ifdef BUSYDETECT_DEBUG
                ast_debug(5, "busy detector: avgsilence of %d not close enough to desired %d\n",
                        avgsilence, dsp->busy_quietlength);