Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

217 lines
9.1 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1997 Active Voice Corporation. All Rights Reserved.
  4. //
  5. // Active Agent(r) and Unified Communications(tm) are trademarks of Active Voice Corporation.
  6. //
  7. // Other brand and product names used herein are trademarks of their respective owners.
  8. //
  9. // The entire program and user interface including the structure, sequence, selection,
  10. // and arrangement of the dialog, the exclusively "yes" and "no" choices represented
  11. // by "1" and "2," and each dialog message are protected by copyrights registered in
  12. // the United States and by international treaties.
  13. //
  14. // Protected by one or more of the following United States patents: 5,070,526, 5,488,650,
  15. // 5,434,906, 5,581,604, 5,533,102, 5,568,540, 5,625,676, 5,651,054.
  16. //
  17. // Active Voice Corporation
  18. // Seattle, Washington
  19. // USA
  20. //
  21. /////////////////////////////////////////////////////////////////////////////////////////
  22. // AVTapiCall.h : Declaration of the CAVTapiCall
  23. #ifndef __AVTAPICALL_H_
  24. #define __AVTAPICALL_H_
  25. #include "resource.h" // main symbols
  26. #include "particip.h"
  27. #include <list>
  28. using namespace std;
  29. typedef list<ITTerminal *> TERMINALLIST;
  30. typedef list<IVideoWindow *> VIDEOWINDOWLIST;
  31. #define WM_THREADINSTRUCTION (WM_USER + 5057)
  32. #define WM_ADDPARTICIPANT (WM_USER + 5058)
  33. #define WM_REMOVEPARTICIPANT (WM_USER + 5059)
  34. #define WM_UPDATEPARTICIPANT (WM_USER + 5060)
  35. #define WM_CME_STREAMSTART (WM_USER + 5061)
  36. #define WM_CME_STREAMSTOP (WM_USER + 5062)
  37. #define WM_CALLSTATE (WM_USER + 5063)
  38. #define WM_STREAM_EVENT (WM_USER + 5064)
  39. #define NUM_USER_BSTR 2
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CAVTapiCall
  42. class ATL_NO_VTABLE CAVTapiCall :
  43. public CComObjectRootEx<CComMultiThreadModel>,
  44. public CComCoClass<CAVTapiCall, &CLSID_AVTapiCall>,
  45. public IAVTapiCall
  46. {
  47. // Enumerations
  48. public:
  49. typedef enum tag_ThreadInstructions_t
  50. {
  51. TI_NONE,
  52. TI_DISCONNECT,
  53. TI_NOTIFYCONFROOMSTATE,
  54. TI_REQUEST_QOS,
  55. TI_USERUSERINFO,
  56. TI_STREAM_ACTIVE,
  57. TI_STREAM_INACTIVE,
  58. TI_RCV_VIDEO_ACTIVE,
  59. TI_RCV_VIDEO_INACTIVE,
  60. TI_REJECT,
  61. TI_CONNECT,
  62. TI_QUIT,
  63. } ThreadInstructions_t;
  64. // Construction
  65. public:
  66. CAVTapiCall();
  67. void FinalRelease();
  68. // Members
  69. public:
  70. DWORD m_dwThreadID;
  71. long m_lCallID; // Host app information
  72. bool m_bCallLogged;
  73. BSTR m_bstrName;
  74. BSTR m_bstrUser[NUM_USER_BSTR];
  75. BSTR m_bstrOriginalAddress; // Originally dialed string
  76. BSTR m_bstrDisplayableAddress; // String displayed as the dialed number
  77. DWORD m_dwAddressType;
  78. CallLogType m_nCallLogType;
  79. DATE m_dateStart;
  80. bool m_bPreviewStreaming;
  81. bool m_bRcvVideoStreaming;
  82. AVCallType m_nCallType;
  83. protected:
  84. ITBasicCallControl *m_pITControl; // TAPI call information
  85. ITTerminal *m_pITTerminalPreview;
  86. CALL_STATE m_callState; // Current call state (convienence)
  87. TERMINALLIST m_lstTerminals; // List of terminals in use for the call
  88. PARTICIPANTLIST m_lstParticipants;
  89. VIDEOWINDOWLIST m_lstStreamingVideo;
  90. CAtomicList m_atomList;
  91. CComAutoCriticalSection m_critTerminals;
  92. CComAutoCriticalSection m_critLstStreamingVideo;
  93. BOOL m_bKillMe; // For cancelling during dial
  94. bool m_bResolvedAddress; // have we successfully resolved the address
  95. bool m_bMustDisconnect; // Once a call goes to connected, we must call disconnect on it
  96. // Implementation
  97. public:
  98. static bool WaitWithMessageLoop();
  99. HRESULT GetTerminalInterface( REFIID riid, long nMediaType, TERMINAL_DIRECTION nTD, void **ppVoid, short nInd );
  100. protected:
  101. void StreamingChanged( IVideoFeed *pFeed, bool bStreaming );
  102. // COM Implementation
  103. public:
  104. DECLARE_NOT_AGGREGATABLE(CAVTapiCall)
  105. BEGIN_COM_MAP(CAVTapiCall)
  106. COM_INTERFACE_ENTRY(IAVTapiCall)
  107. END_COM_MAP()
  108. // IAVTapiCall
  109. public:
  110. STDMETHOD(FindParticipant)(ITParticipant *pParticipant, IParticipant **ppFound);
  111. STDMETHOD(UpdateParticipant)(ITParticipant *pITParticipant);
  112. STDMETHOD(get_nCallType)(/*[out, retval]*/ AVCallType *pVal);
  113. STDMETHOD(put_nCallType)(/*[in]*/ AVCallType newVal);
  114. STDMETHOD(OnStreamingChanged)(IVideoFeed *pFeed, VARIANT_BOOL bStreaming);
  115. STDMETHOD(get_RcvVideoStreaming)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  116. STDMETHOD(put_RcvVideoStreaming)(/*[in]*/ VARIANT_BOOL newVal);
  117. STDMETHOD(IsRcvVideoStreaming)();
  118. STDMETHOD(put_StreamActive)(/*[in]*/ VARIANT_BOOL bActive );
  119. STDMETHOD(HandleUserUserInfo)();
  120. STDMETHOD(GetCallerIDInfo)(ITCallInfo *pCallInfo);
  121. STDMETHOD(IsPreviewStreaming)();
  122. STDMETHOD(get_ITCallInfo)(/*[out, retval]*/ ITCallInfo * *pVal);
  123. STDMETHOD(NotifyParticipantChangeConfRoom)(ITParticipant *pParticipant, AV_PARTICIPANT_EVENT nEvent);
  124. STDMETHOD(get_bResolved)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  125. STDMETHOD(put_bResolved)(/*[in]*/ VARIANT_BOOL newVal);
  126. STDMETHOD(get_bstrDisplayableAddress)(/*[out, retval]*/ BSTR *pVal);
  127. STDMETHOD(put_bstrDisplayableAddress)(/*[in]*/ BSTR newVal);
  128. STDMETHOD(GetVideoFeedCount)(short *pnCount);
  129. STDMETHOD(NotifyStreamEvent)(CALL_MEDIA_EVENT cme);
  130. STDMETHOD(ForceCallerIDUpdate)();
  131. STDMETHOD(get_bstrUser)(/*[in]*/ short nIndex, /*[out, retval]*/ BSTR *pVal);
  132. STDMETHOD(put_bstrUser)(/*[in]*/ short nIndex, /*[in]*/ BSTR newVal);
  133. STDMETHOD(TerminalArrival)(/*[in]*/ITTerminal *pTerminal);
  134. STDMETHOD(TerminalRemoval)(/*[in]*/ITTerminal *pTerminal);
  135. // Basic call properties
  136. STDMETHOD(get_bstrCallerID)(/*[out, retval]*/ BSTR *pVal);
  137. STDMETHOD(get_bstrName)(/*[out, retval]*/ BSTR *pVal);
  138. STDMETHOD(put_bstrName)(/*[in]*/ BSTR newVal);
  139. STDMETHOD(get_dwAddressType)(/*[out, retval]*/ DWORD *pVal);
  140. STDMETHOD(put_dwAddressType)(/*[in]*/ DWORD newVal);
  141. STDMETHOD(get_bstrOriginalAddress)(/*[out, retval]*/ BSTR *pVal);
  142. STDMETHOD(put_bstrOriginalAddress)(/*[in]*/ BSTR newVal);
  143. STDMETHOD(get_dwCaps)(/*[out, retval]*/ DWORD *pVal);
  144. STDMETHOD(get_nCallLogType)(/*[out, retval]*/ CallLogType *pVal);
  145. STDMETHOD(put_nCallLogType)(/*[in]*/ CallLogType newVal);
  146. STDMETHOD(get_callState)(/*[out, retval]*/ CALL_STATE *pVal);
  147. STDMETHOD(put_callState)(/*[in]*/ CALL_STATE newVal);
  148. // Object properties
  149. STDMETHOD(CheckKillMe)();
  150. STDMETHOD(get_bKillMe)(/*[out, retval]*/ BOOL *pVal);
  151. STDMETHOD(put_bKillMe)(/*[in]*/ BOOL newVal);
  152. STDMETHOD(get_lCallID)(/*[out, retval]*/ long *pVal);
  153. STDMETHOD(put_lCallID)(/*[in]*/ long newVal);
  154. STDMETHOD(get_dwThreadID)(/*[out, retval]*/ DWORD *pVal);
  155. STDMETHOD(put_dwThreadID)(/*[in]*/ DWORD newVal);
  156. // Participant related methods
  157. STDMETHOD(IsSameCallHub)(ITCallHub *pCallHub);
  158. STDMETHOD(get_ITCallHub)(/*[out, retval]*/ ITCallHub * *pVal);
  159. STDMETHOD(IsMyParticipant)(ITParticipant *pParticipant);
  160. STDMETHOD(EnumParticipants)();
  161. STDMETHOD(AddParticipant)(ITParticipant *pParticipant);
  162. STDMETHOD(RemoveParticipant)(ITParticipant *pParticipant);
  163. STDMETHOD(PopulateTreeView)(IConfRoomTreeView *pTreeView);
  164. STDMETHOD(GetDisplayNameForParticipant)(ITParticipant *pParticipant, BSTR *pbstrName );
  165. STDMETHOD(UpdateCallerIDFromParticipant)();
  166. // General operations
  167. STDMETHOD(ResolveAddress)();
  168. STDMETHOD(Log)(CallLogType nType);
  169. // Call control methods
  170. STDMETHOD(NotifyConfRoomState)(long *pErrorInfo);
  171. STDMETHOD(PostMessage)(long msg, WPARAM wParam);
  172. STDMETHOD(Disconnect)(/*[in]*/ VARIANT_BOOL bKill);
  173. // Retrieving other interfaces
  174. STDMETHOD(get_ITBasicAudioTerminal)(/*[out, retval]*/ ITBasicAudioTerminal* *pVal);
  175. STDMETHOD(get_IBasicVideo)(/*[out, retval]*/ IDispatch **pVal);
  176. STDMETHOD(get_ITAddress)(/*[out, retval]*/ ITAddress **pVal);
  177. STDMETHOD(get_ITBasicCallControl)(/*[out, retval]*/ ITBasicCallControl **pVal);
  178. STDMETHOD(put_ITBasicCallControl)(/*[in]*/ ITBasicCallControl *newVal);
  179. STDMETHOD(get_IVideoWindow)(short nInd, /*[out, retval]*/ IDispatch **pVal);
  180. STDMETHOD(get_ITParticipantControl)(/*[out, retval]*/ ITParticipantControl **ppVal);
  181. STDMETHOD(get_IVideoWindowPreview)(/*[out, retval]*/ IDispatch **ppVal);
  182. STDMETHOD(get_ITTerminalPreview)(/*[out, retval]*/ ITTerminal **ppVal);
  183. STDMETHOD(put_ITTerminalPreview)(/*[in]*/ ITTerminal * newVal);
  184. STDMETHOD(AddTerminal)(ITTerminal *pITTerminal);
  185. STDMETHOD(RemoveTerminal)(ITTerminal *pITTerminal);
  186. };
  187. #endif //__AVTAPICALL_H_