174 Voice API Programming Guide — June 2005
Global Dial Pulse Detection /* 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
*/