
Description | Termination Events | Cautions | Example | Errors | See Also
Name: |
int cc_SetChanState(linedev, chanstate, mode) | |
Inputs: |
LINEDEV linedev |
|
int chanstate |
| |
unsigned long mode |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
System tools | |
Mode: |
synchronous or asynchronous | |
Technology: |
PRI (all protocols) | |
The cc_SetChanState( ) function is used to change the maintenance state of a specified B channel. When power is first turned on, all channels are placed in the IN_SERVICE state. However, in some protocols, the D channel may need to be activated.
Parameter |
Description |
linedev: |
The line device handle of the B channel. |
chanstate: |
The channel service state. Possible values for chanstate are:
|
mode: |
Specifies asynchronous (EV_ASYNC) or synchronous (EV_SYNC) mode. |
#include <windows.h> /* For Windows applications only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
void main()
{
LINEDEV devhdl = 0;
CRN crn = 0;
char *devname = "dtiB1T1";
if ( cc_Open(&devhdl, devname, 0) < 0 )
{
printf("Error opening device: errno = %d\n", errno);
exit(1);
}
/*
* using cc_SetChanState(devhdl, IN_SERVICE,
* EV_SYNC) to set B channel to "in service" state.
* Recommended for all supported protocols.
*/
if ( cc_SetChanState(devhdl, IN_SERVICE, EV_SYNC) < 0 )
procdevfail(devhdl);
if ( cc_WaitCall(devhdl, &crn, NULL, -1, EV_SYNC) < 0 )
procdevfail(devhdl);
if ( cc_AnswerCall(crn, 0, EV_SYNC) < 0 )
callfail(crn);
.
.
.
.
.
/* Drop the call */
if ( cc_DropCall(crn, NORMAL_CLEARING, EV_SYNC) < 0 )
callfail(crn);
if ( cc_ReleaseCall(crn) < 0 )
callfail(crn);
/* Close the device */
if ( cc_Close( devhdl ) < 0 )
printf("Error closing device, errno = %d\n", errno);
}
int callfail(CRN crn)
{
LINEDEV ld;
cc_CRN2LineDev(crn,&ld);
procdevfail(ld);
}
int procdevfail(LINEDEV handle)
{
int reason;
char *msg;
reason = cc_CauseValue(handle);
cc_ResultMsg(handle, reason, &msg);
printf("reason = %x - %s\n",reason,msg);
}
If the function returns < 0 to indicate failure, use the cc_CauseValue( ) function to retrieve the reason code for the failure. The cc_ResultMsg( ) function can be used to interpret the reason code. Error codes are defined in the files ccerr.h, isdnerr.h, and isdncmd.h.
Error codes from the cc_SetChanState( ) function include the following:
Error Code |
Description |
ERR_ISDN_LIB | E_ISBADTS |
Bad time slot |
ERR_ISDN_LIB | E_ISBADIF |
Bad interface number |
ERR_ISDN_LIB | E_ISBADPAR |
Bad input parameter |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation