
Description | Cautions | Example | Errors | See Also
Name: |
dx_mreciottdata (devd, iotp, tptp, xpb, mode, sc_tsinfop) | |
Inputs: |
int devd |
|
DX_IOTT *iotp |
| |
DV_TPT *tptp |
| |
DX_XPB *xpb |
| |
USHORT *mode |
| |
*sc_tsinfop |
| |
Returns: |
0 success | |
-1 error return code | ||
Includes: |
srllib.h | |
dxxxlib.h | ||
Category: |
I/O | |
Mode: |
synchronous | |
The dx_mreciottdata( ) function records voice data from two SCbus time slots. The data may be recorded to a combination of data files, memory or custom devices.
The Transaction Record feature allows you to record two SCbus time slots from a single channel. Voice activity on two channels can be summed and stored in a single file, device, and/or memory.
This function has the following parameters:
Parameter |
Description | |
devd |
Specifies the valid Dialogic voice channel descriptor on which the recording is to occur. The channel descriptor may be that associated with either of the two SCbus transmit time slots or a third device also connected to the SCbus. | |
iotp |
Pointer to the I/O Transfer Table Structure, DX_IOTT. Specifies the order of the voice data and the media on which it will be recorded. | |
tptp |
Points to the Termination Parameter Table Structure, DV_TPT, which specifies the termination conditions for recording. See the chapter on Data Structures for more information. | |
xpb |
Points to a DX_XPB structure and specifies parameter values for I/O data transfer. See the chapter on Data Structures for more information. | |
mode |
Specifies the attributes of the recording mode. One or more of the following values can be specified: | |
0 |
standard play mode | |
RM_TONE |
Transmits a 200ms tone before initiating record. If this mode is not selected, no tone is transmitted (default). | |
sc_tsinfop |
Points to an SC_TSINFO structure and specifies the SCbus transmit time slot values of the two time slots being recorded. | |
The structure for SC_TSINFO is as follows:
typedef struct {
unsigned long sc_numts: /* Number of time slots in array */
long *sc_tsarrayp: /* Pointer to array of SCbus time slots */
}SC_TSINFO;
where sc_numts should be set to 2 for channel recording and sc_tsarrayp should point to an array of two long integers, specifying the two SCbus transmit time slots from which to record.
After dx_mreciottdata( ) is called, recording continues until one of the following occurs:
#include <windows.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <srllib.h>
#include <dxxxlib.h>
#define MAXLEN 10000
main()
{
int devh1, devh2, devh3;
short fd;
DV_TPT tpt;
DX_IOTT iott[2];
DX_XPB xpb;
SC_TSINFO tsinfo;
long scts;
long tslots[32];
char basebufp[MAXLEN];
/* open two voice channels */
if ((devh1 = dx_open("dxxxB1C1", NULL)) == -1) {
printf("Could not open dxxxB1C1\n");
exit (1);
}
if ((devh2 = dx_open("dxxxB1C2", NULL)) == -1) {
printf("Could not open dxxxB1C2\n");
exit (1);
}
if ((devh3 = dx_open("dxxxB1C3", NULL)) == -1) {
printf("Could not open dxxxB1C2\n");
exit (1);
}
if ((fd = dx_fileopen("file.vox", O_CREAT | O_RDWR | O_BINARY)) == -1){
printf("File open error\n");
exit (1);
}
/*
* Get channels' external time slots
* and fill in tslots[] array
*/
tsinfo.sc_numts = 1;
tsinfo.sc_tsarrayp = &scts;
if (dx_getxmitslot (devh1, &tsinfo) == -1 ){ /* Handle error */ }
tslots[0] = scts;
if (dx_getxmitslot (devh2, &tsinfo) == -1 ) { /* Handle error */ }
tslots[1] = scts;
/* Set up SC_TSINFO structure */
tsinfo.sc_numts = 2;
tsinfo.sc_tsarrayp = &tslots[0];
/* Set up DX_XPB structure */
xpb.wFileFormat = FILE_FORMAT_VOX;
xpb.wDataFormat = 0;
xpb.nSamplesPerSec = 0L;
xpb.wBitsPerSample = 0;
/*Set up DV_TPT structure */
dx_clrtpt (&tpt,1);
tpt.tp_type = IO_EOT;
tpt.tp_termno = DX_MAXDTMF;
tpt.tp_length = 1;
tpt.tp_flags = TF_MAXDTMF;
/* Set up DX_IOTT structure */
iott[0].io_fhandle = fd;
iott[0].io_type = IO_DEV;
iott[0].io_offset = 0;
iott[0].io_length = MAXLEN;
iott[0].io_offset = IO_EOT;
/* And record from both voice channels */
if (dx_mreciottdata(devh3, &iott[0], &tpt, &xpb, RM_TONE, &tsinfo) == -1) {
printf("Error recording from dxxxB1C1 and dxxxB1C2\n");
printf("error = %s\n", ATDV_ERRMSGP(devh1));
exit(2);
}
/* Display termination condition value */
printf ("The termination value = %d\n", ATDX_TERMMSK(devh1));
/* And close three voice channels */
if (dx_close(devh3) == -1){
printf("Error closing devh3 \n");
/* Perform system error processing */
exit(3);
}
if (dx_close(devh2) == -1) {
printf("Error closing devh2\n");
/* Perform system error processing */
exit (3);
}
if (dx_close(devh1) == -1) {
printf("Error closing devh1\n");
/* Perform system error processing */
exit (3);
}
if (dx_fileclose(fd) == -1){
printf("File close error \n");
exit(1);
}
/* And finish */
return;
}
If this function returns -1 to indicate failure, use ATDV_LASTERR and ATDV_ERRMSGP to retrieve one of the following error reasons:
EDX_BADDEV |
Invalid device handle |
EDX_BADIOTT |
Invalid DX_IOTT entry |
EDX_BADPARM |
Invalid parameter passed |
EDX_BADTPT |
Invalid DV_TPT entry |
EDX_BUSY |
Busy executing I/O function |
EDX_SYSTEM |
Error from operating system; use dx_fileerrno( ) to obtain error value |
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation