
Description | Caution | Example | Errors | See Also
Name: |
int cc_ResultMsg(linedev, ResultCode, msg) | |
Inputs: |
LINEDEV linedev |
|
int ResultCode |
| |
char **msg |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
System tools | |
Mode: |
synchronous | |
Technology: |
BRI/2; BRI/SC; PRI (all protocols) | |
cc_ResultMsg( ) is a convenience function that interprets the function return code. The cc_ResultMsg( ) function retrieves either the cause value of an event from the cc_CauseValue( ) function or the function return code from the cc_ResultValue( ) function.
Parameter |
Description |
linedev: |
The line device handle. |
ResultCode: |
The cause value of the event or return code (retrieved from cc_ResultValue( ) or cc_CauseValue( )). |
msg: |
The pointer to the buffer address where the result message will be stored. |
None
#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. Error codes are defined in the files ccerr.h, isdnerr.h, and isdncmd.h.
Typically, a < 0 return code for the cc_ResultMsg( ) function indicates that the function reference (the line device number) is not valid for the function call.
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation