Intel 05-1832-002 IP Phone User Manual


 
Voice API for Windows Operating Systems Library Reference — November 2003 313
play back recorded voice data from multiple sources — dx_playiottdata( )
/* Set up DX_IOTT */
iott.io_fhandle = fd;
iott.io_bufp = 0;
iott.io_offset = 0;
iott.io_length = -1;
iott.io_type = IO_DEV | IO_EOT;
/*
* Specify VOX file format for ADPCM at 8KHz
*/
xpb.wFileFormat = FILE_FORMAT_VOX;
xpb.wDataFormat = DATA_FORMAT_DIALOGIC_ADPCM;
xpb.nSamplesPerSec = DRT_8KHZ;
xpb.wBitsPerSample = 4;
/* Wait forever for phone to ring and go offhook */
if (dx_wtring(chdev,1,DX_OFFHOOK,-1) == -1) {
printf("Error waiting for ring - %s\n", ATDV_LASTERR(chdev));
exit(3);
}
/* Start playback */
if
(dx_playiottdata(chdev,&iott,&tpt,&xpb,EV_SYNC)==-1)
{
printf("Error playing file - %s\n", ATDV_ERRMSGP(chdev));
exit(4);
}
}
!
!!
! Example 2
This example illustrates how to play back a cached prompt (VOX file) that has already been
downloaded to on-board memory.
#include "srllib.h"
#include "dxxxlib.h"
#include <stdio.h>
#include <fcntl.h>
main()
{
int chdev; /* channel descriptor */
int brdhdl; /* board handle */
int promptHandle; /* Handle of the prompt to be downloaded */
int fd; /* file descriptor for file to be played */
DX_IOTT iott; /* I/O transfer table for the play operation*/
DX_IOTT iottp; /* I/O transfer table for the downloaded cache prompt*/
DV_TPT tpt; /* termination parameter table */
DX_XPB xpb; /* I/O transfer parameter block */
/* Open channel */
if ((chdev = dx_open("dxxxB1C1",0)) == -1) {
printf("Cannot open channel\n");
/* Perform system error processing */
exit(1);
}
/* Open board */
if ((brdhdl = dx_open("brdB1",0)) == -1) {
printf("Cannot open board\n");
/* Perform system error processing */
exit(1);
}