📄 gatestat.bak.txt
字号:
return (DM3SUCCESS);
} /* Function gateWaitForCall */
/*****FUNCTION***************************************************
* NAME : gateWaitForConnect
* DESCRIPTION : Waiting for connect event from NetTSC:
* * If we made call update state to
* WAIT FOR DISCONNECT
* * If we got offering from NetTSC,
* we should dial to local extention
* and route.
* 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 gateWaitForConnect(LPDM3NetTSC lpNetTsc,
LONG event,
void *pEvtData)
{
BOOL rBool;
LPDM3TSC lpTsc;
CallParameters *CFGParm;
CallParameters *lpCallParm;
GateSession *pCamelSession;
USHORT channel;
pCamelSession = (GateSession *)(lpNetTsc->lpUserInfo);
channel = pCamelSession->sessionNumber;
lpTsc = NETTSC_GET_DM3TSC(lpNetTsc);
lpCallParm = NETTSC_GET_CALLPARM(lpNetTsc);
CFGParm = &(pCamelSession->ConfigFileParm);
gateTRACE(channel,(Session[channel].LogFile,"In WAIT_FOR_CONNECT on channel %d\n\t got event %s (0x%x)\n",
channel,gateEventStr(event), event));
switch(event) {
case TSC_EvtCallState_Type_Connected:
chanInfo[channel].callsConnected++;
/* Update the active channel to send UII or NonStdCmd */
activeChannel = channel;
if(lpNetTsc->fIsInbound == TRUE) {
/* Go off hook */
if(pstnOffHook(channel) == DM3FAIL) {
gateFATAL(channel,(Session[channel].LogFile,"\tError setting line on channel %d\n"));
}
if((frontEnd == GATE_LEGACY_T1) || (frontEnd == GATE_LEGACY_E1) ) {
if((pstnState(channel) == FALSE)) {
gateUpdate(pCamelSession,PSTN_INIT);
return(DM3SUCCESS);
}
}
/* Dialing the local phone number on Analog front end*/
if (frontEnd == GATE_LEGACY_ANALOG) {
gateTRACE(channel,(Session[channel].LogFile,"\tDialing (%s) on channel %d\n",
lpCallParm->localPhoneNumber, channel));
rBool = pstnDial(channel, lpCallParm->localPhoneNumber);
if(rBool==DM3FAIL) {
gateFATAL(channel,(Session[channel].LogFile,"\tError dialing on channel %d\n", channel));
return(DM3FAIL);
}
}
/* Routing the channels */
rBool = gateRoute(channel);
if(rBool==DM3FAIL) {
gateFATAL(channel,(Session[channel].LogFile,"\tError routing after dial on channel %d\n", channel));
}
} /* End of if(lpNetTsc->fIsInbound == TRUE) */
gateUpdate(pCamelSession,GATE_WAIT_DISCONNECT);
break;
/* Case of MakeCallCmlt */
case TSC_MsgMakeCallCmplt:
gateTRACE(channel,(Session[channel].LogFile,"Got makeCallCmplt on channel %d.\n",channel));
break;
/* ...._Idle can happen if the h323 service could
not find matching coders to astablish the call (as a respond to answerCall) */
case TSC_EvtCallState_Type_Idle:
chanInfo[channel].callsIdle++;
if(lpNetTsc->fIsInbound != TRUE) {
gateUnRoute(channel);
}
/* 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);
}
else {
gateTRACE(channel,(Session[channel].LogFile,"Releasing call on channel %d.\n",channel));
gateUpdate(pCamelSession,GATE_WAIT_RELEASE);
}
return(DM3SUCCESS);
break;
/* ...._Failed can happen if the remote side decided to disconect
, if h323 service didn't find matching coders(as a respond to makeCall) */
case TSC_EvtCallState_Type_Failed:
gateTRACE(channel,(Session[channel].LogFile,"Got Failed or Disconneted reason is %d\n",
((TSC_EvtCallState_t *)(pEvtData))->Reason));
chanInfo[channel].callsFailed++;
/* Can happen if the user made call and hang up before connection */
case DE_LCOFF:
case DE_TONEON:
case DIGITAL_ONHOOK:
if(event != TSC_EvtCallState_Type_Failed) {
Session[channel].waitOnHook = FALSE;
gateTRACE(channel,(Session[channel].LogFile,"PSTN Disconnect on channel %d\n",
channel));
}
/* Unlisten both sides */
if(lpNetTsc->fIsInbound != TRUE) {
gateUnRoute(channel);
}
/* Dropping call */
Dm3TscDropCall(lpTsc, /* pointer to DM3TSC structure */
/* reason for dropping call */
CallStateR_RemoteTermination);
chanInfo[channel].callsDropped++;
gateUpdate(pCamelSession,GATE_WAIT_IDLE);
break;
/* Case of Exit Notification */
case TSC_EvtChanState_Type_OutOfService:
gateTRACE(channel,(Session[channel].LogFile,"Channel %d OutOfService.\n",channel));
if(lpNetTsc->fIsInbound != TRUE) {
gateUnRoute(channel);
}
gateExit(CHAN_OUT_OF_SERVICE,channel);
break;
default:
gateTRACE(channel,(Session[channel].LogFile,"\tUnexpected event %s (0x%x) on channel %d in WaitForConnect\n",
gateEventStr(event),event,channel));
break;
} /* end switch(event) */
return (DM3SUCCESS);
} /* Function gateWaitForConnect */
/*****FUNCTION***************************************************
* NAME : gatePstnInit
* DESCRIPTION : Waiting for off 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 gatePstnInit(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_INIT on channel %d\n\t got event %s (0x%x)\n",
channel,gateEventStr(event), event));
switch(event) {
case DIGITAL_OFFHOOK:
Session[channel].waitOnHook = TRUE;
/* Routing the channels */
rBool = gateRoute(channel);
if(rBool==DM3FAIL) {
gateFATAL(channel,(Session[channel].LogFile,"\tError routing after dial on channel %d\n", channel));
}
gateUpdate(pCamelSession,GATE_WAIT_DISCONNECT);
break;
/* A drop from the NetTSC */
case TSC_EvtCallState_Type_Disconnected:
gateTRACE(channel,(Session[channel].LogFile,"Got Call State Disconnected the reason is %d\n",
((TSC_EvtCallState_t *)(pEvtData))->Reason));
/* Dropping call */
Dm3TscDropCall(lpTsc, /* pointer to DM3TSC structure */
/* Reason for dropping call */
CallStateR_RemoteTermination);
chanInfo[channel].callsDropped++;
gateUpdate(pCamelSession,GATE_WAIT_IDLE);
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 PstnInit\n",
gateEventStr(event),event,channel));
break;
} /* end switch(event) */
return (DM3SUCCESS);
} /* Function gatePstnInit */
/*****FUNCTION***************************************************
* NAME : gateWaitForDisconnect
* DESCRIPTION : Gateway is in connected state.
* May get UII or NonStdCmd.
* Waiting for hang up or netTSC drop,
* then unroute the channel and send message drop call
* 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 gateWaitForDisconnect(LPDM3NetTSC lpNetTsc,
LONG event,
void *pEvtData)
{
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_DISCONNECT on channel %d\n\t got event %s (0x%x)\n",
channel,gateEventStr(event), event));
/* Switch on event */
switch(event) {
/* Case of Exit Notification */
case TSC_EvtChanState_Type_OutOfService:
gateUnRoute(channel);
gateTRACE(channel,(Session[channel].LogFile,"Channel %d OutOfService.\n",channel));
gateExit(CHAN_OUT_OF_SERVICE,channel);
break;
/* Got call information */
case TSC_MsgGetCallInfoCmplt :
gateTRACE(channel,(Session[channel].LogFile,"Got Call info cmplt on channel %d\n",
channel));
break;
/* Any drop whether from phone line or NetTSC is handled basically the same: */
case TSC_EvtCallState_Type_Disconnected:
gateTRACE(channel,(Session[channel].LogFile,"Got Call State Disconnected the reason is %d\n",
((TSC_EvtCallState_t *)(pEvtData))->Reason));
case DE_LCOFF:
case DE_TONEON:
case DIGITAL_ONHOOK:
if(event != TSC_EvtCallState_Type_Disconnected) {
Session[channel].waitOnHook = FALSE;
gateTRACE(channel,(Session[channel].LogFile,"PSTN Disconnect on channel %d\n",
channel));
}
/* Unlisten both sides */
gateUnRoute(channel);
/* Dropping call */
Dm3TscDropCall(lpTsc, /* pointer to DM3TSC structure */
/* Reason for dropping call */
CallStateR_RemoteTermination);
chanInfo[channel].callsDropped++;
gateUpdate(pCamelSession,GATE_WAIT_IDLE);
break;
default:
gateTRACE(channel,(Session[channel].LogFile,"\tUnexpected event %s (0x%x) on channel %d in WaitForDisconnect\n",
gateEventStr(event),event,channel));
break;
} /* end switch(event) */
return (DM3SUCCESS);
} /* Function gateWaitForDisconnect */
/*****FUNCTION***************************************************
* NAME : gateWaitForIdle
* DESCRIPTION : Gateway is waiting for idle state,
* then get information about the call and send release call
*
* 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.
****************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -