Previous PageTable Of Contents../index.htmlIndexNext Page

dx_getdig( )

Description | Cautions | Example 1: | Example 2: | Errors | See Also

Name:

int dx_getdig(chdev,tptp,digitp,mode)

Inputs:

int chdev

  valid Dialogic channel device handle

 

DV_TPT *tptp

  pointer to Termination Parameter Table Structure

 

DV_DIGIT *digitp

  pointer to User Digit Buffer Structure

 

unsigned short mode

  asynchronous/synchronous setting

Returns:

0 to indicate successful initiation (asynchronous)

 

number of digits (+1 for NULL) if successful (synchronous)

 

-1 if failure

Includes:

srllib.h

 

dxxxlib.h

Category:

I/O

Mode:

synchronous/asynchronous

Top Of PageDescription

The dx_getdig( ) function collects digits from a channel digit buffer. Upon termination of the function, the collected digits are written in ASCIIZ format into the local buffer, which is arranged as a DV_DIGIT structure.

The type of digits collected depends on the digit detection mode set by the dx_setdigtyp( ) function (for standard Voice board digits) or by the dx_addtone( ) function (for user-defined digits).

See dx_setdigtyp( ) and dx_addtone( ) and the DV_DIGIT structure in chapter on Data Structures for more information.

Set termination conditions using the DV_TPT structure. This structure is pointed to by the tptp parameter described below.

Asynchronous Operation

To run this function asynchronously set the mode field to EV_ASYNC. When running asynchronously, this function will return 0 to indicate it has initiated successfully, and will generate a TDX_GETDIG termination event to indicate completion. Use the SRL Event Management functions to handle the termination event.

Termination of asynchronous digit collection is indicated by a TDX_GETDIG event. After dx_getdig( ) terminates, use the ATDX_TERMMSK( ) function to determine the reason for termination.

Synchronous Operation

By default, this function runs synchronously. Termination of synchronous digit collection is indicated by a return value greater than 0 that represents the number of digits received (+1 for NULL). Use ATDX_TERMMSK( ) to determine the reason for termination.

The function parameters are defined as follows:

Parameter

Description

chdev

specifies the valid channel device handle obtained when the channel was opened using dx_open( ).

tptp

points to the Termination Parameter Table Structure, DV_TPT, which specifies termination conditions for this function. Termination conditions are listed below:

 

DX_DIGTYPE

  • User-defined digits
 

DX_MAXDTMF

  • Maximum number of digits received
 

DX_MAXSIL

  • Maximum silence
 

DX_MAXNOSIL

  • Maximum non-silence
 

DX_LCOFF

  • Loop current off
 

DX_IDDTIME

  • Inter-digit delay
 

DX_MAXTIME

  • Function time
 

DX_DIGMASK

  • Digit mask termination
 

DX_PMOFF

  • Pattern match silence off
 

DX_PMON

  • Pattern match silence on
 

DX_TONE

  • Tone-off or Tone-on detection

digitp

points to the User's Digit Buffer Structure, , where collected digits and their types are stored in arrays. The digit types in DV_DIGIT can be one of the following:

 

DG_DTMF

  • DTMF digit
 

DG_MF

  • MF digit
 

DG_USER1

  • User-defined digit
 

DG_USER2

  • User-defined digit
 

DG_USER3

  • User-defined digit
 

DG_USER4

  • User-defined digit
 

DG_USER5

  • User-defined digit
 

Refer to the DV_DIGIT structure in the chapter on Data Structures for details.

 

See dx_addtone( ) for information about creating user-defined digits.

mode

specifies whether to run dx_getdig( ) asynchronously or synchronously. Specify one of the following:

 

EV_ASYNC:

Run dx_getdig( ) asynchronously.

 

EV_SYNC:

Run dx_getdig( ) synchronously (default).

The channel's digit buffer contains up to 31 digits, collected on a First-In
First-Out (FIFO) basis. Since the digits remain in the channel's digit buffer until they are overwritten or cleared using dx_clrdigbuf( ), the digits in the channel's buffer may have been received prior to this function call. DG_MAXDIGS is the define for the maximum number of digits that can be returned by a single call to dx_getdig( ).

NOTE:
By default, after the 31st digit, all subsequent digits will be discarded. You can use the dx_setdigbuf( ) function with the mode parameter set to DX_DIGCYCLIC, which will cause all incoming digits to overwrite the oldest digit in the buffer. See the dx_setdigbuf( ) function.

Top Of PageCautions

    1. Some MF digits use approximately the same frequencies as DTMF digits (see Appendix C). Because there is a frequency overlap, if you have the incorrect kind of detection enabled, MF digits may be mistaken for DTMF digits, and vice versa. To ensure that digits are correctly detected, only one kind of detection should be enabled at any time. To set MF digit detection, use the dx_setdigtyp( ) function.
    2. A digit that is set to adjust play-speed or play-volume (using dx_setsvcond( )) will not be passed to dx_getdig( ), and will not be used as a terminating condition. If a digit is defined to adjust play and to terminate play, then the play adjustment will take priority.
    3. When operating asynchronously, ensure that the digit buffer stays in scope for the duration of the function.
    4. The channel must be idle, or the function will return an EDX_BUSY error.
    5. If the function is operating synchronously and there are no digits in the buffer, the return value from this function will be 1, which indicates the NULL terminator.

Top Of PageExample 1: Using dx_getdig( ) in synchronous mode

Top Of PageExample 2: Using dx_getdig( ) in asynchronous mode

Top Of PageErrors

If this function returns -1 to indicate failure, use ATDV_LASTERR( ) and ATDV_ERRMSGP( ) to retrieve one of the following error reasons:

EDX_BADPARM

  • Invalid Parameter

EDX_BADTPT

  • Invalid DV_TPT entry

EDX_BUSY

  • Channel busy

EDX_SYSTEM

Top Of PageSee Also

Setting User-Defined Digits:

Collecting Digits:


Previous PageTable Of ContentsTop Of PageIndexNext Page

Click here to contact Dialogic Customer Engineering

Copyright 2002, Dialogic Corporation
All rights reserved
This page generated February, 2002