Dialogic 05-0867-005 Table Top Game User Manual


 
cc_GetBChanState( ) retrieves the status of the B channel
84
{
LINEDEV devhdl = 0;
CRN crn = 0;
char *devname = "dtiB1T1";
int bchanstate;
if ( cc_Open( &devhdl, devname,0)<0)
{
printf("Error opening device: errno = %d\n", errno);
exit(1);
}
/*
* Using cc_GetBChanState() to get the current
* B channel status.
*/
if ( cc_GetBChanState(devhdl,&bchanstate) <0)
procdevfail(devhdl);
else if ( bchanstate != ISDN_IN_SERVICE )
{
printf("B Channel is not in service...\n");
if ( cc_Close( devhdl)<0)
printf("Error closing device, errno = %d\n", errno);
exit(1);
}
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);