Răsfoiți Sursa

!10500 解决连线失败问题&优化呼叫路由兜底实现方式
Merge pull request !10500 from 80274480/remoterecord_base_ST2

陈礼鹏80274480 11 luni în urmă
părinte
comite
0bdcfe63d3

+ 0 - 49
Module/mod_assistantchannel/AssistantChannel_client_g.h

@@ -280,55 +280,6 @@ public:
 		/// implement by user
 	}
 
-	ErrorCodeEnum GetIpByDomain(ChannelService_GetIpByDomain_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(ChannelService_Method_GetIpByDomain, ChannelService_MethodSignature_GetIpByDomain, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum GetIpByDomain(ChannelService_GetIpByDomain_Req &Req, ChannelService_GetIpByDomain_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetIpByDomain(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetIpByDomain(ChannelService_GetIpByDomain_Req &Req, ChannelService_GetIpByDomain_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetIpByDomain(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetIpByDomain(ChannelService_GetIpByDomain_Req &Req, ChannelService_GetIpByDomain_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetIpByDomain(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
 
 	bool SafeDelete()
 	{

+ 1 - 26
Module/mod_assistantchannel/AssistantChannel_def_g.h

@@ -47,7 +47,6 @@ namespace AssistantChannel {
 #define ChannelService_MethodSignature_BeginRecv -2054337141
 #define ChannelService_MethodSignature_EndRecv 1619609928
 #define ChannelService_MethodSignature_Packet -1048709116
-#define ChannelService_MethodSignature_GetIpByDomain 263102333
 
 #define ChannelService_LogCode_Connect "QLR040230C00"
 #define ChannelService_LogCode_Close "QLR040230C01"
@@ -59,12 +58,10 @@ struct ChannelService_Connect_Req
 {
 	CSimpleStringA ip;
 	int port;
-	CSimpleStringA callno;
-	int etype;
 
 	void Serialize(SpBuffer &Buf)
 	{
-		auto & buf = Buf & ip & port & callno & etype;
+		auto & buf = Buf & ip & port;
 	}
 
 };
@@ -197,28 +194,6 @@ struct ChannelService_Packet_Info
 
 };
 
-struct ChannelService_GetIpByDomain_Req
-{
-	CSimpleStringA strdomain;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & strdomain;
-	}
-
-};
-
-struct ChannelService_GetIpByDomain_Ans
-{
-	CSimpleStringA strip;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & strip;
-	}
-
-};
-
 
 ///////////////////////////
 

+ 0 - 27
Module/mod_assistantchannel/AssistantChannel_server_g.h

@@ -86,13 +86,6 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
-		case ChannelService_Method_GetIpByDomain:
-			if (dwSignature == ChannelService_MethodSignature_GetIpByDomain) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -144,11 +137,6 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
-		case ChannelService_Method_GetIpByDomain:
-			if (dwSignature != ChannelService_MethodSignature_GetIpByDomain) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -196,11 +184,6 @@ public:
 	/// override by user
 	}
 
-	virtual void Handle_GetIpByDomain(SpReqAnsContext<ChannelService_GetIpByDomain_Req, ChannelService_GetIpByDomain_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
 	virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
 	{
 		CAutoBuffer Buf;
@@ -289,16 +272,6 @@ public:
 						Handle_EndRecv(ctx);
 					}
 					break;
-				case ChannelService_Method_GetIpByDomain:
-					{
-						SpReqAnsContext<ChannelService_GetIpByDomain_Req,ChannelService_GetIpByDomain_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<ChannelService_GetIpByDomain_Req,ChannelService_GetIpByDomain_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_GetIpByDomain(ctx);
-					}
-					break;
 				default:
 					assert(0);
 					break;

+ 0 - 10
Module/mod_assistantchannel/ChannelService.xml

@@ -18,8 +18,6 @@
 			<req>
 				<param name="ip" type="string"/>
 				<param name="port" type="int"/>
-				<param name="callno" type="string"/>
-				<param name="etype" type="int"/>
 			</req>
 		</twoway>
 		<twoway name="Close" overlap="true">
@@ -55,13 +53,5 @@
 				<param name="data" type="blob"/>
 			</message>
 		</subscribe>
-		<twoway name="GetIpByDomain" overlap="true">
-			<req>
-				<param name="strdomain" type="string"/>
-			</req>
-			<res>
-				<param name="strip" type="string"/>
-			</res>
-		</twoway>
 	</class>
 </entity>

+ 4 - 8
Module/mod_assistantchannel/mod_assistantchannel.cpp

@@ -162,7 +162,7 @@ CServerSessionBase* CBizChannelEntity::OnNewSession(const char* pszRemoteEntityN
 }
 
 
-ErrorCodeEnum CBizChannelEntity::Connect(const char *ip, int port, const char *callno, CallingTypeEnum eType)
+ErrorCodeEnum CBizChannelEntity::Connect(const char *ip, int port)
 {
 	ErrorCodeEnum Error = Error_Succeed;
 	if (m_eState == eChannelState_Idle) 
@@ -175,6 +175,7 @@ ErrorCodeEnum CBizChannelEntity::Connect(const char *ip, int port, const char *c
 		config.proxy_server_port = port;
 		config.session_id = const_cast<char*>(((const char*)Info.strTerminalID));
 		config.client_id = "";
+		config.call_no = "";
 		config.video.desc = MakeDesc(Info.eScreen,m_eDeviceType);
 		config.video.rtp_port = REC_COMMON_VIDEO_PORT;
 		cb.user_data = this;
@@ -457,8 +458,8 @@ void CBizChannelEntity::_on_close()
 void ChannelServiceSession::Handle_Connect( SpReqAnsContext<ChannelService_Connect_Req, ChannelService_Connect_Ans>::Pointer ctx )
 {
 	DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start connect, %s:%d [%s]", (LPCSTR)ctx->Req.ip, ctx->Req.port, (LPCSTR)ctx->Req.callno);
-	ErrorCodeEnum Error = m_pEntity->Connect(ctx->Req.ip, ctx->Req.port, ctx->Req.callno, (CallingTypeEnum)ctx->Req.etype);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start connect, %s:%d", ctx->Req.ip.GetData(), ctx->Req.port);
+	ErrorCodeEnum Error = m_pEntity->Connect(ctx->Req.ip, ctx->Req.port);
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("connect Error = %d", Error);
 	ctx->Answer(Error);
 }
@@ -506,11 +507,6 @@ void ChannelServiceSession::Handle_EndRecv( SpOnewayCallContext<ChannelService_E
 	m_pEntity->UnregisterRxpkt(m_id);
 }
 
-void ChannelServiceSession::Handle_GetIpByDomain(SpReqAnsContext<ChannelService_GetIpByDomain_Req, ChannelService_GetIpByDomain_Ans>::Pointer ctx)
-{
-	DbgToBeidou(ctx->link, __FUNCTION__)();
-	ctx->Answer(Error_Succeed);
-}
 
 void ChannelServiceSession::OnClose( ErrorCodeEnum eErrorCode )
 {

+ 1 - 3
Module/mod_assistantchannel/mod_assistantchannel.h

@@ -38,7 +38,7 @@ public:
 	DeviceTypeEnum RvcGetDeviceType();
 	ErrorCodeEnum __OnClose(ErrorCodeEnum preOperationError);
 	virtual CServerSessionBase *OnNewSession(const char* pszRemoteEntityName, const char * pszClass);
-	ErrorCodeEnum Connect(const char *ip, int port, const char *callno, CallingTypeEnum eType);
+	ErrorCodeEnum Connect(const char *ip, int port);
 	ErrorCodeEnum Close();
 	int GetState() { return m_eState; }
 	ErrorCodeEnum RegisterState(int id, SpSubscribeContext<ChannelService_BeginState_Sub, ChannelService_State_Info>::Pointer ctx);
@@ -137,8 +137,6 @@ public:
 
 	virtual void OnClose(ErrorCodeEnum eErrorCode);
 
-	virtual void Handle_GetIpByDomain(SpReqAnsContext<ChannelService_GetIpByDomain_Req, ChannelService_GetIpByDomain_Ans>::Pointer ctx);
-
 private:
 	int m_id;
 	CBizChannelEntity *m_pEntity;

+ 22 - 12
Module/mod_counterconnector/ConnectorFSM.cpp

@@ -161,18 +161,32 @@ ACMCallFSM::~ACMCallFSM()
 ErrorCodeEnum ACMCallFSM::OnInit()
 {
 	ErrorCodeEnum Error = LoadConfig();
+	int iCount = 0;
+
 	if (Error != Error_Succeed) {
-		goto on_error;
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("on_error");
+		FSMEvent* e = new FSMEvent(USER_EVT_ERROR);
+		PostEventFIFO(e); // jump to error state
+		return Error;
 	}
 		
 	GetEntityBase()->GetFunction()->SetSysVar("CallState", "O"); // set to offline state 
 	Error = LoadTerminalId();
 	if (Error != Error_Succeed) {
-		goto on_error;
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("on_error");
+		FSMEvent* e = new FSMEvent(USER_EVT_ERROR);
+		PostEventFIFO(e); // jump to error state
+		return Error;
 	}
 
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_strDefaultServer %s.", m_strDefaultServer.GetData());
 	if(m_strDefaultServer.GetLength() > 0){
-		ParseDefaultServer(m_strDefaultServer.GetData());
+		iCount = ParseDefaultServer(m_strDefaultServer.GetData());
+	}
+	char strbuf[2 * MAX_PATH] = { 0 };
+	snprintf(strbuf, 2 * MAX_PATH, "%s", RVC_DEFAULT_VOIPSERVER_ADDR);
+	if (0 == iCount) {
+		ParseDefaultServer(strbuf);
 	}
 
 	m_bHangup = false;
@@ -188,12 +202,6 @@ ErrorCodeEnum ACMCallFSM::OnInit()
 	AddStateHooker(this);
 
 	return Error;
-
-on_error:
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("on_error");
-	FSMEvent *e = new FSMEvent(USER_EVT_ERROR);
-	PostEventFIFO(e); // jump to error state
-	return Error;
 }
 
 bool ACMCallFSM::ReConnectionAssistchan()
@@ -481,6 +489,7 @@ static int get_interger_netaddr(char *strbuf, size_t ubufszie, const char* szip)
 int ACMCallFSM::ParseDefaultServer(const char* strServer)
 {
 	int iRet = 0;
+
 	if(NULL == strServer){
 		return iRet;
 	}
@@ -490,6 +499,7 @@ int ACMCallFSM::ParseDefaultServer(const char* strServer)
 	int index = 0;
 	while(index < icount && result[index]){
 		m_voipserver.push_back(result[index]);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("result[%d] = [%s].", index, result[index]);
 		index++;
 	}
 
@@ -882,15 +892,15 @@ void ACMCallFSM::s11_on_entry()
 			m_iChanProxyPort[1] = node->uassistport;
 			m_strChanProxyIP[0] = node->strassistip;
 			m_strChanProxyIP[1] = node->strassistip;
-			node->bused = TRUE;
+			node->bused = true;
 		}	
 		else{
-			int icount = m_voipserver.size();
+			std::size_t icount = m_voipserver.size();
 			if (icount > 0){
 				int index = SP::Module::Comm::RVCGetTickCount()%icount;
 				char strcallurl[MAX_PATH] = {0};
 				char strassistip[32] = {0};
-				size_t uport = 0;
+				std::size_t uport = 0;
 				char strserver[MAX_PATH] = { 0 };
 				snprintf(strserver, MAX_PATH, "%s", m_voipserver[index].c_str());
 				if (0 == GetCallInfoFromConfig(strcallurl, MAX_PATH, strassistip, 32, &uport, strserver)){

+ 10 - 2
Module/mod_counterconnector/ConnectorFSM.h

@@ -47,6 +47,15 @@ using namespace InteractionContext;
 #define RVC_DEFAULT_HTTPTIMEOUT 10
 #endif // !RVC_DEFAULT_HTTPTIMEOUT
 
+#ifndef RVC_DEFAULT_VOIPSERVER_ADDR
+#ifdef DEVOPS_ON_PRD
+#define RVC_DEFAULT_VOIPSERVER_ADDR "sip:843235023@10.16.129.1,10.16.130.65 2334|sip:843235023@10.16.129.3,10.16.130.66 2334|sip:843235023@10.16.129.5,10.16.130.67 2334|sip:843235023@10.16.129.9,10.16.130.68 2334|sip:843235023@10.16.129.10,10.16.130.131 2334|sip:843235023@10.16.128.1,10.16.130.132 2334|sip:843235023@10.16.128.2,10.16.130.133 2334|sip:843235023@10.16.128.3,10.16.130.134 2334|sip:843235023@10.16.128.4,10.16.130.68 2334|sip:843235023@10.16.128.5,10.16.130.131 2334\0"
+#else
+#define RVC_DEFAULT_VOIPSERVER_ADDR "sip:843215022@55.9.188.83,55.9.188.83 2334|sip:843215022@55.9.188.83,55.9.188.83 2334\0"
+#endif// !DEVOPS_ON_PRD
+
+#endif // !RVC_DEFAULT_VOIPSERVER_ADDR
+
 
 #define USER_EVT_PICKUP_CALL	EVT_USER+1
 #define USER_EVT_HANDFREE_CALL	EVT_USER+2
@@ -97,7 +106,7 @@ enum CurServerNum
 };
 
 #ifndef MAX_VOIP_SERVER_NUM
-#define MAX_VOIP_SERVER_NUM 10
+#define MAX_VOIP_SERVER_NUM 16
 #endif
 
 struct ChanStateConnectedEvent : public FSMEvent 
@@ -640,7 +649,6 @@ private:
 		else{
 			Req.ip = m_strChanProxyIP[nChanServer];
 			Req.port = m_iChanProxyPort[nChanServer];
-			Req.etype = NORMAL_CALLTYPE;
 			return m_pChannelClient->Connect(Req, Ans, 10000);
 		}		
 	}