To route these channels using SCbus convenience functions, perform the following:
After the call completes, these digital channels are easily rerouted to a voice channel, another network interface channel or to a complementary technology channel to handle the next call.
Sample code for each operating system illustrating SCbus routing for this example using the SCbus convenience functions and also using the individual SCbus routing functions is contained in the following paragraphs.
Figure 4. Initial Digital Service Routing Example

Figure 5. Digital Service Inbound/Outbound Routing Example

5.1.1. Windows Sample Code for SCbus Convenience Functions#include <windows.h>
#include <errno.h>
#include <srllib.h>
#include <dtilib.h>
/*
* For nr_ function error printing and DTI functionality, make sure
* PRINTON and DTISC are defined when compiling the sctools.c file.
*/
#include "sctools.h"
main()
{
int dtih1, /* D/240SC-T1 #1 T-1 time slot handle */
dtih2; /* D/240SC-T1 #2 T-1 time slot handle */
/* 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. *****/
/*
* Make a full duplex connection between T-1 time slot 12 (on the
* first D/240SC-T1) and T-1 time slot 23 (on the second D/240SC-T1).
*/
if (nr_scroute(dtih1, SC_DTI, dtih2, SC_DTI, SC_FULLDUP) == -1) {
printf("Could not route the two T-1 time slots.");
exit(1);
}
.
. Continue processing.
.
}
5.1.2. Linux Sample Code for SCbus Convenience Functions#include <srllib.h>
#include <dtilib.h>
#include <errno.h>
/*
* For nr_ function error printing and DTI functionality, make sure
* PRINTON and DTISC are defined when compiling the sctools.c file.
*/
#include "sctools.h"
main()
{
int dtih1, /* D/240SC-T1 #1 T-1 time slot handle */
dtih2; /* D/240SC-T1 #2 T-1 time slot handle */
/* 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. *****/
/*
* Make a full duplex connection between T-1 time slot 12 (on the
* first D/240SC-T1) and T-1 time slot 23 (on the second D/240SC-T1).
*/
if (nr_scroute(dtih1, SC_DTI, dtih2, SC_DTI, SC_FULLDUP) == -1) {
printf("Could not route the two T-1 time slots.");
exit(1);
}
.
. Continue processing.
.
}
5.1.3. MS-DOS Sample Code for SCbus Convenience 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"
/*
* In order for the nr_ functions to have DTI functionality, DTISC must
* be defined when compiling the sctools.c file.
*/
#include "sctools.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(). */
/***** 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. ******/
/*
* Make a full duplex connection between T-1 time slot 12 (on the
* first D/240SC-T1) and T-1 time slot 23 (on the second D/240SC-T1).
*/
if ((rcode = nr_scroute(DT_MKTSLOT(dti_bd1, dti_ts1) , SC_DTI,
DT_MKTSLOT(dti_bd2, dti_ts2) , SC_DTI,
SC_FULLDUP)) != 0) {
printf("Could not route the T-1 time slots: Error = %d", rcode);
exit(1);
}
.
. Continue processing.
.
}
5.1.4. OS/2 Sample Code for SCbus Convenience Functions#define INCL_DOSERRORS
#include <os2.h>
#include <stdlib.h>
#include <stdio.h>
#include <voxlib.h>
#include <dtilib.h>
#include <dti2lib.h>
/*
* For nr_ function error printing and DTI functionality, make sure
* PRINTON and DTISC are defined when compiling the sctools.c file.
*/
#include <sctools.h>
main()
{
int dtih1, /* D/240SC-T1 #1 T-1 time slot handle */
dtih2; /* D/240SC-T1 #2 T-1 time slot handle */
/* 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. *****/
/*
* Make a full duplex connection between T-1 time slot 12 (on the
* first D/240SC-T1) and T-1 time slot 23 (on the second D/240SC-T1).
*/
if (nr_scroute(dtih1, SC_DTI, dtih2, SC_DTI, SC_FULLDUP) == -1) {
printf("Could not route the two T-1 time slots.");
exit(1);
}
.
. Continue processing.
.
}
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation