SDK: Change DTMF detection sensitivity
When you are processing inbound DTMF in a Diva SDK application, normally the sensitivity of the DTMF detection is set with some default values when you execute the DivaReportDTMF function. The default values are 80ms for the minimum duration of DTMF tones, and 40ms for the gap between successive DTMF tones.
In some cases it is necessary to change these values to 'tune' the recognition to work better with some DTMF sources. In CAPI, this is done using a FACILITY request, but in the Diva SDK it is done using the DivaSetCallProperties function. An example function is show below:
BOOL ChangeDTMFParameters( DivaCallHandle ch, DWORD duration, DWORD gap )
{
DivaCallPropertyValue v;
DWORD ret;
v.VoiceDTMF_DetectDuration = duration;
ret = DivaSetCallProperties( ch, DivaCPT_VoiceDTMF_DetectDuration, &v,
sizeof(v.VoiceDTMF_DetectDuration));
if(ret!=DivaSuccess)
return FALSE;
v.VoiceDTMF_DetectPause = gap;
ret = DivaSetCallProperties( ch, DivaCPT_VoiceDTMF_DetectPause, &v,
sizeof(v.VoiceDTMF_DetectPause));
if(ret==DivaSuccess)
return TRUE;
else
return FALSE;
}
So to use this function, you might make a call like so:
ret = ChangeDTMFParameters( ch, 79, 39 );
You can see the two DivaSetCallProperties calls being executed, if you look at the Diva SDK trace (set with CONFIG.EXE from the SDK 'bin' directory):
[01/10/2005 09:02:35:054] [SDK] [Calls.cpp ] [API] [0444] DivaSetCallProperties() App: 0x007FEAB8,
.... hCall: 0x00802D60, pCall: 0x00924238, CallId: [1] PropertyType: 103
[01/10/2005 09:02:35:064] [SDK] [Calls.cpp ] [API] [0444] DivaSetCallProperties() App: 0x007FEAB8,
.... hCall: 0x00802D60, pCall: 0x00924238, CallId: [1] PropertyType: 104
Also, if you run a CAPI level trace (using the Diva Diagnostics utility) you will see that the command is ultimately translated into a FACILITY_REQ at the CAPI level, with the 79 and 39ms values being passed to the card:
9:02:35.164 X 6 CAPI20_PUT(022)
0x0000 02 00 80 80 49 00 01 01 10 00 01 00 07 01 00 4F ....I..........O
0x0010 00 27 00 00 .'..
---
FACILITY REQ AppID 0x0002 MsgNr 0x0049 NCCI: 0x00100101
Facility selector: 0x1 DTMF
Facility parameter (0x7):
Function: Start DTMF listen
Tone-Duration: 79 ms
Gap-Duration: 39 ms
DTMF-Digits (0x0):
Note that DivaSetCallProperties must be called before the DTMF reporting is enabled (e.g. before you call DivaReportDTMF) otherwise they will have no effect.
See also:DTMF, continuous and generic tones
First published: 09-Jun-2006
Last published: 16-May-2011
Open access: Product rule: ; Page rule: Auto