Intel 05-1832-002 IP Phone User Manual


 
Voice API for Windows Operating Systems Library Reference — November 2003 345
record voice data to a single file — dx_recf( )
/* Use dx_rec() to do the record */
iott.io_type = IO_EOT | IO_DEV;
iott.io_offset = (long)0;
iott.io_length = -1;
rval = dx_rec(devd,&iott,tptp,mode);
if (close(iott.io_fhandle) == -1) {
return -1;
}
return rval;
}
!
!!
! Example
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
main()
{
int chdev;
long termtype;
DV_TPT tpt[2];
/* Open the channel using dx_open( ). Get channel device descriptor in
* chdev
*/
if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) {
/* process error */
}
/* Set the DV_TPT structures up for MAXDTMF and MAXSIL */
dx_clrtpt(tpt,2);
tpt[0].tp_type = IO_CONT;
tpt[0].tp_termno = DX_MAXDTMF; /* Maximum digits */
tpt[0].tp_length = 1; /* terminate on the first digit */
tpt[0].tp_flags = TF_MAXDTMF; /* Use the default flags */
/*
* If the initial silence period before the first non-silence period
* exceeds 4 seconds then terminate. If a silence period after the
* first non-silence period exceeds 2 seconds then terminate.
*/
tpt[1].tp_type = IO_EOT; /* last entry in the table */
tpt[1].tp_termno = DX_MAXSIL; /* Maximum silence */
tpt[1].tp_length = 20; /* terminate on 2 seconds of
* continuous silence */
tpt[1].tp_flags = TF_MAXSIL|TF_SETINIT; /* Use the default flags and
* initial silence flag */
tpt[1].tp_data = 40; /* Allow 4 seconds of initial
* silence */
if (
dx_recf(chdev,"weather.vox",tpt,RM_TONE)
== -1) {
/* process error */
}
termtype = ATDX_TERMMSK(chdev); /* investigate termination reason */
if (termtype & TM_MAXDTMF) {
/* process DTMF termination */
}
. . .
}