hd

EslGateway.h 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*************************************************************************
  2. 【文件名】 EslGateway.h
  3. 【功能模块和目的】 ESL网关类头文件
  4. 【开发者及日期】 郑石诺 2016/07/14
  5. 【版本】 V1.0.0
  6. 【版权信息】 Copyright (C)2016 河南华谊网络科技有限公司
  7. 【更改记录】
  8. *************************************************************************/
  9. #pragma once
  10. class CChanTrunk;
  11. /*************************************************************************
  12. 【类名】 CEslGateway
  13. 【功能】 负责ESL消息解析、收发
  14. 【接口说明】 ESL网关类
  15. 【开发者及日期】 郑石诺 2016/07/14
  16. 【版本】 V1.0.0
  17. 【版权信息】 Copyright (C)2016 河南华谊网络科技有限公司
  18. 【更改记录】
  19. *************************************************************************/
  20. class CEslGateway
  21. {
  22. public:
  23. ~CEslGateway(void);
  24. // 控制接口
  25. bool start(void);
  26. void stop(void);
  27. bool hangupAll(void);
  28. bool scanExten(void);
  29. bool sendCmd(LPCTSTR pCmd);
  30. bool execute(esl_handle_t* pHandle, LPCTSTR App, LPCTSTR Param);
  31. bool Execte2( LPCTSTR App, LPCTSTR Param,LPCTSTR ChanId);
  32. private:
  33. friend class CFsProxy;
  34. CEslGateway(CFsProxy* pParent);
  35. // ESL服务端线程函数
  36. static DWORD WINAPI __eslListenThread(LPVOID lpParameter);
  37. static void __eslListenThreadCb(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr, void *user_data);
  38. void __processCallConnect(esl_handle_t* pHandle, CChanTrunk* pTrunk);
  39. // 事件处理的线程函数
  40. static DWORD WINAPI __eventThread(LPVOID lpParameter);
  41. void __onEslEvent(esl_event_t* pEvent);
  42. void __onEslDisconnect(void);
  43. void __onEslEvtBgJobDone(esl_event_t* pEvent);
  44. void __onEslEvtChanEvent(esl_event_t* pEvent);
  45. void __onEslEvtCustom(esl_event_t* pEvent);
  46. void __onEslEvtDtmf(esl_event_t* pEvent);
  47. void __onEslEvtHold(esl_event_t* pEvent, EVENT_HOLD_TYPE EvtType);
  48. private:
  49. CFsProxy* m_pParent;
  50. volatile bool m_Stop;
  51. HANDLE m_ListenThread;
  52. HANDLE m_EventThread;
  53. esl_handle_t m_EslHdl4Listen; // 监听FreeSWITCH消息
  54. esl_handle_t m_EslHdl4Send; // 向FreeSWITCH发送命令
  55. };