Using the Generic Tone Detector
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:
1. Get input parameters and scale them appropriately
2. Call
DivaDetectSingleTone to 'arm' the GTD
3. Process
DivaEventGenericToneDetected messages, which arrive asynchronously
4.
DivaGetToneDetectorResult is used to retrieve the actual values associated with the GTD event
Note that 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 that some of the parameters need scaling (MinSNR, MinLevel, MaxAM), and that MaxAM and MaxFM are unsigned (DWORD) rather than integers.
MinDuration = inputMinDuration;
MinSNR = inputMinSNR * 256;
MinLevel = inputMinLevel * 256;
MaxAM = inputMaxAM * 256;
MaxFM = inputMaxFM;
result = DivaDetectSingleTone(call->handle, DivaSingleToneReportAll,
MinDuration, MinSNR, MinLevel,
MaxAM, MaxFM);
if(result==DivaSuccess)
{
Log( "GTD (Single) started ok" );
}
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.
First published: 24-Sep-2008
Open access: Product rule: ; Page rule: Auto