cc_GetCRN( ) retrieves the call reference number for the event
102
#include "cclib.h"
main()
{
.
.
.
.
if ( sr_enbhdlr( devhdl,CCEV_DISCONNECTED,discCallHdlr)<0)
{
printf( "dtiEnable for DISCONNECT failed: %s\n",
ATDV_ERRMSGP( SRL_DEVICE ) );
return( 1 );
}
.
.
.
.
while (1)
{
/* wait for network event */
sr_waitevt(-1);
}
}
/***************************************************/
/* discCallHdlr - disconnect the active call */
/***************************************************/
int discCallHdlr( )
{
int devindx;
int dev;
int len;
void *datap;
CRN crn;
dev = sr_getevtdev();
len = sr_getevtlen();
datap = sr_getevtdatap();
cc_GetCRN (&crn, datap);
if ( cc_DropCall( crn,NORMAL_CLEARING,EV_ASYNC)<0)
{
int lasterr = cc_CauseValue(dev);
char *errmsg;
if ( cc_ResultMsg(dev,lasterr,&errmsg) == 0 )
printf( "\tcc_DropCall() Error: ( %x ) %s\n",lasterr,errmsg);
}
return( 0 );
}
!
! !
!
Errors
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.