中间件底层,websocket

VirtualChan.cpp 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #include "StdAfx.h"
  2. #include "VirtualChan.h"
  3. #include "Operation.h"
  4. #include "FsProxy.h"
  5. #include "OperationReactor.h"
  6. CVirtualChan::CVirtualChan(CFsProxy* pParent, UINT ChanNo) : m_pParent(pParent), m_No(ChanNo), m_State(CHAN_LOGIC_STATE_FREE), m_IsInMeeting(false), m_pOperation(NULL), m_isActiveHanguper(FALSE)
  7. {
  8. ASSERT(m_pParent != NULL);
  9. }
  10. CVirtualChan::~CVirtualChan(void)
  11. {
  12. }
  13. /*****************************************************************
  14. **【函数名称】 _setSession
  15. **【函数功能】 设置通道会话环境
  16. **【参数】
  17. **【返回值】
  18. ****************************************************************/
  19. void CVirtualChan::_setSession( LPCTSTR SessionId, LPCTSTR ChanId )
  20. {
  21. if(SessionId != NULL)
  22. m_SessionId = SessionId;
  23. else
  24. m_SessionId = _T("");
  25. if(ChanId != NULL)
  26. {
  27. m_TmpChanID = ChanId;
  28. m_ChanId = ChanId;
  29. m_pParent->regBusyChan(this);
  30. }
  31. else
  32. {
  33. m_pParent->unregBusyChan(this);
  34. m_ChanId = _T("");
  35. }
  36. }
  37. /*****************************************************************
  38. **【函数名称】 _reset
  39. **【函数功能】 重置通道
  40. **【参数】
  41. **【返回值】
  42. ****************************************************************/
  43. void CVirtualChan::_reset( void )
  44. {
  45. LOGGER(LOG_LEVEL_NORMAL, _T("{CVirtualChan}: 执行线路[%lu]重置"), m_No);
  46. m_State = CHAN_LOGIC_STATE_FREE;
  47. m_IsInMeeting = false;
  48. m_CallerNum = _T("");
  49. m_CalleeNum = _T("");
  50. m_ChanId = _T("");
  51. m_SessionId = _T("");
  52. m_OpNumber = _T("");
  53. }
  54. /*****************************************************************
  55. **【函数名称】 bindOp
  56. **【函数功能】 绑定操作
  57. **【参数】
  58. **【返回值】
  59. ****************************************************************/
  60. bool CVirtualChan::bindOp( COperation* pOp )
  61. {
  62. ASSERT(pOp != NULL);
  63. if(pOp == NULL || m_pOperation != NULL)
  64. return false;
  65. m_pOperation = pOp;
  66. return true;
  67. }
  68. /*****************************************************************
  69. **【函数名称】 releaseOp
  70. **【函数功能】 释放操作
  71. **【参数】
  72. **【返回值】
  73. ****************************************************************/
  74. bool CVirtualChan::releaseOp( COperation* pOp )
  75. {
  76. if(m_pOperation != pOp)
  77. return false;
  78. m_pOperation = NULL;
  79. return true;
  80. }
  81. /*****************************************************************
  82. **【函数名称】 onChanDtmf
  83. **【函数功能】 通道DTMF事件处理
  84. **【参数】
  85. **【返回值】
  86. ****************************************************************/
  87. void CVirtualChan::onChanDtmf( LPCTSTR Dtmf )
  88. {
  89. if(m_pOperation != NULL)
  90. m_pOperation->onHostChanDtmf(Dtmf);
  91. }
  92. /*****************************************************************
  93. **【函数名称】 onChanHold
  94. **【函数功能】 通道保持事件处理
  95. **【参数】
  96. **【返回值】
  97. ****************************************************************/
  98. void CVirtualChan::onChanHold( EVENT_HOLD_TYPE HoldType )
  99. {
  100. }