Asterisk / chan_capi - DTMF detection issue
Issue
In certain scenarios DTMF digits may not be properly recognized because the DTMF tones are too short.
By default, Asterisk issues DTMF listen commands with a 80 ms Minimum Tone Time and 80 ms Minimum Gap Time.
During sending and receiving chan_capi uses the same hard coded values.
chan_capi.h, #define CAPI_DTMF_DURATION 0x50
Note:Â 50Â hex = 80 decimal
Solution/Workaround
This following describes how the DTMF duration can be modified in order to address such issues.
 The fastest way to achieve the desired changes would be to modify the chan_capi sources as follows:
cd /usr/lib/opendiva/divas/src/src
mkdir chancapi
tar -zxvf chancapi.tgz -C chancapi
cd chancapi
 Now open the file chan_capi.c and search for "Setting up DTMF detector". Immediately below the values can be adjusted. Here you can configure new values according to your needs.
e.g.
#define CAPI_DTMF_MIN_TONE_DURATION 60 #define CAPI_DTMF_MIN_GAP_DURATION 80 error = capi_sendf(i, 0, CAPI_FACILITY_REQ, i->PLCI, get_capi_MessageNumber(),
"w(www()())",
((i->channeltype != CAPI_CHANNELTYPE_NULL) || (i->line_plci != 0)) ? FACILITYSELECTOR_DTMF : PRIV_SELECTOR_DTMF_ONDATA,
(flag == 1) ? 1:2, /* start/stop DTMF listen */
CAPI_DTMF_MIN_TONE_DURATION,
CAPI_DTMF_MIN_GAP_DURATION
);
In general the settings in this example should be sufficient. There are only rare cases where different settings are needed.
Â