To route the channels using individual SCbus routing functions, perform the following, see Figure 5:
When these functions return, full duplex communications between the two digital channels will be established.
5.2.1. Windows Sample Code for Individual SCbus Routing Functions#include <windows.h>
#include <errno.h>
#include <srllib.h>
#include <dtilib.h>
main()
{
int dtih1, /* D/240SC-T1 #1 T-1 time slot handle */
dtih2; /* D/240SC-T1 #2 T-1 time slot handle */
SC_TSINFO sc_tsinfo; /* time slot information structure */
long scts; /* SCbus time slot */
/* Open T-1 time slot 12 on D/240SC-T1 #1. */
if ((dtih1 = dt_open("dtiB1T12", 0)) == -1) {
printf("Cannot open T-1 time slot dtiB1T12. errno = %d", errno);
exit(1);
}
/* Open T-1 time slot 23 on D/240SC-T1 #2. */
if ((dtih2 = dt_open("dtiB2T23", 0)) == -1) {
printf("Cannot open T-1 time slot dtiB2T23. 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 12th T-1 time slot (of the first
* D/240SC-T1) is transmitting.
*/
if (dt_getxmitslot(dtih1, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(dtih1));
exit(1);
}
/*
* Make T-1 time slot 23 (of the second D/240SC-T1) listen to the
* SCbus time slot that T-1 time slot 12 (on the first D/240SC-T1)
* is transmitting on.
*/
if (dt_listen(dtih2, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDV_ERRMSGP(dtih2));
exit(1);
}
/*
* Get the SCbus time slot on which the 23rd T-1 time slot (of the
* second D/240SC-T1) is transmitting.
*/
if (dt_getxmitslot(dtih2, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(dtih2));
exit(1);
}
/*
* Make T-1 time slot 12 (of the first D/240SC-T1) listen to the
* SCbus time slot that T-1 time slot 23 (on the second D/240SC-T1)
* is transmitting on.
*/
if (dt_listen(dtih1, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDV_ERRMSGP(dtih1));
exit(1);
}
.
. Continue processing.
.
}
5.2.2. Linux Sample Code for Individual SCbus Routing Functions#include <srllib.h>
#include <dtilib.h>
#include <errno.h>
main()
{
int dtih1, /* D/240SC-T1 #1 T-1 time slot handle */
dtih2; /* D/240SC-T1 #2 T-1 time slot handle */
SC_TSINFO sc_tsinfo; /* time slot information structure */
long scts; /* SCbus time slot */
/* Open T-1 time slot 12 on D/240SC-T1 #1. */
if ((dtih1 = dt_open("dtiB1T12", 0)) == -1) {
printf("Cannot open T-1 time slot dtiB1T12. errno = %d", errno);
exit(1);
}
/* Open T-1 time slot 23 on D/240SC-T1 #2. */
if ((dtih2 = dt_open("dtiB2T23", 0)) == -1) {
printf("Cannot open T-1 time slot dtiB2T23. 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 12th T-1 time slot (of the first
* D/240SC-T1) is transmitting.
*/
if (dt_getxmitslot(dtih1, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(dtih1));
exit(1);
}
/*
* Make T-1 time slot 23 (of the second D/240SC-T1) listen to the
* SCbus time slot that T-1 time slot 12 (on the first D/240SC-T1)
* is transmitting on.
*/
if (dt_listen(dtih2, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDV_ERRMSGP(dtih2));
exit(1);
}
/*
* Get the SCbus time slot on which the 23rd T-1 time slot (of the
* second D/240SC-T1) is transmitting.
*/
if (dt_getxmitslot(dtih2, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(dtih2));
exit(1);
}
/*
* Make T-1 time slot 12 (of the first D/240SC-T1) listen to the
* SCbus time slot that T-1 time slot 23 (on the second D/240SC-T1)
* is transmitting on.
*/
if (dt_listen(dtih1, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDV_ERRMSGP(dtih1));
exit(1);
}
.
. Continue processing.
.
}
5.2.3. MS-DOS Sample Code for Individual SCbus Routing Functions#include <stdlib.h>
#include <stdio.h>
#include "d40.h"
#include "dti.h"
#include "d40lib.h"
#include "dtilib.h"
#include "dtierr.h"
#include "vfcns.h"
int main()
{
int dti_bd1 = 1, /* D/240SC-T1 #1 network brd device handle. */
dti_ts1 = 12, /* T-1 time slot number. */
dti_bd2 = 2, /* D/240SC-T1 #2 network brd device handle. */
dti_ts2 = 23, /* T-1 time slot number. */
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(). */
num_dti_brd, /* Location for number of DTI boards */
/* returned by startdti(). */
num_dti_ts; /* Location for number of DTI time slots */
/* returned by startdti(). */
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 DTI driver is stopped before starting. */
stopdti();
/* 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);
}
/* Start the DTI driver. */
if ((rcode = startdti(&num_dti_brd, &num_dti_ts)) != E_DTSUCC) {
printf("Could not start DTI driver: Error = %d", 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 12th T-1 time slot (of the first
* D/240SC-T1) is transmitting.
*/
if ((rcode = dt_getxmitslot(DT_MKTSLOT(dti_bd1, dti_ts1), &sc_tsinfo)) != E_DTSUCC) {
printf("dt_getxmitslot() failed: Error = %d", rcode);
exit(1);
}
/*
* Make T-1 time slot 23 (of the second D/240SC-T1) listen to the
* SCbus time slot that T-1 time slot 12 (on the first D/240SC-T1)
* is transmitting on.
*/
if ((rcode = dt_listen(DT_MKTSLOT(dti_bd2, dti_ts2), &sc_tsinfo)) != E_DTSUCC) {
printf("dt_listen() failed: Error = %d", rcode);
exit(1);
}
/*
* Get the SCbus time slot on which the 23rd T-1 time slot (of the
* second D/240SC-T1) is transmitting.
*/
if ((rcode = dt_getxmitslot(DT_MKTSLOT(dti_bd2, dti_ts2), &sc_tsinfo)) != E_DTSUCC) {
printf("dt_getxmitslot() failed: Error = %d", rcode);
exit(1);
}
/*
* Make T-1 time slot 12 (of the first D/240SC-T1) listen to the
* SCbus time slot that T-1 time slot 23 (on the second D/240SC-T1)
* is transmitting on.
*/
if ((rcode = dt_listen(DT_MKTSLOT(dti_bd1, dti_ts1), &sc_tsinfo)) != E_DTSUCC) {
printf("dt_listen() failed: Error = %d", rcode);
exit(1);
}
.
. Continue processing.
.
}
5.2.4. OS/2 Sample Code for Individual SCbus Routing Functions#define INCL_DOSERRORS
#include <os2.h>
#include <stdlib.h>
#include <stdio.h>
#include <voxlib.h>
#include <dtilib.h>
#include <dti2lib.h>
main()
{
int dtih1, /* D/240SC-T1 #1 T-1 time slot handle */
dtih2; /* D/240SC-T1 #2 T-1 time slot handle */
SC_TSINFO sc_tsinfo; /* time slot information structure */
long scts; /* SCbus time slot */
/* Open T-1 time slot 12 on D/240SC-T1 #1. */
if ((dtih1 = dt_open("DTIB0T11", 0)) == -1) {
printf("Cannot open T-1 time slot DTIB0T11. dl_errno = %d", dl_errno);
exit(1);
}
/* Open T-1 time slot 23 on D/240SC-T1 #2. */
if ((dtih2 = dt_open("DTIB1T22", 0)) == -1) {
printf("Cannot open T-1 time slot DTIB1T22. 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 12th T-1 time slot (of the first
* D/240SC-T1) is transmitting.
*/
if (dt_getxmitslot(dtih1, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDT_ERRMSGP(dtih1));
exit(1);
}
/*
* Make T-1 time slot 23 (of the second D/240SC-T1) listen to the
* SCbus time slot that T-1 time slot 12 (on the first D/240SC-T1)
* is transmitting on.
*/
if (dt_listen(dtih2, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDT_ERRMSGP(dtih2));
exit(1);
}
/*
* Get the SCbus time slot on which the 23rd T-1 time slot (of the
* second D/240SC-T1) is transmitting.
*/
if (dt_getxmitslot(dtih2, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDT_ERRMSGP(dtih2));
exit(1);
}
/*
* Make T-1 time slot 12 (of the first D/240SC-T1) listen to the
* SCbus time slot that T-1 time slot 23 (on the second D/240SC-T1)
* is transmitting on.
*/
if (dt_listen(dtih1, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDT_ERRMSGP(dtih1));
exit(1);
}
.
. Continue processing.
.
}
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation