Technical Helpweb

- more articles

Ways to Process Incoming DTMF in the Diva SDK

There are three distinct APIs included in the Dialogic® Diva® SDK: the Dialogic® Diva® API (for "C" and C++), the Dialogic® Diva® Component API (for VB and VB.NET), and the Dialogic® Diva® API for .Net (Diva C# Framework) (for C#.Net). 

There are differences in the functions available for DTMF processing in the different APIs.

C, C++ and C#

In the Diva API and the Diva API for .Net C# Framework there is a high-level function DivaSetDTMFProcessingRules.

Note that in the Diva C# Framework, the functions and their associated events omit the 'Diva' at the start of the name. 

DivaSetDTMFProcessingRules allows you to collect a number of DTMF digits in one operation, while applying various timers.

The end of the collection operation is marked by an event (one of DivaEventDTMFMaxDigits, DivaEventDTMFTerminationDigit, DivaEventDTMFInterDigitTimeout, DivaEventDTMFInitialDigitTimeout, or DivaEventDTMFMaxTimeout). Many of the events return the number of DTMF digits in the buffer.

Once an event is received, you may read the digits from the DTMF buffer with DivaGetDTMFBuffer. Clearing the buffer is done with DivaClearDTMFBuffer.

In the C# Framework, the events are received by overriding the default handlers:
OnDTMFMaxDigits, OnDTMFTerminationDigit, OnDTMFInterDigitTimeout, OnDTMFInitialDigitTimeout, OnDTMFMaxTimeout.  In addition, reading the digits and clearing the buffer are performed using GetDTMFBuffer and ClearDTMFBuffer.

Note: DivaSetDTMFProcessingRules
does not exist in the Diva Component API (for VB and VB.NET).


DTMF Events

Note that in the Diva C# Framework, functions and their associated events omit the 'Diva' at the start of the name.

If DTMF is enabled (DivaReportDTMF is called with TRUE), then your application will receive an event for each DTMF digit seen, DivaEventDTMFReceived. The events are received in realtime as they are decoded by the board.

In your callback handler for the DivaEventDTMFReceived, you can process these digits as you wish, storing them in a buffer, or processing them in realtime.

In the Diva C# Framework, the function is called ReportDTMF  and you need to override the OnDTMFReceived  handler with your own method.

The same functionality exists in the Diva Component API (for VB and VB.NET).

DTMF reporting is switched on with

callobj.EnableDigitDetection = True


and then each DTMF event is sent to the tone event handler, which is declared like this:

Sub CallObj_OnToneReceived(ByVal tone As Byte) Handles CallObj.OnToneReceived


Synchronous Functions (Blocking Mode – Diva Component API only)

In the Diva Component API, VB and VB.NET applications can use blocking functions that use an internal buffer in the Diva SDK.

GetDigits can wait for a specified number of digits to be pressed, also applying timers. The buffer is cleared with ClearDetectedDigits.

SendVoiceFilesEx combines sending a voice prompt with waiting for a single DTMF tone.

RecordVoiceFile combines recording audio from the user with waiting for a DTMF tone. The allowable tones are provided as a string.


See also:
Processing Received DTMF Using DivaSetDTMFProcessingRules


Feedback

Please rate the usefulness of this page:  
0 - not useful at all
1 - potentially useful
2 - quite useful
3 - very useful
4 - exactly the information I needed     

Please enter a comment about this page:

First published: 19-Sep-2008
Open access: Product rule: ; Page rule: Auto

Service Center Logon