Voice API Programming Guide — June 2005 173
Global Dial Pulse Detection
14.9 Global DPD Programming ProcedureUse the following procedure to implement global DPD:
1. Define a data structure of type DV_DIGIT (this structure is specified in the DXDIGIT.H file).
2. Enable DPD on the desired channels using the dx_setdigtyp( ) function. For new calls you
must use the D_DPDZ mask that initializes the DPD detector for new calls.
3. Execute the dx_getdig( ) function to collect and transfer the digits to the user’s digit buffer.
The digits are stored in the dg_value field of the DV_DIGIT structure with the corresponding
digit types stored in the dg_type field of the DV_DIGIT structure.
14.10 Global DPD Example CodeThe following example illustrates how to set up and use global DPD. The code uses the
synchronous model.
/*$ dx_setdigtyp( )and dx_getdig( ) example for global dial pulse detection $*/
#include <stdio.h>
#include "srllib.h"
#include "dxxxlib.h"
void main(int argc, char **argv)
{
int dev; /* Dialogic device handle */
DV_DIGIT dig;
DV_TPT tpt;
/*
* Open device, make or accept call
*/
/* set up TPT to wait for 3 digits and terminate */
dx_clrtpt(&tpt, 1);
tpt.tp_type = IO_EOT;
tpt.tp_termno = DX_MAXDTMF;
tpt.tp_length = 3;
tpt.tp_flags = TF_MAXDTMF;
Defines for dg_type from
Digit Type Digit Buffer Event Queue
DTMF DG_DTMF_ASCII DG_DTMF
DPD DG_DPD_ASCII DG_DPD
MF DG_MF_ASCII DG_MF
GTD DG_USER1_ASCII DG_USER1
(user-defined) DG_USER2_ASCII DG_USER2
DG_USER3_ASCII DG_USER3
DG_USER4_ASCII DG_USER4
DG_USER5_ASCII DG_USER5