To route these channels using SCbus convenience functions, perform the following:
Figure 2. Initial Analog & Voice Device Routing Example

Figure 3. Analog Inbound/Outbound Routing Example

After the call completes, these analog channels can be easily rerouted to their associated voice device, Figure 2, by performing the following:
Note that in this example, since the voice channels were never disconnected, the nr_scroute( ) calls could be issued in half-duplex mode so that only the analog channels were rerouted.
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.
4.1.1. Windows Sample Code for SCbus Convenience Functions#include <windows.h>
#include <errno.h>
#include <srllib.h>
#include <dxxxlib.h>
/*
* For nr_ function error printing, make sure PRINTON is defined when
* compiling the sctools.c file.
*/
#include "sctools.h"
main()
{
int chdev1, /* D/160SC-LS voice channel handle */
chdev2; /* VFX/40ESC voice channel handle */
/* 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. *****/
/*
* Make a full duplex connection between analog channel 6 on the
* D/160SC-LS board and analog channel 2 on the VFX/40ESC board.
*/
if (nr_scroute(chdev1, SC_LSI, chdev2, SC_LSI, SC_FULLDUP) == -1) {
printf("Could not route the two analog channels.");
exit(1);
}
.
. Continue processing.
.
}
4.1.2. Linux Sample Code for SCbus Convenience Functions#include <srllib.h>
#include <dxxxlib.h>
#include <errno.h>
/*
* For nr_ function error printing, make sure PRINTON is defined when
* compiling the sctools.c file.
*/
#include "sctools.h"
main()
{
int chdev1, /* D/160SC-LS voice channel handle */
chdev2; /* VFX/40ESC voice channel handle */
/* 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. *****/
/*
* Make a full duplex connection between analog channel 6 on the
* D/160SC-LS board and analog channel 2 on the VFX/40ESC board.
*/
if (nr_scroute(chdev1, SC_LSI, chdev2, SC_LSI, SC_FULLDUP) == -1) {
printf("Could not route the two analog channels.");
exit(1);
}
.
. Continue processing.
.
}
4.1.3. MS-DOS Sample Code for SCbus Convenience Functions#include <stdlib.h>
#include <stdio.h>
#include "d40.h"
#include "d40lib.h"
#include "vfcns.h"
#include "sctools.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(). */
/***** 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. ******/
/*
* Make a full duplex connection between the D/160SC-LS 6th analog
* channel and the VFX/40ESC 2nd analog channel.
*/
if ((rcode = nr_scroute(chdev1, SC_LSI, chdev2, SC_LSI, SC_FULLDUP)) != 0) {
printf("Could not route the analog channels: Error = %d", rcode);
exit(1);
}
.
. Continue processing.
.
}
4.1.4. OS/2 Sample Code for SCbus Convenience Functions#define INCL_DOSERRORS
#include <os2.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <voxlib.h>
/*
* For nr_ function error printing, make sure PRINTON is defined when
* compiling the sctools.c file.
*/
#include <sctools.h>
main()
{
int chdev1, /* D/160SC-LS voice channel handle */
chdev2; /* VFX/40ESC voice channel handle */
/* 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. *****/
/*
* Make a full duplex connection between the D/160SC-LS 6th analog
* channel and the VFX/40ESC 2nd analog channel.
*/
if (nr_scroute(chdev1, SC_LSI, chdev2, SC_LSI, SC_FULLDUP) == -1) {
printf("Could not route the two analog channels.");
exit(1);
}
.
. Continue processing.
.
}
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation