Intel 05-1832-002 IP Phone User Manual


 
Voice API for Windows Operating Systems Library Reference — November 2003 305
play recorded voice data — dx_play( )
/* play the data */
if
(dx_play(chdev[i],&prompt[i],&tpt,EV_ASYNC)
== -1) {
/* process error */
}
}
/* Use sr_waitevt to wait for the completion of dx_play().
* On receiving the completion event, TDX_PLAY, control is transferred
* to the handler function previously established using sr_enbhdlr().
*/
.
.
}
int play_handler()
{
long term;
/* Use ATDX_TERMMSK() to get the reason for termination. */
term = ATDX_TERMMSK(sr_getevtdev());
if (term & TM_MAXDTMF) {
printf("play terminated on receiving DTMF digit(s)\n");
} else if (term & TM_EOD) {
printf("play terminated on reaching end of data\n");
} else {
printf("Unknown termination reason: %x\n", term);
}
/* Kick off next function in the state machine model. */
.
.
return 0;
}
!
!!
! Example 3
This example illustrates how to define and play an alert tone, receive acknowledgement of the alert
tone, and use dx_play( ) to transfer ADSI data.
#include <stdio.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
int parm;
DV_TPT tpt[2];
DV_DIGIT digit;
TN_GEN tngen;
DX_IOTT iott;
main(argc,argv)
int argc;
char* argv[];
{
int chfd;
char channame[12];
parm = SR_POLLMODE;
sr_setparm(SRL_DEVICE, SR_MODEID, &parm);
/*
* Open the channel using the command line arguments as input
*/
sprintf(channame, "%sC%s", argv[1],argv[2]);
if (( chfd = dx_open(channame, NULL)) == -1) {
printf("Board open failed on device %s\n",channame);