Index: configs/dsp.conf.sample =================================================================== --- configs/dsp.conf.sample (revision 374095) +++ configs/dsp.conf.sample (working copy) @@ -5,3 +5,34 @@ ; to talking. [default=256] ; ;silencethreshold=256 + +; DTMF Reverse Twist and Normal Twist is the difference in power between the row and column energies. +; +; Normal Twist is where the Column energy is greater than the Row energy +; Reverse Twist is where the Row energy is greater. +; +; Power level difference between frequencies for different Administrations/RPOAs +; Power Gain equiv +; normal reverse dB's +; AT&T(default) 6.31 2.51 8dB(normal), 4dB(reverse) +; NTT 3.16 3.16 Max. 5dB +; Danish 3.98 3.98 Max. 6dB +; Australian 10.0 10.0 Max. 10dB +; Brazilian 7.94 7.94 Max. 9dB +; ETSI 3.98 3.98 Max. 6dB + +;previous version compatible AT&T values +; RADIO_RELAX disabled, and relaxdtmf=no +; 6.30 2.50 7.99dB(normal), 3.98dB(reverse) +; RADIO_RELAX disabled, and relaxdtmf=yes +; 6.30 4.00 7.99dB(normal), 6.02dB(reverse) +; RADIO_RELAX enabled, and relaxdtmf=no +; 6.30 2.50 7.99dB(normal), 3.984dB(reverse) +; RADIO_RELAX enabled, and relaxdtmf=yes +; 6.30 6.50 7.99dB(normal), 8.13dB(reverse) + +;If you don't know what these mean, don't change them. +;dtmfnormaltwist=6.31 +;dtmfreversetwist=2.51 +;relaxdtmfnormaltwist=6.31 +;relaxdtmfreversetwist=3.98 Index: main/dsp.c =================================================================== --- main/dsp.c (revision 374095) +++ main/dsp.c (working copy) @@ -146,7 +146,7 @@ #define MAX_DTMF_DIGITS 128 -/* Basic DTMF specs: +/* Basic DTMF (AT&T) specs: * * Minimum tone on = 40ms * Minimum tone off = 50ms @@ -161,12 +161,18 @@ #define DTMF_THRESHOLD 8.0e7 #define FAX_THRESHOLD 8.0e7 #define FAX_2ND_HARMONIC 2.0 /* 4dB */ -#define DTMF_NORMAL_TWIST 6.3 /* 8dB */ + +#define DEF_DTMF_NORMAL_TWIST 6.31 /* 8.0dB */ +#define DEF_RELAX_DTMF_NORMAL_TWIST 6.31 /* 8.0dB */ + #ifdef RADIO_RELAX -#define DTMF_REVERSE_TWIST (relax ? 6.5 : 2.5) /* 4dB normal */ +#define DEF_DTMF_REVERSE_TWIST 2.51 /* 4.01dB */ +#define DEF_RELAX_DTMF_REVERSE_TWIST 6.61 /* 8.20dB */ #else -#define DTMF_REVERSE_TWIST (relax ? 4.0 : 2.5) /* 4dB normal */ +#define DEF_DTMF_REVERSE_TWIST 2.51 /* 4.01dB */ +#define DEF_RELAX_DTMF_REVERSE_TWIST 3.98 /* 6.00dB */ #endif + #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 */ @@ -307,6 +313,11 @@ static const char bell_mf_positions[] = "1247C-358A--69*---0B----#"; static int thresholds[THRESHOLD_MAX]; +static float dtmfnormaltwist; /* AT&T 8dB */ +static float dtmfreversetwist; /* AT&T 4dB */ +static float relaxdtmfnormaltwist; /* AT&T 8dB */ +static float relaxdtmfreversetwist; /* AT&T 6dB */ + static inline void goertzel_sample(goertzel_state_t *s, short sample) { int v1; @@ -709,8 +720,8 @@ /* Basic signal level test and the twist test */ if (row_energy[best_row] >= DTMF_THRESHOLD && col_energy[best_col] >= DTMF_THRESHOLD && - col_energy[best_col] < row_energy[best_row] * DTMF_REVERSE_TWIST && - col_energy[best_col] * DTMF_NORMAL_TWIST > row_energy[best_row]) { + col_energy[best_col] < row_energy[best_row] * (relax ? relaxdtmfreversetwist : dtmfreversetwist) && + col_energy[best_col] * (relax ? relaxdtmfnormaltwist : dtmfnormaltwist) > row_energy[best_row]) { /* Relative peak test */ for (i = 0; i < 4; i++) { if ((i != best_col && @@ -1741,6 +1752,10 @@ if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEINVALID) { ast_verb(5, "Can't find dsp config file %s. Assuming default silencethreshold of %d.\n", CONFIG_FILE_NAME, DEFAULT_SILENCE_THRESHOLD); thresholds[THRESHOLD_SILENCE] = DEFAULT_SILENCE_THRESHOLD; + dtmfnormaltwist = DEF_DTMF_NORMAL_TWIST; + dtmfreversetwist = DEF_DTMF_REVERSE_TWIST; + relaxdtmfnormaltwist = DEF_RELAX_DTMF_NORMAL_TWIST; + relaxdtmfreversetwist = DEF_RELAX_DTMF_REVERSE_TWIST; return 0; } @@ -1759,6 +1774,38 @@ thresholds[THRESHOLD_SILENCE] = DEFAULT_SILENCE_THRESHOLD; } + value = ast_variable_retrieve(cfg, "default", "dtmfnormaltwist"); + if (value && sscanf(value, "%30f", &dtmfnormaltwist) != 1) { + ast_verb(5, "%s: '%s' is not a valid dtmfnormaltwist value\n", CONFIG_FILE_NAME, value); + dtmfnormaltwist = DEF_DTMF_NORMAL_TWIST; + } else if (!value) { + dtmfnormaltwist = DEF_DTMF_NORMAL_TWIST; + } + + value = ast_variable_retrieve(cfg, "default", "dtmfreversetwist"); + if (value && sscanf(value, "%30f", &dtmfreversetwist) != 1) { + ast_verb(5, "%s: '%s' is not a valid dtmfreversetwist value\n", CONFIG_FILE_NAME, value); + dtmfreversetwist = DEF_DTMF_REVERSE_TWIST; + } else if (!value) { + dtmfreversetwist = DEF_DTMF_REVERSE_TWIST; + } + + value = ast_variable_retrieve(cfg, "default", "relaxdtmfnormaltwist"); + if (value && sscanf(value, "%30f", &relaxdtmfnormaltwist) != 1) { + ast_verb(5, "%s: '%s' is not a valid relaxdtmfnormaltwist value\n", CONFIG_FILE_NAME, value); + relaxdtmfnormaltwist = DEF_RELAX_DTMF_NORMAL_TWIST; + } else if (!value) { + relaxdtmfnormaltwist = DEF_RELAX_DTMF_NORMAL_TWIST; + } + + value = ast_variable_retrieve(cfg, "default", "relaxdtmfreversetwist"); + if (value && sscanf(value, "%30f", &relaxdtmfreversetwist) != 1) { + ast_verb(5, "%s: '%s' is not a valid relaxdtmfreversetwist value\n", CONFIG_FILE_NAME, value); + relaxdtmfreversetwist = DEF_RELAX_DTMF_REVERSE_TWIST; + } else if (!value) { + relaxdtmfreversetwist = DEF_RELAX_DTMF_REVERSE_TWIST; + } + ast_config_destroy(cfg); } return 0;