Global Dial Pulse Detection uses the same Application Programming Interface (API) model as the standard DPD interface.
The Global DPD feature must be implemented on a call-by-call basis. Global DPD must be enabled for each call by calling dx_setdigtyp( ) for the Global DPD feature to work correctly.
For any digit detected, you can determine the digit type, DTMF, MF, GTD (user-defined) or DPD, by using the DV_DIGIT data structure in the application. When a dx_getdig( ) call is performed, the digits are collected and transferred to the user's digit buffer. The digits are stored as an array inside the DV_DIGIT structure. This method allows you to determine very quickly whether a pulse or DTMF telephone is being used.
4.4.1. Dial Pulse Detection Digit Type ReportingAs shown in the following table, two defines are provided for identifying the Dial Pulse Detection digit type, depending upon how the digit type is retrieved.
#define |
Digit Type |
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.
4.4.2. Defines for Digit Type ReportingSeveral can be used to obtain the DV_DIGIT dg_type (digit type) from the digit buffer. These defines contain "_ASCII" extensions as shown in the following table. If you get the digit from the DV_DIGIT dg_type digit buffer using dx_getdig( ), you 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
|
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 |
| ||
4.4.3. GDPD Programming Procedure
4.4.4. GDPD Programming Example/*$ 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
*/
/* setup 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;
/* enable DPD and DTMF digits */
dx_setdigtyp(dev, D_DPDZ|D_DTMF);
/* clear the digit buffer */
dx_clrdigbuf(dev);
/* collect 3 digits from the user */
if (dx_getdig(dev, &tpt, &dig, EV_SYNC) == -1) {
/* error, display error message */
printf("dx_getdig error %d, %s\n", ATDV_LASTERR(dev), ATDV_ERRMSGP(dev));
} else {
/* display digits received and digit type */
printf("Received \"%s\"\n", dig.dg_value);
printf("Digit type is ");
/*
* digit types have 0x30 ORed with them strip it off
* so that we can use the DG_xxx equates from the header files
*/
switch ((dig.dg_type[0] & 0x000f)) {
case DG_DTMF:
printf("DTMF\n");
break;
case DG_DPD:
printf("DPD\n");
break;
default:
printf("Unknown, %d\n", (dig.dg_type[0] &0x000f));
}
}
/*
* continue processing call
*/
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation