| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- /*************************************************************************
- 【文件名】 Agent.h
- 【功能模块和目的】 座席类头文件
- 【开发者及日期】 郑石诺 2015/01/19
- 【版本】 V1.0.0
- 【版权信息】 Copyright (C)2015 河南华谊网络科技有限公司
- 【更改记录】
- *************************************************************************/
- #pragma once
- #include <atomic>
- #include "TemplateTimer.h"
- //class CAgentProperty // ych 2018.5.4
- //{
- //public:
- // CTime m_FirstLogTimeToday;
- // // 业务属性
- // UINT m_TimePostProcessing; // 话后处理时长
- // UINT m_AnswerCount; // 应答次数
- // UINT m_ReposeCount; // 小休次数
- // UINT m_TimeFree; // 空闲时长
- // UINT m_TimeRepos; // 小休时长
- // UINT m_TimeTalk; // 通话时长
- //};
- /*************************************************************************
- 【类名】 CAgent
- 【功能】
- 【接口说明】 座席类
- 【开发者及日期】 郑石诺 2015/01/19
- 【版本】 V1.0.0
- 【版权信息】 Copyright (C)2015 河南华谊网络科技有限公司
- 【更改记录】
- *************************************************************************/
- class CAgent
- {
- public:
- CAgent(UINT a_AgentID, UINT a_ExtID, LPCTSTR a_GroupID, UINT a_AgentType, UINT a_PostProcessingTime);
- //CAgent(UINT a_AgentID, UINT a_ExtID, LPCTSTR a_GroupID, UINT a_AgentType, const CAgentProperty& AgentProperty); // ych 2018.5.4 2020-03-05 屏蔽
- ~CAgent(void);
- // 清理资源
- void release(UINT HostAgent);
- // 座席是否空闲
- bool isFree(void) const { return (m_State == AGENT_STATE_FREE && m_AssoExtState == INNER_STATE_FREE && !m_IsRepose); }
- bool isFreeForCall(void) const { return (m_State == AGENT_STATE_FREE && m_AssoExtState == INNER_STATE_FREE/* && !m_IsRepose*/); } // 安图拷贝
- // 属性操作
- BOOL setState(AGENT_STATE a_AgentState, bool IsForce = false); // 设置座席的逻辑状态
- /*2020-04-03 安图复制,解决置忙情况下外呼后状态为置忙 start*/
- BOOL setFreeForAgentCall(bool IsForce = false);
- BOOL setRequestedForAgentCall(bool IsForce = false);
- BOOL setBusyForAgentCall(bool IsForce = false);
- BOOL setProcessingForAgentCall(bool IsForce = false);
- /* end*/
- void onAssoExtStatusUpdated(INNER_STATE a_ExtState, PARAM Param = NULL); // 关联分机状态更新的处理函数
- const CString& ip(void) const { return m_AgentIp; } // 读取座席的主机IP
- UINT assoExten(void) const { return m_Exten; } // 读取关联的分机ID
- UINT id(void) const { return m_AgentID; } // 读取座席工号
- LPCTSTR group(void) const { return m_GroupID; } // 读取座席组号
- //UINT answerCount(void) const { return m_AnswerCount; } // 读取应答次数
- //UINT freeTime(void) const { return m_TimeFree; } // 读取空闲时长
- /********2019-12-19************/
- UINT answerCount(void) const { return m_AnswerCount + m_AnswerCountOld; } // 读取应答次数
- UINT freeTime(void) const { return m_TimeFree + m_TimeFreeOld; } // 读取空闲时长
-
- UINT type(void) const { return m_AgentType; } // 读取坐席类型
- AGENT_STATE state(void) const { return m_State; } // 得到座席实际状态
- BOOL isRepose(void) const { return m_IsRepose; } // 读取座席是否置忙
- const AgentGroupNoList& groupNoList(void) const { return m_GroupNoList; }
- AgentGroupNoList& groupNoList(void) { return m_GroupNoList; }
- BOOL lock(void);
- BOOL lockForCall(void); // 安图拷贝
- //void GetAgentProperty(CAgentProperty& AgentProperty); // ych 2018.5.4 2020-03-05 屏蔽
- bool queueJump();
- private:
- // 统计处理
- void __reportLogin(); // 签出统计通知
- void __reportLogout(const UINT HostAgent); // 签出统计通知
- void __onStatusUpdate(AGENT_STATE State, bool StartFlag);
- void __reportStatus(void); // 上报座席当前状态
- // 定时器处理
- void __onTimerPoll(void); // 轮询处理
- void __onTimerPostProcessing(void); // 话后处理时长处理
- void __onTimerLock(void); // 座席被锁定超时处理
- void __setTimer(UINT TimmerId, UINT Elapse);
- void __killTimer(UINT TimmerId);
- private:
- // 定时器常量
- static const UINT TIMER_POST_PROCESSING = 1001; // 话后处理定时器ID
- static const UINT TIMER_LOCK_PERIOD = 1005; // 锁定定时器ID
- // 座席网络属性
- CString m_AgentIp; // 座席网络IP
- int m_AgentPort; // 座席网络端口号
- // 座席基本属性
- UINT m_AgentID; // 座席工号
- UINT m_Exten; // 关联分机号
- CString m_GroupID; // 座席组号
- AGENT_TYPE m_AgentType; // 座席类型
- AGENT_STATE m_State; // 座席状态
- INNER_STATE m_AssoExtState; // 关联分机状态
- bool m_IsRepose; // 是否小休
- AgentGroupNoList m_GroupNoList; // 座席组号列表
- bool m_bFirstQueue; //2018.6.11 for loop
- // 业务属性
- UINT m_TypePostProcessing; // 话后处理类型 0:自动 1:手动
- UINT m_TimePostProcessing; // 话后处理时长
- UINT m_AnswerCount; // 应答次数
- UINT m_ReposeCount; // 小休次数
- //UINT m_TimeFree; // 空闲时长
- std::atomic<UINT> m_TimeFree; // 空闲时长 // 2020-03-05 防止 定时器,挂断后该值置0时 该变量被同时操作
- UINT m_TimeRepos; // 小休时长
- UINT m_TimeTalk; // 通话时长
- /************2019-12-19 历史记录**************************/
- UINT m_AnswerCountOld; // 应答次数
- UINT m_ReposeCountOld; // 小休次数 暂不需要使用
- UINT m_TimeFreeOld; // 空闲时长
- UINT m_TimeReposOld; // 小休时长 暂不需要使用
- UINT m_TimeTalkOld; // 通话时长 暂不需要使用
- /**************************************/
- CCriticalSection m_Cs4Lock; // 座席锁用于多组分配、被叫前锁定
- TTimer<CAgent> m_PollTimer; // 轮询定时器
- TTimer<CAgent> m_AgentTimer; // 座席定时器,用于锁定和话后处理
- };
|