public int checkPreAgentState() { // 로그인하기전 서버에 상담원 상태를 먼저 체크한다. AgentStateVO agentStateVO = checkAgentState(); if (agentStateVO != null) { AgentEvent evt = new AgentEvent(); evt.setEvtMsg(agentStateVO.getXmppMsg()); evt.setAgentState(agentStateVO.getState()); evt.setReasonCode(agentStateVO.getReasonCode()); evt.setEvtCode(EVENT_TYPE.ON_LOGGEDON); evt.setIsFirstLogin(true); finesseObj.raiseEvent(evt); if (agentStateVO.getState().Equals(AGENTSTATE.TALKING)) { XMLParser xmlParser = new XMLParser(logwrite, agent); string talkingState = httpHandler.checkDialogID((string)currentServer["IP"], agent); talkingState = talkingState.Replace("\n", ""); Event evt_ = xmlParser.parseXML(talkingState); finesseObj.raiseEvent(evt_); } return(ERRORCODE.SUCCESS); } else { return(ERRORCODE.FAIL); } }
private void raiseCallEvent(CallEvent evt) { string evtCode = evt.getEvtCode(); string evtMessage = evt.getEvtMsg(); callDataTable = evt.getCallVariable(); evtMessage = evtMessage.Replace("\n", ""); StringBuilder callState = new StringBuilder(); foreach (DictionaryEntry item in evt.getCallStateTable()) { callState.Append(item.Key).Append("^").Append(item.Value).Append("|"); } if (callState.ToString().EndsWith("|")) { string tempStr = callState.ToString().Substring(0, callState.ToString().Length - 1); callState = new StringBuilder(); callState.Append(tempStr); } StringBuilder callAction = new StringBuilder(); foreach (string str in evt.getActionList()) { callAction.Append(str).Append("^"); } if (callAction.ToString().EndsWith("^")) { string tempStr = callAction.ToString().Substring(0, callAction.ToString().Length - 1); callAction = new StringBuilder(); callAction.Append(tempStr); } switch (evtCode) { case EVENT_TYPE.ON_CONNECTION: logwrite.write("raiseEvent", ":::::::::::::::::::::::::::::::::::: GetEventOnConnection ::::::::::::::::::::::::::::::::::::"); logwrite.write("raiseEvent", evtMessage); logwrite.write("raiseEvent", "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"); GetEventOnConnection(evt.getCurFinesseIP(), evt.getCurAemsIP(), evt.getCurIspsIP(), evtMessage); break; case EVENT_TYPE.ON_DISCONNECTION: logwrite.write("raiseEvent", ":::::::::::::::::::::::::::::::::::: GetEventOnDisConnection ::::::::::::::::::::::::::::::::::::"); logwrite.write("raiseEvent", evtMessage); logwrite.write("raiseEvent", "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"); GetEventOnDisConnection(evt.getCurFinesseIP(), evt.getCurAemsIP(), evt.getCurIspsIP(), evtMessage); break; case EVENT_TYPE.ALERTING: writeCallEventLog("GetEventOnCallAlerting", evt); setActiveDialogID(evt); GetEventOnCallAlerting(evt.getDialogID(), evt.getCallType(), evt.getFromAddress(), evt.getToAddress(), callState.ToString(), callAction.ToString()); if (agentCurrentState.Equals(AGENTSTATE.NOT_READY)) { // 상담원 현재 상태가 NOTREADY 인데 Alerting 이벤트가 발생했다는건, 내선인입콜 케이스 isInternalCall = true; } else { isInternalCall = false; } break; case EVENT_TYPE.FAILED: writeCallEventLog("GetEventOnCallFailed", evt); setActiveDialogID(evt); GetEventOnCallFailed(evt.getDialogID(), evt.getCallType(), evt.getFromAddress(), evt.getToAddress(), callState.ToString(), callAction.ToString()); break; case EVENT_TYPE.ACTIVE: writeCallEventLog("GetEventOnCallActive", evt); setActiveDialogID(evt); GetEventOnCallActive(evt.getDialogID(), evt.getCallType(), evt.getFromAddress(), evt.getToAddress(), callState.ToString(), callAction.ToString()); if (evt.getToAddress() != null && evt.getToAddress().Equals(phonePadNum)) { // 폰패드 컨퍼런스 logwrite.write("raiseEvent", "PhonePad Conference Start"); phonePadCallID = dialogID; // phonePad 콜 구분을 위한 DialogID 세팅 fnConference(); } break; case EVENT_TYPE.HELD: writeCallEventLog("GetEventOnCallHeld", evt); //setActiveDialogID(evt); GetEventOnCallHeld(evt.getDialogID(), evt.getCallType(), evt.getFromAddress(), evt.getToAddress(), callState.ToString(), callAction.ToString()); break; case EVENT_TYPE.INITIATING: writeCallEventLog("GetEventOnCallInitiating", evt); setActiveDialogID(evt); GetEventOnCallInitiating(evt.getDialogID(), evt.getCallType(), evt.getFromAddress(), evt.getToAddress(), callState.ToString(), callAction.ToString()); break; case EVENT_TYPE.INITIATED: writeCallEventLog("GetEventOnCallInitiated", evt); setActiveDialogID(evt); GetEventOnCallInitiated(evt.getDialogID(), evt.getCallType(), evt.getFromAddress(), evt.getToAddress(), callState.ToString(), callAction.ToString()); break; case EVENT_TYPE.WRAP_UP: writeCallEventLog("GetEventOnCallWrapUp", evt); // checkTable(callEvent.getCallVariable()); removeDialogID(evt); GetEventOnCallWrapUp(evt.getDialogID(), evt.getCallType(), evt.getFromAddress(), evt.getToAddress(), callState.ToString(), callAction.ToString()); break; case EVENT_TYPE.DROPPED: writeCallEventLog("GetEventOnCallDropped", evt); // checkTable(callEvent.getCallVariable()); removeDialogID(evt); GetEventOnCallDropped(evt.getDialogID(), evt.getCallType(), evt.getFromAddress(), evt.getToAddress(), callState.ToString(), callAction.ToString()); if (evt.getCallType().Equals(CALL.CONFERENCE) && evt.getDialogID().Equals(phonePadCallID)) { // 폰패드 이후 Dropped 이벤트일 경우 폰패드 결과를 요청한다. getPhonePadInfo(); } if (isInternalCall) { // NOTREADY 상태에서 내선콜이 인입되었다가 Alerting 도중에 콜이 종료되면 상담원 이전상태 이벤트를 Finesse 가 주지 않아 // 임의적으로 상담원상태 요청 이후 상태 이벤트를 발생시킨다. AgentStateVO agentStateVO = FinesseClient.checkAgentState(); // 이전 상담원 상태체크 AgentEvent evt_ = new AgentEvent(); evt_.setEvtMsg(agentStateVO.getXmppMsg()); evt_.setAgentState(agentStateVO.getState()); evt_.setReasonCode(agentStateVO.getReasonCode()); evt_.setEvtCode(EVENT_TYPE.ON_AGENTSTATE_CHANGE); raiseEvent(evt_); } break; default: logwrite.write("raiseEvent", ":::::::::::::::::::::::::::::::::::: UNKWON EVENT ::::::::::::::::::::::::::::::::::::"); logwrite.write("raiseEvent", evtMessage); logwrite.write("raiseEvent", "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"); setActiveDialogID(evt); break; } }