Dialogic 05-0867-005 Table Top Game User Manual


 
gets the last channel information cc_GetChanId( )
97
void main( )
{
LINEDEV boarddev;
.
.
if ( cc_Open ( &boarddev, dtiB1,0)<0)
{
printf (Error opening board device: errno = %d\n, errno);
exit (1);
}
.
.
sr_setparm ( SRL_DEVICE, SR_MODELTYPE, &sr_mode );
sr_enbhdlr ( EV_ANYDEV, EV_ANYEVT, event_handler );
if (
cc_WaitCall (boarddev, &normal_crn, NULL, -1, EV_ASYNC)
<0)
procdevfail (linedev);
.
.
.
}
long event_handler(unsigned long event_handle)
{
CRN crn;
int event;
void *datap;
char ani_buf[CC_ADDRSIZE];
CHAN_ID chanId;
event = sr_getevttype(event_handle);
datap = sr_getevtdatap(event_handle);
cc_GetCRN(&crn, datap);
switch(event)
{
case CCEV_OFFERED:
cc_GetChanId(crn, &chanId);
switch(chanId.channel)
{
case NO_BCHAN: /* waiting call */
cc_GetANI (crn, ani_buf);
if (strcmp (ani_buf, 9933000)==0)
{
waitingcall_crn = crn;
/* If no resource is available, then an active one must be freed */
if( cc_DropCall (active_crn, NORMAL_CLEARING, EV_ASYNC)<0)
callfail(crn);
/** Optionally, the active call can be put on Hold
if( cc_HoldCall (active_crn, EV_ASYNC)<0)
callfail(crn);
**/
}
else /* this call is not for us */