Преглед на файлове

Z991239-4629 #comment 信创支持新版呼叫路由

80274480 преди 2 години
родител
ревизия
4a6e9123a5

+ 3 - 0
Module/mod_counterconnector/CMakeLists.txt

@@ -15,12 +15,15 @@ set(${MODULE_PREFIX}_SRCS
 	callroute_request.cpp
 	callrouter.h
 	callrouter.cpp
+	http_callrouter.h
+	http_callrouter.cpp
 	)
 
 set(MOD_VERSION_STRING "0.0.1-dev1")
 add_module_libraries(${MODULE_PREFIX} ${MODULE_NAME} ${MOD_VERSION_STRING})
 
 target_include_directories(${MODULE_NAME} PRIVATE
+	${CONAN_INCLUDE_DIRS_JSONCPP}
 )
 
 target_link_directories(${MODULE_NAME} PRIVATE

+ 186 - 114
Module/mod_counterconnector/ConnectorFSM.cpp

@@ -17,6 +17,9 @@
 #define MAX_PATH 260
 #endif
 
+#ifndef RVC_CALLROUTE_HTTP_API
+#define RVC_CALLROUTE_HTTP_API "/api/route/query"
+#endif // !RVC_CALLROUTE_HTTP_API
 
 static const char* connect_failed_case_table[] = {
 	"",
@@ -151,28 +154,39 @@ ErrorCodeEnum ACMCallFSM::OnInit()
 	memset(m_iSIPProxyPort,0,sizeof(m_iSIPProxyPort));
 	memset(m_strChanCallNum,0,sizeof(m_strChanCallNum));
 	memset(m_strChanProxyIP,0,sizeof(m_strChanProxyIP));
-	memset(m_iSIPProxyPort,0,sizeof(m_iSIPProxyPort));
+	memset(m_iChanProxyPort, 0, sizeof(m_iChanProxyPort));
 	m_strCallRouteIP = NULL;
 	m_iCallRoutePort = 0;
 	m_strCallRouteBranchNo = NULL;
 	m_strCallRouteAccessNo = NULL;
 	m_pCallRouteList = NULL;
 	m_strDefaultServer = NULL;
+	m_strHttpCallRouteAddr = NULL;
+	m_strHttpServerAPI = RVC_CALLROUTE_HTTP_API;
+	m_strQueueName = NULL;
+	m_strAddClientLevel = NULL;
+	m_iCallRouteType = 0;
 	m_LastSipError = Error_Succeed;
 	m_LastAssistError = Error_Succeed;
+	m_bNeedQueueName = FALSE;
 	ErrorCodeEnum Error = LoadConfig();
-	if (Error != Error_Succeed)
+	if (Error != Error_Succeed) {
 		goto on_error;
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("LoadConfig success");
+	}
+		
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("LoadConfig success");
 	GetEntityBase()->GetFunction()->SetSysVar("CallState", "O"); // set to offline state 
 	Error = LoadTerminalId();
-	if (Error != Error_Succeed)
+	if (Error != Error_Succeed) {
 		goto on_error;
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("sip proxy ip1:%s,num1:%s,port1:%d;ip2:%s,num2:%s,port2:%d", (LPCSTR)m_strSIPProxyIP[0],(LPCSTR)m_strSIPCallNum[0], m_iSIPProxyPort[0],(LPCSTR)m_strSIPProxyIP[1],(LPCSTR)m_strSIPCallNum[1], m_iSIPProxyPort[1]);
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("chan proxy ip1:%s,num1:%s,port1:%d;ip2:%s,num2:%s,port2:%d", (LPCSTR)m_strChanProxyIP[0],(LPCSTR)m_strChanCallNum[0], m_iChanProxyPort[0],(LPCSTR)m_strChanProxyIP[1],(LPCSTR)m_strChanCallNum[1], m_iChanProxyPort[1]);
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("CallRouteIP:%s,port:%d", (LPCSTR)m_strCallRouteIP,m_iCallRoutePort);
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("TerminalId: %s", (LPCSTR)m_strTerminalId);
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("default_voip_server: %s", m_strDefaultServer.GetData());
+	}
+		
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("sip proxy ip1:%s,num1:%s,port1:%d;ip2:%s,num2:%s,port2:%d", (LPCSTR)m_strSIPProxyIP[0],(LPCSTR)m_strSIPCallNum[0], m_iSIPProxyPort[0],(LPCSTR)m_strSIPProxyIP[1],(LPCSTR)m_strSIPCallNum[1], m_iSIPProxyPort[1]);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("chan proxy ip1:%s,num1:%s,port1:%d;ip2:%s,num2:%s,port2:%d", (LPCSTR)m_strChanProxyIP[0],(LPCSTR)m_strChanCallNum[0], m_iChanProxyPort[0],(LPCSTR)m_strChanProxyIP[1],(LPCSTR)m_strChanCallNum[1], m_iChanProxyPort[1]);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("CallRouteIP:%s,port:%d", (LPCSTR)m_strCallRouteIP,m_iCallRoutePort);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("TerminalId: %s", (LPCSTR)m_strTerminalId);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("default_voip_server: %s", m_strDefaultServer.GetData());
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("HttpCallRouteAddr: %s", m_strHttpCallRouteAddr.GetData());
 	if(m_strDefaultServer.GetLength() > 0){
 		ParseDefaultServer(m_strDefaultServer.GetData());
 	}
@@ -187,7 +201,7 @@ ErrorCodeEnum ACMCallFSM::OnInit()
 
 	m_nSysCallType = 0;
 
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("fsm init ok!");
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("fsm init ok!");
 
 	AddStateHooker(this);
 
@@ -205,11 +219,11 @@ BOOL ACMCallFSM::ReConnectionAssistchan()
 	if (m_pChannelClient != NULL){
 		m_pChannelClient->GetFunction()->CloseSession();
 		m_pChannelClient = NULL;
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Close AssistChannel Session ");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Close AssistChannel Session ");
 	}
 
 	if (m_pChannelClient == NULL){
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ReConnection AssistChannel Session");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("ReConnection AssistChannel Session");
 		m_pChannelClient = new MyChannelClient(m_pEntity, this);
 		ErrorCodeEnum Error = m_pChannelClient->Connect();
 		if (Error != Error_Succeed) {
@@ -218,7 +232,7 @@ BOOL ACMCallFSM::ReConnectionAssistchan()
 			return FALSE;
 		}
 		else {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_channelClient connect success!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_channelClient connect success!");
 		}
 
 		if (Error == Error_Succeed){
@@ -231,7 +245,7 @@ BOOL ACMCallFSM::ReConnectionAssistchan()
 				return FALSE;
 			}
 			else {
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("BeginState biz channel success!");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("BeginState biz channel success!");
 			}
 		}
 	}
@@ -240,15 +254,14 @@ BOOL ACMCallFSM::ReConnectionAssistchan()
 
 BOOL ACMCallFSM::ReConnectionSipphone()
 {
-	if (m_pPhoneClient != NULL)
-	{
+	if (m_pPhoneClient != NULL){
 		m_pPhoneClient->GetFunction()->CloseSession();
 		m_pPhoneClient = NULL;
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Close sip Session ");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Close sip Session");
 	}
 
 	if (m_pPhoneClient == NULL){
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ReConnection sip Session");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("ReConnection sip Session");
 		m_pPhoneClient = new MyPhoneClient(m_pEntity, this);
 		ErrorCodeEnum Error = m_pPhoneClient->Connect();
 		if (Error != Error_Succeed) {
@@ -258,7 +271,7 @@ BOOL ACMCallFSM::ReConnectionSipphone()
 			return FALSE;
 		}
 		else {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_phoneClient connect success!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_phoneClient connect success!");
 		}
 
 		if (Error == Error_Succeed)
@@ -272,7 +285,7 @@ BOOL ACMCallFSM::ReConnectionSipphone()
 				return FALSE;
 			}
 			else {
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("BeginState sip success!");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("BeginState sip success!");
 			}
 		}
 	}
@@ -285,7 +298,7 @@ BOOL ACMCallFSM::ReConnectionSyncService()
 	if (NULL != m_pSyncServiceClient){
 		m_pSyncServiceClient->GetFunction()->CloseSession();
 		m_pSyncServiceClient = NULL;
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Close SyncService Session.");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Close SyncService Session.");
 	}
 
 	m_pSyncServiceClient = new SyncServiceClient(m_pEntity, this);
@@ -296,12 +309,81 @@ BOOL ACMCallFSM::ReConnectionSyncService()
 		return FALSE;
 	}
 	else {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Connect SyncService Success!");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Connect SyncService Success!");
 	}
 
 	return TRUE;
 }
 
+int ACMCallFSM::GetCallRouteList()
+{
+	int iret = -1;
+
+	if (0 == m_iCallRouteType) {
+		if (m_strCallRouteIP.GetLength() != 0) {
+			int icount = 0;
+			call_info_t call_info;
+			call_info.callroute_server_ip = m_strCallRouteIP;
+			call_info.callroute_server_port = m_iCallRoutePort;
+			call_info.szbranchno = m_strCallRouteBranchNo;
+			call_info.szcaller_num = m_strTerminalId;
+			call_info.szdest_num = m_strCallRouteAccessNo;
+
+			do {
+				m_pCallRouteList = get_callroute_list(&call_info);
+				icount++;
+			} while (!m_pCallRouteList && icount < CALLROUTE_MAX_TRY_COUNT);
+
+			if (icount > 1) {
+				char strmsg[MAX_PATH] = { 0 };
+				snprintf(strmsg, MAX_PATH, "request call route {%s:%d} %d times.", m_strCallRouteIP.GetData(), m_iCallRoutePort, icount);
+				LogWarn(Severity_Low, Error_Debug, LOG_WARN_COUNTERCONNECT_CALLROUTE_TIMES, strmsg);
+			}
+		}
+	}
+	else{
+		if (m_strHttpCallRouteAddr.GetLength() != 0) {
+			int ihttpcount = 0;
+			http_call_info_t http_callinfo;
+			http_callinfo.strServerURL = m_strHttpCallRouteAddr;
+			http_callinfo.strAPI = m_strHttpServerAPI;
+
+			if (m_bNeedQueueName) {
+				http_callinfo.strQueueName = m_strQueueName;
+				http_callinfo.strAddClientLevel = m_strAddClientLevel;
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("http call route queue name is %s, and client level is %s.", http_callinfo.strQueueName.GetData(), http_callinfo.strAddClientLevel.GetData());
+			}
+			else {
+				http_callinfo.strQueueName = NULL;
+				http_callinfo.strAddClientLevel = NULL;
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("http call route queue name is NULL, and client level is NULL.");
+			}
+
+			http_callinfo.strTerminalNo = m_strTerminalId;
+
+			do {
+				m_pCallRouteList = get_http_callroute_list(&http_callinfo);
+				ihttpcount++;
+			} while (!m_pCallRouteList && ihttpcount < CALLROUTE_MAX_TRY_COUNT);
+
+			if (ihttpcount > 1) {
+				char strmsg[MAX_PATH] = { 0 };
+				snprintf(strmsg, MAX_PATH, "request http call route address{%s} %d times.", m_strHttpCallRouteAddr.GetData(), ihttpcount);
+				LogWarn(Severity_Low, Error_Debug, LOG_WARN_COUNTERCONNECT_CALLROUTE_TIMES, strmsg);
+			}
+		}
+	}
+
+	if (NULL != m_pCallRouteList) {
+		iret = 0;                    
+	}
+	else {
+		LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_CALLROUTE_FAILED, "call route request failed!");
+	}
+
+	return iret;
+}
+
 
 int ACMCallFSM::GetDelayTime()
 {
@@ -333,7 +415,7 @@ void ACMCallFSM::SetDelayTime()
 		info.key = "DelayTime";
 		info.data = "0";
 		m_pSyncServiceClient->SetMachineData(info);
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("set delay time to 0");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("set delay time to 0");
 	}
 }
 
@@ -439,9 +521,9 @@ int ACMCallFSM::ParseDefaultServer(const char* strServer)
 	}
 
 	iRet = m_voipserver.size();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("default voip server number is %d.", iRet);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("default voip server number is %d.", iRet);
 	for (int i = 0; i < iRet; i++){
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("default voip server address is %s", m_voipserver[i].c_str());
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("default voip server address is %s", m_voipserver[i].c_str());
 	}
 
 	return iRet;
@@ -553,10 +635,10 @@ void ACMCallFSM::OnStateTrans(int iSrcState, int iDstState)
 
 					if (eState_Fail == st2){
 						int ierrcode = GetFailedErrorCode(iSrcState);
-						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("connect_failed_case_table size is %d, and ierrcode = %d.", sizeof(connect_failed_case_table)/ sizeof(char*), ierrcode);
+						DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("connect_failed_case_table size is %d, and ierrcode = %d.", sizeof(connect_failed_case_table)/ sizeof(char*), ierrcode);
 						if (ierrcode >= 0 && ierrcode < sizeof(connect_failed_case_table)/ sizeof(char*)){
 							evt.errinfo = CSimpleStringA2W(connect_failed_case_table[ierrcode]);
-							DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("connect failed for %s.", CSimpleStringW2A(evt.errinfo).GetData());
+							DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("connect failed for %s.", CSimpleStringW2A(evt.errinfo).GetData());
 						}
 
 						char strerrmsg[MAX_PATH] = {0};
@@ -572,7 +654,7 @@ void ACMCallFSM::OnStateTrans(int iSrcState, int iDstState)
 					}
 
 					SpSendBroadcast(GetEntityBase()->GetFunction(), SP_MSG_OF(PhoneState), SP_MSG_SIG_OF(PhoneState), evt);
-					LogWarn(Severity_Low, Error_Debug, LOG_WARN_COUNTERCONNECT_BROADCAST_CALL_STATE, strmsg);
+					//LogWarn(Severity_Low, Error_Debug, LOG_WARN_COUNTERCONNECT_BROADCAST_CALL_STATE, strmsg);
 				} 
 				else{
 					char strinfo[MAX_PATH] = {0};
@@ -610,7 +692,7 @@ ErrorCodeEnum ACMCallFSM::SetCallState(int state)
 	if (0 <= state && state < sizeof(sts)/sizeof(char*)){
 		strCallState = sts[state];
 	}
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("set call state to [%s].", strCallState);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("set call state to [%s].", strCallState);
 	return GetEntityBase()->GetFunction()->SetSysVar("CallState", strCallState);
 }
 
@@ -628,6 +710,7 @@ void ACMCallFSM::s0_on_entry()
 	}
 	m_iFailedLastState = 0;
 }
+
 void ACMCallFSM::s0_on_exit() 
 {
 	m_bHangup = FALSE;
@@ -655,7 +738,7 @@ unsigned int ACMCallFSM::s0_on_event(FSMEvent* event)
 		//由指令模块触发呼叫
 		GetEntityBase()->GetFunction()->SetSysVar(SYSVAR_CALLTYPE, CALLTYPE_MOBILE); // 设置呼叫模式为手机呼叫
 		m_nSysCallType = 1;
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start command call!");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start command call!");
 	}
 	else if (event->iEvt == USER_EVT_ASSISTCHAN_IDEL)
 	{
@@ -691,12 +774,12 @@ unsigned int ACMCallFSM::s0_on_event(FSMEvent* event)
 		m_CallingParam.nCallType = DOUBLERECORD_CALLTYPE;
 		//GetEntityBase()->GetFunction()->SetSysVar(SYSVAR_CALLTYPE,CALLTYPE_RECORD); // 设置呼叫模式为双录呼叫
 		m_nSysCallType = 0;
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start double record call,call type is %d.", m_CallingParam.nCallType);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start double record call,call type is %d.", m_CallingParam.nCallType);
 		LogWarn(Severity_Low, Error_Debug, LOG_WARN_COUNTERCONNECT_DOUBLERECORDCALL,"begin double record call");
 	}
 	else if (event->iEvt == USER_EVT_STOPLOACALREMOTEVIDEO) 
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d, stop show local and remote video.", __FUNCTION__, __LINE__);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d, stop show local and remote video.", __FUNCTION__, __LINE__);
 
 	}
 	return 0;
@@ -716,7 +799,7 @@ unsigned int ACMCallFSM::s7_on_event(FSMEvent* event)
 {
 	if (event->iEvt == USER_EVT_STOPLOCALVIDEO) 
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop show local video");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop show local video");
 		StopVideo();
 	}
 	else if (event->iEvt == USER_EVT_SIPPHONE_IDEL)
@@ -730,7 +813,7 @@ unsigned int ACMCallFSM::s7_on_event(FSMEvent* event)
 
 void ACMCallFSM::s9_on_entry() 
 {
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start liveness detection.");
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start liveness detection.");
 	m_nLiveDetctionTime = 0;
 	ScheduleTimer(9, 2*LIVEDETECT_CONNECT_INTERVAL);
 }
@@ -746,7 +829,7 @@ unsigned int ACMCallFSM::s9_on_event(FSMEvent* event)
 	if (event->iEvt == USER_EVT_STOPVIDEODISPLAY) 
 	{
 		//ScheduleTimer(9,3000);
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop live detection display");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop live detection display");
 		StopVideo();
 		LogEvent(Severity_Middle,LOG_EVT_RELEASELIVEDETECTION,"release live detection");
 	} 
@@ -767,31 +850,16 @@ void ACMCallFSM::s8_on_entry()
 {
 	//get call route,采用直接总行方式
 	if(FALSE == m_bIsPadDevice){		//大机
-		if (m_strCallRouteIP.GetLength() != 0) {
-			int icount = 0;
-			call_info_t call_info;
-			call_info.callroute_server_ip = m_strCallRouteIP;
-			call_info.callroute_server_port = m_iCallRoutePort;
-			call_info.szbranchno = m_strCallRouteBranchNo;
-			call_info.szcaller_num = m_strTerminalId;
-			call_info.szdest_num = m_strCallRouteAccessNo;
-
-			do 
-			{
-				m_pCallRouteList = get_callroute_list(&call_info);
-				icount++;
-			} while (!m_pCallRouteList && icount < CALLROUTE_MAX_TRY_COUNT);
-
-			if (icount > 1){
-				char strmsg[MAX_PATH] = {0};
-				snprintf(strmsg, MAX_PATH, "request call route {%s:%d} %d times.", m_strCallRouteIP.GetData(), m_iCallRoutePort, icount);
-				LogWarn(Severity_Low, Error_Debug, LOG_WARN_COUNTERCONNECT_CALLROUTE_TIMES, strmsg);
-			}
+		if (0 == GetCallRouteList()) {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get call route list success.");
+		}
+		else {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get call route list failed.");
 		}
 	}
 		
 	int time = GetDelayTime();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get Delay time = %d",time);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("get Delay time = %d",time);
 
 	if (time > 0){
 		ScheduleTimer(8,time*1000);
@@ -844,7 +912,7 @@ unsigned int ACMCallFSM::s10_on_event(FSMEvent* event)
 	}
 	else if (event->iEvt == USER_EVT_STOPLOACALREMOTEVIDEO) 
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d, hang up call and stop show local and remote video.", __FUNCTION__, __LINE__);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d, hang up call and stop show local and remote video.", __FUNCTION__, __LINE__);
 		PostEventFIFO(new FSMEvent(USER_EVT_HANGUP));
 		m_bHangup=TRUE;
 		StopVideo();
@@ -869,78 +937,82 @@ void ACMCallFSM::s11_on_entry()
 		if (FALSE == m_bIsPadDevice)
 		{
 			//get call route,采用直接总行方式
-			if (m_strCallRouteIP.GetLength() != 0) {
-				callurl_node_t *node = get_no_used_node(m_pCallRouteList);
-
-				char callid_str[64] = { 0 };
-				get_format_uuid(callid_str, 64);
-
-				if (node != NULL){
-					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Begin Head Office Make Call!");
-					m_LastSipError = MakeCall(node->strcallurl, CSimpleStringA::Format("sip:%s@%s;transport=UDP", node->strnewcallernum, ipstr), 
-						callid_str, m_CallingParam);
-					m_iChanProxyPort[0] = node->uassistport;
-					m_iChanProxyPort[1] = node->uassistport;
-					m_strChanProxyIP[0] = node->strassistip;
-					m_strChanProxyIP[1] = node->strassistip;
-					node->bused = TRUE;
-				}	
-				else{
-					int icount = m_voipserver.size();
-					if (icount > 0){
-						int index = GetTickCount()%icount;
-						char strcallurl[MAX_PATH] = {0};
-						char strassistip[32] = {0};
-						size_t uport = 0;
-						if (0 == GetCallInfoFromConfig(strcallurl, MAX_PATH, strassistip, 32, &uport, m_voipserver[index].c_str())){
-							char strassitinter[32] = {0};
-							get_interger_netaddr(strassitinter, 32, strassistip);
-							m_LastSipError = MakeCall(strcallurl, CSimpleStringA::Format("sip:%s#%s@%s;transport=UDP", m_strTerminalId.GetData(), strassitinter, ipstr), 
-								callid_str, m_CallingParam);
-							m_iChanProxyPort[0] = uport;
-							m_iChanProxyPort[1] = uport;
-							m_strChanProxyIP[0] = strassistip;
-							m_strChanProxyIP[1] = strassistip;
-							char strmsg[MAX_PATH] = {0};
-							snprintf(strmsg, MAX_PATH, "head office mode no more call router, use default config(call url is %s, assistip is %s).", strcallurl, strassistip);
-							LogWarn(Severity_Low, Error_Debug, LOG_WARN_COUNTERCONNECT_CALLROUTE_CONFIG, strmsg);
-						}
+			callurl_node_t *node = get_no_used_node(m_pCallRouteList);
+
+			char callid_str[64] = { 0 };
+			get_format_uuid(callid_str, 64);
+
+			if (node != NULL){
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin Head Office Make Call!");
+				m_LastSipError = MakeCall(node->strcallurl, CSimpleStringA::Format("sip:%s@%s;transport=UDP", node->strnewcallernum, ipstr), 
+					callid_str, m_CallingParam);
+				m_iChanProxyPort[0] = node->uassistport;
+				m_iChanProxyPort[1] = node->uassistport;
+				m_strChanProxyIP[0] = node->strassistip;
+				m_strChanProxyIP[1] = node->strassistip;
+				node->bused = TRUE;
+			}	
+			else{
+				int icount = m_voipserver.size();
+				if (icount > 0){
+					int index = GetTickCount()%icount;
+					char strcallurl[MAX_PATH] = {0};
+					char strassistip[32] = {0};
+					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)){
+						char strassitinter[32] = {0};
+						get_interger_netaddr(strassitinter, 32, strassistip);
+						m_LastSipError = MakeCall(strcallurl, CSimpleStringA::Format("sip:%s#%s@%s;transport=UDP", m_strTerminalId.GetData(), strassitinter, ipstr), 
+							callid_str, m_CallingParam);
+						m_iChanProxyPort[0] = uport;
+						m_iChanProxyPort[1] = uport;
+						m_strChanProxyIP[0] = strassistip;
+						m_strChanProxyIP[1] = strassistip;
+						char strmsg[MAX_PATH] = {0};
+						snprintf(strmsg, MAX_PATH, "head office mode no more call router, use default config(call url is %s, assistip is %s).", strcallurl, strassistip);
+						LogWarn(Severity_Low, Error_Debug, LOG_WARN_COUNTERCONNECT_CALLROUTE_CONFIG, strmsg);
+					}
+					else {
+						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetCallInfoFromConfig failed!");
+						m_LastSipError = Error_Param;
 					}
 				}
+			}
 
-				if (m_LastSipError!=Error_Succeed){
-					m_nCurSipServer?(m_nCurSipServer=Error_Server):(m_nCurSipServer=BACK_SERVER);
-				}
-				m_nCurChanServer = BACK_SERVER;
-
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("head office make call result:0x%08x", m_LastSipError);
+			if (m_LastSipError!=Error_Succeed){
+				m_nCurSipServer?(m_nCurSipServer=Error_Server):(m_nCurSipServer=BACK_SERVER);
 			}
+			m_nCurChanServer = BACK_SERVER;
+
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("head office make call result:0x%08x", m_LastSipError);
 		} 
 		else
 		{
 			if (m_CallingParam.nCallType != NORMAL_CALLTYPE && m_CallingParam.nCallType != DOUBLERECORD_CALLTYPE)
 			{
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Begin Branch Make Distribute Call!");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin Branch Make Distribute Call!");
 				m_LastSipError = MakeCall(m_nCurSipServer,m_CallingParam);
 				if (m_LastSipError!=Error_Succeed){
 					m_nCurSipServer?(m_nCurSipServer=Error_Server):(m_nCurSipServer=BACK_SERVER);
 				}
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("branch make call result:0x%08x", m_LastSipError);
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("branch make call result:0x%08x", m_LastSipError);
 			}
 			else
 			{	
 				if (NORMAL_CALLTYPE == m_CallingParam.nCallType){
-					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Begin Branch Make Normal Call!");
+					DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin Branch Make Normal Call!");
 				}
 				else{
-					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Begin Branch Make Record Call!");
+					DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin Branch Make Record Call!");
 				}
 
 				m_LastSipError = MakeCall(m_strHintCallNum.GetLength() > 0 ? (LPCSTR)m_strHintCallNum : (LPCSTR)m_strSIPCallNum[m_nCurSipServer],m_nCurSipServer);
 				if (m_LastSipError!=Error_Succeed){
 					m_nCurSipServer?(m_nCurSipServer=Error_Server):(m_nCurSipServer=BACK_SERVER);
 				}
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("branch make call result:0x%08x", m_LastSipError);
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("branch make call result:0x%08x", m_LastSipError);
 			}
 		}
 	}
@@ -1025,7 +1097,7 @@ unsigned int ACMCallFSM::s11_on_event(FSMEvent* event)
 		}else{
 			LogWarn(Severity_Low, Error_Unexpect, LOG_WARN_COUNTERCONNECT_SIPCONNECT_TIMEOUT,"sipphone connect timeout, error server");
 		}
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("sip call timeout,release call");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("sip call timeout,release call");
 		m_nSipErrorNum++;
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR0402304Z80301").setResultCode("RTA3435")("sip connect failed!");
 	}
@@ -1043,7 +1115,7 @@ unsigned int ACMCallFSM::s11_on_event(FSMEvent* event)
 	}
 	else if (event->iEvt == USER_EVT_STOPLOACALREMOTEVIDEO) 
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d, hang up call and stop show local and remote video.", __FUNCTION__, __LINE__);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d, hang up call and stop show local and remote video.", __FUNCTION__, __LINE__);
 		PostEventFIFO(new FSMEvent(USER_EVT_HANGUP));
 		m_bHangup=TRUE;
 		StopVideo();
@@ -1064,7 +1136,7 @@ void ACMCallFSM::s12_on_entry()
 	Sleep(200);
 	if (m_LastAssistError == Error_Succeed) 
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin start channel,m_nCurChanServer=%d",m_nCurChanServer);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("begin start channel,m_nCurChanServer=%d",m_nCurChanServer);
 		if (m_CallingParam.nCallType == NORMAL_CALLTYPE  && m_CallingParam.nCallType != DOUBLERECORD_CALLTYPE)
 		{
 			m_LastAssistError = StartChannel(m_nCurChanServer);
@@ -1079,13 +1151,13 @@ void ACMCallFSM::s12_on_entry()
 			//	}
 			//}
 		}
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start channel result:0x%08x", m_LastAssistError);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start channel result:0x%08x", m_LastAssistError);
 		if (m_LastAssistError != Error_Succeed) 
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start channel failed:0x%08x,start hangup", m_LastAssistError);
 			HangupCall();
 			m_nCurChanServer?(m_nCurChanServer=Error_Server):(m_nCurChanServer=BACK_SERVER);
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("hangup call result:0x%08x", m_LastAssistError);
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("hangup call result:0x%08x", m_LastAssistError);
 		}
 	}
 
@@ -1183,7 +1255,7 @@ unsigned int ACMCallFSM::s12_on_event(FSMEvent* event)
 	}
 	else if (event->iEvt == USER_EVT_STOPLOACALREMOTEVIDEO) 
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d, hang up call and stop show local and remote video.", __FUNCTION__, __LINE__);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d, hang up call and stop show local and remote video.", __FUNCTION__, __LINE__);
 		PostEventFIFO(new FSMEvent(USER_EVT_HANGUP));
 		m_bHangup=TRUE;
 		StopVideo();
@@ -1247,12 +1319,12 @@ unsigned int ACMCallFSM::s14_on_event(FSMEvent* event)
 {
 	if (event->iEvt == USER_EVT_STOPLOACALREMOTEVIDEO) 
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d, stop show local and remote video.", __FUNCTION__, __LINE__);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d, stop show local and remote video.", __FUNCTION__, __LINE__);
 		StopVideoRender();
 	}
 	else if (event->iEvt == USER_EVT_STOP_RECORD_BROADCAST)
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop double record broadcast.");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop double record broadcast.");
 	}
 	else if (event->iEvt == USER_EVT_SIPPHONE_IDEL)
 	{
@@ -1321,13 +1393,13 @@ unsigned int ACMCallFSM::s21_on_event(FSMEvent* event)
 	{
 		if(event->param1 == 21)
 		{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("hangupcall timeout,release call");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("hangupcall timeout,release call");
 			ScheduleTimer(210,RELEASEING_SIP_TIMEOUT);
 			ReleaseCall(0);
 		}
 		else if (event->param1 == 210)
 		{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("release call timeout,restart sipphone");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("release call timeout,restart sipphone");
 			PostEventFIFO(new FSMEvent(USER_EVT_JMP_FAIL));
 			//RealSipErrorCheck();
 			LogEvent(Severity_Middle, EVENT_MOD_RELEASESIP_TIMEOUT,"restart sipphone");

+ 46 - 29
Module/mod_counterconnector/ConnectorFSM.h

@@ -15,6 +15,7 @@
 #include "uuid/uuid.h"
 #endif
 
+#include "http_callrouter.h"
 
 #include "../mod_assistantchannel/VideoDesc.h"
 
@@ -400,10 +401,12 @@ public:
 	BOOL ReConnectionAssistchan();
 	BOOL ReConnectionSipphone();
 	BOOL ReConnectionSyncService();
+	
+	int GetCallRouteList();
 
 	ErrorCodeEnum StartVideo(const char *param)
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Start Video");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Start Video");
 		if (!m_pPhoneClient)
 			return Error_NetBroken;
 		PhoneService_StartVideo_Info Info;
@@ -413,10 +416,11 @@ public:
 			Info.remote_view_x, Info.remote_view_y, Info.remote_view_cx, Info.remote_view_cy);
 			Info.local_hwd_move = 0;
 			Info.remote_hwd_move = 1;
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start video, remote width:%d, remote height:%d, local(%d,%d,%d,%d),remote(%d,%d,%d,%d), remote_fps:%d", 
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start video, remote width:%d, remote height:%d, local(%d,%d,%d,%d),remote(%d,%d,%d,%d), remote_fps:%d",
 			Info.remote_width, Info.remote_height,
 			Info.local_view_x, Info.local_view_y, Info.local_view_cx, Info.local_view_cy,
 			Info.remote_view_x, Info.remote_view_y, Info.remote_view_cx, Info.remote_view_cy, Info.remote_fps);
+
 		if (Error == Error_Succeed) {
 			Error = m_pPhoneClient->StartVideo(Info);
 		} 
@@ -428,7 +432,7 @@ public:
 
 	ErrorCodeEnum StopVideo()
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Stop Video");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Stop Video");
 		if (!m_pPhoneClient)
 			return Error_NetBroken;
 		return m_pPhoneClient->StopVideo();
@@ -478,7 +482,7 @@ public:
 		if (!m_pPhoneClient)
 			return Error_NetBroken;
 
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SetCallingType = %d.", eType);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("SetCallingType = %d.", eType);
 
 		PhoneService_SetCallingParam_Info info;
 		info.CallType = eType;
@@ -496,9 +500,9 @@ public:
 		}
 		else
 		{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("MSClient connected success!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("MSClient connected success!");
 			rc = pMSClient->StopSpeakerRender();
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("pMSClient StopSpeakerRender rc:0x%08x",rc);
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("pMSClient StopSpeakerRender rc:0x%08x",rc);
 			if(rc != Error_Succeed){
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Stop Speaker Render failed return 0x%08x", rc);
 			}
@@ -656,7 +660,7 @@ private:
 		info.connect_ip = callingparam.connect_ip;
 		info.connect_port = callingparam.connect_port;
 	    m_pPhoneClient->SetCallingParam(info);
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Make Distribute Call CallType = %d, to_uri:%s", info.CallType, Req.to_uri.GetData());
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Make Distribute Call CallType = %d, to_uri:%s", info.CallType, Req.to_uri.GetData());
 
 		ErrorCodeEnum Error = m_pPhoneClient->MakeCall(Req, Ans, 10000);
 		return Error;
@@ -668,10 +672,10 @@ private:
 			return Error_NetBroken;
 		}
 			
-		if((m_strSIPCallNum[nSipServer]=="")&&(m_strSIPProxyIP[nSipServer]=="")&&(m_iSIPProxyPort[nSipServer]==0))
-		{
+		if((m_strSIPCallNum[nSipServer]=="")&&(m_strSIPProxyIP[nSipServer]=="")&&(m_iSIPProxyPort[nSipServer]==0)){
 			return Error_Param;
 		}
+
 		CSimpleStringA strCode;
 		PhoneService_MakeCall_Req Req;
 		PhoneService_MakeCall_Ans Ans;
@@ -679,8 +683,7 @@ private:
 
 		PhoneService_SetCallingParam_Info info;
 		info.CallType = NORMAL_CALLTYPE;
-		if (DOUBLERECORD_CALLTYPE == m_CallingParam.nCallType)
-		{
+		if (DOUBLERECORD_CALLTYPE == m_CallingParam.nCallType){
 			info.CallType = DOUBLERECORD_CALLTYPE;
 		}
 		m_pPhoneClient->SetCallingParam(info);
@@ -692,8 +695,10 @@ private:
 
 	ErrorCodeEnum MakeCall(const char *to_uri, const char *from_uri, const char *call_id, CallingParam callingparam)
 	{
-		if (!m_pPhoneClient)
+		if (!m_pPhoneClient){
 			return Error_NetBroken;
+		}
+			
 		CSimpleStringA strCode;
 		PhoneService_MakeCall_Req Req;
 		PhoneService_MakeCall_Ans Ans;
@@ -717,23 +722,24 @@ private:
 
 	ErrorCodeEnum HangupCall()
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Hangup Call!");
-		if (!m_pPhoneClient)
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Hangup Call!");
+		if (!m_pPhoneClient) {
 			return Error_NetBroken;
+		}
+			
 		PhoneService_HangupCall_Req Req;
 		PhoneService_HangupCall_Ans Ans;
-		if (!m_SessionParam.connect_session.IsNullOrEmpty())
-		{
+		if (!m_SessionParam.connect_session.IsNullOrEmpty()){
 			Req.session_num = m_SessionParam.connect_session;
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Hangup Call connect_session = %s", m_SessionParam.connect_session.GetData());
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Hangup Call connect_session = %s", m_SessionParam.connect_session.GetData());
 		}
-		if (!m_SessionParam.connect_ip.IsNullOrEmpty())
-		{
+
+		if (!m_SessionParam.connect_ip.IsNullOrEmpty()){
 			Req.branch_server_ip = m_SessionParam.connect_ip;
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Hangup Call connect_ip = %s", m_SessionParam.connect_ip.GetData());
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Hangup Call connect_ip = %s", m_SessionParam.connect_ip.GetData());
 		}
-		if (m_SessionParam.event_port)
-		{
+
+		if (m_SessionParam.event_port){
 			Req.branch_server_port = m_SessionParam.event_port;
 		}
 		
@@ -752,10 +758,11 @@ private:
 
 	ErrorCodeEnum StartChannel(int nChanServer)
 	{
-		if (!m_pChannelClient)
+		if (!m_pChannelClient) {
 			return Error_NetBroken;
-		if ((m_strChanProxyIP[nChanServer]=="")&&(m_strChanCallNum[nChanServer]=="")&&(m_iChanProxyPort[nChanServer]==0))
-		{
+		}
+			
+		if ((m_strChanProxyIP[nChanServer]=="")&&(m_strChanCallNum[nChanServer]=="")&&(m_iChanProxyPort[nChanServer]==0)){
 			return Error_Param;
 		}
 		ChannelService_Connect_Req Req;
@@ -781,8 +788,9 @@ private:
 
 	ErrorCodeEnum StartChannel(int nChanServer,CallingParam callparam)
 	{
-		if (!m_pChannelClient)
+		if (!m_pChannelClient) {
 			return Error_NetBroken;
+		}
 
 		ChannelService_Connect_Req Req;
 		ChannelService_Connect_Ans Ans;
@@ -826,9 +834,11 @@ private:
 
 	ErrorCodeEnum StopChannel()
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop channel");
-		if (!m_pPhoneClient)
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop channel");
+		if (!m_pPhoneClient) {
 			return Error_NetBroken;
+		}
+			
 
 		ChannelService_Close_Req Req;
 		ChannelService_Close_Ans Ans;
@@ -875,6 +885,7 @@ private:
 		table.AddEntryString("CounterConnector", "call_route_access_no", m_strCallRouteAccessNo, NULL);
 		table.AddEntryString("Initializer", "SubBankNo", m_strCallRouteBranchNo, NULL);
 		table.AddEntryString("CounterConnector", "default_voip_server", m_strDefaultServer, NULL);
+		table.AddEntryString("CounterConnector", "http_call_route_addr", m_strHttpCallRouteAddr, NULL);
 		CSmartPointer<IConfigInfo> spConfig;
 		ErrorCodeEnum Error = m_pEntity->GetFunction()->OpenConfig(Config_CenterSetting, spConfig);
 		if (Error == Error_Succeed) {
@@ -975,7 +986,6 @@ public:
 	CSimpleStringA m_strHintCallNum;
 
 	BOOL m_bAssistchanIdel;
-
 	CurServerNum m_nCurSipServer;
 	CurServerNum m_nCurChanServer;
 	//呼叫类型,用于区分是分布式呼叫还是常规呼叫,由业务中台设置或者指令模块设置
@@ -986,6 +996,10 @@ public:
 	BOOL m_bIsPadDevice;
 	BOOL m_bConAssist;
 	BOOL m_bConSipphone;
+	int m_iCallRouteType;
+	CSimpleStringA m_strQueueName;
+	CSimpleStringA m_strAddClientLevel;
+	BOOL m_bNeedQueueName;
 
 private:
 	DWORD m_nStarttime;
@@ -1011,5 +1025,8 @@ private:
 	ErrorCodeEnum m_LastSipError;
 	ErrorCodeEnum m_LastAssistError;
 
+	CSimpleStringA m_strHttpCallRouteAddr;
+	CSimpleStringA m_strHttpServerAPI;
+
 	BOOL m_bRing;
 };

+ 15 - 0
Module/mod_counterconnector/ConnectorService.xml

@@ -44,5 +44,20 @@
 				<param name="SessionParam" type="blob"/>
 			</req>
 		</twoway>
+		<twoway name="GetCallRouteType" overlap="true">
+			<res>
+				<param name="RouteType" type="uint"/>
+			</res>
+		</twoway>
+		<twoway name="SetVideoCallRouteParams" overlap="true">
+			<req>
+				<param name="BusinessName" type="string"/>
+				<param name="CallPriority" type="string"/>
+			</req>
+			<res>
+				<param name="ErrorCode" type="uint"/>
+				<param name="ErrorMsg" type="wstring"/>
+			</res>
+		</twoway>
 	</class>
 </entity>

+ 62 - 0
Module/mod_counterconnector/CounterConnector_client_g.h

@@ -152,6 +152,68 @@ public:
 		return Error;
 	}
 
+	ErrorCodeEnum GetCallRouteType(ConnectService_GetCallRouteType_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		auto ret = pFunc->AsyncRequest(ConnectService_Method_GetCallRouteType, ConnectService_MethodSignature_GetCallRouteType, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum GetCallRouteType(ConnectService_GetCallRouteType_Req &Req, ConnectService_GetCallRouteType_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = GetCallRouteType(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum GetCallRouteType(ConnectService_GetCallRouteType_Req &Req, ConnectService_GetCallRouteType_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = GetCallRouteType(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
+	ErrorCodeEnum SetVideoCallRouteParams(ConnectService_SetVideoCallRouteParams_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		auto ret = pFunc->AsyncRequest(ConnectService_Method_SetVideoCallRouteParams, ConnectService_MethodSignature_SetVideoCallRouteParams, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum SetVideoCallRouteParams(ConnectService_SetVideoCallRouteParams_Req &Req, ConnectService_SetVideoCallRouteParams_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = SetVideoCallRouteParams(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum SetVideoCallRouteParams(ConnectService_SetVideoCallRouteParams_Req &Req, ConnectService_SetVideoCallRouteParams_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = SetVideoCallRouteParams(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
 
 	bool SafeDelete()
 	{

+ 49 - 0
Module/mod_counterconnector/CounterConnector_def_g.h

@@ -24,10 +24,15 @@ namespace CounterConnector {
 #define ConnectService_Method_StartCall 0
 #define ConnectService_Method_StartCallExternal 1
 #define ConnectService_Method_StopCall 2
+#define ConnectService_Method_GetCallRouteType 3
+#define ConnectService_Method_SetVideoCallRouteParams 4
 
 #define ConnectService_MethodSignature_StartCall -1910459811
 #define ConnectService_MethodSignature_StartCallExternal 40470846
 #define ConnectService_MethodSignature_StopCall 181632529
+#define ConnectService_MethodSignature_GetCallRouteType 1911492577
+#define ConnectService_MethodSignature_SetVideoCallRouteParams -240588169
+
 
 struct ConnectService_StartCall_Req
 {
@@ -94,6 +99,50 @@ struct ConnectService_StopCall_Ans
 
 };
 
+struct ConnectService_GetCallRouteType_Req
+{
+
+	void Serialize(SpBuffer &Buf)
+	{
+	}
+
+};
+
+struct ConnectService_GetCallRouteType_Ans
+{
+	unsigned int RouteType;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & RouteType;
+	}
+
+};
+
+struct ConnectService_SetVideoCallRouteParams_Req
+{
+	CSimpleStringA BusinessName;
+	CSimpleStringA CallPriority;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & BusinessName & CallPriority;
+	}
+
+};
+
+struct ConnectService_SetVideoCallRouteParams_Ans
+{
+	unsigned int ErrorCode;
+	CSimpleStringW ErrorMsg;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & ErrorCode & ErrorMsg;
+	}
+
+};
+
 
 ///////////////////////////
 

+ 52 - 0
Module/mod_counterconnector/CounterConnector_server_g.h

@@ -51,6 +51,20 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case ConnectService_Method_GetCallRouteType:
+			if (dwSignature == ConnectService_MethodSignature_GetCallRouteType) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case ConnectService_Method_SetVideoCallRouteParams:
+			if (dwSignature == ConnectService_MethodSignature_SetVideoCallRouteParams) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -77,6 +91,16 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case ConnectService_Method_GetCallRouteType:
+			if (dwSignature != ConnectService_MethodSignature_GetCallRouteType) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case ConnectService_Method_SetVideoCallRouteParams:
+			if (dwSignature != ConnectService_MethodSignature_SetVideoCallRouteParams) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -99,6 +123,16 @@ public:
 	/// override by user
 	}
 
+	virtual void Handle_GetCallRouteType(SpReqAnsContext<ConnectService_GetCallRouteType_Req, ConnectService_GetCallRouteType_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
+	virtual void Handle_SetVideoCallRouteParams(SpReqAnsContext<ConnectService_SetVideoCallRouteParams_Req, ConnectService_SetVideoCallRouteParams_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
 	virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
 	{
 		CAutoBuffer Buf;
@@ -142,6 +176,24 @@ public:
 						Handle_StopCall(ctx);
 					}
 					break;
+				case ConnectService_Method_GetCallRouteType:
+					{
+						SpReqAnsContext<ConnectService_GetCallRouteType_Req,ConnectService_GetCallRouteType_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<ConnectService_GetCallRouteType_Req,ConnectService_GetCallRouteType_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						Handle_GetCallRouteType(ctx);
+					}
+					break;
+				case ConnectService_Method_SetVideoCallRouteParams:
+					{
+						SpReqAnsContext<ConnectService_SetVideoCallRouteParams_Req,ConnectService_SetVideoCallRouteParams_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<ConnectService_SetVideoCallRouteParams_Req,ConnectService_SetVideoCallRouteParams_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						Handle_SetVideoCallRouteParams(ctx);
+					}
+					break;
 				default:
 					assert(0);
 					break;

+ 11 - 2
Module/mod_counterconnector/callroute_nodelist.cpp

@@ -3,9 +3,17 @@
 #include <string.h>
 
 #ifndef	SAFE_FREE
-#define SAFE_FREE(p)		if (p){free(p);	p = NULL;}
+#define SAFE_FREE(p)\
+	do{\
+		if (p){\
+			free(p);\
+			p = NULL;\
+		}\
+	}while(0)
+
 #endif
 
+
 node_list_head_t* create_node_list_head(const char* pcallernum)
 {
 	node_list_head_t* pnode = NULL;
@@ -26,7 +34,7 @@ node_list_head_t* create_node_list_head(const char* pcallernum)
 } 
 
 
-int add_node_to_list(node_list_head_t* plist, const char* newcallernum, const char* pcallurl, const char* pstrassistip, const char*  pstrport)
+int add_node_to_list(node_list_head_t* plist, const char* newcallernum, const char* pcallurl, const char* pstrassistip, const char* pstrport)
 {
 	int ret = -1;
 	if (NULL == plist){
@@ -41,6 +49,7 @@ int add_node_to_list(node_list_head_t* plist, const char* newcallernum, const ch
 		char* psipurl = (char*)malloc(ulen+1);
 		char* pstrnewcallernum = NULL;
 		char* pstrip = NULL;
+
 		int uport = atoi(pstrport);
 
 		memset(psipurl, 0, ulen+1);

+ 4 - 0
Module/mod_counterconnector/callroute_nodelist.h

@@ -3,6 +3,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#ifndef RVC_DATALEN
+#define RVC_DATALEN 128
+#endif
+
 typedef struct callurl_node_s{
 	bool	bused;
 	char*	strnewcallernum;

+ 0 - 3
Module/mod_counterconnector/callrouter.h

@@ -6,9 +6,6 @@
 #include "callroute_nodelist.h"
 #include "SimpleString.h"
 
-#ifndef RVC_DATALEN
-#define RVC_DATALEN 126
-#endif
 
 //call_info
 typedef struct call_info{

+ 119 - 44
Module/mod_counterconnector/mod_counterconnector.cpp

@@ -41,8 +41,10 @@ void CCounterConnectorEntity ::OnSelfTest(EntityTestEnum eTestType,CSmartPointer
 
 ErrorCodeEnum CCounterConnectorEntity ::__OnStart(ErrorCodeEnum preOperationError)
 {
-	if (preOperationError != Error_Succeed)
+	if (preOperationError != Error_Succeed) {
 		return preOperationError;
+	}
+		
 	//MessageBoxA(0, 0, 0, 0);
 	//is Pad Version
 	m_pCurrentSession = NULL;
@@ -104,14 +106,16 @@ void CCounterConnectorEntity::OnStarted()
 {
 	CSimpleStringA uiState;
 	GetFunction()->GetSysVar("UIState", uiState);
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Get UIState %s", uiState.GetData());
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Get UIState %s", uiState.GetData());
 	if (uiState.GetLength() > 0 && uiState[0] == 'M')
 	{
 		if (FALSE == m_bHasLaunched) {
 			m_bHasLaunched = TRUE;
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("UI has launched success.");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UI has launched success.");
 		}
 	}
+	
+	Sleep(500);
 
 	m_pCounterConnectorChannel = new ChannelCounterConnectorClient(this);
 	if (Error_Succeed == ConnectAssistChannel()){
@@ -121,13 +125,24 @@ void CCounterConnectorEntity::OnStarted()
 	if (m_fsm.ReConnectionAssistchan()){
 		m_fsm.m_bConAssist = TRUE;
 	}
+	else {
+		GetFunction()->SetTimer(2, this, 3900);
+	}
+
+	Sleep(500);
 
 	if (m_fsm.ReConnectionSipphone()){
 		m_fsm.m_bConSipphone = TRUE;
 	}
+	else {
+		GetFunction()->SetTimer(3, this, 3700);
+	}
 
 	m_fsm.ReConnectionSyncService();
 
+	LoadEntityConfig();
+
+	m_fsm.m_iCallRouteType = m_iRouteType;
 }
 
 ErrorCodeEnum CCounterConnectorEntity::ConnectAssistChannel()
@@ -143,7 +158,7 @@ ErrorCodeEnum CCounterConnectorEntity::ConnectAssistChannel()
 		return Error;
 	}
 	else {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("connect assistant channel success!");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("connect assistant channel success!");
 	}
 
 	{
@@ -156,7 +171,7 @@ ErrorCodeEnum CCounterConnectorEntity::ConnectAssistChannel()
 			return Error;
 		}
 		else {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("BeginState biz channel success!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("BeginState biz channel success!");
 		}
 	}
 
@@ -171,7 +186,7 @@ ErrorCodeEnum CCounterConnectorEntity::ConnectAssistChannel()
 			return Error;
 		}
 		else {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Begin BeginRecv ACM_TYPE_DEVICE success!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin BeginRecv ACM_TYPE_DEVICE success!");
 		}
 	}
 
@@ -186,7 +201,7 @@ ErrorCodeEnum CCounterConnectorEntity::ConnectAssistChannel()
 			return Error;
 		}
 		else {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Begin BeginRecv ACM_TYPE_AGENTVIDEOTYPE success!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin BeginRecv ACM_TYPE_AGENTVIDEOTYPE success!");
 		}
 	}
 
@@ -201,7 +216,7 @@ ErrorCodeEnum CCounterConnectorEntity::ConnectAssistChannel()
 			return Error;
 		}
 		else {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Begin BeginRecv ACM_TYPE_CALLTRANS success!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin BeginRecv ACM_TYPE_CALLTRANS success!");
 		}
 	}
 
@@ -210,20 +225,53 @@ ErrorCodeEnum CCounterConnectorEntity::ConnectAssistChannel()
 
 
 void CCounterConnectorEntity::OnSysVarEvent(const char *pszKey,  const char *pszValue,const char *pszOldValue,const char *pszEntityName)
-{
+{	
 	if (_stricmp(pszKey, "UIState") == 0)
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Current UIState is %s.", pszValue);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Current UIState is %s.", pszValue);
 		if (pszValue[0] == 'M')
 		{
 			if (FALSE == m_bHasLaunched){
 				m_bHasLaunched = TRUE;
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("UI has launched success.");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UI has launched success.");
 			}
 		}		
 	}
 }
 
+
+ErrorCodeEnum CCounterConnectorEntity::LoadEntityConfig()
+{
+	SpIniMappingTable table;
+	int iRouteType = 0;
+	table.AddEntryInt("CounterConnector", "CallRouteType", iRouteType, 0);
+	CSmartPointer<IConfigInfo> spConfig;
+	ErrorCodeEnum Error = GetFunction()->OpenConfig(Config_CenterSetting, spConfig);
+	if (Error == Error_Succeed) {
+		Error = table.Load(spConfig);
+	}
+
+	if (1 == iRouteType) {
+		m_iRouteType = 1;
+	}
+
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Call Route Type is %d.",m_iRouteType);
+
+	return Error;
+}
+
+ErrorCodeEnum CCounterConnectorEntity::SetCallRouteParams(CSimpleStringA strQueueName, CSimpleStringA strClientLevel)
+{
+	ErrorCodeEnum Error = Error_Succeed;
+
+	m_fsm.m_strQueueName = strQueueName;
+	m_fsm.m_strAddClientLevel = strClientLevel;
+	
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SetCallRouteParams QueueName = %s, ClientLevel = %s.", m_fsm.m_strQueueName.GetData(), m_fsm.m_strAddClientLevel.GetData());
+
+	return Error;
+}
+
 ErrorCodeEnum CCounterConnectorEntity ::__OnClose(ErrorCodeEnum preOperationError)
 {
 	if (preOperationError != Error_Succeed) {
@@ -279,6 +327,7 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 			if (m_bHasLaunched){
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("提机呼叫");
 				m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_PICKUP_CALL));
+				m_fsm.m_bNeedQueueName = FALSE;
 			}
 			else{
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("UI has not launched, ignore it.");
@@ -286,6 +335,7 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 		}
 		break;
 	case EVENT_MOD_CONNECT_HANDFREE_CALL: // 免提呼叫
+		m_fsm.m_bNeedQueueName = TRUE;
 		if (m_fsm.m_bHandFree)
 		{
 			LogEvent(Severity_Middle,EVENT_MOD_CONNECT_SLV_HANDFREECALL,"handfree call");
@@ -369,6 +419,7 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 	case EVENT_MOD_CONNECT_BEGAIN_RECORD_CALL:
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("开始远程双录呼叫.");
+			m_fsm.m_bNeedQueueName = TRUE;
 			m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_DOUBLE_RECORD_CALL));
 			if (TRUE == m_fsm.m_bHandFree){
 				LogEvent(Severity_Middle,LOG_EVT_HANDFREE_MODE_REMOTE_CALL,"remote double call start with hand free mode.");
@@ -399,8 +450,8 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 		m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_AGENT_WRITABLE));
 
 	case LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS:		
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS");
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("current state name is %s.", m_fsm.GetCurrStateName());
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("current state name is %s.", m_fsm.GetCurrStateName());
 		Sleep(500);
 		m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_ASSISTCHAN_IDEL));
 		m_fsm.m_bConAssist = FALSE;
@@ -425,7 +476,7 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 		break;
 
 	case LOG_EVT_MOD_SIPPHONE_STARTED_SUCCESS: 
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_SIPPHONE_STARTED_SUCCESS");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_SIPPHONE_STARTED_SUCCESS");
 		Sleep(890);
 		m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_SIPPHONE_IDEL));
 		m_fsm.m_bConSipphone = FALSE;
@@ -434,25 +485,25 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 
 	case LOG_EVT_UI_STARTRECORD:
 	case LOG_EVT_UI_STARTRECORDPREVIEW:
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start sales record video,get pos = %s",pszMessage);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start sales record video,get pos = %s",pszMessage);
 		Handle_StartRecord(pszMessage);
 		break;
 
 	case LOG_EVT_UI_STARTREMOTERECORD:
 		{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start sales remote record video,get pos = %s",pszMessage);
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start sales remote record video,get pos = %s",pszMessage);
 			Handle_StartRemoteRecord(pszMessage);
 		}
 		break;
 
 	case LOG_EVT_UI_STOPRECORD:
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin stop sales record video.");	
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("begin stop sales record video.");
 		m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_STOPLOCALVIDEO));
 		m_bIsSalesRecord = FALSE;
 		break;
 
 	case  LOG_EVT_UI_STOPREMOTERECORD:
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin stop double record video,and cur state name is %s.",m_fsm.GetCurrStateName());
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("begin stop double record video,and cur state name is %s.",m_fsm.GetCurrStateName());
 		m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_STOPLOACALREMOTEVIDEO));
 		m_bIsRemoteRecord = FALSE;
 		break;
@@ -460,18 +511,18 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 	case LOG_EVT_UI_RETURNMENU:
 		if (m_bIsSalesRecord)
 		{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop sales record video by return menu");	
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop sales record video by return menu");
 			m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_STOPLOCALVIDEO));
 			m_bIsSalesRecord = FALSE;
 		}
 		if (m_bIsRemoteRecord)
 		{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop remote record video by return menu.");	
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop remote record video by return menu.");
 			if (m_fsm.m_CallingParam.nCallType != DOUBLERECORD_CALLTYPE){
 				m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_STOPLOACALREMOTEVIDEO));
 			}
 			else{
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("hangup call by return menu, CurrStateName is %s.", m_fsm.GetCurrStateName());
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("hangup call by return menu, CurrStateName is %s.", m_fsm.GetCurrStateName());
 				m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_HANGUP));
 				m_fsm.m_bHangup=TRUE;
 			}
@@ -483,7 +534,7 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 			LogEvent(Severity_Middle,EVENT_MOD_CONNECT_HANNUP,"UI start photograph, hangup!");
 		}
 		else{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("offline state,ignore UI_STARTPHOTOGRAPH hangup event");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("offline state,ignore UI_STARTPHOTOGRAPH hangup event");
 		}
 		break;
 
@@ -494,7 +545,6 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 
 CServerSessionBase*CCounterConnectorEntity::OnNewSession(const char* /*pszRemoteEntityName*/, const char* /*pszClass*/)
 {
-	LOG_FUNCTION();
 	m_pCurrentSession = new CCounterConnectorSession(this);
 	return m_pCurrentSession;
 }
@@ -516,7 +566,7 @@ void CCounterConnectorEntity::OnTimeout(DWORD dwTimerID)
 		}
 	}
 	else if(2 == dwTimerID) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_fsm.m_bConAssist is %s.", m_fsm.m_bConAssist ? "TRUE" : "FALSE");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_fsm.m_bConAssist is %s.", m_fsm.m_bConAssist ? "TRUE" : "FALSE");
 		if (FALSE == m_fsm.m_bConAssist) {
 			if (m_fsm.ReConnectionAssistchan()) {
 				m_fsm.m_bConAssist = TRUE;
@@ -528,7 +578,7 @@ void CCounterConnectorEntity::OnTimeout(DWORD dwTimerID)
 		}
 	}
 	else if (3 == dwTimerID) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_fsm.m_bConSipphone is %s.", m_fsm.m_bConSipphone ? "TRUE" : "FALSE");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_fsm.m_bConSipphone is %s.", m_fsm.m_bConSipphone ? "TRUE" : "FALSE");
 		if (FALSE == m_fsm.m_bConSipphone) {
 			if (m_fsm.ReConnectionSipphone()) {
 				m_fsm.m_bConSipphone = TRUE;
@@ -544,7 +594,7 @@ void CCounterConnectorEntity::OnTimeout(DWORD dwTimerID)
 //change audio device message
 void CCounterConnectorEntity ::OnReceivePkt(int type, int sub_type, const char *buffer, int size)
 {
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv pkt  type=%d,subtype=%d",type,sub_type);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("recv pkt  type=%d,subtype=%d",type,sub_type);
 	if ((type == ACM_TYPE_DEVICE)&&!m_bIsPadType)
 	{
 		switch (sub_type)
@@ -552,7 +602,7 @@ void CCounterConnectorEntity ::OnReceivePkt(int type, int sub_type, const char *
 			//设备切换
 			//change to handfree
 		case ACM_CHANGE_HANDFREE:
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv change audiodevice to handfree");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("recv change audiodevice to handfree");
 			if (!m_fsm.m_bAgentHandFree)
 			{
 				LogEvent(Severity_Middle,EVENT_MOD_CONNECT_AGENT_PICKUP_HANDFREE,"agent change audio device to handfree");
@@ -560,12 +610,12 @@ void CCounterConnectorEntity ::OnReceivePkt(int type, int sub_type, const char *
 			}
 			else
 			{
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("agent want change audiodevice to handfree,but the device is handfree now");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("agent want change audiodevice to handfree,but the device is handfree now");
 			}
 			break;
 			//change to pickup
 		case ACM_CHANGE_PICKUP:
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv change audio device to pickup");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("recv change audio device to pickup");
 			if (m_fsm.m_bAgentHandFree)
 			{
 				LogEvent(Severity_Middle,EVENT_MOD_CONNECT_AGENT_HANDFREE_PICKUP,"agent change audio device to pickup");
@@ -604,7 +654,7 @@ void CCounterConnectorEntity ::OnReceivePkt(int type, int sub_type, const char *
 			//广播单向视频
 			AgentVideoType agentvideotype;
 			agentvideotype.VideoType = 0;
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Broadcast Oneway video");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Broadcast Oneway video");
 			SpSendBroadcast(GetFunction(), SP_MSG_OF(AgentVideoType), SP_MSG_SIG_OF(AgentVideoType), agentvideotype);
 		}
 		else if (sub_type == ACM_AGENTVIDEOTYPE_TWOWAY)
@@ -612,7 +662,7 @@ void CCounterConnectorEntity ::OnReceivePkt(int type, int sub_type, const char *
 			//广播双向视频
 			AgentVideoType agentvideotype;
 			agentvideotype.VideoType = 1;
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Broadcast Twoway Video");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Broadcast Twoway Video");
 			SpSendBroadcast(GetFunction(), SP_MSG_OF(AgentVideoType), SP_MSG_SIG_OF(AgentVideoType), agentvideotype);
 		}
 	}
@@ -669,7 +719,7 @@ CSimpleStringA CCounterConnectorEntity ::ConstructVideoParam(CSimpleStringA strM
 	CSimpleStringA str;
 	if (false == bDoubleVideo){
 		sscanf(strMsg.GetData(), "%d@%d@%d@%d@%d@%s", &lxPos, &lyPos, &lwidth, &lheight, &str);
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("local video param : (x=%d,y=%d,width=%d,height=%d).",lxPos,lyPos,lwidth,lheight);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("local video param : (x=%d,y=%d,width=%d,height=%d).",lxPos,lyPos,lwidth,lheight);
 		strVideoParam = BuildVideoDesc(lxPos,lyPos,lwidth,lheight);
 	}
 	else{
@@ -685,7 +735,7 @@ CSimpleStringA CCounterConnectorEntity ::ConstructVideoParam(CSimpleStringA strM
 				}
 			}
 		}
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("remote record local video param : (x=%d,y=%d,width=%d,height=%d), remote video param : (x=%d,y=%d,width=%d,height=%d)",
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("remote record local video param : (x=%d,y=%d,width=%d,height=%d), remote video param : (x=%d,y=%d,width=%d,height=%d)",
 			iPostionArr[0][0], iPostionArr[1][0],iPostionArr[2][0], iPostionArr[3][0],iPostionArr[0][1], iPostionArr[1][1],iPostionArr[2][1], iPostionArr[3][1]);
 		strVideoParam = BuildDoubleVideoDesc(iPostionArr[0][0], iPostionArr[1][0],iPostionArr[2][0], iPostionArr[3][0],iPostionArr[0][1], iPostionArr[1][1],iPostionArr[2][1], iPostionArr[3][1]);
 	}
@@ -722,7 +772,7 @@ void CCounterConnectorEntity::StopRemoteRecordSpeakerAudioCapture()
 				}
 			}
 			else{
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("remote record has stop speaker capture.");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("remote record has stop speaker capture.");
 			}
 		}
 	}
@@ -786,6 +836,7 @@ void CCounterConnectorEntity ::SendCurAudioDevice()
 	}
 }
 
+
 void CCounterConnectorEntity::SetCallType(CallingTypeEnum eType)
 {
 	m_fsm.SetCallingType(eType);
@@ -810,7 +861,7 @@ DeviceTypeEnum CCounterConnectorEntity::RvcGetDeviceType()
 		eType = eDesk2SType;
 		WORD nMajor = stStaticinfo.MachineVersion.GetMajor();
 		WORD nMinor = stStaticinfo.MachineVersion.GetMinor();
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("MachineVersion is %d.%d", nMajor, nMinor);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("MachineVersion is %d.%d", nMajor, nMinor);
 		if (2 == nMajor) {
 			eType = eDesk2SIntegratedType;
 		}
@@ -832,6 +883,7 @@ DeviceTypeEnum CCounterConnectorEntity::RvcGetDeviceType()
 	return eType;
 }
 
+
 ChannelCounterConnectorClient::ChannelCounterConnectorClient( CCounterConnectorEntity *pEntity ) : ChannelService_ClientBase(pEntity)
 {
 	m_eLastState = eChannelState_Idle;
@@ -891,7 +943,6 @@ void ChannelCounterConnectorClient::OnMessage( ErrorCodeEnum Error, ChannelServi
 
 void CCounterConnectorSession::Handle_StartCall(SpReqAnsContext<ConnectService_StartCall_Req, ConnectService_StartCall_Ans>::Pointer ctx)
 {
-	LOG_FUNCTION();
 	ErrorCodeEnum rc = Error_Succeed;
 	m_pEntity->m_fsm.m_CallingParam.connect_ip		= ctx->Req.connect_ip; 
 	m_pEntity->m_fsm.m_CallingParam.connect_port	= ctx->Req.connect_port;
@@ -900,6 +951,7 @@ void CCounterConnectorSession::Handle_StartCall(SpReqAnsContext<ConnectService_S
 	m_pEntity->m_fsm.m_CallingParam.assistant_port = ctx->Req.assistant_port;
 	m_pEntity->m_fsm.m_CallingParam.subid = ctx->Req.subid;
 	m_pEntity->m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_COMMAND_CALL));
+	m_pEntity->m_fsm.m_bNeedQueueName = TRUE;
 	ctx->Answer((ErrorCodeEnum)rc);
 }
 
@@ -916,14 +968,13 @@ void CCounterConnectorSession::Handle_StartCallExternal(SpReqAnsContext<ConnectS
 		m_pEntity->m_fsm.m_CallingParam.connect_session	= callparam->strConnectSession;
 		m_pEntity->m_fsm.m_CallingParam.subid = callparam->strSubid;
 		m_pEntity->m_fsm.m_CallingParam.assistant_port = callparam->nAsisstPort;
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Handle_StartCallExternal strConnectIp=%s, nSipPort=%d, nCallType=%d, strConnectSession=%s, strSubid=%s, nAsisstPort=%d", callparam->strConnectIp,
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Handle_StartCallExternal strConnectIp=%s, nSipPort=%d, nCallType=%d, strConnectSession=%s, strSubid=%s, nAsisstPort=%d", callparam->strConnectIp,
 			callparam->nSipPort, callparam->nCallType, callparam->strConnectSession, callparam->strSubid, callparam->nAsisstPort);
 	}
-	else
-	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Get RVCCallingParam Failed!\n");
+	else{
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Get RVCCallingParam Failed!");
 	}
-
+	m_pEntity->m_fsm.m_bNeedQueueName = TRUE;
 	m_pEntity->m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_COMMAND_CALL));
 	ctx->Answer((ErrorCodeEnum)rc);
 }
@@ -938,18 +989,42 @@ void CCounterConnectorSession::Handle_StopCall(SpReqAnsContext<ConnectService_St
 		m_pEntity->m_fsm.m_SessionParam.connect_ip = callparam->strConnectIp ; 
 		m_pEntity->m_fsm.m_SessionParam.connect_session = callparam->strConnectSession;
 		m_pEntity->m_fsm.m_SessionParam.event_port = callparam->nInstructPort;
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Handle_StopCall strConnectIp=%s, strConnectSession=%s,event_port=%d", m_pEntity->m_fsm.m_SessionParam.connect_ip.GetData(),
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Handle_StopCall strConnectIp=%s, strConnectSession=%s,event_port=%d", m_pEntity->m_fsm.m_SessionParam.connect_ip.GetData(),
 			m_pEntity->m_fsm.m_SessionParam.connect_session.GetData(), m_pEntity->m_fsm.m_SessionParam.event_port);
 	}
 	else{
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Get SessionParam Failed!\n");
 	}
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("holder hangup call!");
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("holder hangup call!");
 	m_pEntity->m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_HANGUP));
 	ctx->Answer((ErrorCodeEnum)rc);
 }
 
-void CCounterConnectorSession::OnClose( ErrorCodeEnum eErrorCode )
+
+void CCounterConnectorSession::Handle_GetCallRouteType(SpReqAnsContext<ConnectService_GetCallRouteType_Req, ConnectService_GetCallRouteType_Ans>::Pointer ctx)
+{
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Get Call Route Type is %d.", m_pEntity->m_iRouteType);
+	ctx->Ans.RouteType = m_pEntity->m_iRouteType;
+	ctx->Answer(Error_Succeed);
+}
+
+
+void CCounterConnectorSession::Handle_SetVideoCallRouteParams(SpReqAnsContext<ConnectService_SetVideoCallRouteParams_Req, ConnectService_SetVideoCallRouteParams_Ans>::Pointer ctx)
+{
+	if (m_pEntity->m_iRouteType) {
+		m_pEntity->SetCallRouteParams(ctx->Req.BusinessName, ctx->Req.CallPriority);
+		ctx->Ans.ErrorCode = Error_Succeed;
+		ctx->Ans.ErrorMsg = CSimpleStringA2W("设置呼叫路由参数成功.");
+	}
+	else {
+		ctx->Ans.ErrorCode = Error_Param;
+		ctx->Ans.ErrorMsg = CSimpleStringA2W("该设备不支持新模式呼叫路由.");
+	}
+	ctx->Answer(Error_Succeed);
+}
+
+
+void CCounterConnectorSession::OnClose(ErrorCodeEnum eErrorCode )
 {
 	LOG_FUNCTION();
 }

+ 7 - 0
Module/mod_counterconnector/mod_counterconnector.h

@@ -29,6 +29,10 @@ public:
 	virtual void Handle_StartCallExternal(SpReqAnsContext<ConnectService_StartCallExternal_Req, ConnectService_StartCallExternal_Ans>::Pointer ctx);
 	virtual void Handle_StopCall(SpReqAnsContext<ConnectService_StopCall_Req, ConnectService_StopCall_Ans>::Pointer ctx);
 	virtual void OnClose(ErrorCodeEnum eErrorCode);
+	virtual void Handle_GetCallRouteType(SpReqAnsContext<ConnectService_GetCallRouteType_Req, ConnectService_GetCallRouteType_Ans>::Pointer ctx);
+	virtual void Handle_SetVideoCallRouteParams(SpReqAnsContext<ConnectService_SetVideoCallRouteParams_Req, ConnectService_SetVideoCallRouteParams_Ans>::Pointer ctx);
+
+
 private:
 	CCounterConnectorEntity *m_pEntity;
 };
@@ -82,6 +86,8 @@ public:
 	void StopRemoteRecordSpeakerAudioCapture();
 	void Handle_StartRecordPreview(const char* pszMessage);
 	DeviceTypeEnum RvcGetDeviceType();
+	ErrorCodeEnum LoadEntityConfig();
+	ErrorCodeEnum SetCallRouteParams(CSimpleStringA strQueueName, CSimpleStringA strClientLevel);
 
 	virtual bool IsService()const;
 	virtual void OnTimeout(DWORD dwTimerID);
@@ -91,6 +97,7 @@ public:
 	BOOL m_bIsRemoteRecordStopSpeakerCapture;	
 	BOOL m_bHasLaunched;
 	CServerSessionBase *m_pCurrentSession;
+	int m_iRouteType;
 
 private:
 	BOOL m_bIsPadType;

+ 0 - 3
Module/mod_counterconnector/strutil.h

@@ -5,9 +5,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifndef RVC_DATALEN
-#define RVC_DATALEN 126
-#endif
 
 #define proxy_copy(pDst, pSrc)		if(pSrc)	{	memcpy(pDst, pSrc, strlen(pSrc));	}
 

+ 1 - 1
Module/mod_interactivecontrol/mod_interactivecontrol.cpp

@@ -1343,7 +1343,7 @@ ErrorCodeEnum CITCtrlEntity::StopRecord(CSimpleStringA strVideoName)
 		else{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Stop record failed for 0x%08x", rc);
 			char strmsg[MAX_PATH] = { 0 };
-			_snprintf(strmsg, MAX_PATH, "stop record failed for 0x%08x", rc);
+			snprintf(strmsg, MAX_PATH, "stop record failed for 0x%08x", rc);
 			LogError(Severity_High, Error_Debug, LOG_EVT_STOP_REMOTERECORD_FAILED, strmsg);
 		}
 	}