Browse Source

#IQBX #comment mod_initiativetransfer 编译通过

80374374 1 year ago
parent
commit
6fc7d1380d

+ 1 - 0
Module/mod_initiativetransfer/CMakeLists.txt

@@ -20,6 +20,7 @@ target_include_directories(${MODULE_NAME} PRIVATE
 	${RVC_FRAMEWORK_INCLUDES_DIR}
 	${CONAN_RVCFRAMEWORK_ROOT}/include
     ${MODULE_BASE_DIR}
+	${MODULE_BASE_DIR}/mod_assistantchannel
 )
 
 # 添加实体需要依赖的其他共享库(包括系统库)

+ 78 - 14
Module/mod_initiativetransfer/FlowControlFSM.cpp

@@ -2,6 +2,21 @@
 #include "FlowControlFSM.h"
 
 #define LOG_EVT_EXIT_ACM_FLOW	 0x30500002          //退出坐席控制流程
+//错误码
+#define LOG_ERR_S0_ANSACMFLOW	 			0x30500080          
+#define LOG_ERR_S0_REQAGENTFLOW	 			0x30500081  
+#define LOG_ERR_S1_REQAGENTFLOW_FAILED 		0x30500082
+#define LOG_ERR_S2_ANSAGENTFLOW_FAILED	 	0x30500083
+#define LOG_ERR_S2_NTFENTFLOW_FAILED	 	0x30500084
+#define LOG_ERR_S3_ANSACMFLOW_FAILED	 	0x30500085
+#define LOG_ERR_S5_DISCTRL_FAILED 			0x30500086
+#define LOG_ERR_S5_REQAGENTFLOW_FAILED 		0x30500087
+#define LOG_ERR_S7_ENTRY 					0x30500088
+#define LOG_ERR_S1_ASSIS_IDEL	 			0x30500089
+#define LOG_ERR_S2_ASSIS_IDEL	 			0x3050008a
+#define LOG_ERR_S3_ASSIS_IDEL	 			0x3050008b
+#define LOG_ERR_S5_ASSIS_IDEL	 			0x3050008c
+
 
 void ChannelClient::OnMessage( ErrorCodeEnum Error, ChannelService_State_Info &Msg, CSmartPointer<IReleasable> pData )
 {
@@ -170,10 +185,12 @@ unsigned int CFlowControlFSM::s0_on_event(FSMEvent* event)
 		AgentFlowResult evt;
 		evt.error = Error_NetBroken;
 		SpSendBroadcast(m_pEntity->GetFunction(), SP_MSG_OF(AgentFlowResult), SP_MSG_SIG_OF(AgentFlowResult), evt);
+		LogWarn(Severity_Low, Error_Debug, LOG_ERR_S0_ANSACMFLOW, "s0 receive ANSACMFLOW");
 	} else if (event->iEvt == USER_EVT_REQAGENTFLOW) {
 		AgentFlowResult evt;
 		evt.error = Error_NetBroken;
 		SpSendBroadcast(m_pEntity->GetFunction(), SP_MSG_OF(AgentFlowResult), SP_MSG_SIG_OF(AgentFlowResult), evt);
+		LogWarn(Severity_Low, Error_Debug, LOG_ERR_S0_REQAGENTFLOW, "s0 receive REQAGENTFLOW");
 	}
 	else if (event->iEvt == USER_EVT_ASSIS_IDEL)
 	{
@@ -194,14 +211,19 @@ unsigned int CFlowControlFSM::s1_on_event(FSMEvent* event)
 			Info.type = ACM_TYPE_FLW;
 			SpBuffer buf;
 			buf.OpenWrite();
+#if defined(RVC_OS_WIN)
+			buf& rafe->req_context;
+#else
 			CSimpleString16Bit reqContext = CSimpleStringW216Bit(rafe->req_context);
-			buf & reqContext;
+			buf& reqContext;
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s After convert: %s", __FUNCTION__, CSimpleString16Bit2A(reqContext).GetData());
+#endif //RVC_OS_WIN
 			Info.data = buf.ToBlob();
 			Error = m_pClient->Send(Info);
 		} else 
 		{
 			Error = Error_NetBroken;
+			LogWarn(Severity_Low, Error_Debug, LOG_ERR_S1_REQAGENTFLOW_FAILED, "s1 receive REQAGENTFLOW but chan is off.");
 		}
 		return Error == Error_Succeed ? 1 : 0;
 	} else if (event->iEvt == USER_EVT_NTFENTFLOW) {
@@ -212,6 +234,7 @@ unsigned int CFlowControlFSM::s1_on_event(FSMEvent* event)
 	}
 	else if (event->iEvt == USER_EVT_ASSIS_IDEL)
 	{
+		LogWarn(Severity_Low, Error_Debug, LOG_ERR_S1_ASSIS_IDEL, "s1 ASSIS_IDEL.");
 		ReConnectionAssistchan();
 	}
 	return 0;
@@ -224,26 +247,43 @@ unsigned int CFlowControlFSM::s2_on_event(FSMEvent* event)
 		AgentFlowResult evt;
 		evt.error = Error_NetBroken;
 		SpSendBroadcast(m_pEntity->GetFunction(), SP_MSG_OF(AgentFlowResult), SP_MSG_SIG_OF(AgentFlowResult), evt);
-	} else if (event->iEvt == USER_EVT_ANSAGENTFLOW) {
+	} 
+	else if (event->iEvt == USER_EVT_ANSAGENTFLOW) {
 		AnsAgentFlowEvent *afe = static_cast<AnsAgentFlowEvent*>(event);
 		AgentFlowResult evt;
+#if defined(RVC_OS_WIN)
+		evt.ans_context = afe->ans_context;
+#else
 		CSimpleStringW ans_context = CSimpleString16Bit2W(afe->ans_context);
 		evt.ans_context = ans_context;
+#endif //RVC_OS_WIN
 		evt.error = afe->err ? Error_Unexpect : Error_Succeed;
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("AgentFlowResult!!!!!");
+		if (evt.error != Error_Succeed){
+			LogWarn(Severity_Low, Error_Debug, LOG_ERR_S2_ANSAGENTFLOW_FAILED, "s2 receive ANSAGENTFLOW error.");
+		}
 		SpSendBroadcast(m_pEntity->GetFunction(), SP_MSG_OF(AgentFlowResult), SP_MSG_SIG_OF(AgentFlowResult), evt);
-	} else if (event->iEvt == USER_EVT_REQACMFLOW) {
+	}
+	else if (event->iEvt == USER_EVT_REQACMFLOW) {
 		ReqACMFlowEvent *afe = static_cast<ReqACMFlowEvent *>(event);
 		ACMFlowInvoke evt;
+#if defined(RVC_OS_WIN)
+		evt.req_context = afe->req_context;
+#else
 		CSimpleStringW req_context = CSimpleString16Bit2W(afe->req_context);
 		evt.req_context = req_context;
+#endif //RVC_OS_WIN
 		SpSendBroadcast(m_pEntity->GetFunction(), SP_MSG_OF(ACMFlowInvoke), SP_MSG_SIG_OF(ACMFlowInvoke), evt);
-	} else if (event->iEvt == USER_EVT_NTFENTFLOW) {
+	}
+	else if (event->iEvt == USER_EVT_NTFENTFLOW) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("notify enter flow, disallow control!");
-		DisallowControl();
+		ErrorCodeEnum result = DisallowControl();
+		if (result != Error_Succeed){
+			LogWarn(Severity_Low, Error_Debug, LOG_ERR_S2_NTFENTFLOW_FAILED, "s2 send NTFENTFLOW error.");
+		}
 	}
-	else if (event->iEvt == USER_EVT_ASSIS_IDEL)
-	{
+	else if (event->iEvt == USER_EVT_ASSIS_IDEL){
+		LogWarn(Severity_Low, Error_Debug, LOG_ERR_S2_ASSIS_IDEL, "s2 ASSIS_IDEL.");
 		ReConnectionAssistchan();
 	}
 	return 0;
@@ -275,13 +315,18 @@ unsigned int CFlowControlFSM::s3_on_event(FSMEvent* event)
 			Info.type = ACM_TYPE_FLW;
 			SpBuffer buf;
 			buf.OpenWrite();
-            CSimpleString16Bit ansContext = CSimpleStringW216Bit(afe->ans_context);
-            buf& ansContext;
+#if defined(RVC_OS_WIN)
+			buf& afe->ans_context;
+#else
+			CSimpleString16Bit ansContext = CSimpleStringW216Bit(afe->ans_context);
+			buf& ansContext;
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s After convert: %s", __FUNCTION__, CSimpleString16Bit2A(ansContext).GetData());
+#endif //RVC_OS_WIN
 			Info.data = buf.ToBlob();
 			Error = m_pClient->Send(Info);
 		} else {
 			Error = Error_NetBroken;
+			LogWarn(Severity_Low, Error_Debug, LOG_ERR_S3_ANSACMFLOW_FAILED, "s3 send ANSACMFLOW error.");
 		}
 		return Error == Error_Succeed ? 1 : 0;
 	} else if (event->iEvt == USER_EVT_CHAN_OFF) {
@@ -291,6 +336,7 @@ unsigned int CFlowControlFSM::s3_on_event(FSMEvent* event)
 	}
 	else if (event->iEvt == USER_EVT_ASSIS_IDEL)
 	{
+		LogWarn(Severity_Low, Error_Debug, LOG_ERR_S3_ASSIS_IDEL, "s3 ASSIS_IDEL.");
 		ReConnectionAssistchan();
 	}
 	return 0;
@@ -303,7 +349,10 @@ void CFlowControlFSM::s5_on_exit() { }
 unsigned int CFlowControlFSM::s5_on_event(FSMEvent* event)
 {
 	if (event->iEvt == USER_EVT_DISCTRL) {
-		DisallowControl();
+		ErrorCodeEnum result = DisallowControl();
+		if (result != Error_Succeed){
+			LogWarn(Severity_Low, Error_Debug, LOG_ERR_S5_DISCTRL_FAILED, "s5 send DISCTRL error.");
+		}
 	} else if (event->iEvt == USER_EVT_REQAGENTFLOW) {
 		ReqAgentFlowEvent *rafe = static_cast<ReqAgentFlowEvent*>(event);
 		ErrorCodeEnum Error;
@@ -315,26 +364,38 @@ unsigned int CFlowControlFSM::s5_on_event(FSMEvent* event)
 			Info.type = ACM_TYPE_FLW;
 			SpBuffer buf;
 			buf.OpenWrite();
-            CSimpleString16Bit reqContext = CSimpleStringW216Bit(rafe->req_context);
-            buf& reqContext;
+#if defined(RVC_OS_WIN)
+			buf& rafe->req_context;
+#else
+			CSimpleString16Bit reqContext = CSimpleStringW216Bit(rafe->req_context);
+			buf& reqContext;
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s After convert: %s", __FUNCTION__, CSimpleString16Bit2A(reqContext).GetData());
+#endif //RVC_OS_WIN
 			Info.data = buf.ToBlob();
 			Error = m_pClient->Send(Info);
 		} else {
 			Error = Error_NetBroken;
+			LogWarn(Severity_Low, Error_Debug, LOG_ERR_S5_REQAGENTFLOW_FAILED, "s5 send REQAGENTFLOW error.");
 		}
 		return Error == Error_Succeed ? 1 : 0;
 	}
 	else if (event->iEvt == USER_EVT_ASSIS_IDEL)
 	{
+		LogWarn(Severity_Low, Error_Debug, LOG_ERR_S5_ASSIS_IDEL, "s5 ASSIS_IDEL.");
 		ReConnectionAssistchan();
 	}
 	return 0;
 }
 
+void CFlowControlFSM::s7_on_entry()
+{
+	LogWarn(Severity_Low, Error_Debug, LOG_ERR_S7_ENTRY, "s7 ENTRY.");
+}
+
 unsigned int CFlowControlFSM::s7_on_event(FSMEvent* event)
 {
-	if (event->iEvt == USER_EVT_ASSIS_IDEL){
+	if (event->iEvt == USER_EVT_ASSIS_IDEL)
+	{
 		ReConnectionAssistchan();
 	}
 	return 0;
@@ -365,7 +426,7 @@ void CFlowControlFSM::ProcessPacket( int sub_type, CBlob &blob )
 		buf & e->context;
 		PostEventFIFO(e);
 	} else {
-		LOG_TRACE("unknown sub_type from agent!");
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("unknown sub_type from agent!");
 	}
 }
 
@@ -391,6 +452,9 @@ ErrorCodeEnum CFlowControlFSM::DisallowControl()
 	}	
 }
 
+
+
+
 void NotifyEnterFlowEvent::OnUnhandled()
 {
 	LOG_FUNCTION();

+ 17 - 3
Module/mod_initiativetransfer/FlowControlFSM.h

@@ -7,8 +7,8 @@
 #include "InitiativeTransfer_server_g.h"
 #include "InitiativeTransfer_msg_g.h"
 
-#include "mod_assistantchannel/AssistantChannel_client_g.h"
-#include "mod_assistantchannel/chan_protocol.h"
+#include "AssistantChannel_client_g.h"
+#include "chan_protocol.h"
 using namespace AssistantChannel;
 
 #include "InitiativeTransfer_msg_g.h"
@@ -27,6 +27,7 @@ using namespace InitiativeTransfer;
 #define USER_EVT_EXIT			EVT_USER+50
 #define USER_EVT_ASSIS_IDEL		EVT_USER+60
 #define USER_EVT_MENU_RETURN    EVT_USER+70
+#define USER_EVT_EXIT_BACKRUN	EVT_USER+80
 
 class CFlowControlFSM;
 
@@ -62,7 +63,11 @@ struct AnsAgentFlowEvent : public FSMEvent
 {
 	AnsAgentFlowEvent() : FSMEvent(USER_EVT_ANSAGENTFLOW) {}
 	virtual ~AnsAgentFlowEvent() {}
+#if defined(RVC_OS_WIN)
+	CSimpleStringW ans_context;
+#else
 	CSimpleString16Bit ans_context;
+#endif //RVC_OS_WIN
 	int err;
 };
 
@@ -72,7 +77,11 @@ struct NotifyEnterFlowEvent : public FSMEvent
 	virtual ~NotifyEnterFlowEvent() {}
 
 	virtual void OnUnhandled();
+#if defined(RVC_OS_WIN)
+	CSimpleStringW context;
+#else
 	CSimpleString16Bit context;
+#endif //RVC_OS_WIN
 	CFlowControlFSM *m_pFSM;
 };
 
@@ -87,7 +96,11 @@ struct ReqACMFlowEvent : public FSMEvent
 {
 	ReqACMFlowEvent() : FSMEvent(USER_EVT_REQACMFLOW) {}
 	virtual ~ReqACMFlowEvent() {}
+#if defined(RVC_OS_WIN)
+	CSimpleStringW req_context;
+#else
 	CSimpleString16Bit req_context;
+#endif //RVC_OS_WIN
 };
 
 class CFlowControlFSM : public FSMImpl<CFlowControlFSM>, public IFSMStateHooker
@@ -115,6 +128,7 @@ public:
 		FSM_RULE_ENTRY_ANY(s1, s5, USER_EVT_NTFENTFLOW)
 		FSM_RULE_ENTRY_ANY(s2, s0, USER_EVT_CHAN_OFF)
 		FSM_RULE_ENTRY_ANY(s2, s1, USER_EVT_MENU_RETURN)
+		FSM_RULE_ENTRY_ANY(s2, s1, USER_EVT_EXIT_BACKRUN)
 		FSM_RULE_ENTRY_ANY(s2, s1, USER_EVT_ANSAGENTFLOW)
 		FSM_RULE_ENTRY_ANY(s2, s3, USER_EVT_REQACMFLOW)
 		FSM_RULE_ENTRY_ANY(s2, s2, USER_EVT_NTFENTFLOW)
@@ -155,7 +169,7 @@ public:
 	void s6_on_entry() {}
 	void s6_on_exit() {}
 	unsigned int s6_on_event(FSMEvent* event);
-	void s7_on_entry() {}
+	void s7_on_entry();
 	void s7_on_exit() {}
 	unsigned int s7_on_event(FSMEvent* event);
 

+ 14 - 0
Module/mod_initiativetransfer/FlowControlService.xml

@@ -1,5 +1,12 @@
 <?xml version="1.0" encoding="gb2312" ?>
 <entity name="InitiativeTransfer">
+	<const name="eState_Offline" value="0"/>
+	<const name="eState_FrontFlow" value="1"/>
+	<const name="eState_BackRun" value="2"/>
+	<const name="eState_FrontCall" value="3"/>
+	<const name="eState_Transferring" value="4"/>
+	<const name="eState_Error" value="5"/>
+	
 	<class name="FlowService" overlap="true" exclusive="false">
 	
 		<!-- ǰ¶Ë¶Ôºó¶Ëµ÷Óà -->
@@ -17,6 +24,9 @@
 			<param name="ans_context" type="wstring"/>
 		</oneway>
 		
+		<oneway name="SwitchToFrontFlow" overlap="true">
+		</oneway>
+		
 	</class>
 	
 	<message name="NotifyEnterFlow">
@@ -31,4 +41,8 @@
 		<param name="error" type="int"/>
 		<param name="ans_context" type="wstring"/>
 	</message>
+	<message name="ChanState">
+		<param name="state" type="int"/>
+		<param name="status" type="string"/>
+	</message>
 </entity>

+ 14 - 0
Module/mod_initiativetransfer/InitiativeTransfer_client_g.h

@@ -104,6 +104,20 @@ public:
 		return ret;
 	}
 
+	ErrorCodeEnum SwitchToFrontFlow()
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		if (m_context.checkEmpty())
+		{
+			m_context.AutoGenerate();
+			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
+			m_context = m_context.upgradeLink();
+		}
+		auto ret = pFunc->OnewayCall(FlowService_Method_SwitchToFrontFlow, FlowService_MethodSignature_SwitchToFrontFlow, m_context);
+		m_context.clear();
+		return ret;
+	}
+
 
 	bool SafeDelete()
 	{

+ 22 - 0
Module/mod_initiativetransfer/InitiativeTransfer_def_g.h

@@ -11,14 +11,27 @@ namespace InitiativeTransfer {
 //
 // const goes here
 //
+#define eState_Offline 0
+#define eState_FrontFlow 1
+#define eState_BackRun 2
+#define eState_FrontCall 3
+#define eState_Transferring 4
+#define eState_Error 5
 
 #define FlowService_Method_SwitchToAgentFlow 0
 #define FlowService_Method_DisallowControl 1
 #define FlowService_Method_ReturnAgent 2
+#define FlowService_Method_SwitchToFrontFlow 3
 
 #define FlowService_MethodSignature_SwitchToAgentFlow -1898800781
 #define FlowService_MethodSignature_DisallowControl -550996977
 #define FlowService_MethodSignature_ReturnAgent -1941180761
+#define FlowService_MethodSignature_SwitchToFrontFlow 398882002
+
+#define FlowService_LogCode_SwitchToAgentFlow "QLR040230500"
+#define FlowService_LogCode_DisallowControl "QLR040230501"
+#define FlowService_LogCode_ReturnAgent "QLR040230502"
+#define FlowService_LogCode_SwitchToFrontFlow "QLR040230503"
 
 struct FlowService_SwitchToAgentFlow_Info
 {
@@ -53,6 +66,15 @@ struct FlowService_ReturnAgent_Info
 
 };
 
+struct FlowService_SwitchToFrontFlow_Info
+{
+
+	void Serialize(SpBuffer &Buf)
+	{
+	}
+
+};
+
 
 ///////////////////////////
 

+ 16 - 0
Module/mod_initiativetransfer/InitiativeTransfer_msg_g.h

@@ -12,10 +12,12 @@ namespace InitiativeTransfer {
 #define eMsg_NotifyEnterFlow 0
 #define eMsg_ACMFlowInvoke 1
 #define eMsg_AgentFlowResult 2
+#define eMsg_ChanState 3
 
 #define eMsgSig_NotifyEnterFlow 1397875158
 #define eMsgSig_ACMFlowInvoke 2025290751
 #define eMsgSig_AgentFlowResult 87091676
+#define eMsgSig_ChanState -701373428
 
 struct NotifyEnterFlow
 {
@@ -57,5 +59,19 @@ struct AgentFlowResult
 
 ///////////////////////////
 
+struct ChanState
+{
+	int state;
+	CSimpleStringA status;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & state & status;
+	}
+
+};
+
+///////////////////////////
+
 } // namespace InitiativeTransfer
 #endif // __INITIATIVETRANSFER_MSG_G_H

+ 27 - 0
Module/mod_initiativetransfer/InitiativeTransfer_server_g.h

@@ -51,6 +51,13 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case FlowService_Method_SwitchToFrontFlow:
+			if (dwSignature == FlowService_MethodSignature_SwitchToFrontFlow) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -77,6 +84,11 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case FlowService_Method_SwitchToFrontFlow:
+			if (dwSignature != FlowService_MethodSignature_SwitchToFrontFlow) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -99,6 +111,11 @@ public:
 	/// override by user
 	}
 
+	virtual void Handle_SwitchToFrontFlow(SpOnewayCallContext<FlowService_SwitchToFrontFlow_Info>::Pointer ctx)
+	{
+	/// override by user
+	}
+
 	virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
 	{
 		CAutoBuffer Buf;
@@ -145,6 +162,16 @@ public:
 						Handle_ReturnAgent(ctx);
 					}
 					break;
+				case FlowService_Method_SwitchToFrontFlow:
+					{
+						SpOnewayCallContext<FlowService_SwitchToFrontFlow_Info>::Pointer ctx;
+						ctx.Attach(new SpOnewayCallContext<FlowService_SwitchToFrontFlow_Info>());
+						SpBuffer2Object(Buf, ctx->Info);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_SwitchToFrontFlow(ctx);
+					}
+					break;
 				default:
 					assert(0);
 					break;

+ 33 - 5
Module/mod_initiativetransfer/mod_initiativetransfer.cpp

@@ -4,13 +4,14 @@
 
 #include "InitiativeTransfer_server_g.h"
 #include "InitiativeTransfer_msg_g.h"
-#include "../include/EventCode.h"
+#include "EventCode.h"
 
 using namespace InitiativeTransfer;
 
 #define LOG_EVT_ENTER_ACM_FLOW	 0x30500001          //进入坐席控制流程
 
 #define LOG_EVT_UI_RETURNMENU		0x30B00006				//退出到主菜单
+#define LOG_EVT_UI_EXIT_BACKRUN		0x30B00016				//前端主动退出后端模式
 
 class CFlowControlEntity;
 
@@ -25,6 +26,8 @@ public:
 	
 	virtual void Handle_ReturnAgent(SpOnewayCallContext<FlowService_ReturnAgent_Info>::Pointer ctx);
 
+	virtual void Handle_SwitchToFrontFlow(SpOnewayCallContext<FlowService_SwitchToFrontFlow_Info>::Pointer ctx);
+
 private:
 	CFlowControlEntity *m_pEntity;
 };
@@ -43,13 +46,15 @@ public:
 		m_bIsPadType = FALSE;
 		m_fsm = new CFlowControlFSM();
 		ErrorCodeEnum Error = m_fsm->Init(this);
+
 		int i = 0;
 		CSmartPointer<IEntityFunction> spFunction = GetFunction();
-		m_arrListener.Init(2);
+		m_arrListener.Init(3);
 		spFunction->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS,NULL,false);
 		spFunction->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_UI_RETURNMENU,NULL,false);
+		spFunction->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_UI_EXIT_BACKRUN,NULL,false);
 		
-			//is Pad Version
+		//is Pad Version
 		CSystemStaticInfo stStaticinfo;
 		spFunction->GetSystemStaticInfo(stStaticinfo);
 		if (stricmp(stStaticinfo.strMachineType,"RVC.PAD")==0)
@@ -98,7 +103,7 @@ public:
 
 	virtual void OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
 		const DWORD dwSysError,const DWORD dwUserCode,const DWORD dwEntityInstanceID, const WORD wEntityDevelID, 
-		const CAutoArray<DWORD> &Param, const char *pszEntityName, const char *pszModuleName,const char *pszMessage, const linkContext& pLinkInfo)
+		const CAutoArray<DWORD> &Param, const char *pszEntityName, const char *pszModuleName,const char *pszMessage, const linkContext &pLinkInfo)
 	{
 		if (dwUserCode == LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS)
 		{
@@ -111,6 +116,11 @@ public:
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("return main menu");
 			m_fsm->PostEventFIFO(new FSMEvent(USER_EVT_MENU_RETURN));
 		}
+		else if (dwUserCode == LOG_EVT_UI_EXIT_BACKRUN)
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ui exit back run");
+			m_fsm->PostEventFIFO(new FSMEvent(USER_EVT_EXIT_BACKRUN));
+		}
 	}
 
 	virtual CServerSessionBase *OnNewSession(const char* /*pszRemoteEntityName*/, const char * /*pszClass*/)
@@ -121,15 +131,17 @@ public:
 
 	void SwitchToAgentFlow(CSimpleStringW req_context)
 	{
+#if defined(RVC_OS_LINUX)
 		CSimpleStringA str_req = CSimpleStringW2A(req_context);
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SwitchToAgentFlow, req_context:%s", str_req.GetData());
+#endif //RVC_OS_LINUX
 		ReqAgentFlowEvent *e = new ReqAgentFlowEvent();
 		e->req_context = req_context;
 		e->m_pEntityBase = this;
 		m_fsm->PostEventFIFO(e);
 		if (m_bIsPadType)
 		{
-			//only pad vervison use
+			//only pad version use
 			LogEvent(Severity_Middle,LOG_EVT_ENTER_ACM_FLOW,"enter acm flow");
 		}
 	}
@@ -139,6 +151,12 @@ public:
 		m_fsm->PostEventFIFO(new FSMEvent(USER_EVT_DISCTRL));
 	}
 
+	void SwitchToFrontFlow()
+	{
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv handle SwitchToFrontFlow function.");
+		m_fsm->PostEventFIFO(new FSMEvent(USER_EVT_EXIT_BACKRUN));
+	}
+
 	void ReturnAgent(CSimpleStringW ans_ctx)
 	{
 		AnsACMFlowEvent *e = new AnsACMFlowEvent();
@@ -155,21 +173,31 @@ private:
 void FlowControlServiceSession::Handle_SwitchToAgentFlow( SpOnewayCallContext<FlowService_SwitchToAgentFlow_Info>::Pointer ctx )
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->SwitchToAgentFlow(ctx->Info.req_context);
 }
 
 void FlowControlServiceSession::Handle_DisallowControl( SpOnewayCallContext<FlowService_DisallowControl_Info>::Pointer ctx )
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->DisallowControl();
 }
 
 void FlowControlServiceSession::Handle_ReturnAgent( SpOnewayCallContext<FlowService_ReturnAgent_Info>::Pointer ctx )
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->ReturnAgent(ctx->Info.ans_context);
 }
 
+void FlowControlServiceSession::Handle_SwitchToFrontFlow(SpOnewayCallContext<FlowService_SwitchToFrontFlow_Info>::Pointer ctx)
+{
+	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
+	m_pEntity->SwitchToFrontFlow();
+}
+
 void FinishClose(CEntityBase *pEntity, ErrorCodeEnum Error = Error_Succeed)
 {
 	if (pEntity) {