Intel 05-1832-002 IP Phone User Manual


 
376 Voice API for Windows Operating Systems Library Reference — November 2003
dx_setdigtyp( ) — control the types of digits detected by the voice channel
/* 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
*/
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
main()
{
int chdev;
.
.
/* Open Voice channel */
if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) {
/* process error */
}
/* Set channel to detect DTMF */
if (dx_setdigtyp(chdev, DM_DTMF) == -1) {
/* error routine */
}
.
.
}
!
!!
! See Also
dx_addtone( )