
Description | Cautions | Example | Errors | See Also
Name: |
SHORT dx_recwav(chdev, filenamep, tptp, xpbp, mode) | |
Inputs: |
int chdev |
|
char *filenamep |
| |
DV_TPT *tptp |
| |
DX_XPB *xpbp |
| |
unsigned short mode |
| |
Returns: |
| |
| ||
Includes: |
| |
dxxxlib.h | ||
Category: |
Convenience function | |
Mode: |
synchronous | |
The dx_recwav( ) convenience function records voice data to a single WAVE file. If xpbp is set to NULL, the function will record in 11 KHz linear 8-bit PCM. This function calls dx_reciottdata( ).
Parameter |
Description |
chdev |
channel device descriptor |
tcbp |
pointer to termination parameter table |
filenamep |
pointer to name of file to play |
xpbp |
pointer to I/O Transfer Parameter Block |
mode |
specifies the play mode: PM_TONE play 200 ms audible tone |
| |
None.
#include "srllib.h"
#include "dxxxlib.h"
int chdev; /* channel descriptor */
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);
}
/* Set to terminate play on 1 digit */
tpt.tp_type = IO_EOT;
tpt.tp_termno = DX_MAXDTMF;
tpt.tp_length = 1;
tpt.tp_flags = TF_MAXDTMF;
/* 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_playwav(chdev,"HELLO.WAV",&tpt,EV_SYNC) == -1) {
printf("Error playing file - %s\n", ATDV_ERRMSGP(chdev));
exit(4);
}
/* clear digit buffer */
dx_clrdigbuf(chdev);
/* Start 11KHz PCM recording */
if (dx_recwav(chdev,"MESSAGE.WAV", &tpt, (DX_XPB *)NULL,PM_TONE|EV_SYNC) == -1) {
printf("Error recording file - %s\n", ATDV_ERRMSGP(chdev));
exit(4);
}
If this function returns -1 to indicate failure, one of the following reasons will be contained by ATDV_LASTERR( ):
Equate |
Returned When |
EDX_BUSY |
Channel is busy |
EDX_XPBPARM |
Invalid DX_XPB setting |
EDX_BADIOTT |
Invalid DX_IOTT setting |
EDX_SYSTEM |
Error from operating system; use dx_fileerrno( ) to obtain error value. System I/O errors |
EDX_BADWAVFILE |
Invalid WAV file |
EDX_SH_BADCMD |
Unsupported command or WAV file format |
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation