To route the channels using individual SCbus routing functions, perform the following, see Figure 3:
When these functions return, full duplex communications between the two analog channels will be established.
4.2.1. Windows Sample Code for Individual SCbus Routing Functions#include <windows.h>
#include <errno.h>
#include <srllib.h>
#include <dxxxlib.h>
main()
{
int chdev1, /* D/160SC-LS voice channel handle */
chdev2; /* VFX/40ESC voice channel handle */
SC_TSINFO sc_tsinfo; /* time slot information structure */
long scts; /* SCbus time slot */
/* Open voice channel 2 on board 2 (D/160SC-LS voice channel 6). */
if ((chdev1 = dx_open("dxxxB2C2", 0)) == -1) {
printf("Cannot open channel dxxxB2C2. errno = %d", errno);
exit(1);
}
/* Open voice channel 2 on board 5 (VFX/40ESC voice channel 2). */
if ((chdev2 = dx_open("dxxxB5C2", 0)) == -1) {
printf("Cannot open channel dxxxB5C2. errno = %d", errno);
exit(1);
}
.
. Continue processing.
.
/***** SCbus routing example. *****/
/* Initialize the SC_TSINFO structure with the necessary information. */
sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &scts;
/*
* Get the SCbus time slot on which the D/160SC-LS sixth analog
* channel is transmitting.
*/
if (ag_getxmitslot(chdev1, &sc_tsinfo) == -1) {
printf("ag_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(chdev1));
exit(1);
}
/*
* Make analog channel 2 (of the VFX/40ESC board) listen to the
* SCbus time slot that the D/160SC-LS sixth analog channel is
* transmitting on.
*/
if (ag_listen(chdev2, &sc_tsinfo) == -1) {
printf("ag_listen() failed: Error message = %s", ATDV_ERRMSGP(chdev2));
exit(1);
}
/*
* Get the SCbus time slot on which the VFX/40ESC second analog
* channel is transmitting.
*/
if (ag_getxmitslot(chdev2, &sc_tsinfo) == -1) {
printf("ag_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(chdev2));
exit(1);
}
/*
* Make analog channel 6 (of the D/160SC-LS board) listen to the
* SCbus time slot that the VFX/40ESC second analog channel is
* transmitting on.
*/
if (ag_listen(chdev1, &sc_tsinfo) == -1) {
printf("ag_listen() failed: Error message = %s", ATDV_ERRMSGP(chdev1));
exit(1);
}
.
. Continue processing.
.
}
4.2.2. Linux Sample Code for Individual SCbus Routing Functions#include <srllib.h>
#include <dxxxlib.h>
#include <errno.h>
main()
{
int chdev1, /* D/160SC-LS voice channel handle */
chdev2; /* VFX/40ESC voice channel handle */
SC_TSINFO sc_tsinfo; /* time slot information structure */
long scts; /* SCbus time slot */
/* Open voice channel 2 on board 2 (D/160SC-LS voice channel 6). */
if ((chdev1 = dx_open("dxxxB2C2", 0)) == -1) {
printf("Cannot open channel dxxxB2C2. errno = %d", errno);
exit(1);
}
/* Open voice channel 2 on board 5 (VFX/40ESC voice channel 2). */
if ((chdev2 = dx_open("dxxxB5C2", 0)) == -1) {
printf("Cannot open channel dxxxB5C2. errno = %d", errno);
exit(1);
}
.
. Continue processing.
.
/***** SCbus routing example. *****/
/* Initialize the SC_TSINFO structure with the necessary information. */
sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &scts;
/*
* Get the SCbus time slot on which the D/160SC-LS sixth analog
* channel is transmitting.
*/
if (ag_getxmitslot(chdev1, &sc_tsinfo) == -1) {
printf("ag_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(chdev1));
exit(1);
}
/*
* Make analog channel 2 (of the VFX/40ESC board) listen to the
* SCbus time slot that the D/160SC-LS sixth analog channel is
* transmitting on.
*/
if (ag_listen(chdev2, &sc_tsinfo) == -1) {
printf("ag_listen() failed: Error message = %s", ATDV_ERRMSGP(chdev2));
exit(1);
}
/*
* Get the SCbus time slot on which the VFX/40ESC second analog
* channel is transmitting.
*/
if (ag_getxmitslot(chdev2, &sc_tsinfo) == -1) {
printf("ag_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(chdev2));
exit(1);
}
/*
* Make analog channel 6 (of the D/160SC-LS board) listen to the
* SCbus time slot that the VFX/40ESC second analog channel is
* transmitting on.
*/
if (ag_listen(chdev1, &sc_tsinfo) == -1) {
printf("ag_listen() failed: Error message = %s", ATDV_ERRMSGP(chdev1));
exit(1);
}
.
. Continue processing.
.
}
4.2.3. MS-DOS Sample Code for Individual SCbus Routing Functions#include <stdlib.h>
#include <stdio.h>
#include "d40.h"
#include "d40lib.h"
#include "vfcns.h"
int main()
{
int chdev1 = 6, /* Sixth voice channel on the D/160SC-LS */
chdev2 = 18, /* Second voice channel on the VFX/40ESC */
rcode; /* To hold function error return codes. */
unsigned int sc_IRQ = 10, /* SCbus board interrupt (from DIALOGIC.CFG) */
num_chans; /* Location for number of voice channels */
/* returned by startsys(). */
SC_TSINFO sc_tsinfo; /* time slot information structure */
long scts; /* SCbus time slot */
/***** Initialize system. ******/
/* Make sure the voice driver is loaded. */
if (getvctr() == 0) {
printf("Voice driver is not loaded.");
exit(1);
}
/* Make sure the voice driver is stopped before starting. */
stopsys();
/* Start the voice driver. */
if ((rcode = startsys(sc_IRQ, SM_EVENT, 0, 0, &num_chans)) != E_SUCC) {
printf("Could not start voice driver: Error message = %s", d4xerr(rcode));
exit(1);
}
.
. Continue processing.
.
/***** SCbus routing example. ******/
/* Initialize the SC_TSINFO structure with the necessary information. */
sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &scts;
/*
* Get the SCbus time slot on which the D/160SC-LS sixth analog
* channel is transmitting.
*/
if ((rcode = ag_getxmitslot(chdev1, &sc_tsinfo)) != E_SUCC) {
printf("ag_getxmitslot() failed: Error message = %s", d4xerr(rcode));
exit(1);
}
/*
* Make analog channel 2 (of the VFX/40ESC board) listen to the
* SCbus time slot that the D/160SC-LS sixth analog channel is
* transmitting on.
*/
if ((rcode = ag_listen(chdev2, &sc_tsinfo)) != E_SUCC) {
printf("ag_listen() failed: Error message = %s", d4xerr(rcode));
exit(1);
}
/*
* Get the SCbus time slot on which the VFX/40ESC second analog
* channel is transmitting.
*/
if ((rcode = ag_getxmitslot(chdev2, &sc_tsinfo)) != E_SUCC) {
printf("ag_getxmitslot() failed: Error message = %s", d4xerr(rcode));
exit(1);
}
/*
* Make analog channel 6 (of the D/160SC-LS board) listen to the
* SCbus time slot that the VFX/40ESC second analog channel is
* transmitting on.
*/
if ((rcode = ag_listen(chdev1, &sc_tsinfo)) != E_SUCC) {
printf("ag_listen() failed: Error message = %s", d4xerr(rcode));
exit(1);
}
.
. Continue processing.
.
}
4.2.4. OS/2 Sample Code for Individual SCbus Routing Functions#define INCL_DOSERRORS
#include <os2.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <voxlib.h>
main()
{
int chdev1, /* D/160SC-LS voice channel handle */
chdev2; /* VFX/40ESC voice channel handle */
SC_TSINFO sc_tsinfo; /* time slot information structure */
long scts; /* SCbus time slot */
/* Open voice channel 2 on board 2 (D/160SC-LS voice channel 6). */
if ((chdev1 = dl_open("VOXB1C1", O_RDWR)) == -1) {
printf("Cannot open channel VOXB1C1. dl_errno = %d", dl_errno);
exit(1);
}
/* Open voice channel 2 on board 5 (VFX/40ESC voice channel 2). */
if ((chdev2 = dl_open("VOXB4C1", O_RDWR)) == -1) {
printf("Cannot open channel VOXB4C1. dl_errno = %d", dl_errno);
exit(1);
}
.
. Continue processing.
.
/***** SCbus routing example. *****/
/* Initialize the SC_TSINFO structure with the necessary information. */
sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &scts;
/*
* Get the SCbus time slot on which the D/160SC-LS sixth analog
* channel is transmitting.
*/
if (ag_getxmitslot(chdev1, &sc_tsinfo) == -1) {
printf("ag_getxmitslot() failed: dl_errno = %d", dl_errno);
exit(1);
}
/*
* Make analog channel 2 (of the VFX/40ESC board) listen to the
* SCbus time slot that the D/160SC-LS sixth analog channel is
* transmitting on.
*/
if (ag_listen(chdev2, &sc_tsinfo) == -1) {
printf("ag_listen() failed: dl_errno = %d", dl_errno);
exit(1);
}
/*
* Get the SCbus time slot on which the VFX/40ESC second analog
* channel is transmitting.
*/
if (ag_getxmitslot(chdev2, &sc_tsinfo) == -1) {
printf("ag_getxmitslot() failed: dl_errno = %d", dl_errno);
exit(1);
}
/*
* Make analog channel 6 (of the D/160SC-LS board) listen to the
* SCbus time slot that the VFX/40ESC second analog channel is
* transmitting on.
*/
if (ag_listen(chdev1, &sc_tsinfo) == -1) {
printf("ag_listen() failed: dl_errno = %d", dl_errno);
exit(1);
}
.
. Continue processing.
.
}
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation