sets the user attribute cc_SetUsrAttr( )
255
main()
{
int chan = 1;
char devname[16];
.
.
.
.
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(dev);
else
printf(“Call disconnected at chan %ld\n”,chan);
if ( cc_DropCall(crn, NORMAL_CLEARING, EV_ASYNC)<0)
procdevfail(dev);
return( 0 );
}