| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #pragma once
- #include "Log.h"
- #include <esl.h>
- #include "FsLinkInc.h"
- #include <iostream>
- typedef struct
- {
- std::string name; // 座席名字
- std::string system;
- std::string uuid;
- std::string type; //
- std::string contact; // 呼叫字符串
- std::string status; // 座席状态 忙,闲 Logged Out Available On Break
- std::string state; // Idle Waiting Receiving In a queue call
- void to_string() {
- Format fmt("name = %s,system = %s,uuid = %s,type = %s,contact = %s,status = %s,state = %s");
- fmt %name %system %uuid %type %contact %status %state;
- LOG_INFO_S(fmt.str());
- std::cout << fmt.str() << std::endl;
- }
- }AgentDetail;
- class CFsProxy;
- class CEslGateway
- {
- public:
- CEslGateway(CFsProxy* pParent);
- ~CEslGateway();
- // 控制接口
- bool start(void);
- void stop(void);
- bool hangupAll(void);
- bool scanExten(void);
- bool getAgentState(std::string AgentID, AgentDetail &agent);
- bool delAgentAll(void);
- bool delAgent(std::string AgentID);
- bool delAgent(std::string AgentID,std::list<std::string> Groups);
- bool sendCmd(string pCmd);
- bool execute(esl_handle_t* pHandle, const char* App, const char* Param);
- bool Execte(const char* App, const char* Param, const char* ChanId);
- private:
- // 事件处理的线程函数
- void __eventThread(void);
- void __onEslEvent(esl_event_t* pEvent);
- void __onEslDisconnect(void);
- void __onEslEvtBgJobDone(esl_event_t* pEvent);
- void __onEslEvtChanEvent(esl_event_t* pEvent);
- void __onEslEvtCustom(esl_event_t* pEvent);
- void __onEslEvtDtmf(esl_event_t* pEvent);
- void __onEslEvtHold(esl_event_t* pEvent, EVENT_HOLD_TYPE EvtType);
- private:
- CFsProxy* m_pParent;
- volatile bool m_Stop;
- esl_handle_t m_EslHdl4Listen; // 监听FreeSWITCH消息
- esl_handle_t m_EslHdl4Send; // 向FreeSWITCH发送命令
- };
|