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.

5097 lines
182 KiB

  1. /****************************************************************************
  2. *
  3. * $Archive: S:/STURGEON/SRC/CALLCONT/VCS/h245man.c_v $
  4. *
  5. * INTEL Corporation Prorietary Information
  6. *
  7. * This listing is supplied under the terms of a license agreement
  8. * with INTEL Corporation and may not be copied nor disclosed except
  9. * in accordance with the terms of that agreement.
  10. *
  11. * Copyright (c) 1993-1994 Intel Corporation.
  12. *
  13. * $Revision: 1.225 $
  14. * $Date: 03 Mar 1997 09:08:10 $
  15. * $Author: MANDREWS $
  16. *
  17. * Deliverable:
  18. *
  19. * Abstract:
  20. *
  21. *
  22. * Notes:
  23. *
  24. ***************************************************************************/
  25. #include "precomp.h"
  26. #include "apierror.h"
  27. #include "incommon.h"
  28. #include "callcont.h"
  29. #include "q931.h"
  30. #include "ccmain.h"
  31. #include "listman.h"
  32. #include "q931man.h"
  33. #include "userman.h"
  34. #include "callman.h"
  35. #include "confman.h"
  36. #include "h245man.h"
  37. #include "chanman.h"
  38. #include "hangman.h"
  39. #include "ccutils.h"
  40. #include "linkapi.h"
  41. #include "h245com.h"
  42. extern CALL_CONTROL_STATE CallControlState;
  43. extern THREADCOUNT ThreadCount;
  44. static BOOL bH245ManagerInited = FALSE;
  45. static struct {
  46. DWORD dwPhysicalID;
  47. LOCK Lock;
  48. } PhysicalID;
  49. HRESULT InitH245Manager()
  50. {
  51. ASSERT(bH245ManagerInited == FALSE);
  52. // Note -- don't use a physical ID of 0; the physical ID gets mapped
  53. // to an H245 instance of the same value, and an H245 instance of
  54. // 0 is invalid
  55. PhysicalID.dwPhysicalID = 1;
  56. InitializeLock(&PhysicalID.Lock);
  57. bH245ManagerInited = H245SysInit();
  58. return CC_OK;
  59. }
  60. HRESULT DeInitH245Manager()
  61. {
  62. if (bH245ManagerInited == FALSE)
  63. return CC_OK;
  64. H245SysDeInit();
  65. H245WSShutdown();
  66. DeleteLock(&PhysicalID.Lock);
  67. bH245ManagerInited = FALSE;
  68. return CC_OK;
  69. }
  70. HRESULT MakeH245PhysicalID( DWORD *pdwH245PhysicalID)
  71. {
  72. AcquireLock(&PhysicalID.Lock);
  73. *pdwH245PhysicalID = PhysicalID.dwPhysicalID++;
  74. RelinquishLock(&PhysicalID.Lock);
  75. return CC_OK;
  76. }
  77. HRESULT _ConstructTermCapList( PCC_TERMCAPLIST *ppTermCapList,
  78. PCC_TERMCAP *ppH2250MuxCap,
  79. PCC_TERMCAPDESCRIPTORS *ppTermCapDescriptors,
  80. PCALL pCall)
  81. {
  82. #define MAX_TERM_CAPS 257
  83. #define MAX_TERM_CAP_DESC 255
  84. H245_TOTCAP_T * pTermCapArray[MAX_TERM_CAPS];
  85. H245_TOTCAPDESC_T * pTermCapDescriptorArray[MAX_TERM_CAP_DESC];
  86. unsigned long CapArrayLength;
  87. unsigned long CapDescriptorArrayLength;
  88. unsigned long i, j;
  89. HRESULT status;
  90. ASSERT(ppTermCapList != NULL);
  91. ASSERT(*ppTermCapList == NULL);
  92. ASSERT(ppH2250MuxCap != NULL);
  93. ASSERT(*ppH2250MuxCap == NULL);
  94. ASSERT(ppTermCapDescriptors != NULL);
  95. ASSERT(*ppTermCapDescriptors == NULL);
  96. ASSERT(pCall != NULL);
  97. CapArrayLength = MAX_TERM_CAPS;
  98. CapDescriptorArrayLength = MAX_TERM_CAP_DESC;
  99. status = H245GetCaps(pCall->H245Instance,
  100. H245_CAPDIR_RMTRXTX,
  101. H245_DATA_DONTCARE,
  102. H245_CLIENT_DONTCARE,
  103. pTermCapArray,
  104. &CapArrayLength,
  105. pTermCapDescriptorArray,
  106. &CapDescriptorArrayLength);
  107. if (status != H245_ERROR_OK) {
  108. *ppTermCapList = NULL;
  109. *ppH2250MuxCap = NULL;
  110. *ppTermCapDescriptors = NULL;
  111. return status;
  112. }
  113. // Check the term cap list to see if an H.225.0 mux capability is present;
  114. // this capability is treated as a special case
  115. *ppH2250MuxCap = NULL;
  116. for (i = 0; i < CapArrayLength; i++) {
  117. ASSERT(pTermCapArray[i] != NULL);
  118. if (pTermCapArray[i]->CapId == 0) {
  119. *ppH2250MuxCap = pTermCapArray[i];
  120. --CapArrayLength;
  121. for (j = i; j < CapArrayLength; j++)
  122. pTermCapArray[j] = pTermCapArray[j+1];
  123. break;
  124. }
  125. }
  126. if (CapArrayLength == 0)
  127. *ppTermCapList = NULL;
  128. else {
  129. *ppTermCapList = (PCC_TERMCAPLIST)MemAlloc(sizeof(CC_TERMCAPLIST));
  130. if (*ppTermCapList == NULL) {
  131. for (i = 0; i < CapArrayLength; i++)
  132. H245FreeCap(pTermCapArray[i]);
  133. if (*ppH2250MuxCap != NULL)
  134. H245FreeCap(*ppH2250MuxCap);
  135. for (i = 0; i < CapDescriptorArrayLength; i++)
  136. H245FreeCapDescriptor(pTermCapDescriptorArray[i]);
  137. return CC_NO_MEMORY;
  138. }
  139. (*ppTermCapList)->wLength = (WORD)CapArrayLength;
  140. (*ppTermCapList)->pTermCapArray =
  141. (H245_TOTCAP_T **)MemAlloc(sizeof(H245_TOTCAP_T *) * CapArrayLength);
  142. if ((*ppTermCapList)->pTermCapArray == NULL) {
  143. MemFree(*ppTermCapList);
  144. for (i = 0; i < CapArrayLength; i++)
  145. H245FreeCap(pTermCapArray[i]);
  146. if (*ppH2250MuxCap != NULL)
  147. H245FreeCap(*ppH2250MuxCap);
  148. for (i = 0; i < CapDescriptorArrayLength; i++)
  149. H245FreeCapDescriptor(pTermCapDescriptorArray[i]);
  150. *ppTermCapList = NULL;
  151. *ppH2250MuxCap = NULL;
  152. *ppTermCapDescriptors = NULL;
  153. return CC_NO_MEMORY;
  154. }
  155. for (i = 0; i < CapArrayLength; i++)
  156. (*ppTermCapList)->pTermCapArray[i] = pTermCapArray[i];
  157. }
  158. if (CapDescriptorArrayLength == 0)
  159. *ppTermCapDescriptors = NULL;
  160. else {
  161. *ppTermCapDescriptors = (PCC_TERMCAPDESCRIPTORS)MemAlloc(sizeof(CC_TERMCAPDESCRIPTORS));
  162. if (*ppTermCapDescriptors == NULL) {
  163. for (i = 0; i < CapArrayLength; i++)
  164. H245FreeCap(pTermCapArray[i]);
  165. if (*ppH2250MuxCap != NULL)
  166. H245FreeCap(*ppH2250MuxCap);
  167. for (i = 0; i < CapDescriptorArrayLength; i++)
  168. H245FreeCapDescriptor(pTermCapDescriptorArray[i]);
  169. if (*ppTermCapList != NULL) {
  170. MemFree((*ppTermCapList)->pTermCapArray);
  171. MemFree(*ppTermCapList);
  172. }
  173. *ppTermCapList = NULL;
  174. *ppH2250MuxCap = NULL;
  175. *ppTermCapDescriptors = NULL;
  176. return CC_NO_MEMORY;
  177. }
  178. (*ppTermCapDescriptors)->wLength = (WORD)CapDescriptorArrayLength;
  179. (*ppTermCapDescriptors)->pTermCapDescriptorArray =
  180. (H245_TOTCAPDESC_T **)MemAlloc(sizeof(H245_TOTCAPDESC_T *) * CapDescriptorArrayLength);
  181. if ((*ppTermCapDescriptors)->pTermCapDescriptorArray == NULL) {
  182. for (i = 0; i < CapArrayLength; i++)
  183. H245FreeCap(pTermCapArray[i]);
  184. if (*ppH2250MuxCap != NULL)
  185. H245FreeCap(*ppH2250MuxCap);
  186. for (i = 0; i < CapDescriptorArrayLength; i++)
  187. H245FreeCapDescriptor(pTermCapDescriptorArray[i]);
  188. if (*ppTermCapList != NULL) {
  189. MemFree((*ppTermCapList)->pTermCapArray);
  190. MemFree(*ppTermCapList);
  191. }
  192. MemFree(*ppTermCapDescriptors);
  193. *ppTermCapList = NULL;
  194. *ppH2250MuxCap = NULL;
  195. *ppTermCapDescriptors = NULL;
  196. return CC_NO_MEMORY;
  197. }
  198. for (i = 0; i < CapDescriptorArrayLength; i++)
  199. (*ppTermCapDescriptors)->pTermCapDescriptorArray[i] = pTermCapDescriptorArray[i];
  200. }
  201. return CC_OK;
  202. }
  203. HRESULT _ProcessConnectionComplete( PCONFERENCE pConference,
  204. PCALL pCall)
  205. {
  206. CC_HCONFERENCE hConference;
  207. CC_HCALL hCall;
  208. HQ931CALL hQ931Call;
  209. HQ931CALL hQ931CallInvitor;
  210. HRESULT status;
  211. CC_CONNECT_CALLBACK_PARAMS ConnectCallbackParams;
  212. CC_MULTIPOINT_CALLBACK_PARAMS MultipointCallbackParams;
  213. CC_PEER_CHANGE_CAP_CALLBACK_PARAMS PeerChangeCapCallbackParams;
  214. CC_PEER_ADD_CALLBACK_PARAMS PeerAddCallbackParams;
  215. WORD i;
  216. BOOL bMultipointConference;
  217. H245_TRANSPORT_ADDRESS_T Q931Address;
  218. PDU_T *pPdu = NULL; // Too big to be local variable (70K)
  219. CALLTYPE CallType;
  220. WORD wNumCalls;
  221. PCC_HCALL CallList;
  222. WORD wNumChannels;
  223. PCC_HCHANNEL ChannelList;
  224. PCHANNEL pChannel;
  225. PCALL pOldCall;
  226. CC_HCALL hOldCall;
  227. BYTE bNewTerminalNumber;
  228. BYTE bNewMCUNumber;
  229. CC_ENDPOINTTYPE DestinationEndpointType;
  230. H245_COMM_MODE_ENTRY_T *pH245CommunicationTable;
  231. BYTE bCommunicationTableCount;
  232. BOOL bSessionTableChanged;
  233. CONFMODE PreviousConferenceMode;
  234. CC_ADDR MCAddress;
  235. BOOL bConferenceTermCapsChanged;
  236. H245_INST_T H245Instance;
  237. PCC_TERMCAP pTxTermCap;
  238. PCC_TERMCAP pRxTermCap;
  239. H245_MUX_T *pTxMuxTable;
  240. H245_MUX_T *pRxMuxTable;
  241. ASSERT(pConference != NULL);
  242. ASSERT(pCall != NULL);
  243. ASSERT(pCall->hConference == pConference->hConference);
  244. hConference = pConference->hConference;
  245. hCall = pCall->hCall;
  246. hQ931Call = pCall->hQ931Call;
  247. hQ931CallInvitor = pCall->hQ931CallInvitor;
  248. H245Instance = pCall->H245Instance;
  249. CallType = pCall->CallType;
  250. // Note that pConference->ConferenceMode refers to the conference mode BEFORE
  251. // this connection attempt completes. If the current conference mode is
  252. // point-to-point, this connection (if successful) will result in a multipoint
  253. // conference. We want to reflect in the CONNECT callback the connection mode
  254. // that would exist if the connect attempt is successful.
  255. if ((pConference->ConferenceMode == POINT_TO_POINT_MODE) ||
  256. (pConference->ConferenceMode == MULTIPOINT_MODE) ||
  257. (pCall->bCallerIsMC))
  258. bMultipointConference = TRUE;
  259. else
  260. bMultipointConference = FALSE;
  261. // Initialize all fields of ConnectCallbackParams now
  262. ConnectCallbackParams.pNonStandardData = pCall->pPeerNonStandardData;
  263. ConnectCallbackParams.pszPeerDisplay = pCall->pszPeerDisplay;
  264. ConnectCallbackParams.bRejectReason = CC_REJECT_UNDEFINED_REASON;
  265. ConnectCallbackParams.pTermCapList = pCall->pPeerH245TermCapList;
  266. ConnectCallbackParams.pH2250MuxCapability = pCall->pPeerH245H2250MuxCapability;
  267. ConnectCallbackParams.pTermCapDescriptors = pCall->pPeerH245TermCapDescriptors;
  268. ConnectCallbackParams.pLocalAddr = pCall->pQ931LocalConnectAddr;
  269. if (pCall->pQ931DestinationAddr == NULL)
  270. ConnectCallbackParams.pPeerAddr = pCall->pQ931PeerConnectAddr;
  271. else
  272. ConnectCallbackParams.pPeerAddr = pCall->pQ931DestinationAddr;
  273. ConnectCallbackParams.pVendorInfo = pCall->pPeerVendorInfo;
  274. ConnectCallbackParams.bMultipointConference = bMultipointConference;
  275. ConnectCallbackParams.pConferenceID = &pConference->ConferenceID;
  276. ConnectCallbackParams.pMCAddress = pConference->pMultipointControllerAddr;
  277. ConnectCallbackParams.pAlternateAddress = NULL;
  278. ConnectCallbackParams.dwUserToken = pCall->dwUserToken;
  279. status = AddEstablishedCallToConference(pCall, pConference);
  280. if (status != CC_OK) {
  281. MarkCallForDeletion(pCall);
  282. if (CallType == THIRD_PARTY_INTERMEDIARY)
  283. Q931RejectCall(hQ931CallInvitor,
  284. CC_REJECT_UNDEFINED_REASON,
  285. &pCall->ConferenceID,
  286. NULL, // alternate address
  287. pCall->pPeerNonStandardData);
  288. if ((CallType == CALLER) || (CallType == THIRD_PARTY_INVITOR) ||
  289. ((CallType == CALLEE) && (pConference->LocalEndpointAttached == NEVER_ATTACHED)))
  290. InvokeUserConferenceCallback(pConference,
  291. CC_CONNECT_INDICATION,
  292. status,
  293. &ConnectCallbackParams);
  294. if (ValidateCallMarkedForDeletion(hCall) == CC_OK)
  295. FreeCall(pCall);
  296. H245ShutDown(H245Instance);
  297. Q931Hangup(hQ931Call, CC_REJECT_UNDEFINED_REASON);
  298. if (ValidateConference(hConference) == CC_OK)
  299. UnlockConference(pConference);
  300. return status;
  301. }
  302. if (((pConference->ConferenceMode == POINT_TO_POINT_MODE) ||
  303. (pConference->ConferenceMode == MULTIPOINT_MODE)) &&
  304. (pConference->tsMultipointController == TS_TRUE))
  305. status = CreateConferenceTermCaps(pConference, &bConferenceTermCapsChanged);
  306. else {
  307. status = CC_OK;
  308. bConferenceTermCapsChanged = FALSE;
  309. }
  310. if (status != CC_OK) {
  311. MarkCallForDeletion(pCall);
  312. if (CallType == THIRD_PARTY_INTERMEDIARY)
  313. Q931RejectCall(pCall->hQ931CallInvitor,
  314. CC_REJECT_UNDEFINED_REASON,
  315. &pCall->ConferenceID,
  316. NULL, // alternate address
  317. pCall->pPeerNonStandardData);
  318. if ((CallType == CALLER) || (CallType == THIRD_PARTY_INVITOR) ||
  319. ((CallType == CALLEE) && (pConference->LocalEndpointAttached == NEVER_ATTACHED)))
  320. InvokeUserConferenceCallback(pConference,
  321. CC_CONNECT_INDICATION,
  322. status,
  323. &ConnectCallbackParams);
  324. if (ValidateCallMarkedForDeletion(hCall) == CC_OK)
  325. FreeCall(pCall);
  326. H245ShutDown(H245Instance);
  327. Q931Hangup(hQ931Call, CC_REJECT_UNDEFINED_REASON);
  328. if (ValidateConference(hConference) == CC_OK)
  329. UnlockConference(pConference);
  330. return status;
  331. }
  332. if (pConference->tsMultipointController == TS_TRUE) {
  333. // Send MCLocationIndication
  334. status = GetLastListenAddress(&MCAddress);
  335. if (status == CC_OK) {
  336. ASSERT(MCAddress.nAddrType == CC_IP_BINARY);
  337. Q931Address.type = H245_IP_UNICAST;
  338. Q931Address.u.ip.tsapIdentifier =
  339. MCAddress.Addr.IP_Binary.wPort;
  340. HostToH245IPNetwork(Q931Address.u.ip.network,
  341. MCAddress.Addr.IP_Binary.dwAddr);
  342. H245MCLocationIndication(pCall->H245Instance,
  343. &Q931Address);
  344. }
  345. }
  346. EnumerateCallsInConference(&wNumCalls, &CallList, pConference, ESTABLISHED_CALL);
  347. if (pConference->ConferenceMode == UNCONNECTED_MODE) {
  348. ASSERT(pConference->pSessionTable == NULL);
  349. ASSERT(wNumCalls == 1);
  350. pConference->ConferenceMode = POINT_TO_POINT_MODE;
  351. } else { // we're currently in point-to-point mode or multipoint mode
  352. if (pConference->tsMultipointController == TS_TRUE) {
  353. PreviousConferenceMode = pConference->ConferenceMode;
  354. pConference->ConferenceMode = MULTIPOINT_MODE;
  355. // In the future, we may want to construct a new session table
  356. // each time a new peer is added to the conference
  357. if (PreviousConferenceMode == POINT_TO_POINT_MODE) {
  358. // Assign a terminal label to ourselves
  359. // Note that we reserve a terminal number of 0 for ourselves
  360. // if we're the MC
  361. ASSERT(pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber == 255);
  362. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber = 0;
  363. // Create a new session table
  364. CreateConferenceSessionTable(
  365. pConference,
  366. &bSessionTableChanged);
  367. } else
  368. // For the current implementation, don't cause a new
  369. // CommunicationModeCommand to be issued when a new peer is added
  370. // unless we're switching from point-to-point to multipoint mode
  371. // (in which case bSessionTableChanged is ignored)
  372. bSessionTableChanged = FALSE;
  373. if (bSessionTableChanged)
  374. SessionTableToH245CommunicationTable(pConference->pSessionTable,
  375. &pH245CommunicationTable,
  376. &bCommunicationTableCount);
  377. else
  378. pH245CommunicationTable = NULL;
  379. // Send MultipointModeCommand to new call
  380. pPdu = (PDU_T *)MemAlloc(sizeof(PDU_T));
  381. if(NULL != pPdu)
  382. {
  383. pPdu->choice = MSCMg_cmmnd_chosen;
  384. pPdu->u.MSCMg_cmmnd.choice = miscellaneousCommand_chosen;
  385. // logical channel number is irrelavent but needs to be filled in
  386. pPdu->u.MSCMg_cmmnd.u.miscellaneousCommand.logicalChannelNumber = 1;
  387. pPdu->u.MSCMg_cmmnd.u.miscellaneousCommand.type.choice = multipointModeCommand_chosen;
  388. H245SendPDU(pCall->H245Instance, pPdu);
  389. MemFree(pPdu);
  390. pPdu = NULL;
  391. }
  392. status = AllocatePeerParticipantInfo(pConference, &pCall->pPeerParticipantInfo);
  393. if (status == CC_OK) {
  394. bNewMCUNumber = pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber;
  395. bNewTerminalNumber = pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber;
  396. // Send TerminalNumberAssign to new call
  397. H245ConferenceIndication(pCall->H245Instance,
  398. H245_IND_TERMINAL_NUMBER_ASSIGN,// Indication Type
  399. 0, // SBE number; ignored here
  400. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber, // MCU number
  401. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber); // terminal number
  402. // Send EnterH243TerminalID to new call
  403. H245ConferenceRequest(pCall->H245Instance,
  404. H245_REQ_ENTER_H243_TERMINAL_ID,
  405. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber,
  406. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber);
  407. pCall->pPeerParticipantInfo->TerminalIDState = TERMINAL_ID_REQUESTED;
  408. } else {
  409. // Unable to assign a terminal number to the new call
  410. bNewMCUNumber = 0;
  411. bNewTerminalNumber = 0;
  412. }
  413. if (pH245CommunicationTable != NULL) {
  414. // Send CommunicationModeCommand to new call
  415. status = H245CommunicationModeCommand(pCall->H245Instance,
  416. pH245CommunicationTable,
  417. bCommunicationTableCount);
  418. }
  419. if (PreviousConferenceMode == POINT_TO_POINT_MODE) {
  420. // Generate MULTIPOINT callback
  421. MultipointCallbackParams.pTerminalInfo = &pConference->LocalParticipantInfo.ParticipantInfo;
  422. MultipointCallbackParams.pSessionTable = pConference->pSessionTable;
  423. InvokeUserConferenceCallback(pConference,
  424. CC_MULTIPOINT_INDICATION,
  425. CC_OK,
  426. &MultipointCallbackParams);
  427. if (ValidateConference(hConference) != CC_OK) {
  428. if (ValidateCall(hCall) == CC_OK) {
  429. pCall->CallState = CALL_COMPLETE;
  430. UnlockCall(pCall);
  431. }
  432. MemFree(CallList);
  433. return CC_OK;
  434. }
  435. // Generate CC_PEER_CHANGE_CAP callback
  436. PeerChangeCapCallbackParams.pTermCapList =
  437. pConference->pConferenceTermCapList;
  438. PeerChangeCapCallbackParams.pH2250MuxCapability =
  439. pConference->pConferenceH245H2250MuxCapability;
  440. PeerChangeCapCallbackParams.pTermCapDescriptors =
  441. pConference->pConferenceTermCapDescriptors;
  442. InvokeUserConferenceCallback(pConference,
  443. CC_PEER_CHANGE_CAP_INDICATION,
  444. CC_OK,
  445. &PeerChangeCapCallbackParams);
  446. if (ValidateConference(hConference) != CC_OK) {
  447. if (ValidateCall(hCall) == CC_OK) {
  448. pCall->CallState = CALL_COMPLETE;
  449. UnlockCall(pCall);
  450. }
  451. MemFree(CallList);
  452. return CC_OK;
  453. }
  454. ASSERT(wNumCalls == 2); // one existing call and new call
  455. if (CallList[0] == hCall)
  456. hOldCall = CallList[1];
  457. else
  458. hOldCall = CallList[0];
  459. if (LockCall(hOldCall, &pOldCall) == CC_OK) {
  460. // Send MultipointModeCommand to old call
  461. pPdu = (PDU_T *)MemAlloc(sizeof(PDU_T));
  462. if(NULL != pPdu)
  463. {
  464. pPdu->choice = MSCMg_cmmnd_chosen;
  465. pPdu->u.MSCMg_cmmnd.choice = miscellaneousCommand_chosen;
  466. // logical channel number is irrelavent but needs to be filled in
  467. pPdu->u.MSCMg_cmmnd.u.miscellaneousCommand.logicalChannelNumber = 1;
  468. pPdu->u.MSCMg_cmmnd.u.miscellaneousCommand.type.choice = multipointModeCommand_chosen;
  469. H245SendPDU(pOldCall->H245Instance, pPdu);
  470. MemFree(pPdu);
  471. pPdu = NULL;
  472. }
  473. status = AllocatePeerParticipantInfo(pConference,
  474. &pOldCall->pPeerParticipantInfo);
  475. if (status == CC_OK) {
  476. // Send TerminalNumberAssign to old call
  477. H245ConferenceIndication(pOldCall->H245Instance,
  478. H245_IND_TERMINAL_NUMBER_ASSIGN,// Indication Type
  479. 0, // SBE number; ignored here
  480. pOldCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber, // MCU number
  481. pOldCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber); // terminal number
  482. // Send EnterH243TerminalID to old call
  483. H245ConferenceRequest(pOldCall->H245Instance,
  484. H245_REQ_ENTER_H243_TERMINAL_ID,
  485. pOldCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber,
  486. pOldCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber);
  487. pOldCall->pPeerParticipantInfo->TerminalIDState = TERMINAL_ID_REQUESTED;
  488. }
  489. if (pH245CommunicationTable != NULL) {
  490. // Send CommunicationModeCommand to old call
  491. status = H245CommunicationModeCommand(pOldCall->H245Instance,
  492. pH245CommunicationTable,
  493. bCommunicationTableCount);
  494. FreeH245CommunicationTable(pH245CommunicationTable,
  495. bCommunicationTableCount);
  496. }
  497. // Send TerminalJoinedConference (this call) to old call
  498. H245ConferenceIndication(pOldCall->H245Instance,
  499. H245_IND_TERMINAL_JOINED, // Indication Type
  500. 0, // SBE number; ignored here
  501. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bMCUNumber, // MCU number
  502. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber); // terminal number // terminal number of MC
  503. if (bNewTerminalNumber != 0) {
  504. // Send TerminalJoinedConference (new call) to old call
  505. H245ConferenceIndication(pOldCall->H245Instance,
  506. H245_IND_TERMINAL_JOINED, // Indication Type
  507. 0, // SBE number; ignored here
  508. bNewMCUNumber, // MCU number
  509. bNewTerminalNumber); // terminal number
  510. // Generate PEER_ADD callback for old call
  511. PeerAddCallbackParams.hCall = pOldCall->hCall;
  512. PeerAddCallbackParams.TerminalLabel =
  513. pOldCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  514. PeerAddCallbackParams.pPeerTerminalID = NULL;
  515. InvokeUserConferenceCallback(pConference,
  516. CC_PEER_ADD_INDICATION,
  517. CC_OK,
  518. &PeerAddCallbackParams);
  519. if (ValidateConference(hConference) != CC_OK) {
  520. if (ValidateCall(hOldCall) == CC_OK)
  521. UnlockCall(pCall);
  522. if (ValidateCall(hCall) == CC_OK) {
  523. pCall->CallState = CALL_COMPLETE;
  524. UnlockCall(pCall);
  525. }
  526. MemFree(CallList);
  527. return CC_OK;
  528. }
  529. }
  530. // Send new term caps to old call
  531. SendTermCaps(pOldCall, pConference);
  532. UnlockCall(pOldCall);
  533. }
  534. } else { // we're currently in multipoint mode
  535. EnumerateChannelsInConference(&wNumChannels,
  536. &ChannelList,
  537. pConference,
  538. TX_CHANNEL | PROXY_CHANNEL | TXRX_CHANNEL);
  539. for (i = 0; i < wNumChannels; i++) {
  540. if (LockChannel(ChannelList[i], &pChannel) == CC_OK) {
  541. if (pChannel->bMultipointChannel) {
  542. if ((pChannel->bChannelType == TX_CHANNEL) ||
  543. ((pChannel->bChannelType == TXRX_CHANNEL) &&
  544. (pChannel->bLocallyOpened == TRUE))) {
  545. pTxTermCap = pChannel->pTxH245TermCap;
  546. pTxMuxTable = pChannel->pTxMuxTable;
  547. pRxTermCap = pChannel->pRxH245TermCap;
  548. pRxMuxTable = pChannel->pRxMuxTable;
  549. } else {
  550. // Note: since this is a proxy or remotely-opened
  551. // bi-directional channel, RxTermCap and RxMuxTable
  552. // contain the channel's term cap and mux table,
  553. // and must be sent to other endpoints as the
  554. // Tx term cap and mux table;
  555. // TxTermCap and TxMuxTable should be NULL
  556. pTxTermCap = pChannel->pRxH245TermCap;
  557. pTxMuxTable = pChannel->pRxMuxTable;
  558. pRxTermCap = pChannel->pTxH245TermCap;
  559. pRxMuxTable = pChannel->pTxMuxTable;
  560. }
  561. status = H245OpenChannel(
  562. pCall->H245Instance,
  563. pChannel->hChannel, // dwTransId
  564. pChannel->wLocalChannelNumber,
  565. pTxTermCap, // TxMode
  566. pTxMuxTable, // TxMux
  567. H245_INVALID_PORT_NUMBER, // TxPort
  568. pRxTermCap, // RxMode
  569. pRxMuxTable, // RxMux
  570. pChannel->pSeparateStack);
  571. if ((status == CC_OK) && (pChannel->wNumOutstandingRequests != 0))
  572. (pChannel->wNumOutstandingRequests)++;
  573. }
  574. UnlockChannel(pChannel);
  575. }
  576. }
  577. MemFree(ChannelList);
  578. for (i = 0; i < wNumCalls; i++) {
  579. // Don't send a message to the endpoint that just joined the conference!
  580. if (CallList[i] != hCall) {
  581. if (LockCall(CallList[i], &pOldCall) == CC_OK) {
  582. if (bNewTerminalNumber != 0)
  583. // Send TerminalJoinedConference (new call) to old call
  584. H245ConferenceIndication(pOldCall->H245Instance,
  585. H245_IND_TERMINAL_JOINED, // Indication Type
  586. 0, // SBE number; ignored here
  587. bNewMCUNumber, // MCU number
  588. bNewTerminalNumber); // terminal number
  589. // Send CommunicationModeCommand, if necessary
  590. if (pH245CommunicationTable != NULL)
  591. status = H245CommunicationModeCommand(pOldCall->H245Instance,
  592. pH245CommunicationTable,
  593. bCommunicationTableCount);
  594. if (bConferenceTermCapsChanged)
  595. // Send new term caps
  596. SendTermCaps(pOldCall, pConference);
  597. UnlockCall(pOldCall);
  598. }
  599. }
  600. }
  601. if (bConferenceTermCapsChanged) {
  602. // Generate CC_PEER_CHANGE_CAP callback
  603. PeerChangeCapCallbackParams.pTermCapList =
  604. pConference->pConferenceTermCapList;
  605. PeerChangeCapCallbackParams.pH2250MuxCapability =
  606. pConference->pConferenceH245H2250MuxCapability;
  607. PeerChangeCapCallbackParams.pTermCapDescriptors =
  608. pConference->pConferenceTermCapDescriptors;
  609. InvokeUserConferenceCallback(pConference,
  610. CC_PEER_CHANGE_CAP_INDICATION,
  611. CC_OK,
  612. &PeerChangeCapCallbackParams);
  613. if (ValidateConference(hConference) != CC_OK) {
  614. if (ValidateCall(hCall) == CC_OK) {
  615. pCall->CallState = CALL_COMPLETE;
  616. UnlockCall(pCall);
  617. }
  618. MemFree(CallList);
  619. return CC_OK;
  620. }
  621. }
  622. }
  623. // Generate PEER_ADD callback
  624. PeerAddCallbackParams.hCall = pCall->hCall;
  625. PeerAddCallbackParams.TerminalLabel =
  626. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  627. PeerAddCallbackParams.pPeerTerminalID = NULL;
  628. InvokeUserConferenceCallback(pConference,
  629. CC_PEER_ADD_INDICATION,
  630. CC_OK,
  631. &PeerAddCallbackParams);
  632. if (ValidateConference(hConference) != CC_OK) {
  633. if (ValidateCall(hCall) == CC_OK) {
  634. pCall->CallState = CALL_COMPLETE;
  635. UnlockCall(pCall);
  636. MemFree(CallList);
  637. return CC_OK;
  638. }
  639. }
  640. if (CallType == THIRD_PARTY_INTERMEDIARY) {
  641. DestinationEndpointType.pVendorInfo = pCall->pPeerVendorInfo;
  642. DestinationEndpointType.bIsTerminal = TRUE;
  643. DestinationEndpointType.bIsGateway = FALSE;
  644. status = Q931AcceptCall(pCall->hQ931CallInvitor,
  645. pCall->pszPeerDisplay,
  646. pCall->pPeerNonStandardData,
  647. &DestinationEndpointType,
  648. NULL,
  649. pCall->hCall);
  650. Q931Hangup(pCall->hQ931CallInvitor, CC_REJECT_NORMAL_CALL_CLEARING);
  651. }
  652. } // if (pConference->tsMultipointController == TS_TRUE)
  653. }
  654. MemFree(CallList);
  655. if (ValidateConference(hConference) == CC_OK)
  656. if ((CallType == CALLER) || (CallType == THIRD_PARTY_INVITOR) ||
  657. ((CallType == CALLEE) && (pConference->LocalEndpointAttached == NEVER_ATTACHED))) {
  658. // This CONNECT must apply to the local endpoint
  659. pConference->LocalEndpointAttached = ATTACHED;
  660. InvokeUserConferenceCallback(pConference,
  661. CC_CONNECT_INDICATION,
  662. CC_OK,
  663. &ConnectCallbackParams);
  664. }
  665. // Need to validate the conference and call handles; the associated
  666. // objects may have been deleted during user callback on this thread
  667. if (ValidateConference(hConference) == CC_OK)
  668. UnlockConference(pConference);
  669. if (ValidateCall(hCall) == CC_OK) {
  670. pCall->CallState = CALL_COMPLETE;
  671. UnlockCall(pCall);
  672. }
  673. return status;
  674. }
  675. HRESULT _IndUnimplemented( H245_CONF_IND_T *pH245ConfIndData)
  676. {
  677. return H245_ERROR_NOSUP;
  678. }
  679. HRESULT _IndFlowControl( H245_CONF_IND_T *pH245ConfIndData)
  680. {
  681. HRESULT status;
  682. CC_HCALL hCall;
  683. PCALL pCall;
  684. PCONFERENCE pConference;
  685. CC_HCONFERENCE hConference;
  686. CC_HCHANNEL hChannel;
  687. PCHANNEL pChannel;
  688. CC_FLOW_CONTROL_CALLBACK_PARAMS FlowControlCallbackParams;
  689. if (pH245ConfIndData->u.Indication.u.IndFlowControl.Scope != H245_SCOPE_CHANNEL_NUMBER)
  690. return H245_ERROR_NOSUP;
  691. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  692. status = LockCallAndConference(hCall, &pCall, &pConference);
  693. if (status != CC_OK) {
  694. // This may be OK, if the call was cancelled while
  695. // call setup was in progress.
  696. return H245_ERROR_OK;
  697. }
  698. hConference = pCall->hConference;
  699. UnlockCall(pCall);
  700. if (FindChannelInConference(pH245ConfIndData->u.Indication.u.IndFlowControl.Channel,
  701. TRUE, // local channel number
  702. TX_CHANNEL | PROXY_CHANNEL,
  703. CC_INVALID_HANDLE,
  704. &hChannel,
  705. pConference) != CC_OK) {
  706. UnlockConference(pConference);
  707. return H245_ERROR_OK;
  708. }
  709. if (LockChannel(hChannel, &pChannel) != CC_OK) {
  710. UnlockConference(pConference);
  711. return H245_ERROR_OK;
  712. }
  713. if (pChannel->bChannelType == TX_CHANNEL) {
  714. UnlockChannel(pChannel);
  715. FlowControlCallbackParams.hChannel = hChannel;
  716. FlowControlCallbackParams.dwRate =
  717. pH245ConfIndData->u.Indication.u.IndFlowControl.dwRestriction;
  718. InvokeUserConferenceCallback(pConference,
  719. CC_FLOW_CONTROL_INDICATION,
  720. CC_OK,
  721. &FlowControlCallbackParams);
  722. if (ValidateConference(hConference) == CC_OK)
  723. UnlockConference(pConference);
  724. } else { // pChannel->bChannelType == PROXY_CHANNEL
  725. if (LockCall(pChannel->hCall, &pCall) == CC_OK) {
  726. H245FlowControl(pCall->H245Instance,
  727. pH245ConfIndData->u.Indication.u.IndFlowControl.Scope,
  728. pChannel->wRemoteChannelNumber,
  729. pH245ConfIndData->u.Indication.u.IndFlowControl.wResourceID,
  730. pH245ConfIndData->u.Indication.u.IndFlowControl.dwRestriction);
  731. UnlockCall(pCall);
  732. }
  733. UnlockChannel(pChannel);
  734. UnlockConference(pConference);
  735. }
  736. return H245_ERROR_OK;
  737. }
  738. HRESULT _IndEndSession( H245_CONF_IND_T *pH245ConfIndData)
  739. {
  740. CC_HCALL hCall;
  741. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  742. if (hCall != CC_INVALID_HANDLE)
  743. ProcessRemoteHangup(hCall, CC_INVALID_HANDLE, CC_REJECT_NORMAL_CALL_CLEARING);
  744. return H245_ERROR_OK;
  745. }
  746. HRESULT _IndCapability( H245_CONF_IND_T *pH245ConfIndData)
  747. {
  748. CC_HCALL hCall;
  749. PCALL pCall;
  750. HRESULT status;
  751. PCONFERENCE pConference;
  752. CC_HCONFERENCE hConference;
  753. CC_PEER_CHANGE_CAP_CALLBACK_PARAMS PeerChangeCapCallbackParams;
  754. BOOL bConferenceTermCapsChanged;
  755. WORD wNumCalls;
  756. PCC_HCALL CallList;
  757. PCALL pOldCall;
  758. WORD i;
  759. // We received a TerminalCapabilitySet message from a peer
  760. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  761. status = LockCallAndConference(hCall, &pCall, &pConference);
  762. if (status != CC_OK) {
  763. // This may be OK, if the call was cancelled while
  764. // call setup was in progress.
  765. return H245_ERROR_OK;
  766. }
  767. hConference = pCall->hConference;
  768. if ((pConference->ConferenceMode == MULTIPOINT_MODE) &&
  769. (pConference->tsMultipointController == TS_TRUE))
  770. CreateConferenceTermCaps(pConference, &bConferenceTermCapsChanged);
  771. else
  772. bConferenceTermCapsChanged = FALSE;
  773. pCall->bLinkEstablished = TRUE;
  774. pCall->IncomingTermCapState = TERMCAP_COMPLETE;
  775. if (pCall->CallState == TERMCAP) {
  776. ASSERT(pCall->pPeerH245TermCapList == NULL);
  777. ASSERT(pCall->pPeerH245H2250MuxCapability == NULL);
  778. ASSERT(pCall->pPeerH245TermCapDescriptors == NULL);
  779. } else {
  780. DestroyH245TermCapList(&pCall->pPeerH245TermCapList);
  781. DestroyH245TermCap(&pCall->pPeerH245H2250MuxCapability);
  782. DestroyH245TermCapDescriptors(&pCall->pPeerH245TermCapDescriptors);
  783. }
  784. _ConstructTermCapList(&(pCall->pPeerH245TermCapList),
  785. &(pCall->pPeerH245H2250MuxCapability),
  786. &(pCall->pPeerH245TermCapDescriptors),
  787. pCall);
  788. if ((pCall->OutgoingTermCapState == TERMCAP_COMPLETE) &&
  789. (pCall->IncomingTermCapState == TERMCAP_COMPLETE) &&
  790. (pCall->CallState == TERMCAP) &&
  791. (pCall->MasterSlaveState == MASTER_SLAVE_COMPLETE)) {
  792. // Note that _ProcessConnectionComplete() returns with pConference and pCall unlocked
  793. _ProcessConnectionComplete(pConference, pCall);
  794. return H245_ERROR_OK;
  795. }
  796. if (pCall->CallState == CALL_COMPLETE) {
  797. if ((pConference->ConferenceMode == MULTIPOINT_MODE) &&
  798. (pConference->tsMultipointController == TS_TRUE)) {
  799. CreateConferenceTermCaps(pConference, &bConferenceTermCapsChanged);
  800. if (bConferenceTermCapsChanged) {
  801. EnumerateCallsInConference(&wNumCalls, &CallList, pConference, ESTABLISHED_CALL);
  802. for (i = 0; i < wNumCalls; i++) {
  803. // Don't send a message to the endpoint that just joined the conference!
  804. if (CallList[i] != hCall) {
  805. if (LockCall(CallList[i], &pOldCall) == CC_OK) {
  806. // Send new term caps
  807. SendTermCaps(pOldCall, pConference);
  808. UnlockCall(pOldCall);
  809. }
  810. }
  811. }
  812. if (CallList != NULL)
  813. MemFree(CallList);
  814. // Generate CC_PEER_CHANGE_CAP callback
  815. PeerChangeCapCallbackParams.pTermCapList =
  816. pConference->pConferenceTermCapList;
  817. PeerChangeCapCallbackParams.pH2250MuxCapability =
  818. pConference->pConferenceH245H2250MuxCapability;
  819. PeerChangeCapCallbackParams.pTermCapDescriptors =
  820. pConference->pConferenceTermCapDescriptors;
  821. InvokeUserConferenceCallback(pConference,
  822. CC_PEER_CHANGE_CAP_INDICATION,
  823. CC_OK,
  824. &PeerChangeCapCallbackParams);
  825. }
  826. } else {
  827. PeerChangeCapCallbackParams.pTermCapList = pCall->pPeerH245TermCapList;
  828. PeerChangeCapCallbackParams.pH2250MuxCapability = pCall->pPeerH245H2250MuxCapability;
  829. PeerChangeCapCallbackParams.pTermCapDescriptors = pCall->pPeerH245TermCapDescriptors;
  830. InvokeUserConferenceCallback(pConference,
  831. CC_PEER_CHANGE_CAP_INDICATION,
  832. CC_OK,
  833. &PeerChangeCapCallbackParams);
  834. }
  835. if (ValidateConference(hConference) == CC_OK)
  836. UnlockConference(pConference);
  837. if (ValidateCall(hCall) == CC_OK)
  838. UnlockCall(pCall);
  839. return H245_ERROR_OK;
  840. }
  841. UnlockCall(pCall);
  842. UnlockConference(pConference);
  843. return H245_ERROR_OK;
  844. }
  845. HRESULT _IndOpenT120( H245_CONF_IND_T *pH245ConfIndData)
  846. {
  847. BOOL bFailed;
  848. CC_T120_CHANNEL_REQUEST_CALLBACK_PARAMS T120ChannelRequestCallbackParams;
  849. CC_HCALL hCall;
  850. PCALL pCall;
  851. CC_HCONFERENCE hConference;
  852. PCONFERENCE pConference;
  853. CC_HCHANNEL hChannel;
  854. PCHANNEL pChannel;
  855. CC_TERMCAP *pRxTermCap = NULL; // Too big to be local variable (9K)
  856. CC_TERMCAP *pTxTermCap = NULL; // Too big to be local variable (9K)
  857. H245_MUX_T RxH245MuxTable;
  858. H245_MUX_T TxH245MuxTable;
  859. CC_ADDR T120Addr;
  860. CC_OCTETSTRING ExternalReference;
  861. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  862. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK) {
  863. // Can't cancel with H245, because we don't have the H245 instance
  864. return H245_ERROR_OK;
  865. }
  866. hConference = pCall->hConference;
  867. if (pH245ConfIndData->u.Indication.u.IndOpen.RxDataType != H245_DATA_DATA ||
  868. pH245ConfIndData->u.Indication.u.IndOpen.RxClientType != H245_CLIENT_DAT_T120 ||
  869. pH245ConfIndData->u.Indication.u.IndOpen.pRxCap == NULL ||
  870. pH245ConfIndData->u.Indication.u.IndOpen.pRxCap->H245Dat_T120.application.choice != DACy_applctn_t120_chosen ||
  871. pH245ConfIndData->u.Indication.u.IndOpen.pRxCap->H245Dat_T120.application.u.DACy_applctn_t120.choice != separateLANStack_chosen ||
  872. pH245ConfIndData->u.Indication.u.IndOpen.TxDataType != H245_DATA_DATA ||
  873. pH245ConfIndData->u.Indication.u.IndOpen.TxClientType != H245_CLIENT_DAT_T120 ||
  874. pH245ConfIndData->u.Indication.u.IndOpen.pTxCap == NULL ||
  875. pH245ConfIndData->u.Indication.u.IndOpen.pTxCap->H245Dat_T120.application.choice != DACy_applctn_t120_chosen ||
  876. pH245ConfIndData->u.Indication.u.IndOpen.pTxCap->H245Dat_T120.application.u.DACy_applctn_t120.choice != separateLANStack_chosen) {
  877. bFailed = TRUE;
  878. } else {
  879. bFailed = FALSE;
  880. }
  881. if (pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack) {
  882. if ((pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack->networkAddress.choice == localAreaAddress_chosen) &&
  883. (pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack->networkAddress.u.localAreaAddress.choice == unicastAddress_chosen) &&
  884. (pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack->networkAddress.u.localAreaAddress.u.unicastAddress.choice == UnicastAddress_iPAddress_chosen)) {
  885. T120Addr.nAddrType = CC_IP_BINARY;
  886. T120Addr.bMulticast = FALSE;
  887. T120Addr.Addr.IP_Binary.wPort =
  888. pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack->networkAddress.u.localAreaAddress.u.unicastAddress.u.UnicastAddress_iPAddress.tsapIdentifier;
  889. H245IPNetworkToHost(&T120Addr.Addr.IP_Binary.dwAddr,
  890. pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack->networkAddress.u.localAreaAddress.u.unicastAddress.u.UnicastAddress_iPAddress.network.value);
  891. } else {
  892. bFailed = TRUE;
  893. }
  894. }
  895. if (bFailed) {
  896. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  897. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  898. H245_REJ); // rejection reason
  899. UnlockConference(pConference);
  900. UnlockCall(pCall);
  901. return H245_ERROR_OK;
  902. }
  903. // These will be freed immediatly after their use (AllocAndLockChannel)
  904. pRxTermCap = (CC_TERMCAP *)MemAlloc(sizeof(CC_TERMCAP));
  905. pTxTermCap = (CC_TERMCAP *)MemAlloc(sizeof(CC_TERMCAP));
  906. if((NULL == pRxTermCap) || (NULL == pTxTermCap))
  907. {
  908. MemFree(pRxTermCap);
  909. MemFree(pTxTermCap);
  910. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  911. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  912. H245_REJ); // rejection reason
  913. UnlockConference(pConference);
  914. UnlockCall(pCall);
  915. return H245_ERROR_NOMEM;
  916. }
  917. pRxTermCap->Dir = H245_CAPDIR_RMTTX;
  918. pRxTermCap->DataType = pH245ConfIndData->u.Indication.u.IndOpen.RxDataType;
  919. pRxTermCap->ClientType = pH245ConfIndData->u.Indication.u.IndOpen.RxClientType;
  920. pRxTermCap->CapId = 0; // not used for channels
  921. pRxTermCap->Cap = *pH245ConfIndData->u.Indication.u.IndOpen.pRxCap;
  922. pTxTermCap->Dir = H245_CAPDIR_RMTTX;
  923. pTxTermCap->DataType = pH245ConfIndData->u.Indication.u.IndOpen.TxDataType;
  924. pTxTermCap->ClientType = pH245ConfIndData->u.Indication.u.IndOpen.TxClientType;
  925. pTxTermCap->CapId = 0; // not used for channels
  926. pTxTermCap->Cap = *pH245ConfIndData->u.Indication.u.IndOpen.pTxCap;
  927. RxH245MuxTable = *pH245ConfIndData->u.Indication.u.IndOpen.pRxMux;
  928. if ((pCall->pPeerParticipantInfo != NULL) &&
  929. (pCall->pPeerParticipantInfo->TerminalIDState == TERMINAL_ID_VALID)) {
  930. RxH245MuxTable.u.H2250.destinationPresent = TRUE;
  931. RxH245MuxTable.u.H2250.destination.mcuNumber = pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber;
  932. RxH245MuxTable.u.H2250.destination.terminalNumber = pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber;
  933. } else
  934. RxH245MuxTable.u.H2250.destinationPresent = FALSE;
  935. if(pH245ConfIndData->u.Indication.u.IndOpen.pTxMux)
  936. {
  937. TxH245MuxTable = *pH245ConfIndData->u.Indication.u.IndOpen.pTxMux;
  938. TxH245MuxTable.u.H2250.destinationPresent = FALSE;
  939. }
  940. bFailed = (AllocAndLockChannel(&hChannel,
  941. pConference,
  942. hCall,
  943. pTxTermCap, // Tx terminal capability
  944. pRxTermCap, // Rx terminal capability
  945. (pH245ConfIndData->u.Indication.u.IndOpen.pTxMux)?
  946. &TxH245MuxTable: NULL, // Tx H245 mux table
  947. &RxH245MuxTable, // Rx H245 mux table
  948. pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack, // separate stack
  949. 0, // user token
  950. TXRX_CHANNEL, // channel type
  951. 0, // session ID
  952. 0, // associated session ID
  953. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel, // remote bi-dir channel number
  954. NULL, // pLocalRTPAddr
  955. NULL, // pLocalRTCPAddr
  956. NULL, // pPeerRTPAddr
  957. NULL, // pPeerRTCPAddr
  958. FALSE, // locally opened
  959. &pChannel) != CC_OK);
  960. MemFree(pRxTermCap);
  961. pRxTermCap = NULL;
  962. MemFree(pTxTermCap);
  963. pTxTermCap = NULL;
  964. if(bFailed)
  965. {
  966. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  967. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  968. H245_REJ); // rejection reason
  969. UnlockConference(pConference);
  970. UnlockCall(pCall);
  971. return H245_ERROR_OK;
  972. }
  973. if (AddChannelToConference(pChannel, pConference) != CC_OK) {
  974. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  975. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  976. H245_REJ); // rejection reason
  977. UnlockConference(pConference);
  978. UnlockCall(pCall);
  979. FreeChannel(pChannel);
  980. return H245_ERROR_OK;
  981. }
  982. T120ChannelRequestCallbackParams.hChannel = hChannel;
  983. if (pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack == NULL) {
  984. T120ChannelRequestCallbackParams.bAssociateConference = FALSE;
  985. T120ChannelRequestCallbackParams.pExternalReference = NULL;
  986. T120ChannelRequestCallbackParams.pAddr = NULL;
  987. } else {
  988. T120ChannelRequestCallbackParams.bAssociateConference =
  989. pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack->associateConference;
  990. if (pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack->bit_mask & externalReference_present) {
  991. ExternalReference.wOctetStringLength = (WORD)
  992. pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack->externalReference.length;
  993. ExternalReference.pOctetString =
  994. pH245ConfIndData->u.Indication.u.IndOpen.pSeparateStack->externalReference.value;
  995. T120ChannelRequestCallbackParams.pExternalReference = &ExternalReference;
  996. } else
  997. T120ChannelRequestCallbackParams.pExternalReference = NULL;
  998. T120ChannelRequestCallbackParams.pAddr = &T120Addr;
  999. }
  1000. if ((pConference->ConferenceMode == MULTIPOINT_MODE) &&
  1001. (pConference->tsMultipointController == TS_TRUE))
  1002. T120ChannelRequestCallbackParams.bMultipointController = TRUE;
  1003. else
  1004. T120ChannelRequestCallbackParams.bMultipointController = FALSE;
  1005. if (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.destinationPresent) {
  1006. T120ChannelRequestCallbackParams.TerminalLabel.bMCUNumber =
  1007. (BYTE)pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.destination.mcuNumber;
  1008. T120ChannelRequestCallbackParams.TerminalLabel.bTerminalNumber =
  1009. (BYTE)pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.destination.terminalNumber;
  1010. } else {
  1011. T120ChannelRequestCallbackParams.TerminalLabel.bMCUNumber = 255;
  1012. T120ChannelRequestCallbackParams.TerminalLabel.bTerminalNumber = 255;
  1013. }
  1014. pChannel->wNumOutstandingRequests = 1;
  1015. InvokeUserConferenceCallback(pConference,
  1016. CC_T120_CHANNEL_REQUEST_INDICATION,
  1017. CC_OK,
  1018. &T120ChannelRequestCallbackParams);
  1019. if (ValidateChannel(hChannel) == CC_OK)
  1020. UnlockChannel(pChannel);
  1021. if (ValidateCall(hCall) == CC_OK)
  1022. UnlockCall(pCall);
  1023. if (ValidateConference(hConference) == CC_OK)
  1024. UnlockConference(pConference);
  1025. return H245_ERROR_OK;
  1026. }
  1027. HRESULT _IndOpen( H245_CONF_IND_T *pH245ConfIndData)
  1028. {
  1029. CC_HCALL hCall;
  1030. PCALL pCall;
  1031. PCALL pOldCall;
  1032. CC_HCONFERENCE hConference;
  1033. PCONFERENCE pConference;
  1034. WORD wNumCalls;
  1035. PCC_HCALL CallList;
  1036. CC_HCHANNEL hChannel;
  1037. PCHANNEL pChannel;
  1038. CC_TERMCAP TermCap;
  1039. CC_ADDR PeerRTPAddr;
  1040. CC_ADDR PeerRTCPAddr;
  1041. CC_RX_CHANNEL_REQUEST_CALLBACK_PARAMS RxChannelRequestCallbackParams;
  1042. BYTE bChannelType;
  1043. WORD i;
  1044. H245_MUX_T H245MuxTable;
  1045. PCC_ADDR pLocalRTPAddr;
  1046. PCC_ADDR pLocalRTCPAddr;
  1047. PCC_ADDR pPeerRTPAddr;
  1048. PCC_ADDR pPeerRTCPAddr;
  1049. BOOL bFoundSession;
  1050. HRESULT status;
  1051. // First check to see if this is a T.120 channel request,
  1052. // as T.120 channels are handled differently then other channels
  1053. if (pH245ConfIndData->u.Indication.u.IndOpen.RxClientType == H245_CLIENT_DAT_T120) {
  1054. status = _IndOpenT120(pH245ConfIndData);
  1055. return status;
  1056. }
  1057. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  1058. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK) {
  1059. // Can't cancel with H245, because we don't have the H245 instance
  1060. return H245_ERROR_OK;
  1061. }
  1062. // Make sure that this is not a bi-directional channel
  1063. if (pH245ConfIndData->u.Indication.u.IndOpen.pTxMux != NULL) {
  1064. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  1065. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  1066. H245_REJ); // rejection reason
  1067. UnlockConference(pConference);
  1068. UnlockCall(pCall);
  1069. return H245_ERROR_OK;
  1070. }
  1071. hConference = pCall->hConference;
  1072. TermCap.Dir = H245_CAPDIR_RMTTX;
  1073. TermCap.DataType = pH245ConfIndData->u.Indication.u.IndOpen.RxDataType;
  1074. TermCap.ClientType = pH245ConfIndData->u.Indication.u.IndOpen.RxClientType;
  1075. TermCap.CapId = 0; // not used for Rx channels
  1076. TermCap.Cap = *pH245ConfIndData->u.Indication.u.IndOpen.pRxCap;
  1077. RxChannelRequestCallbackParams.pChannelCapability = &TermCap;
  1078. if ((pH245ConfIndData->u.Indication.u.IndOpen.pRxMux != NULL) &&
  1079. (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->Kind == H245_H2250)) {
  1080. RxChannelRequestCallbackParams.bSessionID =
  1081. pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.sessionID;
  1082. if (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.associatedSessionIDPresent)
  1083. RxChannelRequestCallbackParams.bAssociatedSessionID =
  1084. pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.associatedSessionID;
  1085. else
  1086. RxChannelRequestCallbackParams.bAssociatedSessionID = 0;
  1087. if (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.silenceSuppressionPresent)
  1088. RxChannelRequestCallbackParams.bSilenceSuppression =
  1089. pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.silenceSuppression;
  1090. else
  1091. RxChannelRequestCallbackParams.bSilenceSuppression = FALSE;
  1092. if ((pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaChannelPresent) &&
  1093. ((pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaChannel.type == H245_IP_MULTICAST) ||
  1094. (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaChannel.type == H245_IP_UNICAST))) {
  1095. RxChannelRequestCallbackParams.pPeerRTPAddr = &PeerRTPAddr;
  1096. PeerRTPAddr.nAddrType = CC_IP_BINARY;
  1097. if (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaChannel.type == H245_IP_MULTICAST)
  1098. PeerRTPAddr.bMulticast = TRUE;
  1099. else
  1100. PeerRTPAddr.bMulticast = FALSE;
  1101. PeerRTPAddr.Addr.IP_Binary.wPort =
  1102. pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaChannel.u.ip.tsapIdentifier;
  1103. H245IPNetworkToHost(&PeerRTPAddr.Addr.IP_Binary.dwAddr,
  1104. pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaChannel.u.ip.network);
  1105. } else
  1106. RxChannelRequestCallbackParams.pPeerRTPAddr = NULL;
  1107. if ((pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaControlChannelPresent) &&
  1108. ((pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaControlChannel.type == H245_IP_MULTICAST) ||
  1109. (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaControlChannel.type == H245_IP_UNICAST))) {
  1110. RxChannelRequestCallbackParams.pPeerRTCPAddr = &PeerRTCPAddr;
  1111. PeerRTCPAddr.nAddrType = CC_IP_BINARY;
  1112. if (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaControlChannel.type == H245_IP_MULTICAST)
  1113. PeerRTCPAddr.bMulticast = TRUE;
  1114. else
  1115. PeerRTCPAddr.bMulticast = FALSE;
  1116. PeerRTCPAddr.Addr.IP_Binary.wPort =
  1117. pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaControlChannel.u.ip.tsapIdentifier;
  1118. H245IPNetworkToHost(&PeerRTCPAddr.Addr.IP_Binary.dwAddr,
  1119. pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.mediaControlChannel.u.ip.network);
  1120. } else
  1121. RxChannelRequestCallbackParams.pPeerRTCPAddr = NULL;
  1122. if (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.destinationPresent) {
  1123. RxChannelRequestCallbackParams.TerminalLabel.bMCUNumber =
  1124. (BYTE)pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.destination.mcuNumber;
  1125. RxChannelRequestCallbackParams.TerminalLabel.bTerminalNumber =
  1126. (BYTE)pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.destination.terminalNumber;
  1127. } else {
  1128. RxChannelRequestCallbackParams.TerminalLabel.bMCUNumber = 255;
  1129. RxChannelRequestCallbackParams.TerminalLabel.bTerminalNumber = 255;
  1130. }
  1131. if (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.dynamicRTPPayloadTypePresent)
  1132. RxChannelRequestCallbackParams.bRTPPayloadType =
  1133. pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.dynamicRTPPayloadType;
  1134. else
  1135. RxChannelRequestCallbackParams.bRTPPayloadType = 0;
  1136. } else {
  1137. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  1138. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  1139. H245_REJ); // rejection reason
  1140. UnlockConference(pConference);
  1141. UnlockCall(pCall);
  1142. return H245_ERROR_OK;
  1143. }
  1144. // XXX -- someday we should allow dynamic sessions to be created on the MC
  1145. if (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.sessionID == 0) {
  1146. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  1147. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  1148. H245_REJ); // rejection reason
  1149. UnlockConference(pConference);
  1150. UnlockCall(pCall);
  1151. return H245_ERROR_OK;
  1152. }
  1153. if (pConference->ConferenceMode == MULTIPOINT_MODE) {
  1154. if ((pConference->tsMultipointController == TS_TRUE) &&
  1155. ((RxChannelRequestCallbackParams.pPeerRTPAddr != NULL) ||
  1156. (RxChannelRequestCallbackParams.pPeerRTCPAddr != NULL)) ||
  1157. ((pConference->tsMultipointController == TS_FALSE) &&
  1158. ((RxChannelRequestCallbackParams.pPeerRTPAddr == NULL) ||
  1159. (RxChannelRequestCallbackParams.pPeerRTCPAddr == NULL) ||
  1160. (RxChannelRequestCallbackParams.bSessionID == 0)))) {
  1161. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  1162. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  1163. H245_REJ); // rejection reason
  1164. UnlockConference(pConference);
  1165. UnlockCall(pCall);
  1166. return H245_ERROR_OK;
  1167. }
  1168. // Validate session ID
  1169. pLocalRTPAddr = NULL;
  1170. pLocalRTCPAddr = NULL;
  1171. bFoundSession = FALSE;
  1172. if (pConference->pSessionTable != NULL) {
  1173. for (i = 0; i < pConference->pSessionTable->wLength; i++) {
  1174. if (pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.sessionID ==
  1175. pConference->pSessionTable->SessionInfoArray[i].bSessionID) {
  1176. bFoundSession = TRUE;
  1177. pLocalRTPAddr = pConference->pSessionTable->SessionInfoArray[i].pRTPAddr;
  1178. pLocalRTCPAddr = pConference->pSessionTable->SessionInfoArray[i].pRTCPAddr;
  1179. break;
  1180. }
  1181. }
  1182. }
  1183. if (bFoundSession == FALSE) {
  1184. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  1185. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  1186. H245_REJ); // rejection reason
  1187. UnlockConference(pConference);
  1188. UnlockCall(pCall);
  1189. return H245_ERROR_OK;
  1190. }
  1191. ASSERT(pLocalRTPAddr != NULL);
  1192. ASSERT(pLocalRTCPAddr != NULL);
  1193. if (pConference->tsMultipointController == TS_TRUE) {
  1194. pPeerRTPAddr = pLocalRTPAddr;
  1195. pPeerRTCPAddr = pLocalRTCPAddr;
  1196. RxChannelRequestCallbackParams.pPeerRTPAddr = pLocalRTPAddr;
  1197. RxChannelRequestCallbackParams.pPeerRTCPAddr = pLocalRTCPAddr;
  1198. bChannelType = PROXY_CHANNEL;
  1199. } else { // multipoint mode, not MC
  1200. pLocalRTPAddr = RxChannelRequestCallbackParams.pPeerRTPAddr;
  1201. pLocalRTCPAddr = RxChannelRequestCallbackParams.pPeerRTCPAddr;
  1202. pPeerRTPAddr = RxChannelRequestCallbackParams.pPeerRTPAddr;
  1203. pPeerRTCPAddr = RxChannelRequestCallbackParams.pPeerRTCPAddr;
  1204. bChannelType = RX_CHANNEL;
  1205. }
  1206. } else { // not multipoint mode
  1207. pLocalRTPAddr = NULL;
  1208. pLocalRTCPAddr = NULL;
  1209. pPeerRTPAddr = RxChannelRequestCallbackParams.pPeerRTPAddr;
  1210. pPeerRTCPAddr = RxChannelRequestCallbackParams.pPeerRTCPAddr;
  1211. bChannelType = RX_CHANNEL;
  1212. }
  1213. H245MuxTable = *pH245ConfIndData->u.Indication.u.IndOpen.pRxMux;
  1214. if ((pCall->pPeerParticipantInfo != NULL) &&
  1215. (pCall->pPeerParticipantInfo->TerminalIDState == TERMINAL_ID_VALID)) {
  1216. H245MuxTable.u.H2250.destinationPresent = TRUE;
  1217. H245MuxTable.u.H2250.destination.mcuNumber = pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber;
  1218. H245MuxTable.u.H2250.destination.terminalNumber = pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber;
  1219. } else
  1220. H245MuxTable.u.H2250.destinationPresent = FALSE;
  1221. if (pLocalRTPAddr != NULL) {
  1222. if (pLocalRTPAddr->bMulticast)
  1223. H245MuxTable.u.H2250.mediaChannel.type = H245_IP_MULTICAST;
  1224. else
  1225. H245MuxTable.u.H2250.mediaChannel.type = H245_IP_UNICAST;
  1226. H245MuxTable.u.H2250.mediaChannel.u.ip.tsapIdentifier =
  1227. pLocalRTPAddr->Addr.IP_Binary.wPort;
  1228. HostToH245IPNetwork(H245MuxTable.u.H2250.mediaChannel.u.ip.network,
  1229. pLocalRTPAddr->Addr.IP_Binary.dwAddr);
  1230. H245MuxTable.u.H2250.mediaChannelPresent = TRUE;
  1231. } else
  1232. H245MuxTable.u.H2250.mediaChannelPresent = FALSE;
  1233. if (pLocalRTCPAddr != NULL) {
  1234. if (pLocalRTCPAddr->bMulticast)
  1235. H245MuxTable.u.H2250.mediaControlChannel.type = H245_IP_MULTICAST;
  1236. else
  1237. H245MuxTable.u.H2250.mediaControlChannel.type = H245_IP_UNICAST;
  1238. H245MuxTable.u.H2250.mediaControlChannel.u.ip.tsapIdentifier =
  1239. pLocalRTCPAddr->Addr.IP_Binary.wPort;
  1240. HostToH245IPNetwork(H245MuxTable.u.H2250.mediaControlChannel.u.ip.network,
  1241. pLocalRTCPAddr->Addr.IP_Binary.dwAddr);
  1242. H245MuxTable.u.H2250.mediaControlChannelPresent = TRUE;
  1243. } else
  1244. H245MuxTable.u.H2250.mediaControlChannelPresent = FALSE;
  1245. if (AllocAndLockChannel(&hChannel,
  1246. pConference,
  1247. hCall,
  1248. NULL, // Tx terminal capability
  1249. &TermCap, // Rx terminal capability
  1250. NULL, // Tx H245 mux table
  1251. &H245MuxTable, // Rx H245 mux table
  1252. NULL, // separate stack
  1253. 0, // user token
  1254. bChannelType,
  1255. pH245ConfIndData->u.Indication.u.IndOpen.pRxMux->u.H2250.sessionID,
  1256. RxChannelRequestCallbackParams.bAssociatedSessionID,
  1257. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  1258. pLocalRTPAddr, // pLocalRTPAddr
  1259. pLocalRTCPAddr, // pLocalRTCPAddr
  1260. pPeerRTPAddr, // pPeerRTPAddr
  1261. pPeerRTCPAddr, // pPeerRTCPAddr
  1262. FALSE, // locally opened
  1263. &pChannel) != CC_OK) {
  1264. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  1265. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  1266. H245_REJ); // rejection reason
  1267. UnlockConference(pConference);
  1268. UnlockCall(pCall);
  1269. return H245_ERROR_OK;
  1270. }
  1271. if (AddChannelToConference(pChannel, pConference) != CC_OK) {
  1272. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  1273. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  1274. H245_REJ); // rejection reason
  1275. UnlockConference(pConference);
  1276. UnlockCall(pCall);
  1277. FreeChannel(pChannel);
  1278. return H245_ERROR_OK;
  1279. }
  1280. RxChannelRequestCallbackParams.hChannel = hChannel;
  1281. if ((pConference->ConferenceMode == MULTIPOINT_MODE) &&
  1282. (pConference->tsMultipointController == TS_TRUE)) {
  1283. // Open this channel to each peer in the conference (except the peer
  1284. // that requested this channel)
  1285. EnumerateCallsInConference(&wNumCalls, &CallList, pConference, ESTABLISHED_CALL);
  1286. for (i = 0; i < wNumCalls; i++) {
  1287. if (CallList[i] != hCall) {
  1288. if (LockCall(CallList[i], &pOldCall) == CC_OK) {
  1289. ASSERT(pChannel->bChannelType == PROXY_CHANNEL);
  1290. // Note: since this is a proxy channel, RxTermCap and RxMuxTable
  1291. // contain the channel's term cap and mux table, and must be sent
  1292. // to other endpoints as the Tx term cap and mux table;
  1293. // TxTermCap and TxMuxTable should be NULL
  1294. if (H245OpenChannel(pOldCall->H245Instance,
  1295. pChannel->hChannel, // dwTransId
  1296. pChannel->wLocalChannelNumber,
  1297. pChannel->pRxH245TermCap, // TxMode
  1298. pChannel->pRxMuxTable, // TxMux
  1299. H245_INVALID_PORT_NUMBER, // TxPort
  1300. pChannel->pTxH245TermCap, // RxMode
  1301. pChannel->pTxMuxTable, // RxMux
  1302. pChannel->pSeparateStack) == CC_OK)
  1303. (pChannel->wNumOutstandingRequests)++;
  1304. UnlockCall(pOldCall);
  1305. }
  1306. }
  1307. }
  1308. MemFree(CallList);
  1309. if (pConference->LocalEndpointAttached == ATTACHED)
  1310. (pChannel->wNumOutstandingRequests)++;
  1311. if (pChannel->wNumOutstandingRequests == 0) {
  1312. H245OpenChannelReject(pCall->H245Instance, // H245 instance
  1313. pH245ConfIndData->u.Indication.u.IndOpen.RxChannel,
  1314. H245_REJ); // rejection reason
  1315. UnlockConference(pConference);
  1316. UnlockCall(pCall);
  1317. FreeChannel(pChannel);
  1318. return H245_ERROR_OK;
  1319. }
  1320. } else
  1321. pChannel->wNumOutstandingRequests = 1;
  1322. InvokeUserConferenceCallback(pConference,
  1323. CC_RX_CHANNEL_REQUEST_INDICATION,
  1324. CC_OK,
  1325. &RxChannelRequestCallbackParams);
  1326. if (ValidateChannel(hChannel) == CC_OK)
  1327. UnlockChannel(pChannel);
  1328. if (ValidateCall(hCall) == CC_OK)
  1329. UnlockCall(pCall);
  1330. if (ValidateConference(hConference) == CC_OK)
  1331. UnlockConference(pConference);
  1332. return H245_ERROR_OK;
  1333. }
  1334. HRESULT _IndOpenConf( H245_CONF_IND_T *pH245ConfIndData)
  1335. {
  1336. CC_HCALL hCall;
  1337. PCALL pCall;
  1338. CC_HCONFERENCE hConference;
  1339. PCONFERENCE pConference;
  1340. CC_HCHANNEL hChannel;
  1341. CC_ACCEPT_CHANNEL_CALLBACK_PARAMS AcceptChannelCallbackParams;
  1342. // Bi-directional channel open initiated by remote peer is now complete.
  1343. // Local peer may now send data over this channel.
  1344. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  1345. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  1346. return H245_ERROR_OK;
  1347. hConference = pConference->hConference;
  1348. UnlockCall(pCall);
  1349. if (FindChannelInConference(pH245ConfIndData->u.Indication.u.IndOpenConf.TxChannel,
  1350. FALSE, // remote channel number
  1351. TXRX_CHANNEL,
  1352. hCall,
  1353. &hChannel,
  1354. pConference) != CC_OK) {
  1355. UnlockConference(pConference);
  1356. return H245_ERROR_OK;
  1357. }
  1358. AcceptChannelCallbackParams.hChannel = hChannel;
  1359. InvokeUserConferenceCallback(pConference,
  1360. CC_ACCEPT_CHANNEL_INDICATION,
  1361. CC_OK,
  1362. &AcceptChannelCallbackParams);
  1363. if (ValidateConference(hConference) == CC_OK)
  1364. UnlockConference(pConference);
  1365. return H245_ERROR_OK;
  1366. }
  1367. HRESULT _IndMstslv( H245_CONF_IND_T *pH245ConfIndData)
  1368. {
  1369. CC_HCALL hCall;
  1370. PCALL pCall;
  1371. PCONFERENCE pConference;
  1372. CC_CONNECT_CALLBACK_PARAMS ConnectCallbackParams;
  1373. CC_HCALL hEnqueuedCall;
  1374. PCALL pEnqueuedCall;
  1375. CC_HCONFERENCE hConference;
  1376. HRESULT status;
  1377. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  1378. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK) {
  1379. // Can't cancel with H245, because we don't have the H245 instance
  1380. return H245_ERROR_OK;
  1381. }
  1382. ASSERT(pCall->MasterSlaveState != MASTER_SLAVE_COMPLETE);
  1383. switch (pH245ConfIndData->u.Indication.u.IndMstSlv) {
  1384. case H245_MASTER:
  1385. pConference->tsMaster = TS_TRUE;
  1386. if (pConference->tsMultipointController == TS_UNKNOWN) {
  1387. ASSERT(pConference->bMultipointCapable == TRUE);
  1388. pConference->tsMultipointController = TS_TRUE;
  1389. // place all calls enqueued on this conference object
  1390. for ( ; ; ) {
  1391. // Start up all enqueued calls, if any exist
  1392. status = RemoveEnqueuedCallFromConference(pConference, &hEnqueuedCall);
  1393. if ((status != CC_OK) || (hEnqueuedCall == CC_INVALID_HANDLE))
  1394. break;
  1395. status = LockCall(hEnqueuedCall, &pEnqueuedCall);
  1396. if (status == CC_OK) {
  1397. pEnqueuedCall->CallState = PLACED;
  1398. status = PlaceCall(pEnqueuedCall, pConference);
  1399. UnlockCall(pEnqueuedCall);
  1400. }
  1401. }
  1402. }
  1403. break;
  1404. case H245_SLAVE:
  1405. ASSERT(pConference->tsMaster != TS_TRUE);
  1406. ASSERT(pConference->tsMultipointController != TS_TRUE);
  1407. pConference->tsMaster = TS_FALSE;
  1408. pConference->tsMultipointController = TS_FALSE;
  1409. // XXX -- we may eventually want to re-enqueue these requests
  1410. // and set an expiration timer
  1411. hConference = pConference->hConference;
  1412. for ( ; ; ) {
  1413. status = RemoveEnqueuedCallFromConference(pConference, &hEnqueuedCall);
  1414. if ((status != CC_OK) || (hEnqueuedCall == CC_INVALID_HANDLE))
  1415. break;
  1416. status = LockCall(hEnqueuedCall, &pEnqueuedCall);
  1417. if (status == CC_OK) {
  1418. MarkCallForDeletion(pEnqueuedCall);
  1419. ConnectCallbackParams.pNonStandardData = pEnqueuedCall->pPeerNonStandardData;
  1420. ConnectCallbackParams.pszPeerDisplay = pEnqueuedCall->pszPeerDisplay;
  1421. ConnectCallbackParams.bRejectReason = CC_REJECT_UNDEFINED_REASON;
  1422. ConnectCallbackParams.pTermCapList = pEnqueuedCall->pPeerH245TermCapList;
  1423. ConnectCallbackParams.pH2250MuxCapability = pEnqueuedCall->pPeerH245H2250MuxCapability;
  1424. ConnectCallbackParams.pTermCapDescriptors = pEnqueuedCall->pPeerH245TermCapDescriptors;
  1425. ConnectCallbackParams.pLocalAddr = pEnqueuedCall->pQ931LocalConnectAddr;
  1426. if (pEnqueuedCall->pQ931DestinationAddr == NULL)
  1427. ConnectCallbackParams.pPeerAddr = pEnqueuedCall->pQ931PeerConnectAddr;
  1428. else
  1429. ConnectCallbackParams.pPeerAddr = pEnqueuedCall->pQ931DestinationAddr;
  1430. ConnectCallbackParams.pVendorInfo = pEnqueuedCall->pPeerVendorInfo;
  1431. ConnectCallbackParams.bMultipointConference = TRUE;
  1432. ConnectCallbackParams.pConferenceID = &pConference->ConferenceID;
  1433. ConnectCallbackParams.pMCAddress = pConference->pMultipointControllerAddr;
  1434. ConnectCallbackParams.pAlternateAddress = NULL;
  1435. ConnectCallbackParams.dwUserToken = pEnqueuedCall->dwUserToken;
  1436. InvokeUserConferenceCallback(pConference,
  1437. CC_CONNECT_INDICATION,
  1438. CC_NOT_MULTIPOINT_CAPABLE,
  1439. &ConnectCallbackParams);
  1440. if (ValidateCallMarkedForDeletion(hEnqueuedCall) == CC_OK)
  1441. FreeCall(pEnqueuedCall);
  1442. if (ValidateConference(hConference) != CC_OK) {
  1443. if (ValidateCall(hCall) == CC_OK)
  1444. UnlockCall(pCall);
  1445. return H245_ERROR_OK;
  1446. }
  1447. }
  1448. }
  1449. break;
  1450. default: // H245_INDETERMINATE
  1451. UnlockConference(pConference);
  1452. if (++pCall->wMasterSlaveRetry < MASTER_SLAVE_RETRY_MAX) {
  1453. H245InitMasterSlave(pCall->H245Instance, pCall->H245Instance);
  1454. UnlockCall(pCall);
  1455. } else {
  1456. UnlockCall(pCall);
  1457. ProcessRemoteHangup(hCall, CC_INVALID_HANDLE, CC_REJECT_UNDEFINED_REASON);
  1458. }
  1459. return H245_ERROR_OK;
  1460. } // switch
  1461. pCall->MasterSlaveState = MASTER_SLAVE_COMPLETE;
  1462. if ((pCall->OutgoingTermCapState == TERMCAP_COMPLETE) &&
  1463. (pCall->IncomingTermCapState == TERMCAP_COMPLETE) &&
  1464. (pCall->CallState == TERMCAP) &&
  1465. (pCall->MasterSlaveState == MASTER_SLAVE_COMPLETE)) {
  1466. // Note that _ProcessConnectionComplete() returns with pConference and pCall unlocked
  1467. _ProcessConnectionComplete(pConference, pCall);
  1468. return H245_ERROR_OK;
  1469. }
  1470. UnlockCall(pCall);
  1471. UnlockConference(pConference);
  1472. return H245_ERROR_OK;
  1473. }
  1474. HRESULT _IndClose( H245_CONF_IND_T *pH245ConfIndData)
  1475. {
  1476. CC_HCALL hCall;
  1477. PCALL pCall;
  1478. CC_HCONFERENCE hConference;
  1479. PCONFERENCE pConference;
  1480. CC_HCHANNEL hChannel;
  1481. PCHANNEL pChannel;
  1482. WORD i;
  1483. WORD wNumCalls;
  1484. PCC_HCALL CallList;
  1485. CC_RX_CHANNEL_CLOSE_CALLBACK_PARAMS RxChannelCloseCallbackParams;
  1486. #ifdef GATEKEEPER
  1487. unsigned uBandwidth;
  1488. #endif // GATEKEEPER
  1489. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  1490. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  1491. return H245_ERROR_OK;
  1492. hConference = pCall->hConference;
  1493. UnlockCall(pCall);
  1494. if (FindChannelInConference(pH245ConfIndData->u.Indication.u.IndClose.Channel,
  1495. FALSE, // remote channel number
  1496. RX_CHANNEL | TXRX_CHANNEL | PROXY_CHANNEL,
  1497. hCall,
  1498. &hChannel,
  1499. pConference) != CC_OK) {
  1500. UnlockConference(pConference);
  1501. return H245_ERROR_OK;
  1502. }
  1503. if (LockChannel(hChannel, &pChannel) != CC_OK)
  1504. return H245_ERROR_OK;
  1505. EnumerateCallsInConference(&wNumCalls, &CallList, pConference, ESTABLISHED_CALL);
  1506. #ifdef GATEKEEPER
  1507. if(GKIExists())
  1508. {
  1509. if (pChannel->bChannelType != TXRX_CHANNEL)
  1510. {
  1511. uBandwidth = pChannel->dwChannelBitRate / 100;
  1512. for (i = 0; i < wNumCalls; i++)
  1513. {
  1514. if (LockCall(CallList[i], &pCall) == CC_OK)
  1515. {
  1516. if (uBandwidth && pCall->GkiCall.uBandwidthUsed >= uBandwidth)
  1517. {
  1518. if (GkiCloseChannel(&pCall->GkiCall, pChannel->dwChannelBitRate, hChannel) == CC_OK)
  1519. {
  1520. uBandwidth = 0;
  1521. UnlockCall(pCall);
  1522. break;
  1523. }
  1524. }
  1525. UnlockCall(pCall);
  1526. }
  1527. } // for
  1528. }
  1529. }
  1530. #endif // GATEKEEPER
  1531. if (pChannel->bChannelType == PROXY_CHANNEL) {
  1532. ASSERT(pConference->ConferenceMode == MULTIPOINT_MODE);
  1533. ASSERT(pConference->tsMultipointController == TS_TRUE);
  1534. ASSERT(pChannel->bMultipointChannel == TRUE);
  1535. for (i = 0; i < wNumCalls; i++) {
  1536. if (CallList[i] != hCall) {
  1537. if (LockCall(CallList[i], &pCall) == CC_OK) {
  1538. H245CloseChannel(pCall->H245Instance, // H245 instance
  1539. 0, // dwTransId
  1540. pChannel->wLocalChannelNumber);
  1541. UnlockCall(pCall);
  1542. }
  1543. }
  1544. }
  1545. }
  1546. if (CallList != NULL)
  1547. MemFree(CallList);
  1548. if (pChannel->tsAccepted == TS_TRUE) {
  1549. RxChannelCloseCallbackParams.hChannel = hChannel;
  1550. InvokeUserConferenceCallback(pConference,
  1551. CC_RX_CHANNEL_CLOSE_INDICATION,
  1552. CC_OK,
  1553. &RxChannelCloseCallbackParams);
  1554. }
  1555. if (ValidateChannel(hChannel) == CC_OK)
  1556. FreeChannel(pChannel);
  1557. if (ValidateConference(hConference) == CC_OK)
  1558. UnlockConference(pConference);
  1559. return H245_ERROR_OK;
  1560. }
  1561. HRESULT _IndRequestClose( H245_CONF_IND_T *pH245ConfIndData)
  1562. {
  1563. CC_HCALL hCall;
  1564. PCALL pCall;
  1565. CC_HCONFERENCE hConference;
  1566. PCONFERENCE pConference;
  1567. CC_HCHANNEL hChannel;
  1568. PCHANNEL pChannel;
  1569. CC_TX_CHANNEL_CLOSE_REQUEST_CALLBACK_PARAMS TxChannelCloseRequestCallbackParams;
  1570. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  1571. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  1572. return H245_ERROR_OK;
  1573. hConference = pCall->hConference;
  1574. UnlockCall(pCall);
  1575. if (FindChannelInConference(pH245ConfIndData->u.Indication.u.IndClose.Channel,
  1576. TRUE, // local channel number
  1577. TX_CHANNEL | TXRX_CHANNEL | PROXY_CHANNEL,
  1578. CC_INVALID_HANDLE,
  1579. &hChannel,
  1580. pConference) != CC_OK) {
  1581. UnlockConference(pConference);
  1582. return H245_ERROR_OK;
  1583. }
  1584. if (LockChannel(hChannel, &pChannel) != CC_OK) {
  1585. UnlockConference(pConference);
  1586. return H245_ERROR_OK;
  1587. }
  1588. if ((pChannel->bChannelType == TX_CHANNEL) ||
  1589. (pChannel->bChannelType == TXRX_CHANNEL)) {
  1590. EnqueueRequest(&pChannel->pCloseRequests, hCall);
  1591. UnlockChannel(pChannel);
  1592. TxChannelCloseRequestCallbackParams.hChannel = hChannel;
  1593. InvokeUserConferenceCallback(pConference,
  1594. CC_TX_CHANNEL_CLOSE_REQUEST_INDICATION,
  1595. CC_OK,
  1596. &TxChannelCloseRequestCallbackParams);
  1597. if (ValidateConference(hConference) == CC_OK)
  1598. UnlockConference(pConference);
  1599. } else { // pChannel->bChannelType == PROXY_CHANNEL
  1600. if (LockCall(pChannel->hCall, &pCall) == CC_OK) {
  1601. // Note that dwTransID is set to the call handle of the peer who
  1602. // initiated the close channel request. When the close channel response
  1603. // is received, the dwTransID gives us back the call handle to which
  1604. // the response must be forwarded
  1605. H245CloseChannelReq(pCall->H245Instance,
  1606. hCall, // dwTransID
  1607. pChannel->wRemoteChannelNumber);
  1608. UnlockCall(pCall);
  1609. }
  1610. UnlockChannel(pChannel);
  1611. UnlockConference(pConference);
  1612. }
  1613. return H245_ERROR_OK;
  1614. }
  1615. HRESULT _IndNonStandard( H245_CONF_IND_T *pH245ConfIndData)
  1616. {
  1617. CC_HCALL hCall;
  1618. PCALL pCall;
  1619. CC_HCONFERENCE hConference;
  1620. PCONFERENCE pConference;
  1621. CC_RX_NONSTANDARD_MESSAGE_CALLBACK_PARAMS RxNonStandardMessageCallbackParams;
  1622. // We only handle H221 non-standard messages; if pwObjectId is non-NULL,
  1623. // ignore the message
  1624. if (pH245ConfIndData->u.Indication.u.IndNonstandard.pwObjectId != NULL)
  1625. return H245_ERROR_OK;
  1626. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  1627. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  1628. return H245_ERROR_OK;
  1629. hConference = pCall->hConference;
  1630. switch (pH245ConfIndData->u.Indication.Indicator) {
  1631. case H245_IND_NONSTANDARD_REQUEST:
  1632. RxNonStandardMessageCallbackParams.bH245MessageType = CC_H245_MESSAGE_REQUEST;
  1633. break;
  1634. case H245_IND_NONSTANDARD_RESPONSE:
  1635. RxNonStandardMessageCallbackParams.bH245MessageType = CC_H245_MESSAGE_RESPONSE;
  1636. break;
  1637. case H245_IND_NONSTANDARD_COMMAND:
  1638. RxNonStandardMessageCallbackParams.bH245MessageType = CC_H245_MESSAGE_COMMAND;
  1639. break;
  1640. case H245_IND_NONSTANDARD:
  1641. RxNonStandardMessageCallbackParams.bH245MessageType = CC_H245_MESSAGE_INDICATION;
  1642. break;
  1643. default:
  1644. UnlockConference(pConference);
  1645. return H245_ERROR_NOSUP;
  1646. }
  1647. RxNonStandardMessageCallbackParams.NonStandardData.sData.pOctetString =
  1648. pH245ConfIndData->u.Indication.u.IndNonstandard.pData;
  1649. RxNonStandardMessageCallbackParams.NonStandardData.sData.wOctetStringLength =
  1650. (WORD)pH245ConfIndData->u.Indication.u.IndNonstandard.dwDataLength;
  1651. RxNonStandardMessageCallbackParams.NonStandardData.bCountryCode =
  1652. pH245ConfIndData->u.Indication.u.IndNonstandard.byCountryCode;
  1653. RxNonStandardMessageCallbackParams.NonStandardData.bExtension =
  1654. pH245ConfIndData->u.Indication.u.IndNonstandard.byExtension;
  1655. RxNonStandardMessageCallbackParams.NonStandardData.wManufacturerCode =
  1656. pH245ConfIndData->u.Indication.u.IndNonstandard.wManufacturerCode;
  1657. RxNonStandardMessageCallbackParams.hCall = pCall->hCall;
  1658. if (pCall->pPeerParticipantInfo != NULL)
  1659. RxNonStandardMessageCallbackParams.InitiatorTerminalLabel =
  1660. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  1661. else {
  1662. RxNonStandardMessageCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  1663. RxNonStandardMessageCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  1664. }
  1665. InvokeUserConferenceCallback(pConference,
  1666. CC_RX_NONSTANDARD_MESSAGE_INDICATION,
  1667. CC_OK,
  1668. &RxNonStandardMessageCallbackParams);
  1669. if (ValidateConference(hConference) == CC_OK)
  1670. UnlockConference(pConference);
  1671. if (ValidateCall(hCall) == CC_OK)
  1672. UnlockCall(pCall);
  1673. return H245_ERROR_OK;
  1674. }
  1675. HRESULT _IndMiscellaneous( H245_CONF_IND_T *pH245ConfIndData,
  1676. MiscellaneousIndication *pMiscellaneousIndication)
  1677. {
  1678. HRESULT status = CC_OK;
  1679. CC_HCALL hCall;
  1680. PCALL pCall;
  1681. PCALL pOldCall;
  1682. CC_HCONFERENCE hConference;
  1683. PCONFERENCE pConference;
  1684. CC_HCHANNEL hChannel;
  1685. PCHANNEL pChannel;
  1686. WORD i;
  1687. WORD wNumCalls;
  1688. PCC_HCALL CallList;
  1689. PDU_T *pPdu = NULL;
  1690. CC_MUTE_CALLBACK_PARAMS MuteCallbackParams;
  1691. CC_UNMUTE_CALLBACK_PARAMS UnMuteCallbackParams;
  1692. CC_H245_MISCELLANEOUS_INDICATION_CALLBACK_PARAMS H245MiscellaneousIndicationCallbackParams;
  1693. if (pMiscellaneousIndication == NULL)
  1694. // Should never hit this case
  1695. return H245_ERROR_NOSUP;
  1696. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  1697. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  1698. return H245_ERROR_OK;
  1699. hConference = pCall->hConference;
  1700. switch (pMiscellaneousIndication->type.choice) {
  1701. case logicalChannelActive_chosen:
  1702. case logicalChannelInactive_chosen:
  1703. UnlockCall(pCall);
  1704. if (FindChannelInConference(pMiscellaneousIndication->logicalChannelNumber,
  1705. FALSE, // remote channel number
  1706. RX_CHANNEL | PROXY_CHANNEL,
  1707. hCall,
  1708. &hChannel,
  1709. pConference) != CC_OK) {
  1710. UnlockConference(pConference);
  1711. return H245_ERROR_OK;
  1712. }
  1713. if (LockChannel(hChannel, &pChannel) != CC_OK) {
  1714. UnlockConference(pConference);
  1715. return H245_ERROR_OK;
  1716. }
  1717. if (pChannel->bChannelType == PROXY_CHANNEL) {
  1718. ASSERT(pConference->ConferenceMode == MULTIPOINT_MODE);
  1719. ASSERT(pConference->tsMultipointController == TS_TRUE);
  1720. ASSERT(pChannel->bMultipointChannel == TRUE);
  1721. // Construct an H.245 PDU to hold a miscellaneous indication
  1722. // of "logical channel inactive" (mute) or "logical channel active" (unmute)
  1723. pPdu = (PDU_T *)MemAlloc(sizeof(PDU_T));
  1724. if(NULL != pPdu)
  1725. {
  1726. pPdu->choice = indication_chosen;
  1727. pPdu->u.indication.choice = miscellaneousIndication_chosen;
  1728. pPdu->u.indication.u.miscellaneousIndication.logicalChannelNumber =
  1729. pChannel->wLocalChannelNumber;
  1730. pPdu->u.indication.u.miscellaneousIndication.type.choice =
  1731. pMiscellaneousIndication->type.choice;
  1732. EnumerateCallsInConference(&wNumCalls, &CallList, pConference, ESTABLISHED_CALL);
  1733. for (i = 0; i < wNumCalls; i++) {
  1734. if (CallList[i] != hCall) {
  1735. if (LockCall(CallList[i], &pCall) == CC_OK) {
  1736. H245SendPDU(pCall->H245Instance, pPdu);
  1737. UnlockCall(pCall);
  1738. }
  1739. }
  1740. }
  1741. MemFree(CallList);
  1742. MemFree(pPdu);
  1743. pPdu = NULL;
  1744. }
  1745. }
  1746. if (pMiscellaneousIndication->type.choice == logicalChannelActive_chosen) {
  1747. if (pChannel->tsAccepted == TS_TRUE) {
  1748. UnMuteCallbackParams.hChannel = hChannel;
  1749. InvokeUserConferenceCallback(pConference,
  1750. CC_UNMUTE_INDICATION,
  1751. CC_OK,
  1752. &UnMuteCallbackParams);
  1753. }
  1754. } else {
  1755. if (pChannel->tsAccepted == TS_TRUE) {
  1756. MuteCallbackParams.hChannel = hChannel;
  1757. InvokeUserConferenceCallback(pConference,
  1758. CC_MUTE_INDICATION,
  1759. CC_OK,
  1760. &MuteCallbackParams);
  1761. }
  1762. }
  1763. if (ValidateChannel(hChannel) == CC_OK)
  1764. UnlockChannel(pChannel);
  1765. if (ValidateConference(hConference) == CC_OK)
  1766. UnlockConference(pConference);
  1767. status = H245_ERROR_OK;
  1768. break;
  1769. case multipointConference_chosen:
  1770. case cnclMltpntCnfrnc_chosen:
  1771. // We're required to support receipt of this indication, but I have no
  1772. // idea what we're supposed to do with it
  1773. UnlockCall(pCall);
  1774. UnlockConference(pConference);
  1775. status = H245_ERROR_OK;
  1776. break;
  1777. case vdIndctRdyTActvt_chosen:
  1778. case MIn_tp_vdTmprlSptlTrdOff_chosen:
  1779. if (FindChannelInConference(pMiscellaneousIndication->logicalChannelNumber,
  1780. FALSE, // remote channel number
  1781. RX_CHANNEL | PROXY_CHANNEL,
  1782. hCall,
  1783. &hChannel,
  1784. pConference) != CC_OK) {
  1785. UnlockCall(pCall);
  1786. UnlockConference(pConference);
  1787. return H245_ERROR_OK;
  1788. }
  1789. if (LockChannel(hChannel, &pChannel) != CC_OK) {
  1790. UnlockCall(pCall);
  1791. UnlockConference(pConference);
  1792. return H245_ERROR_OK;
  1793. }
  1794. if (pChannel->bChannelType == PROXY_CHANNEL) {
  1795. ASSERT(pConference->ConferenceMode == MULTIPOINT_MODE);
  1796. ASSERT(pConference->tsMultipointController == TS_TRUE);
  1797. ASSERT(pChannel->bMultipointChannel == TRUE);
  1798. // Construct an H.245 PDU to hold a miscellaneous indication
  1799. // of "video indicate ready to activate" or
  1800. // "video temporal spatial tradeoff"
  1801. pPdu = (PDU_T *)MemAlloc(sizeof(PDU_T));
  1802. if(NULL != pPdu)
  1803. {
  1804. pPdu->choice = indication_chosen;
  1805. pPdu->u.indication.choice = miscellaneousIndication_chosen;
  1806. pPdu->u.indication.u.miscellaneousIndication.logicalChannelNumber =
  1807. pChannel->wLocalChannelNumber;
  1808. pPdu->u.indication.u.miscellaneousIndication.type.choice =
  1809. pMiscellaneousIndication->type.choice;
  1810. EnumerateCallsInConference(&wNumCalls, &CallList, pConference, ESTABLISHED_CALL);
  1811. for (i = 0; i < wNumCalls; i++) {
  1812. if (CallList[i] != hCall) {
  1813. if (LockCall(CallList[i], &pOldCall) == CC_OK) {
  1814. H245SendPDU(pOldCall->H245Instance, pPdu);
  1815. UnlockCall(pOldCall);
  1816. }
  1817. }
  1818. }
  1819. MemFree(CallList);
  1820. MemFree(pPdu);
  1821. pPdu = NULL;
  1822. }
  1823. }
  1824. if (pChannel->tsAccepted == TS_TRUE) {
  1825. H245MiscellaneousIndicationCallbackParams.hCall = hCall;
  1826. if (pCall->pPeerParticipantInfo == NULL) {
  1827. H245MiscellaneousIndicationCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  1828. H245MiscellaneousIndicationCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  1829. } else
  1830. H245MiscellaneousIndicationCallbackParams.InitiatorTerminalLabel =
  1831. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  1832. H245MiscellaneousIndicationCallbackParams.hChannel = hChannel;
  1833. H245MiscellaneousIndicationCallbackParams.pMiscellaneousIndication =
  1834. pMiscellaneousIndication;
  1835. status = InvokeUserConferenceCallback(pConference,
  1836. CC_H245_MISCELLANEOUS_INDICATION_INDICATION,
  1837. CC_OK,
  1838. &H245MiscellaneousIndicationCallbackParams);
  1839. if (status != CC_OK)
  1840. status = H245_ERROR_NOSUP;
  1841. } else
  1842. status = H245_ERROR_OK;
  1843. if (ValidateChannel(hChannel) == CC_OK)
  1844. UnlockChannel(pChannel);
  1845. if (ValidateCall(hCall) == CC_OK)
  1846. UnlockCall(pCall);
  1847. if (ValidateConference(hConference) == CC_OK)
  1848. UnlockConference(pConference);
  1849. break;
  1850. case videoNotDecodedMBs_chosen:
  1851. if (FindChannelInConference(pMiscellaneousIndication->logicalChannelNumber,
  1852. TRUE, // local channel number
  1853. TX_CHANNEL | PROXY_CHANNEL,
  1854. CC_INVALID_HANDLE,
  1855. &hChannel,
  1856. pConference) != CC_OK) {
  1857. UnlockCall(pCall);
  1858. UnlockConference(pConference);
  1859. return H245_ERROR_OK;
  1860. }
  1861. if (LockChannel(hChannel, &pChannel) != CC_OK) {
  1862. UnlockCall(pCall);
  1863. UnlockConference(pConference);
  1864. return H245_ERROR_OK;
  1865. }
  1866. if (pChannel->bChannelType == TX_CHANNEL) {
  1867. H245MiscellaneousIndicationCallbackParams.hCall = hCall;
  1868. if (pCall->pPeerParticipantInfo == NULL) {
  1869. H245MiscellaneousIndicationCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  1870. H245MiscellaneousIndicationCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  1871. } else
  1872. H245MiscellaneousIndicationCallbackParams.InitiatorTerminalLabel =
  1873. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  1874. H245MiscellaneousIndicationCallbackParams.hChannel = hChannel;
  1875. H245MiscellaneousIndicationCallbackParams.pMiscellaneousIndication =
  1876. pMiscellaneousIndication;
  1877. status = InvokeUserConferenceCallback(pConference,
  1878. CC_H245_MISCELLANEOUS_INDICATION_INDICATION,
  1879. CC_OK,
  1880. &H245MiscellaneousIndicationCallbackParams);
  1881. if (status != CC_OK)
  1882. status = H245_ERROR_NOSUP;
  1883. if (ValidateChannel(hChannel) == CC_OK)
  1884. UnlockChannel(pChannel);
  1885. if (ValidateCall(hCall) == CC_OK)
  1886. UnlockCall(pCall);
  1887. if (ValidateConference(hConference) == CC_OK)
  1888. UnlockConference(pConference);
  1889. return H245_ERROR_OK;
  1890. } else {
  1891. // Proxy channel; forward the request to the transmitter
  1892. ASSERT(pConference->ConferenceMode == MULTIPOINT_MODE);
  1893. ASSERT(pConference->tsMultipointController == TS_TRUE);
  1894. ASSERT(pChannel->bMultipointChannel == TRUE);
  1895. // Construct an H.245 PDU to hold a miscellaneous indication
  1896. // of "video not decoded MBs"
  1897. pPdu = (PDU_T *)MemAlloc(sizeof(PDU_T));
  1898. if(NULL != pPdu)
  1899. {
  1900. pPdu->choice = indication_chosen;
  1901. pPdu->u.indication.choice = miscellaneousIndication_chosen;
  1902. pPdu->u.indication.u.miscellaneousIndication.logicalChannelNumber =
  1903. pChannel->wRemoteChannelNumber;
  1904. pPdu->u.indication.u.miscellaneousIndication.type.choice =
  1905. pMiscellaneousIndication->type.choice;
  1906. if (LockCall(pChannel->hCall, &pOldCall) == CC_OK) {
  1907. H245SendPDU(pOldCall->H245Instance, pPdu);
  1908. UnlockCall(pOldCall);
  1909. }
  1910. MemFree(pPdu);
  1911. pPdu = NULL;
  1912. }
  1913. UnlockChannel(pChannel);
  1914. UnlockCall(pCall);
  1915. UnlockConference(pConference);
  1916. return H245_ERROR_OK;
  1917. }
  1918. // We should never reach here
  1919. ASSERT(0);
  1920. default:
  1921. // Miscellaneous indication not containing channel information
  1922. // Pass it up to the client
  1923. H245MiscellaneousIndicationCallbackParams.hCall = hCall;
  1924. if (pCall->pPeerParticipantInfo == NULL) {
  1925. H245MiscellaneousIndicationCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  1926. H245MiscellaneousIndicationCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  1927. } else
  1928. H245MiscellaneousIndicationCallbackParams.InitiatorTerminalLabel =
  1929. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  1930. H245MiscellaneousIndicationCallbackParams.hChannel = CC_INVALID_HANDLE;;
  1931. H245MiscellaneousIndicationCallbackParams.pMiscellaneousIndication =
  1932. pMiscellaneousIndication;
  1933. status = InvokeUserConferenceCallback(pConference,
  1934. CC_H245_MISCELLANEOUS_INDICATION_INDICATION,
  1935. CC_OK,
  1936. &H245MiscellaneousIndicationCallbackParams);
  1937. if (status != CC_OK)
  1938. status = H245_ERROR_NOSUP;
  1939. if (ValidateCall(hCall) == CC_OK)
  1940. UnlockCall(pCall);
  1941. if (ValidateConference(hConference) == CC_OK)
  1942. UnlockConference(pConference);
  1943. break;
  1944. }
  1945. return status;
  1946. // We should never reach this point
  1947. ASSERT(0);
  1948. }
  1949. HRESULT _IndMiscellaneousCommand( H245_CONF_IND_T *pH245ConfIndData,
  1950. MiscellaneousCommand *pMiscellaneousCommand)
  1951. {
  1952. CC_HCALL hCall;
  1953. PCALL pCall;
  1954. PCALL pOldCall;
  1955. CC_HCONFERENCE hConference;
  1956. PCONFERENCE pConference;
  1957. HRESULT status = CC_OK;
  1958. WORD wChoice;
  1959. CC_HCHANNEL hChannel;
  1960. PCHANNEL pChannel;
  1961. CC_H245_MISCELLANEOUS_COMMAND_CALLBACK_PARAMS H245MiscellaneousCommandCallbackParams;
  1962. if (pMiscellaneousCommand == NULL)
  1963. // Should never hit this case
  1964. return H245_ERROR_NOSUP;
  1965. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  1966. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  1967. return H245_ERROR_OK;
  1968. hConference = pConference->hConference;
  1969. switch (pMiscellaneousCommand->type.choice) {
  1970. case multipointModeCommand_chosen:
  1971. //
  1972. // from this point on, expect CommunicationModeCommand
  1973. // also, theoretically, channels shouldn't be opened until at
  1974. // least one CommunicationModeCommand is received.
  1975. // It's only by examining CommunicationModeCommand contents
  1976. // that we can determine if a conference has decentralized
  1977. // media.
  1978. // I'm commenting this out on 6/4/98 because it's bogus: all
  1979. // endpoints have centralized media distribution. Set
  1980. // pConference->ConferenceMode = MULTIPOINT_MODE; only after
  1981. // CommunicationModeCommand is received and the multiplex table has
  1982. // been examined and decentralized media is found
  1983. #if(0)
  1984. if (pConference->bMultipointCapable == FALSE) {
  1985. // We can't support multipoint operation, so treat this as if
  1986. // we received a remote hangup indication
  1987. UnlockConference(pConference);
  1988. UnlockCall(pCall);
  1989. ProcessRemoteHangup(hCall, CC_INVALID_HANDLE, CC_REJECT_NORMAL_CALL_CLEARING);
  1990. return H245_ERROR_OK;
  1991. } else {
  1992. pConference->ConferenceMode = MULTIPOINT_MODE;
  1993. // Send TerminalListRequest
  1994. H245ConferenceRequest(pCall->H245Instance,
  1995. H245_REQ_TERMINAL_LIST,
  1996. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bMCUNumber,
  1997. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber);
  1998. }
  1999. #else
  2000. // Send TerminalListRequest
  2001. H245ConferenceRequest(pCall->H245Instance,
  2002. H245_REQ_TERMINAL_LIST,
  2003. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bMCUNumber,
  2004. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber);
  2005. #endif
  2006. status = H245_ERROR_OK;
  2007. break;
  2008. case cnclMltpntMdCmmnd_chosen:
  2009. // We're required to support receipt of this command, but I have no
  2010. // idea what we're supposed to do with it
  2011. status = H245_ERROR_OK;
  2012. break;
  2013. case videoFreezePicture_chosen:
  2014. case videoFastUpdatePicture_chosen:
  2015. case videoFastUpdateGOB_chosen:
  2016. case MCd_tp_vdTmprlSptlTrdOff_chosen:
  2017. case videoSendSyncEveryGOB_chosen:
  2018. case videoFastUpdateMB_chosen:
  2019. case vdSndSyncEvryGOBCncl_chosen:
  2020. if (FindChannelInConference(pMiscellaneousCommand->logicalChannelNumber,
  2021. TRUE, // local channel number
  2022. TX_CHANNEL | PROXY_CHANNEL,
  2023. CC_INVALID_HANDLE,
  2024. &hChannel,
  2025. pConference) != CC_OK) {
  2026. UnlockCall(pCall);
  2027. UnlockConference(pConference);
  2028. return H245_ERROR_OK;
  2029. }
  2030. if (LockChannel(hChannel, &pChannel) != CC_OK) {
  2031. UnlockCall(pCall);
  2032. UnlockConference(pConference);
  2033. return H245_ERROR_OK;
  2034. }
  2035. if (pChannel->bChannelType == TX_CHANNEL) {
  2036. H245MiscellaneousCommandCallbackParams.hCall = hCall;
  2037. if (pCall->pPeerParticipantInfo == NULL) {
  2038. H245MiscellaneousCommandCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  2039. H245MiscellaneousCommandCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  2040. } else
  2041. H245MiscellaneousCommandCallbackParams.InitiatorTerminalLabel =
  2042. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  2043. H245MiscellaneousCommandCallbackParams.hChannel = hChannel;
  2044. wChoice = pMiscellaneousCommand->type.choice;
  2045. if ((wChoice == videoFreezePicture_chosen) ||
  2046. (wChoice == videoFastUpdatePicture_chosen) ||
  2047. (wChoice == videoFastUpdateGOB_chosen) ||
  2048. (wChoice == videoFastUpdateMB_chosen))
  2049. H245MiscellaneousCommandCallbackParams.bH323ActionRequired = TRUE;
  2050. else
  2051. H245MiscellaneousCommandCallbackParams.bH323ActionRequired = FALSE;
  2052. H245MiscellaneousCommandCallbackParams.pMiscellaneousCommand =
  2053. pMiscellaneousCommand;
  2054. status = InvokeUserConferenceCallback(pConference,
  2055. CC_H245_MISCELLANEOUS_COMMAND_INDICATION,
  2056. CC_OK,
  2057. &H245MiscellaneousCommandCallbackParams);
  2058. if (status != CC_OK)
  2059. status = H245_ERROR_NOSUP;
  2060. if (ValidateChannel(hChannel) == CC_OK)
  2061. UnlockChannel(pChannel);
  2062. if (ValidateCall(hCall) == CC_OK)
  2063. UnlockCall(pCall);
  2064. if (ValidateConference(hConference) == CC_OK)
  2065. UnlockConference(pConference);
  2066. return H245_ERROR_OK;
  2067. } else {
  2068. // Proxy channel; forward the request to the transmitter
  2069. ASSERT(pConference->ConferenceMode == MULTIPOINT_MODE);
  2070. ASSERT(pConference->tsMultipointController == TS_TRUE);
  2071. ASSERT(pChannel->bMultipointChannel == TRUE);
  2072. if (LockCall(pChannel->hCall, &pOldCall) == CC_OK) {
  2073. PDU_T *pPdu = (PDU_T *) MemAlloc(sizeof(PDU_T));
  2074. if(NULL != pPdu)
  2075. {
  2076. pPdu->choice = MSCMg_cmmnd_chosen;
  2077. pPdu->u.MSCMg_cmmnd.choice = miscellaneousCommand_chosen;
  2078. pPdu->u.MSCMg_cmmnd.u.miscellaneousCommand.logicalChannelNumber =
  2079. pChannel->wRemoteChannelNumber;
  2080. pPdu->u.MSCMg_cmmnd.u.miscellaneousCommand = *pMiscellaneousCommand;
  2081. H245SendPDU(pOldCall->H245Instance, pPdu);
  2082. MemFree(pPdu);
  2083. pPdu = NULL;
  2084. }
  2085. UnlockCall(pOldCall);
  2086. }
  2087. UnlockChannel(pChannel);
  2088. UnlockCall(pCall);
  2089. UnlockConference(pConference);
  2090. return H245_ERROR_OK;
  2091. }
  2092. // We should never reach here
  2093. ASSERT(0);
  2094. default:
  2095. // Unrecognized miscellaneous command
  2096. // Pass it up to the client
  2097. H245MiscellaneousCommandCallbackParams.hCall = hCall;
  2098. if (pCall->pPeerParticipantInfo == NULL) {
  2099. H245MiscellaneousCommandCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  2100. H245MiscellaneousCommandCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  2101. } else
  2102. H245MiscellaneousCommandCallbackParams.InitiatorTerminalLabel =
  2103. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  2104. H245MiscellaneousCommandCallbackParams.hChannel = CC_INVALID_HANDLE;
  2105. H245MiscellaneousCommandCallbackParams.bH323ActionRequired = FALSE;
  2106. H245MiscellaneousCommandCallbackParams.pMiscellaneousCommand =
  2107. pMiscellaneousCommand;
  2108. status = InvokeUserConferenceCallback(pConference,
  2109. CC_H245_MISCELLANEOUS_COMMAND_INDICATION,
  2110. CC_OK,
  2111. &H245MiscellaneousCommandCallbackParams);
  2112. if (status != CC_OK)
  2113. status = H245_ERROR_NOSUP;
  2114. if (ValidateCall(hCall) == CC_OK)
  2115. UnlockCall(pCall);
  2116. if (ValidateConference(hConference) == CC_OK)
  2117. UnlockConference(pConference);
  2118. return status;
  2119. }
  2120. if (ValidateCall(hCall) == CC_OK)
  2121. UnlockCall(pCall);
  2122. if (ValidateConference(hConference) == CC_OK)
  2123. UnlockConference(pConference);
  2124. return status;
  2125. // We should never reach this point
  2126. ASSERT(0);
  2127. }
  2128. HRESULT _IndMCLocation( H245_CONF_IND_T *pH245ConfIndData)
  2129. {
  2130. CC_HCALL hCall;
  2131. PCALL pCall;
  2132. PCONFERENCE pConference;
  2133. CC_CONNECT_CALLBACK_PARAMS ConnectCallbackParams;
  2134. PCALL pEnqueuedCall;
  2135. CC_HCALL hEnqueuedCall;
  2136. HRESULT status;
  2137. CC_HCONFERENCE hConference;
  2138. if (pH245ConfIndData->u.Indication.u.IndMcLocation.type != H245_IP_UNICAST)
  2139. return H245_ERROR_OK;
  2140. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  2141. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  2142. return H245_ERROR_OK;
  2143. UnlockCall(pCall);
  2144. hConference = pConference->hConference;
  2145. if (pConference->tsMultipointController != TS_FALSE) {
  2146. // We don't expect to receive an MCLocationIndication until master/slave
  2147. // has completed, at which time tsMultipointController will change from
  2148. // TS_UNKNOWN to either TS_TRUE or TS_FALSE.
  2149. UnlockConference(pConference);
  2150. return H245_ERROR_NOSUP;
  2151. }
  2152. if (pConference->pMultipointControllerAddr == NULL) {
  2153. pConference->pMultipointControllerAddr = (PCC_ADDR)MemAlloc(sizeof(CC_ADDR));
  2154. if (pConference->pMultipointControllerAddr == NULL) {
  2155. UnlockConference(pConference);
  2156. return H245_ERROR_OK;
  2157. }
  2158. }
  2159. pConference->pMultipointControllerAddr->nAddrType = CC_IP_BINARY;
  2160. pConference->pMultipointControllerAddr->bMulticast = FALSE;
  2161. pConference->pMultipointControllerAddr->Addr.IP_Binary.wPort =
  2162. pH245ConfIndData->u.Indication.u.IndMcLocation.u.ip.tsapIdentifier;
  2163. H245IPNetworkToHost(&pConference->pMultipointControllerAddr->Addr.IP_Binary.dwAddr,
  2164. pH245ConfIndData->u.Indication.u.IndMcLocation.u.ip.network);
  2165. // place all calls enqueued on this conference object
  2166. for ( ; ; ) {
  2167. // Start up all enqueued calls, if any exist
  2168. status = RemoveEnqueuedCallFromConference(pConference, &hEnqueuedCall);
  2169. if ((status != CC_OK) || (hEnqueuedCall == CC_INVALID_HANDLE))
  2170. break;
  2171. status = LockCall(hEnqueuedCall, &pEnqueuedCall);
  2172. if (status == CC_OK) {
  2173. // Place Call to MC
  2174. pEnqueuedCall->CallState = PLACED;
  2175. pEnqueuedCall->CallType = THIRD_PARTY_INVITOR;
  2176. if (pEnqueuedCall->pQ931DestinationAddr == NULL)
  2177. pEnqueuedCall->pQ931DestinationAddr = pEnqueuedCall->pQ931PeerConnectAddr;
  2178. if (pEnqueuedCall->pQ931PeerConnectAddr == NULL)
  2179. pEnqueuedCall->pQ931PeerConnectAddr = (PCC_ADDR)MemAlloc(sizeof(CC_ADDR));
  2180. if (pEnqueuedCall->pQ931PeerConnectAddr == NULL) {
  2181. MarkCallForDeletion(pEnqueuedCall);
  2182. ConnectCallbackParams.pNonStandardData = pEnqueuedCall->pPeerNonStandardData;
  2183. ConnectCallbackParams.pszPeerDisplay = pEnqueuedCall->pszPeerDisplay;
  2184. ConnectCallbackParams.bRejectReason = CC_REJECT_UNDEFINED_REASON;
  2185. ConnectCallbackParams.pTermCapList = pEnqueuedCall->pPeerH245TermCapList;
  2186. ConnectCallbackParams.pH2250MuxCapability = pEnqueuedCall->pPeerH245H2250MuxCapability;
  2187. ConnectCallbackParams.pTermCapDescriptors = pEnqueuedCall->pPeerH245TermCapDescriptors;
  2188. ConnectCallbackParams.pLocalAddr = pEnqueuedCall->pQ931LocalConnectAddr;
  2189. if (pEnqueuedCall->pQ931DestinationAddr == NULL)
  2190. ConnectCallbackParams.pPeerAddr = pEnqueuedCall->pQ931PeerConnectAddr;
  2191. else
  2192. ConnectCallbackParams.pPeerAddr = pEnqueuedCall->pQ931DestinationAddr;
  2193. ConnectCallbackParams.pVendorInfo = pEnqueuedCall->pPeerVendorInfo;
  2194. ConnectCallbackParams.bMultipointConference = TRUE;
  2195. ConnectCallbackParams.pConferenceID = &pConference->ConferenceID;
  2196. ConnectCallbackParams.pMCAddress = pConference->pMultipointControllerAddr;
  2197. ConnectCallbackParams.pAlternateAddress = NULL;
  2198. ConnectCallbackParams.dwUserToken = pEnqueuedCall->dwUserToken;
  2199. InvokeUserConferenceCallback(pConference,
  2200. CC_CONNECT_INDICATION,
  2201. CC_NO_MEMORY,
  2202. &ConnectCallbackParams);
  2203. if (ValidateCallMarkedForDeletion(hEnqueuedCall) == CC_OK)
  2204. FreeCall(pEnqueuedCall);
  2205. if (ValidateConference(hConference) != CC_OK)
  2206. return H245_ERROR_OK;
  2207. }
  2208. pEnqueuedCall->pQ931PeerConnectAddr = pConference->pMultipointControllerAddr;
  2209. status = PlaceCall(pEnqueuedCall, pConference);
  2210. UnlockCall(pEnqueuedCall);
  2211. }
  2212. }
  2213. UnlockConference(pConference);
  2214. return H245_ERROR_OK;
  2215. }
  2216. HRESULT _IndConferenceRequest( H245_CONF_IND_T *pH245ConfIndData)
  2217. {
  2218. CC_HCALL hCall;
  2219. PCALL pCall;
  2220. PCALL pPeerCall;
  2221. CC_HCONFERENCE hConference;
  2222. PCONFERENCE pConference;
  2223. HRESULT status;
  2224. H245_TERMINAL_LABEL_T *H245TerminalLabelList;
  2225. H245_TERMINAL_LABEL_T H245TerminalLabel;
  2226. WORD wNumTerminalLabels;
  2227. CC_H245_CONFERENCE_REQUEST_CALLBACK_PARAMS H245ConferenceRequestCallbackParams;
  2228. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  2229. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  2230. return H245_ERROR_OK;
  2231. hConference = pConference->hConference;
  2232. switch (pH245ConfIndData->u.Indication.u.IndConferReq.RequestType) {
  2233. case H245_REQ_ENTER_H243_TERMINAL_ID:
  2234. switch (pConference->LocalParticipantInfo.TerminalIDState) {
  2235. case TERMINAL_ID_INVALID:
  2236. UnlockCall(pCall);
  2237. EnqueueRequest(&pConference->LocalParticipantInfo.pEnqueuedRequestsForTerminalID,
  2238. hCall);
  2239. pConference->LocalParticipantInfo.TerminalIDState = TERMINAL_ID_REQUESTED;
  2240. InvokeUserConferenceCallback(pConference,
  2241. CC_TERMINAL_ID_REQUEST_INDICATION,
  2242. CC_OK,
  2243. NULL);
  2244. if (ValidateConference(hConference) == CC_OK)
  2245. UnlockConference(pConference);
  2246. return H245_ERROR_OK;
  2247. case TERMINAL_ID_REQUESTED:
  2248. UnlockCall(pCall);
  2249. EnqueueRequest(&pConference->LocalParticipantInfo.pEnqueuedRequestsForTerminalID,
  2250. hCall);
  2251. UnlockConference(pConference);
  2252. return H245_ERROR_OK;
  2253. case TERMINAL_ID_VALID:
  2254. H245ConferenceResponse(pCall->H245Instance,
  2255. H245_RSP_TERMINAL_ID,
  2256. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bMCUNumber,
  2257. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber,
  2258. pConference->LocalParticipantInfo.ParticipantInfo.TerminalID.pOctetString,
  2259. (BYTE)pConference->LocalParticipantInfo.ParticipantInfo.TerminalID.wOctetStringLength,
  2260. NULL, // terminal list
  2261. 0); // terminal list count
  2262. UnlockCall(pCall);
  2263. UnlockConference(pConference);
  2264. return H245_ERROR_OK;
  2265. default:
  2266. ASSERT(0);
  2267. }
  2268. case H245_REQ_TERMINAL_LIST:
  2269. if ((pConference->ConferenceMode == MULTIPOINT_MODE) &&
  2270. (pConference->tsMultipointController == TS_TRUE)) {
  2271. status = EnumerateTerminalLabelsInConference(&wNumTerminalLabels,
  2272. &H245TerminalLabelList,
  2273. pConference);
  2274. if (status == CC_OK)
  2275. H245ConferenceResponse(pCall->H245Instance,
  2276. H245_RSP_TERMINAL_LIST,
  2277. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bMCUNumber,
  2278. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber,
  2279. pConference->LocalParticipantInfo.ParticipantInfo.TerminalID.pOctetString,
  2280. (BYTE)pConference->LocalParticipantInfo.ParticipantInfo.TerminalID.wOctetStringLength,
  2281. H245TerminalLabelList, // terminal list
  2282. wNumTerminalLabels); // terminal list count
  2283. if (H245TerminalLabelList != NULL)
  2284. MemFree(H245TerminalLabelList);
  2285. status = H245_ERROR_OK;
  2286. } else
  2287. status = H245_ERROR_NOSUP;
  2288. break;
  2289. case H245_REQ_TERMINAL_ID:
  2290. if (pConference->tsMultipointController != TS_TRUE) {
  2291. status = H245_ERROR_NOSUP;
  2292. break;
  2293. }
  2294. if (pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bMCUNumber !=
  2295. pH245ConfIndData->u.Indication.u.IndConferReq.byMcuNumber) {
  2296. // This terminal ID wasn't allocated by this MC, so return without a response
  2297. status = H245_ERROR_OK;
  2298. break;
  2299. }
  2300. // First check to see whether the requested terminal ID is ours
  2301. if (pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber ==
  2302. pH245ConfIndData->u.Indication.u.IndConferReq.byTerminalNumber) {
  2303. if (pConference->LocalEndpointAttached != ATTACHED) {
  2304. status = H245_ERROR_OK;
  2305. break;
  2306. }
  2307. switch (pConference->LocalParticipantInfo.TerminalIDState) {
  2308. case TERMINAL_ID_INVALID:
  2309. UnlockCall(pCall);
  2310. EnqueueRequest(&pConference->LocalParticipantInfo.pEnqueuedRequestsForTerminalID,
  2311. hCall);
  2312. pConference->LocalParticipantInfo.TerminalIDState = TERMINAL_ID_REQUESTED;
  2313. InvokeUserConferenceCallback(pConference,
  2314. CC_TERMINAL_ID_REQUEST_INDICATION,
  2315. CC_OK,
  2316. NULL);
  2317. if (ValidateConference(hConference) == CC_OK)
  2318. UnlockConference(pConference);
  2319. return H245_ERROR_OK;
  2320. case TERMINAL_ID_REQUESTED:
  2321. UnlockCall(pCall);
  2322. EnqueueRequest(&pConference->LocalParticipantInfo.pEnqueuedRequestsForTerminalID,
  2323. hCall);
  2324. UnlockConference(pConference);
  2325. return H245_ERROR_OK;
  2326. case TERMINAL_ID_VALID:
  2327. H245ConferenceResponse(pCall->H245Instance,
  2328. H245_RSP_MC_TERMINAL_ID,
  2329. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bMCUNumber,
  2330. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber,
  2331. pConference->LocalParticipantInfo.ParticipantInfo.TerminalID.pOctetString,
  2332. (BYTE)pConference->LocalParticipantInfo.ParticipantInfo.TerminalID.wOctetStringLength,
  2333. NULL, // terminal list
  2334. 0); // terminal list count
  2335. UnlockCall(pCall);
  2336. UnlockConference(pConference);
  2337. return H245_ERROR_OK;
  2338. default:
  2339. ASSERT(0);
  2340. }
  2341. }
  2342. H245TerminalLabel.mcuNumber = pH245ConfIndData->u.Indication.u.IndConferReq.byMcuNumber;
  2343. H245TerminalLabel.terminalNumber = pH245ConfIndData->u.Indication.u.IndConferReq.byTerminalNumber;
  2344. FindPeerParticipantInfo(H245TerminalLabel,
  2345. pConference,
  2346. ESTABLISHED_CALL,
  2347. &pPeerCall);
  2348. if (pPeerCall == NULL) {
  2349. // We don't know about the existance of this terminal ID, so return without a response
  2350. status = H245_ERROR_OK;
  2351. break;
  2352. }
  2353. if (pPeerCall->pPeerParticipantInfo == NULL) {
  2354. UnlockCall(pPeerCall);
  2355. status = H245_ERROR_OK;
  2356. break;
  2357. }
  2358. switch (pPeerCall->pPeerParticipantInfo->TerminalIDState) {
  2359. case TERMINAL_ID_INVALID:
  2360. EnqueueRequest(&pPeerCall->pPeerParticipantInfo->pEnqueuedRequestsForTerminalID,
  2361. hCall);
  2362. pPeerCall->pPeerParticipantInfo->TerminalIDState = TERMINAL_ID_REQUESTED;
  2363. H245ConferenceRequest(pPeerCall->H245Instance,
  2364. H245_REQ_ENTER_H243_TERMINAL_ID,
  2365. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber,
  2366. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber);
  2367. break;
  2368. case TERMINAL_ID_REQUESTED:
  2369. EnqueueRequest(&pPeerCall->pPeerParticipantInfo->pEnqueuedRequestsForTerminalID,
  2370. hCall);
  2371. break;
  2372. case TERMINAL_ID_VALID:
  2373. H245ConferenceResponse(pCall->H245Instance,
  2374. H245_RSP_MC_TERMINAL_ID,
  2375. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber,
  2376. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber,
  2377. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.pOctetString,
  2378. (BYTE)pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.wOctetStringLength,
  2379. NULL, // terminal list
  2380. 0); // terminal list count
  2381. break;
  2382. default:
  2383. ASSERT(0);
  2384. break;
  2385. }
  2386. UnlockCall(pPeerCall);
  2387. status = H245_ERROR_OK;
  2388. break;
  2389. default:
  2390. H245ConferenceRequestCallbackParams.hCall = hCall;
  2391. if (pCall->pPeerParticipantInfo == NULL) {
  2392. H245ConferenceRequestCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  2393. H245ConferenceRequestCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  2394. } else
  2395. H245ConferenceRequestCallbackParams.InitiatorTerminalLabel =
  2396. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  2397. H245ConferenceRequestCallbackParams.RequestType =
  2398. pH245ConfIndData->u.Indication.u.IndConferReq.RequestType;
  2399. H245ConferenceRequestCallbackParams.TerminalLabel.bMCUNumber =
  2400. pH245ConfIndData->u.Indication.u.IndConferReq.byMcuNumber;
  2401. H245ConferenceRequestCallbackParams.TerminalLabel.bTerminalNumber =
  2402. pH245ConfIndData->u.Indication.u.IndConferReq.byTerminalNumber;
  2403. status = InvokeUserConferenceCallback(pConference,
  2404. CC_H245_CONFERENCE_REQUEST_INDICATION,
  2405. CC_OK,
  2406. &H245ConferenceRequestCallbackParams);
  2407. if (status != CC_OK)
  2408. status = H245_ERROR_NOSUP;
  2409. break;
  2410. }
  2411. if (ValidateCall(hCall) == CC_OK)
  2412. UnlockCall(pCall);
  2413. if (ValidateConference(hConference) == CC_OK)
  2414. UnlockConference(pConference);
  2415. return status;
  2416. }
  2417. HRESULT _IndConferenceResponse( H245_CONF_IND_T *pH245ConfIndData)
  2418. {
  2419. CC_HCALL hCall;
  2420. PCALL pCall;
  2421. PCALL pPeerCall;
  2422. CC_HCALL hEnqueuedCall;
  2423. PCALL pEnqueuedCall;
  2424. CC_HCALL hVirtualCall;
  2425. CC_HCALL hPeerCall;
  2426. PCALL pVirtualCall;
  2427. PCONFERENCE pConference;
  2428. CC_HCONFERENCE hConference;
  2429. HRESULT status;
  2430. WORD i;
  2431. PPARTICIPANTINFO pPeerParticipantInfo;
  2432. H245_TERMINAL_LABEL_T TerminalLabel;
  2433. CC_PEER_ADD_CALLBACK_PARAMS PeerAddCallbackParams;
  2434. CC_PEER_UPDATE_CALLBACK_PARAMS PeerUpdateCallbackParams;
  2435. CC_H245_CONFERENCE_RESPONSE_CALLBACK_PARAMS H245ConferenceResponseCallbackParams;
  2436. CC_OCTETSTRING OctetString;
  2437. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  2438. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  2439. return H245_ERROR_OK;
  2440. hConference = pConference->hConference;
  2441. switch (pH245ConfIndData->u.Indication.u.IndConferRsp.ResponseType) {
  2442. case H245_RSP_TERMINAL_LIST:
  2443. if (pConference->tsMultipointController == TS_FALSE) {
  2444. for (i = 0; i < pH245ConfIndData->u.Indication.u.IndConferRsp.wTerminalListCount; i++) {
  2445. if ((pH245ConfIndData->u.Indication.u.IndConferRsp.pTerminalList[i].mcuNumber ==
  2446. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bMCUNumber) &&
  2447. (pH245ConfIndData->u.Indication.u.IndConferRsp.pTerminalList[i].terminalNumber ==
  2448. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber))
  2449. // This terminal number refers to us
  2450. continue;
  2451. FindPeerParticipantInfo(pH245ConfIndData->u.Indication.u.IndConferRsp.pTerminalList[i],
  2452. pConference,
  2453. VIRTUAL_CALL,
  2454. &pPeerCall);
  2455. if (pPeerCall != NULL) {
  2456. // We already know this peer's terminal label, and we
  2457. // eithet know its terminal ID or we have a pending request
  2458. // to obtain it
  2459. UnlockCall(pPeerCall);
  2460. continue;
  2461. }
  2462. // We don't know about this peer.
  2463. // Create a virtual call object for it, and issue a request
  2464. // for its terminal ID
  2465. status = AllocAndLockCall(&hVirtualCall,
  2466. pConference->hConference,
  2467. CC_INVALID_HANDLE, // hQ931Call
  2468. CC_INVALID_HANDLE, // hQ931CallInvitor,
  2469. NULL, // pLocalAliasNames,
  2470. NULL, // pPeerAliasNames,
  2471. NULL, // pPeerExtraAliasNames
  2472. NULL, // pPeerExtension
  2473. NULL, // pLocalNonStandardData,
  2474. NULL, // pPeerNonStandardData,
  2475. NULL, // pszLocalDisplay,
  2476. NULL, // pszPeerDisplay,
  2477. NULL, // pPeerVendorInfo,
  2478. NULL, // pQ931LocalConnectAddr,
  2479. NULL, // pQ931PeerConnectAddr,
  2480. NULL, // pQ931DestinationAddr,
  2481. NULL, // pSourceCallSignalAddress
  2482. VIRTUAL, // CallType,
  2483. FALSE, // bCallerIsMC,
  2484. 0, // dwUserToken,
  2485. CALL_COMPLETE, // InitialCallState,
  2486. NULL, // no CallIdentifier
  2487. &pConference->ConferenceID,
  2488. &pVirtualCall);
  2489. if (status == CC_OK) {
  2490. status = AllocatePeerParticipantInfo(NULL,
  2491. &pPeerParticipantInfo);
  2492. if (status == CC_OK) {
  2493. pVirtualCall->pPeerParticipantInfo =
  2494. pPeerParticipantInfo;
  2495. pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber =
  2496. (BYTE)pH245ConfIndData->u.Indication.u.IndConferRsp.pTerminalList[i].mcuNumber;
  2497. pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber =
  2498. (BYTE)pH245ConfIndData->u.Indication.u.IndConferRsp.pTerminalList[i].terminalNumber;
  2499. AddVirtualCallToConference(pVirtualCall,
  2500. pConference);
  2501. // Send RequestTerminalID
  2502. H245ConferenceRequest(pCall->H245Instance,
  2503. H245_REQ_TERMINAL_ID,
  2504. (BYTE)pH245ConfIndData->u.Indication.u.IndConferRsp.pTerminalList[i].mcuNumber,
  2505. (BYTE)pH245ConfIndData->u.Indication.u.IndConferRsp.pTerminalList[i].terminalNumber);
  2506. pPeerParticipantInfo->TerminalIDState = TERMINAL_ID_REQUESTED;
  2507. // Generate PEER_ADD callback
  2508. PeerAddCallbackParams.hCall = hVirtualCall;
  2509. PeerAddCallbackParams.TerminalLabel =
  2510. pVirtualCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  2511. PeerAddCallbackParams.pPeerTerminalID = NULL;
  2512. InvokeUserConferenceCallback(pConference,
  2513. CC_PEER_ADD_INDICATION,
  2514. CC_OK,
  2515. &PeerAddCallbackParams);
  2516. if (ValidateCall(hVirtualCall) == CC_OK)
  2517. UnlockCall(pVirtualCall);
  2518. } else
  2519. FreeCall(pVirtualCall);
  2520. }
  2521. }
  2522. }
  2523. status = H245_ERROR_OK;
  2524. break;
  2525. case H245_RSP_MC_TERMINAL_ID:
  2526. if (pConference->tsMultipointController == TS_FALSE) {
  2527. TerminalLabel.mcuNumber = pH245ConfIndData->u.Indication.u.IndConferRsp.byMcuNumber;
  2528. TerminalLabel.terminalNumber = pH245ConfIndData->u.Indication.u.IndConferRsp.byTerminalNumber;
  2529. FindPeerParticipantInfo(TerminalLabel,
  2530. pConference,
  2531. VIRTUAL_CALL,
  2532. &pPeerCall);
  2533. if (pPeerCall != NULL) {
  2534. hPeerCall = pPeerCall->hCall;
  2535. if (pPeerCall->pPeerParticipantInfo->TerminalIDState != TERMINAL_ID_VALID) {
  2536. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.pOctetString =
  2537. (BYTE *)MemAlloc(pH245ConfIndData->u.Indication.u.IndConferRsp.byOctetStringLength);
  2538. if (pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.pOctetString == NULL) {
  2539. UnlockCall(pPeerCall);
  2540. status = H245_ERROR_OK;
  2541. break;
  2542. }
  2543. memcpy(pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.pOctetString,
  2544. pH245ConfIndData->u.Indication.u.IndConferRsp.pOctetString,
  2545. pH245ConfIndData->u.Indication.u.IndConferRsp.byOctetStringLength);
  2546. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.wOctetStringLength =
  2547. pH245ConfIndData->u.Indication.u.IndConferRsp.byOctetStringLength;
  2548. pPeerCall->pPeerParticipantInfo->TerminalIDState = TERMINAL_ID_VALID;
  2549. PeerUpdateCallbackParams.hCall = hPeerCall;
  2550. PeerUpdateCallbackParams.TerminalLabel =
  2551. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  2552. PeerUpdateCallbackParams.pPeerTerminalID = &pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID;
  2553. InvokeUserConferenceCallback(pConference,
  2554. CC_PEER_UPDATE_INDICATION,
  2555. CC_OK,
  2556. &PeerUpdateCallbackParams);
  2557. }
  2558. if (ValidateCall(hPeerCall) == CC_OK)
  2559. UnlockCall(pPeerCall);
  2560. }
  2561. }
  2562. status = H245_ERROR_OK;
  2563. break;
  2564. case H245_RSP_TERMINAL_ID:
  2565. if ((pConference->ConferenceMode == MULTIPOINT_MODE) &&
  2566. (pConference->tsMultipointController == TS_TRUE)) {
  2567. TerminalLabel.mcuNumber = pH245ConfIndData->u.Indication.u.IndConferRsp.byMcuNumber;
  2568. TerminalLabel.terminalNumber = pH245ConfIndData->u.Indication.u.IndConferRsp.byTerminalNumber;
  2569. FindPeerParticipantInfo(TerminalLabel,
  2570. pConference,
  2571. ESTABLISHED_CALL,
  2572. &pPeerCall);
  2573. if (pPeerCall != NULL) {
  2574. hPeerCall = pPeerCall->hCall;
  2575. if (pPeerCall->pPeerParticipantInfo->TerminalIDState != TERMINAL_ID_VALID) {
  2576. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.pOctetString =
  2577. (BYTE *)MemAlloc(pH245ConfIndData->u.Indication.u.IndConferRsp.byOctetStringLength);
  2578. if (pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.pOctetString == NULL) {
  2579. UnlockCall(pPeerCall);
  2580. status = H245_ERROR_OK;
  2581. break;
  2582. }
  2583. memcpy(pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.pOctetString,
  2584. pH245ConfIndData->u.Indication.u.IndConferRsp.pOctetString,
  2585. pH245ConfIndData->u.Indication.u.IndConferRsp.byOctetStringLength);
  2586. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.wOctetStringLength =
  2587. pH245ConfIndData->u.Indication.u.IndConferRsp.byOctetStringLength;
  2588. pPeerCall->pPeerParticipantInfo->TerminalIDState = TERMINAL_ID_VALID;
  2589. // Dequeue and respond to each enqueued request for this terminal ID
  2590. while (DequeueRequest(&pPeerCall->pPeerParticipantInfo->pEnqueuedRequestsForTerminalID,
  2591. &hEnqueuedCall) == CC_OK) {
  2592. if (LockCall(hEnqueuedCall, &pEnqueuedCall) == CC_OK) {
  2593. H245ConferenceResponse(pEnqueuedCall->H245Instance,
  2594. H245_RSP_MC_TERMINAL_ID,
  2595. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber,
  2596. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber,
  2597. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.pOctetString,
  2598. (BYTE)pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID.wOctetStringLength,
  2599. NULL, // terminal list
  2600. 0); // terminal list count
  2601. UnlockCall(pEnqueuedCall);
  2602. }
  2603. }
  2604. // Generate a CC_PEER_UPDATE_INDICATION callback
  2605. PeerUpdateCallbackParams.hCall = hPeerCall;
  2606. PeerUpdateCallbackParams.TerminalLabel =
  2607. pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  2608. PeerUpdateCallbackParams.pPeerTerminalID = &pPeerCall->pPeerParticipantInfo->ParticipantInfo.TerminalID;
  2609. InvokeUserConferenceCallback(pConference,
  2610. CC_PEER_UPDATE_INDICATION,
  2611. CC_OK,
  2612. &PeerUpdateCallbackParams);
  2613. }
  2614. if (ValidateCall(hPeerCall) == CC_OK)
  2615. UnlockCall(pPeerCall);
  2616. }
  2617. }
  2618. status = H245_ERROR_OK;
  2619. break;
  2620. default:
  2621. H245ConferenceResponseCallbackParams.hCall = hCall;
  2622. if (pCall->pPeerParticipantInfo == NULL) {
  2623. H245ConferenceResponseCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  2624. H245ConferenceResponseCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  2625. } else
  2626. H245ConferenceResponseCallbackParams.InitiatorTerminalLabel =
  2627. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  2628. H245ConferenceResponseCallbackParams.ResponseType =
  2629. pH245ConfIndData->u.Indication.u.IndConferRsp.ResponseType;
  2630. H245ConferenceResponseCallbackParams.TerminalLabel.bMCUNumber =
  2631. pH245ConfIndData->u.Indication.u.IndConferRsp.byMcuNumber;
  2632. H245ConferenceResponseCallbackParams.TerminalLabel.bTerminalNumber =
  2633. pH245ConfIndData->u.Indication.u.IndConferRsp.byTerminalNumber;
  2634. if ((pH245ConfIndData->u.Indication.u.IndConferRsp.pOctetString == NULL) ||
  2635. (pH245ConfIndData->u.Indication.u.IndConferRsp.byOctetStringLength == 0)) {
  2636. H245ConferenceResponseCallbackParams.pOctetString = NULL;
  2637. } else {
  2638. OctetString.pOctetString =
  2639. pH245ConfIndData->u.Indication.u.IndConferRsp.pOctetString;
  2640. OctetString.wOctetStringLength =
  2641. pH245ConfIndData->u.Indication.u.IndConferRsp.byOctetStringLength;
  2642. H245ConferenceResponseCallbackParams.pOctetString = &OctetString;
  2643. }
  2644. if (pH245ConfIndData->u.Indication.u.IndConferRsp.wTerminalListCount == 0) {
  2645. H245ConferenceResponseCallbackParams.pTerminalList = NULL;
  2646. H245ConferenceResponseCallbackParams.wTerminalListCount = 0;
  2647. status = CC_OK;
  2648. } else {
  2649. H245ConferenceResponseCallbackParams.pTerminalList =
  2650. (CC_TERMINAL_LABEL *)MemAlloc(sizeof(CC_TERMINAL_LABEL) *
  2651. pH245ConfIndData->u.Indication.u.IndConferRsp.wTerminalListCount);
  2652. if (H245ConferenceResponseCallbackParams.pTerminalList == NULL) {
  2653. H245ConferenceResponseCallbackParams.wTerminalListCount = 0;
  2654. status = CC_NO_MEMORY;
  2655. } else {
  2656. for (i = 0; i < pH245ConfIndData->u.Indication.u.IndConferRsp.wTerminalListCount; i++) {
  2657. H245ConferenceResponseCallbackParams.pTerminalList[i].bMCUNumber =
  2658. (BYTE)pH245ConfIndData->u.Indication.u.IndConferRsp.pTerminalList[i].mcuNumber;
  2659. H245ConferenceResponseCallbackParams.pTerminalList[i].bMCUNumber =
  2660. (BYTE)pH245ConfIndData->u.Indication.u.IndConferRsp.pTerminalList[i].terminalNumber;
  2661. }
  2662. H245ConferenceResponseCallbackParams.wTerminalListCount =
  2663. pH245ConfIndData->u.Indication.u.IndConferRsp.wTerminalListCount;
  2664. status = CC_OK;
  2665. }
  2666. }
  2667. status = InvokeUserConferenceCallback(pConference,
  2668. CC_H245_CONFERENCE_RESPONSE_INDICATION,
  2669. status,
  2670. &H245ConferenceResponseCallbackParams);
  2671. if (status != CC_OK)
  2672. status = H245_ERROR_NOSUP;
  2673. if (H245ConferenceResponseCallbackParams.pTerminalList != NULL)
  2674. MemFree(H245ConferenceResponseCallbackParams.pTerminalList);
  2675. break;
  2676. }
  2677. if (ValidateCall(hCall) == CC_OK)
  2678. UnlockCall(pCall);
  2679. if (ValidateConference(hConference) == CC_OK)
  2680. UnlockConference(pConference);
  2681. return status;
  2682. }
  2683. HRESULT _IndConferenceCommand( H245_CONF_IND_T *pH245ConfIndData)
  2684. {
  2685. CC_HCALL hCall;
  2686. PCALL pCall;
  2687. PCALL pOldCall;
  2688. PCONFERENCE pConference;
  2689. CC_HCONFERENCE hConference;
  2690. WORD i;
  2691. WORD wNumCalls;
  2692. PCC_HCALL CallList;
  2693. WORD wNumChannels;
  2694. PCC_HCHANNEL ChannelList;
  2695. PCHANNEL pChannel;
  2696. CC_HCHANNEL hChannel;
  2697. CALLSTATE CallState;
  2698. HQ931CALL hQ931Call;
  2699. H245_INST_T H245Instance;
  2700. HRESULT status = CC_OK;
  2701. CC_H245_CONFERENCE_COMMAND_CALLBACK_PARAMS H245ConferenceCommandCallbackParams;
  2702. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  2703. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  2704. return H245_ERROR_OK;
  2705. hConference = pConference->hConference;
  2706. switch (pH245ConfIndData->u.Indication.u.IndConferCmd.CommandType) {
  2707. case H245_CMD_DROP_CONFERENCE:
  2708. if ((pConference->ConferenceMode == MULTIPOINT_MODE) &&
  2709. (pConference->tsMultipointController == TS_TRUE)) {
  2710. UnlockCall(pCall);
  2711. EnumerateCallsInConference(&wNumCalls, &CallList, pConference, ALL_CALLS);
  2712. for (i = 0; i < wNumCalls; i++) {
  2713. if (LockCall(CallList[i], &pCall) == CC_OK) {
  2714. hQ931Call = pCall->hQ931Call;
  2715. H245Instance = pCall->H245Instance;
  2716. CallState = pCall->CallState;
  2717. FreeCall(pCall);
  2718. switch (CallState) {
  2719. case ENQUEUED:
  2720. break;
  2721. case PLACED:
  2722. case RINGING:
  2723. Q931Hangup(hQ931Call, CC_REJECT_NORMAL_CALL_CLEARING);
  2724. break;
  2725. default:
  2726. H245ShutDown(H245Instance);
  2727. Q931Hangup(hQ931Call, CC_REJECT_NORMAL_CALL_CLEARING);
  2728. break;
  2729. }
  2730. }
  2731. }
  2732. if (CallList != NULL)
  2733. MemFree(CallList);
  2734. EnumerateChannelsInConference(&wNumChannels,
  2735. &ChannelList,
  2736. pConference,
  2737. ALL_CHANNELS);
  2738. for (i = 0; i < wNumChannels; i++) {
  2739. if (LockChannel(ChannelList[i], &pChannel) == CC_OK)
  2740. FreeChannel(pChannel);
  2741. }
  2742. if (ChannelList != NULL)
  2743. MemFree(ChannelList);
  2744. InvokeUserConferenceCallback(
  2745. pConference,
  2746. CC_CONFERENCE_TERMINATION_INDICATION,
  2747. CC_OK,
  2748. NULL);
  2749. if (ValidateConference(hConference) == CC_OK) {
  2750. if (pConference->bDeferredDelete)
  2751. FreeConference(pConference);
  2752. else {
  2753. ReInitializeConference(pConference);
  2754. UnlockConference(pConference);
  2755. }
  2756. }
  2757. return H245_ERROR_OK;
  2758. }
  2759. status = H245_ERROR_OK;
  2760. break;
  2761. case brdcstMyLgclChnnl_chosen:
  2762. case cnclBrdcstMyLgclChnnl_chosen:
  2763. if (FindChannelInConference(pH245ConfIndData->u.Indication.u.IndConferCmd.Channel,
  2764. FALSE, // remote channel number
  2765. RX_CHANNEL | PROXY_CHANNEL,
  2766. hCall,
  2767. &hChannel,
  2768. pConference) != CC_OK) {
  2769. UnlockCall(pCall);
  2770. UnlockConference(pConference);
  2771. return H245_ERROR_OK;
  2772. }
  2773. if (LockChannel(hChannel, &pChannel) != CC_OK) {
  2774. UnlockCall(pCall);
  2775. UnlockConference(pConference);
  2776. return H245_ERROR_OK;
  2777. }
  2778. if (pChannel->bChannelType == PROXY_CHANNEL) {
  2779. ASSERT(pConference->ConferenceMode == MULTIPOINT_MODE);
  2780. ASSERT(pConference->tsMultipointController == TS_TRUE);
  2781. ASSERT(pChannel->bMultipointChannel == TRUE);
  2782. EnumerateCallsInConference(&wNumCalls, &CallList, pConference, ESTABLISHED_CALL);
  2783. for (i = 0; i < wNumCalls; i++) {
  2784. if (CallList[i] != hCall) {
  2785. if (LockCall(CallList[i], &pOldCall) == CC_OK) {
  2786. H245ConferenceCommand(pOldCall->H245Instance,
  2787. pH245ConfIndData->u.Indication.u.IndConferCmd.CommandType,
  2788. pChannel->wLocalChannelNumber,
  2789. pH245ConfIndData->u.Indication.u.IndConferCmd.byMcuNumber,
  2790. pH245ConfIndData->u.Indication.u.IndConferCmd.byTerminalNumber);
  2791. UnlockCall(pOldCall);
  2792. }
  2793. }
  2794. }
  2795. MemFree(CallList);
  2796. }
  2797. if (pChannel->tsAccepted == TS_TRUE) {
  2798. H245ConferenceCommandCallbackParams.hCall = hCall;
  2799. H245ConferenceCommandCallbackParams.hChannel = hChannel;
  2800. if (pCall->pPeerParticipantInfo == NULL) {
  2801. H245ConferenceCommandCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  2802. H245ConferenceCommandCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  2803. } else
  2804. H245ConferenceCommandCallbackParams.InitiatorTerminalLabel =
  2805. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  2806. H245ConferenceCommandCallbackParams.CommandType =
  2807. pH245ConfIndData->u.Indication.u.IndConferCmd.CommandType;
  2808. H245ConferenceCommandCallbackParams.TerminalLabel.bMCUNumber =
  2809. pH245ConfIndData->u.Indication.u.IndConferCmd.byMcuNumber;
  2810. H245ConferenceCommandCallbackParams.TerminalLabel.bTerminalNumber =
  2811. pH245ConfIndData->u.Indication.u.IndConferCmd.byTerminalNumber;
  2812. status = InvokeUserConferenceCallback(pConference,
  2813. CC_H245_CONFERENCE_COMMAND_INDICATION,
  2814. CC_OK,
  2815. &H245ConferenceCommandCallbackParams);
  2816. if (status != CC_OK)
  2817. status = H245_ERROR_NOSUP;
  2818. } else
  2819. status = H245_ERROR_OK;
  2820. if (ValidateChannel(hChannel) == CC_OK)
  2821. UnlockChannel(pChannel);
  2822. if (ValidateCall(hCall) == CC_OK)
  2823. UnlockCall(pCall);
  2824. if (ValidateConference(hConference) == CC_OK)
  2825. UnlockConference(pConference);
  2826. return status;
  2827. default:
  2828. // Unrecognized conference command
  2829. // Pass it up to the client
  2830. H245ConferenceCommandCallbackParams.hCall = hCall;
  2831. if (pCall->pPeerParticipantInfo == NULL) {
  2832. H245ConferenceCommandCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  2833. H245ConferenceCommandCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  2834. } else
  2835. H245ConferenceCommandCallbackParams.InitiatorTerminalLabel =
  2836. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  2837. H245ConferenceCommandCallbackParams.CommandType =
  2838. pH245ConfIndData->u.Indication.u.IndConferCmd.CommandType;
  2839. H245ConferenceCommandCallbackParams.TerminalLabel.bMCUNumber =
  2840. pH245ConfIndData->u.Indication.u.IndConferCmd.byMcuNumber;
  2841. H245ConferenceCommandCallbackParams.TerminalLabel.bTerminalNumber =
  2842. pH245ConfIndData->u.Indication.u.IndConferCmd.byTerminalNumber;
  2843. H245ConferenceCommandCallbackParams.hChannel = CC_INVALID_HANDLE;
  2844. status = InvokeUserConferenceCallback(pConference,
  2845. CC_H245_CONFERENCE_COMMAND_INDICATION,
  2846. CC_OK,
  2847. &H245ConferenceCommandCallbackParams);
  2848. if (status != CC_OK)
  2849. status = H245_ERROR_NOSUP;
  2850. if (ValidateCall(hCall) == CC_OK)
  2851. UnlockCall(pCall);
  2852. if (ValidateConference(hConference) == CC_OK)
  2853. UnlockConference(pConference);
  2854. return status;
  2855. }
  2856. if (ValidateCall(hCall) == CC_OK)
  2857. UnlockCall(pCall);
  2858. if (ValidateConference(hConference) == CC_OK)
  2859. UnlockConference(pConference);
  2860. return status;
  2861. }
  2862. HRESULT _IndConference( H245_CONF_IND_T *pH245ConfIndData)
  2863. {
  2864. CC_HCALL hCall;
  2865. PCALL pCall;
  2866. PCALL pPeerCall;
  2867. PCONFERENCE pConference;
  2868. CC_HCONFERENCE hConference;
  2869. H245_TERMINAL_LABEL_T H245TerminalLabel;
  2870. PPARTICIPANTINFO pPeerParticipantInfo;
  2871. HRESULT status;
  2872. CC_HCALL hVirtualCall;
  2873. PCALL pVirtualCall;
  2874. CC_PEER_ADD_CALLBACK_PARAMS PeerAddCallbackParams;
  2875. CC_PEER_DROP_CALLBACK_PARAMS PeerDropCallbackParams;
  2876. CC_H245_CONFERENCE_INDICATION_CALLBACK_PARAMS H245ConferenceIndicationCallbackParams;
  2877. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  2878. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  2879. return H245_ERROR_OK;
  2880. hConference = pConference->hConference;
  2881. switch (pH245ConfIndData->u.Indication.u.IndConfer.IndicationType) {
  2882. case H245_IND_TERMINAL_NUMBER_ASSIGN:
  2883. if (pConference->tsMultipointController == TS_FALSE) {
  2884. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bMCUNumber =
  2885. pH245ConfIndData->u.Indication.u.IndConfer.byMcuNumber;
  2886. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber =
  2887. pH245ConfIndData->u.Indication.u.IndConfer.byTerminalNumber;
  2888. hConference = pConference->hConference;
  2889. // Generate a CC_TERMINAL_NUMBER_ASSIGN callback
  2890. InvokeUserConferenceCallback(pConference,
  2891. CC_TERMINAL_NUMBER_INDICATION,
  2892. CC_OK,
  2893. &pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel);
  2894. if (ValidateConference(hConference) == CC_OK)
  2895. UnlockConference(pConference);
  2896. UnlockCall(pCall);
  2897. return H245_ERROR_OK;
  2898. }
  2899. status = H245_ERROR_OK;
  2900. break;
  2901. case H245_IND_TERMINAL_JOINED:
  2902. if (pConference->tsMultipointController == TS_FALSE) {
  2903. if ((pH245ConfIndData->u.Indication.u.IndConfer.byMcuNumber ==
  2904. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bMCUNumber) &&
  2905. (pH245ConfIndData->u.Indication.u.IndConfer.byTerminalNumber ==
  2906. pConference->LocalParticipantInfo.ParticipantInfo.TerminalLabel.bTerminalNumber)) {
  2907. // This message refers to us
  2908. status = H245_ERROR_OK;
  2909. break;
  2910. }
  2911. H245TerminalLabel.mcuNumber = pH245ConfIndData->u.Indication.u.IndConfer.byMcuNumber;
  2912. H245TerminalLabel.terminalNumber = pH245ConfIndData->u.Indication.u.IndConfer.byTerminalNumber;
  2913. FindPeerParticipantInfo(H245TerminalLabel,
  2914. pConference,
  2915. VIRTUAL_CALL,
  2916. &pPeerCall);
  2917. if (pPeerCall != NULL) {
  2918. // We already know this peer's terminal label, and we
  2919. // eithet know its terminal ID or we have a pending request
  2920. // to obtain it
  2921. UnlockCall(pPeerCall);
  2922. status = H245_ERROR_OK;
  2923. break;
  2924. }
  2925. // We don't know about this peer.
  2926. // Create a virtual call object for it, and issue a request
  2927. // for its terminal ID
  2928. status = AllocAndLockCall(&hVirtualCall,
  2929. pConference->hConference,
  2930. CC_INVALID_HANDLE, // hQ931Call
  2931. CC_INVALID_HANDLE, // hQ931CallInvitor,
  2932. NULL, // pLocalAliasNames,
  2933. NULL, // pPeerAliasNames,
  2934. NULL, // pPeerExtraAliasNames
  2935. NULL, // pPeerExtension
  2936. NULL, // pLocalNonStandardData,
  2937. NULL, // pPeerNonStandardData,
  2938. NULL, // pszLocalDisplay,
  2939. NULL, // pszPeerDisplay,
  2940. NULL, // pPeerVendorInfo,
  2941. NULL, // pQ931LocalConnectAddr,
  2942. NULL, // pQ931PeerConnectAddr,
  2943. NULL, // pQ931DestinationAddr,
  2944. NULL, // pSourceCallSignalAddress
  2945. VIRTUAL, // CallType,
  2946. FALSE, // bCallerIsMC,
  2947. 0, // dwUserToken,
  2948. CALL_COMPLETE, // InitialCallState,
  2949. NULL, // no CallIdentifier
  2950. &pConference->ConferenceID,
  2951. &pVirtualCall);
  2952. if (status == CC_OK) {
  2953. status = AllocatePeerParticipantInfo(NULL,
  2954. &pPeerParticipantInfo);
  2955. if (status == CC_OK) {
  2956. pVirtualCall->pPeerParticipantInfo =
  2957. pPeerParticipantInfo;
  2958. pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bMCUNumber =
  2959. (BYTE)H245TerminalLabel.mcuNumber;
  2960. pPeerParticipantInfo->ParticipantInfo.TerminalLabel.bTerminalNumber =
  2961. (BYTE)H245TerminalLabel.terminalNumber;
  2962. AddVirtualCallToConference(pVirtualCall,
  2963. pConference);
  2964. // Send RequestTerminalID
  2965. H245ConferenceRequest(pCall->H245Instance,
  2966. H245_REQ_TERMINAL_ID,
  2967. (BYTE)H245TerminalLabel.mcuNumber,
  2968. (BYTE)H245TerminalLabel.terminalNumber);
  2969. pPeerParticipantInfo->TerminalIDState = TERMINAL_ID_REQUESTED;
  2970. // Generate PEER_ADD callback
  2971. PeerAddCallbackParams.hCall = hVirtualCall;
  2972. PeerAddCallbackParams.TerminalLabel =
  2973. pVirtualCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  2974. PeerAddCallbackParams.pPeerTerminalID = NULL;
  2975. InvokeUserConferenceCallback(pConference,
  2976. CC_PEER_ADD_INDICATION,
  2977. CC_OK,
  2978. &PeerAddCallbackParams);
  2979. if (ValidateCall(hVirtualCall) == CC_OK)
  2980. UnlockCall(pVirtualCall);
  2981. if (ValidateConference(hConference) == CC_OK)
  2982. UnlockConference(pConference);
  2983. UnlockCall(pCall);
  2984. return H245_ERROR_OK;
  2985. } else
  2986. FreeCall(pVirtualCall);
  2987. }
  2988. }
  2989. status = H245_ERROR_OK;
  2990. break;
  2991. case H245_IND_TERMINAL_LEFT:
  2992. if (pConference->tsMultipointController == TS_FALSE) {
  2993. H245TerminalLabel.mcuNumber = pH245ConfIndData->u.Indication.u.IndConfer.byMcuNumber;
  2994. H245TerminalLabel.terminalNumber = pH245ConfIndData->u.Indication.u.IndConfer.byTerminalNumber;
  2995. status = FindPeerParticipantInfo(H245TerminalLabel,
  2996. pConference,
  2997. VIRTUAL_CALL,
  2998. &pVirtualCall);
  2999. if (status == CC_OK) {
  3000. ASSERT(pVirtualCall != NULL);
  3001. ASSERT(pVirtualCall->pPeerParticipantInfo != NULL);
  3002. // Save the virtual call handle; we'll need to validate the virtual
  3003. // call object after returning from the conference callback
  3004. hVirtualCall = pVirtualCall->hCall;
  3005. PeerDropCallbackParams.hCall = hVirtualCall;
  3006. PeerDropCallbackParams.TerminalLabel = pVirtualCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  3007. if (pVirtualCall->pPeerParticipantInfo->TerminalIDState == TERMINAL_ID_VALID)
  3008. PeerDropCallbackParams.pPeerTerminalID = &pVirtualCall->pPeerParticipantInfo->ParticipantInfo.TerminalID;
  3009. else
  3010. PeerDropCallbackParams.pPeerTerminalID = NULL;
  3011. } else {
  3012. // Set pVirtualCall to NULL to indicate that we don't have
  3013. // a virtual call object that needs to be free'd up later
  3014. pVirtualCall = NULL;
  3015. PeerDropCallbackParams.hCall = CC_INVALID_HANDLE;
  3016. PeerDropCallbackParams.TerminalLabel.bMCUNumber = pH245ConfIndData->u.Indication.u.IndConfer.byMcuNumber;
  3017. PeerDropCallbackParams.TerminalLabel.bTerminalNumber = pH245ConfIndData->u.Indication.u.IndConfer.byTerminalNumber;
  3018. PeerDropCallbackParams.pPeerTerminalID = NULL;
  3019. }
  3020. hConference = pConference->hConference;
  3021. // Generate a CC_PEER_DROP_INDICATION callback
  3022. InvokeUserConferenceCallback(pConference,
  3023. CC_PEER_DROP_INDICATION,
  3024. CC_OK,
  3025. &PeerDropCallbackParams);
  3026. if (ValidateConference(hConference) == CC_OK)
  3027. UnlockConference(pConference);
  3028. // Check to see if we have a virtual call object that needs to be free'd up
  3029. if (pVirtualCall != NULL)
  3030. if (ValidateCall(hVirtualCall) == CC_OK)
  3031. FreeCall(pVirtualCall);
  3032. UnlockCall(pCall);
  3033. return H245_ERROR_OK;
  3034. }
  3035. status = H245_ERROR_OK;
  3036. break;
  3037. default:
  3038. H245ConferenceIndicationCallbackParams.hCall = hCall;
  3039. if (pCall->pPeerParticipantInfo == NULL) {
  3040. H245ConferenceIndicationCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  3041. H245ConferenceIndicationCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  3042. } else
  3043. H245ConferenceIndicationCallbackParams.InitiatorTerminalLabel =
  3044. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  3045. H245ConferenceIndicationCallbackParams.IndicationType =
  3046. pH245ConfIndData->u.Indication.u.IndConfer.IndicationType;
  3047. H245ConferenceIndicationCallbackParams.bSBENumber =
  3048. pH245ConfIndData->u.Indication.u.IndConfer.bySbeNumber;
  3049. H245ConferenceIndicationCallbackParams.TerminalLabel.bMCUNumber =
  3050. pH245ConfIndData->u.Indication.u.IndConfer.byMcuNumber;
  3051. H245ConferenceIndicationCallbackParams.TerminalLabel.bTerminalNumber =
  3052. pH245ConfIndData->u.Indication.u.IndConfer.byTerminalNumber;
  3053. status = InvokeUserConferenceCallback(pConference,
  3054. CC_H245_CONFERENCE_INDICATION_INDICATION,
  3055. CC_OK,
  3056. &H245ConferenceIndicationCallbackParams);
  3057. if (status != CC_OK)
  3058. status = H245_ERROR_NOSUP;
  3059. break;
  3060. }
  3061. if (ValidateCall(hCall) == CC_OK)
  3062. UnlockCall(pCall);
  3063. if (ValidateConference(hConference) == CC_OK)
  3064. UnlockConference(pConference);
  3065. return status;
  3066. }
  3067. HRESULT _IndCommunicationModeCommand(
  3068. H245_CONF_IND_T *pH245ConfIndData)
  3069. {
  3070. CC_HCALL hCall;
  3071. PCALL pCall;
  3072. CC_HCONFERENCE hConference;
  3073. PCONFERENCE pConference;
  3074. CC_MULTIPOINT_CALLBACK_PARAMS MultipointCallbackParams;
  3075. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  3076. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  3077. return H245_ERROR_OK;
  3078. if (pConference->tsMultipointController == TS_TRUE) {
  3079. UnlockCall(pCall);
  3080. UnlockConference(pConference);
  3081. return H245_ERROR_OK;
  3082. }
  3083. hConference = pConference->hConference;
  3084. // Destroy the old session table
  3085. FreeConferenceSessionTable(pConference);
  3086. H245CommunicationTableToSessionTable(
  3087. pH245ConfIndData->u.Indication.u.IndCommRsp.pTable,
  3088. pH245ConfIndData->u.Indication.u.IndCommRsp.byTableCount,
  3089. &pConference->pSessionTable);
  3090. pConference->bSessionTableInternallyConstructed = TRUE;
  3091. // Generate MULTIPOINT callback
  3092. MultipointCallbackParams.pTerminalInfo = &pConference->LocalParticipantInfo.ParticipantInfo;
  3093. MultipointCallbackParams.pSessionTable = pConference->pSessionTable;
  3094. InvokeUserConferenceCallback(pConference,
  3095. CC_MULTIPOINT_INDICATION,
  3096. CC_OK,
  3097. &MultipointCallbackParams);
  3098. if (ValidateCall(hCall) == CC_OK)
  3099. UnlockCall(pCall);
  3100. if (ValidateConference(hConference) == CC_OK)
  3101. UnlockConference(pConference);
  3102. return H245_ERROR_OK;
  3103. }
  3104. HRESULT _IndVendorIdentification( H245_CONF_IND_T *pH245ConfIndData,
  3105. VendorIdentification *pVendorIdentification)
  3106. {
  3107. CC_HCALL hCall;
  3108. PCALL pCall;
  3109. CC_HCONFERENCE hConference;
  3110. PCONFERENCE pConference;
  3111. CC_NONSTANDARDDATA NonStandardData;
  3112. CC_OCTETSTRING ProductNumber;
  3113. CC_OCTETSTRING VersionNumber;
  3114. CC_VENDOR_ID_CALLBACK_PARAMS VendorIDCallbackParams;
  3115. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  3116. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  3117. return H245_ERROR_OK;
  3118. hConference = pConference->hConference;
  3119. VendorIDCallbackParams.hCall = hCall;
  3120. if (pCall->pPeerParticipantInfo == NULL) {
  3121. VendorIDCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  3122. VendorIDCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  3123. } else
  3124. VendorIDCallbackParams.InitiatorTerminalLabel =
  3125. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  3126. if (pVendorIdentification->vendor.choice == h221NonStandard_chosen) {
  3127. NonStandardData.sData.pOctetString = NULL;
  3128. NonStandardData.sData.wOctetStringLength = 0;
  3129. NonStandardData.bCountryCode = (BYTE)pVendorIdentification->vendor.u.h221NonStandard.t35CountryCode;
  3130. NonStandardData.bExtension = (BYTE)pVendorIdentification->vendor.u.h221NonStandard.t35Extension;
  3131. NonStandardData.wManufacturerCode = pVendorIdentification->vendor.u.h221NonStandard.manufacturerCode;
  3132. VendorIDCallbackParams.pNonStandardData = &NonStandardData;
  3133. } else
  3134. VendorIDCallbackParams.pNonStandardData = NULL;
  3135. if (pVendorIdentification->bit_mask & productNumber_present) {
  3136. ProductNumber.pOctetString =
  3137. pVendorIdentification->productNumber.value;
  3138. ProductNumber.wOctetStringLength = (WORD)
  3139. pVendorIdentification->productNumber.length;
  3140. VendorIDCallbackParams.pProductNumber = &ProductNumber;
  3141. } else
  3142. VendorIDCallbackParams.pProductNumber = NULL;
  3143. if (pVendorIdentification->bit_mask & versionNumber_present) {
  3144. VersionNumber.pOctetString =
  3145. pVendorIdentification->versionNumber.value;
  3146. VersionNumber.wOctetStringLength = (WORD)
  3147. pVendorIdentification->versionNumber.length;
  3148. VendorIDCallbackParams.pVersionNumber = &VersionNumber;
  3149. } else
  3150. VendorIDCallbackParams.pVersionNumber = NULL;
  3151. InvokeUserConferenceCallback(pConference,
  3152. CC_VENDOR_ID_INDICATION,
  3153. CC_OK,
  3154. &VendorIDCallbackParams);
  3155. if (ValidateCall(hCall) == CC_OK)
  3156. UnlockCall(pCall);
  3157. if (ValidateConference(hConference) == CC_OK)
  3158. UnlockConference(pConference);
  3159. return H245_ERROR_OK;
  3160. }
  3161. HRESULT _IndH2250MaximumSkew( H245_CONF_IND_T *pH245ConfIndData)
  3162. {
  3163. HRESULT status;
  3164. CC_HCONFERENCE hConference;
  3165. PCONFERENCE pConference;
  3166. CC_HCALL hCall;
  3167. PCC_HCALL CallList;
  3168. WORD wNumCalls;
  3169. WORD i;
  3170. PCALL pCall;
  3171. PCALL pOldCall;
  3172. CC_HCHANNEL hChannel1;
  3173. PCHANNEL pChannel1;
  3174. CC_HCHANNEL hChannel2;
  3175. PCHANNEL pChannel2;
  3176. CC_MAXIMUM_AUDIO_VIDEO_SKEW_CALLBACK_PARAMS MaximumAudioVideoSkewCallbackParams;
  3177. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  3178. status = LockCallAndConference(hCall, &pCall, &pConference);
  3179. if (status != CC_OK) {
  3180. // This may be OK, if the call was cancelled while
  3181. // call setup was in progress.
  3182. return H245_ERROR_OK;
  3183. }
  3184. hConference = pCall->hConference;
  3185. UnlockCall(pCall);
  3186. if (FindChannelInConference(pH245ConfIndData->u.Indication.u.IndH2250MaxSkew.LogicalChannelNumber1,
  3187. FALSE, // remote channel number
  3188. RX_CHANNEL | PROXY_CHANNEL,
  3189. hCall,
  3190. &hChannel1,
  3191. pConference) != CC_OK) {
  3192. UnlockConference(pConference);
  3193. return H245_ERROR_OK;
  3194. }
  3195. if (LockChannel(hChannel1, &pChannel1) != CC_OK) {
  3196. UnlockConference(pConference);
  3197. return H245_ERROR_OK;
  3198. }
  3199. if (pChannel1->bChannelType == RX_CHANNEL) {
  3200. UnlockChannel(pChannel1);
  3201. if (FindChannelInConference(pH245ConfIndData->u.Indication.u.IndH2250MaxSkew.LogicalChannelNumber2,
  3202. FALSE, // remote channel number
  3203. RX_CHANNEL,
  3204. hCall,
  3205. &hChannel2,
  3206. pConference) != CC_OK) {
  3207. UnlockConference(pConference);
  3208. return H245_ERROR_OK;
  3209. }
  3210. if (LockChannel(hChannel2, &pChannel2) != CC_OK) {
  3211. UnlockConference(pConference);
  3212. return H245_ERROR_OK;
  3213. }
  3214. if (pChannel2->bChannelType != RX_CHANNEL) {
  3215. UnlockChannel(pChannel2);
  3216. UnlockConference(pConference);
  3217. return H245_ERROR_OK;
  3218. }
  3219. UnlockChannel(pChannel2);
  3220. MaximumAudioVideoSkewCallbackParams.hChannel1 = hChannel1;
  3221. MaximumAudioVideoSkewCallbackParams.hChannel2 = hChannel2;
  3222. MaximumAudioVideoSkewCallbackParams.wMaximumSkew =
  3223. pH245ConfIndData->u.Indication.u.IndH2250MaxSkew.wSkew;
  3224. InvokeUserConferenceCallback(pConference,
  3225. CC_MAXIMUM_AUDIO_VIDEO_SKEW_INDICATION,
  3226. CC_OK,
  3227. &MaximumAudioVideoSkewCallbackParams);
  3228. if (ValidateConference(hConference) == CC_OK)
  3229. UnlockConference(pConference);
  3230. } else { // pChannel1->bChannelType == PROXY_CHANNEL
  3231. if (FindChannelInConference(pH245ConfIndData->u.Indication.u.IndH2250MaxSkew.LogicalChannelNumber2,
  3232. FALSE, // remote channel number
  3233. PROXY_CHANNEL,
  3234. hCall,
  3235. &hChannel2,
  3236. pConference) != CC_OK) {
  3237. UnlockChannel(pChannel1);
  3238. UnlockConference(pConference);
  3239. return H245_ERROR_OK;
  3240. }
  3241. if (LockChannel(hChannel2, &pChannel2) != CC_OK) {
  3242. UnlockChannel(pChannel1);
  3243. UnlockConference(pConference);
  3244. return H245_ERROR_OK;
  3245. }
  3246. if (pChannel1->hCall != pChannel2->hCall) {
  3247. UnlockChannel(pChannel1);
  3248. UnlockChannel(pChannel2);
  3249. UnlockConference(pConference);
  3250. return H245_ERROR_OK;
  3251. }
  3252. EnumerateCallsInConference(&wNumCalls, &CallList, pConference, ESTABLISHED_CALL);
  3253. for (i = 0; i < wNumCalls; i++) {
  3254. if (CallList[i] != hCall) {
  3255. if (LockCall(CallList[i], &pOldCall) == CC_OK) {
  3256. H245H2250MaximumSkewIndication(pOldCall->H245Instance,
  3257. pChannel1->wLocalChannelNumber,
  3258. pChannel2->wLocalChannelNumber,
  3259. pH245ConfIndData->u.Indication.u.IndH2250MaxSkew.wSkew);
  3260. UnlockCall(pCall);
  3261. }
  3262. }
  3263. }
  3264. if (CallList != NULL)
  3265. MemFree(CallList);
  3266. if ((pChannel1->tsAccepted == TS_TRUE) && (pChannel2->tsAccepted == TS_TRUE)) {
  3267. MaximumAudioVideoSkewCallbackParams.hChannel1 = hChannel1;
  3268. MaximumAudioVideoSkewCallbackParams.hChannel2 = hChannel2;
  3269. MaximumAudioVideoSkewCallbackParams.wMaximumSkew =
  3270. pH245ConfIndData->u.Indication.u.IndH2250MaxSkew.wSkew;
  3271. InvokeUserConferenceCallback(pConference,
  3272. CC_MAXIMUM_AUDIO_VIDEO_SKEW_INDICATION,
  3273. CC_OK,
  3274. &MaximumAudioVideoSkewCallbackParams);
  3275. }
  3276. if (ValidateChannel(hChannel1) == CC_OK)
  3277. UnlockChannel(pChannel1);
  3278. if (ValidateChannel(hChannel2) == CC_OK)
  3279. UnlockChannel(pChannel2);
  3280. if (ValidateConference(hConference) == CC_OK)
  3281. UnlockConference(pConference);
  3282. }
  3283. return H245_ERROR_OK;
  3284. }
  3285. HRESULT _IndUserInput( H245_CONF_IND_T *pH245ConfIndData)
  3286. {
  3287. return H245_ERROR_OK;
  3288. }
  3289. HRESULT _IndSendTerminalCapabilitySet(
  3290. H245_CONF_IND_T *pH245ConfIndData)
  3291. {
  3292. HRESULT status;
  3293. CC_HCALL hCall;
  3294. PCALL pCall;
  3295. PCONFERENCE pConference;
  3296. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  3297. status = LockCallAndConference(hCall, &pCall, &pConference);
  3298. if (status != CC_OK) {
  3299. // This may be OK, if the call was cancelled while
  3300. // call setup was in progress.
  3301. return H245_ERROR_OK;
  3302. }
  3303. SendTermCaps(pCall, pConference);
  3304. UnlockCall(pCall);
  3305. UnlockConference(pConference);
  3306. return H245_ERROR_OK;
  3307. }
  3308. HRESULT _IndModeRequest( H245_CONF_IND_T *pH245ConfIndData)
  3309. {
  3310. HRESULT status;
  3311. CC_HCALL hCall;
  3312. PCALL pCall;
  3313. CC_HCONFERENCE hConference;
  3314. PCONFERENCE pConference;
  3315. CC_REQUEST_MODE_CALLBACK_PARAMS RequestModeCallbackParams;
  3316. hCall = pH245ConfIndData->u.Indication.dwPreserved;
  3317. status = LockCallAndConference(hCall, &pCall, &pConference);
  3318. if (status != CC_OK) {
  3319. // This may be OK, if the call was cancelled while
  3320. // call setup was in progress.
  3321. return H245_ERROR_OK;
  3322. }
  3323. hConference = pConference->hConference;
  3324. EnqueueRequest(&pConference->pEnqueuedRequestModeCalls, hCall);
  3325. RequestModeCallbackParams.hCall = hCall;
  3326. if (pCall->pPeerParticipantInfo == NULL) {
  3327. RequestModeCallbackParams.InitiatorTerminalLabel.bMCUNumber = 255;
  3328. RequestModeCallbackParams.InitiatorTerminalLabel.bTerminalNumber = 255;
  3329. } else
  3330. RequestModeCallbackParams.InitiatorTerminalLabel =
  3331. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  3332. RequestModeCallbackParams.pRequestedModes =
  3333. pH245ConfIndData->u.Indication.u.IndMrse.pRequestedModes;
  3334. InvokeUserConferenceCallback(pConference,
  3335. CC_REQUEST_MODE_INDICATION,
  3336. CC_OK,
  3337. &RequestModeCallbackParams);
  3338. if (ValidateCall(hCall) == CC_OK)
  3339. UnlockCall(pCall);
  3340. if (ValidateConference(hConference) == CC_OK)
  3341. UnlockConference(pConference);
  3342. return H245_ERROR_OK;
  3343. }
  3344. HRESULT _ConfUnimplemented( H245_CONF_IND_T *pH245ConfIndData)
  3345. {
  3346. return H245_ERROR_NOSUP;
  3347. }
  3348. HRESULT _ConfBiDirectionalOpen( H245_CONF_IND_T *pH245ConfIndData)
  3349. {
  3350. CC_HCALL hCall;
  3351. CC_HCHANNEL hChannel;
  3352. CC_HCONFERENCE hConference;
  3353. PCHANNEL pChannel;
  3354. PCONFERENCE pConference;
  3355. BOOL bAccept;
  3356. HRESULT status;
  3357. CC_ADDR T120Addr;
  3358. CC_OCTETSTRING ExternalReference;
  3359. CC_T120_CHANNEL_OPEN_CALLBACK_PARAMS T120ChannelOpenCallbackParams;
  3360. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  3361. if (hCall == CC_INVALID_HANDLE)
  3362. return H245_ERROR_OK;
  3363. hChannel = pH245ConfIndData->u.Confirm.dwTransId;
  3364. if (hChannel == CC_INVALID_HANDLE)
  3365. return H245_ERROR_OK;
  3366. if (LockChannelAndConference(hChannel, &pChannel, &pConference) != CC_OK)
  3367. return H245_ERROR_OK;
  3368. hConference = pConference->hConference;
  3369. if (pChannel->bChannelType != TXRX_CHANNEL) {
  3370. UnlockChannel(pChannel);
  3371. UnlockConference(pConference);
  3372. return H245_ERROR_OK;
  3373. }
  3374. if ((pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.AccRej == H245_ACC) &&
  3375. (pH245ConfIndData->u.Confirm.Error == H245_ERROR_OK)) {
  3376. pChannel->wNumOutstandingRequests = 0;
  3377. bAccept = TRUE;
  3378. } else {
  3379. (pChannel->wNumOutstandingRequests)--;
  3380. bAccept = FALSE;
  3381. }
  3382. T120ChannelOpenCallbackParams.hChannel = hChannel;
  3383. T120ChannelOpenCallbackParams.hCall = hCall;
  3384. T120ChannelOpenCallbackParams.dwUserToken = pChannel->dwUserToken;
  3385. T120ChannelOpenCallbackParams.dwRejectReason = 0;
  3386. if (bAccept) {
  3387. status = CC_OK;
  3388. if (pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.pSeparateStack) {
  3389. if ((pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.pSeparateStack->networkAddress.choice == localAreaAddress_chosen) &&
  3390. (pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.pSeparateStack->networkAddress.u.localAreaAddress.choice == unicastAddress_chosen) &&
  3391. (pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.pSeparateStack->networkAddress.u.localAreaAddress.u.unicastAddress.choice == UnicastAddress_iPAddress_chosen)) {
  3392. T120Addr.nAddrType = CC_IP_BINARY;
  3393. T120Addr.bMulticast = FALSE;
  3394. T120Addr.Addr.IP_Binary.wPort =
  3395. pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.pSeparateStack->networkAddress.u.localAreaAddress.u.unicastAddress.u.UnicastAddress_iPAddress.tsapIdentifier;
  3396. H245IPNetworkToHost(&T120Addr.Addr.IP_Binary.dwAddr,
  3397. pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.pSeparateStack->networkAddress.u.localAreaAddress.u.unicastAddress.u.UnicastAddress_iPAddress.network.value);
  3398. T120ChannelOpenCallbackParams.pAddr = &T120Addr;
  3399. } else {
  3400. T120ChannelOpenCallbackParams.pAddr = NULL;
  3401. }
  3402. T120ChannelOpenCallbackParams.bAssociateConference =
  3403. pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.pSeparateStack->associateConference;
  3404. if (pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.pSeparateStack->bit_mask & externalReference_present) {
  3405. ExternalReference.wOctetStringLength = (WORD)
  3406. pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.pSeparateStack->externalReference.length;
  3407. ExternalReference.pOctetString =
  3408. pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.pSeparateStack->externalReference.value;
  3409. T120ChannelOpenCallbackParams.pExternalReference = &ExternalReference;
  3410. } else
  3411. T120ChannelOpenCallbackParams.pExternalReference = NULL;
  3412. } else {
  3413. T120ChannelOpenCallbackParams.pAddr = NULL;
  3414. T120ChannelOpenCallbackParams.bAssociateConference = FALSE;
  3415. T120ChannelOpenCallbackParams.pExternalReference = NULL;
  3416. }
  3417. } else { // bAccept == FALSE
  3418. if (pH245ConfIndData->u.Confirm.Error == H245_ERROR_OK)
  3419. status = CC_PEER_REJECT;
  3420. else
  3421. status = pH245ConfIndData->u.Confirm.Error;
  3422. T120ChannelOpenCallbackParams.pAddr = NULL;
  3423. T120ChannelOpenCallbackParams.bAssociateConference = FALSE;
  3424. T120ChannelOpenCallbackParams.pExternalReference = NULL;
  3425. T120ChannelOpenCallbackParams.dwRejectReason =
  3426. pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.AccRej;
  3427. }
  3428. InvokeUserConferenceCallback(pConference,
  3429. CC_T120_CHANNEL_OPEN_INDICATION,
  3430. status,
  3431. &T120ChannelOpenCallbackParams);
  3432. if (ValidateChannel(hChannel) == CC_OK)
  3433. if (bAccept)
  3434. UnlockChannel(pChannel);
  3435. else
  3436. FreeChannel(pChannel);
  3437. if (ValidateConference(hConference) == CC_OK)
  3438. UnlockConference(pConference);
  3439. return H245_ERROR_OK;
  3440. }
  3441. HRESULT _ConfOpenT120( H245_CONF_IND_T *pH245ConfIndData)
  3442. {
  3443. CC_HCALL hCall;
  3444. CC_HCHANNEL hChannel;
  3445. CC_HCONFERENCE hConference;
  3446. PCHANNEL pChannel;
  3447. PCONFERENCE pConference;
  3448. HRESULT status;
  3449. CC_T120_CHANNEL_OPEN_CALLBACK_PARAMS T120ChannelOpenCallbackParams;
  3450. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  3451. if (hCall == CC_INVALID_HANDLE)
  3452. return H245_ERROR_OK;
  3453. hChannel = pH245ConfIndData->u.Confirm.dwTransId;
  3454. if (hChannel == CC_INVALID_HANDLE)
  3455. return H245_ERROR_OK;
  3456. if (LockChannelAndConference(hChannel, &pChannel, &pConference) != CC_OK)
  3457. return H245_ERROR_OK;
  3458. hConference = pConference->hConference;
  3459. if (pChannel->bChannelType != TXRX_CHANNEL) {
  3460. UnlockChannel(pChannel);
  3461. UnlockConference(pConference);
  3462. return H245_ERROR_OK;
  3463. }
  3464. if ((pH245ConfIndData->u.Confirm.u.ConfOpen.AccRej == H245_ACC) &&
  3465. (pH245ConfIndData->u.Confirm.Error == H245_ERROR_OK)) {
  3466. // We expect to get a ConfOpenNeedRsp callback for this case;
  3467. // Since we're not sure how we got here, just bail out
  3468. UnlockChannel(pChannel);
  3469. UnlockConference(pConference);
  3470. return H245_ERROR_OK;
  3471. }
  3472. T120ChannelOpenCallbackParams.hChannel = hChannel;
  3473. T120ChannelOpenCallbackParams.hCall = hCall;
  3474. T120ChannelOpenCallbackParams.dwUserToken = pChannel->dwUserToken;
  3475. if (pH245ConfIndData->u.Confirm.Error == H245_ERROR_OK)
  3476. status = CC_PEER_REJECT;
  3477. else
  3478. status = pH245ConfIndData->u.Confirm.Error;
  3479. T120ChannelOpenCallbackParams.pAddr = NULL;
  3480. T120ChannelOpenCallbackParams.bAssociateConference = FALSE;
  3481. T120ChannelOpenCallbackParams.pExternalReference = NULL;
  3482. T120ChannelOpenCallbackParams.dwRejectReason =
  3483. pH245ConfIndData->u.Confirm.u.ConfOpenNeedRsp.AccRej;
  3484. InvokeUserConferenceCallback(pConference,
  3485. CC_T120_CHANNEL_OPEN_INDICATION,
  3486. status,
  3487. &T120ChannelOpenCallbackParams);
  3488. if (ValidateChannel(hChannel) == CC_OK)
  3489. FreeChannel(pChannel);
  3490. if (ValidateConference(hConference) == CC_OK)
  3491. UnlockConference(pConference);
  3492. return H245_ERROR_OK;
  3493. }
  3494. HRESULT _ConfOpen( H245_CONF_IND_T *pH245ConfIndData)
  3495. {
  3496. HRESULT status;
  3497. CC_ADDR PeerRTPAddr;
  3498. PCC_ADDR pPeerRTPAddr;
  3499. CC_ADDR PeerRTCPAddr;
  3500. PCC_ADDR pPeerRTCPAddr;
  3501. CC_HCHANNEL hChannel;
  3502. PCHANNEL pChannel;
  3503. CC_HCONFERENCE hConference;
  3504. PCONFERENCE pConference;
  3505. CC_TX_CHANNEL_OPEN_CALLBACK_PARAMS TxChannelOpenCallbackParams;
  3506. PCALL pCall;
  3507. BOOL bAccept;
  3508. H245_MUX_T H245MuxTable;
  3509. WORD i;
  3510. #ifdef GATEKEEPER
  3511. unsigned uBandwidth;
  3512. WORD wNumCalls;
  3513. PCC_HCALL CallList;
  3514. #endif // GATEKEEPER
  3515. // a channel was opened
  3516. hChannel = pH245ConfIndData->u.Confirm.dwTransId;
  3517. if (hChannel == CC_INVALID_HANDLE)
  3518. return H245_ERROR_OK;
  3519. if (LockChannelAndConference(hChannel, &pChannel, &pConference) != CC_OK)
  3520. return H245_ERROR_OK;
  3521. if (pChannel->bChannelType == TXRX_CHANNEL) {
  3522. UnlockChannel(pChannel);
  3523. UnlockConference(pConference);
  3524. return _ConfOpenT120(pH245ConfIndData);
  3525. }
  3526. hConference = pConference->hConference;
  3527. if (pChannel->wNumOutstandingRequests == 0) {
  3528. UnlockChannel(pChannel);
  3529. UnlockConference(pConference);
  3530. return H245_ERROR_OK;
  3531. }
  3532. if ((pH245ConfIndData->u.Confirm.u.ConfOpen.AccRej == H245_ACC) &&
  3533. (pH245ConfIndData->u.Confirm.Error == H245_ERROR_OK)) {
  3534. pChannel->wNumOutstandingRequests = 0;
  3535. bAccept = TRUE;
  3536. } else {
  3537. (pChannel->wNumOutstandingRequests)--;
  3538. bAccept = FALSE;
  3539. #ifdef GATEKEEPER
  3540. if(GKIExists())
  3541. {
  3542. uBandwidth = pChannel->dwChannelBitRate / 100;
  3543. if (uBandwidth != 0 && pChannel->bChannelType != TXRX_CHANNEL)
  3544. {
  3545. EnumerateCallsInConference(&wNumCalls, &CallList, pConference, ESTABLISHED_CALL);
  3546. for (i = 0; i < wNumCalls; ++i)
  3547. {
  3548. if (LockCall(CallList[i], &pCall) == CC_OK)
  3549. {
  3550. if (pCall->GkiCall.uBandwidthUsed >= uBandwidth)
  3551. {
  3552. if (GkiCloseChannel(&pCall->GkiCall, pChannel->dwChannelBitRate, hChannel) == CC_OK)
  3553. {
  3554. UnlockCall(pCall);
  3555. break;
  3556. }
  3557. }
  3558. UnlockCall(pCall);
  3559. }
  3560. } // for
  3561. if (CallList != NULL)
  3562. MemFree(CallList);
  3563. }
  3564. }
  3565. #endif // GATEKEEPER
  3566. }
  3567. if (pChannel->wNumOutstandingRequests == 0) {
  3568. if (pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux == NULL) {
  3569. pPeerRTPAddr = NULL;
  3570. pPeerRTCPAddr = NULL;
  3571. } else {
  3572. ASSERT(pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->Kind == H245_H2250ACK);
  3573. if ((pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaChannelPresent) &&
  3574. ((pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaChannel.type == H245_IP_MULTICAST) ||
  3575. (pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaChannel.type == H245_IP_UNICAST))) {
  3576. pPeerRTPAddr = &PeerRTPAddr;
  3577. PeerRTPAddr.nAddrType = CC_IP_BINARY;
  3578. if (pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaChannel.type == H245_IP_MULTICAST)
  3579. PeerRTPAddr.bMulticast = TRUE;
  3580. else
  3581. PeerRTPAddr.bMulticast = FALSE;
  3582. H245IPNetworkToHost(&PeerRTPAddr.Addr.IP_Binary.dwAddr,
  3583. pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaChannel.u.ip.network);
  3584. PeerRTPAddr.Addr.IP_Binary.wPort =
  3585. pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaChannel.u.ip.tsapIdentifier;
  3586. } else
  3587. pPeerRTPAddr = NULL;
  3588. if ((pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaControlChannelPresent) &&
  3589. ((pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaControlChannel.type == H245_IP_MULTICAST) ||
  3590. (pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaControlChannel.type == H245_IP_UNICAST))) {
  3591. pPeerRTCPAddr = &PeerRTCPAddr;
  3592. PeerRTCPAddr.nAddrType = CC_IP_BINARY;
  3593. if (pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaControlChannel.type == H245_IP_MULTICAST)
  3594. PeerRTCPAddr.bMulticast = TRUE;
  3595. else
  3596. PeerRTCPAddr.bMulticast = FALSE;
  3597. H245IPNetworkToHost(&PeerRTCPAddr.Addr.IP_Binary.dwAddr,
  3598. pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaControlChannel.u.ip.network);
  3599. PeerRTCPAddr.Addr.IP_Binary.wPort =
  3600. pH245ConfIndData->u.Confirm.u.ConfOpen.pTxMux->u.H2250ACK.mediaControlChannel.u.ip.tsapIdentifier;
  3601. } else
  3602. pPeerRTCPAddr = NULL;
  3603. }
  3604. if ((pPeerRTPAddr == NULL) || (pPeerRTCPAddr == NULL)) {
  3605. if (pConference->pSessionTable != NULL) {
  3606. for (i = 0; i < pConference->pSessionTable->wLength; i++) {
  3607. if (pConference->pSessionTable->SessionInfoArray[i].bSessionID ==
  3608. pChannel->bSessionID) {
  3609. if (pPeerRTPAddr == NULL)
  3610. pPeerRTPAddr = pConference->pSessionTable->SessionInfoArray[i].pRTPAddr;
  3611. if (pPeerRTCPAddr == NULL)
  3612. pPeerRTCPAddr = pConference->pSessionTable->SessionInfoArray[i].pRTCPAddr;
  3613. break;
  3614. }
  3615. }
  3616. }
  3617. }
  3618. if ((pChannel->pPeerRTPAddr == NULL) && (pPeerRTPAddr != NULL))
  3619. CopyAddr(&pChannel->pPeerRTPAddr, pPeerRTPAddr);
  3620. if ((pChannel->pPeerRTCPAddr == NULL) && (pPeerRTCPAddr != NULL))
  3621. CopyAddr(&pChannel->pPeerRTCPAddr, pPeerRTCPAddr);
  3622. if (pChannel->bChannelType == PROXY_CHANNEL) {
  3623. if (LockCall(pChannel->hCall, &pCall) == CC_OK) {
  3624. if (bAccept) {
  3625. H245MuxTable.Kind = H245_H2250ACK;
  3626. H245MuxTable.u.H2250ACK.nonStandardList = NULL;
  3627. if (pPeerRTPAddr != NULL) {
  3628. if (pPeerRTPAddr->bMulticast)
  3629. H245MuxTable.u.H2250ACK.mediaChannel.type = H245_IP_MULTICAST;
  3630. else
  3631. H245MuxTable.u.H2250ACK.mediaChannel.type = H245_IP_UNICAST;
  3632. H245MuxTable.u.H2250ACK.mediaChannel.u.ip.tsapIdentifier =
  3633. pPeerRTPAddr->Addr.IP_Binary.wPort;
  3634. HostToH245IPNetwork(H245MuxTable.u.H2250ACK.mediaChannel.u.ip.network,
  3635. pPeerRTPAddr->Addr.IP_Binary.dwAddr);
  3636. H245MuxTable.u.H2250ACK.mediaChannelPresent = TRUE;
  3637. } else
  3638. H245MuxTable.u.H2250ACK.mediaChannelPresent = FALSE;
  3639. if (pPeerRTCPAddr != NULL) {
  3640. if (pPeerRTCPAddr->bMulticast)
  3641. H245MuxTable.u.H2250ACK.mediaControlChannel.type = H245_IP_MULTICAST;
  3642. else
  3643. H245MuxTable.u.H2250ACK.mediaControlChannel.type = H245_IP_UNICAST;
  3644. H245MuxTable.u.H2250ACK.mediaControlChannel.u.ip.tsapIdentifier =
  3645. pPeerRTCPAddr->Addr.IP_Binary.wPort;
  3646. HostToH245IPNetwork(H245MuxTable.u.H2250ACK.mediaControlChannel.u.ip.network,
  3647. pPeerRTCPAddr->Addr.IP_Binary.dwAddr);
  3648. H245MuxTable.u.H2250ACK.mediaControlChannelPresent = TRUE;
  3649. } else
  3650. H245MuxTable.u.H2250ACK.mediaControlChannelPresent = FALSE;
  3651. H245MuxTable.u.H2250ACK.dynamicRTPPayloadTypePresent = FALSE;
  3652. H245MuxTable.u.H2250ACK.sessionIDPresent = TRUE;
  3653. H245MuxTable.u.H2250ACK.sessionID = pChannel->bSessionID;
  3654. status = H245OpenChannelAccept(pCall->H245Instance,
  3655. 0, // dwTransId
  3656. pChannel->wRemoteChannelNumber, // Rx channel
  3657. &H245MuxTable,
  3658. 0, // Tx channel
  3659. NULL, // Tx mux
  3660. H245_INVALID_PORT_NUMBER,// Port
  3661. NULL);
  3662. } else { // bAccept == FALSE
  3663. status = H245OpenChannelReject(pCall->H245Instance,
  3664. pChannel->wRemoteChannelNumber, // Rx channel
  3665. (unsigned short)pH245ConfIndData->u.Confirm.u.ConfOpen.AccRej); // rejection reason
  3666. }
  3667. UnlockCall(pCall);
  3668. }
  3669. }
  3670. TxChannelOpenCallbackParams.hChannel = hChannel;
  3671. TxChannelOpenCallbackParams.pPeerRTPAddr = pPeerRTPAddr;
  3672. TxChannelOpenCallbackParams.pPeerRTCPAddr = pPeerRTCPAddr;
  3673. TxChannelOpenCallbackParams.dwUserToken = pChannel->dwUserToken;
  3674. if (bAccept) {
  3675. status = CC_OK;
  3676. TxChannelOpenCallbackParams.dwRejectReason = H245_ACC;
  3677. } else { // bAccept = FALSE
  3678. if (pH245ConfIndData->u.Confirm.Error == H245_ERROR_OK)
  3679. status = CC_PEER_REJECT;
  3680. else
  3681. status = pH245ConfIndData->u.Confirm.Error;
  3682. TxChannelOpenCallbackParams.dwRejectReason =
  3683. pH245ConfIndData->u.Confirm.u.ConfOpen.AccRej;
  3684. }
  3685. if ((pChannel->bCallbackInvoked == FALSE) &&
  3686. ((pChannel->bChannelType == TX_CHANNEL) ||
  3687. ((pChannel->bChannelType == TXRX_CHANNEL) &&
  3688. (pChannel->bLocallyOpened == TRUE)))) {
  3689. pChannel->bCallbackInvoked = TRUE;
  3690. InvokeUserConferenceCallback(pConference,
  3691. CC_TX_CHANNEL_OPEN_INDICATION,
  3692. status,
  3693. &TxChannelOpenCallbackParams);
  3694. }
  3695. if (ValidateChannel(hChannel) == CC_OK)
  3696. if (bAccept)
  3697. UnlockChannel(pChannel);
  3698. else
  3699. FreeChannel(pChannel);
  3700. } else
  3701. UnlockChannel(pChannel);
  3702. if (ValidateConference(hConference) == CC_OK)
  3703. UnlockConference(pConference);
  3704. return H245_ERROR_OK;
  3705. }
  3706. HRESULT _ConfClose( H245_CONF_IND_T *pH245ConfIndData)
  3707. {
  3708. CC_HCALL hCall;
  3709. CC_HCHANNEL hChannel;
  3710. PCHANNEL pChannel;
  3711. CC_HCONFERENCE hConference;
  3712. PCONFERENCE pConference;
  3713. PCALL pCall;
  3714. H245_ACC_REJ_T AccRej;
  3715. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  3716. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  3717. return H245_ERROR_OK;
  3718. hConference = pCall->hConference;
  3719. UnlockCall(pCall);
  3720. if (pH245ConfIndData->u.Confirm.Error != H245_ERROR_OK)
  3721. {
  3722. // TBD - Report error to Call Control client
  3723. // but wait! CC_CloseChannel() is a synchronous API! Until/unless that
  3724. // changes, the buck stops here.
  3725. if (FindChannelInConference(pH245ConfIndData->u.Confirm.u.ConfReqClose.Channel,
  3726. TRUE, // local channel number
  3727. TX_CHANNEL | PROXY_CHANNEL,
  3728. hCall,
  3729. &hChannel,
  3730. pConference) != CC_OK)
  3731. {
  3732. UnlockConference(pConference);
  3733. return H245_ERROR_OK;
  3734. }
  3735. if (LockChannel(hChannel, &pChannel) != CC_OK)
  3736. {
  3737. UnlockConference(pConference);
  3738. return H245_ERROR_OK;
  3739. }
  3740. // NOTE STOPGAP MEASURE : short term intentional "leak" of channel number.
  3741. // The channel number is actually a bit in a per-conference bitmap, so there
  3742. // is no real memory leak.
  3743. // This case is rare. The most likely error that leads here is a timeout.
  3744. // Calling FreeChannel() will normally recycle the logical channel
  3745. // number, and a new channel could reuse this number very quickly. If the error
  3746. // is a timeout, chances are that a late CloseLogicalChannelAck is on its
  3747. // way up the wire. We don't want that late CloseLogicalChannelAck to be
  3748. // associated with a completely new unrelated channel.
  3749. // set channel number to zero so that FreeChannel() does not recycle the number
  3750. pChannel->wLocalChannelNumber = 0;
  3751. FreeChannel(pChannel);
  3752. UnlockConference(pConference);
  3753. }
  3754. else
  3755. {
  3756. if(pH245ConfIndData->u.Confirm.u.ConfClose.AccRej == H245_ACC)
  3757. {
  3758. if (FindChannelInConference(pH245ConfIndData->u.Confirm.u.ConfReqClose.Channel,
  3759. TRUE, // local channel number
  3760. TX_CHANNEL | PROXY_CHANNEL,
  3761. hCall,
  3762. &hChannel,
  3763. pConference) != CC_OK)
  3764. {
  3765. UnlockConference(pConference);
  3766. return H245_ERROR_OK;
  3767. }
  3768. if (LockChannel(hChannel, &pChannel) != CC_OK)
  3769. {
  3770. UnlockConference(pConference);
  3771. return H245_ERROR_OK;
  3772. }
  3773. FreeChannel(pChannel);
  3774. UnlockConference(pConference);
  3775. }
  3776. else
  3777. {
  3778. // At the time the ASSERT(0) was added here, the path that leads here
  3779. // always set pH245ConfIndData->u.Confirm.u.ConfClose.AccRej = H245_ACC
  3780. // at the same point it set ConfInd.u.Confirm.Error = H245_ERROR_OK;
  3781. // if that is ever changed, this also needs to change.
  3782. // see ..\h245\src\api_up.c, function H245FsmConfirm(), case H245_CONF_CLOSE:
  3783. ASSERT(0);
  3784. }
  3785. }
  3786. return H245_ERROR_OK;
  3787. }
  3788. HRESULT _ConfRequestClose( H245_CONF_IND_T *pH245ConfIndData)
  3789. {
  3790. CC_HCALL hCall;
  3791. CC_HCHANNEL hChannel;
  3792. PCHANNEL pChannel;
  3793. CC_HCONFERENCE hConference;
  3794. PCONFERENCE pConference;
  3795. PCALL pCall;
  3796. H245_ACC_REJ_T AccRej;
  3797. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  3798. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  3799. return H245_ERROR_OK;
  3800. hConference = pCall->hConference;
  3801. UnlockCall(pCall);
  3802. if (pH245ConfIndData->u.Confirm.Error == H245_ERROR_OK)
  3803. AccRej = pH245ConfIndData->u.Confirm.u.ConfReqClose.AccRej;
  3804. else
  3805. AccRej = H245_REJ;
  3806. // Note: the only time we need to take any real action is when the channel
  3807. // is a proxy channel, and the local endpoint is not the one which requested
  3808. // the channel closure; in this case, we simply forward the closure response
  3809. // on to the endpoint which initiated the request.
  3810. // If the channel is an RX or TXRX channel, the channel object was deleted
  3811. // when our client requested the channel closure, so there's no real work to
  3812. // be done.
  3813. // If the channel is a proxy channel which our client requested be closed,
  3814. // the channel object will remain around until closed by the TX side, but we
  3815. // don't need (nor do we have a mechanism) to inform our client of receipt
  3816. // of this channel closure response.
  3817. if (FindChannelInConference(pH245ConfIndData->u.Confirm.u.ConfReqClose.Channel,
  3818. FALSE, // remote channel number
  3819. PROXY_CHANNEL,
  3820. hCall,
  3821. &hChannel,
  3822. pConference) != CC_OK) {
  3823. UnlockConference(pConference);
  3824. return H245_ERROR_OK;
  3825. }
  3826. // Set hCall to the peer which initiated the close channel request
  3827. hCall = pH245ConfIndData->u.Confirm.dwTransId;
  3828. if (hCall == CC_INVALID_HANDLE) {
  3829. // The local endpoint was the one who requested the channel closure,
  3830. // so there's no one to forwards this response onto. We don't provide
  3831. // a callback for informing our client of receipt of this response,
  3832. // so we can simply clean up and return
  3833. UnlockConference(pConference);
  3834. return H245_ERROR_OK;
  3835. }
  3836. if (LockChannel(hChannel, &pChannel) != CC_OK) {
  3837. UnlockConference(pConference);
  3838. return H245_ERROR_OK;
  3839. }
  3840. // Forward this response onto the endpoint which requested the channel closure
  3841. if (LockCall(hCall, &pCall) == CC_OK) {
  3842. H245CloseChannelReqResp(pCall->H245Instance,
  3843. AccRej,
  3844. pChannel->wLocalChannelNumber);
  3845. UnlockCall(pCall);
  3846. }
  3847. UnlockChannel(pChannel);
  3848. UnlockConference(pConference);
  3849. return H245_ERROR_OK;
  3850. }
  3851. #if 0
  3852. HRESULT _ConfShutdown( H245_CONF_IND_T *pH245ConfIndData)
  3853. {
  3854. CC_HCALL hCall;
  3855. PCALL pCall;
  3856. CC_HCONFERENCE hConference;
  3857. PCONFERENCE pConference;
  3858. HRESULT status;
  3859. HQ931CALL hQ931Call;
  3860. H245_INST_T H245Instance;
  3861. #if 1
  3862. // Sync 2 - specific code
  3863. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  3864. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  3865. return H245_ERROR_OK;
  3866. hConference = pCall->hConference;
  3867. if (pConference->tsMultipointController == TS_TRUE) {
  3868. // XXX -- invoke user callback with "peer drop indication"
  3869. } else {
  3870. H245Instance = pCall->H245Instance;
  3871. hQ931Call = pCall->hQ931Call;
  3872. FreeCall(pCall);
  3873. if (H245Instance != H245_INVALID_ID)
  3874. status = H245ShutDown(H245Instance);
  3875. else
  3876. status = H245_ERROR_OK;
  3877. if (status == H245_ERROR_OK) {
  3878. status = Q931Hangup(hQ931Call, CC_REJECT_UNDEFINED_REASON);
  3879. // Q931Hangup may legitimately return CS_BAD_PARAM, because the Q.931 call object
  3880. // may have been deleted at this point
  3881. if (status == CS_BAD_PARAM)
  3882. status = CC_OK;
  3883. } else
  3884. Q931Hangup(hQ931Call, CC_REJECT_UNDEFINED_REASON);
  3885. InvokeUserConferenceCallback(pConference,
  3886. CC_CONFERENCE_TERMINATION_INDICATION,
  3887. status,
  3888. NULL);
  3889. if (ValidateConference(hConference) == CC_OK)
  3890. UnlockConference(pConference);
  3891. return H245_ERROR_OK;
  3892. }
  3893. #else
  3894. // Probably sync 3 code
  3895. HHANGUP hHangup;
  3896. PHANGUP pHangup;
  3897. CC_HANGUP_CALLBACK_PARAMS HangupCallbackParams;
  3898. hHangup = pH245ConfIndData->u.Confirm.dwTransId;
  3899. if (hHangup == CC_INVALID_HANDLE)
  3900. return H245_ERROR_OK;
  3901. if (LockHangup(hHangup, &pHangup) != CC_OK)
  3902. return H245_ERROR_OK;
  3903. pHangup->wNumCalls--;
  3904. if (pHangup->wNumCalls == 0) {
  3905. hConference = pHangup->hConference;
  3906. if (LockConference(hConference, &pConference) != CC_OK) {
  3907. UnlockHangup(pHangup);
  3908. return H245_ERROR_OK;
  3909. }
  3910. HangupCallbackParams.dwUserToken = pHangup->dwUserToken;
  3911. InvokeUserConferenceCallback(pConference->ConferenceCallback,
  3912. CC_HANGUP_INDICATION,
  3913. CC_OK,
  3914. hConference,
  3915. pConference->dwConferenceToken,
  3916. &HangupCallbackParams);
  3917. if (ValidateConference(hConference) == CC_OK)
  3918. UnlockConference(pConference);
  3919. if (ValidateHangup(hHangup) == CC_OK)
  3920. FreeHangup(pHangup);
  3921. return H245_ERROR_OK;
  3922. } else
  3923. UnlockHangup(pHangup);
  3924. return H245_ERROR_OK;
  3925. #endif // Sync 3 code
  3926. }
  3927. #endif
  3928. HRESULT _ConfInitMstslv( H245_CONF_IND_T *pH245ConfIndData)
  3929. {
  3930. CC_HCALL hCall;
  3931. PCALL pCall;
  3932. PCONFERENCE pConference;
  3933. CC_CONNECT_CALLBACK_PARAMS ConnectCallbackParams;
  3934. CC_HCALL hEnqueuedCall;
  3935. PCALL pEnqueuedCall;
  3936. CC_HCONFERENCE hConference;
  3937. HRESULT status;
  3938. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  3939. if (LockCallAndConference(hCall, &pCall, &pConference) != CC_OK)
  3940. return H245_ERROR_OK;
  3941. ASSERT(pCall->MasterSlaveState != MASTER_SLAVE_COMPLETE);
  3942. switch (pH245ConfIndData->u.Confirm.u.ConfMstSlv) {
  3943. case H245_MASTER:
  3944. pConference->tsMaster = TS_TRUE;
  3945. if (pConference->tsMultipointController == TS_UNKNOWN) {
  3946. ASSERT(pConference->bMultipointCapable == TRUE);
  3947. pConference->tsMultipointController = TS_TRUE;
  3948. // place all calls enqueued on this conference object
  3949. for ( ; ; ) {
  3950. // Start up all enqueued calls, if any exist
  3951. status = RemoveEnqueuedCallFromConference(pConference, &hEnqueuedCall);
  3952. if ((status != CC_OK) || (hEnqueuedCall == CC_INVALID_HANDLE))
  3953. break;
  3954. status = LockCall(hEnqueuedCall, &pEnqueuedCall);
  3955. if (status == CC_OK) {
  3956. pEnqueuedCall->CallState = PLACED;
  3957. status = PlaceCall(pEnqueuedCall, pConference);
  3958. UnlockCall(pEnqueuedCall);
  3959. }
  3960. }
  3961. }
  3962. break;
  3963. case H245_SLAVE:
  3964. ASSERT(pConference->tsMaster != TS_TRUE);
  3965. ASSERT(pConference->tsMultipointController != TS_TRUE);
  3966. pConference->tsMaster = TS_FALSE;
  3967. pConference->tsMultipointController = TS_FALSE;
  3968. // XXX -- we may eventually want to re-enqueue these requests
  3969. // and set an expiration timer
  3970. hConference = pConference->hConference;
  3971. for ( ; ; ) {
  3972. status = RemoveEnqueuedCallFromConference(pConference, &hEnqueuedCall);
  3973. if ((status != CC_OK) || (hEnqueuedCall == CC_INVALID_HANDLE))
  3974. break;
  3975. status = LockCall(hEnqueuedCall, &pEnqueuedCall);
  3976. if (status == CC_OK) {
  3977. MarkCallForDeletion(pEnqueuedCall);
  3978. ConnectCallbackParams.pNonStandardData = pEnqueuedCall->pPeerNonStandardData;
  3979. ConnectCallbackParams.pszPeerDisplay = pEnqueuedCall->pszPeerDisplay;
  3980. ConnectCallbackParams.bRejectReason = CC_REJECT_UNDEFINED_REASON;
  3981. ConnectCallbackParams.pTermCapList = pEnqueuedCall->pPeerH245TermCapList;
  3982. ConnectCallbackParams.pH2250MuxCapability = pEnqueuedCall->pPeerH245H2250MuxCapability;
  3983. ConnectCallbackParams.pTermCapDescriptors = pEnqueuedCall->pPeerH245TermCapDescriptors;
  3984. ConnectCallbackParams.pLocalAddr = pEnqueuedCall->pQ931LocalConnectAddr;
  3985. if (pEnqueuedCall->pQ931DestinationAddr == NULL)
  3986. ConnectCallbackParams.pPeerAddr = pEnqueuedCall->pQ931PeerConnectAddr;
  3987. else
  3988. ConnectCallbackParams.pPeerAddr = pEnqueuedCall->pQ931DestinationAddr;
  3989. ConnectCallbackParams.pVendorInfo = pEnqueuedCall->pPeerVendorInfo;
  3990. ConnectCallbackParams.bMultipointConference = TRUE;
  3991. ConnectCallbackParams.pConferenceID = &pConference->ConferenceID;
  3992. ConnectCallbackParams.pMCAddress = pConference->pMultipointControllerAddr;
  3993. ConnectCallbackParams.pAlternateAddress = NULL;
  3994. ConnectCallbackParams.dwUserToken = pEnqueuedCall->dwUserToken;
  3995. InvokeUserConferenceCallback(pConference,
  3996. CC_CONNECT_INDICATION,
  3997. CC_NOT_MULTIPOINT_CAPABLE,
  3998. &ConnectCallbackParams);
  3999. if (ValidateCallMarkedForDeletion(hEnqueuedCall) == CC_OK)
  4000. FreeCall(pEnqueuedCall);
  4001. if (ValidateConference(hConference) != CC_OK) {
  4002. if (ValidateCall(hCall) == CC_OK)
  4003. UnlockCall(pCall);
  4004. return H245_ERROR_OK;
  4005. }
  4006. }
  4007. }
  4008. break;
  4009. default: // H245_INDETERMINATE
  4010. UnlockConference(pConference);
  4011. if (++pCall->wMasterSlaveRetry < MASTER_SLAVE_RETRY_MAX) {
  4012. H245InitMasterSlave(pCall->H245Instance, pCall->H245Instance);
  4013. UnlockCall(pCall);
  4014. } else {
  4015. UnlockCall(pCall);
  4016. ProcessRemoteHangup(hCall, CC_INVALID_HANDLE, CC_REJECT_UNDEFINED_REASON);
  4017. }
  4018. return H245_ERROR_OK;
  4019. } // switch
  4020. pCall->MasterSlaveState = MASTER_SLAVE_COMPLETE;
  4021. if ((pCall->OutgoingTermCapState == TERMCAP_COMPLETE) &&
  4022. (pCall->IncomingTermCapState == TERMCAP_COMPLETE) &&
  4023. (pCall->CallState == TERMCAP) &&
  4024. (pCall->MasterSlaveState == MASTER_SLAVE_COMPLETE)) {
  4025. // Note that _ProcessConnectionComplete() returns with pConference and pCall unlocked
  4026. _ProcessConnectionComplete(pConference, pCall);
  4027. return H245_ERROR_OK;
  4028. }
  4029. UnlockCall(pCall);
  4030. UnlockConference(pConference);
  4031. return H245_ERROR_OK;
  4032. }
  4033. HRESULT _ConfSendTermCap( H245_CONF_IND_T *pH245ConfIndData)
  4034. {
  4035. CC_HCALL hCall;
  4036. PCALL pCall;
  4037. HRESULT status;
  4038. PCONFERENCE pConference;
  4039. // A TerminalCapabilitySet message was successfully sent from this endpoint
  4040. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  4041. status = LockCallAndConference(hCall, &pCall, &pConference);
  4042. if (status != CC_OK) {
  4043. // This may be OK, if the call was cancelled while
  4044. // call setup was in progress.
  4045. return H245_ERROR_OK;
  4046. }
  4047. if (pH245ConfIndData->u.Confirm.Error == H245_ERROR_OK &&
  4048. pH245ConfIndData->u.Confirm.u.ConfSndTcap.AccRej == H245_ACC) {
  4049. pCall->OutgoingTermCapState = TERMCAP_COMPLETE;
  4050. if ((pCall->IncomingTermCapState == TERMCAP_COMPLETE) &&
  4051. (pCall->CallState == TERMCAP) &&
  4052. (pCall->MasterSlaveState == MASTER_SLAVE_COMPLETE)) {
  4053. // Note that _ProcessConnectionComplete() returns with pConference and pCall unlocked
  4054. _ProcessConnectionComplete(pConference, pCall);
  4055. return H245_ERROR_OK;
  4056. }
  4057. } else if (pCall->CallState == TERMCAP) {
  4058. // Report error to Call Control client
  4059. UnlockConference(pConference);
  4060. UnlockCall(pCall);
  4061. ProcessRemoteHangup(hCall, CC_INVALID_HANDLE, CC_REJECT_UNDEFINED_REASON);
  4062. return H245_ERROR_OK;
  4063. }
  4064. UnlockConference(pConference);
  4065. UnlockCall(pCall);
  4066. return H245_ERROR_OK;
  4067. }
  4068. HRESULT _ConfRequestMode( H245_CONF_IND_T *pH245ConfIndData)
  4069. {
  4070. HRESULT status;
  4071. CC_HCALL hCall;
  4072. PCALL pCall;
  4073. CC_HCONFERENCE hConference;
  4074. PCONFERENCE pConference;
  4075. CC_REQUEST_MODE_RESPONSE_CALLBACK_PARAMS RequestModeResponseCallbackParams;
  4076. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  4077. status = LockCallAndConference(hCall, &pCall, &pConference);
  4078. if (status != CC_OK) {
  4079. // This may be OK, if the call was cancelled while
  4080. // call setup was in progress.
  4081. return H245_ERROR_OK;
  4082. }
  4083. hConference = pConference->hConference;
  4084. RequestModeResponseCallbackParams.hCall = hCall;
  4085. if (pCall->pPeerParticipantInfo == NULL) {
  4086. RequestModeResponseCallbackParams.TerminalLabel.bMCUNumber = 255;
  4087. RequestModeResponseCallbackParams.TerminalLabel.bTerminalNumber = 255;
  4088. } else
  4089. RequestModeResponseCallbackParams.TerminalLabel =
  4090. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  4091. switch (pH245ConfIndData->u.Confirm.u.ConfMrse) {
  4092. case wllTrnsmtMstPrfrrdMd_chosen:
  4093. RequestModeResponseCallbackParams.RequestModeResponse = CC_WILL_TRANSMIT_PREFERRED_MODE;
  4094. break;
  4095. case wllTrnsmtLssPrfrrdMd_chosen:
  4096. RequestModeResponseCallbackParams.RequestModeResponse = CC_WILL_TRANSMIT_LESS_PREFERRED_MODE;
  4097. break;
  4098. default:
  4099. RequestModeResponseCallbackParams.RequestModeResponse = CC_REQUEST_DENIED;
  4100. break;
  4101. }
  4102. InvokeUserConferenceCallback(pConference,
  4103. CC_REQUEST_MODE_RESPONSE_INDICATION,
  4104. pH245ConfIndData->u.Confirm.Error,
  4105. &RequestModeResponseCallbackParams);
  4106. if (ValidateCall(hCall) == CC_OK)
  4107. UnlockCall(pCall);
  4108. if (ValidateConference(hConference) == CC_OK)
  4109. UnlockConference(pConference);
  4110. return H245_ERROR_OK;
  4111. }
  4112. HRESULT _ConfRequestModeReject( H245_CONF_IND_T *pH245ConfIndData)
  4113. {
  4114. HRESULT status;
  4115. CC_HCALL hCall;
  4116. PCALL pCall;
  4117. CC_HCONFERENCE hConference;
  4118. PCONFERENCE pConference;
  4119. CC_REQUEST_MODE_RESPONSE_CALLBACK_PARAMS RequestModeResponseCallbackParams;
  4120. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  4121. status = LockCallAndConference(hCall, &pCall, &pConference);
  4122. if (status != CC_OK) {
  4123. // This may be OK, if the call was cancelled while
  4124. // call setup was in progress.
  4125. return H245_ERROR_OK;
  4126. }
  4127. hConference = pConference->hConference;
  4128. RequestModeResponseCallbackParams.hCall = hCall;
  4129. if (pCall->pPeerParticipantInfo == NULL) {
  4130. RequestModeResponseCallbackParams.TerminalLabel.bMCUNumber = 255;
  4131. RequestModeResponseCallbackParams.TerminalLabel.bTerminalNumber = 255;
  4132. } else
  4133. RequestModeResponseCallbackParams.TerminalLabel =
  4134. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  4135. switch (pH245ConfIndData->u.Confirm.u.ConfMrseReject) {
  4136. case H245_REJ_UNAVAILABLE:
  4137. RequestModeResponseCallbackParams.RequestModeResponse = CC_MODE_UNAVAILABLE;
  4138. break;
  4139. case H245_REJ_MULTIPOINT:
  4140. RequestModeResponseCallbackParams.RequestModeResponse = CC_MULTIPOINT_CONSTRAINT;
  4141. break;
  4142. case H245_REJ_DENIED:
  4143. RequestModeResponseCallbackParams.RequestModeResponse = CC_REQUEST_DENIED;
  4144. break;
  4145. default:
  4146. RequestModeResponseCallbackParams.RequestModeResponse = CC_REQUEST_DENIED;
  4147. break;
  4148. }
  4149. InvokeUserConferenceCallback(pConference,
  4150. CC_REQUEST_MODE_RESPONSE_INDICATION,
  4151. pH245ConfIndData->u.Confirm.Error,
  4152. &RequestModeResponseCallbackParams);
  4153. if (ValidateCall(hCall) == CC_OK)
  4154. UnlockCall(pCall);
  4155. if (ValidateConference(hConference) == CC_OK)
  4156. UnlockConference(pConference);
  4157. return H245_ERROR_OK;
  4158. }
  4159. HRESULT _ConfRequestModeExpired( H245_CONF_IND_T *pH245ConfIndData)
  4160. {
  4161. HRESULT status;
  4162. CC_HCALL hCall;
  4163. PCALL pCall;
  4164. CC_HCONFERENCE hConference;
  4165. PCONFERENCE pConference;
  4166. CC_REQUEST_MODE_RESPONSE_CALLBACK_PARAMS RequestModeResponseCallbackParams;
  4167. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  4168. status = LockCallAndConference(hCall, &pCall, &pConference);
  4169. if (status != CC_OK) {
  4170. // This may be OK, if the call was cancelled while
  4171. // call setup was in progress.
  4172. return H245_ERROR_OK;
  4173. }
  4174. hConference = pConference->hConference;
  4175. RequestModeResponseCallbackParams.hCall = hCall;
  4176. if (pCall->pPeerParticipantInfo == NULL) {
  4177. RequestModeResponseCallbackParams.TerminalLabel.bMCUNumber = 255;
  4178. RequestModeResponseCallbackParams.TerminalLabel.bTerminalNumber = 255;
  4179. } else
  4180. RequestModeResponseCallbackParams.TerminalLabel =
  4181. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  4182. RequestModeResponseCallbackParams.RequestModeResponse = CC_REQUEST_DENIED;
  4183. InvokeUserConferenceCallback(pConference,
  4184. CC_REQUEST_MODE_RESPONSE_INDICATION,
  4185. pH245ConfIndData->u.Confirm.Error,
  4186. &RequestModeResponseCallbackParams);
  4187. if (ValidateCall(hCall) == CC_OK)
  4188. UnlockCall(pCall);
  4189. if (ValidateConference(hConference) == CC_OK)
  4190. UnlockConference(pConference);
  4191. return H245_ERROR_OK;
  4192. }
  4193. HRESULT _ConfRoundTrip( H245_CONF_IND_T *pH245ConfIndData)
  4194. {
  4195. CC_HCALL hCall;
  4196. PCALL pCall;
  4197. CC_HCONFERENCE hConference;
  4198. PCONFERENCE pConference;
  4199. HRESULT status;
  4200. CC_PING_RESPONSE_CALLBACK_PARAMS PingCallbackParams;
  4201. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  4202. status = LockCallAndConference(hCall, &pCall, &pConference);
  4203. if (status != CC_OK) {
  4204. // This may be OK, if the call was cancelled while
  4205. // call setup was in progress.
  4206. return H245_ERROR_OK;
  4207. }
  4208. hConference = pConference->hConference;
  4209. PingCallbackParams.hCall = hCall;
  4210. if (pCall->pPeerParticipantInfo == NULL) {
  4211. PingCallbackParams.TerminalLabel.bMCUNumber = 255;
  4212. PingCallbackParams.TerminalLabel.bTerminalNumber = 255;
  4213. } else
  4214. PingCallbackParams.TerminalLabel =
  4215. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  4216. PingCallbackParams.bResponse = TRUE;
  4217. InvokeUserConferenceCallback(pConference,
  4218. CC_PING_RESPONSE_INDICATION,
  4219. pH245ConfIndData->u.Confirm.Error,
  4220. &PingCallbackParams);
  4221. if (ValidateCall(hCall) == CC_OK)
  4222. UnlockCall(pCall);
  4223. if (ValidateConference(hConference) == CC_OK)
  4224. UnlockConference(pConference);
  4225. return H245_ERROR_OK;
  4226. }
  4227. HRESULT _ConfRoundTripExpired( H245_CONF_IND_T *pH245ConfIndData)
  4228. {
  4229. CC_HCALL hCall;
  4230. PCALL pCall;
  4231. CC_HCONFERENCE hConference;
  4232. PCONFERENCE pConference;
  4233. HRESULT status;
  4234. CC_PING_RESPONSE_CALLBACK_PARAMS PingCallbackParams;
  4235. hCall = pH245ConfIndData->u.Confirm.dwPreserved;
  4236. status = LockCallAndConference(hCall, &pCall, &pConference);
  4237. if (status != CC_OK) {
  4238. // This may be OK, if the call was cancelled while
  4239. // call setup was in progress.
  4240. return H245_ERROR_OK;
  4241. }
  4242. hConference = pConference->hConference;
  4243. PingCallbackParams.hCall = hCall;
  4244. if (pCall->pPeerParticipantInfo == NULL) {
  4245. PingCallbackParams.TerminalLabel.bMCUNumber = 255;
  4246. PingCallbackParams.TerminalLabel.bTerminalNumber = 255;
  4247. } else
  4248. PingCallbackParams.TerminalLabel =
  4249. pCall->pPeerParticipantInfo->ParticipantInfo.TerminalLabel;
  4250. PingCallbackParams.bResponse = FALSE;
  4251. InvokeUserConferenceCallback(pConference,
  4252. CC_PING_RESPONSE_INDICATION,
  4253. pH245ConfIndData->u.Confirm.Error,
  4254. &PingCallbackParams);
  4255. if (ValidateCall(hCall) == CC_OK)
  4256. UnlockCall(pCall);
  4257. if (ValidateConference(hConference) == CC_OK)
  4258. UnlockConference(pConference);
  4259. return H245_ERROR_OK;
  4260. }
  4261. HRESULT H245Callback( H245_CONF_IND_T *pH245ConfIndData,
  4262. void *pMisc)
  4263. {
  4264. HRESULT status = H245_ERROR_OK;
  4265. EnterCallControl();
  4266. if (CallControlState != OPERATIONAL_STATE)
  4267. HResultLeaveCallControl(H245_ERROR_OK);
  4268. if (pH245ConfIndData == NULL)
  4269. HResultLeaveCallControl(H245_ERROR_OK);
  4270. if (pH245ConfIndData->Kind == H245_CONF) {
  4271. switch (pH245ConfIndData->u.Confirm.Confirm) {
  4272. case H245_CONF_INIT_MSTSLV:
  4273. status = _ConfInitMstslv(pH245ConfIndData);
  4274. break;
  4275. case H245_CONF_SEND_TERMCAP:
  4276. status = _ConfSendTermCap(pH245ConfIndData);
  4277. break;
  4278. case H245_CONF_OPEN:
  4279. status = _ConfOpen(pH245ConfIndData);
  4280. break;
  4281. case H245_CONF_NEEDRSP_OPEN:
  4282. status = _ConfBiDirectionalOpen(pH245ConfIndData);
  4283. break;
  4284. case H245_CONF_CLOSE:
  4285. status = _ConfClose(pH245ConfIndData);
  4286. break;
  4287. case H245_CONF_REQ_CLOSE:
  4288. status = _ConfRequestClose(pH245ConfIndData);
  4289. break;
  4290. // case H245_CONF_MUXTBL_SND: not valid for H.323 MuliplexEntrySend
  4291. // case H245_CONF_RMESE: not valid for H.323 RequestMultiplexEntry
  4292. // case H245_CONF_RMESE_REJECT: not valid for H.323 RequestMultiplexEntryReject
  4293. // case H245_CONF_RMESE_EXPIRED: not valid for H.323
  4294. case H245_CONF_MRSE:
  4295. status = _ConfRequestMode(pH245ConfIndData);
  4296. break;
  4297. case H245_CONF_MRSE_REJECT:
  4298. status = _ConfRequestModeReject(pH245ConfIndData);
  4299. break;
  4300. case H245_CONF_MRSE_EXPIRED:
  4301. status = _ConfRequestModeExpired(pH245ConfIndData);
  4302. break;
  4303. case H245_CONF_RTDSE:
  4304. status = _ConfRoundTrip(pH245ConfIndData);
  4305. break;
  4306. case H245_CONF_RTDSE_EXPIRED:
  4307. status = _ConfRoundTripExpired(pH245ConfIndData);
  4308. break;
  4309. default:
  4310. status = _ConfUnimplemented(pH245ConfIndData);
  4311. break;
  4312. }
  4313. } else if (pH245ConfIndData->Kind == H245_IND) {
  4314. switch (pH245ConfIndData->u.Indication.Indicator) {
  4315. case H245_IND_MSTSLV:
  4316. status = _IndMstslv(pH245ConfIndData);
  4317. break;
  4318. case H245_IND_CAP:
  4319. status = _IndCapability(pH245ConfIndData);
  4320. break;
  4321. case H245_IND_CESE_RELEASE:
  4322. // Remote has abandoned TerminalCapabilitySet
  4323. // No longer need to send TerminalCapabilitySetAck
  4324. // We can probably get away with ignoring this,
  4325. // but we should NOT return FunctionNotSupported!
  4326. break;
  4327. case H245_IND_OPEN:
  4328. status = _IndOpen(pH245ConfIndData);
  4329. break;
  4330. case H245_IND_OPEN_CONF:
  4331. // Bi-directionl channel open complete
  4332. status = _IndOpenConf(pH245ConfIndData);
  4333. break;
  4334. case H245_IND_CLOSE:
  4335. status = _IndClose(pH245ConfIndData);
  4336. break;
  4337. case H245_IND_REQ_CLOSE:
  4338. status = _IndRequestClose(pH245ConfIndData);
  4339. break;
  4340. case H245_IND_CLCSE_RELEASE:
  4341. // Remote has abandoned RequestChannelClose
  4342. // No longer need to send RequestChannelCloseAck and CloseLogicalChannel
  4343. // We can probably get away with ignoring this,
  4344. // but we should NOT return FunctionNotSupported!
  4345. break;
  4346. // case H245_IND_MUX_TBL: not valid in H.323 MuliplexEntrySend
  4347. // case H245_IND_MTSE_RELEASE not valid in H.323 MuliplexEntrySendRelease
  4348. // case H245_IND_RMESE not valid in H.323 RequestMuliplexEntry
  4349. // case H245_IND_RMESE_RELEASE not valid in H.323 RequestMuliplexEntryRelease
  4350. case H245_IND_MRSE:
  4351. status = _IndModeRequest(pH245ConfIndData);
  4352. break;
  4353. case H245_IND_MRSE_RELEASE:
  4354. // Remote has abandoned RequestMode
  4355. // No longer need to send RequestModeAck or RequestModeReject
  4356. // We can probably get away with ignoring this,
  4357. // but we should NOT return FunctionNotSupported!
  4358. break;
  4359. // case H245_IND_MLSE: We don't support looping back data
  4360. case H245_IND_MLSE_RELEASE:
  4361. // Required to accept this message
  4362. break;
  4363. case H245_IND_NONSTANDARD_REQUEST:
  4364. case H245_IND_NONSTANDARD_RESPONSE:
  4365. case H245_IND_NONSTANDARD_COMMAND:
  4366. case H245_IND_NONSTANDARD:
  4367. status = _IndNonStandard(pH245ConfIndData);
  4368. break;
  4369. case H245_IND_MISC_COMMAND:
  4370. status = _IndMiscellaneousCommand(pH245ConfIndData, pMisc);
  4371. break;
  4372. case H245_IND_MISC:
  4373. status = _IndMiscellaneous(pH245ConfIndData, pMisc);
  4374. break;
  4375. case H245_IND_COMM_MODE_REQUEST:
  4376. status = _IndUnimplemented(pH245ConfIndData); // TBD
  4377. break;
  4378. // case H245_IND_COMM_MODE_RESPONSE: We never send request!
  4379. case H245_IND_COMM_MODE_COMMAND:
  4380. status = _IndCommunicationModeCommand(pH245ConfIndData);
  4381. break;
  4382. case H245_IND_CONFERENCE_REQUEST:
  4383. status = _IndConferenceRequest(pH245ConfIndData);
  4384. break;
  4385. case H245_IND_CONFERENCE_RESPONSE:
  4386. status = _IndConferenceResponse(pH245ConfIndData);
  4387. break;
  4388. case H245_IND_CONFERENCE_COMMAND:
  4389. status = _IndConferenceCommand(pH245ConfIndData);
  4390. break;
  4391. case H245_IND_CONFERENCE:
  4392. status = _IndConference(pH245ConfIndData);
  4393. break;
  4394. case H245_IND_SEND_TERMCAP:
  4395. status = _IndSendTerminalCapabilitySet(pH245ConfIndData);
  4396. break;
  4397. // case H245_IND_ENCRYPTION: Not valid in H.323
  4398. case H245_IND_FLOW_CONTROL:
  4399. status = _IndFlowControl(pH245ConfIndData);
  4400. break;
  4401. case H245_IND_ENDSESSION:
  4402. status = _IndEndSession(pH245ConfIndData);
  4403. break;
  4404. case H245_IND_FUNCTION_NOT_UNDERSTOOD:
  4405. // We don't do anything with this but we still want to
  4406. // return H245_ERROR_OK so H.245 does not sent
  4407. // FunctionNotSupported back to remote peer!
  4408. break;
  4409. case H245_IND_JITTER:
  4410. // It is ok to ignore this; no response is expected
  4411. break;
  4412. // case H245_IND_H223_SKEW: Not valid in H.323
  4413. // case H245_IND_NEW_ATM_VC: Not valid in H.323
  4414. case H245_IND_USERINPUT:
  4415. status = _IndUserInput(pH245ConfIndData);
  4416. break;
  4417. case H245_IND_H2250_MAX_SKEW:
  4418. status = _IndH2250MaximumSkew(pH245ConfIndData);
  4419. break;
  4420. case H245_IND_MC_LOCATION:
  4421. status = _IndMCLocation(pH245ConfIndData);
  4422. break;
  4423. case H245_IND_VENDOR_ID:
  4424. status = _IndVendorIdentification(pH245ConfIndData, pMisc);
  4425. break;
  4426. case H245_IND_FUNCTION_NOT_SUPPORTED:
  4427. // We don't do anything with this but we still want to
  4428. // return H245_ERROR_OK so H.245 does not sent
  4429. // FunctionNotSupported back to remote peer!
  4430. break;
  4431. // case H245_IND_H223_RECONFIG: Not valid in H.323
  4432. // case H245_IND_H223_RECONFIG_ACK: Not valid in H.323
  4433. // case H245_IND_H223_RECONFIG_REJECT: Not valid in H.323
  4434. default:
  4435. status = _IndUnimplemented(pH245ConfIndData);
  4436. break;
  4437. }
  4438. }
  4439. HResultLeaveCallControl(status);
  4440. }