
Description | Cautions | Source Code | See Also
Name: |
int nr_scunroute(devh1, devtype1, devh2, devtype2, mode) | |
Inputs: |
int devh1 |
|
|
unsigned short devtype1 |
|
|
int devh2 |
|
|
unsigned short devtype2 |
|
|
unsigned char mode |
|
Returns: |
0 on success |
|
|
-1 on error |
|
Includes: |
stdio.h, windows.h, srllib.h, dxxxlib.h and sctools.h. Optional dtilib.h, msilib.h, and faxlib.h. | |
Category: |
Routing convenience | |
Mode: |
Synchronous | |
The nr_scunroute( ) convenience function breaks the connection between two devices. This function disconnects the full or half-duplex connection between two devices. This function is provided in a separate C source file called sctools.c in the <install drive>:\<install directory>\dialogic\sctools directory. The library version is in sctools.lib in the <install drive>:\<install directory>\dialogic\lib directory. The nr_sc prefix to the function signifies network (analog and digital) devices and resource (voice and FAX) devices accessible via the SCbus. See the Digital Network Interface Software Reference for digital interface device details and the FAX Software Reference for FAX device details.
Parameter |
Description | ||
devh1: |
Dialogic device handle. | ||
devtype1: |
Specifies the parameters for devh1. | ||
|
SC_VOX |
voice channel device | |
|
SC_LSI |
analog channel device | |
|
SC_DTI |
digital time slot device | |
|
SC_MSI |
MSI station device | |
|
SC_FAX |
fax channel device | |
devh2: |
Dialogic device handle. | ||
devtype2: |
Specifies the type of device for devh2. See devtype1 for list of defines. | ||
mode: |
Specifies half or full duplex connection. The mode parameter contains one of the following defines from sctools.h to specify full or half duplex: | ||
|
SC_FULLDUP |
full duplex connection | |
|
SC_HALFDUP |
half duplex connection. | |
|
The default mode value is SC_FULLDUP. When SC_HALFDUP is specified, then the function returns with the second device NOT listening (receive disconnected) to the SCbus time slot connected to the first device. | ||
/*
* Include files.
*/
#include <windows.h>
#include <stdio.h>
#include <srllib.h>
#include <dxxxlib.h>
#ifdef DTISC
#include <dtilib.h>
#include <msilib.h>
#endif
#ifdef FAXSC
#include <faxlib.h>
#endif
#include "sctools.h"
/*
* Function prototypes
*/
static void nr_scerror(char *, ...);
#if ( defined( __STDC__ ) || defined( __cplusplus ) )
int nr_scunroute( int devh1, unsigned short devtype1,
int devh2, unsigned short devtype2, unsigned char mode )
#else
int nr_scunroute( devh1, devtype1, devh2, devtype2, mode )
int devh1;
unsigned short devtype1;
int devh2;
unsigned short devtype2;
unsigned char mode;
#endif
{
short rc = 0; /* Return code from the function */
/*
* Disconnect the receive of the second device from the SCBus timeslot.
*/
switch (devtype2) {
case SC_VOX:
if (dx_unlisten(devh2) == -1) {
nr_scerror("nr_scunroute: %s: dx_unlisten ERROR: %s\n",
ATDV_NAMEP(devh2),ATDV_ERRMSGP(devh2));
rc = -1;
}
break;
case SC_LSI:
if (ag_unlisten(devh2) == -1) {
nr_scerror("nr_scunroute: %s: ag_unlisten ERROR: %s\n",
ATDV_NAMEP(devh2),ATDV_ERRMSGP(devh2));
rc = -1;
}
break;
#ifdef DTISC
case SC_DTI:
if (dt_unlisten(devh2) == -1) {
nr_scerror("nr_scunroute: %s: dt_unlisten ERROR: %s\n",
ATDV_NAMEP(devh2),ATDV_ERRMSGP(devh2));
rc = -1;
}
break;
case SC_MSI:
if (ms_unlisten(devh2) == -1) {
nr_scerror("nr_scunroute: %s: ms_unlisten ERROR: %s\n",
ATDV_NAMEP(devh2),ATDV_ERRMSGP(devh2));
rc = -1;
}
break;
#endif
#ifdef FAXSC
case SC_FAX:
if (fx_unlisten(devh2) == -1) {
nr_scerror("nr_scunroute: %s: fx_unlisten ERROR: %s\n",
ATDV_NAMEP(devh2),ATDV_ERRMSGP(devh2));
rc = -1;
}
break;
#endif
default:
nr_scerror("nr_scunroute: %s: ERROR: Invalid 2nd device type\n",
ATDV_NAMEP(devh2));
rc = -1;
}
/*
* A half duplex connection has already been broken. If this is all that
* is required, then return now.
*/
if (mode == SC_HALFDUP) {
return rc;
}
/*
* Disconnect the receive of the first device from the SCBus timeslot.
*/
switch (devtype1) {
case SC_VOX:
if (dx_unlisten(devh1) == -1) {
nr_scerror("nr_scunroute: %s: dx_unlisten ERROR: %s\n",
ATDV_NAMEP(devh1),ATDV_ERRMSGP(devh1));
rc = -1;
}
break;
case SC_LSI:
if (ag_unlisten(devh1) == -1) {
nr_scerror("nr_scunroute: %s: ag_unlisten ERROR: %s\n",
ATDV_NAMEP(devh1),ATDV_ERRMSGP(devh1));
rc = -1;
}
break;
#ifdef DTISC
case SC_DTI:
if (dt_unlisten(devh1) == -1) {
nr_scerror("nr_scunroute: %s: dt_unlisten ERROR: %s\n",
ATDV_NAMEP(devh1),ATDV_ERRMSGP(devh1));
rc = -1;
}
break;
case SC_MSI:
if (ms_unlisten(devh1) == -1) {
nr_scerror("nr_scunroute: %s: ms_unlisten ERROR: %s\n",
ATDV_NAMEP(devh1),ATDV_ERRMSGP(devh1));
rc = -1;
}
break;
#endif
#ifdef FAXSC
case SC_FAX:
if (fx_unlisten(devh1) == -1) {
nr_scerror("nr_scunroute: %s: fx_unlisten ERROR: %s\n",
ATDV_NAMEP(devh1),ATDV_ERRMSGP(devh1));
rc = -1;
}
break;
#endif
default:
nr_scerror("nr_scunroute: %s: ERROR: Invalid 1st device type\n",
ATDV_NAMEP(devh1));
rc = -1;
}
return rc;
}
void nr_scerror(char *fmt, ...)
{
#ifdef PRINTON
va_list args;
char *fmt;
/*
* Make args point to the 1st unnamed argument and then print to stderr.
*/
va_start(args, fmt);
fmt = va_arg(args, char *);
vfprintf(stderr, fmt, args);
va_end(args);
#endif
}
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation