acd_agent_manager.h
7.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* CC/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "acd_agent.h"
#include "thread.h"
class acd_agent_manager : public Thread {
private:
uint32_t m_agent_timeout;
string m_default_anishow;
string m_default_destshow;
string m_password;
SafeMap<int64_t, acd_agent_ptr> m_agentHandle_map;
SafeMap<string, acd_agent_ptr> m_agentID_map;
SafeMap<string, acd_agent_ptr> m_agentDN_map;
protected:
virtual void Method();
private:
static bool ProcessCheckAgent(const acd_agent_ptr& p_agent);
static void ProcessIMSConnect(int64_t handle, const acd_agent_ptr& p_agent);
static void ProcessIMSDisconnect(int64_t handle, const acd_agent_ptr& p_agent);
static void ProcessGetAgentCalls(int64_t handle, acd_agent_ptr p_agent, int32_t& num);
int32_t GetAgentCalls();
bool CheckAgent(const acd_agent_ptr& p_agent);
void RouteRequest(const ims::RouteEventT& event);
void RouteRequestCancel(const ims::RouteEventT& event);
void RouteRequestSuccess(const ims::RouteEventT& event, const acd_agent_ptr& p_agent);
void RouteRequestFail(const ims::RouteEventT& event, const ims::RouteEventReasonT& result);
public:
acd_agent_manager();
~acd_agent_manager();
void Initialize(uint32_t agent_timeout, const string& default_anishow,
const string& default_destshow, const string& password);
void Uninitialize();
void ProcessIMSEvent(const ims::CallEventT& event);
void ProcessIMSEvent(const ims::MediaEventT& event);
void ProcessIMSEvent(const ims::RouteEventT& event);
void ProcessIMSEvent(const ims::OtherEventT& event);
void IMSConnect();
void IMSDisconnect();
bool GetAgent(const string& agentId, acd_agent_ptr& p_agent);
SafeMap<string, acd_agent_ptr>& GetAgents();
public:
acd::AcdResultT SignIn(const string& agentId, const string& agentDn, const string& agentPwd,
const acd::StatusChangeT& statusChangetype, bool autoAnswer, bool fcSignin, const string& skill,
int64_t& handle, const std::map<std::string, std::string>& ctx);
acd::AcdResultT SignOut(int64_t handle, const string& agentId);
acd::AcdResultT SetAgentStatus(int64_t handle, const string& agentId,
const acd::AgentStatusT& agentStatus, const string& restReason);
acd::AcdResultT GetAgentStatus(int64_t handle, const string& agentId,
acd::AgentStatusT& agentStatus);
acd::AcdResultT ResetStatuschangetype(int64_t handle, const string& agentId,
const acd::StatusChangeT& statusChangetype);
acd::AcdResultT ResetAutoAnswer(int64_t handle, const string& agentId, bool autoAnswer);
acd::AcdResultT ResetSkill(int64_t handle, const string& agentId, const string& skill);
acd::AcdResultT Reset(int64_t handle, const string& agentId);
acd::AcdResultT OutboundCall(int64_t handle, const string& agentId, const string& callerId,
const string& destId, const string& forCallerDispNum, const string& forCalleeDispNum,
int32_t timeout, const acd::CallModeT& callMode, const acd::CallTypeT& callType);
acd::AcdResultT AnswerCall(int64_t handle, const string& agentId);
acd::AcdResultT ReleaseCall(int64_t handle, const string& agentId);
acd::AcdResultT Hold(int64_t handle, const string& agentId);
acd::AcdResultT Retrieve(int64_t handle, const string& agentId);
acd::AcdResultT Consult(int64_t handle, const string& agentId, const string& callerId,
const string& destId, const string& forCallerDispNum, const string& forCalleeDispNum,
const acd::CallTypeT& callType);
acd::AcdResultT ConsultReconnect(int64_t handle, const string& agentId);
acd::AcdResultT ConsultTransfer(int64_t handle, const string& agentId);
acd::AcdResultT SingleStepTransfer(int64_t handle, const string& agentId, const string& callerId,
const string& destId, const string& forCallerDispNum, const string& forCalleeDispNum,
bool isPassthrough, const acd::CallTypeT& transferType);
acd::AcdResultT ConsultConference(int64_t handle, const string& agentId);
acd::AcdResultT ConferenceJoin(int64_t handle, const string& agentId, const string& callerId,
const string& destId, const string& forCallerDispNum, const string& forCalleeDispNum,
const acd::ConferenceT& conferenceType);
acd::AcdResultT SetAssociateData(int64_t handle, const string& agentId, const string& key,
const string& value);
acd::AcdResultT GetAssociateData(int64_t handle, const string& agentId, const string& key,
string& value);
acd::AcdResultT ForceSignOut(int64_t handle, const string& agentId, const string& destAgentId);
acd::AcdResultT ForceSetAgentStatus(int64_t handle, const string& agentId,
const string& destAgentId, const acd::AgentStatusT& agentStatus, const string& restReason);
acd::AcdResultT Listen(int64_t handle, const string& agentId, const string& callerId,
const string& destAgentId, const string& forCallerDispNum, const string& forCalleeDispNum);
acd::AcdResultT StopListen(int64_t handle, const string& agentId, const string& destAgentId);
acd::AcdResultT Insert(int64_t handle, const string& agentId, const string& callerId,
const string& destAgentId, const string& forCallerDispNum, const string& forCalleeDispNum);
acd::AcdResultT StopInsert(int64_t handle, const string& agentId, const string& destAgentId);
acd::AcdResultT SwitchInsertorListen(int64_t handle, const string& agentId, const string& callerId,
const string& destAgentId, const string& forCallerDispNum, const string& forCalleeDispNum);
acd::AcdResultT Break(int64_t handle, const string& agentId, const string& destAgentId);
acd::AcdResultT SendDTMF(int64_t handle, const string& agentId, const string& digitals);
acd::AcdResultT GetAgentDetailByAgentID(int64_t handle, const string& agentId,
const string& destAgentId, acd::AgentInfoT& agentInfo);
acd::AcdResultT GetAgentDetailByAgentDN(int64_t handle, const string& agentId,
const string& destAgentDn, acd::AgentInfoT& agentInfo);
acd::AcdResultT GetAgentDetailsByAgentIDs(int64_t handle, const string& agentId,
const acd::StringListT& destAgentIdList, acd::AgentInfoListT& agentInfoList);
acd::AcdResultT GetAgentDetailsByAgentDNs(int64_t handle, const string& agentId,
const acd::StringListT& destAgentDnList, acd::AgentInfoListT& agentInfoList);
acd::AcdResultT GetRecordFileName(int64_t handle, const string& agentId, string& filename);
acd::AcdResultT GetSkill(int64_t handle, const string& agentId, acd::StringListT& skill);
acd::AcdResultT GetRestReason(int64_t handle, const string& agentId, acd::StringListT& restReason);
acd::AcdResultT GetSysInfo(int64_t handle, const string& agentId, acd::SysInfoT& sysInfo);
acd::AcdResultT SynchronizeCTITime(int64_t handle, const string& agentId, int64_t& timestamp);
acd::AcdResultT Heartbeat(int64_t handle, const string& agentId);
acd::AcdResultT ResetConfig(const string& password);
};