|
|
@@ -279,11 +279,13 @@ void CFsProxy::onEslExtenReg(uint32_t ExtenNo, string ExtenIp)
|
|
279
|
279
|
|
|
280
|
280
|
void CFsProxy::onEslExtenUnreg(uint32_t ExtenNo)
|
|
281
|
281
|
{
|
|
|
282
|
+ std::string agentId;
|
|
282
|
283
|
{
|
|
283
|
284
|
std::unique_lock<std::mutex>lock(m_AgentLock);
|
|
284
|
285
|
auto it = m_MapAgent.find(std::to_string(ExtenNo));
|
|
285
|
286
|
if (it != m_MapAgent.end())
|
|
286
|
287
|
{
|
|
|
288
|
+ agentId = it->second->id();
|
|
287
|
289
|
it->second->removeAgent("分机掉线");
|
|
288
|
290
|
//m_Gateway.delAgent(it->second->id()); // callcenter模块中删除
|
|
289
|
291
|
m_Gateway.delAgent(it->second->id(), it->second->groups());
|
|
|
@@ -291,6 +293,13 @@ void CFsProxy::onEslExtenUnreg(uint32_t ExtenNo)
|
|
291
|
293
|
m_MapAgent.erase(it); // 从签入列表中删除
|
|
292
|
294
|
}
|
|
293
|
295
|
}
|
|
|
296
|
+
|
|
|
297
|
+ if (!agentId.empty())
|
|
|
298
|
+ {
|
|
|
299
|
+ std::string data = creatJson("Monitor", "签出", agentId);
|
|
|
300
|
+ m_MonitAgents.loopAgent(m_Server, data); // 通知班长坐席监控
|
|
|
301
|
+ }
|
|
|
302
|
+
|
|
294
|
303
|
__delExten(ExtenNo);
|
|
295
|
304
|
}
|
|
296
|
305
|
|
|
|
@@ -416,6 +425,15 @@ std::string CFsProxy::getAgentByExten(std::string ExtenNo)
|
|
416
|
425
|
return it->second->id();
|
|
417
|
426
|
}
|
|
418
|
427
|
|
|
|
428
|
+std::string CFsProxy::getAgentByExten(std::string ExtenNo, std::string &Groups)
|
|
|
429
|
+{
|
|
|
430
|
+ std::unique_lock<std::mutex>lock(m_AgentLock);
|
|
|
431
|
+ auto it = m_MapAgent.find(ExtenNo);
|
|
|
432
|
+ if (it->second == nullptr) return "";
|
|
|
433
|
+ Groups = it->second->group();
|
|
|
434
|
+ return it->second->id();
|
|
|
435
|
+}
|
|
|
436
|
+
|
|
419
|
437
|
std::string CFsProxy::getExtenByAgent(std::string AgentId)
|
|
420
|
438
|
{
|
|
421
|
439
|
std::unique_lock<std::mutex>lock(m_AgentLock);
|
|
|
@@ -431,8 +449,22 @@ std::string CFsProxy::getExtenByAgent(std::string AgentId)
|
|
431
|
449
|
|
|
432
|
450
|
bool CFsProxy::ExtenCall(long JobId, VirtualChan * pChan, std::string CallerNum, std::string CalleeNum)
|
|
433
|
451
|
{
|
|
434
|
|
- Format fmt("bgapi originate {origination_caller_id_number=%lu}user/%lu %s XML %s\r\n%s: %ld");
|
|
435
|
|
- fmt % pChan->no() % pChan->no() % CalleeNum % CConfig::GetInstance()->extContext() % ESL_HEADER_JOB_UUID % JobId;
|
|
|
452
|
+ /*Format fmt("bgapi originate {origination_caller_id_number=%lu }user/%lu %s XML %s\r\n%s: %ld");
|
|
|
453
|
+ fmt % pChan->no() % pChan->no() % CalleeNum % CConfig::GetInstance()->extContext() % ESL_HEADER_JOB_UUID % JobId;*/
|
|
|
454
|
+
|
|
|
455
|
+ std::string called;
|
|
|
456
|
+ if (getExten(atoi(CalleeNum.c_str())) == nullptr)
|
|
|
457
|
+ {
|
|
|
458
|
+ std::string prefix = CConfig::GetInstance()->gateWayPrefix();
|
|
|
459
|
+ called = CalleeNum.substr(prefix.length(), CalleeNum.length()- prefix.length());
|
|
|
460
|
+ }
|
|
|
461
|
+ else
|
|
|
462
|
+ {
|
|
|
463
|
+ called = CalleeNum;
|
|
|
464
|
+ }
|
|
|
465
|
+ Format fmt("bgapi originate {origination_caller_id_number=%lu,%s=%s}user/%lu %s XML %s\r\n%s: %ld");
|
|
|
466
|
+ fmt % pChan->no() % ESL_VAR_MALL_CALL_CALLEE %called % pChan->no() % CalleeNum % CConfig::GetInstance()->extContext() % ESL_HEADER_JOB_UUID % JobId;
|
|
|
467
|
+
|
|
436
|
468
|
return m_Gateway.sendCmd(fmt.str());
|
|
437
|
469
|
}
|
|
438
|
470
|
bool CFsProxy::PredictionCall(long JobId, std::string CallerNum, std::string CalleeNum)
|
|
|
@@ -453,8 +485,21 @@ bool CFsProxy::AutoCall(long JobId, std::string CallerNum, std::string CalleeNum
|
|
453
|
485
|
if (!m_CallStringMaker.makeCallString(Caller, CallerNum, CallString))
|
|
454
|
486
|
return false;
|
|
455
|
487
|
std::string EslCmd;
|
|
456
|
|
- EslCmd = boost::str(Format("bgapi originate {origination_caller_id_number=%s,%s=%ld,%s=%ld}%s %s XML %s\r\n%s: %ld")
|
|
457
|
|
- % CallerNum % ESL_VAR_OP_TYPE % OpType % ESL_VAR_TASK_ID % TaskId % CallString % CalleeNum % CConfig::GetInstance()->extContext() % ESL_HEADER_JOB_UUID % JobId);
|
|
|
488
|
+ /*EslCmd = boost::str(Format("bgapi originate {origination_caller_id_number=%s,%s=%ld,%s=%ld}%s %s XML %s\r\n%s: %ld")
|
|
|
489
|
+ % CallerNum % ESL_VAR_OP_TYPE % OpType % ESL_VAR_TASK_ID % TaskId % CallString % CalleeNum % CConfig::GetInstance()->extContext() % ESL_HEADER_JOB_UUID % JobId);*/
|
|
|
490
|
+
|
|
|
491
|
+ std::string called;
|
|
|
492
|
+ if (getExten(atoi(CalleeNum.c_str())) == nullptr)
|
|
|
493
|
+ {
|
|
|
494
|
+ std::string prefix = CConfig::GetInstance()->gateWayPrefix();
|
|
|
495
|
+ called = CalleeNum.substr(prefix.length(), CalleeNum.length() - prefix.length());
|
|
|
496
|
+ }
|
|
|
497
|
+ else
|
|
|
498
|
+ {
|
|
|
499
|
+ called = CalleeNum;
|
|
|
500
|
+ }
|
|
|
501
|
+ EslCmd = boost::str(Format("bgapi originate {origination_caller_id_number=%s,%s=%ld,%s=%ld,,%s=%s}%s %s XML %s\r\n%s: %ld")
|
|
|
502
|
+ % CallerNum % ESL_VAR_OP_TYPE % OpType % ESL_VAR_TASK_ID % TaskId % ESL_VAR_MALL_CALL_CALLEE %called % CallString % CalleeNum % CConfig::GetInstance()->extContext() % ESL_HEADER_JOB_UUID % JobId);
|
|
458
|
503
|
|
|
459
|
504
|
return m_Gateway.sendCmd(EslCmd);
|
|
460
|
505
|
}
|
|
|
@@ -1093,6 +1138,9 @@ void CFsProxy::__recvMsgFun(websocketpp::connection_hdl hdl, string msg)
|
|
1093
|
1138
|
fmt %ret % AgentID % AgentExten % hdl.lock().get();
|
|
1094
|
1139
|
LOG_INFO_S(fmt.str());
|
|
1095
|
1140
|
m_Server.sendMsg(hdl, creatJson(type, ret));
|
|
|
1141
|
+
|
|
|
1142
|
+ std::string data = creatJson("Monitor", "签出", AgentID);
|
|
|
1143
|
+ m_MonitAgents.loopAgent(m_Server, data); // 通知班长坐席监控
|
|
1096
|
1144
|
}
|
|
1097
|
1145
|
else if ("SayBusy" == type) { // 置忙
|
|
1098
|
1146
|
bool ret = __setState(AgentID, false);
|
|
|
@@ -1101,6 +1149,9 @@ void CFsProxy::__recvMsgFun(websocketpp::connection_hdl hdl, string msg)
|
|
1101
|
1149
|
if (it != m_MapAgent.end())
|
|
1102
|
1150
|
it->second->setState(AGENT_STATE_REPOSE);
|
|
1103
|
1151
|
m_Server.sendMsg(hdl, creatJson(type, ret));
|
|
|
1152
|
+
|
|
|
1153
|
+ std::string data = creatJson("Monitor", "小休", AgentID);
|
|
|
1154
|
+ m_MonitAgents.loopAgent(m_Server, data); // 通知班长坐席监控
|
|
1104
|
1155
|
}
|
|
1105
|
1156
|
else if ("SayFree" == type) { // 置闲
|
|
1106
|
1157
|
bool ret = __setState(AgentID, true);
|
|
|
@@ -1109,6 +1160,9 @@ void CFsProxy::__recvMsgFun(websocketpp::connection_hdl hdl, string msg)
|
|
1109
|
1160
|
if (it != m_MapAgent.end())
|
|
1110
|
1161
|
it->second->setState(AGENT_STATE_FREE);
|
|
1111
|
1162
|
m_Server.sendMsg(hdl, creatJson(type, ret));
|
|
|
1163
|
+
|
|
|
1164
|
+ std::string data = creatJson("Monitor", "空闲", AgentID);
|
|
|
1165
|
+ m_MonitAgents.loopAgent(m_Server, data); // 通知班长坐席监控
|
|
1112
|
1166
|
}
|
|
1113
|
1167
|
else if ("Hold" == type) { // 保持
|
|
1114
|
1168
|
bool ret = COperationReactor::GetInstance()->procOperation(opInstance++, LINE_OP_HOLD, ExtenNo, nullptr);
|
|
|
@@ -1287,6 +1341,8 @@ void CFsProxy::__closeFun(websocketpp::connection_hdl hdl)
|
|
1287
|
1341
|
|
|
1288
|
1342
|
if (!agentId.empty())
|
|
1289
|
1343
|
{
|
|
|
1344
|
+ std::string data = creatJson("Monitor", "签出", agentId);
|
|
|
1345
|
+ m_MonitAgents.loopAgent(m_Server, data); // 通知班长坐席监控
|
|
1290
|
1346
|
m_MonitAgents.delAgent(agentId);
|
|
1291
|
1347
|
}
|
|
1292
|
1348
|
}
|