| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #pragma once
- #include <iostream>
- #include "WebSocketServer.h"
- #include <boost/date_time/posix_time/posix_time.hpp>
- #include "Log.h"
- #include "ITimer.h"
- #include "TimeScheduler.h"
- #include <list>
- using namespace boost::posix_time;
- //类型定义:座席当前的状态
- typedef enum tagAGENT_STATE
- {
- AGENT_STATE_UNKNOWN = 0x00, // 未知
- // 座席逻辑状态
- AGENT_STATE_LOGING = 0x01, // 登录中
- AGENT_STATE_FREE = 0x02, // 空闲
- AGENT_STATE_BUSY = 0x03, // 通话中
- AGENT_STATE_POST_PROCESSING = 0x04, // 话后处理
- AGENT_STATE_REPOSE = 0x05, // 小休
- AGENT_STATE_REQUESTED = 0x06, // 被请求
- AGENT_STATE_LOGOUT = 0x07 // 注销
- } AGENT_STATE;
- class Agent
- {
- public:
- Agent(std::string a_AgentID,std::string a_ExtID);
- Agent(std::string a_AgentID, std::string a_ExtID,std::string a_Group);
- virtual ~Agent();
- void removeAgent(std::string HostAgent); // 签出
- bool setState(AGENT_STATE a_AgentState);
- std::string assoExten(void) const { return m_Exten; } // 读取关联的分机ID
- std::string id(void) const { return m_AgentID; } // 读取座席工号
- bool isRepose(void) const { return m_IsRepose; } // 读取座席是否置忙
- AGENT_STATE state() const { return m_State; } // 坐席状态
- std::string state_s() ;
- websocketpp::connection_hdl hdl() const { return m_hdl; }
- websocketpp::connection_hdl& hdl() { return m_hdl; }
- std::list<std::string> groups() const { return m_Groups; };
- std::string group() const { return m_Group; };
- private:
- bool __login();
- bool __logout();
- std::string __FormatTime(ptime time);
- ptime __getCurTime();
- int64_t __subTime(ptime before, ptime after);
- protected:
- //virtual void onTimer(); // 定时器函数
- private:
- std::string m_AgentID;
- std::string m_Exten;
- bool m_IsRepose; // 是否小休
- AGENT_STATE m_State;
- ptime m_TimeLogin;
- ptime m_TimeLogout;
- uint64_t m_LoginTimes; // 签入时长
- uint32_t m_FreeTimes; // 空闲时长
- uint32_t m_ReposeTimes; // 小休时长
- uint32_t m_TalkTimes; // 通话时长
- uint32_t m_ReposeNum; // 小休次数
- uint32_t m_AnswerNum; // 应答次数
- uint32_t m_LogoutType; // 签出类型
- std::list<std::string> m_Groups; // 坐席组,分割后
- std::string m_Group; // 坐席组,未分割
- websocketpp::connection_hdl m_hdl;
- };
|