📄 gatestat.bak.txt
字号:
USHORT gateWaitForIdle(LPDM3NetTSC lpNetTsc,
LONG event,
void *pEvtData)
{
BOOL rBool;
UInt32 InfoArr[3];
LPDM3TSC lpTsc;
GateSession *pCamelSession;
USHORT channel;
pCamelSession = (GateSession *)(lpNetTsc->lpUserInfo);
channel = pCamelSession->sessionNumber;
lpTsc = NETTSC_GET_DM3TSC(lpNetTsc);
gateTRACE(channel,(Session[channel].LogFile,"In WAIT_FOR_IDLE on channel %d\n\t got event %s (0x%x)\n",
channel,gateEventStr(event), event));
/* Switch on event */
switch(event) {
/* Got idle state */
case TSC_EvtCallState_Type_Idle:
chanInfo[channel].callsIdle++;
/* Set array for get call info message */
InfoArr[0] = CallInfo_RTCPInfo;
InfoArr[1] = CallInfo_CallDurationTime;
/* Get call information */
Dm3TscGetCallInfo(lpTsc,2,InfoArr);
break;
case TSC_MsgGetCallInfoCmplt:
/* Releasing call */
rBool = Dm3TscReleaseCall(lpTsc, /* poinet to DM3TSC structure */
/* reason for releasing the call */
TSC_MsgRejectCall_Reason_Busy);
if(rBool==DM3FAIL) {
gateFATAL(channel,(Session[channel].LogFile,"\tError releasing Call channel %d \n", channel));
return(DM3FAIL);
}
else {
gateTRACE(channel,(Session[channel].LogFile,"Releasing call on channel %d.\n",channel));
gateUpdate(pCamelSession,GATE_WAIT_RELEASE);
}
break;
case DIGITAL_OFFHOOK:
Session[channel].waitOnHook = TRUE;
break;
case DIGITAL_ONHOOK:
Session[channel].waitOnHook = FALSE;
break;
/* Case of Exit Notification */
case TSC_EvtChanState_Type_OutOfService:
gateTRACE(channel,(Session[channel].LogFile,"Channel %d OutOfService.\n",channel));
gateExit(CHAN_OUT_OF_SERVICE,channel);
break;
default:
gateTRACE(channel,(Session[channel].LogFile,"\tUnexpected event %s (0x%x) on channel %d in WaitForIdle\n",
gateEventStr(event),event,channel));
break;
} /* end switch(event) */
return (DM3SUCCESS);
} /* Function gateWaitForIdle */
/*****FUNCTION***************************************************
* NAME : gateWaitForRelease
* DESCRIPTION : Waiting for null, then set pstn on-hook
* and reset data structure
* INPUT : LPDM3NetTSC lpNetTsc - pointer to NetTsc structure
* LONG event - the recieved event
* void *pEvtData - the data recieved
* OUTPUT : None
* RETURNS : Success or fail
* CAUTIONS : None.
****************************************************************/
USHORT gateWaitForRelease(LPDM3NetTSC lpNetTsc,
LONG event,
void *pEvtData)
{
LPDM3TSC lpTsc;
GateSession *pCamelSession;
USHORT channel;
BOOL rBool;
pCamelSession = (GateSession *)(lpNetTsc->lpUserInfo);
channel = pCamelSession->sessionNumber;
lpTsc = NETTSC_GET_DM3TSC(lpNetTsc);
gateTRACE(channel,(Session[channel].LogFile,"In WAIT_FOR_RELEASE on channel %d\n\t got Event %s (0x%x)\n",
channel,gateEventStr(event), event));
switch(event) {
case DIGITAL_OFFHOOK:
Session[channel].waitOnHook = TRUE;
break;
case DIGITAL_ONHOOK:
Session[channel].waitOnHook = FALSE;
break;
/* Got null event */
case TSC_EvtCallState_Type_Null:
if( lpTsc->fBusy) {
/* Set PSTN on-hook */
rBool = pstnOnHook(channel);
if(rBool==DM3FAIL) {
gateFATAL(channel,(Session[channel].LogFile,"\tError setting on hook for channel %d in Wait For Disconnect\n",
channel));
}
}
chanInfo[channel].callsNull++;
if(((frontEnd == GATE_LEGACY_T1) || (frontEnd == GATE_LEGACY_E1))
&& (Session[channel].waitOnHook == TRUE) ) {
if((pstnState(channel) == TRUE)) {
gateUpdate(pCamelSession,PSTN_RELEASE);
return(DM3SUCCESS);
}
}
/* Reset session */
IPTResetSession(channel,FALSE);
break;
/* Case of Exit Notification */
case TSC_EvtChanState_Type_OutOfService:
gateTRACE(channel,(Session[channel].LogFile,"Channel %d OutOfService.\n",channel));
gateExit(CHAN_OUT_OF_SERVICE,channel);
break;
default:
gateTRACE(channel,(Session[channel].LogFile,"\tUnexpected event %s (0x%x) on channel %d in WaitForRelease\n",
gateEventStr(event), event,channel));
break;
} /* end switch(event) */
return (DM3SUCCESS);
} /* Function gateWaitForRelease */
/*****FUNCTION***************************************************
* NAME : gatePstnRelease
* DESCRIPTION : Waiting for on hook from PSTN:
*
* INPUT : LPDM3NetTSC lpNetTsc - pointer to NetTsc structure
* LONG event - the recieved event
* void *pEvtData - the data recieved
* OUTPUT : None
* RETURNS : Success or fail
* CAUTIONS : None.
****************************************************************/
USHORT gatePstnRelease(LPDM3NetTSC lpNetTsc,
LONG event,
void *pEvtData)
{
BOOL rBool;
LPDM3TSC lpTsc;
GateSession *pCamelSession;
USHORT channel;;
pCamelSession = (GateSession *)(lpNetTsc->lpUserInfo);
channel = pCamelSession->sessionNumber;
lpTsc = NETTSC_GET_DM3TSC(lpNetTsc);
gateTRACE(channel,(Session[channel].LogFile,"In PSTN_RELEASE on channel %d\n\t got event %s (0x%x)\n",
channel,gateEventStr(event), event));
switch(event) {
case DIGITAL_ONHOOK:
/* Reset session */
IPTResetSession(channel,FALSE);
break;
/* Case of Offering from LAN */
case TSC_EvtCallState_Type_Offered:
chanInfo[channel].callsOffered++;
Session[channel].resetNow = 3;
rBool = Dm3TscRejectCall(lpTsc, /* pointer to DM3TSC structure */
/* reason for rejecting the call */
TSC_MsgRejectCall_Reason_Busy);
if(rBool==DM3FAIL) {
gateFATAL(channel,(Session[channel].LogFile,"\tError rejecting Call channel %d\n", channel));
return(DM3FAIL);
}
gateTRACE(channel,(Session[channel].LogFile,"\tRejecting call on channel %d, Didn't get on_hook Cmplt yet\n",channel));
chanInfo[channel].callsRejected++;
gateUpdate(pCamelSession,GATE_WAIT_DONE);
break;
/* Case of Exit Notification */
case TSC_EvtChanState_Type_OutOfService:
gateTRACE(channel,(Session[channel].LogFile,"Channel %d OutOfService.\n",channel));
gateExit(CHAN_OUT_OF_SERVICE,channel);
break;
default:
gateTRACE(channel,(Session[channel].LogFile,"\tUnexpected event %s (0x%x) on channel %d in PstnRelease\n",
gateEventStr(event),event,channel));
break;
} /* end switch(event) */
return (DM3SUCCESS);
} /* Function gatePstnRelease */
/*****FUNCTION***************************************************
* NAME : gateWaitDone
* DESCRIPTION : Still waiting for on hook from PSTN,
* Idle from NetTSC to release the call
* and Null to reset session structure
*
* INPUT : LPDM3NetTSC lpNetTsc - pointer to NetTsc structure
* LONG event - the recieved event
* void *pEvtData - the data recieved
* OUTPUT : None
* RETURNS : Success or fail
* CAUTIONS : None.
****************************************************************/
USHORT gateWaitDone(LPDM3NetTSC lpNetTsc,
LONG event,
void *pEvtData)
{
BOOL rBool;
LPDM3TSC lpTsc;
GateSession *pCamelSession;
USHORT channel;
pCamelSession = (GateSession *)(lpNetTsc->lpUserInfo);
channel = pCamelSession->sessionNumber;
lpTsc = NETTSC_GET_DM3TSC(lpNetTsc);
gateTRACE(channel,(Session[channel].LogFile,"In GATE_WAIT_DONE on channel %d\n\t got event %s (0x%x)\n",
channel,gateEventStr(event), event));
switch(event) {
/* Case of Offering from LAN */
case TSC_EvtCallState_Type_Offered:
Session[channel].resetNow += 2;
chanInfo[channel].callsOffered++;
rBool = Dm3TscRejectCall(lpTsc, /* pointer to DM3TSC structure */
/* reason for rejecting the call */
TSC_MsgRejectCall_Reason_Busy);
if(rBool==DM3FAIL) {
gateFATAL(channel,(Session[channel].LogFile,"\tError rejecting Call channel %d\n", channel));
return(DM3FAIL);
}
gateTRACE(channel,(Session[channel].LogFile,"\tRejecting call on channel %d, Didn't get on_hook Cmplt yet\n",channel));
chanInfo[channel].callsRejected++;
break;
case DIGITAL_ONHOOK:
Session[channel].resetNow--;
if(Session[channel].resetNow == 0) {
/* Reset session */
IPTResetSession(channel,FALSE);
}
break;
case TSC_EvtCallState_Type_Idle:
Session[channel].resetNow--;
chanInfo[channel].callsIdle++;
/* Releasing call */
rBool = Dm3TscReleaseCall(lpTsc, /* pointer to DM3TSC structure */
/* reason for releasing call */
TSC_MsgRejectCall_Reason_Busy);
if(rBool==DM3FAIL) {
gateFATAL(channel,(Session[channel].LogFile,"\tError releasing Call channel %d \n", channel));
return(DM3FAIL);
}
break; /* End of TSC_EvtCallState_Type_Idle case */
/* Got null event */
case TSC_EvtCallState_Type_Null:
Session[channel].resetNow--;
chanInfo[channel].callsNull++;
if(Session[channel].resetNow == 0) {
/* Reset session */
IPTResetSession(channel,FALSE);
}
break;
/* Case of Exit Notification */
case TSC_EvtChanState_Type_OutOfService:
gateTRACE(channel,(Session[channel].LogFile,"Channel %d OutOfService.\n",channel));
gateExit(CHAN_OUT_OF_SERVICE,channel);
break;
default:
gateTRACE(channel,(Session[channel].LogFile,"\tUnexpected event %s (0x%x) on channel %d in gateWaitDone\n",
gateEventStr(event),event,channel));
break;
} /* end switch(event) */
return (DM3SUCCESS);
} /* Function gateWaitDone */
/**** End of File: GateState.c *****/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -