
Description | Cautions | Example | Errors | See Also
Name: |
int cc_Open(linedevp, devicename, rfu) | |
Inputs: |
LINEDEV *linedevp |
|
char *devicename |
| |
int rfu |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
Call control | |
Mode: |
synchronous | |
Technology: |
BRI/2; BRI/SC; PRI (all protocols) | |
The cc_Open( ) function opens a device and returns a unique line device handle to identify the physical device that carries the call. The cc_Open( ) function is used to open both network board and channel (that is, time slot) devices. Once a device is opened, all subsequent references to the opened device must be made using the line device number that is returned to and placed in linedevp.
Each PRI structure is composed of one D channel and 23 (T1) or 30 (E1) B (bearer) channels. A PRI board device, such as dtiB1, is defined as a station and controls the D channel. A PRI time slot device, such dtiB1T1, is defined as a bearer channel under a station.
Each BRI structure is composed of one D channel and two B (bearer) channels. A BRI board device, such as briS1, is defined as a station and controls the D-channel the same way as a PRI board device. A BRI time slot device, such as briS1T1, is defined as a bearer channel under a station and is handled the same way as a PRI line device.
Do not open a D or B channel more than once from the same process, or unpredictable results could occur.
#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 = "briS1T1";
if ( cc_Open( &devhdl, devname, 0) < 0 )
{
printf("Error opening device: errno = %d\n", errno);
exit(1);
}
printf("Waiting for call\n");
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);
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, check errno.h to retrieve the reason for the failure.
Typically, a < 0 return code for the cc_Open( ) function indicates that the function reference (the device name) is not valid for the function call.
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation