summaryrefslogtreecommitdiff
path: root/main/dsp.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2016-07-21 22:28:25 -0500
committerRichard Mudgett <rmudgett@digium.com>2016-07-26 11:48:52 -0500
commit49461f37b75aa27275d1c4811007e2a7f94ac002 (patch)
treea22b7bf9c7e1a90befd5884acef7550a0c28baec /main/dsp.c
parente2bfcb3e58c426c71aebe64cad0ff290bd3f8560 (diff)
dsp.c: Fix erroneous fax tone detection.
The Goertzel calculations get less accurate the lower the signal level being worked with becomes because there is less resolution remaining. If it is too low we can erroneously detect a tone where none really exists. The searched for fax frequencies not only need to be so much stronger than the background noise they must also be a minimum strength. * Add needed minimum threshold test to tone_detect(). * Set TONE_THRESHOLD to allow low volume frequency spread detection. ASTERISK-26237 #close Reported by: Richard Mudgett Change-Id: I84dbba7f7628fa13720add6a88eae3b129e066fc
Diffstat (limited to 'main/dsp.c')
-rw-r--r--main/dsp.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/main/dsp.c b/main/dsp.c
index 193bf9fd5..f043ff9d1 100644
--- a/main/dsp.c
+++ b/main/dsp.c
@@ -171,8 +171,7 @@ enum gsamp_thresh {
*/
#define DTMF_THRESHOLD 8.0e7
-#define FAX_THRESHOLD 8.0e7
-#define FAX_2ND_HARMONIC 2.0 /* 4dB */
+#define TONE_THRESHOLD 7.8e7
#define DEF_DTMF_NORMAL_TWIST 6.31 /* 8.0dB */
#define DEF_RELAX_DTMF_NORMAL_TWIST 6.31 /* 8.0dB */
@@ -187,8 +186,6 @@ enum gsamp_thresh {
#define DTMF_RELATIVE_PEAK_ROW 6.3 /* 8dB */
#define DTMF_RELATIVE_PEAK_COL 6.3 /* 8dB */
-#define DTMF_2ND_HARMONIC_ROW (relax ? 1.7 : 2.5) /* 4dB normal */
-#define DTMF_2ND_HARMONIC_COL 63.1 /* 18dB */
#define DTMF_TO_TOTAL_ENERGY 42.0
#define BELL_MF_THRESHOLD 1.6e9
@@ -583,7 +580,8 @@ static int tone_detect(struct ast_dsp *dsp, tone_detect_state_t *s, int16_t *amp
ast_debug(10, "tone %d, Ew=%.2E, Et=%.2E, s/n=%10.2f\n", s->freq, tone_energy, s->energy, tone_energy / (s->energy - tone_energy));
hit = 0;
- if (tone_energy > s->energy * s->threshold) {
+ if (TONE_THRESHOLD <= tone_energy
+ && tone_energy > s->energy * s->threshold) {
ast_debug(10, "Hit! count=%d\n", s->hit_count);
hit = 1;
}