Quellcode durchsuchen

Z991239-2175 #comment fix: 优化框架启动后断网,sipphone实体lost等异常情况下,提机呼叫失败无提示问题

陈礼鹏80274480 vor 4 Jahren
Ursprung
Commit
8c3fc94de7

+ 15 - 3
Module/mod_counterconnector/ConnectorFSM.cpp

@@ -572,9 +572,21 @@ void ACMCallFSM::s11_on_entry()
 			Dbg("make call result:0x%08x", Error);
 		}
 	}
-	if (Error != Error_Succeed) 
-	{
-		PostEventFIFO(new FSMEvent(USER_EVT_JMP_FAIL));
+
+	if (Error != Error_Succeed) {
+		if (Error_NetBroken == Error || Error_TimeOut == Error){
+			PostEventFIFO(new FSMEvent(USER_EVT_HANGUP));
+			m_bHangup = TRUE;
+			if (Error_TimeOut == Error){
+				LogFatal(Severity_High, Error_TimeOut, 0, "获取IP失败,请检查机器网络!");
+			}
+			else{
+				LogFatal(Severity_High, Error_NetBroken, 0, "系统故障,尝试恢复中(预计90s内),请稍等!");
+			}
+		}
+		else{
+			PostEventFIFO(new FSMEvent(USER_EVT_JMP_FAIL));
+		}
 	}
 	else
 	{

+ 3 - 1
Module/mod_counterconnector/ConnectorFSM.h

@@ -557,8 +557,10 @@ private:
 
 	ErrorCodeEnum MakeCall(const char *hint_callnum,int nSipServer)
 	{
-		if (!m_pPhoneClient)
+		if (!m_pPhoneClient) {
 			return Error_NetBroken;
+		}
+			
 		if((m_strSIPCallNum[nSipServer]=="")&&(m_strSIPProxyIP[nSipServer]=="")&&(m_iSIPProxyPort[nSipServer]==0))
 		{
 			return Error_Param;

+ 28 - 28
Module/mod_sipphone/mod_sipphone.cpp

@@ -2162,39 +2162,39 @@ void CSIPPhoneSession::Handle_MakeCall( SpReqAnsContext<PhoneService_MakeCall_Re
 	cmd->strUri = ctx->Req.call_uri;
 	///////////重新初始化sip话机,防止断网导致IP改变//////////////////
 
-		if (m_pEntity->m_pEndpoint)
-		{
-			Dbg("%s:%d m_pEndpoint is not null and it's addr is 0x%0x,destroy it.", __FUNCTION__, __LINE__, m_pEntity->m_pEndpoint);
-			endpoint_destroy(m_pEntity->m_pEndpoint);
-			m_pEntity->m_pEndpoint = NULL;
-		}
-		CSimpleStringA strUri = m_pEntity->MakeUri(m_pEntity->staticInfo.strTerminalID);
-		if (strUri.GetLength() > 0) {
-			strcpy(m_pEntity->conf.uri, strUri);
-			m_pEntity->conf.media_start_port = REC_COMMON_AUDIO_PORT_START;
-			m_pEntity->conf.media_stop_port = REC_COMMON_AUDIO_PORT_STOP;
-			Dbg("%s:%d", __FUNCTION__, __LINE__);
-			m_pEntity->m_pEndpoint = endpoint_create(m_pEntity, &m_pEntity->conf, m_pEntity->m_iPickupPhoneState);
-			if (!m_pEntity->m_pEndpoint) {
-				LOG_TRACE("create endpoint failed!");
-			}
-			else {
-				Dbg("%s:%d endpoint_create m_pEndpoint addr is 0x%0x.", __FUNCTION__, __LINE__, m_pEntity->m_pEndpoint);
-			}
+	if (m_pEntity->m_pEndpoint){
+		Dbg("%s:%d m_pEndpoint is not null and it's addr is 0x%0x,destroy it.", __FUNCTION__, __LINE__, m_pEntity->m_pEndpoint);
+		endpoint_destroy(m_pEntity->m_pEndpoint);
+		m_pEntity->m_pEndpoint = NULL;
+	}
+	CSimpleStringA strUri = m_pEntity->MakeUri(m_pEntity->staticInfo.strTerminalID);
+	if (strUri.GetLength() > 0) {
+		strcpy(m_pEntity->conf.uri, strUri);
+		m_pEntity->conf.media_start_port = REC_COMMON_AUDIO_PORT_START;
+		m_pEntity->conf.media_stop_port = REC_COMMON_AUDIO_PORT_STOP;
+		Dbg("%s:%d", __FUNCTION__, __LINE__);
+		m_pEntity->m_pEndpoint = endpoint_create(m_pEntity, &m_pEntity->conf, m_pEntity->m_iPickupPhoneState);
+		if (!m_pEntity->m_pEndpoint) {
+			LOG_TRACE("create endpoint failed!");
 		}
 		else {
-			LOG_TRACE("strUri length equals zero!");
+			Dbg("%s:%d endpoint_create m_pEndpoint addr is 0x%0x.", __FUNCTION__, __LINE__, m_pEntity->m_pEndpoint);
 		}
+	}
+	else {
+		LOG_TRACE("strUri length equals zero!");
+	}
 
-		ErrorCodeEnum  Error = m_pEntity->GetLocalIP();
-		if (Error != 0) {
-			LOG_TRACE("get local ip failed!");
-		}
+	ErrorCodeEnum  Error = m_pEntity->GetLocalIP();
+	if (Error != 0) {
+		LOG_TRACE("get local ip failed!");
+		ctx->Answer(Error_TimeOut);
+		return;
+	}
 
-		if (m_pEntity->m_eDeviceType == eMobilePadType) {
-			m_pEntity->m_stVideoParam.nUpDynamicFps = 3;
-		}
-	
+	if (m_pEntity->m_eDeviceType == eMobilePadType) {
+		m_pEntity->m_stVideoParam.nUpDynamicFps = 3;
+	}
 
 	///////////重新初始化sip话机,防止断网导致IP改变//////////////////
 	if (m_pEntity->GetEndpoint()) {