
Description | Cautions | Example | Errors
Name: |
int cc_CRN2LineDev(crn, linedevp) | |
Inputs: |
CRN crn |
|
LINEDEV *linedevp |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
System control | |
Mode: |
synchronous | |
Technology: |
BRI/2; BRI/SC; PRI (all protocols) | |
The cc_CRN2LineDev( ) function is a utility function that matches a CRN to its line device handle. The function returns the line device handle associated with the specified call reference number (CRN).
Parameter |
Description |
crn: |
The call reference number. Each call needs a CRN. |
linedevp: |
Points to the buffer where the line device handle will be stored. |
The call reference number (CRN) exists after CCEV_OFFERED is received by the application or cc_MakeCall( ) is issued. The CRN is valid until the cc_ReleaseCall( ) function is issued.
#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);
}
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, 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.
Typically, a < 0 return code for the cc_CRN2LineDev( ) function indicates that the function reference (the CRN) is not valid for the function call.
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation