gets the established attribute for the line device cc_GetUsrAttr( )
157
.
if ( sr_enbhdlr( devhdl,CCEV_DISCONNECTED,discCallHdlr)<0)
{
printf( “dtiEnable for DISCONNECT failed: %s\n”,
ATDV_ERRMSGP( SRL_DEVICE ) );
return( 1 );
}
printf(devname,”dtiB1T%d”,chan);
if ( cc_Open( &devhdl, devname,0)<0)
{
printf(“Error opening device: errno = %d\n”, errno);
exit(1);
}
if ( cc_SetUsrAttr(devhdl,chan))
procdevfail(devhdl);
.
.
.
.
while (1)
{
/* wait for network event */
sr_waitcvt(-1);
}
cc_Close(devhdl);
}
/***************************************************/
/* discCallHdlr - disconnect the active call */
/***************************************************/
int discCallHdlr( )
{
int devindx;
int dev;
int len;
void *datap;
CRN crn;
long chan;
dev = sr_getevtdev();
len = sr_getevtlen();
datap = sr_getevtdatap();
cc_GetCRN(&crn, datap);
if ( cc_GetUsrAttr(dev,&chan))
procdevfail(devhdl);
else
printf(“Call disconnected at chan %ld\n”,chan);
if ( cc_DropCall( crn,NORMAL_CLEARING,EV_ASYNC)<0)
callfail(crn);
return( 0 );
}
int callfail(CRN crn)
{
LINEDEV ld;
cc_CRN2LineDev(crn,&ld);
procdevfail(ld);