修改三方通话功能,在发起三方通话时,先保持住主叫,然后再拉回主叫到会议

MeetingPool.cpp 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. #include "StdAfx.h"
  2. #include "MeetingPool.h"
  3. #include "Meeting.h"
  4. #include "DevDsp.h"
  5. CMeetingPool::CMeetingPool(CDevDsp* pParent) : m_pParent(pParent), m_Handle(DEV_HANDLE_INVALID)
  6. {
  7. }
  8. CMeetingPool::~CMeetingPool(void)
  9. {
  10. __release();
  11. }
  12. /*****************************************************************
  13. **【函数名称】 __release
  14. **【函数功能】 释放资源
  15. **【参数】
  16. **【返回值】
  17. ****************************************************************/
  18. void CMeetingPool::__release( void )
  19. {
  20. int Key;
  21. CMeeting* pMeeting;
  22. POSITION Pos = m_MeetingMap.GetStartPosition();
  23. while(Pos != NULL)
  24. {
  25. m_MeetingMap.GetNextAssoc(Pos, Key, pMeeting);
  26. ASSERT(pMeeting != NULL);
  27. delete pMeeting;
  28. }
  29. m_MeetingMap.RemoveAll();
  30. }
  31. /*****************************************************************
  32. **【函数名称】 __getMeeting
  33. **【函数功能】 返回指定会议
  34. **【参数】
  35. **【返回值】
  36. ****************************************************************/
  37. CMeeting* CMeetingPool::__getMeeting( int MeetingId )
  38. {
  39. CMeeting* pMeeting = NULL;
  40. m_MeetingMap.Lookup(MeetingId, pMeeting);
  41. return pMeeting;
  42. }
  43. /*****************************************************************
  44. **【函数名称】 __deleteMeeting
  45. **【函数功能】 删除指定会议
  46. **【参数】
  47. **【返回值】
  48. ****************************************************************/
  49. void CMeetingPool::deleteMeeting( int MeetingId )
  50. {
  51. CMeeting* pMeeting = __getMeeting(MeetingId);
  52. if(pMeeting == NULL)
  53. return;
  54. ASSERT(pMeeting->attendeeCount() == 0);
  55. m_MeetingMap.RemoveKey(MeetingId);
  56. delete pMeeting;
  57. ISX_dcb_delconf(m_Handle, MeetingId);
  58. }
  59. /*****************************************************************
  60. **【函数名称】 open
  61. **【函数功能】 打开会议设备
  62. **【参数】
  63. **【返回值】
  64. ****************************************************************/
  65. bool CMeetingPool::open( void )
  66. {
  67. ASSERT(m_Handle == DEV_HANDLE_INVALID);
  68. m_Handle = ISX_dcb_open(m_pParent->nodeNo(), m_pParent->boardNo());
  69. bool t_bRes = false;
  70. if (m_Handle != DEV_HANDLE_INVALID) {
  71. LOGGER(LOG_CLASS_BUSI, LOG_LEVEL_WARNING, _T("{CMeetingPool}:DSP[%d-%d]成功打开会议设备[%d]"), m_pParent->nodeNo(), m_pParent->boardNo(), m_Handle);
  72. t_bRes = true;
  73. }
  74. else {
  75. LOGGER(LOG_CLASS_BUSI, LOG_LEVEL_WARNING, _T("{CMeetingPool}:DSP[%d-%d]打开会议设备失败"), m_pParent->nodeNo(), m_pParent->boardNo());
  76. }
  77. return t_bRes;
  78. }
  79. /*****************************************************************
  80. **【函数名称】 close
  81. **【函数功能】 关闭会议设备
  82. **【参数】
  83. **【返回值】
  84. ****************************************************************/
  85. void CMeetingPool::close( void )
  86. {
  87. if(m_Handle != DEV_HANDLE_INVALID)
  88. {
  89. ISX_dcb_close(m_Handle);
  90. m_Handle = DEV_HANDLE_INVALID;
  91. }
  92. __release();
  93. }
  94. /*****************************************************************
  95. **【函数名称】 createMeeting
  96. **【函数功能】 创建会议
  97. **【参数】
  98. **【返回值】
  99. ****************************************************************/
  100. bool CMeetingPool::createMeeting( MeetingInfo& MeetInfo )
  101. {
  102. ASSERT(m_Handle != DEV_HANDLE_INVALID);
  103. if(m_Handle == DEV_HANDLE_INVALID)
  104. return false;
  105. int MeetingId;
  106. if(ISX_dcb_estconf(m_Handle, NULL, 0, 0, &MeetingId) == 0)
  107. {
  108. CMeeting* pMeeting = new CMeeting(this, MeetingId);
  109. m_MeetingMap.SetAt(MeetingId, pMeeting);
  110. MeetInfo.NodeNo = m_pParent->nodeNo();
  111. MeetInfo.BoardNo = m_pParent->boardNo();
  112. MeetInfo.MeetingId = MeetingId;
  113. return true;
  114. }
  115. return false;
  116. }
  117. /*****************************************************************
  118. **【函数名称】 accept
  119. **【函数功能】 接受与会方
  120. **【参数】
  121. **【返回值】
  122. ****************************************************************/
  123. bool CMeetingPool::accept( int MeetingId, COneLeg* pAttendee, bool IsOneWay )
  124. {
  125. ASSERT(m_Handle != DEV_HANDLE_INVALID);
  126. if(m_Handle == DEV_HANDLE_INVALID)
  127. return false;
  128. CMeeting* pMeeting = __getMeeting(MeetingId);
  129. if(pMeeting == NULL)
  130. return false;
  131. return pMeeting->accept(pAttendee, IsOneWay);
  132. }
  133. /*****************************************************************
  134. **【函数名称】 remove
  135. **【函数功能】 删除一个与会方
  136. **【参数】
  137. **【返回值】
  138. ****************************************************************/
  139. bool CMeetingPool::remove( int MeetingId, COneLeg* pAttendee )
  140. {
  141. CMeeting* pMeeting = __getMeeting(MeetingId);
  142. if(pMeeting == NULL)
  143. return false;
  144. bool Res = pMeeting->remove(pAttendee);
  145. if(pMeeting->attendeeCount() == 0)
  146. deleteMeeting(MeetingId);
  147. return Res;
  148. }
  149. /*****************************************************************
  150. **【函数名称】 record
  151. **【函数功能】 为与会方录音
  152. **【参数】
  153. **【返回值】
  154. ****************************************************************/
  155. bool CMeetingPool::record( int MeetingId, COneLeg* pAttendee, RecordContent* pContent, bool IsStop )
  156. {
  157. CMeeting* pMeeting = __getMeeting(MeetingId);
  158. if(pMeeting == NULL)
  159. return false;
  160. return pMeeting->record(pAttendee, pContent, IsStop);
  161. }
  162. /*****************************************************************
  163. **【函数名称】 mute
  164. **【函数功能】 静音与会方
  165. **【参数】
  166. **【返回值】
  167. ****************************************************************/
  168. bool CMeetingPool::mute( int MeetingId, COneLeg* pAttendee, bool IsOff )
  169. {
  170. CMeeting* pMeeting = __getMeeting(MeetingId);
  171. if(pMeeting == NULL)
  172. return false;
  173. return pMeeting->mute(pAttendee, IsOff);
  174. }
  175. /*****************************************************************
  176. **【函数名称】 allocDspChan
  177. **【函数功能】 分配DSP通道
  178. **【参数】
  179. **【返回值】
  180. ****************************************************************/
  181. CDspChannel* CMeetingPool::allocDspChan( void )
  182. {
  183. return m_pParent->getFreeDspCh();
  184. }