
Description | Cautions | Example | Errors | See Also
Name: |
short dx_reciottdata(chdev, iottp, tptp, xpbp, mode) | |
Inputs: |
int chdev |
|
DX_IOTT *iottp |
| |
DV_TPT *tptp |
| |
DX_XPB*xpbp |
| |
unsigned short mode |
| |
Returns: |
| |
| ||
Includes: |
| |
dxxxlib.h | ||
Category: |
I/O function | |
Mode: |
synchronous or asynchronous | |
The dx_reciottdata( ) function records voice data to multiple destinations, a combination of data files, memory, or custom devices
Parameter |
Description |
chdev |
channel device descriptor. |
iottp |
Pointer to DX_IOTT table that specifies the order and media onto which the voice data will be recorded. |
tptp |
pointer to Termination Parameter Table structure |
xpbp |
pointer to I/O transfer parameter block |
mode |
specifies the record mode: PM_TONE play 200 ms audible tone |
#include "srllib.h"
#include "dxxxlib.h"
int chdev; /* channel descriptor */
int fd; /* file descriptor for file to be played */
DX_IOTT iott; /* I/O transfer table */
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;
/* Open file */
if ((fd = dx_fileopen("MESSAGE.VOX",O_RDWR|O_BINARY)) == -1) {
printf("File open error\n");
exit(2);
}
/* 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 PCM at 8KHz.
*/
xpb.wFileFormat = FILE_FORMAT_VOX;
xpb.wDataFormat = DATA_FORMAT_PCM;
xpb.nSamplesPerSec = DRT_8KHZ;
xpb.wBitsPerSample = 8;
/* 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);
}
/* Play intro message */
if (dx_playwav(chdev,"HELLO.WAV",&tpt,EV_SYNC) == -1) {
printf("Error playing file - %s\n", ATDV_ERRMSGP(chdev));
exit(4);
}
/* Start recording */
if (dx_reciottdata(chdev,&iott,&tpt,&xpb,PM_TONE|EV_SYNC) == -1) {
printf("Error recording file - %s\n", ATDV_ERRMSGP(chdev));
exit(4);
}
In asynchronous mode, function returns immediately and a TDX_RECORD event is queued upon completion. Check ATDX_TERMMSK( ) for the termination reason. If a failure occurs, then a TDX_ERROR event will be queued. Use ATDV_LASTERR( ) to determine the reason for error.
In synchronous mode, 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