To route the channels using individual SCbus routing functions, perform the following, see Figure 7:
When these functions return, full duplex communications between the fax and digital channels will be established.
6.2.1. Win NT Sample Code for Individual SCbus Routing Functions#include <windows.h>
#include <errno.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <dtilib.h>
#include <faxlib.h>
main()
{
int dtih, /* T-1 time slot handle */
faxh, /* Fax channel handle */
chdev; /* Voice channel handle */
SC_TSINFO sc_tsinfo; /* time slot information structure */
long scts; /* SCbus time slot */
/* Open T-1 time slot 12 on the first D/240SC-T1. */
if ((dtih = dt_open("dtiB1T12", 0)) == -1) {
printf("Cannot open T-1 time slot dtiB1T12. errno = %d", errno);
exit(1);
}
/* Open fax channel 2 on board 5 (fax channel 2 on the VFX/40ESC). */
if ((faxh = fx_open("dxxxB5C2", 0)) == -1) {
printf("Cannot open fax channel dxxxB5C2. errno = %d", errno);
exit(1);
}
/* Open voice channel 2 on board 9 (voice channel 14 on the first D/240SC-T1). */
if ((chdev = dx_open("dxxxB9C2", NULL)) == -1) {
printf("Cannot open voice channel dxxxB9C2. 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 T-1 time slot 12 is transmitting.
*/
if (dt_getxmitslot(dtih, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(dtih));
exit(1);
}
/*
* Make fax channel 2 listen to the SCbus time slot that T-1 time slot
* 12 is transmitting on.
*/
if (fx_listen(faxh, &sc_tsinfo) == -1) {
printf("fx_listen() failed: Error message = %s", ATDV_ERRMSGP(faxh));
exit(1);
}
/*
* Get the SCbus time slot on which fax channel 2 is transmitting.
*/
if (fx_getxmitslot(faxh, &sc_tsinfo) == -1) {
printf("fx_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(faxh));
exit(1);
}
/*
* Make T-1 time slot 12 listen to the SCbus time slot that
* fax channel 2 is transmitting on.
*/
if (dt_listen(dtih, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDV_ERRMSGP(dtih));
exit(1);
}
.
. Process fax call.
.
/***** Disconnect fax channel. ******/
/*
* Make fax channel 2 stop listening to the SCbus time slot on which
* T-1 time slot 12 is transmitting.
*/
if (fx_unlisten(faxh) == -1) {
printf("fx_unlisten() failed: Error message = %s", ATDV_ERRMSGP(faxh));
exit(1);
}
/***** Connect T-1 time slot 12 for voice processing *****/
/***** using voice channel 14. *****/
/* 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 T-1 time slot 12 is transmitting.
*/
if (dt_getxmitslot(dtih, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(dtih));
exit(1);
}
/*
* Make voice channel 14 listen to the SCbus time slot that T-1 time slot
* 12 is transmitting on.
*/
if (dx_listen(chdev, &sc_tsinfo) == -1) {
printf("dx_listen() failed: Error message = %s", ATDV_ERRMSGP(chdev));
exit(1);
}
/*
* Get the SCbus time slot on which voice channel 14 is transmitting.
*/
if (dx_getxmitslot(chdev, &sc_tsinfo) == -1) {
printf("dx_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(chdev));
exit(1);
}
/*
* Make T-1 time slot 12 listen to the SCbus time slot that
* voice channel 14 is transmitting on.
*/
if (dt_listen(dtih, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDV_ERRMSGP(dtih));
exit(1);
}
.
. Continue processing.
.
}
6.2.2. Linux Sample Code for Individual SCbus Routing Functions#include <srllib.h>
#include <dxxxlib.h>
#include <dtilib.h>
#include <faxlib.h>
#include <errno.h>
main()
{
int dtih, /* T-1 time slot handle */
faxh, /* Fax channel handle */
chdev; /* Voice channel handle */
SC_TSINFO sc_tsinfo; /* time slot information structure */
long scts; /* SCbus time slot */
/* Open T-1 time slot 12 on the first D/240SC-T1. */
if ((dtih = dt_open("dtiB1T12", 0)) == -1) {
printf("Cannot open T-1 time slot dtiB1T12. errno = %d", errno);
exit(1);
}
/* Open fax channel 2 on board 5 (fax channel 2 on the VFX/40ESC). */
if ((faxh = fx_open("dxxxB5C2", 0)) == -1) {
printf("Cannot open fax channel dxxxB5C2. errno = %d", errno);
exit(1);
}
/* Open voice channel 2 on board 9 (voice channel 14 on the first D/240SC-T1). */
if ((chdev = dx_open("dxxxB9C2", NULL)) == -1) {
printf("Cannot open voice channel dxxxB9C2. 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 T-1 time slot 12 is transmitting.
*/
if (dt_getxmitslot(dtih, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(dtih));
exit(1);
}
/*
* Make fax channel 2 listen to the SCbus time slot that T-1 time slot
* 12 is transmitting on.
*/
if (fx_listen(faxh, &sc_tsinfo) == -1) {
printf("fx_listen() failed: Error message = %s", ATDV_ERRMSGP(faxh));
exit(1);
}
/*
* Get the SCbus time slot on which fax channel 2 is transmitting.
*/
if (fx_getxmitslot(faxh, &sc_tsinfo) == -1) {
printf("fx_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(faxh));
exit(1);
}
/*
* Make T-1 time slot 12 listen to the SCbus time slot that
* fax channel 2 is transmitting on.
*/
if (dt_listen(dtih, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDV_ERRMSGP(dtih));
exit(1);
}
.
. Process fax call.
.
/***** Disconnect fax channel. ******/
/*
* Make fax channel 2 stop listening to the SCbus time slot on which
* T-1 time slot 12 is transmitting.
*/
if (fx_unlisten(faxh) == -1) {
printf("fx_unlisten() failed: Error message = %s", ATDV_ERRMSGP(faxh));
exit(1);
}
/***** Connect T-1 time slot 12 for voice processing *****/
/***** using voice channel 14. *****/
/* 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 T-1 time slot 12 is transmitting.
*/
if (dt_getxmitslot(dtih, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(dtih));
exit(1);
}
/*
* Make voice channel 14 listen to the SCbus time slot that T-1 time slot
* 12 is transmitting on.
*/
if (dx_listen(chdev, &sc_tsinfo) == -1) {
printf("dx_listen() failed: Error message = %s", ATDV_ERRMSGP(chdev));
exit(1);
}
/*
* Get the SCbus time slot on which voice channel 14 is transmitting.
*/
if (dx_getxmitslot(chdev, &sc_tsinfo) == -1) {
printf("dx_getxmitslot() failed: Error message = %s", ATDV_ERRMSGP(chdev));
exit(1);
}
/*
* Make T-1 time slot 12 listen to the SCbus time slot that
* voice channel 14 is transmitting on.
*/
if (dt_listen(dtih, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDV_ERRMSGP(dtih));
exit(1);
}
.
. Continue processing.
.
}
6.2.3. MS-DOS Sample Code for Individual SCbus Routing Functions#include <stdlib.h>
#include <stdio.h>
#include "d40.h"
#include "dti.h"
#include "fax.h"
#include "d40lib.h"
#include "dtilib.h"
#include "dtierr.h"
#include "faxlib.h"
#include "vfcns.h"
int main()
{
int dti_bd = 1, /* D/240SC-T1 network board device handle. */
dti_ts = 12, /* T-1 time slot number. */
fax_ch = 2, /* Fax channel. */
chdev = 14, /* Voice channel. */
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(). */
num_fax_brd, /* Location for number of fax boards */
/* returned by fx_startsys(). */
num_fax_chan; /* Location for number of fax channels */
/* returned by fx_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 fax driver is loaded. */
if (fx_isdrvact() == 0) {
printf("fax driver is not loaded.");
exit(1);
}
/* Make sure the fax driver is stopped before starting. */
fx_stopsys();
/* 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);
}
/* Start the fax driver. */
if ((rcode = fx_startsys(&num_fax_brd, &num_fax_chan)) != EFX_SUCC) {
printf("Could not start fax driver: Error message = %s", fx_faxerr(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 T-1 time slot 12 is transmitting.
*/
if ((rcode = dt_getxmitslot(DT_MKTSLOT(dti_bd, dti_ts), &sc_tsinfo)) != E_DTSUCC) {
printf("dt_getxmitslot() failed: Error = %d", rcode);
exit(1);
}
/*
* Make fax channel 2 listen to the SCbus time slot that T-1 time slot
* 12 is transmitting on.
*/
if ((rcode = fx_listen(fax_ch, &sc_tsinfo)) != EFX_SUCC) {
printf("fx_listen() failed: Error message = %s", fx_faxerr(rcode));
exit(1);
}
/*
* Get the SCbus time slot on which fax channel 2 is transmitting.
*/
if ((rcode = fx_getxmitslot(fax_ch, &sc_tsinfo)) != EFX_SUCC) {
printf("fx_getxmitslot() failed: Error message = %s", fx_faxerr(rcode));
exit(1);
}
/*
* Make T-1 time slot 12 listen to the SCbus time slot that
* fax channel 2 is transmitting on.
*/
if ((rcode = dt_listen(DT_MKTSLOT(dti_bd, dti_ts), &sc_tsinfo)) != E_DTSUCC) {
printf("dt_listen() failed: Error = %d", rcode);
exit(1);
}
.
. Process fax call.
.
/***** Disconnect fax channel. ******/
/*
* Make fax channel 2 stop listening to the SCbus time slot on which
* T-1 time slot 12 is transmitting.
*/
if ((rcode = fx_unlisten(fax_ch)) != EFX_SUCC) {
printf("fx_unlisten() failed: Error message = %s", fx_faxerr(rcode));
exit(1);
}
/***** Connect T-1 time slot 12 for voice processing *****/
/***** using voice channel 14. *****/
/* 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 T-1 time slot 12 is transmitting.
*/
if ((rcode = dt_getxmitslot(DT_MKTSLOT(dti_bd, dti_ts), &sc_tsinfo)) != E_DTSUCC) {
printf("dt_getxmitslot() failed: Error = %d", rcode);
exit(1);
}
/*
* Make voice channel 14 listen to the SCbus time slot that T-1 time slot
* 12 is transmitting on.
*/
if ((rcode = dl_listen(chdev, &sc_tsinfo)) != E_SUCC) {
printf("dl_listen() failed: Error message = %s", d4xerr(rcode));
exit(1);
}
/*
* Get the SCbus time slot on which voice channel 14 is transmitting.
*/
if ((rcode = dl_getxmitslot(chdev, &sc_tsinfo)) != E_SUCC) {
printf("dl_getxmitslot() failed: Error message = %s", d4xerr(rcode));
exit(1);
}
/*
* Make T-1 time slot 12 listen to the SCbus time slot that
* voice channel 14 is transmitting on.
*/
if ((rcode = dt_listen(DT_MKTSLOT(dti_bd, dti_ts), &sc_tsinfo)) != E_DTSUCC) {
printf("dt_listen() failed: Error = %d", rcode);
exit(1);
}
.
. Continue processing.
.
}
6.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>
#include <dtilib.h>
#include <dti2lib.h>
#include <faxlib.h>
main()
{
int dtih, /* T-1 time slot handle */
faxh, /* fax channel handle */
chdev; /* Voice channel handle */
SC_TSINFO sc_tsinfo; /* time slot information structure */
long scts; /* SCbus time slot */
/* Open T-1 time slot 12 on the first D/240SC-T1. */
if ((dtih = dt_open("DTIB0T11", 0)) == -1) {
printf("Cannot open T-1 time slot DTIB0T11. dl_errno = %d", dl_errno);
exit(1);
}
/* Open fax channel 2 on board 5 (fax channel 2 on the VFX/40ESC). */
if ((faxh = fx_open("VOXB4C1", O_RDWR)) == -1) {
printf("Cannot open fax channel VOXB4C1. dl_errno = %d", dl_errno);
exit(1);
}
/* Open voice channel 2 on board 9 (voice channel 14 on the first D/240SC-T1). */
if ((chdev = dl_open("VOXB8C1", O_RDWR)) == -1) {
printf("Cannot open voice channel VOXB8C1. 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 T-1 time slot 12 is transmitting.
*/
if (dt_getxmitslot(dtih, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDT_ERRMSGP(dtih));
exit(1);
}
/*
* Make fax channel 2 listen to the SCbus time slot that T-1 time slot
* 12 is transmitting on.
*/
if (fx_listen(faxh, &sc_tsinfo) == -1) {
printf("fx_listen() failed: dl_errno = %d", dl_errno);
exit(1);
}
/*
* Get the SCbus time slot on which fax channel 2 is transmitting.
*/
if (fx_getxmitslot(faxh, &sc_tsinfo) == -1) {
printf("fx_getxmitslot() failed: dl_errno = %d", dl_errno);
exit(1);
}
/*
* Make T-1 time slot 12 listen to the SCbus time slot that
* fax channel 2 is transmitting on.
*/
if (dt_listen(dtih, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDT_ERRMSGP(dtih));
exit(1);
}
.
. Process fax call.
.
/***** Disconnect fax channel. ******/
/*
* Make fax channel 2 stop listening to the SCbus time slot on which
* T-1 time slot 12 is transmitting.
*/
if (fx_unlisten(faxh) == -1) {
printf("fx_unlisten() failed: Error = %d", dl_errno);
exit(1);
}
/***** Connect T-1 time slot 12 for voice processing *****/
/***** using voice channel 14. *****/
/* 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 T-1 time slot 12 is transmitting.
*/
if (dt_getxmitslot(dtih, &sc_tsinfo) == -1) {
printf("dt_getxmitslot() failed: Error message = %s", ATDT_ERRMSGP(dtih));
exit(1);
}
/*
* Make voice channel 14 listen to the SCbus time slot that T-1 time slot
* 12 is transmitting on.
*/
if (dx_listen(chdev, &sc_tsinfo) == -1) {
printf("dx_listen() failed: dl_errno = %d", dl_errno);
exit(1);
}
/*
* Get the SCbus time slot on which voice channel 14 is transmitting.
*/
if (dx_getxmitslot(chdev, &sc_tsinfo) == -1) {
printf("dx_getxmitslot() failed: dl_errno = %d", dl_errno);
exit(1);
}
/*
* Make T-1 time slot 12 listen to the SCbus time slot that
* voice channel 14 is transmitting on.
*/
if (dt_listen(dtih, &sc_tsinfo) == -1) {
printf("dt_listen() failed: Error message = %s", ATDT_ERRMSGP(dtih));
exit(1);
}
.
. Continue processing.
.
}
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation