
Description | Example | Errors | See Also
Name: |
int dx_recf(chdev,fnamep,tptp,mode) | |
Inputs: |
int chdev |
|
char *fnamep |
| |
DV_TPT *tptp |
| |
unsigned short mode |
| |
Returns: |
0 if success | |
-1 if failure | ||
Includes: |
srllib.h | |
dxxxlib.h | ||
Category: |
Convenience | |
Mode: |
synchronous | |
The dx_recf( ) function permits voice data to be recorded from a channel to a single file. dx_recf( ) performs the same as synchronous dx_rec( ) does with a DX_IOTT structure that specified a single file. dx_recf( ) is provided as a convenient method for recording to one file without having to specify a DX_IOTT structure. dx_recf( ) opens and closes the file pointed to by fnamep while dx_rec( ) uses a DX_IOTT structure that requires the application to open the file.
Parameter |
Description |
fnamep |
points to the file from to which voice data will be recorded. |
For information about other function arguments and other function information, see dx_rec( ).
#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 */
}
. . .
}
If this function returns -1 to indicate failure, use ATDV_LASTERR( ) and ATDV_ERRMSGP( ) to retrieve one of the following error reasons:
EDX_BADPARM |
Invalid Parameter |
EDX_BADIOTT |
Invalid DX_IOTT entry |
EDX_BADTPT |
Invalid DX_TPT entry |
EDX_BUSY |
Busy executing I/O function |
EDX_SYSTEM |
Error from operating system; use dx_fileerrno( ) to obtain error value |
Related Functions:
Setting and Handling Record Termination:
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation