|
|
@@ -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();
|