172 Voice API Programming Guide — June 2005
Global Dial Pulse Detection
14.6 Retrieving Digits as Events
To get the digits as events, use the following asynchronous programming model using the
dx_setevtmsk(), sr_waitevt( ), and sr_getevtdatap( ) functions and the DX_CST data structure.
1. Since the supported voice boards come with channels capable of global DPD, you must enable
DPD on the desired channels using the dx_setdigtyp( ) function.
2. For each new connection, use dx_setdigtyp( ) with the D_DPDZ mask, which initializes the
DPD algorithm. After collecting the first DPD digit string, the mask can be set to D_DPD for
the remainder of that connection. Each subsequent invocation of dx_setdigtyp( ) must use the
D_DPD mask.
3. Use dx_setevtmsk( ) to enable digit detection.
4. Use sr_waitevt( ) to wait for events.
5. When a CST event occurs, use sr_getevtdatap( ) to retrieve the pointer to the DX_CST
structure.
6. The cst_data field (DX_CST structure) for a DE_DIGITS event contains an ASCII digit (low
byte) and the digit type (high byte). For more information, see the DX_CST structure in the
Voice API Library Reference.
14.7 Dial Pulse Detection Digit Type Reporting
Two defines are provided for identifying the dial pulse detection digit type, depending upon how
the digit type is retrieved:
DG_DPD
Dial pulse detection digit from the DX_EBLK event queue data (cst_data) through a
DE_DIGITS Call Status Transition event
DG_DPD_ASCII
Dial pulse detection digit from the DV_DIGIT dg_type digit buffer using dx_getdig()
Obtaining the digit type for DPD digits is valid only in the case when the voice and DPD
capabilities are both present on the same board. In the case where a voice board does not support
DPD, you cannot detect DPD digits or obtain the DPD digit type even though you can enable DPD
and digit type reporting without an error.
14.8 Defines for Digit Type Reporting
Use the defines as shown here to determine the digit type from the value returned in the dg_type
(digit type) field from the DV_DIGIT digit buffer. If you get the digit from the DV_DIGIT dg_type
digit buffer using dx_getdig(), yo u should use the digit type define that has the “_ASCII” suffix.
Otherwise, if you get the digit from the DX_EBLK event queue data (cst_data) through a
DE_DIGITS Call Status Transition event, you should use the digit type define without the
“_ASCII” suffix.