Using the Generic Tone Detector
Overview
The Dialogic Diva generic tone detector (GTD) is a feature of Dialogic® Diva® Media Boards with DSPs that allows an application to detect either a single tone or a pair of tones (such as MF or DTMF) on the line. Tones will be reported if they meet the criteria that you have specified including:
Minimum duration
Frequency variation
Amplitude variation
Signal to noise ratio
The tone-on messages report the exact frequency of the tone, and the tone-off message will allow measurement of the exact duration, if desired.
Note that GTD is a feature built-in to DSP-equipped Diva Media Boards, and thus does not apply to the Dialogic Diva SDK when used with Dialogic Host Media Processing (HMP) Software, Dialogic Diva softIP or Diva Media Boards without DSPs (such as Dialogic Diva PRI-CTI Media Boards).
Basic procedure
Get input parameters and scale them appropriately
CallÂ
DivaDetectSingleTone to 'arm' the GTD
ProcessÂ
DivaEventGenericToneDetected messages, which arrive asynchronously
Â
DivaGetToneDetectorResult is used to retrieve the actual values associated with the GTD event
NOTE
Once they are 'armed', the GTD will continue to send DivaEventGenericToneDetected events for every tone that matches the criteria you have set.
Â
Example:
int  inputMinDuration=80;  // ms
int  inputMinSNR=18;       // dB
int  inputMinLevel=-30;    // dB
int  inputMaxAM=1;         // dB
int  inputMaxFM=80;        // Hz
Â
// Actual parameters as sent to DivaDetectSingleTone
DWORD MinDuration;
int  MinSNR;
int  MinLevel;
DWORD MaxAM;
DWORD MaxFM; |
NOTE
one of the parameters need scaling (MinSNR, MinLevel, MaxAM), and that MaxAM and MaxFM are unsigned (DWORD) rather than integers.
Now, there needs to be a handler for DivaEventGenericToneDetected:
result = DivaGetToneDetectorResult ( call->handle, &ToneResult );
  if(result == DivaSuccess)
  {
     if(ToneResult.Type==DivaSingleToneStart)
     {
       Log("GTD Tone On: f=%d, SNR=%d, A=%d",
        ToneResult.Tone.Single.Frequency,
        ToneResult.Tone.Single.SignalNoiseRatio / 256,
        ToneResult.Tone.Single.Energy / 256
                );
     }
     else if(ToneResult.Type==DivaSingleToneStop)
     {
       Log("Tone Off",duration);
     }
  } |
Â
The same procedure works for current Diva Media Boards with Blackfin DSPs as well as earlier Diva Media Boards equipped with 21xx DSPs. However, you should use the latest versions of Dialogic Diva System Release Software and the Dialogic Diva SDK.
More information on the workings of GTD can be found in the CxTone.pdf document, included in the documentation directory of the Dialogic Diva SDK install.