@webex/plugin-meetings 3.12.0-next.11 → 3.12.0-next.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/AGENTS.md +9 -0
  2. package/dist/aiEnableRequest/index.js +15 -2
  3. package/dist/aiEnableRequest/index.js.map +1 -1
  4. package/dist/breakouts/breakout.js +8 -3
  5. package/dist/breakouts/breakout.js.map +1 -1
  6. package/dist/breakouts/events.js +29 -14
  7. package/dist/breakouts/events.js.map +1 -1
  8. package/dist/breakouts/index.js +90 -3
  9. package/dist/breakouts/index.js.map +1 -1
  10. package/dist/common/errors/webex-errors.js +49 -5
  11. package/dist/common/errors/webex-errors.js.map +1 -1
  12. package/dist/config.js +2 -2
  13. package/dist/config.js.map +1 -1
  14. package/dist/constants.js +37 -10
  15. package/dist/constants.js.map +1 -1
  16. package/dist/controls-options-manager/constants.js +11 -1
  17. package/dist/controls-options-manager/constants.js.map +1 -1
  18. package/dist/controls-options-manager/index.js +67 -29
  19. package/dist/controls-options-manager/index.js.map +1 -1
  20. package/dist/controls-options-manager/util.js +91 -0
  21. package/dist/controls-options-manager/util.js.map +1 -1
  22. package/dist/hashTree/constants.js +4 -1
  23. package/dist/hashTree/constants.js.map +1 -1
  24. package/dist/hashTree/hashTreeParser.js +1003 -393
  25. package/dist/hashTree/hashTreeParser.js.map +1 -1
  26. package/dist/hashTree/utils.js +20 -0
  27. package/dist/hashTree/utils.js.map +1 -1
  28. package/dist/index.js +7 -0
  29. package/dist/index.js.map +1 -1
  30. package/dist/interceptors/dataChannelAuthToken.js +75 -15
  31. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  32. package/dist/interceptors/locusRetry.js +23 -8
  33. package/dist/interceptors/locusRetry.js.map +1 -1
  34. package/dist/interpretation/index.js +10 -1
  35. package/dist/interpretation/index.js.map +1 -1
  36. package/dist/interpretation/interpretation.types.js +7 -0
  37. package/dist/interpretation/interpretation.types.js.map +1 -0
  38. package/dist/interpretation/siLanguage.js +1 -1
  39. package/dist/locus-info/controlsUtils.js +4 -1
  40. package/dist/locus-info/controlsUtils.js.map +1 -1
  41. package/dist/locus-info/index.js +406 -121
  42. package/dist/locus-info/index.js.map +1 -1
  43. package/dist/locus-info/infoUtils.js +36 -5
  44. package/dist/locus-info/infoUtils.js.map +1 -1
  45. package/dist/locus-info/types.js +19 -0
  46. package/dist/locus-info/types.js.map +1 -1
  47. package/dist/media/MediaConnectionAwaiter.js +15 -2
  48. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  49. package/dist/media/index.js +8 -2
  50. package/dist/media/index.js.map +1 -1
  51. package/dist/media/properties.js +4 -5
  52. package/dist/media/properties.js.map +1 -1
  53. package/dist/meeting/in-meeting-actions.js +5 -1
  54. package/dist/meeting/in-meeting-actions.js.map +1 -1
  55. package/dist/meeting/index.js +1662 -829
  56. package/dist/meeting/index.js.map +1 -1
  57. package/dist/meeting/locusMediaRequest.js +229 -82
  58. package/dist/meeting/locusMediaRequest.js.map +1 -1
  59. package/dist/meeting/muteState.js +10 -1
  60. package/dist/meeting/muteState.js.map +1 -1
  61. package/dist/meeting/request.js +5 -2
  62. package/dist/meeting/request.js.map +1 -1
  63. package/dist/meeting/util.js +34 -2
  64. package/dist/meeting/util.js.map +1 -1
  65. package/dist/meeting-info/meeting-info-v2.js +2 -2
  66. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  67. package/dist/meetings/index.js +256 -118
  68. package/dist/meetings/index.js.map +1 -1
  69. package/dist/meetings/meetings.types.js +6 -1
  70. package/dist/meetings/meetings.types.js.map +1 -1
  71. package/dist/meetings/request.js +39 -0
  72. package/dist/meetings/request.js.map +1 -1
  73. package/dist/meetings/util.js +116 -18
  74. package/dist/meetings/util.js.map +1 -1
  75. package/dist/member/index.js +10 -0
  76. package/dist/member/index.js.map +1 -1
  77. package/dist/member/types.js.map +1 -1
  78. package/dist/member/util.js +30 -0
  79. package/dist/member/util.js.map +1 -1
  80. package/dist/members/index.js +101 -43
  81. package/dist/members/index.js.map +1 -1
  82. package/dist/members/util.js +8 -1
  83. package/dist/members/util.js.map +1 -1
  84. package/dist/metrics/constants.js +7 -1
  85. package/dist/metrics/constants.js.map +1 -1
  86. package/dist/multistream/codec/constants.js +63 -0
  87. package/dist/multistream/codec/constants.js.map +1 -0
  88. package/dist/multistream/mediaRequestManager.js +62 -15
  89. package/dist/multistream/mediaRequestManager.js.map +1 -1
  90. package/dist/multistream/receiveSlot.js +9 -0
  91. package/dist/multistream/receiveSlot.js.map +1 -1
  92. package/dist/reachability/clusterReachability.js.map +1 -1
  93. package/dist/reachability/index.js +121 -83
  94. package/dist/reachability/index.js.map +1 -1
  95. package/dist/reachability/reachability.types.js +2 -0
  96. package/dist/reachability/reachability.types.js.map +1 -1
  97. package/dist/reachability/util.js +45 -0
  98. package/dist/reachability/util.js.map +1 -1
  99. package/dist/reactions/reactions.type.js.map +1 -1
  100. package/dist/recording-controller/index.js +1 -3
  101. package/dist/recording-controller/index.js.map +1 -1
  102. package/dist/roap/turnDiscovery.js +8 -1
  103. package/dist/roap/turnDiscovery.js.map +1 -1
  104. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  105. package/dist/types/config.d.ts +2 -2
  106. package/dist/types/constants.d.ts +13 -1
  107. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  108. package/dist/types/controls-options-manager/index.d.ts +16 -0
  109. package/dist/types/hashTree/constants.d.ts +1 -0
  110. package/dist/types/hashTree/hashTreeParser.d.ts +178 -22
  111. package/dist/types/hashTree/utils.d.ts +7 -0
  112. package/dist/types/index.d.ts +3 -0
  113. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  114. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  115. package/dist/types/locus-info/index.d.ts +61 -7
  116. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  117. package/dist/types/locus-info/types.d.ts +21 -1
  118. package/dist/types/media/MediaConnectionAwaiter.d.ts +10 -1
  119. package/dist/types/media/properties.d.ts +6 -2
  120. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  121. package/dist/types/meeting/index.d.ts +175 -11
  122. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  123. package/dist/types/meeting/request.d.ts +1 -0
  124. package/dist/types/meeting/util.d.ts +9 -0
  125. package/dist/types/meetings/index.d.ts +38 -18
  126. package/dist/types/meetings/meetings.types.d.ts +15 -0
  127. package/dist/types/meetings/request.d.ts +14 -0
  128. package/dist/types/member/index.d.ts +1 -0
  129. package/dist/types/member/types.d.ts +1 -0
  130. package/dist/types/member/util.d.ts +9 -0
  131. package/dist/types/members/index.d.ts +15 -2
  132. package/dist/types/members/util.d.ts +1 -5
  133. package/dist/types/metrics/constants.d.ts +6 -0
  134. package/dist/types/multistream/codec/constants.d.ts +7 -0
  135. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  136. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  137. package/dist/types/reachability/index.d.ts +10 -3
  138. package/dist/types/reachability/reachability.types.d.ts +7 -0
  139. package/dist/types/reachability/util.d.ts +17 -0
  140. package/dist/types/reactions/reactions.type.d.ts +3 -0
  141. package/dist/webinar/index.js +307 -161
  142. package/dist/webinar/index.js.map +1 -1
  143. package/package.json +23 -23
  144. package/src/aiEnableRequest/index.ts +16 -0
  145. package/src/breakouts/breakout.ts +3 -1
  146. package/src/breakouts/events.ts +33 -11
  147. package/src/breakouts/index.ts +110 -1
  148. package/src/common/errors/webex-errors.ts +50 -3
  149. package/src/config.ts +2 -2
  150. package/src/constants.ts +21 -3
  151. package/src/controls-options-manager/constants.ts +14 -1
  152. package/src/controls-options-manager/index.ts +87 -28
  153. package/src/controls-options-manager/util.ts +81 -1
  154. package/src/hashTree/constants.ts +7 -0
  155. package/src/hashTree/hashTreeParser.ts +752 -192
  156. package/src/hashTree/utils.ts +19 -0
  157. package/src/index.ts +6 -0
  158. package/src/interceptors/dataChannelAuthToken.ts +88 -12
  159. package/src/interceptors/locusRetry.ts +25 -4
  160. package/src/interpretation/index.ts +27 -9
  161. package/src/interpretation/interpretation.types.ts +11 -0
  162. package/src/locus-info/controlsUtils.ts +3 -1
  163. package/src/locus-info/index.ts +412 -130
  164. package/src/locus-info/infoUtils.ts +41 -6
  165. package/src/locus-info/types.ts +25 -1
  166. package/src/media/MediaConnectionAwaiter.ts +21 -4
  167. package/src/media/index.ts +10 -1
  168. package/src/media/properties.ts +8 -3
  169. package/src/meeting/in-meeting-actions.ts +8 -0
  170. package/src/meeting/index.ts +913 -111
  171. package/src/meeting/locusMediaRequest.ts +106 -6
  172. package/src/meeting/muteState.ts +10 -1
  173. package/src/meeting/request.ts +11 -0
  174. package/src/meeting/util.ts +46 -5
  175. package/src/meeting-info/meeting-info-v2.ts +4 -2
  176. package/src/meetings/index.ts +168 -79
  177. package/src/meetings/meetings.types.ts +19 -0
  178. package/src/meetings/request.ts +43 -0
  179. package/src/meetings/util.ts +117 -4
  180. package/src/member/index.ts +10 -0
  181. package/src/member/types.ts +1 -0
  182. package/src/member/util.ts +29 -0
  183. package/src/members/index.ts +70 -7
  184. package/src/members/util.ts +12 -4
  185. package/src/metrics/constants.ts +6 -0
  186. package/src/multistream/codec/constants.ts +58 -0
  187. package/src/multistream/mediaRequestManager.ts +119 -28
  188. package/src/multistream/receiveSlot.ts +18 -0
  189. package/src/reachability/clusterReachability.ts +3 -2
  190. package/src/reachability/index.ts +47 -16
  191. package/src/reachability/reachability.types.ts +11 -0
  192. package/src/reachability/util.ts +36 -0
  193. package/src/reactions/reactions.type.ts +3 -0
  194. package/src/recording-controller/index.ts +1 -2
  195. package/src/roap/turnDiscovery.ts +9 -1
  196. package/src/webinar/index.ts +216 -38
  197. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  198. package/test/unit/spec/breakouts/breakout.ts +9 -3
  199. package/test/unit/spec/breakouts/events.ts +120 -2
  200. package/test/unit/spec/breakouts/index.ts +191 -2
  201. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  202. package/test/unit/spec/controls-options-manager/index.js +244 -29
  203. package/test/unit/spec/controls-options-manager/util.js +165 -0
  204. package/test/unit/spec/hashTree/hashTreeParser.ts +2110 -170
  205. package/test/unit/spec/hashTree/utils.ts +37 -0
  206. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +196 -0
  207. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  208. package/test/unit/spec/interpretation/index.ts +26 -4
  209. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  210. package/test/unit/spec/locus-info/index.js +643 -63
  211. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  212. package/test/unit/spec/media/MediaConnectionAwaiter.ts +55 -0
  213. package/test/unit/spec/media/index.ts +92 -0
  214. package/test/unit/spec/media/properties.ts +23 -23
  215. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  216. package/test/unit/spec/meeting/index.js +2711 -183
  217. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  218. package/test/unit/spec/meeting/muteState.js +81 -0
  219. package/test/unit/spec/meeting/request.js +12 -0
  220. package/test/unit/spec/meeting/utils.js +153 -1
  221. package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
  222. package/test/unit/spec/meetings/index.js +467 -36
  223. package/test/unit/spec/meetings/request.js +141 -0
  224. package/test/unit/spec/meetings/utils.js +402 -51
  225. package/test/unit/spec/member/index.js +7 -0
  226. package/test/unit/spec/member/util.js +89 -0
  227. package/test/unit/spec/members/index.js +216 -0
  228. package/test/unit/spec/members/request.js +37 -1
  229. package/test/unit/spec/members/utils.js +63 -0
  230. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  231. package/test/unit/spec/reachability/index.ts +128 -46
  232. package/test/unit/spec/reachability/util.ts +31 -0
  233. package/test/unit/spec/recording-controller/index.js +9 -8
  234. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  235. package/test/unit/spec/webinar/index.ts +332 -31
@@ -17,6 +17,8 @@ _Object$defineProperty(exports, "__esModule", {
17
17
  });
18
18
  exports.default = exports.ScreenShareFloorStatus = exports.MEDIA_UPDATE_TYPE = void 0;
19
19
  exports.storeEventForDebugging = storeEventForDebugging;
20
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
21
+ var _set = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/set"));
20
22
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
21
23
  var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
22
24
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
@@ -24,7 +26,6 @@ var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"))
24
26
  var _isNan = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/number/is-nan"));
25
27
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
26
28
  var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
27
- var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
28
29
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/typeof"));
29
30
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
30
31
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
@@ -111,6 +112,7 @@ var DEFAULT_ICE_PHASE_CALLBACK = function DEFAULT_ICE_PHASE_CALLBACK() {
111
112
  return 'JOIN_MEETING_FINAL';
112
113
  };
113
114
  var LLM_HEALTHCHECK_TIMER_MS = 3 * 60 * 1000;
115
+ var JOIN_WITH_MEDIA_RETRY_MAX_COUNT = 2;
114
116
  var logRequest = function logRequest(request, _ref) {
115
117
  var _ref$logText = _ref.logText,
116
118
  logText = _ref$logText === void 0 ? '' : _ref$logText;
@@ -496,6 +498,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
496
498
  (0, _defineProperty3.default)(_this, "floorGrantPending", void 0);
497
499
  (0, _defineProperty3.default)(_this, "hasJoinedOnce", void 0);
498
500
  (0, _defineProperty3.default)(_this, "hasWebsocketConnected", void 0);
501
+ (0, _defineProperty3.default)(_this, "mercuryOnlineHandler", void 0);
502
+ (0, _defineProperty3.default)(_this, "mercuryOfflineHandler", void 0);
499
503
  (0, _defineProperty3.default)(_this, "inMeetingActions", void 0);
500
504
  (0, _defineProperty3.default)(_this, "isLocalShareLive", void 0);
501
505
  (0, _defineProperty3.default)(_this, "isRoapInProgress", void 0);
@@ -507,6 +511,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
507
511
  (0, _defineProperty3.default)(_this, "joinedWith", void 0);
508
512
  (0, _defineProperty3.default)(_this, "selfId", void 0);
509
513
  (0, _defineProperty3.default)(_this, "roles", void 0);
514
+ (0, _defineProperty3.default)(_this, "canNotViewTheParticipantList", void 0);
510
515
  // ... there is more ... see SelfUtils.parse()
511
516
  // end of the group
512
517
  (0, _defineProperty3.default)(_this, "locusMediaRequest", void 0);
@@ -568,6 +573,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
568
573
  (0, _defineProperty3.default)(_this, "isMoveToInProgress", false);
569
574
  (0, _defineProperty3.default)(_this, "registrationIdStatus", void 0);
570
575
  (0, _defineProperty3.default)(_this, "brbState", void 0);
576
+ (0, _defineProperty3.default)(_this, "emittedBreakoutJoinResponseMoveIds", new _set.default());
577
+ (0, _defineProperty3.default)(_this, "promisesWaitingForPropUpdate", {});
571
578
  (0, _defineProperty3.default)(_this, "voiceaListenerCallbacks", (0, _defineProperty3.default)((0, _defineProperty3.default)((0, _defineProperty3.default)((0, _defineProperty3.default)({}, _internalPluginVoicea.EVENT_TRIGGERS.VOICEA_ANNOUNCEMENT, function (payload) {
572
579
  _this.transcription.languageOptions = payload;
573
580
  _loggerProxy.default.logger.debug("".concat(_util.default.getScopeLog({
@@ -629,7 +636,17 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
629
636
  if (_this.config.experimental.storeLocusHashTreeEventsForDebugging) {
630
637
  storeEventForDebugging('llm', event.data);
631
638
  }
639
+ var trackingId = event.trackingId;
632
640
  _this.locusInfo.parse(_this, event.data);
641
+
642
+ // Only the client whose /sync request tracking id matches the tracking id echoed back on this
643
+ // LLM message should emit client.locus.sync.complete. The tracking id lives at the top level
644
+ // of the received LLM event envelope. When it is absent there is nothing to correlate, so
645
+ // skip. onLocusSyncLlmMessage records the LLM arrival time and is a no-op unless a stored
646
+ // record for this meeting matches the tracking id.
647
+ if (trackingId) {
648
+ _this.onLocusSyncLlmMessage(_this.id, trackingId);
649
+ }
633
650
  } else {
634
651
  _loggerProxy.default.logger.warn("Meeting:index#processLocusLLMEvent --> Unknown event type: ".concat(event.data.eventType));
635
652
  }
@@ -641,6 +658,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
641
658
  * @returns {void}
642
659
  */
643
660
  (0, _defineProperty3.default)(_this, "processRelayEvent", function (e) {
661
+ if (!_this.isRelayEventRouteValid(e)) {
662
+ return;
663
+ }
644
664
  switch (e.data.relayType) {
645
665
  case _constants3.REACTION_RELAY_TYPES.REACTION:
646
666
  if (
@@ -680,6 +700,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
680
700
  */
681
701
  (0, _defineProperty3.default)(_this, "handleLLMOnline", function () {
682
702
  _this.restoreLLMSubscriptionsIfNeeded();
703
+ _this.locusInfo.syncAllHashTreeDatasets({
704
+ onlyLLM: true
705
+ });
683
706
  _triggerProxy.default.trigger(_this, {
684
707
  file: 'meeting/index',
685
708
  function: 'handleLLMOnline'
@@ -687,6 +710,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
687
710
  });
688
711
  /**
689
712
  * Disconnects and cleans up the default LLM session listeners/timers.
713
+ *
714
+ * Ownership-aware: only calls `disconnectLLM` when this meeting is the
715
+ * current owner of the default LLM session (or when no owner is recorded).
716
+ * Event listeners belonging to this meeting instance are always detached
717
+ * so they do not receive another meeting's relay events.
718
+ *
690
719
  * @param {Object} options
691
720
  * @param {boolean} [options.removeOnlineListener=true] removes the one-time online listener
692
721
  * @param {boolean} [options.throwOnError=true] rethrows disconnect errors when true
@@ -698,47 +727,74 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
698
727
  removeOnlineListener,
699
728
  _ref3$throwOnError,
700
729
  throwOnError,
730
+ _this$webex$internal$,
731
+ currentOwner,
732
+ isOwner,
733
+ _this$webex$internal$2,
734
+ currentOwnerAfterCleanup,
735
+ _this$webex$internal$3,
736
+ _this$webex$internal$4,
701
737
  _args = arguments,
702
738
  _t;
703
739
  return _regenerator.default.wrap(function (_context) {
704
740
  while (1) switch (_context.prev = _context.next) {
705
741
  case 0:
706
742
  _ref3 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref3$removeOnlineLis = _ref3.removeOnlineListener, removeOnlineListener = _ref3$removeOnlineLis === void 0 ? true : _ref3$removeOnlineLis, _ref3$throwOnError = _ref3.throwOnError, throwOnError = _ref3$throwOnError === void 0 ? true : _ref3$throwOnError;
743
+ // @ts-ignore - Fix type
744
+ // @ts-ignore - Fix type
745
+ _this$webex$internal$ = _this.webex.internal.llm.resolveSessionOwnership(_this.id, _constants.LLM_DEFAULT_SESSION), currentOwner = _this$webex$internal$.currentOwner, isOwner = _this$webex$internal$.isOwner;
707
746
  _context.prev = 1;
747
+ if (!isOwner) {
748
+ _context.next = 3;
749
+ break;
750
+ }
708
751
  _context.next = 2;
709
752
  return _this.webex.internal.llm.disconnectLLM({
710
753
  code: 3050,
711
754
  reason: 'done (permanent)'
712
- });
755
+ }, _constants.LLM_DEFAULT_SESSION, _this.id);
713
756
  case 2:
714
757
  _context.next = 4;
715
758
  break;
716
759
  case 3:
717
- _context.prev = 3;
760
+ _loggerProxy.default.logger.info("Meeting:index#cleanupLLMConneciton --> skipping disconnect; LLM owned by meeting ".concat(currentOwner, ", not ").concat(_this.id));
761
+ case 4:
762
+ _context.next = 6;
763
+ break;
764
+ case 5:
765
+ _context.prev = 5;
718
766
  _t = _context["catch"](1);
719
767
  _loggerProxy.default.logger.error('Meeting:index#cleanupLLMConneciton --> Failed to disconnect default LLM session', _t);
720
768
  if (!throwOnError) {
721
- _context.next = 4;
769
+ _context.next = 6;
722
770
  break;
723
771
  }
724
772
  throw _t;
725
- case 4:
726
- _context.prev = 4;
773
+ case 6:
774
+ _context.prev = 6;
727
775
  if (removeOnlineListener) {
728
776
  // @ts-ignore - Fix type
729
777
  _this.webex.internal.llm.off('online', _this.handleLLMOnline);
730
778
  }
731
- // @ts-ignore - fix types
732
- _this.webex.internal.llm.off('event:relay.event', _this.processRelayEvent);
733
- // @ts-ignore - Fix type
734
- _this.webex.internal.llm.off(_constants.LOCUS_LLM_EVENT, _this.processLocusLLMEvent);
735
- _this.clearLLMHealthCheckTimer();
736
- return _context.finish(4);
737
- case 5:
779
+ _this.stopListeningForLLMEvents();
780
+
781
+ // Re-check ownership after awaiting disconnectLLM. If ownership changed
782
+ // while cleanup was in flight, do not clear another meeting's owner tag.
783
+ if (isOwner) {
784
+ _this$webex$internal$2 =
785
+ // @ts-ignore - Fix type
786
+ _this.webex.internal.llm.resolveSessionOwnership(_this.id, _constants.LLM_DEFAULT_SESSION), currentOwnerAfterCleanup = _this$webex$internal$2.currentOwner;
787
+ if (currentOwnerAfterCleanup === _this.id) {
788
+ // @ts-ignore - Fix type
789
+ (_this$webex$internal$3 = (_this$webex$internal$4 = _this.webex.internal.llm).setOwnerMeetingId) === null || _this$webex$internal$3 === void 0 ? void 0 : _this$webex$internal$3.call(_this$webex$internal$4, undefined);
790
+ }
791
+ }
792
+ return _context.finish(6);
793
+ case 7:
738
794
  case "end":
739
795
  return _context.stop();
740
796
  }
741
- }, _callee, null, [[1, 3, 4, 5]]);
797
+ }, _callee, null, [[1, 5, 6, 7]]);
742
798
  })));
743
799
  /**
744
800
  * Handles ROAP_FAILURE event from the webrtc media connection
@@ -855,16 +911,31 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
855
911
  // @ts-ignore
856
912
  var cdl = _this.webex.internal.newMetrics.callDiagnosticLatencies;
857
913
 
914
+ // Save the remote-sdp-received timestamp before submitting the client event so we can
915
+ // calculate and include localSDPGenRemoteSDPRecv in the client event payload
916
+ cdl.saveTimestamp({
917
+ key: 'client.media-engine.remote-sdp-received',
918
+ options: {
919
+ meetingId: _this.id
920
+ }
921
+ });
922
+ var localSDPGenRemoteSDPRecv = cdl.getLocalSDPGenRemoteSDPRecv();
923
+
858
924
  // @ts-ignore
859
925
  _this.webex.internal.newMetrics.submitClientEvent({
860
926
  name: 'client.media-engine.remote-sdp-received',
927
+ payload: {
928
+ eventData: {
929
+ localSDPGenRemoteSDPRecv: localSDPGenRemoteSDPRecv
930
+ }
931
+ },
861
932
  options: {
862
933
  meetingId: _this.id
863
934
  }
864
935
  });
865
936
  _metrics.default.sendBehavioralMetric(_constants2.default.ROAP_OFFER_TO_ANSWER_LATENCY, {
866
937
  correlation_id: _this.correlationId,
867
- latency: cdl.getLocalSDPGenRemoteSDPRecv(),
938
+ latency: localSDPGenRemoteSDPRecv,
868
939
  meetingId: _this.id
869
940
  });
870
941
  if (_this.deferSDPAnswer) {
@@ -1321,6 +1392,37 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1321
1392
  }
1322
1393
  }
1323
1394
  });
1395
+ _this.statsAnalyzer.on(_internalMediaCore.StatsAnalyzerEventNames.STATS_UPDATE, function (data) {
1396
+ // Extract srtpCipher from transport stats
1397
+ var srtpCipher;
1398
+ var _iterator = _createForOfIteratorHelper(data.stats.values()),
1399
+ _step;
1400
+ try {
1401
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1402
+ var stats = _step.value;
1403
+ if (stats.type === 'transport' && stats.srtpCipher) {
1404
+ srtpCipher = stats.srtpCipher;
1405
+ break;
1406
+ }
1407
+ }
1408
+
1409
+ // Only emit event if srtpCipher has changed
1410
+ } catch (err) {
1411
+ _iterator.e(err);
1412
+ } finally {
1413
+ _iterator.f();
1414
+ }
1415
+ if (srtpCipher && srtpCipher !== _this.mediaProperties.srtpCipher) {
1416
+ _loggerProxy.default.logger.info("Meeting:index#setupStatsAnalyzerEventHandlers --> SRTP cipher changed from ".concat(_this.mediaProperties.srtpCipher, " to ").concat(srtpCipher));
1417
+ _this.mediaProperties.srtpCipher = srtpCipher;
1418
+ _triggerProxy.default.trigger(_this, {
1419
+ file: 'meeting/index',
1420
+ function: 'setupStatsAnalyzerEventHandlers'
1421
+ }, _constants.EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED, {
1422
+ srtpCipher: srtpCipher
1423
+ });
1424
+ }
1425
+ });
1324
1426
  });
1325
1427
  /**
1326
1428
  * media failed, so collect a stats report from webrtc using the wcme connection to grab the rtc stats report
@@ -1549,9 +1651,14 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1549
1651
  _this.shareStatus = _constants.SHARE_STATUS.NO_SHARE;
1550
1652
  }
1551
1653
  _this.queuedMediaUpdates = [];
1552
- _this.stopTranscription();
1553
- _this.transcription = undefined;
1554
- _this.annotation.deregisterEvents();
1654
+
1655
+ // Listener teardown (transcription, annotation, llm/mercury) runs in
1656
+ // stopListeningForMeetingEvents() before /leave and /end so events
1657
+ // received mid-teardown do not trigger Locus syncs. Calling it here
1658
+ // again would double-emit MEETING_STOPPED_RECEIVING_TRANSCRIPTION
1659
+ // because stopTranscription() always fires its trigger.
1660
+ //
1661
+ // Ownership-aware token clear is encapsulated inside clearDataChannelToken().
1555
1662
  _this.clearDataChannelToken();
1556
1663
  _context5.next = 1;
1557
1664
  return _this.cleanupLLMConneciton({
@@ -1727,7 +1834,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1727
1834
  });
1728
1835
 
1729
1836
  // @ts-ignore
1730
- _this.aiEnableRequest = new _aiEnableRequest.default({}, {
1837
+ _this.aiEnableRequest = new _aiEnableRequest.default({
1838
+ locusUrl: _this.locusUrl
1839
+ }, {
1731
1840
  parent: _this.webex
1732
1841
  });
1733
1842
 
@@ -1766,6 +1875,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1766
1875
  var _this$members$findMem2;
1767
1876
  return (_this$members$findMem2 = _this.members.findMemberByCsi(csi)) === null || _this$members$findMem2 === void 0 ? void 0 : _this$members$findMem2.id;
1768
1877
  });
1878
+
1769
1879
  /**
1770
1880
  * Object containing helper classes for managing media requests for audio/video/screenshare (for multistream media connections)
1771
1881
  * All multistream media requests sent out for this meeting have to go through them.
@@ -1777,7 +1887,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1777
1887
  return;
1778
1888
  }
1779
1889
  _this.mediaProperties.webrtcMediaConnection.requestMedia(_internalMediaCore.MediaType.AudioMain, mediaRequests);
1780
- }, {
1890
+ }, _this.getIngressPayloadTypeCallback.bind(_this), {
1781
1891
  // @ts-ignore - config coming from registerPlugin
1782
1892
  degradationPreferences: _this.config.degradationPreferences,
1783
1893
  kind: 'audio',
@@ -1789,7 +1899,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1789
1899
  return;
1790
1900
  }
1791
1901
  _this.mediaProperties.webrtcMediaConnection.requestMedia(_internalMediaCore.MediaType.VideoMain, mediaRequests);
1792
- }, {
1902
+ }, _this.getIngressPayloadTypeCallback.bind(_this), {
1793
1903
  // @ts-ignore - config coming from registerPlugin
1794
1904
  degradationPreferences: _this.config.degradationPreferences,
1795
1905
  kind: 'video',
@@ -1801,7 +1911,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1801
1911
  return;
1802
1912
  }
1803
1913
  _this.mediaProperties.webrtcMediaConnection.requestMedia(_internalMediaCore.MediaType.AudioSlides, mediaRequests);
1804
- }, {
1914
+ }, _this.getIngressPayloadTypeCallback.bind(_this), {
1805
1915
  // @ts-ignore - config coming from registerPlugin
1806
1916
  degradationPreferences: _this.config.degradationPreferences,
1807
1917
  kind: 'audio',
@@ -1813,11 +1923,13 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1813
1923
  return;
1814
1924
  }
1815
1925
  _this.mediaProperties.webrtcMediaConnection.requestMedia(_internalMediaCore.MediaType.VideoSlides, mediaRequests);
1816
- }, {
1926
+ }, _this.getIngressPayloadTypeCallback.bind(_this), {
1817
1927
  // @ts-ignore - config coming from registerPlugin
1818
1928
  degradationPreferences: _this.config.degradationPreferences,
1819
1929
  kind: 'video',
1820
- trimRequestsToNumOfSources: false
1930
+ trimRequestsToNumOfSources: false,
1931
+ // @ts-ignore - config coming from registerPlugin
1932
+ enableAv1: _this.config.enableAv1SlidesSupport
1821
1933
  })
1822
1934
  };
1823
1935
  /**
@@ -2135,7 +2247,42 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2135
2247
  * @memberof Meeting
2136
2248
  */
2137
2249
  // @ts-ignore - Fix type
2138
- _this.locusInfo = new _locusInfo.default(_this.updateMeetingObject.bind(_this), _this.webex, _this.id);
2250
+ _this.locusInfo = new _locusInfo.default({
2251
+ updateMeeting: _this.updateMeetingObject.bind(_this),
2252
+ syncLatencyTracker: {
2253
+ // Compute/store latency timestamps live on CallDiagnosticLatencies, while
2254
+ // submitting the client.locus.sync.complete CA event is owned by the metrics
2255
+ // facade. Wire each method to the layer that owns that responsibility.
2256
+ saveLatency: function saveLatency() {
2257
+ var _this$webex$internal$5;
2258
+ return (
2259
+ // @ts-ignore
2260
+ (_this$webex$internal$5 = _this.webex.internal.newMetrics.callDiagnosticLatencies).saveLatency.apply(_this$webex$internal$5, arguments)
2261
+ );
2262
+ },
2263
+ saveTimestamp: function saveTimestamp(saveTimestampOptions) {
2264
+ var _saveTimestampOptions;
2265
+ // @ts-ignore
2266
+ _this.webex.internal.newMetrics.callDiagnosticLatencies.saveTimestamp(saveTimestampOptions);
2267
+
2268
+ // The /sync response is one of the two milestones (the other is the LLM message) that
2269
+ // complete client.locus.sync.complete. Try to complete now: the metric is emitted only
2270
+ // once both the LLM message and the /sync response have arrived (either can come first).
2271
+ if (saveTimestampOptions.key === 'internal.client.locus.sync.response' && (_saveTimestampOptions = saveTimestampOptions.options) !== null && _saveTimestampOptions !== void 0 && _saveTimestampOptions.trackingId) {
2272
+ _this.tryCompleteLocusSyncLatency(saveTimestampOptions.options.meetingId, saveTimestampOptions.options.trackingId);
2273
+ }
2274
+ },
2275
+ clearLocusSyncLatency: function clearLocusSyncLatency() {
2276
+ var _this$webex$internal$6;
2277
+ return (
2278
+ // @ts-ignore
2279
+ (_this$webex$internal$6 = _this.webex.internal.newMetrics.callDiagnosticLatencies).clearLocusSyncLatency.apply(_this$webex$internal$6, arguments)
2280
+ );
2281
+ }
2282
+ }
2283
+ },
2284
+ // @ts-ignore
2285
+ _this.webex, _this.id);
2139
2286
 
2140
2287
  // We had to add listeners first before setting up the locus instance
2141
2288
  /**
@@ -2325,7 +2472,15 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2325
2472
  */
2326
2473
  _this.controlsOptionsManager = new _controlsOptionsManager.default(_this.meetingRequest, {
2327
2474
  locusUrl: (_this$locusInfo5 = _this.locusInfo) === null || _this$locusInfo5 === void 0 ? void 0 : _this$locusInfo5.url,
2328
- displayHints: []
2475
+ displayHints: [],
2476
+ getControls: function getControls() {
2477
+ var _this$locusInfo6;
2478
+ return (_this$locusInfo6 = _this.locusInfo) === null || _this$locusInfo6 === void 0 ? void 0 : _this$locusInfo6.controls;
2479
+ },
2480
+ isWebinar: function isWebinar() {
2481
+ var _this$locusInfo7, _this$locusInfo7$info;
2482
+ return (_this$locusInfo7 = _this.locusInfo) === null || _this$locusInfo7 === void 0 ? void 0 : (_this$locusInfo7$info = _this$locusInfo7.info) === null || _this$locusInfo7$info === void 0 ? void 0 : _this$locusInfo7$info.isWebinar;
2483
+ }
2329
2484
  });
2330
2485
  _this.setUpLocusInfoListeners();
2331
2486
  _this.locusInfo.init(attrs.locus ? attrs.locus : {});
@@ -2423,12 +2578,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2423
2578
  /**
2424
2579
  * Information needed for a retry of a call to joinWithMedia
2425
2580
  * @instance
2426
- * @type {{isRetry: boolean; prevJoinResponse?: any}}
2581
+ * @type {{retryCount: number; prevJoinResponse?: any}}
2427
2582
  * @private
2428
2583
  * @memberof Meeting
2429
2584
  */
2430
2585
  _this.joinWithMediaRetryInfo = {
2431
- isRetry: false,
2586
+ retryCount: 0,
2432
2587
  prevJoinResponse: undefined
2433
2588
  };
2434
2589
 
@@ -2486,14 +2641,36 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2486
2641
  }
2487
2642
 
2488
2643
  /**
2489
- * Temporary func to return webex object,
2490
- * in order to access internal plugin metrics
2491
- * in the utils file.
2492
- * @internal
2493
- * @returns {object} webex object
2644
+ * Get the ingress payload type for a given media type and codec mime type
2645
+ * @param {MediaType} mediaType - The media type
2646
+ * @param {MediaCodecMimeType} codecMimeType - The codec mime type
2647
+ * @returns {number | undefined} - The ingress payload type
2648
+ * @private
2649
+ * @memberof Meeting
2494
2650
  */
2495
2651
  (0, _inherits2.default)(Meeting, _StatelessWebexPlugin);
2496
2652
  return (0, _createClass2.default)(Meeting, [{
2653
+ key: "getIngressPayloadTypeCallback",
2654
+ value: function getIngressPayloadTypeCallback(mediaType, codecMimeType) {
2655
+ if (this.isMultistream) {
2656
+ try {
2657
+ return this.mediaProperties.webrtcMediaConnection.getIngressPayloadType(mediaType, codecMimeType);
2658
+ } catch (error) {
2659
+ _loggerProxy.default.logger.info("Meeting:index#mediaRequestManager --> failed to get ingress payload type for mediaType=".concat(mediaType, ", codecMimeType=").concat(codecMimeType), error);
2660
+ return undefined;
2661
+ }
2662
+ }
2663
+ return undefined;
2664
+ }
2665
+
2666
+ /**
2667
+ * Temporary func to return webex object,
2668
+ * in order to access internal plugin metrics
2669
+ * in the utils file.
2670
+ * @internal
2671
+ * @returns {object} webex object
2672
+ */
2673
+ }, {
2497
2674
  key: "getWebexObject",
2498
2675
  value: function getWebexObject() {
2499
2676
  // @ts-ignore
@@ -3134,6 +3311,85 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
3134
3311
  });
3135
3312
  }
3136
3313
 
3314
+ /**
3315
+ * Handles the LLM state-update message that resulted from a Locus /sync. Records the LLM arrival
3316
+ * time (the milestone that gates client.locus.sync.complete - the metric is emitted only for LLM
3317
+ * flows) and then tries to complete the metric.
3318
+ * @param {string} meetingId meeting id
3319
+ * @param {string} trackingId sync tracking id echoed back on the LLM message
3320
+ * @returns {void}
3321
+ * @private
3322
+ * @memberof Meeting
3323
+ */
3324
+ }, {
3325
+ key: "onLocusSyncLlmMessage",
3326
+ value: function onLocusSyncLlmMessage(meetingId, trackingId) {
3327
+ // @ts-ignore
3328
+ this.webex.internal.newMetrics.callDiagnosticLatencies.recordLocusSyncMessageReceived(meetingId, trackingId);
3329
+ this.tryCompleteLocusSyncLatency(meetingId, trackingId);
3330
+ }
3331
+
3332
+ /**
3333
+ * Attempts to complete the Locus sync latency metric and emit client.locus.sync.complete. The
3334
+ * metric is emitted only once BOTH the /sync response and the resulting LLM message have arrived
3335
+ * (in either order); until then the record is kept so the missing milestone can still land. Both
3336
+ * trigger points (the LLM message handler and the /sync response timestamp) call this, so the
3337
+ * metric fires as soon as the second milestone is in.
3338
+ * @param {string} meetingId meeting id
3339
+ * @param {string} trackingId sync tracking id used to match the pending record
3340
+ * @returns {void}
3341
+ * @private
3342
+ * @memberof Meeting
3343
+ */
3344
+ }, {
3345
+ key: "tryCompleteLocusSyncLatency",
3346
+ value: function tryCompleteLocusSyncLatency(meetingId, trackingId) {
3347
+ var completed =
3348
+ // @ts-ignore
3349
+ this.webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency(meetingId, trackingId);
3350
+ if (completed) {
3351
+ this.emitLocusSyncCompleteMetric(meetingId, completed);
3352
+ }
3353
+ }
3354
+
3355
+ /**
3356
+ * Submits the client.locus.sync.complete Call Analyzer event for a completed Locus sync latency
3357
+ * measurement.
3358
+ * @param {string} meetingId meeting id
3359
+ * @param {object} completed completed sync latency payload from the metrics plugin
3360
+ * @returns {void}
3361
+ * @private
3362
+ * @memberof Meeting
3363
+ */
3364
+ }, {
3365
+ key: "emitLocusSyncCompleteMetric",
3366
+ value: function emitLocusSyncCompleteMetric(meetingId, completed) {
3367
+ var _this$webex$internal$7, _this$webex$internal$8;
3368
+ // @ts-ignore
3369
+ var llmWebsocketUrl = ((_this$webex$internal$7 = this.webex.internal.llm) === null || _this$webex$internal$7 === void 0 ? void 0 : (_this$webex$internal$8 = _this$webex$internal$7.getWebSocketUrl) === null || _this$webex$internal$8 === void 0 ? void 0 : _this$webex$internal$8.call(_this$webex$internal$7)) || undefined;
3370
+
3371
+ // Per the LLM sync-latency spec, the event carries the LLM websocket url identifier,
3372
+ // the llmInfo.dataSet (main, atd-active or atd-unmuted) and the syncLatency block.
3373
+ var clientEvent = {
3374
+ name: 'client.locus.sync.complete',
3375
+ payload: {
3376
+ identifiers: {
3377
+ llmWebsocketUrl: llmWebsocketUrl
3378
+ },
3379
+ llmInfo: {
3380
+ dataSet: completed.dataSet
3381
+ },
3382
+ syncLatency: completed.syncLatency
3383
+ },
3384
+ options: {
3385
+ meetingId: meetingId
3386
+ }
3387
+ };
3388
+
3389
+ // @ts-ignore
3390
+ this.webex.internal.newMetrics.submitClientEvent(clientEvent);
3391
+ }
3392
+
3137
3393
  /**
3138
3394
  * Proxy function for all the listener set ups
3139
3395
  * @returns {undefined}
@@ -3525,7 +3781,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
3525
3781
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED, function (_ref10) {
3526
3782
  var state = _ref10.state,
3527
3783
  modifiedBy = _ref10.modifiedBy,
3528
- lastModified = _ref10.lastModified;
3784
+ lastModified = _ref10.lastModified,
3785
+ modifiedByServiceAppName = _ref10.modifiedByServiceAppName,
3786
+ modifiedByServiceAppId = _ref10.modifiedByServiceAppId;
3529
3787
  var event;
3530
3788
  switch (state) {
3531
3789
  case _constants.RECORDING_STATE.RECORDING:
@@ -3549,7 +3807,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
3549
3807
  _this12.recording = {
3550
3808
  state: state === _constants.RECORDING_STATE.RESUMED ? _constants.RECORDING_STATE.RECORDING : state,
3551
3809
  modifiedBy: modifiedBy,
3552
- lastModified: lastModified
3810
+ lastModified: lastModified,
3811
+ modifiedByServiceAppName: modifiedByServiceAppName,
3812
+ modifiedByServiceAppId: modifiedByServiceAppId
3553
3813
  };
3554
3814
  _triggerProxy.default.trigger(_this12, {
3555
3815
  file: 'meeting/index',
@@ -3877,7 +4137,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
3877
4137
  else if ((previousContentShare && contentShare.disposition === _constants.FLOOR_ACTION.RELEASED || contentShare.disposition === null) && (previousWhiteboardShare && whiteboardShare.disposition === _constants.FLOOR_ACTION.RELEASED || whiteboardShare.disposition === null)) {
3878
4138
  newShareStatus = _constants.SHARE_STATUS.NO_SHARE;
3879
4139
  }
3880
- _loggerProxy.default.logger.info("Meeting:index#setUpLocusInfoMediaInactiveListener --> this.shareStatus=".concat(_this13.shareStatus, " newShareStatus=").concat(newShareStatus));
4140
+ _loggerProxy.default.logger.info("Meeting:index#setUpLocusMediaSharesListener --> this.shareStatus=".concat(_this13.shareStatus, " newShareStatus=").concat(newShareStatus));
3881
4141
  if (!(newShareStatus !== _this13.shareStatus)) {
3882
4142
  _context0.next = 17;
3883
4143
  break;
@@ -4086,15 +4346,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4086
4346
  _this14.breakouts.locusUrlUpdate(url);
4087
4347
  _this14.simultaneousInterpretation.locusUrlUpdate(url);
4088
4348
  _this14.annotation.locusUrlUpdate(url);
4349
+ _this14.aiEnableRequest.locusUrlUpdate(url);
4089
4350
  _this14.locusUrl = url;
4090
4351
  _this14.locusId = (_this14$locusUrl = _this14.locusUrl) === null || _this14$locusUrl === void 0 ? void 0 : _this14$locusUrl.split('/').pop();
4091
4352
  _this14.recordingController.setLocusUrl(_this14.locusUrl);
4092
4353
  _this14.controlsOptionsManager.setLocusUrl(_this14.locusUrl, !!isMainLocus);
4093
4354
  _this14.webinar.locusUrlUpdate(url);
4094
- // @ts-ignore
4095
- _this14.webex.internal.llm.setRefreshHandler(function () {
4096
- return _this14.refreshDataChannelToken();
4097
- });
4098
4355
  _triggerProxy.default.trigger(_this14, {
4099
4356
  file: 'meeting/index',
4100
4357
  function: 'setUpLocusSelfListener'
@@ -4324,34 +4581,56 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4324
4581
  });
4325
4582
  _this19.updateLLMConnection();
4326
4583
  });
4327
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_ADMITTED_GUEST, function (payload) {
4328
- var _this19$rtcMetrics;
4329
- _this19.stopKeepAlive();
4330
- if (payload) {
4331
- _triggerProxy.default.trigger(_this19, {
4332
- file: 'meeting/index',
4333
- function: 'setUpLocusInfoSelfListener'
4334
- }, _constants.EVENT_TRIGGERS.MEETING_SELF_GUEST_ADMITTED, {
4335
- payload: payload
4336
- });
4584
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_ADMITTED_GUEST, /*#__PURE__*/function () {
4585
+ var _ref37 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1(payload) {
4586
+ var _this19$rtcMetrics;
4587
+ var _t9;
4588
+ return _regenerator.default.wrap(function (_context1) {
4589
+ while (1) switch (_context1.prev = _context1.next) {
4590
+ case 0:
4591
+ _this19.stopKeepAlive();
4592
+ if (payload) {
4593
+ _triggerProxy.default.trigger(_this19, {
4594
+ file: 'meeting/index',
4595
+ function: 'setUpLocusInfoSelfListener'
4596
+ }, _constants.EVENT_TRIGGERS.MEETING_SELF_GUEST_ADMITTED, {
4597
+ payload: payload
4598
+ });
4337
4599
 
4338
- // @ts-ignore
4339
- _this19.webex.internal.newMetrics.submitClientEvent({
4340
- name: 'client.lobby.exited',
4341
- options: {
4342
- meetingId: _this19.id
4600
+ // @ts-ignore
4601
+ _this19.webex.internal.newMetrics.submitClientEvent({
4602
+ name: 'client.lobby.exited',
4603
+ options: {
4604
+ meetingId: _this19.id
4605
+ }
4606
+ });
4607
+ _metrics.default.sendBehavioralMetric(_constants2.default.GUEST_EXITED_LOBBY, {
4608
+ correlation_id: _this19.correlationId
4609
+ });
4610
+ }
4611
+ (_this19$rtcMetrics = _this19.rtcMetrics) === null || _this19$rtcMetrics === void 0 ? void 0 : _this19$rtcMetrics.sendNextMetrics();
4612
+ _context1.prev = 1;
4613
+ _context1.next = 2;
4614
+ return _this19.ensureDefaultDatachannelTokenAfterAdmit();
4615
+ case 2:
4616
+ _context1.next = 4;
4617
+ break;
4618
+ case 3:
4619
+ _context1.prev = 3;
4620
+ _t9 = _context1["catch"](1);
4621
+ _loggerProxy.default.logger.warn("Meeting:index#setUpLocusInfoSelfListener --> failed post-admit token prefetch flow: ".concat((_t9 === null || _t9 === void 0 ? void 0 : _t9.message) || String(_t9)));
4622
+ case 4:
4623
+ _this19.updateLLMConnection();
4624
+ case 5:
4625
+ case "end":
4626
+ return _context1.stop();
4343
4627
  }
4344
- });
4345
- _metrics.default.sendBehavioralMetric(_constants2.default.GUEST_EXITED_LOBBY, {
4346
- correlation_id: _this19.correlationId
4347
- });
4348
- }
4349
- (_this19$rtcMetrics = _this19.rtcMetrics) === null || _this19$rtcMetrics === void 0 ? void 0 : _this19$rtcMetrics.sendNextMetrics();
4350
- _this19.ensureDefaultDatachannelTokenAfterAdmit().catch(function (error) {
4351
- _loggerProxy.default.logger.warn("Meeting:index#setUpLocusInfoSelfListener --> failed post-admit token prefetch flow: ".concat((error === null || error === void 0 ? void 0 : error.message) || String(error)));
4352
- });
4353
- _this19.updateLLMConnection();
4354
- });
4628
+ }, _callee1, null, [[1, 3]]);
4629
+ }));
4630
+ return function (_x9) {
4631
+ return _ref37.apply(this, arguments);
4632
+ };
4633
+ }());
4355
4634
 
4356
4635
  // @ts-ignore - check if MEDIA_INACTIVITY exists
4357
4636
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.MEDIA_INACTIVITY, function () {
@@ -4387,6 +4666,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4387
4666
  }
4388
4667
  });
4389
4668
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_CANNOT_VIEW_PARTICIPANT_LIST_CHANGE, function (payload) {
4669
+ // canViewTheParticipantList meeting action depends on this value, so we need to update meeting actions
4670
+ _this19.updateMeetingActions();
4390
4671
  _triggerProxy.default.trigger(_this19, {
4391
4672
  file: 'meeting/index',
4392
4673
  function: 'setUpLocusInfoSelfListener'
@@ -4471,49 +4752,49 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4471
4752
  }
4472
4753
  });
4473
4754
  this.locusInfo.on(_constants.EVENTS.DESTROY_MEETING, /*#__PURE__*/function () {
4474
- var _ref37 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1(payload) {
4475
- var _t9;
4476
- return _regenerator.default.wrap(function (_context1) {
4477
- while (1) switch (_context1.prev = _context1.next) {
4755
+ var _ref38 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10(payload) {
4756
+ var _t0;
4757
+ return _regenerator.default.wrap(function (_context10) {
4758
+ while (1) switch (_context10.prev = _context10.next) {
4478
4759
  case 0:
4479
4760
  if (!_this20.wirelessShare) {
4480
- _context1.next = 2;
4761
+ _context10.next = 2;
4481
4762
  break;
4482
4763
  }
4483
4764
  if (!_this20.mediaProperties.shareVideoStream) {
4484
- _context1.next = 1;
4765
+ _context10.next = 1;
4485
4766
  break;
4486
4767
  }
4487
- _context1.next = 1;
4768
+ _context10.next = 1;
4488
4769
  return _this20.setLocalShareVideoStream(undefined);
4489
4770
  case 1:
4490
4771
  if (!_this20.mediaProperties.shareAudioStream) {
4491
- _context1.next = 2;
4772
+ _context10.next = 2;
4492
4773
  break;
4493
4774
  }
4494
- _context1.next = 2;
4775
+ _context10.next = 2;
4495
4776
  return _this20.setLocalShareAudioStream(undefined);
4496
4777
  case 2:
4497
4778
  if (!payload.shouldLeave) {
4498
- _context1.next = 7;
4779
+ _context10.next = 7;
4499
4780
  break;
4500
4781
  }
4501
- _context1.prev = 3;
4502
- _context1.next = 4;
4782
+ _context10.prev = 3;
4783
+ _context10.next = 4;
4503
4784
  return _this20.leave({
4504
4785
  reason: payload.reason
4505
4786
  });
4506
4787
  case 4:
4507
4788
  _loggerProxy.default.logger.warn('Meeting:index#setUpLocusInfoMeetingListener --> DESTROY_MEETING. The meeting has been left, but has not been destroyed, you should see a later event for leave.');
4508
- _context1.next = 6;
4789
+ _context10.next = 6;
4509
4790
  break;
4510
4791
  case 5:
4511
- _context1.prev = 5;
4512
- _t9 = _context1["catch"](3);
4792
+ _context10.prev = 5;
4793
+ _t0 = _context10["catch"](3);
4513
4794
  // @ts-ignore
4514
- _loggerProxy.default.logger.error("Meeting:index#setUpLocusInfoMeetingListener --> DESTROY_MEETING. Issue with leave for meeting, meeting still in collection: ".concat(_this20, ", error: ").concat(_t9));
4795
+ _loggerProxy.default.logger.error("Meeting:index#setUpLocusInfoMeetingListener --> DESTROY_MEETING. Issue with leave for meeting, meeting still in collection: ".concat(_this20, ", error: ").concat(_t0));
4515
4796
  case 6:
4516
- _context1.next = 8;
4797
+ _context10.next = 8;
4517
4798
  break;
4518
4799
  case 7:
4519
4800
  _loggerProxy.default.logger.info('Meeting:index#setUpLocusInfoMeetingListener --> MEETING_REMOVED_REASON', payload.reason);
@@ -4527,12 +4808,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4527
4808
  });
4528
4809
  case 8:
4529
4810
  case "end":
4530
- return _context1.stop();
4811
+ return _context10.stop();
4531
4812
  }
4532
- }, _callee1, null, [[3, 5]]);
4813
+ }, _callee10, null, [[3, 5]]);
4533
4814
  }));
4534
- return function (_x9) {
4535
- return _ref37.apply(this, arguments);
4815
+ return function (_x0) {
4816
+ return _ref38.apply(this, arguments);
4536
4817
  };
4537
4818
  }());
4538
4819
  }
@@ -4554,7 +4835,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4554
4835
  // is not changed by any delta event
4555
4836
  if (object && (0, _keys.default)(object).length) {
4556
4837
  (0, _keys.default)(object).forEach(function (key) {
4838
+ var previousValue = _this21[key];
4557
4839
  _this21[key] = object[key];
4840
+ if (_this21.promisesWaitingForPropUpdate[key] && previousValue !== object[key]) {
4841
+ _this21.promisesWaitingForPropUpdate[key].resolve();
4842
+ delete _this21.promisesWaitingForPropUpdate[key];
4843
+ }
4558
4844
  });
4559
4845
  }
4560
4846
  }
@@ -4650,31 +4936,31 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4650
4936
  }, {
4651
4937
  key: "beRightBack",
4652
4938
  value: (function () {
4653
- var _beRightBack = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10(enabled) {
4939
+ var _beRightBack = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11(enabled) {
4654
4940
  var _this22 = this;
4655
4941
  var errorMessage, error, _errorMessage, _error;
4656
- return _regenerator.default.wrap(function (_context10) {
4657
- while (1) switch (_context10.prev = _context10.next) {
4942
+ return _regenerator.default.wrap(function (_context11) {
4943
+ while (1) switch (_context11.prev = _context11.next) {
4658
4944
  case 0:
4659
4945
  if (this.isMultistream) {
4660
- _context10.next = 1;
4946
+ _context11.next = 1;
4661
4947
  break;
4662
4948
  }
4663
4949
  errorMessage = 'Meeting:index#beRightBack --> Not a multistream meeting';
4664
4950
  error = new Error(errorMessage);
4665
4951
  _loggerProxy.default.logger.error(error);
4666
- return _context10.abrupt("return", _promise.default.reject(error));
4952
+ return _context11.abrupt("return", _promise.default.reject(error));
4667
4953
  case 1:
4668
4954
  if (this.mediaProperties.webrtcMediaConnection) {
4669
- _context10.next = 2;
4955
+ _context11.next = 2;
4670
4956
  break;
4671
4957
  }
4672
4958
  _errorMessage = 'Meeting:index#beRightBack --> WebRTC media connection is not defined';
4673
4959
  _error = new Error(_errorMessage);
4674
4960
  _loggerProxy.default.logger.error(_error);
4675
- return _context10.abrupt("return", _promise.default.reject(_error));
4961
+ return _context11.abrupt("return", _promise.default.reject(_error));
4676
4962
  case 2:
4677
- return _context10.abrupt("return", this.brbState.enable(enabled, this.sendSlotManager).then(function () {
4963
+ return _context11.abrupt("return", this.brbState.enable(enabled, this.sendSlotManager).then(function () {
4678
4964
  if (_this22.audio && enabled) {
4679
4965
  // locus mutes the participant with brb enabled request,
4680
4966
  // so we need to explicitly update remote mute for correct logic flow
@@ -4685,11 +4971,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4685
4971
  }));
4686
4972
  case 3:
4687
4973
  case "end":
4688
- return _context10.stop();
4974
+ return _context11.stop();
4689
4975
  }
4690
- }, _callee10, this);
4976
+ }, _callee11, this);
4691
4977
  }));
4692
- function beRightBack(_x0) {
4978
+ function beRightBack(_x1) {
4693
4979
  return _beRightBack.apply(this, arguments);
4694
4980
  }
4695
4981
  return beRightBack;
@@ -4724,7 +5010,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4724
5010
  }
4725
5011
 
4726
5012
  /**
4727
- * Transfer the moderator role to another eligible member
5013
+ * Transfer the moderator role to another eligible member.
5014
+ *
5015
+ * If the target member is currently joined in the current session, the request is
5016
+ * sent against the current locus. Otherwise, we search the breakout sessions and,
5017
+ * when the member is found in one, we send the request against that breakout
5018
+ * session's locus url instead.
4728
5019
  * @param {String} memberId
4729
5020
  * @param {Boolean} moderator
4730
5021
  * @returns {Promise} see #members.transferHostToMember
@@ -4734,8 +5025,19 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4734
5025
  }, {
4735
5026
  key: "transfer",
4736
5027
  value: function transfer(memberId) {
5028
+ var _this$breakouts2, _this$breakouts2$brea, _this$breakouts2$brea2, _breakout$breakoutRos;
4737
5029
  var moderator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4738
- return this.members.transferHostToMember(memberId, moderator);
5030
+ var targetMember = this.members.membersCollection.get(memberId);
5031
+ if (targetMember !== null && targetMember !== void 0 && targetMember.isInMeeting) {
5032
+ return this.members.transferHostToMember(memberId, moderator);
5033
+ }
5034
+ var breakout = (_this$breakouts2 = this.breakouts) === null || _this$breakouts2 === void 0 ? void 0 : (_this$breakouts2$brea = _this$breakouts2.breakouts) === null || _this$breakouts2$brea === void 0 ? void 0 : (_this$breakouts2$brea2 = _this$breakouts2$brea.models) === null || _this$breakouts2$brea2 === void 0 ? void 0 : _this$breakouts2$brea2.find(function (bo) {
5035
+ var _bo$members, _bo$members$membersCo;
5036
+ var breakoutMember = (_bo$members = bo.members) === null || _bo$members === void 0 ? void 0 : (_bo$members$membersCo = _bo$members.membersCollection) === null || _bo$members$membersCo === void 0 ? void 0 : _bo$members$membersCo.get(memberId);
5037
+ return breakoutMember === null || breakoutMember === void 0 ? void 0 : breakoutMember.isInMeeting;
5038
+ });
5039
+ var breakoutLocusUrl = breakout === null || breakout === void 0 ? void 0 : (_breakout$breakoutRos = breakout.breakoutRosterLocus) === null || _breakout$breakoutRos === void 0 ? void 0 : _breakout$breakoutRos.url;
5040
+ return this.members.transferHostToMember(memberId, moderator, breakoutLocusUrl);
4739
5041
  }
4740
5042
 
4741
5043
  /**
@@ -4863,6 +5165,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4863
5165
  }) && ((_this$meetingInfo5 = this.meetingInfo) === null || _this$meetingInfo5 === void 0 ? void 0 : (_this$meetingInfo5$vi = _this$meetingInfo5.video) === null || _this$meetingInfo5$vi === void 0 ? void 0 : _this$meetingInfo5$vi.supportHQV) || !this.arePolicyRestrictionsSupported()
4864
5166
  });
4865
5167
  if (this.userDisplayHints !== undefined) {
5168
+ var _this$canNotViewThePa;
4866
5169
  changed = this.inMeetingActions.set({
4867
5170
  canInviteNewParticipants: _util2.default.canInviteNewParticipants(this.userDisplayHints),
4868
5171
  canAdmitParticipant: _util2.default.canAdmitParticipant(this.userDisplayHints),
@@ -5117,7 +5420,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5117
5420
  displayHints: this.userDisplayHints
5118
5421
  }),
5119
5422
  canAttendeeRequestAiAssistantEnabled: _util2.default.canAttendeeRequestAiAssistantEnabled(this.userDisplayHints, this.roles),
5120
- isAttendeeRequestAiAssistantDeclinedAll: _util2.default.attendeeRequestAiAssistantDeclinedAll(this.userDisplayHints)
5423
+ isAttendeeRequestAiAssistantDeclinedAll: _util2.default.attendeeRequestAiAssistantDeclinedAll(this.userDisplayHints),
5424
+ isAnonymizeDisplayNamesEnabled: _util2.default.isAnonymizeDisplayNamesEnabled(this.userDisplayHints),
5425
+ canViewTheParticipantList: _util2.default.canViewTheParticipantList(this.userDisplayHints, (_this$canNotViewThePa = this.canNotViewTheParticipantList) !== null && _this$canNotViewThePa !== void 0 ? _this$canNotViewThePa : false)
5121
5426
  }) || changed;
5122
5427
  }
5123
5428
  if (changed) {
@@ -5168,6 +5473,51 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5168
5473
  this.sipUri = sipUri;
5169
5474
  }
5170
5475
 
5476
+ /**
5477
+ * After initial locus setup, refreshes destination with synced locus data and optionally
5478
+ * performs deferred meeting info fetch when initial locus was incomplete.
5479
+ * @param {LocusDTO} locus
5480
+ * @returns {void}
5481
+ */
5482
+ }, {
5483
+ key: "finalizeMeetingAfterInitialLocusSetup",
5484
+ value: (function () {
5485
+ var _finalizeMeetingAfterInitialLocusSetup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12(locus) {
5486
+ var _this$destination;
5487
+ var _t1;
5488
+ return _regenerator.default.wrap(function (_context12) {
5489
+ while (1) switch (_context12.prev = _context12.next) {
5490
+ case 0:
5491
+ if (locus && (this === null || this === void 0 ? void 0 : this.destinationType) === _constants.DESTINATION_TYPE.LOCUS_ID) {
5492
+ // destination is initialized from the initial locus snapshot in constructor,
5493
+ // so refresh it after locus sync to avoid stale partial hash-tree data.
5494
+ this.destination = locus;
5495
+ }
5496
+ if (!((!this.meetingInfo || (0, _lodash.isEmpty)(this.meetingInfo)) && (_this$destination = this.destination) !== null && _this$destination !== void 0 && _this$destination.info && !this.fetchMeetingInfoTimeoutId && !_util3.default.isOneOnOneCall(locus))) {
5497
+ _context12.next = 4;
5498
+ break;
5499
+ }
5500
+ _context12.prev = 1;
5501
+ _context12.next = 2;
5502
+ return this.fetchMeetingInfo({});
5503
+ case 2:
5504
+ _context12.next = 4;
5505
+ break;
5506
+ case 3:
5507
+ _context12.prev = 3;
5508
+ _t1 = _context12["catch"](1);
5509
+ _loggerProxy.default.logger.info("Meeting:index#finalizeMeetingAfterInitialLocusSetup --> deferred fetchMeetingInfo failed: ".concat(_t1.message));
5510
+ case 4:
5511
+ case "end":
5512
+ return _context12.stop();
5513
+ }
5514
+ }, _callee12, this, [[1, 3]]);
5515
+ }));
5516
+ function finalizeMeetingAfterInitialLocusSetup(_x10) {
5517
+ return _finalizeMeetingAfterInitialLocusSetup.apply(this, arguments);
5518
+ }
5519
+ return finalizeMeetingAfterInitialLocusSetup;
5520
+ }()
5171
5521
  /**
5172
5522
  * Set the locus info the class instance. Should be called with the parsed locus
5173
5523
  * we got in the join response.
@@ -5183,6 +5533,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5183
5533
  * @private
5184
5534
  * @memberof Meeting
5185
5535
  */
5536
+ )
5186
5537
  }, {
5187
5538
  key: "setLocus",
5188
5539
  value: function setLocus(data) {
@@ -5362,11 +5713,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5362
5713
  }, {
5363
5714
  key: "setLocalAudioStream",
5364
5715
  value: (function () {
5365
- var _setLocalAudioStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11(localStream) {
5716
+ var _setLocalAudioStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13(localStream) {
5366
5717
  var _this$audio2;
5367
5718
  var oldStream;
5368
- return _regenerator.default.wrap(function (_context11) {
5369
- while (1) switch (_context11.prev = _context11.next) {
5719
+ return _regenerator.default.wrap(function (_context13) {
5720
+ while (1) switch (_context13.prev = _context13.next) {
5370
5721
  case 0:
5371
5722
  oldStream = this.mediaProperties.audioStream;
5372
5723
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.UserMuteStateChange, this.localAudioStreamMuteStateHandler);
@@ -5380,21 +5731,21 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5380
5731
  localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.localAudioStreamMuteStateHandler);
5381
5732
  localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
5382
5733
  if (!(!this.isMultistream || !localStream)) {
5383
- _context11.next = 1;
5734
+ _context13.next = 1;
5384
5735
  break;
5385
5736
  }
5386
- _context11.next = 1;
5737
+ _context13.next = 1;
5387
5738
  return this.unpublishStream(_internalMediaCore.MediaType.AudioMain, oldStream);
5388
5739
  case 1:
5389
- _context11.next = 2;
5740
+ _context13.next = 2;
5390
5741
  return this.publishStream(_internalMediaCore.MediaType.AudioMain, this.mediaProperties.audioStream);
5391
5742
  case 2:
5392
5743
  case "end":
5393
- return _context11.stop();
5744
+ return _context13.stop();
5394
5745
  }
5395
- }, _callee11, this);
5746
+ }, _callee13, this);
5396
5747
  }));
5397
- function setLocalAudioStream(_x1) {
5748
+ function setLocalAudioStream(_x11) {
5398
5749
  return _setLocalAudioStream.apply(this, arguments);
5399
5750
  }
5400
5751
  return setLocalAudioStream;
@@ -5410,11 +5761,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5410
5761
  }, {
5411
5762
  key: "setLocalVideoStream",
5412
5763
  value: (function () {
5413
- var _setLocalVideoStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12(localStream) {
5764
+ var _setLocalVideoStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14(localStream) {
5414
5765
  var _this$video2;
5415
5766
  var oldStream;
5416
- return _regenerator.default.wrap(function (_context12) {
5417
- while (1) switch (_context12.prev = _context12.next) {
5767
+ return _regenerator.default.wrap(function (_context14) {
5768
+ while (1) switch (_context14.prev = _context14.next) {
5418
5769
  case 0:
5419
5770
  oldStream = this.mediaProperties.videoStream;
5420
5771
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.UserMuteStateChange, this.localVideoStreamMuteStateHandler);
@@ -5430,21 +5781,21 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5430
5781
  localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
5431
5782
  localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.ConstraintsChange, this.localConstraintsChangeHandler);
5432
5783
  if (!(!this.isMultistream || !localStream)) {
5433
- _context12.next = 1;
5784
+ _context14.next = 1;
5434
5785
  break;
5435
5786
  }
5436
- _context12.next = 1;
5787
+ _context14.next = 1;
5437
5788
  return this.unpublishStream(_internalMediaCore.MediaType.VideoMain, oldStream);
5438
5789
  case 1:
5439
- _context12.next = 2;
5790
+ _context14.next = 2;
5440
5791
  return this.publishStream(_internalMediaCore.MediaType.VideoMain, this.mediaProperties.videoStream);
5441
5792
  case 2:
5442
5793
  case "end":
5443
- return _context12.stop();
5794
+ return _context14.stop();
5444
5795
  }
5445
- }, _callee12, this);
5796
+ }, _callee14, this);
5446
5797
  }));
5447
- function setLocalVideoStream(_x10) {
5798
+ function setLocalVideoStream(_x12) {
5448
5799
  return _setLocalVideoStream.apply(this, arguments);
5449
5800
  }
5450
5801
  return setLocalVideoStream;
@@ -5461,10 +5812,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5461
5812
  }, {
5462
5813
  key: "setLocalShareVideoStream",
5463
5814
  value: (function () {
5464
- var _setLocalShareVideoStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13(localDisplayStream) {
5815
+ var _setLocalShareVideoStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15(localDisplayStream) {
5465
5816
  var oldStream;
5466
- return _regenerator.default.wrap(function (_context13) {
5467
- while (1) switch (_context13.prev = _context13.next) {
5817
+ return _regenerator.default.wrap(function (_context15) {
5818
+ while (1) switch (_context15.prev = _context15.next) {
5468
5819
  case 0:
5469
5820
  oldStream = this.mediaProperties.shareVideoStream;
5470
5821
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.handleShareVideoStreamMuteStateChange);
@@ -5476,21 +5827,21 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5476
5827
  localDisplayStream === null || localDisplayStream === void 0 ? void 0 : localDisplayStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
5477
5828
  this.mediaProperties.mediaDirection.sendShare = this.mediaProperties.hasLocalShareStream();
5478
5829
  if (!(!this.isMultistream || !localDisplayStream)) {
5479
- _context13.next = 1;
5830
+ _context15.next = 1;
5480
5831
  break;
5481
5832
  }
5482
- _context13.next = 1;
5833
+ _context15.next = 1;
5483
5834
  return this.unpublishStream(_internalMediaCore.MediaType.VideoSlides, oldStream);
5484
5835
  case 1:
5485
- _context13.next = 2;
5836
+ _context15.next = 2;
5486
5837
  return this.publishStream(_internalMediaCore.MediaType.VideoSlides, this.mediaProperties.shareVideoStream);
5487
5838
  case 2:
5488
5839
  case "end":
5489
- return _context13.stop();
5840
+ return _context15.stop();
5490
5841
  }
5491
- }, _callee13, this);
5842
+ }, _callee15, this);
5492
5843
  }));
5493
- function setLocalShareVideoStream(_x11) {
5844
+ function setLocalShareVideoStream(_x13) {
5494
5845
  return _setLocalShareVideoStream.apply(this, arguments);
5495
5846
  }
5496
5847
  return setLocalShareVideoStream;
@@ -5506,10 +5857,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5506
5857
  }, {
5507
5858
  key: "setLocalShareAudioStream",
5508
5859
  value: (function () {
5509
- var _setLocalShareAudioStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14(localSystemAudioStream) {
5860
+ var _setLocalShareAudioStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16(localSystemAudioStream) {
5510
5861
  var oldStream;
5511
- return _regenerator.default.wrap(function (_context14) {
5512
- while (1) switch (_context14.prev = _context14.next) {
5862
+ return _regenerator.default.wrap(function (_context16) {
5863
+ while (1) switch (_context16.prev = _context16.next) {
5513
5864
  case 0:
5514
5865
  oldStream = this.mediaProperties.shareAudioStream;
5515
5866
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.StreamEventNames.Ended, this.handleShareAudioStreamEnded);
@@ -5519,21 +5870,21 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5519
5870
  localSystemAudioStream === null || localSystemAudioStream === void 0 ? void 0 : localSystemAudioStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
5520
5871
  this.mediaProperties.mediaDirection.sendShare = this.mediaProperties.hasLocalShareStream();
5521
5872
  if (!(!this.isMultistream || !localSystemAudioStream)) {
5522
- _context14.next = 1;
5873
+ _context16.next = 1;
5523
5874
  break;
5524
5875
  }
5525
- _context14.next = 1;
5876
+ _context16.next = 1;
5526
5877
  return this.unpublishStream(_internalMediaCore.MediaType.AudioSlides, oldStream);
5527
5878
  case 1:
5528
- _context14.next = 2;
5879
+ _context16.next = 2;
5529
5880
  return this.publishStream(_internalMediaCore.MediaType.AudioSlides, this.mediaProperties.shareAudioStream);
5530
5881
  case 2:
5531
5882
  case "end":
5532
- return _context14.stop();
5883
+ return _context16.stop();
5533
5884
  }
5534
- }, _callee14, this);
5885
+ }, _callee16, this);
5535
5886
  }));
5536
- function setLocalShareAudioStream(_x12) {
5887
+ function setLocalShareAudioStream(_x14) {
5537
5888
  return _setLocalShareAudioStream.apply(this, arguments);
5538
5889
  }
5539
5890
  return setLocalShareAudioStream;
@@ -5642,8 +5993,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5642
5993
  var _this25 = this;
5643
5994
  // Client will have a socket manager and handle reconnecting to mercury, when we reconnect to mercury
5644
5995
  // if the meeting has active peer connections, it should try to reconnect.
5645
- // @ts-ignore
5646
- this.webex.internal.mercury.on(_constants.ONLINE, function () {
5996
+ this.mercuryOnlineHandler = function () {
5647
5997
  _loggerProxy.default.logger.info('Meeting:index#setMercuryListener --> Web socket online');
5648
5998
 
5649
5999
  // Only send restore event when it was disconnected before and for connected later
@@ -5653,15 +6003,48 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5653
6003
  });
5654
6004
  }
5655
6005
  _this25.hasWebsocketConnected = true;
5656
- });
5657
-
5658
- // @ts-ignore
5659
- this.webex.internal.mercury.on(_constants.OFFLINE, function () {
6006
+ };
6007
+ this.mercuryOfflineHandler = function () {
5660
6008
  _loggerProxy.default.logger.error('Meeting:index#setMercuryListener --> Web socket offline');
5661
6009
  _metrics.default.sendBehavioralMetric(_constants2.default.MERCURY_CONNECTION_FAILURE, {
5662
6010
  correlation_id: _this25.correlationId
5663
6011
  });
5664
- });
6012
+ };
6013
+
6014
+ // @ts-ignore
6015
+ this.webex.internal.mercury.on(_constants.ONLINE, this.mercuryOnlineHandler);
6016
+ // @ts-ignore
6017
+ this.webex.internal.mercury.on(_constants.OFFLINE, this.mercuryOfflineHandler);
6018
+ }
6019
+
6020
+ /**
6021
+ * Removes this meeting's Mercury ONLINE/OFFLINE event listeners registered
6022
+ * by setMercuryListener(). Must be called before Locus /leave to avoid
6023
+ * unnecessary syncs/metrics triggered by events received while leaving
6024
+ * (per Locus team recommendation).
6025
+ *
6026
+ * Mercury is a process-wide singleton shared with other plugins, so we
6027
+ * pass the bound handler refs to .off() to avoid clearing every listener
6028
+ * for ONLINE/OFFLINE on the shared emitter.
6029
+ *
6030
+ * Idempotent: subsequent calls are no-ops because the handler refs are
6031
+ * cleared after detaching.
6032
+ * @private
6033
+ * @returns {void}
6034
+ */
6035
+ }, {
6036
+ key: "stopListeningForMercuryEvents",
6037
+ value: function stopListeningForMercuryEvents() {
6038
+ if (this.mercuryOnlineHandler) {
6039
+ // @ts-ignore
6040
+ this.webex.internal.mercury.off(_constants.ONLINE, this.mercuryOnlineHandler);
6041
+ this.mercuryOnlineHandler = undefined;
6042
+ }
6043
+ if (this.mercuryOfflineHandler) {
6044
+ // @ts-ignore
6045
+ this.webex.internal.mercury.off(_constants.OFFLINE, this.mercuryOfflineHandler);
6046
+ this.mercuryOfflineHandler = undefined;
6047
+ }
5665
6048
  }
5666
6049
 
5667
6050
  /**
@@ -5972,22 +6355,25 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5972
6355
  }, {
5973
6356
  key: "joinWithMedia",
5974
6357
  value: (function () {
5975
- var _joinWithMedia = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
6358
+ var _joinWithMedia = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
5976
6359
  var _this30 = this;
5977
6360
  var options,
5978
6361
  mediaOptions,
5979
6362
  _options$joinOptions,
5980
6363
  joinOptions,
5981
6364
  _this$joinWithMediaRe,
5982
- isRetry,
6365
+ retryCount,
5983
6366
  prevJoinResponse,
6367
+ prevError,
5984
6368
  joined,
5985
6369
  joinResponse,
6370
+ shouldJoin,
5986
6371
  turnServerInfo,
5987
6372
  turnDiscoverySkippedReason,
5988
6373
  forceTurnDiscovery,
5989
6374
  turnDiscoveryRequest,
5990
6375
  _yield$this$roap$hand,
6376
+ shouldRetryMediaWithOnlyTurnTLS,
5991
6377
  mediaResponse,
5992
6378
  _this$locusUrl,
5993
6379
  _leaveError,
@@ -5995,64 +6381,77 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5995
6381
  shouldRetry,
5996
6382
  _error2,
5997
6383
  _error3,
5998
- _args15 = arguments,
5999
- _t0,
6000
- _t1;
6001
- return _regenerator.default.wrap(function (_context15) {
6002
- while (1) switch (_context15.prev = _context15.next) {
6384
+ firstError,
6385
+ _args17 = arguments,
6386
+ _t10,
6387
+ _t11;
6388
+ return _regenerator.default.wrap(function (_context17) {
6389
+ while (1) switch (_context17.prev = _context17.next) {
6003
6390
  case 0:
6004
- options = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
6391
+ options = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
6005
6392
  mediaOptions = options.mediaOptions, _options$joinOptions = options.joinOptions, joinOptions = _options$joinOptions === void 0 ? {} : _options$joinOptions;
6006
- _this$joinWithMediaRe = this.joinWithMediaRetryInfo, isRetry = _this$joinWithMediaRe.isRetry, prevJoinResponse = _this$joinWithMediaRe.prevJoinResponse;
6393
+ _this$joinWithMediaRe = this.joinWithMediaRetryInfo, retryCount = _this$joinWithMediaRe.retryCount, prevJoinResponse = _this$joinWithMediaRe.prevJoinResponse, prevError = _this$joinWithMediaRe.prevError;
6007
6394
  if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.allowMediaInLobby) {
6008
- _context15.next = 1;
6395
+ _context17.next = 1;
6009
6396
  break;
6010
6397
  }
6011
- return _context15.abrupt("return", _promise.default.reject(new _parameter.default('joinWithMedia() can only be used with allowMediaInLobby set to true')));
6398
+ return _context17.abrupt("return", _promise.default.reject(new _parameter.default('joinWithMedia() can only be used with allowMediaInLobby set to true')));
6012
6399
  case 1:
6013
6400
  this.allowMediaInLobby = true;
6014
6401
  _loggerProxy.default.logger.info('Meeting:index#joinWithMedia called');
6015
- joined = false;
6016
- joinResponse = prevJoinResponse;
6402
+
6017
6403
  /* Before we do anything, check if RTCPeerConnection is available. Normally this is checked
6018
6404
  by addMediaInternal() itself when creating the media connection, but since joinWithMedia()
6019
6405
  is a convenience method that does both join() and addMedia(), we want to fail fast here
6020
6406
  in case WebRTC is not available at all.
6021
6407
  */
6022
6408
  if (!(_webCapabilities.WebCapabilities.supportsRTCPeerConnection() === _webCapabilities.CapabilityState.NOT_CAPABLE)) {
6023
- _context15.next = 2;
6409
+ _context17.next = 2;
6024
6410
  break;
6025
6411
  }
6026
6412
  throw new _internalMediaCore.Errors.WebrtcApiNotAvailableError('RTCPeerConnection API is not available in this environment');
6027
6413
  case 2:
6028
- _context15.prev = 2;
6414
+ /* While we're trying to join, we may fail and be doing a retry. In that case,
6415
+ we sometimes get dropped by Locus as a result of the 1st failed attempt.
6416
+ That notification from Locus needs to be ignored, otherwise it causes the meeting to be
6417
+ cleaned up and prevents the retry from running correctly.
6418
+ */
6419
+ this.locusInfo.suspendDestroyMeeting(true);
6420
+ joined = false;
6421
+ joinResponse = prevJoinResponse;
6422
+ shouldJoin = !joinResponse ||
6423
+ // first try, when the join response is empty
6424
+ prevError && prevError instanceof _webexErrors.UserNotJoinedError ||
6425
+ // last try failed with UserNotJoinedError
6426
+ this.isErrorMeaningLocusDroppedUs(prevError) || _util2.default.isUserInLeftState(this.locusInfo); // locus dropped the connection before we can re-try addMedia
6427
+ _context17.prev = 3;
6029
6428
  forceTurnDiscovery = false;
6030
- if (joinResponse) {
6031
- _context15.next = 7;
6429
+ if (!shouldJoin) {
6430
+ _context17.next = 8;
6032
6431
  break;
6033
6432
  }
6034
- _context15.next = 3;
6433
+ _context17.next = 4;
6035
6434
  return this.roap.generateTurnDiscoveryRequestMessage(this, true);
6036
- case 3:
6037
- turnDiscoveryRequest = _context15.sent;
6435
+ case 4:
6436
+ turnDiscoveryRequest = _context17.sent;
6038
6437
  turnDiscoverySkippedReason = turnDiscoveryRequest.turnDiscoverySkippedReason;
6039
6438
  joinOptions.roapMessage = turnDiscoveryRequest.roapMessage;
6040
6439
  _loggerProxy.default.logger.info('Meeting:index#joinWithMedia ---> calling join with joinOptions, ', joinOptions);
6041
- _context15.next = 4;
6440
+ _context17.next = 5;
6042
6441
  return this.join(joinOptions);
6043
- case 4:
6044
- joinResponse = _context15.sent;
6442
+ case 5:
6443
+ joinResponse = _context17.sent;
6045
6444
  joined = true;
6046
6445
 
6047
6446
  // if we sent out TURN discovery Roap message with join, process the TURN discovery response
6048
6447
  if (!joinOptions.roapMessage) {
6049
- _context15.next = 6;
6448
+ _context17.next = 7;
6050
6449
  break;
6051
6450
  }
6052
- _context15.next = 5;
6451
+ _context17.next = 6;
6053
6452
  return this.roap.handleTurnDiscoveryHttpResponse(this, joinResponse);
6054
- case 5:
6055
- _yield$this$roap$hand = _context15.sent;
6453
+ case 6:
6454
+ _yield$this$roap$hand = _context17.sent;
6056
6455
  turnServerInfo = _yield$this$roap$hand.turnServerInfo;
6057
6456
  turnDiscoverySkippedReason = _yield$this$roap$hand.turnDiscoverySkippedReason;
6058
6457
  this.turnDiscoverySkippedReason = turnDiscoverySkippedReason;
@@ -6060,107 +6459,121 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6060
6459
  if (turnServerInfo === undefined) {
6061
6460
  this.roap.abortTurnDiscovery();
6062
6461
  }
6063
- case 6:
6064
- _context15.next = 8;
6065
- break;
6066
6462
  case 7:
6463
+ _context17.next = 9;
6464
+ break;
6465
+ case 8:
6067
6466
  // This is a retry, when join succeeded but addMedia failed, so we'll just call addMedia() again,
6068
6467
  // but we need to ensure that it also does a new TURN discovery
6069
6468
  forceTurnDiscovery = true;
6070
6469
  joined = true;
6071
- case 8:
6072
- _context15.next = 9;
6073
- return this.addMediaInternal(function () {
6074
- return _this30.joinWithMediaRetryInfo.isRetry ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY';
6075
- }, turnServerInfo, forceTurnDiscovery, mediaOptions);
6076
6470
  case 9:
6077
- mediaResponse = _context15.sent;
6471
+ _context17.next = 10;
6472
+ return this.shouldRetryMediaWithOnlyTurnTLS(prevError);
6473
+ case 10:
6474
+ shouldRetryMediaWithOnlyTurnTLS = _context17.sent;
6475
+ _context17.next = 11;
6476
+ return this.addMediaInternal(function () {
6477
+ // callback is not called when UserNotJoinedError is thrown
6478
+ return _this30.joinWithMediaRetryInfo.retryCount >= 1 ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY';
6479
+ }, forceTurnDiscovery, turnServerInfo, shouldRetryMediaWithOnlyTurnTLS ? 'relay' : undefined, mediaOptions);
6480
+ case 11:
6481
+ mediaResponse = _context17.sent;
6078
6482
  this.joinWithMediaRetryInfo = {
6079
- isRetry: false,
6483
+ retryCount: 0,
6080
6484
  prevJoinResponse: undefined
6081
6485
  };
6082
- return _context15.abrupt("return", {
6486
+ this.locusInfo.suspendDestroyMeeting(false);
6487
+ return _context17.abrupt("return", {
6083
6488
  join: joinResponse,
6084
6489
  media: mediaResponse,
6085
6490
  multistreamEnabled: this.isMultistream
6086
6491
  });
6087
- case 10:
6088
- _context15.prev = 10;
6089
- _t0 = _context15["catch"](2);
6090
- _loggerProxy.default.logger.error('Meeting:index#joinWithMedia --> ', _t0);
6492
+ case 12:
6493
+ _context17.prev = 12;
6494
+ _t10 = _context17["catch"](3);
6495
+ _loggerProxy.default.logger.error('Meeting:index#joinWithMedia --> ', _t10);
6091
6496
  this.roap.abortTurnDiscovery();
6092
6497
 
6093
- // if this was the first attempt, let's do a retry
6094
- shouldRetry = !isRetry;
6095
- if (_internalPluginMetrics.CallDiagnosticUtils.isSdpOfferCreationError(_t0) || _internalPluginMetrics.CallDiagnosticUtils.isWebrtcApiNotAvailableError(_t0)) {
6498
+ // let's do a retry (but not on 1-1 calls, because the flow would get too complicated)
6499
+ shouldRetry = !_util3.default.isOneOnOneCall(this.locusInfo.parsedLocus) && (retryCount < 1 || (_t10 instanceof _webexErrors.UserNotJoinedError || this.isErrorMeaningLocusDroppedUs(_t10)) && retryCount < JOIN_WITH_MEDIA_RETRY_MAX_COUNT);
6500
+ if (_internalPluginMetrics.CallDiagnosticUtils.isSdpOfferCreationError(_t10) || _internalPluginMetrics.CallDiagnosticUtils.isWebrtcApiNotAvailableError(_t10)) {
6096
6501
  // errors related to offer creation (for example missing H264 codec) will happen again no matter how many times we try,
6097
6502
  // so there is no point doing a retry
6098
6503
  shouldRetry = false;
6099
6504
  }
6100
- if (_internalPluginMetrics.CallDiagnosticUtils.isBrowserMediaError(_t0)) {
6505
+ if (_internalPluginMetrics.CallDiagnosticUtils.isBrowserMediaError(_t10)) {
6101
6506
  shouldRetry = false;
6102
6507
  // eslint-disable-next-line no-ex-assign
6103
- _t0 = (0, _lodash.merge)({
6508
+ _t10 = (0, _lodash.merge)({
6104
6509
  error: {
6105
6510
  body: {
6106
- errorCode: _internalPluginMetrics.CallDiagnosticUtils.getBrowserMediaErrorCode(_t0),
6107
- message: (_error2 = _t0) === null || _error2 === void 0 ? void 0 : _error2.message,
6108
- name: (_error3 = _t0) === null || _error3 === void 0 ? void 0 : _error3.name
6511
+ errorCode: _internalPluginMetrics.CallDiagnosticUtils.getBrowserMediaErrorCode(_t10),
6512
+ message: (_error2 = _t10) === null || _error2 === void 0 ? void 0 : _error2.message,
6513
+ name: (_error3 = _t10) === null || _error3 === void 0 ? void 0 : _error3.name
6109
6514
  }
6110
6515
  }
6111
6516
  });
6112
6517
  }
6113
6518
 
6114
- // we only want to call leave if join was successful and this was a retry or we won't be doing any more retries
6115
- if (!(joined && (isRetry || !shouldRetry))) {
6116
- _context15.next = 14;
6519
+ // we only want to call leave if join was successful, and we won't be doing any more retries
6520
+ if (!(joined && !shouldRetry)) {
6521
+ _context17.next = 16;
6117
6522
  break;
6118
6523
  }
6119
- _context15.prev = 11;
6120
- _context15.next = 12;
6524
+ _context17.prev = 13;
6525
+ _context17.next = 14;
6121
6526
  return this.leave({
6122
6527
  resourceId: joinOptions === null || joinOptions === void 0 ? void 0 : joinOptions.resourceId,
6123
6528
  reason: 'joinWithMedia failure'
6124
6529
  });
6125
- case 12:
6126
- _context15.next = 14;
6127
- break;
6128
- case 13:
6129
- _context15.prev = 13;
6130
- _t1 = _context15["catch"](11);
6131
- _loggerProxy.default.logger.error('Meeting:index#joinWithMedia --> leave error', _t1);
6132
- leaveError = _t1;
6133
6530
  case 14:
6531
+ _context17.next = 16;
6532
+ break;
6533
+ case 15:
6534
+ _context17.prev = 15;
6535
+ _t11 = _context17["catch"](13);
6536
+ _loggerProxy.default.logger.error('Meeting:index#joinWithMedia --> leave error', _t11);
6537
+ leaveError = _t11;
6538
+ case 16:
6134
6539
  _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_WITH_MEDIA_FAILURE, {
6135
6540
  correlation_id: this.correlationId,
6136
6541
  locus_id: (_this$locusUrl = this.locusUrl) === null || _this$locusUrl === void 0 ? void 0 : _this$locusUrl.split('/').pop(),
6137
6542
  // if join fails, we may end up with no locusUrl
6138
- reason: _t0.message,
6139
- stack: _t0.stack,
6543
+ reason: _t10.message,
6544
+ stack: _t10.stack,
6140
6545
  leaveErrorReason: (_leaveError = leaveError) === null || _leaveError === void 0 ? void 0 : _leaveError.message,
6141
- isRetry: isRetry
6546
+ isRetry: retryCount > 0
6142
6547
  }, {
6143
- type: _t0.name
6548
+ type: _t10.name
6144
6549
  });
6145
6550
  if (!shouldRetry) {
6146
- _context15.next = 15;
6551
+ _context17.next = 17;
6147
6552
  break;
6148
6553
  }
6149
6554
  _loggerProxy.default.logger.warn('Meeting:index#joinWithMedia --> retrying call to joinWithMedia');
6150
- this.joinWithMediaRetryInfo.isRetry = true;
6555
+ this.joinWithMediaRetryInfo.retryCount = retryCount + 1;
6151
6556
  this.joinWithMediaRetryInfo.prevJoinResponse = joinResponse;
6152
- return _context15.abrupt("return", this.joinWithMedia(options));
6153
- case 15:
6557
+ this.joinWithMediaRetryInfo.prevError = _t10;
6558
+ if (!this.joinWithMediaRetryInfo.firstError) {
6559
+ this.joinWithMediaRetryInfo.firstError = _t10;
6560
+ }
6561
+ return _context17.abrupt("return", this.joinWithMedia(options));
6562
+ case 17:
6563
+ firstError = this.joinWithMediaRetryInfo.firstError;
6154
6564
  this.joinWithMediaRetryInfo = {
6155
- isRetry: false,
6156
- prevJoinResponse: undefined
6565
+ retryCount: 0,
6566
+ prevJoinResponse: undefined,
6567
+ firstError: undefined,
6568
+ prevError: undefined
6157
6569
  };
6158
- throw _t0;
6159
- case 16:
6570
+ this.locusInfo.suspendDestroyMeeting(false);
6571
+ throw firstError !== null && firstError !== void 0 ? firstError : _t10;
6572
+ case 18:
6160
6573
  case "end":
6161
- return _context15.stop();
6574
+ return _context17.stop();
6162
6575
  }
6163
- }, _callee15, this, [[2, 10], [11, 13]]);
6576
+ }, _callee17, this, [[3, 12], [13, 15]]);
6164
6577
  }));
6165
6578
  function joinWithMedia() {
6166
6579
  return _joinWithMedia.apply(this, arguments);
@@ -6190,20 +6603,20 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6190
6603
  return _promise.default.reject(new _parameter.default('Cannot reconnect, Media has not established to reconnect'));
6191
6604
  }
6192
6605
  this.cleanUpBeforeReconnection();
6193
- return this.reconnectionManager.reconnect(options, /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
6194
- return _regenerator.default.wrap(function (_context16) {
6195
- while (1) switch (_context16.prev = _context16.next) {
6606
+ return this.reconnectionManager.reconnect(options, /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
6607
+ return _regenerator.default.wrap(function (_context18) {
6608
+ while (1) switch (_context18.prev = _context18.next) {
6196
6609
  case 0:
6197
- _context16.next = 1;
6610
+ _context18.next = 1;
6198
6611
  return _this31.waitForRemoteSDPAnswer();
6199
6612
  case 1:
6200
- _context16.next = 2;
6613
+ _context18.next = 2;
6201
6614
  return _this31.waitForMediaConnectionConnected();
6202
6615
  case 2:
6203
6616
  case "end":
6204
- return _context16.stop();
6617
+ return _context18.stop();
6205
6618
  }
6206
- }, _callee16);
6619
+ }, _callee18);
6207
6620
  }))).then(function () {
6208
6621
  _loggerProxy.default.logger.log('Meeting:index#reconnect --> Meeting reconnect success');
6209
6622
  }).catch(function (error) {
@@ -6243,8 +6656,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6243
6656
  }, {
6244
6657
  key: "isReactionsSupported",
6245
6658
  value: function isReactionsSupported() {
6246
- var _this$locusInfo6, _this$locusInfo6$cont;
6247
- if ((_this$locusInfo6 = this.locusInfo) !== null && _this$locusInfo6 !== void 0 && (_this$locusInfo6$cont = _this$locusInfo6.controls) !== null && _this$locusInfo6$cont !== void 0 && _this$locusInfo6$cont.reactions.enabled) {
6659
+ var _this$locusInfo8, _this$locusInfo8$cont;
6660
+ if ((_this$locusInfo8 = this.locusInfo) !== null && _this$locusInfo8 !== void 0 && (_this$locusInfo8$cont = _this$locusInfo8.controls) !== null && _this$locusInfo8$cont !== void 0 && _this$locusInfo8$cont.reactions.enabled) {
6248
6661
  return true;
6249
6662
  }
6250
6663
  _loggerProxy.default.logger.error('Meeting:index#isReactionsSupported --> Reactions is not supported');
@@ -6344,53 +6757,75 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6344
6757
  }, {
6345
6758
  key: "startTranscription",
6346
6759
  value: (function () {
6347
- var _startTranscription = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(options) {
6348
- var _t10;
6349
- return _regenerator.default.wrap(function (_context17) {
6350
- while (1) switch (_context17.prev = _context17.next) {
6760
+ var _startTranscription = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19(options) {
6761
+ var _t12;
6762
+ return _regenerator.default.wrap(function (_context19) {
6763
+ while (1) switch (_context19.prev = _context19.next) {
6351
6764
  case 0:
6352
6765
  if (!this.isJoined()) {
6353
- _context17.next = 5;
6766
+ _context19.next = 5;
6354
6767
  break;
6355
6768
  }
6356
6769
  _loggerProxy.default.logger.info('Meeting:index#startTranscription --> Attempting to enable transcription!');
6357
- _context17.prev = 1;
6770
+ _context19.prev = 1;
6358
6771
  if (!this.areVoiceaEventsSetup) {
6359
6772
  this.setUpVoiceaListeners();
6360
6773
  }
6361
6774
 
6362
6775
  // @ts-ignore
6363
- _context17.next = 2;
6776
+ _context19.next = 2;
6364
6777
  return this.webex.internal.voicea.turnOnCaptions(options === null || options === void 0 ? void 0 : options.spokenLanguage);
6365
6778
  case 2:
6366
- _context17.next = 4;
6779
+ _context19.next = 4;
6367
6780
  break;
6368
6781
  case 3:
6369
- _context17.prev = 3;
6370
- _t10 = _context17["catch"](1);
6371
- _loggerProxy.default.logger.error("Meeting:index#startTranscription --> ".concat(_t10));
6782
+ _context19.prev = 3;
6783
+ _t12 = _context19["catch"](1);
6784
+ _loggerProxy.default.logger.error("Meeting:index#startTranscription --> ".concat(_t12));
6372
6785
  _metrics.default.sendBehavioralMetric(_constants2.default.RECEIVE_TRANSCRIPTION_FAILURE, {
6373
6786
  correlation_id: this.correlationId,
6374
- reason: _t10.message,
6375
- stack: _t10.stack
6787
+ reason: _t12.message,
6788
+ stack: _t12.stack
6376
6789
  });
6377
6790
  case 4:
6378
- _context17.next = 6;
6791
+ _context19.next = 6;
6379
6792
  break;
6380
6793
  case 5:
6381
6794
  _loggerProxy.default.logger.error("Meeting:index#startTranscription --> meeting joined : ".concat(this.isJoined()));
6382
6795
  throw new Error('Meeting is not joined');
6383
6796
  case 6:
6384
6797
  case "end":
6385
- return _context17.stop();
6798
+ return _context19.stop();
6386
6799
  }
6387
- }, _callee17, this, [[1, 3]]);
6800
+ }, _callee19, this, [[1, 3]]);
6388
6801
  }));
6389
- function startTranscription(_x13) {
6802
+ function startTranscription(_x15) {
6390
6803
  return _startTranscription.apply(this, arguments);
6391
6804
  }
6392
6805
  return startTranscription;
6393
6806
  }())
6807
+ }, {
6808
+ key: "isRelayEventRouteValid",
6809
+ value:
6810
+ /**
6811
+ * Verifies the relay event was delivered for the active LLM session binding.
6812
+ * @param {RelayEvent} event Event object coming from LLM Connection
6813
+ * @returns {boolean}
6814
+ */
6815
+ function isRelayEventRouteValid(event) {
6816
+ var _event$headers;
6817
+ var route = event === null || event === void 0 ? void 0 : (_event$headers = event.headers) === null || _event$headers === void 0 ? void 0 : _event$headers.route;
6818
+ if (!route) {
6819
+ return true;
6820
+ }
6821
+ var llm = this.webex.internal.llm;
6822
+ var isPracticeSession = llm.isConnected(_constants.LLM_PRACTICE_SESSION);
6823
+ var expectedBinding = isPracticeSession ? llm.getBinding(_constants.LLM_PRACTICE_SESSION) : llm.getBinding();
6824
+ if (!expectedBinding || route === expectedBinding) {
6825
+ return true;
6826
+ }
6827
+ return false;
6828
+ }
6394
6829
  }, {
6395
6830
  key: "stopTranscription",
6396
6831
  value:
@@ -6441,10 +6876,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6441
6876
  key: "restoreLLMSubscriptionsIfNeeded",
6442
6877
  value: function restoreLLMSubscriptionsIfNeeded() {
6443
6878
  try {
6444
- var _this$webex$internal$, _this$webex$internal$2;
6445
- // @ts-ignore
6446
- var isCaptionBoxOn = (_this$webex$internal$ = this.webex.internal.voicea) === null || _this$webex$internal$ === void 0 ? void 0 : (_this$webex$internal$2 = _this$webex$internal$.getIsCaptionBoxOn) === null || _this$webex$internal$2 === void 0 ? void 0 : _this$webex$internal$2.call(_this$webex$internal$);
6447
- if (!isCaptionBoxOn) {
6879
+ var _this$webex$internal$9, _this$webex$internal$0;
6880
+ var keepTranscriptionSubscribed = // @ts-ignore
6881
+ (_this$webex$internal$9 = this.webex.internal.voicea) === null || _this$webex$internal$9 === void 0 ? void 0 : (_this$webex$internal$0 = _this$webex$internal$9.getKeepTranscriptionSubscribed) === null || _this$webex$internal$0 === void 0 ? void 0 : _this$webex$internal$0.call(_this$webex$internal$9);
6882
+ if (!keepTranscriptionSubscribed) {
6448
6883
  return;
6449
6884
  }
6450
6885
 
@@ -6473,7 +6908,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6473
6908
  * Scenario D: Joining any other way (sip, pstn, conversationUrl, link just need to specify resourceId)
6474
6909
  */
6475
6910
  function () {
6476
- var _join = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
6911
+ var _join = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
6477
6912
  var _this34 = this;
6478
6913
  var options,
6479
6914
  errorMessage,
@@ -6484,26 +6919,26 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6484
6919
  _error4,
6485
6920
  _errorMessage3,
6486
6921
  _error5,
6487
- _args18 = arguments,
6488
- _t11;
6489
- return _regenerator.default.wrap(function (_context18) {
6490
- while (1) switch (_context18.prev = _context18.next) {
6922
+ _args20 = arguments,
6923
+ _t13;
6924
+ return _regenerator.default.wrap(function (_context20) {
6925
+ while (1) switch (_context20.prev = _context20.next) {
6491
6926
  case 0:
6492
- options = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
6927
+ options = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
6493
6928
  if (this.webex.meetings.registered) {
6494
- _context18.next = 1;
6929
+ _context20.next = 1;
6495
6930
  break;
6496
6931
  }
6497
6932
  errorMessage = 'Meeting:index#join --> Device not registered';
6498
6933
  error = new Error(errorMessage);
6499
6934
  _loggerProxy.default.logger.error(errorMessage);
6500
- return _context18.abrupt("return", _promise.default.reject(error));
6935
+ return _context20.abrupt("return", _promise.default.reject(error));
6501
6936
  case 1:
6502
6937
  if (!this.deferJoin) {
6503
- _context18.next = 2;
6938
+ _context20.next = 2;
6504
6939
  break;
6505
6940
  }
6506
- return _context18.abrupt("return", this.deferJoin);
6941
+ return _context20.abrupt("return", this.deferJoin);
6507
6942
  case 2:
6508
6943
  // Create a deferred promise for a consistent resolve value from utils.
6509
6944
  // This also prevents redundant API calls.
@@ -6555,15 +6990,15 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6555
6990
  this.wirelessShare = true;
6556
6991
  }
6557
6992
  if (!options.meetingQuality) {
6558
- _context18.next = 6;
6993
+ _context20.next = 6;
6559
6994
  break;
6560
6995
  }
6561
6996
  if (!(typeof options.meetingQuality === 'string')) {
6562
- _context18.next = 4;
6997
+ _context20.next = 4;
6563
6998
  break;
6564
6999
  }
6565
7000
  if (_constants.QUALITY_LEVELS[options.meetingQuality]) {
6566
- _context18.next = 3;
7001
+ _context20.next = 3;
6567
7002
  break;
6568
7003
  }
6569
7004
  _errorMessage2 = "Meeting:index#join --> ".concat(options.meetingQuality, " not defined");
@@ -6571,16 +7006,16 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6571
7006
  _loggerProxy.default.logger.error(_errorMessage2);
6572
7007
  joinFailed(_error4);
6573
7008
  this.deferJoin = undefined;
6574
- return _context18.abrupt("return", _promise.default.reject(_error4));
7009
+ return _context20.abrupt("return", _promise.default.reject(_error4));
6575
7010
  case 3:
6576
7011
  this.mediaProperties.setRemoteQualityLevel(options.meetingQuality);
6577
7012
  case 4:
6578
7013
  if (!((0, _typeof2.default)(options.meetingQuality) === 'object')) {
6579
- _context18.next = 6;
7014
+ _context20.next = 6;
6580
7015
  break;
6581
7016
  }
6582
7017
  if (_constants.QUALITY_LEVELS[options.meetingQuality.remote]) {
6583
- _context18.next = 5;
7018
+ _context20.next = 5;
6584
7019
  break;
6585
7020
  }
6586
7021
  _errorMessage3 = "Meeting:index#join --> ".concat(options.meetingQuality.remote, " not defined");
@@ -6588,42 +7023,42 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6588
7023
  _error5 = new Error(_errorMessage3);
6589
7024
  joinFailed(_error5);
6590
7025
  this.deferJoin = undefined;
6591
- return _context18.abrupt("return", _promise.default.reject(new Error(_errorMessage3)));
7026
+ return _context20.abrupt("return", _promise.default.reject(new Error(_errorMessage3)));
6592
7027
  case 5:
6593
7028
  if (options.meetingQuality.remote) {
6594
7029
  this.mediaProperties.setRemoteQualityLevel(options.meetingQuality.remote);
6595
7030
  }
6596
7031
  case 6:
6597
7032
  this.isMultistream = !!options.enableMultistream;
6598
- _context18.prev = 7;
6599
- _context18.next = 8;
7033
+ _context20.prev = 7;
7034
+ _context20.next = 8;
6600
7035
  return this.checkAndRefreshPermissionToken(_constants.MEETING_PERMISSION_TOKEN_REFRESH_THRESHOLD_IN_SEC, _constants.MEETING_PERMISSION_TOKEN_REFRESH_REASON);
6601
7036
  case 8:
6602
- _context18.next = 10;
7037
+ _context20.next = 10;
6603
7038
  break;
6604
7039
  case 9:
6605
- _context18.prev = 9;
6606
- _t11 = _context18["catch"](7);
6607
- _loggerProxy.default.logger.error('Meeting:index#join --> Failed to refresh permission token:', _t11);
6608
- if (!(_t11 instanceof _captchaError.default || _t11 instanceof _passwordError.default || _t11 instanceof _permission.default)) {
6609
- _context18.next = 10;
7040
+ _context20.prev = 9;
7041
+ _t13 = _context20["catch"](7);
7042
+ _loggerProxy.default.logger.error('Meeting:index#join --> Failed to refresh permission token:', _t13);
7043
+ if (!(_t13 instanceof _captchaError.default || _t13 instanceof _passwordError.default || _t13 instanceof _permission.default)) {
7044
+ _context20.next = 10;
6610
7045
  break;
6611
7046
  }
6612
- this.meetingFiniteStateMachine.fail(_t11);
7047
+ this.meetingFiniteStateMachine.fail(_t13);
6613
7048
 
6614
7049
  // Upload logs on refreshpermissionToken refresh Failure
6615
7050
  _triggerProxy.default.trigger(this, {
6616
7051
  file: 'meeting/index',
6617
7052
  function: 'join'
6618
7053
  }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, this);
6619
- joinFailed(_t11);
7054
+ joinFailed(_t13);
6620
7055
  this.deferJoin = undefined;
6621
7056
 
6622
7057
  // if refresh permission token requires captcha, password or permission, we are throwing the errors
6623
7058
  // and bubble it up to client
6624
- return _context18.abrupt("return", _promise.default.reject(_t11));
7059
+ return _context20.abrupt("return", _promise.default.reject(_t13));
6625
7060
  case 10:
6626
- return _context18.abrupt("return", _util2.default.joinMeetingOptions(this, options).then(function (join) {
7061
+ return _context20.abrupt("return", _util2.default.joinMeetingOptions(this, options).then(function (join) {
6627
7062
  _this34.meetingFiniteStateMachine.join();
6628
7063
  _this34.setupLocusMediaRequest();
6629
7064
 
@@ -6664,7 +7099,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6664
7099
  _this34.webex.internal.llm.off('online', _this34.handleLLMOnline);
6665
7100
  // @ts-ignore
6666
7101
  _this34.webex.internal.llm.on('online', _this34.handleLLMOnline);
6667
- _this34.updateLLMConnection().catch(function (error) {
7102
+ _this34.updateLLMConnection({
7103
+ isInitialJoinPhase: true
7104
+ }).catch(function (error) {
6668
7105
  _loggerProxy.default.logger.error('Meeting:index#join --> Transcription Socket Connection Failed', error);
6669
7106
  _metrics.default.sendBehavioralMetric(_constants2.default.LLM_CONNECTION_AFTER_JOIN_FAILURE, {
6670
7107
  correlation_id: _this34.correlationId,
@@ -6679,9 +7116,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6679
7116
  }));
6680
7117
  case 11:
6681
7118
  case "end":
6682
- return _context18.stop();
7119
+ return _context20.stop();
6683
7120
  }
6684
- }, _callee18, this, [[7, 9]]);
7121
+ }, _callee20, this, [[7, 9]]);
6685
7122
  }));
6686
7123
  function join() {
6687
7124
  return _join.apply(this, arguments);
@@ -6730,17 +7167,66 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6730
7167
  this.llmHealthCheckTimer = undefined;
6731
7168
  }
6732
7169
  }
7170
+
7171
+ /**
7172
+ * Removes LLM event listeners and clears the health check timer.
7173
+ * Must be called before Locus /leave to avoid unnecessary syncs triggered
7174
+ * by events received while leaving (per Locus team recommendation).
7175
+ * Idempotent: safe to call multiple times; .off() is a no-op when no
7176
+ * matching listener is registered.
7177
+ * @private
7178
+ * @returns {void}
7179
+ */
7180
+ }, {
7181
+ key: "stopListeningForLLMEvents",
7182
+ value: function stopListeningForLLMEvents() {
7183
+ // @ts-ignore - fix types
7184
+ this.webex.internal.llm.off('event:relay.event', this.processRelayEvent);
7185
+ // @ts-ignore - fix types
7186
+ this.webex.internal.llm.off(_constants.LOCUS_LLM_EVENT, this.processLocusLLMEvent);
7187
+ this.clearLLMHealthCheckTimer();
7188
+ }
7189
+
7190
+ /**
7191
+ * Stops listening on every event bus (LLM, Mercury, voicea/transcription,
7192
+ * annotation) that could otherwise deliver events to this meeting while
7193
+ * Locus is processing /leave or /end. Per the Locus team recommendation,
7194
+ * this must run before the Locus request is dispatched to avoid
7195
+ * unnecessary syncs triggered by in-flight events.
7196
+ *
7197
+ * Voicea (transcription) subscribes to llm 'event:relay.event' internally,
7198
+ * and the annotation plugin subscribes to both mercury and llm, so both
7199
+ * must be torn down alongside the direct LLM/Mercury listeners.
7200
+ *
7201
+ * Idempotent: safe to call multiple times; .off() is a no-op when no
7202
+ * matching listener is registered, and stopTranscription is guarded.
7203
+ * @private
7204
+ * @returns {void}
7205
+ */
7206
+ }, {
7207
+ key: "stopListeningForMeetingEvents",
7208
+ value: function stopListeningForMeetingEvents() {
7209
+ this.stopListeningForLLMEvents();
7210
+ this.stopListeningForMercuryEvents();
7211
+ if (this.transcription) {
7212
+ this.stopTranscription();
7213
+ this.transcription = undefined;
7214
+ }
7215
+ this.annotation.deregisterEvents();
7216
+ }
6733
7217
  }, {
6734
7218
  key: "clearDataChannelToken",
6735
7219
  value:
6736
7220
  /**
6737
- * Clears all data channel tokens stored in LLM.
6738
- * Called during meeting cleanup to ensure stale tokens are not reused.
7221
+ * Clears data channel tokens associated with this meeting ownership.
7222
+ * Ownership checks are enforced in internal-plugin-llm.
6739
7223
  * @returns {void}
6740
7224
  */
6741
7225
  function clearDataChannelToken() {
6742
7226
  // @ts-ignore
6743
- this.webex.internal.llm.resetDatachannelTokens();
7227
+ this.webex.internal.llm.clearDatachannelToken(_constants.LLM_DEFAULT_SESSION, this.id);
7228
+ // @ts-ignore
7229
+ this.webex.internal.llm.clearDatachannelToken(_constants.LLM_PRACTICE_SESSION, this.id);
6744
7230
  }
6745
7231
 
6746
7232
  /**
@@ -6757,11 +7243,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6757
7243
  var practiceSessionDatachannelToken = join === null || join === void 0 ? void 0 : (_join$locus2 = join.locus) === null || _join$locus2 === void 0 ? void 0 : (_join$locus2$self = _join$locus2.self) === null || _join$locus2$self === void 0 ? void 0 : _join$locus2$self.practiceSessionDatachannelToken;
6758
7244
  if (datachannelToken) {
6759
7245
  // @ts-ignore
6760
- this.webex.internal.llm.setDatachannelToken(datachannelToken, _internalPluginLlm.DataChannelTokenType.Default);
7246
+ this.webex.internal.llm.setDatachannelToken(datachannelToken, _constants.LLM_DEFAULT_SESSION, this.id);
6761
7247
  }
6762
7248
  if (practiceSessionDatachannelToken) {
6763
7249
  // @ts-ignore
6764
- this.webex.internal.llm.setDatachannelToken(practiceSessionDatachannelToken, _internalPluginLlm.DataChannelTokenType.PracticeSession);
7250
+ this.webex.internal.llm.setDatachannelToken(practiceSessionDatachannelToken, _constants.LLM_PRACTICE_SESSION, this.id);
6765
7251
  }
6766
7252
  }
6767
7253
 
@@ -6773,55 +7259,55 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6773
7259
  }, {
6774
7260
  key: "ensureDefaultDatachannelTokenAfterAdmit",
6775
7261
  value: (function () {
6776
- var _ensureDefaultDatachannelTokenAfterAdmit = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
6777
- var _response$body, datachannelToken, isDataChannelTokenEnabled, response, fetchedDatachannelToken, msg, _t12;
6778
- return _regenerator.default.wrap(function (_context19) {
6779
- while (1) switch (_context19.prev = _context19.next) {
7262
+ var _ensureDefaultDatachannelTokenAfterAdmit = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
7263
+ var _response$body, datachannelToken, isDataChannelTokenEnabled, response, fetchedDatachannelToken, msg, _t14;
7264
+ return _regenerator.default.wrap(function (_context21) {
7265
+ while (1) switch (_context21.prev = _context21.next) {
6780
7266
  case 0:
6781
- _context19.prev = 0;
7267
+ _context21.prev = 0;
6782
7268
  // @ts-ignore
6783
- datachannelToken = this.webex.internal.llm.getDatachannelToken(); // @ts-ignore
6784
- _context19.next = 1;
7269
+ datachannelToken = this.webex.internal.llm.getDatachannelToken(_constants.LLM_DEFAULT_SESSION, this.id); // @ts-ignore
7270
+ _context21.next = 1;
6785
7271
  return this.webex.internal.llm.isDataChannelTokenEnabled();
6786
7272
  case 1:
6787
- isDataChannelTokenEnabled = _context19.sent;
7273
+ isDataChannelTokenEnabled = _context21.sent;
6788
7274
  if (!(!isDataChannelTokenEnabled || datachannelToken)) {
6789
- _context19.next = 2;
7275
+ _context21.next = 2;
6790
7276
  break;
6791
7277
  }
6792
- return _context19.abrupt("return", false);
7278
+ return _context21.abrupt("return", false);
6793
7279
  case 2:
6794
- _context19.next = 3;
7280
+ _context21.next = 3;
6795
7281
  return this.meetingRequest.fetchDatachannelToken({
6796
7282
  locusUrl: this.locusUrl,
6797
7283
  requestingParticipantId: this.members.selfId,
6798
7284
  isPracticeSession: false
6799
7285
  });
6800
7286
  case 3:
6801
- response = _context19.sent;
7287
+ response = _context21.sent;
6802
7288
  fetchedDatachannelToken = response === null || response === void 0 ? void 0 : (_response$body = response.body) === null || _response$body === void 0 ? void 0 : _response$body.datachannelToken;
6803
7289
  if (fetchedDatachannelToken) {
6804
- _context19.next = 4;
7290
+ _context21.next = 4;
6805
7291
  break;
6806
7292
  }
6807
- return _context19.abrupt("return", false);
7293
+ return _context21.abrupt("return", false);
6808
7294
  case 4:
6809
7295
  // @ts-ignore
6810
- this.webex.internal.llm.setDatachannelToken(fetchedDatachannelToken, _internalPluginLlm.DataChannelTokenType.Default);
6811
- return _context19.abrupt("return", true);
7296
+ this.webex.internal.llm.setDatachannelToken(fetchedDatachannelToken, _constants.LLM_DEFAULT_SESSION, this.id);
7297
+ return _context21.abrupt("return", true);
6812
7298
  case 5:
6813
- _context19.prev = 5;
6814
- _t12 = _context19["catch"](0);
6815
- msg = (_t12 === null || _t12 === void 0 ? void 0 : _t12.message) || String(_t12);
7299
+ _context21.prev = 5;
7300
+ _t14 = _context21["catch"](0);
7301
+ msg = (_t14 === null || _t14 === void 0 ? void 0 : _t14.message) || String(_t14);
6816
7302
  _loggerProxy.default.logger.warn("Meeting:index#ensureDefaultDatachannelTokenAfterAdmit --> failed to proactively fetch default data channel token after admit: ".concat(msg), {
6817
- statusCode: _t12 === null || _t12 === void 0 ? void 0 : _t12.statusCode
7303
+ statusCode: _t14 === null || _t14 === void 0 ? void 0 : _t14.statusCode
6818
7304
  });
6819
- return _context19.abrupt("return", false);
7305
+ return _context21.abrupt("return", false);
6820
7306
  case 6:
6821
7307
  case "end":
6822
- return _context19.stop();
7308
+ return _context21.stop();
6823
7309
  }
6824
- }, _callee19, this, [[0, 5]]);
7310
+ }, _callee21, this, [[0, 5]]);
6825
7311
  }));
6826
7312
  function ensureDefaultDatachannelTokenAfterAdmit() {
6827
7313
  return _ensureDefaultDatachannelTokenAfterAdmit.apply(this, arguments);
@@ -6831,49 +7317,147 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6831
7317
  /**
6832
7318
  * Connects to low latency mercury and reconnects if the address has changed
6833
7319
  * It will also disconnect if called when the meeting has ended
7320
+ * @param {Object} [options]
7321
+ * @param {boolean} [options.isInitialJoinPhase] true when called from initial join flow
6834
7322
  * @returns {Promise}
6835
7323
  */
6836
7324
  )
6837
7325
  }, {
6838
7326
  key: "updateLLMConnection",
6839
7327
  value: (function () {
6840
- var _updateLLMConnection = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
7328
+ var _updateLLMConnection = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
6841
7329
  var _this36 = this;
6842
- var _ref39, _ref39$url, url, _ref39$info, _ref39$info2, _ref39$info2$datachan, datachannelUrl, isJoined, datachannelToken, dataChannelUrl;
6843
- return _regenerator.default.wrap(function (_context20) {
6844
- while (1) switch (_context20.prev = _context20.next) {
7330
+ var _ref40,
7331
+ _ref40$isInitialJoinP,
7332
+ isInitialJoinPhase,
7333
+ _ref41,
7334
+ _ref41$url,
7335
+ url,
7336
+ _ref41$info,
7337
+ _ref41$info2,
7338
+ _ref41$info2$datachan,
7339
+ datachannelUrl,
7340
+ isJoined,
7341
+ dataChannelUrl,
7342
+ _this$webex$internal$1,
7343
+ currentOwner,
7344
+ wasConnected,
7345
+ datachannelToken,
7346
+ refreshHandlerOwnerMeetingId,
7347
+ shouldAlignRefreshHandlerAfterOwnershipClaim,
7348
+ _args22 = arguments;
7349
+ return _regenerator.default.wrap(function (_context22) {
7350
+ while (1) switch (_context22.prev = _context22.next) {
6845
7351
  case 0:
7352
+ _ref40 = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {}, _ref40$isInitialJoinP = _ref40.isInitialJoinPhase, isInitialJoinPhase = _ref40$isInitialJoinP === void 0 ? false : _ref40$isInitialJoinP;
6846
7353
  // @ts-ignore - Fix type
6847
- _ref39 = this.locusInfo || {}, _ref39$url = _ref39.url, url = _ref39$url === void 0 ? undefined : _ref39$url, _ref39$info = _ref39.info, _ref39$info2 = _ref39$info === void 0 ? {} : _ref39$info, _ref39$info2$datachan = _ref39$info2.datachannelUrl, datachannelUrl = _ref39$info2$datachan === void 0 ? undefined : _ref39$info2$datachan;
6848
- isJoined = this.isJoined(); // @ts-ignore
6849
- datachannelToken = this.webex.internal.llm.getDatachannelToken(_internalPluginLlm.DataChannelTokenType.Default);
6850
- dataChannelUrl = datachannelUrl; // @ts-ignore - Fix type
6851
- if (!this.webex.internal.llm.isConnected()) {
6852
- _context20.next = 2;
7354
+ _ref41 = this.locusInfo || {}, _ref41$url = _ref41.url, url = _ref41$url === void 0 ? undefined : _ref41$url, _ref41$info = _ref41.info, _ref41$info2 = _ref41$info === void 0 ? {} : _ref41$info, _ref41$info2$datachan = _ref41$info2.datachannelUrl, datachannelUrl = _ref41$info2$datachan === void 0 ? undefined : _ref41$info2$datachan;
7355
+ isJoined = this.isJoined();
7356
+ dataChannelUrl = datachannelUrl; // Ownership guard: when the default LLM session is already connected and
7357
+ // owned by a *different* Meeting instance, do not disconnect or reconfigure
7358
+ // it. Another meeting's `updateLLMConnection` must be ignored here to
7359
+ // avoid killing the socket it relies on. We only proceed to manage the
7360
+ // connection when this meeting is the current owner, or when no owner is
7361
+ // set yet (first claim).
7362
+ // @ts-ignore - Fix type
7363
+ _this$webex$internal$1 = this.webex.internal.llm.resolveSessionOwnership(this.id, _constants.LLM_DEFAULT_SESSION), currentOwner = _this$webex$internal$1.currentOwner; // Capture connectivity before any reconnect attempt. If LLM was already
7364
+ // connected, we must respect current ownership. If it was disconnected,
7365
+ // this flow may reclaim stale owner tags after a fresh connect.
7366
+ // @ts-ignore - Fix type
7367
+ wasConnected = this.webex.internal.llm.isConnected(); // Prefer ownership-scoped token read. For disconnected stale-owner reclaim
7368
+ // flows, fallback to ownerless read so initial register can still carry a
7369
+ // token and recover from stale ownership without 401/403 dead-end.
7370
+ // @ts-ignore - Fix type
7371
+ datachannelToken = this.webex.internal.llm.getDatachannelToken(_constants.LLM_DEFAULT_SESSION, this.id);
7372
+ if (!datachannelToken && !wasConnected && currentOwner && currentOwner !== this.id) {
7373
+ // @ts-ignore - Fix type
7374
+ datachannelToken = this.webex.internal.llm.getDatachannelToken(_constants.LLM_DEFAULT_SESSION);
7375
+ }
7376
+
7377
+ // @ts-ignore - Fix type
7378
+ if (!wasConnected) {
7379
+ _context22.next = 3;
6853
7380
  break;
6854
7381
  }
7382
+ if (!(currentOwner && currentOwner !== this.id)) {
7383
+ _context22.next = 1;
7384
+ break;
7385
+ }
7386
+ // Another meeting owns the live LLM socket. We must not disconnect
7387
+ // or reconfigure it -- doing so would tear down a session the
7388
+ // owning meeting still relies on. Locus/datachannel URL mismatch is
7389
+ // expected here (each meeting has its own locus URL) and is NOT a
7390
+ // valid signal of staleness, so we never reclaim from this path.
7391
+ // The only safe reclaim mechanism is the `finally`-block owner-tag
7392
+ // release in `cleanupLLMConneciton`, which fires when this meeting
7393
+ // itself is being torn down.
7394
+ _loggerProxy.default.logger.info("Meeting:index#updateLLMConnection --> skipping; LLM owned by meeting ".concat(currentOwner, ", not ").concat(this.id));
7395
+ return _context22.abrupt("return", undefined);
7396
+ case 1:
6855
7397
  if (!(
6856
7398
  // @ts-ignore - Fix type
6857
7399
  url === this.webex.internal.llm.getLocusUrl() &&
6858
7400
  // @ts-ignore - Fix type
6859
7401
  dataChannelUrl === this.webex.internal.llm.getDatachannelUrl() && isJoined)) {
6860
- _context20.next = 1;
7402
+ _context22.next = 2;
6861
7403
  break;
6862
7404
  }
6863
- return _context20.abrupt("return", undefined);
6864
- case 1:
6865
- _context20.next = 2;
7405
+ return _context22.abrupt("return", undefined);
7406
+ case 2:
7407
+ _context22.next = 3;
6866
7408
  return this.cleanupLLMConneciton({
6867
7409
  removeOnlineListener: false
6868
7410
  });
6869
- case 2:
7411
+ case 3:
6870
7412
  if (isJoined) {
6871
- _context20.next = 3;
7413
+ _context22.next = 4;
6872
7414
  break;
6873
7415
  }
6874
- return _context20.abrupt("return", undefined);
6875
- case 3:
6876
- return _context20.abrupt("return", this.webex.internal.llm.registerAndConnect(url, dataChannelUrl, datachannelToken).then(function (registerAndConnectResult) {
7416
+ return _context22.abrupt("return", undefined);
7417
+ case 4:
7418
+ // Bind refresh handler before registration so interceptor-triggered token
7419
+ // refresh during register POST can resolve a valid handler.
7420
+ // Prefer this meeting as owner, but allow owner-less fallback when a stale
7421
+ // foreign owner tag is present on a disconnected session.
7422
+ refreshHandlerOwnerMeetingId = currentOwner && currentOwner !== this.id ? undefined : this.id;
7423
+ shouldAlignRefreshHandlerAfterOwnershipClaim = refreshHandlerOwnerMeetingId !== this.id; // @ts-ignore - Fix type
7424
+ this.webex.internal.llm.setRefreshHandler(function () {
7425
+ return _this36.refreshDataChannelToken();
7426
+ }, _constants.LLM_DEFAULT_SESSION, refreshHandlerOwnerMeetingId);
7427
+
7428
+ // @ts-ignore - Fix type
7429
+ return _context22.abrupt("return", this.webex.internal.llm.registerAndConnect(url, dataChannelUrl, datachannelToken).then(function (registerAndConnectResult) {
7430
+ _this36.locusInfo.syncAllHashTreeDatasets({
7431
+ onlyLLM: true
7432
+ });
7433
+ // Record ownership of the default LLM session for this meeting so
7434
+ // subsequent cross-meeting `updateLLMConnection` / `cleanupLLMConneciton`
7435
+ // calls can detect and skip work that doesn't belong to them.
7436
+ // @ts-ignore - Fix type
7437
+ var _this36$webex$interna = _this36.webex.internal.llm.resolveSessionOwnership(_this36.id, _constants.LLM_DEFAULT_SESSION),
7438
+ isOwner = _this36$webex$interna.isOwner;
7439
+ var canReclaimAfterDisconnectedStart = !wasConnected;
7440
+
7441
+ // Refresh handler is pre-bound before registerAndConnect so token
7442
+ // refresh can work even during the registration request itself.
7443
+ if (isOwner || canReclaimAfterDisconnectedStart) {
7444
+ var _this36$webex$interna2, _this36$webex$interna3;
7445
+ // Record ownership of the default LLM session for this meeting so
7446
+ // subsequent cross-meeting `updateLLMConnection` / `cleanupLLMConneciton`
7447
+ // calls can detect and skip work that doesn't belong to them.
7448
+ // @ts-ignore - Fix type
7449
+ (_this36$webex$interna2 = (_this36$webex$interna3 = _this36.webex.internal.llm).setOwnerMeetingId) === null || _this36$webex$interna2 === void 0 ? void 0 : _this36$webex$interna2.call(_this36$webex$interna3, _this36.id);
7450
+
7451
+ // If we pre-bound refresh ownerlessly (stale-owner reclaim path),
7452
+ // align the handler with the newly claimed owner immediately after
7453
+ // ownership is updated.
7454
+ if (shouldAlignRefreshHandlerAfterOwnershipClaim) {
7455
+ // @ts-ignore - Fix type
7456
+ _this36.webex.internal.llm.setRefreshHandler(function () {
7457
+ return _this36.refreshDataChannelToken();
7458
+ }, _constants.LLM_DEFAULT_SESSION, _this36.id);
7459
+ }
7460
+ }
6877
7461
  // @ts-ignore - Fix type
6878
7462
  _this36.webex.internal.llm.off('event:relay.event', _this36.processRelayEvent);
6879
7463
  // @ts-ignore - Fix type
@@ -6884,19 +7468,118 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6884
7468
  _this36.webex.internal.llm.on(_constants.LOCUS_LLM_EVENT, _this36.processLocusLLMEvent);
6885
7469
  _loggerProxy.default.logger.info('Meeting:index#updateLLMConnection --> enabled to receive relay events!');
6886
7470
  _this36.startLLMHealthCheckTimer();
7471
+ if (registerAndConnectResult) {
7472
+ var _this36$breakouts;
7473
+ if (isInitialJoinPhase) {
7474
+ _this36.sendLLMConnectMetric(registerAndConnectResult);
7475
+ }
7476
+ (_this36$breakouts = _this36.breakouts) === null || _this36$breakouts === void 0 ? void 0 : _this36$breakouts.trigger(_constants.BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7477
+ meeting: _this36,
7478
+ llmLatency: registerAndConnectResult
7479
+ });
7480
+ }
6887
7481
  return _promise.default.resolve(registerAndConnectResult);
7482
+ }).catch(function (error) {
7483
+ var _error$timing$clientL, _error$timing, _this36$breakouts2;
7484
+ // Prefer the partial timing registerAndConnect attaches when register succeeded but the
7485
+ // websocket connect() failed, so a ws failure isn't misreported as register never completing.
7486
+ var llmLatency = {
7487
+ clientLLMDatachannelResponseTime: (_error$timing$clientL = error === null || error === void 0 ? void 0 : (_error$timing = error.timing) === null || _error$timing === void 0 ? void 0 : _error$timing.clientLLMDatachannelResponseTime) !== null && _error$timing$clientL !== void 0 ? _error$timing$clientL : 0,
7488
+ clientLLMWebSocketConnectTime: 0
7489
+ };
7490
+ if (isInitialJoinPhase) {
7491
+ _this36.sendLLMConnectMetric(llmLatency, error);
7492
+ }
7493
+ (_this36$breakouts2 = _this36.breakouts) === null || _this36$breakouts2 === void 0 ? void 0 : _this36$breakouts2.trigger(_constants.BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7494
+ meeting: _this36,
7495
+ llmLatency: llmLatency,
7496
+ error: error
7497
+ });
7498
+ return _promise.default.reject(error);
6888
7499
  }));
6889
- case 4:
7500
+ case 5:
6890
7501
  case "end":
6891
- return _context20.stop();
7502
+ return _context22.stop();
6892
7503
  }
6893
- }, _callee20, this);
7504
+ }, _callee22, this);
6894
7505
  }));
6895
7506
  function updateLLMConnection() {
6896
7507
  return _updateLLMConnection.apply(this, arguments);
6897
7508
  }
6898
7509
  return updateLLMConnection;
6899
7510
  }()
7511
+ /**
7512
+ * Ensures breakout join response metric with LLM latency is emitted only once per breakout move id.
7513
+ * @param {string | undefined} breakoutMoveId
7514
+ * @param {boolean} [hasLLMLatency=false]
7515
+ * @returns {boolean}
7516
+ */
7517
+ )
7518
+ }, {
7519
+ key: "shouldEmitBreakoutJoinResponseMetric",
7520
+ value: function shouldEmitBreakoutJoinResponseMetric(breakoutMoveId) {
7521
+ var hasLLMLatency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
7522
+ if (!breakoutMoveId) {
7523
+ return false;
7524
+ }
7525
+ if (!hasLLMLatency) {
7526
+ // When automatic LLM is enabled, updateLLMConnection will emit this same breakout join
7527
+ // response after the LLM connection finishes, including llmLatency and llmWebsocketUrl.
7528
+ // Suppress the earlier non-LLM event to avoid sending two events for the same move id,
7529
+ // where the first one would be missing the LLM-specific fields we want to validate.
7530
+ // @ts-ignore - config coming from registerPlugin
7531
+ return !this.config.enableAutomaticLLM;
7532
+ }
7533
+ if (this.emittedBreakoutJoinResponseMoveIds.has(breakoutMoveId)) {
7534
+ return false;
7535
+ }
7536
+ this.emittedBreakoutJoinResponseMoveIds.add(breakoutMoveId);
7537
+ return true;
7538
+ }
7539
+
7540
+ /**
7541
+ * Sends LLM connect latencies for initial join flow.
7542
+ * @param {RegisterAndConnectTiming} timings
7543
+ * @param {any} [error]
7544
+ * @returns {void}
7545
+ */
7546
+ }, {
7547
+ key: "sendLLMConnectMetric",
7548
+ value: function sendLLMConnectMetric(timings, error) {
7549
+ var _this$webex$internal$10, _this$webex$internal$11;
7550
+ // @ts-ignore
7551
+ var llmWebsocketUrl = ((_this$webex$internal$10 = (_this$webex$internal$11 = this.webex.internal.llm).getWebSocketUrl) === null || _this$webex$internal$10 === void 0 ? void 0 : _this$webex$internal$10.call(_this$webex$internal$11)) || undefined;
7552
+ var _ref42 = timings || {},
7553
+ _ref42$clientLLMDatac = _ref42.clientLLMDatachannelResponseTime,
7554
+ clientLLMDatachannelResponseTime = _ref42$clientLLMDatac === void 0 ? 0 : _ref42$clientLLMDatac,
7555
+ clientLLMWebSocketConnectTime = _ref42.clientLLMWebSocketConnectTime;
7556
+ var llmLatency = {
7557
+ clientLLMDatachannelResponseTime: clientLLMDatachannelResponseTime
7558
+ };
7559
+ if (clientLLMWebSocketConnectTime !== undefined) {
7560
+ llmLatency.clientLLMWebSocketConnectTime = clientLLMWebSocketConnectTime;
7561
+ }
7562
+ var payload = {
7563
+ identifiers: {
7564
+ llmWebsocketUrl: llmWebsocketUrl
7565
+ },
7566
+ llmLatency: llmLatency
7567
+ };
7568
+ var options = _objectSpread({
7569
+ meetingId: this.id
7570
+ }, error && {
7571
+ rawError: error
7572
+ });
7573
+ var metricEvent = {
7574
+ name: 'client.llm.connect.response',
7575
+ payload: payload,
7576
+ options: options
7577
+ };
7578
+
7579
+ // @ts-ignore
7580
+ this.webex.internal.newMetrics.submitClientEvent(metricEvent);
7581
+ }
7582
+
6900
7583
  /**
6901
7584
  * Use phone for meeting audio
6902
7585
  * @param {String} phoneNumber If provided, it will dial-out using this number. If not provided, dial-in will be used
@@ -6904,7 +7587,6 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6904
7587
  * @public
6905
7588
  * @memberof Meeting
6906
7589
  */
6907
- )
6908
7590
  }, {
6909
7591
  key: "usePhoneAudio",
6910
7592
  value: function usePhoneAudio(phoneNumber) {
@@ -7076,17 +7758,17 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7076
7758
  meetingId: this.id
7077
7759
  }
7078
7760
  });
7079
- this.locusInfo.once(_constants.LOCUSINFO.EVENTS.SELF_OBSERVING, /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
7080
- var mediaSettings, _t13;
7081
- return _regenerator.default.wrap(function (_context21) {
7082
- while (1) switch (_context21.prev = _context21.next) {
7761
+ this.locusInfo.once(_constants.LOCUSINFO.EVENTS.SELF_OBSERVING, /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
7762
+ var mediaSettings, _t15;
7763
+ return _regenerator.default.wrap(function (_context23) {
7764
+ while (1) switch (_context23.prev = _context23.next) {
7083
7765
  case 0:
7084
- _context21.prev = 0;
7766
+ _context23.prev = 0;
7085
7767
  if (!(_this40.screenShareFloorState === ScreenShareFloorStatus.GRANTED)) {
7086
- _context21.next = 1;
7768
+ _context23.next = 1;
7087
7769
  break;
7088
7770
  }
7089
- _context21.next = 1;
7771
+ _context23.next = 1;
7090
7772
  return _this40.releaseScreenShareFloor();
7091
7773
  case 1:
7092
7774
  mediaSettings = {
@@ -7105,23 +7787,23 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7105
7787
  // when a move to is intiated by the client , Locus delets the existing media node from the server as soon the device answers the meeting
7106
7788
  // once the device answers we close the old connection and create new media server connection with only share enabled
7107
7789
  if (!_this40.statsAnalyzer) {
7108
- _context21.next = 2;
7790
+ _context23.next = 2;
7109
7791
  break;
7110
7792
  }
7111
- _context21.next = 2;
7793
+ _context23.next = 2;
7112
7794
  return _this40.statsAnalyzer.stopAnalyzer();
7113
7795
  case 2:
7114
- _context21.next = 3;
7796
+ _context23.next = 3;
7115
7797
  return _this40.closeRemoteStreams();
7116
7798
  case 3:
7117
- _context21.next = 4;
7799
+ _context23.next = 4;
7118
7800
  return _this40.closePeerConnections();
7119
7801
  case 4:
7120
7802
  _this40.cleanupLocalStreams();
7121
7803
  _this40.unsetRemoteStreams();
7122
7804
  _this40.unsetPeerConnections();
7123
7805
  _this40.reconnectionManager.cleanUp();
7124
- _context21.next = 5;
7806
+ _context23.next = 5;
7125
7807
  return _this40.addMedia({
7126
7808
  audioEnabled: false,
7127
7809
  videoEnabled: false,
@@ -7130,24 +7812,24 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7130
7812
  case 5:
7131
7813
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_SUCCESS);
7132
7814
  _this40.isMoveToInProgress = false;
7133
- _context21.next = 7;
7815
+ _context23.next = 7;
7134
7816
  break;
7135
7817
  case 6:
7136
- _context21.prev = 6;
7137
- _t13 = _context21["catch"](0);
7138
- _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', _t13);
7818
+ _context23.prev = 6;
7819
+ _t15 = _context23["catch"](0);
7820
+ _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', _t15);
7139
7821
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_FAILURE, {
7140
7822
  correlation_id: _this40.correlationId,
7141
7823
  locus_id: _this40.locusUrl.split('/').pop(),
7142
- reason: _t13.message,
7143
- stack: _t13.stack
7824
+ reason: _t15.message,
7825
+ stack: _t15.stack
7144
7826
  });
7145
7827
  _this40.isMoveToInProgress = false;
7146
7828
  case 7:
7147
7829
  case "end":
7148
- return _context21.stop();
7830
+ return _context23.stop();
7149
7831
  }
7150
- }, _callee21, null, [[0, 6]]);
7832
+ }, _callee23, null, [[0, 6]]);
7151
7833
  })));
7152
7834
  _loggerProxy.default.logger.info('Meeting:index#moveTo --> Initated moved to using resourceId', resourceId);
7153
7835
 
@@ -7224,21 +7906,87 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7224
7906
  return "MC-".concat(this.id.substring(0, 4));
7225
7907
  }
7226
7908
 
7909
+ /**
7910
+ * Checks if the error indicates that Locus dropped us from the meeting,
7911
+ * either directly on the error or wrapped inside an AddMediaFailed cause.
7912
+ * This method is meant to be called only with errors thrown by Meeting.addMediaInternal()
7913
+ *
7914
+ * @param {Error} error
7915
+ * @returns {boolean}
7916
+ */
7917
+ }, {
7918
+ key: "isErrorMeaningLocusDroppedUs",
7919
+ value: function isErrorMeaningLocusDroppedUs(error) {
7920
+ var _cause;
7921
+ var statusCode = error === null || error === void 0 ? void 0 : error.statusCode;
7922
+ var causeStatusCode = error === null || error === void 0 ? void 0 : (_cause = error.cause) === null || _cause === void 0 ? void 0 : _cause.statusCode;
7923
+ return statusCode === 409 || statusCode === 403 || causeStatusCode === 409 || causeStatusCode === 403;
7924
+ }
7925
+
7926
+ /**
7927
+ * Determines if the next media attempt should use only TURN-TLS (iceTransportPolicy='relay').
7928
+ * We do this in the hope that it will minimize the chance of Homer sending DTLS packets on a wrong
7929
+ * transport (as there will be only 1 transport) and dealing with firewalls that let STUN packets through, but block
7930
+ * other UDP traffic.
7931
+ *
7932
+ * For clients landing on video mesh nodes (VMN), reachability might still have successful TLS (to public nodes)
7933
+ * but TURN discovery will result in empty TURN urls array and iceTransportPolicy='relay' will still be overriden to undefined,
7934
+ * see the code in establishMediaConnection()
7935
+ *
7936
+ * @param {Error} prevError - The error from the previous addMedia attempt
7937
+ * @returns {Promise<boolean>}
7938
+ */
7939
+ }, {
7940
+ key: "shouldRetryMediaWithOnlyTurnTLS",
7941
+ value: (function () {
7942
+ var _shouldRetryMediaWithOnlyTurnTLS = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24(prevError) {
7943
+ var hasTlsReachability;
7944
+ return _regenerator.default.wrap(function (_context24) {
7945
+ while (1) switch (_context24.prev = _context24.next) {
7946
+ case 0:
7947
+ if (!(this.isMultistream && prevError instanceof _webexErrors.AddMediaFailed && prevError.isDtlsHandshakeFailure && prevError.connectionType === 'UDP')) {
7948
+ _context24.next = 2;
7949
+ break;
7950
+ }
7951
+ _context24.next = 1;
7952
+ return this.webex.meetings.reachability.isAnyClusterReachableViaProtocol('xtls');
7953
+ case 1:
7954
+ hasTlsReachability = _context24.sent;
7955
+ if (!hasTlsReachability) {
7956
+ _context24.next = 2;
7957
+ break;
7958
+ }
7959
+ _loggerProxy.default.logger.info('Meeting:index#shouldRetryMediaWithOnlyTurnTLS --> previous attempt failed due to DTLS handshake failure over UDP and TLS reachability is available');
7960
+ return _context24.abrupt("return", true);
7961
+ case 2:
7962
+ return _context24.abrupt("return", false);
7963
+ case 3:
7964
+ case "end":
7965
+ return _context24.stop();
7966
+ }
7967
+ }, _callee24, this);
7968
+ }));
7969
+ function shouldRetryMediaWithOnlyTurnTLS(_x16) {
7970
+ return _shouldRetryMediaWithOnlyTurnTLS.apply(this, arguments);
7971
+ }
7972
+ return shouldRetryMediaWithOnlyTurnTLS;
7973
+ }()
7227
7974
  /**
7228
7975
  * Creates a webrtc media connection and publishes streams to it
7229
7976
  *
7230
7977
  * @param {Object} turnServerInfo TURN server information
7231
7978
  * @param {BundlePolicy} [bundlePolicy] Bundle policy settings
7232
- * @param {AddMediaOptions} [options] Options for enabling/disabling audio/video
7979
+ * @param {RTCIceTransportPolicy} [iceTransportPolicy] ICE transport policy override
7233
7980
  * @returns {RoapMediaConnection | MultistreamRoapMediaConnection}
7234
7981
  */
7982
+ )
7235
7983
  }, {
7236
7984
  key: "createMediaConnection",
7237
7985
  value: (function () {
7238
- var _createMediaConnection = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22(turnServerInfo, bundlePolicy) {
7986
+ var _createMediaConnection = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25(turnServerInfo, bundlePolicy, iceTransportPolicy) {
7239
7987
  var mc, audioEnabled, videoEnabled, shareEnabled;
7240
- return _regenerator.default.wrap(function (_context22) {
7241
- while (1) switch (_context22.prev = _context22.next) {
7988
+ return _regenerator.default.wrap(function (_context25) {
7989
+ while (1) switch (_context25.prev = _context25.next) {
7242
7990
  case 0:
7243
7991
  this.rtcMetrics = this.isMultistream ?
7244
7992
  // @ts-ignore
@@ -7258,12 +8006,15 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7258
8006
  enableExtmap: this.config.enableExtmap,
7259
8007
  turnServerInfo: turnServerInfo,
7260
8008
  bundlePolicy: bundlePolicy,
8009
+ iceTransportPolicy: iceTransportPolicy,
7261
8010
  // @ts-ignore - config coming from registerPlugin
7262
8011
  iceCandidatesTimeout: this.config.iceCandidatesGatheringTimeout,
7263
8012
  // @ts-ignore - config coming from registerPlugin
7264
8013
  disableAudioMainDtx: this.config.experimental.disableAudioMainDtx,
7265
8014
  // @ts-ignore - config coming from registerPlugin
7266
8015
  enableAudioTwcc: this.config.enableAudioTwccForMultistream,
8016
+ // @ts-ignore - config coming from registerPlugin
8017
+ enableAv1SlidesSupport: this.config.enableAv1SlidesSupport,
7267
8018
  stopIceGatheringAfterFirstRelayCandidate:
7268
8019
  // @ts-ignore - config coming from registerPlugin
7269
8020
  this.config.stopIceGatheringAfterFirstRelayCandidate
@@ -7280,42 +8031,42 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7280
8031
 
7281
8032
  // publish the streams
7282
8033
  if (!this.mediaProperties.audioStream) {
7283
- _context22.next = 1;
8034
+ _context25.next = 1;
7284
8035
  break;
7285
8036
  }
7286
8037
  this.setSendNamedMediaGroup(_internalMediaCore.MediaType.AudioMain);
7287
- _context22.next = 1;
8038
+ _context25.next = 1;
7288
8039
  return this.publishStream(_internalMediaCore.MediaType.AudioMain, this.mediaProperties.audioStream);
7289
8040
  case 1:
7290
8041
  if (!this.mediaProperties.videoStream) {
7291
- _context22.next = 2;
8042
+ _context25.next = 2;
7292
8043
  break;
7293
8044
  }
7294
- _context22.next = 2;
8045
+ _context25.next = 2;
7295
8046
  return this.publishStream(_internalMediaCore.MediaType.VideoMain, this.mediaProperties.videoStream);
7296
8047
  case 2:
7297
8048
  if (!this.mediaProperties.shareVideoStream) {
7298
- _context22.next = 3;
8049
+ _context25.next = 3;
7299
8050
  break;
7300
8051
  }
7301
- _context22.next = 3;
8052
+ _context25.next = 3;
7302
8053
  return this.publishStream(_internalMediaCore.MediaType.VideoSlides, this.mediaProperties.shareVideoStream);
7303
8054
  case 3:
7304
8055
  if (!(this.isMultistream && this.mediaProperties.shareAudioStream)) {
7305
- _context22.next = 4;
8056
+ _context25.next = 4;
7306
8057
  break;
7307
8058
  }
7308
- _context22.next = 4;
8059
+ _context25.next = 4;
7309
8060
  return this.publishStream(_internalMediaCore.MediaType.AudioSlides, this.mediaProperties.shareAudioStream);
7310
8061
  case 4:
7311
- return _context22.abrupt("return", mc);
8062
+ return _context25.abrupt("return", mc);
7312
8063
  case 5:
7313
8064
  case "end":
7314
- return _context22.stop();
8065
+ return _context25.stop();
7315
8066
  }
7316
- }, _callee22, this);
8067
+ }, _callee25, this);
7317
8068
  }));
7318
- function createMediaConnection(_x14, _x15) {
8069
+ function createMediaConnection(_x17, _x18, _x19) {
7319
8070
  return _createMediaConnection.apply(this, arguments);
7320
8071
  }
7321
8072
  return createMediaConnection;
@@ -7353,11 +8104,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7353
8104
  }, {
7354
8105
  key: "setUpLocalStreamReferences",
7355
8106
  value: (function () {
7356
- var _setUpLocalStreamReferences = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23(localStreams) {
8107
+ var _setUpLocalStreamReferences = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26(localStreams) {
7357
8108
  var _localStreams$microph, _localStreams$camera, _localStreams$screenS, _localStreams$screenS2, _localStreams$screenS3, _localStreams$screenS4, _localStreams$screenS5, _localStreams$screenS6;
7358
- var setUpStreamPromises, _t14;
7359
- return _regenerator.default.wrap(function (_context23) {
7360
- while (1) switch (_context23.prev = _context23.next) {
8109
+ var setUpStreamPromises, _t16;
8110
+ return _regenerator.default.wrap(function (_context26) {
8111
+ while (1) switch (_context26.prev = _context26.next) {
7361
8112
  case 0:
7362
8113
  setUpStreamPromises = [];
7363
8114
  if (localStreams !== null && localStreams !== void 0 && localStreams.microphone && (localStreams === null || localStreams === void 0 ? void 0 : (_localStreams$microph = localStreams.microphone) === null || _localStreams$microph === void 0 ? void 0 : _localStreams$microph.readyState) !== 'ended') {
@@ -7372,24 +8123,24 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7372
8123
  if (localStreams !== null && localStreams !== void 0 && (_localStreams$screenS4 = localStreams.screenShare) !== null && _localStreams$screenS4 !== void 0 && _localStreams$screenS4.audio && (localStreams === null || localStreams === void 0 ? void 0 : (_localStreams$screenS5 = localStreams.screenShare) === null || _localStreams$screenS5 === void 0 ? void 0 : (_localStreams$screenS6 = _localStreams$screenS5.audio) === null || _localStreams$screenS6 === void 0 ? void 0 : _localStreams$screenS6.readyState) !== 'ended') {
7373
8124
  setUpStreamPromises.push(this.setLocalShareAudioStream(localStreams.screenShare.audio));
7374
8125
  }
7375
- _context23.prev = 1;
7376
- _context23.next = 2;
8126
+ _context26.prev = 1;
8127
+ _context26.next = 2;
7377
8128
  return _promise.default.all(setUpStreamPromises);
7378
8129
  case 2:
7379
- _context23.next = 4;
8130
+ _context26.next = 4;
7380
8131
  break;
7381
8132
  case 3:
7382
- _context23.prev = 3;
7383
- _t14 = _context23["catch"](1);
7384
- _loggerProxy.default.logger.error("Meeting:index#addMedia():setUpLocalStreamReferences --> Error , ", _t14);
7385
- throw _t14;
8133
+ _context26.prev = 3;
8134
+ _t16 = _context26["catch"](1);
8135
+ _loggerProxy.default.logger.error("Meeting:index#addMedia():setUpLocalStreamReferences --> Error , ", _t16);
8136
+ throw _t16;
7386
8137
  case 4:
7387
8138
  case "end":
7388
- return _context23.stop();
8139
+ return _context26.stop();
7389
8140
  }
7390
- }, _callee23, this, [[1, 3]]);
8141
+ }, _callee26, this, [[1, 3]]);
7391
8142
  }));
7392
- function setUpLocalStreamReferences(_x16) {
8143
+ function setUpLocalStreamReferences(_x20) {
7393
8144
  return _setUpLocalStreamReferences.apply(this, arguments);
7394
8145
  }
7395
8146
  return setUpLocalStreamReferences;
@@ -7404,72 +8155,71 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7404
8155
  }, {
7405
8156
  key: "waitForMediaConnectionConnected",
7406
8157
  value: (function () {
7407
- var _waitForMediaConnectionConnected = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
7408
- var iceConnected, _this$mediaProperties9, _this$mediaProperties0, _this$mediaProperties1, _this$mediaProperties10, _this$mediaProperties11, _this$mediaProperties12, _this$mediaProperties13, timedOutError, _t15, _t16, _t17, _t18, _t19, _t20, _t21, _t22, _t23, _t24, _t25, _t26, _t27, _t28, _t29;
7409
- return _regenerator.default.wrap(function (_context24) {
7410
- while (1) switch (_context24.prev = _context24.next) {
8158
+ var _waitForMediaConnectionConnected = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
8159
+ var _ref44, iceConnected, _this$mediaProperties9, _this$mediaProperties0, _this$mediaProperties1, _this$mediaProperties10, _this$mediaProperties11, _this$mediaProperties12, _this$mediaProperties13, _t17, _t18, _t19, _t20, _t21, _t22, _t23, _t24, _t25, _t26, _t27, _t28, _t29, _t30, _t31;
8160
+ return _regenerator.default.wrap(function (_context27) {
8161
+ while (1) switch (_context27.prev = _context27.next) {
7411
8162
  case 0:
7412
- _context24.prev = 0;
7413
- _context24.next = 1;
8163
+ _context27.prev = 0;
8164
+ _context27.next = 1;
7414
8165
  return this.mediaProperties.waitForMediaConnectionConnected(this.correlationId);
7415
8166
  case 1:
7416
- _context24.next = 5;
8167
+ _context27.next = 5;
7417
8168
  break;
7418
8169
  case 2:
7419
- _context24.prev = 2;
7420
- _t15 = _context24["catch"](0);
7421
- iceConnected = _t15.iceConnected;
8170
+ _context27.prev = 2;
8171
+ _t17 = _context27["catch"](0);
8172
+ _ref44 = _t17, iceConnected = _ref44.iceConnected;
7422
8173
  if (this.hasMediaConnectionConnectedAtLeastOnce) {
7423
- _context24.next = 4;
8174
+ _context27.next = 4;
7424
8175
  break;
7425
8176
  }
7426
- _t16 = this.webex.internal.newMetrics;
7427
- _t17 = !this.turnServerUsed;
7428
- _t18 = this.addMediaData.icePhaseCallback();
7429
- _t19 = this.webex.internal.newMetrics.callDiagnosticMetrics;
7430
- _t20 = _internalPluginMetrics.CallDiagnosticUtils;
7431
- _t21 = ((_this$mediaProperties9 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties9 === void 0 ? void 0 : (_this$mediaProperties0 = _this$mediaProperties9.multistreamConnection) === null || _this$mediaProperties0 === void 0 ? void 0 : (_this$mediaProperties1 = _this$mediaProperties0.pc) === null || _this$mediaProperties1 === void 0 ? void 0 : (_this$mediaProperties10 = _this$mediaProperties1.pc) === null || _this$mediaProperties10 === void 0 ? void 0 : _this$mediaProperties10.signalingState) || ((_this$mediaProperties11 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties11 === void 0 ? void 0 : (_this$mediaProperties12 = _this$mediaProperties11.mediaConnection) === null || _this$mediaProperties12 === void 0 ? void 0 : (_this$mediaProperties13 = _this$mediaProperties12.pc) === null || _this$mediaProperties13 === void 0 ? void 0 : _this$mediaProperties13.signalingState) || 'unknown';
7432
- _t22 = iceConnected;
7433
- _t23 = this.turnServerUsed;
7434
- _context24.next = 3;
8177
+ _t18 = this.webex.internal.newMetrics;
8178
+ _t19 = !this.turnServerUsed;
8179
+ _t20 = this.addMediaData.icePhaseCallback();
8180
+ _t21 = this.webex.internal.newMetrics.callDiagnosticMetrics;
8181
+ _t22 = _internalPluginMetrics.CallDiagnosticUtils;
8182
+ _t23 = ((_this$mediaProperties9 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties9 === void 0 ? void 0 : (_this$mediaProperties0 = _this$mediaProperties9.multistreamConnection) === null || _this$mediaProperties0 === void 0 ? void 0 : (_this$mediaProperties1 = _this$mediaProperties0.pc) === null || _this$mediaProperties1 === void 0 ? void 0 : (_this$mediaProperties10 = _this$mediaProperties1.pc) === null || _this$mediaProperties10 === void 0 ? void 0 : _this$mediaProperties10.signalingState) || ((_this$mediaProperties11 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties11 === void 0 ? void 0 : (_this$mediaProperties12 = _this$mediaProperties11.mediaConnection) === null || _this$mediaProperties12 === void 0 ? void 0 : (_this$mediaProperties13 = _this$mediaProperties12.pc) === null || _this$mediaProperties13 === void 0 ? void 0 : _this$mediaProperties13.signalingState) || 'unknown';
8183
+ _t24 = iceConnected;
8184
+ _t25 = this.turnServerUsed;
8185
+ _context27.next = 3;
7435
8186
  return this.webex.meetings.reachability.isWebexMediaBackendUnreachable().catch(function () {
7436
8187
  return false;
7437
8188
  });
7438
8189
  case 3:
7439
- _t24 = _context24.sent;
7440
- _t25 = _t20.generateClientErrorCodeForIceFailure.call(_t20, {
7441
- signalingState: _t21,
7442
- iceConnected: _t22,
7443
- turnServerUsed: _t23,
7444
- unreachable: _t24
8190
+ _t26 = _context27.sent;
8191
+ _t27 = _t22.generateClientErrorCodeForIceFailure.call(_t22, {
8192
+ signalingState: _t23,
8193
+ iceConnected: _t24,
8194
+ turnServerUsed: _t25,
8195
+ unreachable: _t26
7445
8196
  });
7446
- _t26 = _t19.getErrorPayloadForClientErrorCode.call(_t19, {
7447
- clientErrorCode: _t25
8197
+ _t28 = _t21.getErrorPayloadForClientErrorCode.call(_t21, {
8198
+ clientErrorCode: _t27
7448
8199
  });
7449
- _t27 = [_t26];
7450
- _t28 = {
7451
- canProceed: _t17,
7452
- icePhase: _t18,
7453
- errors: _t27
8200
+ _t29 = [_t28];
8201
+ _t30 = {
8202
+ canProceed: _t19,
8203
+ icePhase: _t20,
8204
+ errors: _t29
7454
8205
  };
7455
- _t29 = {
8206
+ _t31 = {
7456
8207
  meetingId: this.id,
7457
- rawError: _t15
8208
+ rawError: _t17
7458
8209
  };
7459
- _t16.submitClientEvent.call(_t16, {
8210
+ _t18.submitClientEvent.call(_t18, {
7460
8211
  name: 'client.ice.end',
7461
- payload: _t28,
7462
- options: _t29
8212
+ payload: _t30,
8213
+ options: _t31
7463
8214
  });
7464
8215
  case 4:
7465
- timedOutError = new Error("Timed out waiting for media connection to be connected, correlationId=".concat(this.correlationId));
7466
- timedOutError.cause = _t15;
7467
- throw timedOutError;
8216
+ throw new _webexErrors.MediaConnectionTimedOutError("Timed out waiting for media connection to be connected, correlationId=".concat(this.correlationId), iceConnected, // keep reference to the original rejected result (which is the object the SDK reports to CA as rawError above)
8217
+ _t17);
7468
8218
  case 5:
7469
8219
  case "end":
7470
- return _context24.stop();
8220
+ return _context27.stop();
7471
8221
  }
7472
- }, _callee24, this, [[0, 2]]);
8222
+ }, _callee27, this, [[0, 2]]);
7473
8223
  }));
7474
8224
  function waitForMediaConnectionConnected() {
7475
8225
  return _waitForMediaConnectionConnected.apply(this, arguments);
@@ -7516,7 +8266,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7516
8266
  return !member.isSelf && !member.isPairedWithSelf && !member.isAudioMuted;
7517
8267
  });
7518
8268
  if (atLeastOneUnmutedOtherMember) {
7519
- _this43.mediaProperties.sendMediaIssueMetric('inbound_audio', data.issueSubType, _this43.correlationId);
8269
+ _this43.mediaProperties.sendMediaIssueMetric('inbound_audio', data.issueSubType, {
8270
+ correlationId: _this43.correlationId,
8271
+ isMultistream: _this43.isMultistream
8272
+ });
7520
8273
  _triggerProxy.default.trigger(_this43, {
7521
8274
  file: 'meeting/index',
7522
8275
  function: 'createStatsAnalyzer'
@@ -7536,19 +8289,19 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7536
8289
  }, {
7537
8290
  key: "waitForRemoteSDPAnswer",
7538
8291
  value: (function () {
7539
- var _waitForRemoteSDPAnswer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
8292
+ var _waitForRemoteSDPAnswer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
7540
8293
  var _this44 = this;
7541
8294
  var LOG_HEADER, deferSDPAnswer;
7542
- return _regenerator.default.wrap(function (_context25) {
7543
- while (1) switch (_context25.prev = _context25.next) {
8295
+ return _regenerator.default.wrap(function (_context28) {
8296
+ while (1) switch (_context28.prev = _context28.next) {
7544
8297
  case 0:
7545
8298
  LOG_HEADER = 'Meeting:index#addMedia():waitForRemoteSDPAnswer -->';
7546
8299
  if (this.deferSDPAnswer) {
7547
- _context25.next = 1;
8300
+ _context28.next = 1;
7548
8301
  break;
7549
8302
  }
7550
8303
  _loggerProxy.default.logger.warn("".concat(LOG_HEADER, " offer not created yet"));
7551
- return _context25.abrupt("return", _promise.default.reject(new Error('waitForRemoteSDPAnswer() called before local sdp offer created')));
8304
+ return _context28.abrupt("return", _promise.default.reject(new Error('waitForRemoteSDPAnswer() called before local sdp offer created')));
7552
8305
  case 1:
7553
8306
  deferSDPAnswer = this.deferSDPAnswer;
7554
8307
  this.sdpResponseTimer = setTimeout(function () {
@@ -7574,12 +8327,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7574
8327
  deferSDPAnswer.reject(error);
7575
8328
  }, _constants.ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT);
7576
8329
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " waiting for REMOTE SDP ANSWER..."));
7577
- return _context25.abrupt("return", deferSDPAnswer.promise);
8330
+ return _context28.abrupt("return", deferSDPAnswer.promise);
7578
8331
  case 2:
7579
8332
  case "end":
7580
- return _context25.stop();
8333
+ return _context28.stop();
7581
8334
  }
7582
- }, _callee25, this);
8335
+ }, _callee28, this);
7583
8336
  }));
7584
8337
  function waitForRemoteSDPAnswer() {
7585
8338
  return _waitForRemoteSDPAnswer.apply(this, arguments);
@@ -7598,30 +8351,30 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7598
8351
  }, {
7599
8352
  key: "retryEstablishMediaConnectionWithForcedTurnDiscovery",
7600
8353
  value: (function () {
7601
- var _retryEstablishMediaConnectionWithForcedTurnDiscovery = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26(remoteMediaManagerConfig, bundlePolicy) {
7602
- var LOG_HEADER, _t30;
7603
- return _regenerator.default.wrap(function (_context26) {
7604
- while (1) switch (_context26.prev = _context26.next) {
8354
+ var _retryEstablishMediaConnectionWithForcedTurnDiscovery = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29(remoteMediaManagerConfig, bundlePolicy) {
8355
+ var LOG_HEADER, _t32;
8356
+ return _regenerator.default.wrap(function (_context29) {
8357
+ while (1) switch (_context29.prev = _context29.next) {
7605
8358
  case 0:
7606
8359
  LOG_HEADER = 'Meeting:index#addMedia():retryEstablishMediaConnectionWithForcedTurnDiscovery -->';
7607
- _context26.prev = 1;
7608
- _context26.next = 2;
8360
+ _context29.prev = 1;
8361
+ _context29.next = 2;
7609
8362
  return this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, true);
7610
8363
  case 2:
7611
- _context26.next = 4;
8364
+ _context29.next = 4;
7612
8365
  break;
7613
8366
  case 3:
7614
- _context26.prev = 3;
7615
- _t30 = _context26["catch"](1);
7616
- _loggerProxy.default.logger.error("".concat(LOG_HEADER, " retry with TURN-TLS failed, media connection unable to connect, "), _t30);
7617
- throw _t30;
8367
+ _context29.prev = 3;
8368
+ _t32 = _context29["catch"](1);
8369
+ _loggerProxy.default.logger.error("".concat(LOG_HEADER, " retry with TURN-TLS failed, media connection unable to connect, "), _t32);
8370
+ throw _t32;
7618
8371
  case 4:
7619
8372
  case "end":
7620
- return _context26.stop();
8373
+ return _context29.stop();
7621
8374
  }
7622
- }, _callee26, this, [[1, 3]]);
8375
+ }, _callee29, this, [[1, 3]]);
7623
8376
  }));
7624
- function retryEstablishMediaConnectionWithForcedTurnDiscovery(_x17, _x18) {
8377
+ function retryEstablishMediaConnectionWithForcedTurnDiscovery(_x21, _x22) {
7625
8378
  return _retryEstablishMediaConnectionWithForcedTurnDiscovery.apply(this, arguments);
7626
8379
  }
7627
8380
  return retryEstablishMediaConnectionWithForcedTurnDiscovery;
@@ -7639,14 +8392,14 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7639
8392
  }, {
7640
8393
  key: "retryWithForcedTurnDiscovery",
7641
8394
  value: (function () {
7642
- var _retryWithForcedTurnDiscovery = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27(remoteMediaManagerConfig, bundlePolicy) {
8395
+ var _retryWithForcedTurnDiscovery = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30(remoteMediaManagerConfig, bundlePolicy) {
7643
8396
  var LOG_HEADER;
7644
- return _regenerator.default.wrap(function (_context27) {
7645
- while (1) switch (_context27.prev = _context27.next) {
8397
+ return _regenerator.default.wrap(function (_context30) {
8398
+ while (1) switch (_context30.prev = _context30.next) {
7646
8399
  case 0:
7647
8400
  this.addMediaData.retriedWithTurnServer = true;
7648
8401
  LOG_HEADER = 'Meeting:index#addMedia():retryWithForcedTurnDiscovery -->';
7649
- _context27.next = 1;
8402
+ _context30.next = 1;
7650
8403
  return this.cleanUpBeforeRetryWithTurnServer();
7651
8404
  case 1:
7652
8405
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_RETRY, {
@@ -7656,24 +8409,24 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7656
8409
  reason: 'forcingTurnTls'
7657
8410
  });
7658
8411
  if (!(this.state === _constants.MEETING_STATE.STATES.LEFT)) {
7659
- _context27.next = 2;
8412
+ _context30.next = 2;
7660
8413
  break;
7661
8414
  }
7662
8415
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " meeting state was LEFT after first attempt to establish media connection. Attempting to rejoin. "));
7663
- _context27.next = 2;
8416
+ _context30.next = 2;
7664
8417
  return this.join({
7665
8418
  rejoin: true
7666
8419
  });
7667
8420
  case 2:
7668
- _context27.next = 3;
8421
+ _context30.next = 3;
7669
8422
  return this.retryEstablishMediaConnectionWithForcedTurnDiscovery(remoteMediaManagerConfig, bundlePolicy);
7670
8423
  case 3:
7671
8424
  case "end":
7672
- return _context27.stop();
8425
+ return _context30.stop();
7673
8426
  }
7674
- }, _callee27, this);
8427
+ }, _callee30, this);
7675
8428
  }));
7676
- function retryWithForcedTurnDiscovery(_x19, _x20) {
8429
+ function retryWithForcedTurnDiscovery(_x23, _x24) {
7677
8430
  return _retryWithForcedTurnDiscovery.apply(this, arguments);
7678
8431
  }
7679
8432
  return retryWithForcedTurnDiscovery;
@@ -7693,32 +8446,46 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7693
8446
  }, {
7694
8447
  key: "handleWaitForMediaConnectionConnectedError",
7695
8448
  value: (function () {
7696
- var _handleWaitForMediaConnectionConnectedError = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28(error, remoteMediaManagerConfig, bundlePolicy) {
7697
- var LOG_HEADER;
7698
- return _regenerator.default.wrap(function (_context28) {
7699
- while (1) switch (_context28.prev = _context28.next) {
8449
+ var _handleWaitForMediaConnectionConnectedError = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31(error, remoteMediaManagerConfig, bundlePolicy) {
8450
+ var LOG_HEADER, _yield$this$mediaProp, connectionType, selectedCandidatePairChanges, numTransports, iceConnected;
8451
+ return _regenerator.default.wrap(function (_context31) {
8452
+ while (1) switch (_context31.prev = _context31.next) {
7700
8453
  case 0:
7701
8454
  LOG_HEADER = 'Meeting:index#addMedia():handleWaitForMediaConnectionConnectedError -->'; // @ts-ignore - config coming from registerPlugin
7702
8455
  if (this.turnServerUsed) {
7703
- _context28.next = 2;
8456
+ _context31.next = 2;
7704
8457
  break;
7705
8458
  }
7706
8459
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " error waiting for media to connect on UDP, TCP, retrying using TURN-TLS, "), error);
7707
- _context28.next = 1;
8460
+ _context31.next = 1;
7708
8461
  return this.retryWithForcedTurnDiscovery(remoteMediaManagerConfig, bundlePolicy);
7709
8462
  case 1:
7710
- _context28.next = 3;
8463
+ _context31.next = 4;
7711
8464
  break;
7712
8465
  case 2:
7713
8466
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " error waiting for media to connect using UDP, TCP and TURN-TLS"), error);
7714
- throw new _webexErrors.AddMediaFailed(error);
8467
+ _context31.next = 3;
8468
+ return this.mediaProperties.getCurrentConnectionInfo();
7715
8469
  case 3:
8470
+ _yield$this$mediaProp = _context31.sent;
8471
+ connectionType = _yield$this$mediaProp.connectionType;
8472
+ selectedCandidatePairChanges = _yield$this$mediaProp.selectedCandidatePairChanges;
8473
+ numTransports = _yield$this$mediaProp.numTransports;
8474
+ iceConnected = error instanceof _webexErrors.MediaConnectionTimedOutError && error.iceConnected;
8475
+ throw new _webexErrors.AddMediaFailed({
8476
+ cause: error,
8477
+ connectionType: connectionType,
8478
+ selectedCandidatePairChanges: selectedCandidatePairChanges,
8479
+ numTransports: numTransports,
8480
+ iceConnected: iceConnected
8481
+ });
8482
+ case 4:
7716
8483
  case "end":
7717
- return _context28.stop();
8484
+ return _context31.stop();
7718
8485
  }
7719
- }, _callee28, this);
8486
+ }, _callee31, this);
7720
8487
  }));
7721
- function handleWaitForMediaConnectionConnectedError(_x21, _x22, _x23) {
8488
+ function handleWaitForMediaConnectionConnectedError(_x25, _x26, _x27) {
7722
8489
  return _handleWaitForMediaConnectionConnectedError.apply(this, arguments);
7723
8490
  }
7724
8491
  return handleWaitForMediaConnectionConnectedError;
@@ -7734,20 +8501,20 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7734
8501
  }, {
7735
8502
  key: "doTurnDiscovery",
7736
8503
  value: (function () {
7737
- var _doTurnDiscovery = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29(isReconnecting, isForced) {
8504
+ var _doTurnDiscovery = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32(isReconnecting, isForced) {
7738
8505
  var cdl, turnDiscoveryResult;
7739
- return _regenerator.default.wrap(function (_context29) {
7740
- while (1) switch (_context29.prev = _context29.next) {
8506
+ return _regenerator.default.wrap(function (_context32) {
8507
+ while (1) switch (_context32.prev = _context32.next) {
7741
8508
  case 0:
7742
8509
  // @ts-ignore
7743
8510
  cdl = this.webex.internal.newMetrics.callDiagnosticLatencies; // @ts-ignore
7744
8511
  this.webex.internal.newMetrics.submitInternalEvent({
7745
8512
  name: 'internal.client.add-media.turn-discovery.start'
7746
8513
  });
7747
- _context29.next = 1;
8514
+ _context32.next = 1;
7748
8515
  return this.roap.doTurnDiscovery(this, isReconnecting, isForced);
7749
8516
  case 1:
7750
- turnDiscoveryResult = _context29.sent;
8517
+ turnDiscoveryResult = _context32.sent;
7751
8518
  this.turnDiscoverySkippedReason = turnDiscoveryResult === null || turnDiscoveryResult === void 0 ? void 0 : turnDiscoveryResult.turnDiscoverySkippedReason;
7752
8519
  this.turnServerUsed = !this.turnDiscoverySkippedReason;
7753
8520
 
@@ -7763,14 +8530,14 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7763
8530
  retriedWithTurnServer: this.addMediaData.retriedWithTurnServer
7764
8531
  });
7765
8532
  }
7766
- return _context29.abrupt("return", turnDiscoveryResult);
8533
+ return _context32.abrupt("return", turnDiscoveryResult);
7767
8534
  case 2:
7768
8535
  case "end":
7769
- return _context29.stop();
8536
+ return _context32.stop();
7770
8537
  }
7771
- }, _callee29, this);
8538
+ }, _callee32, this);
7772
8539
  }));
7773
- function doTurnDiscovery(_x24, _x25) {
8540
+ function doTurnDiscovery(_x28, _x29) {
7774
8541
  return _doTurnDiscovery.apply(this, arguments);
7775
8542
  }
7776
8543
  return doTurnDiscovery;
@@ -7789,35 +8556,40 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7789
8556
  }, {
7790
8557
  key: "establishMediaConnection",
7791
8558
  value: (function () {
7792
- var _establishMediaConnection = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30(remoteMediaManagerConfig, bundlePolicy, isForced, turnServerInfo) {
8559
+ var _establishMediaConnection = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33(remoteMediaManagerConfig, bundlePolicy, isForced, turnServerInfo) {
7793
8560
  var _this$locusMediaReque;
7794
- var LOG_HEADER, isReconnecting, _yield$this$doTurnDis, mc, _t31, _t32;
7795
- return _regenerator.default.wrap(function (_context30) {
7796
- while (1) switch (_context30.prev = _context30.next) {
8561
+ var LOG_HEADER, isReconnecting, _turnServerInfo$urls, _yield$this$doTurnDis, mediaConnection, _t33, _t34;
8562
+ return _regenerator.default.wrap(function (_context33) {
8563
+ while (1) switch (_context33.prev = _context33.next) {
7797
8564
  case 0:
7798
8565
  LOG_HEADER = 'Meeting:index#addMedia():establishMediaConnection -->';
7799
8566
  isReconnecting = this.isMoveToInProgress || !!((_this$locusMediaReque = this.locusMediaRequest) !== null && _this$locusMediaReque !== void 0 && _this$locusMediaReque.isConfluenceCreated()); // We are forcing turn discovery if the case is moveTo and a turn server was used already
7800
8567
  if (this.isMoveToInProgress && this.turnServerUsed) {
7801
8568
  isForced = true;
7802
8569
  }
7803
- _context30.prev = 1;
8570
+ _context33.prev = 1;
7804
8571
  if (turnServerInfo) {
7805
- _context30.next = 3;
8572
+ _context33.next = 3;
7806
8573
  break;
7807
8574
  }
7808
- _context30.next = 2;
8575
+ _context33.next = 2;
7809
8576
  return this.doTurnDiscovery(isReconnecting, isForced);
7810
8577
  case 2:
7811
- _yield$this$doTurnDis = _context30.sent;
8578
+ _yield$this$doTurnDis = _context33.sent;
7812
8579
  turnServerInfo = _yield$this$doTurnDis.turnServerInfo;
7813
8580
  case 3:
7814
- _context30.next = 4;
7815
- return this.createMediaConnection(turnServerInfo, bundlePolicy);
8581
+ if ((!turnServerInfo || !((_turnServerInfo$urls = turnServerInfo.urls) !== null && _turnServerInfo$urls !== void 0 && _turnServerInfo$urls.length)) && this.addMediaData.iceTransportPolicy === 'relay') {
8582
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " cannot do iceTransportPolicy=relay, because there is no turn server info available"));
8583
+ // drop the forced relay policy and use the default, because we don't have a TURN server
8584
+ this.addMediaData.iceTransportPolicy = undefined;
8585
+ }
8586
+ _context33.next = 4;
8587
+ return this.createMediaConnection(turnServerInfo, bundlePolicy, this.addMediaData.iceTransportPolicy);
7816
8588
  case 4:
7817
- mc = _context30.sent;
8589
+ mediaConnection = _context33.sent;
7818
8590
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " media connection created this.isMultistream=").concat(this.isMultistream));
7819
8591
  if (!this.isMultistream) {
7820
- _context30.next = 5;
8592
+ _context33.next = 5;
7821
8593
  break;
7822
8594
  }
7823
8595
  this.remoteMediaManager = new _remoteMediaManager.RemoteMediaManager(this.receiveSlotManager, this.mediaRequestManagers, remoteMediaManagerConfig);
@@ -7825,42 +8597,42 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7825
8597
  this.forwardEvent(this.remoteMediaManager, _remoteMediaManager.Event.InterpretationAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_INTERPRETATION_AUDIO_CREATED);
7826
8598
  this.forwardEvent(this.remoteMediaManager, _remoteMediaManager.Event.ScreenShareAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED);
7827
8599
  this.forwardEvent(this.remoteMediaManager, _remoteMediaManager.Event.VideoLayoutChanged, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED);
7828
- _context30.next = 5;
8600
+ _context33.next = 5;
7829
8601
  return this.remoteMediaManager.start();
7830
8602
  case 5:
7831
- _context30.next = 6;
7832
- return mc.initiateOffer();
8603
+ _context33.next = 6;
8604
+ return mediaConnection.initiateOffer();
7833
8605
  case 6:
7834
- _context30.next = 7;
8606
+ _context33.next = 7;
7835
8607
  return this.waitForRemoteSDPAnswer();
7836
8608
  case 7:
7837
8609
  this.handleMediaLogging(this.mediaProperties);
7838
- _context30.next = 9;
8610
+ _context33.next = 9;
7839
8611
  break;
7840
8612
  case 8:
7841
- _context30.prev = 8;
7842
- _t31 = _context30["catch"](1);
7843
- _loggerProxy.default.logger.error("".concat(LOG_HEADER, " error establishing media connection, "), _t31);
7844
- throw _t31;
8613
+ _context33.prev = 8;
8614
+ _t33 = _context33["catch"](1);
8615
+ _loggerProxy.default.logger.error("".concat(LOG_HEADER, " error establishing media connection, "), _t33);
8616
+ throw _t33;
7845
8617
  case 9:
7846
- _context30.prev = 9;
7847
- _context30.next = 10;
8618
+ _context33.prev = 9;
8619
+ _context33.next = 10;
7848
8620
  return this.waitForMediaConnectionConnected();
7849
8621
  case 10:
7850
- _context30.next = 12;
8622
+ _context33.next = 12;
7851
8623
  break;
7852
8624
  case 11:
7853
- _context30.prev = 11;
7854
- _t32 = _context30["catch"](9);
7855
- _context30.next = 12;
7856
- return this.handleWaitForMediaConnectionConnectedError(_t32, remoteMediaManagerConfig, bundlePolicy);
8625
+ _context33.prev = 11;
8626
+ _t34 = _context33["catch"](9);
8627
+ _context33.next = 12;
8628
+ return this.handleWaitForMediaConnectionConnectedError(_t34, remoteMediaManagerConfig, bundlePolicy);
7857
8629
  case 12:
7858
8630
  case "end":
7859
- return _context30.stop();
8631
+ return _context33.stop();
7860
8632
  }
7861
- }, _callee30, this, [[1, 8], [9, 11]]);
8633
+ }, _callee33, this, [[1, 8], [9, 11]]);
7862
8634
  }));
7863
- function establishMediaConnection(_x26, _x27, _x28, _x29) {
8635
+ function establishMediaConnection(_x30, _x31, _x32, _x33) {
7864
8636
  return _establishMediaConnection.apply(this, arguments);
7865
8637
  }
7866
8638
  return establishMediaConnection;
@@ -7875,16 +8647,16 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7875
8647
  }, {
7876
8648
  key: "cleanUpOnAddMediaFailure",
7877
8649
  value: (function () {
7878
- var _cleanUpOnAddMediaFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
8650
+ var _cleanUpOnAddMediaFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
7879
8651
  var _this$networkQualityM, _this$statsMonitor;
7880
- return _regenerator.default.wrap(function (_context31) {
7881
- while (1) switch (_context31.prev = _context31.next) {
8652
+ return _regenerator.default.wrap(function (_context34) {
8653
+ while (1) switch (_context34.prev = _context34.next) {
7882
8654
  case 0:
7883
8655
  if (!this.statsAnalyzer) {
7884
- _context31.next = 1;
8656
+ _context34.next = 1;
7885
8657
  break;
7886
8658
  }
7887
- _context31.next = 1;
8659
+ _context34.next = 1;
7888
8660
  return this.statsAnalyzer.stopAnalyzer();
7889
8661
  case 1:
7890
8662
  this.statsAnalyzer = null;
@@ -7895,7 +8667,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7895
8667
 
7896
8668
  // when media fails, we want to upload a webrtc dump to see whats going on
7897
8669
  // this function is async, but returns once the stats have been gathered
7898
- _context31.next = 2;
8670
+ _context34.next = 2;
7899
8671
  return this.forceSendStatsReport({
7900
8672
  callFrom: 'addMedia'
7901
8673
  });
@@ -7906,9 +8678,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7906
8678
  }
7907
8679
  case 3:
7908
8680
  case "end":
7909
- return _context31.stop();
8681
+ return _context34.stop();
7910
8682
  }
7911
- }, _callee31, this);
8683
+ }, _callee34, this);
7912
8684
  }));
7913
8685
  function cleanUpOnAddMediaFailure() {
7914
8686
  return _cleanUpOnAddMediaFailure.apply(this, arguments);
@@ -7926,16 +8698,16 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7926
8698
  }, {
7927
8699
  key: "downgradeFromMultistreamToTranscoded",
7928
8700
  value: (function () {
7929
- var _downgradeFromMultistreamToTranscoded = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
8701
+ var _downgradeFromMultistreamToTranscoded = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
7930
8702
  var _this$networkQualityM2, _this$statsMonitor2, _this$locusMediaReque2;
7931
- return _regenerator.default.wrap(function (_context32) {
7932
- while (1) switch (_context32.prev = _context32.next) {
8703
+ return _regenerator.default.wrap(function (_context35) {
8704
+ while (1) switch (_context35.prev = _context35.next) {
7933
8705
  case 0:
7934
8706
  if (!this.statsAnalyzer) {
7935
- _context32.next = 1;
8707
+ _context35.next = 1;
7936
8708
  break;
7937
8709
  }
7938
- _context32.next = 1;
8710
+ _context35.next = 1;
7939
8711
  return this.statsAnalyzer.stopAnalyzer();
7940
8712
  case 1:
7941
8713
  this.statsAnalyzer = null;
@@ -7944,6 +8716,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7944
8716
  (_this$statsMonitor2 = this.statsMonitor) === null || _this$statsMonitor2 === void 0 ? void 0 : _this$statsMonitor2.removeAllListeners();
7945
8717
  this.statsMonitor = null;
7946
8718
  this.isMultistream = false;
8719
+
8720
+ // reset iceTransportPolicy, because it's only applied for multistream media connections
8721
+ this.addMediaData.iceTransportPolicy = undefined;
7947
8722
  if (this.mediaProperties.webrtcMediaConnection) {
7948
8723
  // close peer connection, but don't reset mute state information, because we will want to use it on the retry
7949
8724
  this.closePeerConnections(false);
@@ -7953,9 +8728,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7953
8728
  this.createStatsAnalyzer();
7954
8729
  case 2:
7955
8730
  case "end":
7956
- return _context32.stop();
8731
+ return _context35.stop();
7957
8732
  }
7958
- }, _callee32, this);
8733
+ }, _callee35, this);
7959
8734
  }));
7960
8735
  function downgradeFromMultistreamToTranscoded() {
7961
8736
  return _downgradeFromMultistreamToTranscoded.apply(this, arguments);
@@ -7973,11 +8748,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7973
8748
  }, {
7974
8749
  key: "cleanUpBeforeRetryWithTurnServer",
7975
8750
  value: (function () {
7976
- var _cleanUpBeforeRetryWithTurnServer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
7977
- return _regenerator.default.wrap(function (_context33) {
7978
- while (1) switch (_context33.prev = _context33.next) {
8751
+ var _cleanUpBeforeRetryWithTurnServer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
8752
+ return _regenerator.default.wrap(function (_context36) {
8753
+ while (1) switch (_context36.prev = _context36.next) {
7979
8754
  case 0:
7980
- _context33.next = 1;
8755
+ _context36.next = 1;
7981
8756
  return this.forceSendStatsReport({
7982
8757
  callFrom: 'cleanUpBeforeRetryWithTurnServer'
7983
8758
  });
@@ -7997,9 +8772,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7997
8772
  }
7998
8773
  case 2:
7999
8774
  case "end":
8000
- return _context33.stop();
8775
+ return _context36.stop();
8001
8776
  }
8002
- }, _callee33, this);
8777
+ }, _callee36, this);
8003
8778
  }));
8004
8779
  function cleanUpBeforeRetryWithTurnServer() {
8005
8780
  return _cleanUpBeforeRetryWithTurnServer.apply(this, arguments);
@@ -8009,35 +8784,35 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8009
8784
  }, {
8010
8785
  key: "cleanUpBeforeReconnection",
8011
8786
  value: function () {
8012
- var _cleanUpBeforeReconnection = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
8013
- var _t33;
8014
- return _regenerator.default.wrap(function (_context34) {
8015
- while (1) switch (_context34.prev = _context34.next) {
8787
+ var _cleanUpBeforeReconnection = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
8788
+ var _t35;
8789
+ return _regenerator.default.wrap(function (_context37) {
8790
+ while (1) switch (_context37.prev = _context37.next) {
8016
8791
  case 0:
8017
- _context34.prev = 0;
8018
- _context34.next = 1;
8792
+ _context37.prev = 0;
8793
+ _context37.next = 1;
8019
8794
  return this.forceSendStatsReport({
8020
8795
  callFrom: 'cleanUpBeforeReconnection'
8021
8796
  });
8022
8797
  case 1:
8023
8798
  if (!this.statsAnalyzer) {
8024
- _context34.next = 2;
8799
+ _context37.next = 2;
8025
8800
  break;
8026
8801
  }
8027
- _context34.next = 2;
8802
+ _context37.next = 2;
8028
8803
  return this.statsAnalyzer.stopAnalyzer();
8029
8804
  case 2:
8030
- _context34.next = 4;
8805
+ _context37.next = 4;
8031
8806
  break;
8032
8807
  case 3:
8033
- _context34.prev = 3;
8034
- _t33 = _context34["catch"](0);
8035
- _loggerProxy.default.logger.error('Meeting:index#cleanUpBeforeReconnection --> Error during cleanup: ', _t33);
8808
+ _context37.prev = 3;
8809
+ _t35 = _context37["catch"](0);
8810
+ _loggerProxy.default.logger.error('Meeting:index#cleanUpBeforeReconnection --> Error during cleanup: ', _t35);
8036
8811
  case 4:
8037
8812
  case "end":
8038
- return _context34.stop();
8813
+ return _context37.stop();
8039
8814
  }
8040
- }, _callee34, this, [[0, 3]]);
8815
+ }, _callee37, this, [[0, 3]]);
8041
8816
  }));
8042
8817
  function cleanUpBeforeReconnection() {
8043
8818
  return _cleanUpBeforeReconnection.apply(this, arguments);
@@ -8053,7 +8828,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8053
8828
  }, {
8054
8829
  key: "setupLocusMediaRequest",
8055
8830
  value: function setupLocusMediaRequest() {
8056
- var _this$webex$meetings$2, _this$webex$meetings$3;
8831
+ var _this$webex$meetings$2,
8832
+ _this$webex$meetings$3,
8833
+ _this45 = this;
8057
8834
  this.locusMediaRequest = new _locusMediaRequest.LocusMediaRequest({
8058
8835
  correlationId: this.correlationId,
8059
8836
  meetingId: this.id,
@@ -8066,13 +8843,50 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8066
8843
  // @ts-ignore
8067
8844
  regionCode: (_this$webex$meetings$3 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$3 === void 0 ? void 0 : _this$webex$meetings$3.regionCode
8068
8845
  },
8069
- preferTranscoding: !this.isMultistream
8846
+ preferTranscoding: !this.isMultistream,
8847
+ getCurrentSelfUrl: function getCurrentSelfUrl() {
8848
+ return _this45.selfUrl;
8849
+ },
8850
+ waitForSelfUrlChange: function waitForSelfUrlChange() {
8851
+ return _this45.waitForSelfUrlChange();
8852
+ }
8070
8853
  }, {
8071
8854
  // @ts-ignore
8072
8855
  parent: this.webex
8073
8856
  });
8074
8857
  }
8075
8858
 
8859
+ /**
8860
+ * Waits for LocusInfo to update meeting.selfUrl, with a timeout fallback.
8861
+ * @returns {Promise<void>}
8862
+ * @private
8863
+ * @memberof Meeting
8864
+ */
8865
+ }, {
8866
+ key: "waitForSelfUrlChange",
8867
+ value: function waitForSelfUrlChange() {
8868
+ var _this46 = this;
8869
+ if (this.joinWithMediaRetryInfo.retryCount > 0) {
8870
+ /* During joinWithMedia() retries we can get 403/409 from Locus and it doesn't mean
8871
+ * that the selfUrl will change, it is usually caused by Locus dropping us as a result of
8872
+ * media connection failure during joinWithMedia's earlier media connection attempt,
8873
+ * so we don't want to wait for selfUrl change as this would only slow down the join process. */
8874
+ _loggerProxy.default.logger.info('Meeting:index#waitForSelfUrlChange --> joinWithMedia retry in progress, will not wait for selfUrl change');
8875
+ return _promise.default.resolve();
8876
+ }
8877
+ if (!this.promisesWaitingForPropUpdate.selfUrl) {
8878
+ var pendingSelfUrlUpdate = new _common.Defer();
8879
+ this.promisesWaitingForPropUpdate.selfUrl = pendingSelfUrlUpdate;
8880
+ setTimeout(function () {
8881
+ if (_this46.promisesWaitingForPropUpdate.selfUrl === pendingSelfUrlUpdate) {
8882
+ delete _this46.promisesWaitingForPropUpdate.selfUrl;
8883
+ pendingSelfUrlUpdate.resolve();
8884
+ }
8885
+ }, 5000);
8886
+ }
8887
+ return this.promisesWaitingForPropUpdate.selfUrl.promise;
8888
+ }
8889
+
8076
8890
  /**
8077
8891
  * Creates a media connection to the server. Media connection is required for sending or receiving any audio/video.
8078
8892
  *
@@ -8084,19 +8898,20 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8084
8898
  }, {
8085
8899
  key: "addMedia",
8086
8900
  value: function addMedia() {
8087
- var _this45 = this;
8901
+ var _this47 = this;
8088
8902
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8089
8903
  return this.addMediaInternal(function () {
8090
- return _this45.turnServerUsed ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY';
8091
- }, undefined, false, options);
8904
+ return _this47.turnServerUsed ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY';
8905
+ }, false, undefined /* turnServerInfo - it will be fetched via doTurnDiscovery() */, undefined /* iceTransportPolicy - we're relying on the default value */, options);
8092
8906
  }
8093
8907
 
8094
8908
  /**
8095
8909
  * Internal version of addMedia() with some more arguments for finer control of its behavior
8096
8910
  *
8097
8911
  * @param {Function} icePhaseCallback - callback to determine the icePhase for CA "client.ice.end" failure events
8098
- * @param {TurnServerInfo} turnServerInfo - TURN server information
8099
8912
  * @param {boolean} forceTurnDiscovery - if true, TURN discovery will be done
8913
+ * @param {TurnServerInfo} turnServerInfo - TURN server information
8914
+ * @param {RTCIceTransportPolicy} [iceTransportPolicy] - ICE transport policy override
8100
8915
  * @param {AddMediaOptions} options - same as options of the public addMedia() method
8101
8916
  * @returns {Promise<void>}
8102
8917
  * @protected
@@ -8105,7 +8920,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8105
8920
  }, {
8106
8921
  key: "addMediaInternal",
8107
8922
  value: (function () {
8108
- var _addMediaInternal = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35(icePhaseCallback, turnServerInfo, forceTurnDiscovery) {
8923
+ var _addMediaInternal = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38(icePhaseCallback, forceTurnDiscovery, turnServerInfo, iceTransportPolicy) {
8109
8924
  var options,
8110
8925
  LOG_HEADER,
8111
8926
  localStreams,
@@ -8134,7 +8949,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8134
8949
  receiveAudio,
8135
8950
  ipver,
8136
8951
  _this$remoteMediaMana,
8137
- _yield$this$mediaProp,
8952
+ _yield$this$mediaProp2,
8138
8953
  connectionType,
8139
8954
  ipVersion,
8140
8955
  selectedCandidatePairChanges,
@@ -8163,30 +8978,33 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8163
8978
  _this$mediaProperties33,
8164
8979
  _this$mediaProperties34,
8165
8980
  _reachabilityMetrics,
8166
- _yield$this$mediaProp2,
8981
+ _ref45,
8982
+ _connectionType,
8167
8983
  _selectedCandidatePairChanges,
8168
8984
  _numTransports,
8169
8985
  _iceCandidateErrors,
8170
- _args35 = arguments,
8171
- _t34,
8172
- _t35;
8173
- return _regenerator.default.wrap(function (_context35) {
8174
- while (1) switch (_context35.prev = _context35.next) {
8986
+ _args38 = arguments,
8987
+ _t36,
8988
+ _t37,
8989
+ _t38;
8990
+ return _regenerator.default.wrap(function (_context38) {
8991
+ while (1) switch (_context38.prev = _context38.next) {
8175
8992
  case 0:
8176
- options = _args35.length > 3 && _args35[3] !== undefined ? _args35[3] : {};
8993
+ options = _args38.length > 4 && _args38[4] !== undefined ? _args38[4] : {};
8177
8994
  this.addMediaData.retriedWithTurnServer = false;
8178
8995
  this.addMediaData.icePhaseCallback = icePhaseCallback;
8996
+ this.addMediaData.iceTransportPolicy = iceTransportPolicy;
8179
8997
  this.hasMediaConnectionConnectedAtLeastOnce = false;
8180
8998
  LOG_HEADER = 'Meeting:index#addMedia -->';
8181
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " called with: options=").concat((0, _stringify.default)(options), ", turnServerInfo=").concat((0, _stringify.default)(turnServerInfo), ", forceTurnDiscovery=").concat(forceTurnDiscovery));
8999
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " called with: options=").concat((0, _stringify.default)(options), ", turnServerInfo=").concat((0, _stringify.default)(turnServerInfo), ", forceTurnDiscovery=").concat(forceTurnDiscovery, ", iceTransportPolicy=").concat(iceTransportPolicy));
8182
9000
  if (!(options.allowMediaInLobby !== true && this.meetingState !== _constants.FULL_STATE.ACTIVE)) {
8183
- _context35.next = 1;
9001
+ _context38.next = 1;
8184
9002
  break;
8185
9003
  }
8186
9004
  throw new _webexErrors.MeetingNotActiveError();
8187
9005
  case 1:
8188
9006
  if (!_util2.default.isUserInLeftState(this.locusInfo)) {
8189
- _context35.next = 2;
9007
+ _context38.next = 2;
8190
9008
  break;
8191
9009
  }
8192
9010
  throw new _webexErrors.UserNotJoinedError();
@@ -8203,7 +9021,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8203
9021
  ipver = _util2.default.getIpVersion(this.webex); // used just for metrics
8204
9022
  // If the user is unjoined or guest waiting in lobby dont allow the user to addMedia
8205
9023
  if (!(this.isUserUnadmitted && !this.wirelessShare && !this.allowMediaInLobby)) {
8206
- _context35.next = 3;
9024
+ _context38.next = 3;
8207
9025
  break;
8208
9026
  }
8209
9027
  throw new _webexErrors.UserInLobbyError();
@@ -8247,62 +9065,62 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8247
9065
  this.audio = (0, _muteState.createMuteState)(_constants.AUDIO, this, audioEnabled);
8248
9066
  this.video = (0, _muteState.createMuteState)(_constants.VIDEO, this, videoEnabled);
8249
9067
  this.brbState = (0, _brbState.createBrbState)(this, false);
8250
- _context35.prev = 4;
9068
+ _context38.prev = 4;
8251
9069
  if (!(allowPublishMediaInLobby || !this.isUserUnadmitted)) {
8252
- _context35.next = 5;
9070
+ _context38.next = 5;
8253
9071
  break;
8254
9072
  }
8255
- _context35.next = 5;
9073
+ _context38.next = 5;
8256
9074
  return this.setUpLocalStreamReferences(localStreams);
8257
9075
  case 5:
8258
9076
  this.setMercuryListener();
8259
9077
  this.createStatsAnalyzer();
8260
- _context35.prev = 6;
8261
- _context35.next = 7;
9078
+ _context38.prev = 6;
9079
+ _context38.next = 7;
8262
9080
  return this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, forceTurnDiscovery, turnServerInfo);
8263
9081
  case 7:
8264
- _context35.next = 12;
9082
+ _context38.next = 12;
8265
9083
  break;
8266
9084
  case 8:
8267
- _context35.prev = 8;
8268
- _t34 = _context35["catch"](6);
8269
- if (!(_t34 instanceof _multistreamNotSupportedError.default)) {
8270
- _context35.next = 11;
9085
+ _context38.prev = 8;
9086
+ _t36 = _context38["catch"](6);
9087
+ if (!(_t36 instanceof _multistreamNotSupportedError.default)) {
9088
+ _context38.next = 11;
8271
9089
  break;
8272
9090
  }
8273
9091
  _loggerProxy.default.logger.warn("".concat(LOG_HEADER, " we asked for multistream backend (Homer), but got transcoded backend, recreating media connection..."));
8274
- _context35.next = 9;
9092
+ _context38.next = 9;
8275
9093
  return this.downgradeFromMultistreamToTranscoded();
8276
9094
  case 9:
8277
- _context35.next = 10;
8278
- return this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, true, undefined);
9095
+ _context38.next = 10;
9096
+ return this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, true);
8279
9097
  case 10:
8280
- _context35.next = 12;
9098
+ _context38.next = 12;
8281
9099
  break;
8282
9100
  case 11:
8283
- throw _t34;
9101
+ throw _t36;
8284
9102
  case 12:
8285
9103
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " media connected, finalizing..."));
8286
9104
  if (!this.mediaProperties.hasLocalShareStream()) {
8287
- _context35.next = 13;
9105
+ _context38.next = 13;
8288
9106
  break;
8289
9107
  }
8290
- _context35.next = 13;
9108
+ _context38.next = 13;
8291
9109
  return this.enqueueScreenShareFloorRequest();
8292
9110
  case 13:
8293
- _context35.next = 14;
9111
+ _context38.next = 14;
8294
9112
  return this.mediaProperties.getCurrentConnectionInfo();
8295
9113
  case 14:
8296
- _yield$this$mediaProp = _context35.sent;
8297
- connectionType = _yield$this$mediaProp.connectionType;
8298
- ipVersion = _yield$this$mediaProp.ipVersion;
8299
- selectedCandidatePairChanges = _yield$this$mediaProp.selectedCandidatePairChanges;
8300
- numTransports = _yield$this$mediaProp.numTransports;
9114
+ _yield$this$mediaProp2 = _context38.sent;
9115
+ connectionType = _yield$this$mediaProp2.connectionType;
9116
+ ipVersion = _yield$this$mediaProp2.ipVersion;
9117
+ selectedCandidatePairChanges = _yield$this$mediaProp2.selectedCandidatePairChanges;
9118
+ numTransports = _yield$this$mediaProp2.numTransports;
8301
9119
  iceCandidateErrors = Object.fromEntries(this.iceCandidateErrors);
8302
- _context35.next = 15;
9120
+ _context38.next = 15;
8303
9121
  return this.getMediaReachabilityMetricFields();
8304
9122
  case 15:
8305
- reachabilityMetrics = _context35.sent;
9123
+ reachabilityMetrics = _context38.sent;
8306
9124
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_SUCCESS, _objectSpread(_objectSpread(_objectSpread({
8307
9125
  correlation_id: this.correlationId,
8308
9126
  locus_id: this.locusUrl.split('/').pop(),
@@ -8313,7 +9131,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8313
9131
  numTransports: numTransports,
8314
9132
  isMultistream: this.isMultistream,
8315
9133
  retriedWithTurnServer: this.addMediaData.retriedWithTurnServer,
8316
- isJoinWithMediaRetry: this.joinWithMediaRetryInfo.isRetry
9134
+ isJoinWithMediaRetry: this.joinWithMediaRetryInfo.retryCount > 0,
9135
+ iceTransportPolicy: this.addMediaData.iceTransportPolicy || 'all'
8317
9136
  }, reachabilityMetrics), iceCandidateErrors), {}, {
8318
9137
  iceCandidatesCount: this.iceCandidatesCount
8319
9138
  }));
@@ -8332,70 +9151,83 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8332
9151
  // We can log ReceiveSlot SSRCs only after the SDP exchange, so doing it here:
8333
9152
  (_this$remoteMediaMana = this.remoteMediaManager) === null || _this$remoteMediaMana === void 0 ? void 0 : _this$remoteMediaMana.logAllReceiveSlots();
8334
9153
  this.startPeriodicLogUpload();
8335
- _context35.next = 20;
9154
+ _context38.next = 22;
8336
9155
  break;
8337
9156
  case 16:
8338
- _context35.prev = 16;
8339
- _t35 = _context35["catch"](4);
8340
- _loggerProxy.default.logger.error("".concat(LOG_HEADER, " failed to establish media connection: "), _t35);
9157
+ _context38.prev = 16;
9158
+ _t37 = _context38["catch"](4);
9159
+ _loggerProxy.default.logger.error("".concat(LOG_HEADER, " failed to establish media connection: "), _t37);
8341
9160
 
8342
9161
  // @ts-ignore
8343
- _context35.next = 17;
9162
+ _context38.next = 17;
8344
9163
  return this.getMediaReachabilityMetricFields();
8345
9164
  case 17:
8346
- _reachabilityMetrics = _context35.sent;
8347
- _context35.next = 18;
8348
- return this.mediaProperties.getCurrentConnectionInfo();
9165
+ _reachabilityMetrics = _context38.sent;
9166
+ if (!(_t37 instanceof _webexErrors.AddMediaFailed)) {
9167
+ _context38.next = 18;
9168
+ break;
9169
+ }
9170
+ _t38 = _t37;
9171
+ _context38.next = 20;
9172
+ break;
8349
9173
  case 18:
8350
- _yield$this$mediaProp2 = _context35.sent;
8351
- _selectedCandidatePairChanges = _yield$this$mediaProp2.selectedCandidatePairChanges;
8352
- _numTransports = _yield$this$mediaProp2.numTransports;
9174
+ _context38.next = 19;
9175
+ return this.mediaProperties.getCurrentConnectionInfo();
9176
+ case 19:
9177
+ _t38 = _context38.sent;
9178
+ case 20:
9179
+ _ref45 = _t38;
9180
+ _connectionType = _ref45.connectionType;
9181
+ _selectedCandidatePairChanges = _ref45.selectedCandidatePairChanges;
9182
+ _numTransports = _ref45.numTransports;
8353
9183
  _iceCandidateErrors = Object.fromEntries(this.iceCandidateErrors);
8354
9184
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, _objectSpread(_objectSpread(_objectSpread({
8355
9185
  correlation_id: this.correlationId,
8356
9186
  locus_id: this.locusUrl.split('/').pop(),
8357
- reason: _t35.message,
8358
- stack: _t35.stack,
8359
- code: _t35.code,
9187
+ reason: _t37.message,
9188
+ stack: _t37.stack,
9189
+ code: _t37.code,
8360
9190
  selectedCandidatePairChanges: _selectedCandidatePairChanges,
8361
9191
  numTransports: _numTransports,
8362
9192
  turnDiscoverySkippedReason: this.turnDiscoverySkippedReason,
8363
9193
  turnServerUsed: this.turnServerUsed,
8364
9194
  retriedWithTurnServer: this.addMediaData.retriedWithTurnServer,
8365
9195
  isMultistream: this.isMultistream,
8366
- isJoinWithMediaRetry: this.joinWithMediaRetryInfo.isRetry,
9196
+ isJoinWithMediaRetry: this.joinWithMediaRetryInfo.retryCount > 0,
9197
+ iceTransportPolicy: this.addMediaData.iceTransportPolicy || 'all',
8367
9198
  signalingState: ((_this$mediaProperties14 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties14 === void 0 ? void 0 : (_this$mediaProperties15 = _this$mediaProperties14.multistreamConnection) === null || _this$mediaProperties15 === void 0 ? void 0 : (_this$mediaProperties16 = _this$mediaProperties15.pc) === null || _this$mediaProperties16 === void 0 ? void 0 : (_this$mediaProperties17 = _this$mediaProperties16.pc) === null || _this$mediaProperties17 === void 0 ? void 0 : _this$mediaProperties17.signalingState) || ((_this$mediaProperties18 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties18 === void 0 ? void 0 : (_this$mediaProperties19 = _this$mediaProperties18.mediaConnection) === null || _this$mediaProperties19 === void 0 ? void 0 : (_this$mediaProperties20 = _this$mediaProperties19.pc) === null || _this$mediaProperties20 === void 0 ? void 0 : _this$mediaProperties20.signalingState) || 'unknown',
8368
9199
  connectionState: ((_this$mediaProperties21 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties21 === void 0 ? void 0 : (_this$mediaProperties22 = _this$mediaProperties21.multistreamConnection) === null || _this$mediaProperties22 === void 0 ? void 0 : (_this$mediaProperties23 = _this$mediaProperties22.pc) === null || _this$mediaProperties23 === void 0 ? void 0 : (_this$mediaProperties24 = _this$mediaProperties23.pc) === null || _this$mediaProperties24 === void 0 ? void 0 : _this$mediaProperties24.connectionState) || ((_this$mediaProperties25 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties25 === void 0 ? void 0 : (_this$mediaProperties26 = _this$mediaProperties25.mediaConnection) === null || _this$mediaProperties26 === void 0 ? void 0 : (_this$mediaProperties27 = _this$mediaProperties26.pc) === null || _this$mediaProperties27 === void 0 ? void 0 : _this$mediaProperties27.connectionState) || 'unknown',
8369
- iceConnectionState: ((_this$mediaProperties28 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties28 === void 0 ? void 0 : (_this$mediaProperties29 = _this$mediaProperties28.multistreamConnection) === null || _this$mediaProperties29 === void 0 ? void 0 : (_this$mediaProperties30 = _this$mediaProperties29.pc) === null || _this$mediaProperties30 === void 0 ? void 0 : (_this$mediaProperties31 = _this$mediaProperties30.pc) === null || _this$mediaProperties31 === void 0 ? void 0 : _this$mediaProperties31.iceConnectionState) || ((_this$mediaProperties32 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties32 === void 0 ? void 0 : (_this$mediaProperties33 = _this$mediaProperties32.mediaConnection) === null || _this$mediaProperties33 === void 0 ? void 0 : (_this$mediaProperties34 = _this$mediaProperties33.pc) === null || _this$mediaProperties34 === void 0 ? void 0 : _this$mediaProperties34.iceConnectionState) || 'unknown'
9200
+ iceConnectionState: ((_this$mediaProperties28 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties28 === void 0 ? void 0 : (_this$mediaProperties29 = _this$mediaProperties28.multistreamConnection) === null || _this$mediaProperties29 === void 0 ? void 0 : (_this$mediaProperties30 = _this$mediaProperties29.pc) === null || _this$mediaProperties30 === void 0 ? void 0 : (_this$mediaProperties31 = _this$mediaProperties30.pc) === null || _this$mediaProperties31 === void 0 ? void 0 : _this$mediaProperties31.iceConnectionState) || ((_this$mediaProperties32 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties32 === void 0 ? void 0 : (_this$mediaProperties33 = _this$mediaProperties32.mediaConnection) === null || _this$mediaProperties33 === void 0 ? void 0 : (_this$mediaProperties34 = _this$mediaProperties33.pc) === null || _this$mediaProperties34 === void 0 ? void 0 : _this$mediaProperties34.iceConnectionState) || 'unknown',
9201
+ connectionType: _connectionType
8370
9202
  }, _reachabilityMetrics), _iceCandidateErrors), {}, {
8371
9203
  iceCandidatesCount: this.iceCandidatesCount,
8372
9204
  ipver: ipver
8373
9205
  }));
8374
- _context35.next = 19;
9206
+ _context38.next = 21;
8375
9207
  return this.cleanUpOnAddMediaFailure();
8376
- case 19:
9208
+ case 21:
8377
9209
  // Upload logs on error while adding media
8378
9210
  _triggerProxy.default.trigger(this, {
8379
9211
  file: 'meeting/index',
8380
9212
  function: 'addMedia'
8381
9213
  }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, this);
8382
- if (_t35 instanceof _internalMediaCore.Errors.SdpError) {
9214
+ if (_t37 instanceof _internalMediaCore.Errors.SdpError) {
8383
9215
  this.leave({
8384
9216
  reason: _constants.MEETING_REMOVED_REASON.MEETING_CONNECTION_FAILED
8385
9217
  });
8386
9218
  }
8387
- throw _t35;
8388
- case 20:
8389
- _context35.prev = 20;
9219
+ throw _t37;
9220
+ case 22:
9221
+ _context38.prev = 22;
8390
9222
  this.addMediaData.icePhaseCallback = DEFAULT_ICE_PHASE_CALLBACK;
8391
- return _context35.finish(20);
8392
- case 21:
9223
+ return _context38.finish(22);
9224
+ case 23:
8393
9225
  case "end":
8394
- return _context35.stop();
9226
+ return _context38.stop();
8395
9227
  }
8396
- }, _callee35, this, [[4, 16, 20, 21], [6, 8]]);
9228
+ }, _callee38, this, [[4, 16, 22, 23], [6, 8]]);
8397
9229
  }));
8398
- function addMediaInternal(_x30, _x31, _x32) {
9230
+ function addMediaInternal(_x34, _x35, _x36, _x37) {
8399
9231
  return _addMediaInternal.apply(this, arguments);
8400
9232
  }
8401
9233
  return addMediaInternal;
@@ -8425,7 +9257,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8425
9257
  * @memberof Meeting
8426
9258
  */
8427
9259
  function enqueueMediaUpdate(mediaUpdateType) {
8428
- var _this46 = this;
9260
+ var _this48 = this;
8429
9261
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8430
9262
  var canUpdateMediaNow = this.canUpdateMedia();
8431
9263
  return new _promise.default(function (resolve, reject) {
@@ -8436,9 +9268,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8436
9268
  options: options
8437
9269
  };
8438
9270
  _loggerProxy.default.logger.log("Meeting:index#enqueueMediaUpdate --> enqueuing media update type=".concat(mediaUpdateType));
8439
- _this46.queuedMediaUpdates.push(queueItem);
9271
+ _this48.queuedMediaUpdates.push(queueItem);
8440
9272
  if (canUpdateMediaNow) {
8441
- _this46.processNextQueuedMediaUpdate();
9273
+ _this48.processNextQueuedMediaUpdate();
8442
9274
  }
8443
9275
  });
8444
9276
  }
@@ -8461,35 +9293,35 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8461
9293
  * @memberof Meeting
8462
9294
  */
8463
9295
  function () {
8464
- var _updateMedia = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36(options) {
9296
+ var _updateMedia = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39(options) {
8465
9297
  var audioEnabled, videoEnabled, shareAudioEnabled, shareVideoEnabled, _this$audio3, _this$video3;
8466
- return _regenerator.default.wrap(function (_context36) {
8467
- while (1) switch (_context36.prev = _context36.next) {
9298
+ return _regenerator.default.wrap(function (_context39) {
9299
+ while (1) switch (_context39.prev = _context39.next) {
8468
9300
  case 0:
8469
9301
  this.checkMediaConnection();
8470
9302
  audioEnabled = options.audioEnabled, videoEnabled = options.videoEnabled, shareAudioEnabled = options.shareAudioEnabled, shareVideoEnabled = options.shareVideoEnabled;
8471
9303
  _loggerProxy.default.logger.log("Meeting:index#updateMedia --> called with options=".concat((0, _stringify.default)(options)));
8472
9304
  if (this.canUpdateMedia()) {
8473
- _context36.next = 1;
9305
+ _context39.next = 1;
8474
9306
  break;
8475
9307
  }
8476
- return _context36.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.UPDATE_MEDIA, options));
9308
+ return _context39.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.UPDATE_MEDIA, options));
8477
9309
  case 1:
8478
9310
  if (!this.isMultistream) {
8479
- _context36.next = 3;
9311
+ _context39.next = 3;
8480
9312
  break;
8481
9313
  }
8482
9314
  if (!(shareAudioEnabled !== undefined || shareVideoEnabled !== undefined)) {
8483
- _context36.next = 2;
9315
+ _context39.next = 2;
8484
9316
  break;
8485
9317
  }
8486
9318
  throw new Error('toggling shareAudioEnabled or shareVideoEnabled in a multistream meeting is not supported, to control receiving screen share call meeting.remoteMediaManager.setLayout() with appropriate layout');
8487
9319
  case 2:
8488
- _context36.next = 4;
9320
+ _context39.next = 4;
8489
9321
  break;
8490
9322
  case 3:
8491
9323
  if (!(shareAudioEnabled !== undefined)) {
8492
- _context36.next = 4;
9324
+ _context39.next = 4;
8493
9325
  break;
8494
9326
  }
8495
9327
  throw new Error('toggling shareAudioEnabled in a transcoded meeting is not supported as of now');
@@ -8514,20 +9346,20 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8514
9346
  this.mediaProperties.mediaDirection.receiveShare = !!(shareAudioEnabled || shareVideoEnabled);
8515
9347
  }
8516
9348
  if (this.isMultistream) {
8517
- _context36.next = 5;
9349
+ _context39.next = 5;
8518
9350
  break;
8519
9351
  }
8520
- _context36.next = 5;
9352
+ _context39.next = 5;
8521
9353
  return this.updateTranscodedMediaConnection();
8522
9354
  case 5:
8523
- return _context36.abrupt("return", undefined);
9355
+ return _context39.abrupt("return", undefined);
8524
9356
  case 6:
8525
9357
  case "end":
8526
- return _context36.stop();
9358
+ return _context39.stop();
8527
9359
  }
8528
- }, _callee36, this);
9360
+ }, _callee39, this);
8529
9361
  }));
8530
- function updateMedia(_x33) {
9362
+ function updateMedia(_x38) {
8531
9363
  return _updateMedia.apply(this, arguments);
8532
9364
  }
8533
9365
  return updateMedia;
@@ -8543,7 +9375,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8543
9375
  }, {
8544
9376
  key: "acknowledge",
8545
9377
  value: function acknowledge(type) {
8546
- var _this47 = this;
9378
+ var _this49 = this;
8547
9379
  if (!type) {
8548
9380
  return _promise.default.reject(new _parameter.default('Type must be set to acknowledge the meeting.'));
8549
9381
  }
@@ -8555,12 +9387,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8555
9387
  }).then(function (response) {
8556
9388
  return _promise.default.resolve(response);
8557
9389
  }).then(function (response) {
8558
- _this47.meetingFiniteStateMachine.ring(type);
9390
+ _this49.meetingFiniteStateMachine.ring(type);
8559
9391
  // @ts-ignore
8560
- _this47.webex.internal.newMetrics.submitClientEvent({
9392
+ _this49.webex.internal.newMetrics.submitClientEvent({
8561
9393
  name: 'client.alert.displayed',
8562
9394
  options: {
8563
- meetingId: _this47.id
9395
+ meetingId: _this49.id
8564
9396
  }
8565
9397
  });
8566
9398
  return _promise.default.resolve({
@@ -8585,12 +9417,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8585
9417
  }, {
8586
9418
  key: "decline",
8587
9419
  value: function decline(reason) {
8588
- var _this48 = this;
9420
+ var _this50 = this;
8589
9421
  return _util2.default.declineMeeting(this, reason).then(function (decline) {
8590
- _this48.meetingFiniteStateMachine.decline();
9422
+ _this50.meetingFiniteStateMachine.decline();
8591
9423
  return _promise.default.resolve(decline);
8592
9424
  }).catch(function (error) {
8593
- _this48.meetingFiniteStateMachine.fail(error);
9425
+ _this50.meetingFiniteStateMachine.fail(error);
8594
9426
  return _promise.default.reject(error);
8595
9427
  });
8596
9428
  }
@@ -8641,7 +9473,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8641
9473
  }, {
8642
9474
  key: "leave",
8643
9475
  value: function leave() {
8644
- var _this49 = this;
9476
+ var _this51 = this;
8645
9477
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8646
9478
  var leaveReason = options.reason || _constants.MEETING_REMOVED_REASON.CLIENT_LEAVE_REQUEST;
8647
9479
 
@@ -8653,7 +9485,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8653
9485
  var payload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8654
9486
  return (
8655
9487
  // @ts-ignore
8656
- _this49.webex.internal.newMetrics.submitClientEvent({
9488
+ _this51.webex.internal.newMetrics.submitClientEvent({
8657
9489
  name: 'client.call.leave',
8658
9490
  payload: _objectSpread({
8659
9491
  trigger: 'user-interaction',
@@ -8661,50 +9493,51 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8661
9493
  leaveReason: options.clientEventLeaveReason
8662
9494
  }, payload),
8663
9495
  options: {
8664
- meetingId: _this49.id
9496
+ meetingId: _this51.id
8665
9497
  }
8666
9498
  })
8667
9499
  );
8668
9500
  };
8669
9501
  _loggerProxy.default.logger.log('Meeting:index#leave --> Leaving a meeting');
9502
+ this.stopListeningForMeetingEvents();
8670
9503
  return _util2.default.leaveMeeting(this, options).then(/*#__PURE__*/function () {
8671
- var _ref41 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37(leave) {
8672
- return _regenerator.default.wrap(function (_context37) {
8673
- while (1) switch (_context37.prev = _context37.next) {
9504
+ var _ref46 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40(leave) {
9505
+ return _regenerator.default.wrap(function (_context40) {
9506
+ while (1) switch (_context40.prev = _context40.next) {
8674
9507
  case 0:
8675
9508
  // CA team recommends submitting this *after* locus /leave
8676
9509
  submitLeaveMetric();
8677
- _this49.meetingFiniteStateMachine.leave();
8678
- _context37.next = 1;
8679
- return _this49.clearMeetingData();
9510
+ _this51.meetingFiniteStateMachine.leave();
9511
+ _context40.next = 1;
9512
+ return _this51.clearMeetingData();
8680
9513
  case 1:
8681
9514
  // upload logs on leave irrespective of meeting delete
8682
- _triggerProxy.default.trigger(_this49, {
9515
+ _triggerProxy.default.trigger(_this51, {
8683
9516
  file: 'meeting/index',
8684
9517
  function: 'leave'
8685
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this49);
9518
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this51);
8686
9519
 
8687
9520
  // TODO: more testing before we remove this code, we are not sure the scenarios for destroy here
8688
- if (_this49.wirelessShare || _this49.guest) {
9521
+ if (_this51.wirelessShare || _this51.guest) {
8689
9522
  // If screen sharing clean the meeting object
8690
- _triggerProxy.default.trigger(_this49, {
9523
+ _triggerProxy.default.trigger(_this51, {
8691
9524
  file: 'meeting/index',
8692
9525
  function: 'leave'
8693
9526
  }, _constants.EVENTS.DESTROY_MEETING, {
8694
9527
  reason: options.reason,
8695
- meetingId: _this49.id
9528
+ meetingId: _this51.id
8696
9529
  });
8697
9530
  }
8698
9531
  _loggerProxy.default.logger.log('Meeting:index#leave --> LEAVE REASON ', leaveReason);
8699
- return _context37.abrupt("return", leave);
9532
+ return _context40.abrupt("return", leave);
8700
9533
  case 2:
8701
9534
  case "end":
8702
- return _context37.stop();
9535
+ return _context40.stop();
8703
9536
  }
8704
- }, _callee37);
9537
+ }, _callee40);
8705
9538
  }));
8706
- return function (_x34) {
8707
- return _ref41.apply(this, arguments);
9539
+ return function (_x39) {
9540
+ return _ref46.apply(this, arguments);
8708
9541
  };
8709
9542
  }()).catch(function (error) {
8710
9543
  // CA team recommends submitting this *after* locus /leave
@@ -8718,16 +9551,16 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8718
9551
  shownToUser: false
8719
9552
  }]
8720
9553
  });
8721
- _this49.meetingFiniteStateMachine.fail(error);
9554
+ _this51.meetingFiniteStateMachine.fail(error);
8722
9555
  _loggerProxy.default.logger.error('Meeting:index#leave --> Failed to leave ', error);
8723
9556
  // upload logs on leave irrespective of meeting delete
8724
- _triggerProxy.default.trigger(_this49, {
9557
+ _triggerProxy.default.trigger(_this51, {
8725
9558
  file: 'meeting/index',
8726
9559
  function: 'leave'
8727
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this49);
9560
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this51);
8728
9561
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_LEAVE_FAILURE, {
8729
- correlation_id: _this49.correlationId,
8730
- locus_id: _this49.locusUrl.split('/').pop(),
9562
+ correlation_id: _this51.correlationId,
9563
+ locus_id: _this51.locusUrl.split('/').pop(),
8731
9564
  reason: error.message,
8732
9565
  stack: error.stack,
8733
9566
  code: error.code
@@ -8747,7 +9580,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8747
9580
  }, {
8748
9581
  key: "startWhiteboardShare",
8749
9582
  value: function startWhiteboardShare(channelUrl, resourceToken) {
8750
- var _this50 = this;
9583
+ var _this52 = this;
8751
9584
  var whiteboard = this.locusInfo.mediaShares.find(function (element) {
8752
9585
  return element.name === 'whiteboard';
8753
9586
  });
@@ -8780,13 +9613,13 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8780
9613
  body.resourceToken = resourceToken;
8781
9614
  }
8782
9615
  return this.meetingRequest.changeMeetingFloor(body).then(function () {
8783
- _this50.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
9616
+ _this52.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
8784
9617
  return _promise.default.resolve();
8785
9618
  }).catch(function (error) {
8786
9619
  _loggerProxy.default.logger.error('Meeting:index#startWhiteboardShare --> Error ', error);
8787
9620
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_START_WHITEBOARD_SHARE_FAILURE, {
8788
- correlation_id: _this50.correlationId,
8789
- locus_id: _this50.locusUrl.split('/').pop(),
9621
+ correlation_id: _this52.correlationId,
9622
+ locus_id: _this52.locusUrl.split('/').pop(),
8790
9623
  reason: error.message,
8791
9624
  stack: error.stack,
8792
9625
  board: {
@@ -8809,7 +9642,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8809
9642
  }, {
8810
9643
  key: "stopWhiteboardShare",
8811
9644
  value: function stopWhiteboardShare(channelUrl) {
8812
- var _this51 = this;
9645
+ var _this53 = this;
8813
9646
  var whiteboard = this.locusInfo.mediaShares.find(function (element) {
8814
9647
  return element.name === 'whiteboard';
8815
9648
  });
@@ -8838,8 +9671,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8838
9671
  }).catch(function (error) {
8839
9672
  _loggerProxy.default.logger.error('Meeting:index#stopWhiteboardShare --> Error ', error);
8840
9673
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_STOP_WHITEBOARD_SHARE_FAILURE, {
8841
- correlation_id: _this51.correlationId,
8842
- locus_id: _this51.locusUrl.split('/').pop(),
9674
+ correlation_id: _this53.correlationId,
9675
+ locus_id: _this53.locusUrl.split('/').pop(),
8843
9676
  reason: error.message,
8844
9677
  stack: error.stack,
8845
9678
  board: {
@@ -8861,7 +9694,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8861
9694
  }, {
8862
9695
  key: "requestScreenShareFloor",
8863
9696
  value: function requestScreenShareFloor() {
8864
- var _this52 = this;
9697
+ var _this54 = this;
8865
9698
  if (!this.mediaProperties.hasLocalShareStream() || !this.mediaProperties.mediaDirection.sendShare) {
8866
9699
  _loggerProxy.default.logger.log("Meeting:index#requestScreenShareFloor --> NOT requesting floor, because we don't have the share stream anymore (shareStream=".concat(this.mediaProperties.shareVideoStream ? 'yes' : 'no', ", sendShare=").concat(this.mediaProperties.mediaDirection.sendShare, ")"));
8867
9700
  this.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
@@ -8892,34 +9725,34 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8892
9725
  resourceUrl: this.resourceUrl,
8893
9726
  shareInstanceId: this.localShareInstanceId
8894
9727
  }).then(function () {
8895
- _this52.screenShareFloorState = ScreenShareFloorStatus.GRANTED;
9728
+ _this54.screenShareFloorState = ScreenShareFloorStatus.GRANTED;
8896
9729
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_SHARE_SUCCESS, {
8897
- correlation_id: _this52.correlationId,
8898
- locus_id: _this52.locusUrl.split('/').pop()
9730
+ correlation_id: _this54.correlationId,
9731
+ locus_id: _this54.locusUrl.split('/').pop()
8899
9732
  });
8900
9733
  return _promise.default.resolve();
8901
9734
  }).catch(function (error) {
8902
9735
  _loggerProxy.default.logger.error('Meeting:index#share --> Error ', error);
8903
9736
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_SHARE_FAILURE, {
8904
- correlation_id: _this52.correlationId,
8905
- locus_id: _this52.locusUrl.split('/').pop(),
9737
+ correlation_id: _this54.correlationId,
9738
+ locus_id: _this54.locusUrl.split('/').pop(),
8906
9739
  reason: error.message,
8907
9740
  stack: error.stack
8908
9741
  });
8909
9742
 
8910
9743
  // @ts-ignore
8911
- _this52.webex.internal.newMetrics.submitClientEvent({
9744
+ _this54.webex.internal.newMetrics.submitClientEvent({
8912
9745
  name: 'client.share.floor-granted.local',
8913
9746
  payload: {
8914
9747
  mediaType: 'share',
8915
9748
  errors: _util2.default.getChangeMeetingFloorErrorPayload(error.message),
8916
- shareInstanceId: _this52.localShareInstanceId
9749
+ shareInstanceId: _this54.localShareInstanceId
8917
9750
  },
8918
9751
  options: {
8919
- meetingId: _this52.id
9752
+ meetingId: _this54.id
8920
9753
  }
8921
9754
  });
8922
- _this52.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
9755
+ _this54.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
8923
9756
  return _promise.default.reject(error);
8924
9757
  });
8925
9758
  }
@@ -8942,10 +9775,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8942
9775
  }, {
8943
9776
  key: "requestScreenShareFloorIfPending",
8944
9777
  value: function requestScreenShareFloorIfPending() {
8945
- var _this53 = this;
9778
+ var _this55 = this;
8946
9779
  if (this.floorGrantPending && this.state === _constants.MEETING_STATE.STATES.JOINED) {
8947
9780
  this.requestScreenShareFloor().then(function () {
8948
- _this53.floorGrantPending = false;
9781
+ _this55.floorGrantPending = false;
8949
9782
  });
8950
9783
  }
8951
9784
  }
@@ -8959,7 +9792,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8959
9792
  }, {
8960
9793
  key: "releaseScreenShareFloor",
8961
9794
  value: function releaseScreenShareFloor() {
8962
- var _this54 = this;
9795
+ var _this56 = this;
8963
9796
  var content = this.locusInfo.mediaShares.find(function (element) {
8964
9797
  return element.name === _constants.CONTENT;
8965
9798
  });
@@ -9000,8 +9833,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9000
9833
  }).catch(function (error) {
9001
9834
  _loggerProxy.default.logger.error('Meeting:index#releaseScreenShareFloor --> Error ', error);
9002
9835
  _metrics.default.sendBehavioralMetric(_constants2.default.STOP_FLOOR_REQUEST_FAILURE, {
9003
- correlation_id: _this54.correlationId,
9004
- locus_id: _this54.locusUrl.split('/').pop(),
9836
+ correlation_id: _this56.correlationId,
9837
+ locus_id: _this56.locusUrl.split('/').pop(),
9005
9838
  reason: error.message,
9006
9839
  stack: error.stack
9007
9840
  });
@@ -9181,7 +10014,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9181
10014
  }, {
9182
10015
  key: "changeVideoLayout",
9183
10016
  value: function changeVideoLayout(layoutType) {
9184
- var _this55 = this;
10017
+ var _this57 = this;
9185
10018
  var renderInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9186
10019
  var main = renderInfo.main,
9187
10020
  content = renderInfo.content;
@@ -9235,7 +10068,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9235
10068
  }
9236
10069
  this.lastVideoLayoutInfo = (0, _lodash.cloneDeep)(layoutInfo);
9237
10070
  this.locusInfo.once(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_LAYOUT_UPDATED, function (envelope) {
9238
- _triggerProxy.default.trigger(_this55, {
10071
+ _triggerProxy.default.trigger(_this57, {
9239
10072
  file: 'meeting/index',
9240
10073
  function: 'changeVideoLayout'
9241
10074
  }, _constants.EVENT_TRIGGERS.MEETING_CONTROLS_LAYOUT_UPDATE, {
@@ -9351,7 +10184,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9351
10184
  }, {
9352
10185
  key: "endMeetingForAll",
9353
10186
  value: function endMeetingForAll() {
9354
- var _this56 = this;
10187
+ var _this58 = this;
9355
10188
  // @ts-ignore
9356
10189
  this.webex.internal.newMetrics.submitClientEvent({
9357
10190
  name: 'client.call.leave',
@@ -9368,41 +10201,42 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9368
10201
  correlation_id: this.correlationId,
9369
10202
  locus_id: this.locusId
9370
10203
  });
10204
+ this.stopListeningForMeetingEvents();
9371
10205
  return _util2.default.endMeetingForAll(this).then(/*#__PURE__*/function () {
9372
- var _ref42 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38(end) {
9373
- return _regenerator.default.wrap(function (_context38) {
9374
- while (1) switch (_context38.prev = _context38.next) {
10206
+ var _ref47 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41(end) {
10207
+ return _regenerator.default.wrap(function (_context41) {
10208
+ while (1) switch (_context41.prev = _context41.next) {
9375
10209
  case 0:
9376
- _this56.meetingFiniteStateMachine.end();
9377
- _context38.next = 1;
9378
- return _this56.clearMeetingData();
10210
+ _this58.meetingFiniteStateMachine.end();
10211
+ _context41.next = 1;
10212
+ return _this58.clearMeetingData();
9379
10213
  case 1:
9380
10214
  // upload logs on leave irrespective of meeting delete
9381
- _triggerProxy.default.trigger(_this56, {
10215
+ _triggerProxy.default.trigger(_this58, {
9382
10216
  file: 'meeting/index',
9383
10217
  function: 'endMeetingForAll'
9384
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this56);
9385
- return _context38.abrupt("return", end);
10218
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this58);
10219
+ return _context41.abrupt("return", end);
9386
10220
  case 2:
9387
10221
  case "end":
9388
- return _context38.stop();
10222
+ return _context41.stop();
9389
10223
  }
9390
- }, _callee38);
10224
+ }, _callee41);
9391
10225
  }));
9392
- return function (_x35) {
9393
- return _ref42.apply(this, arguments);
10226
+ return function (_x40) {
10227
+ return _ref47.apply(this, arguments);
9394
10228
  };
9395
10229
  }()).catch(function (error) {
9396
- _this56.meetingFiniteStateMachine.fail(error);
10230
+ _this58.meetingFiniteStateMachine.fail(error);
9397
10231
  _loggerProxy.default.logger.error('Meeting:index#endMeetingForAll --> Failed to end meeting ', error);
9398
10232
  // upload logs on leave irrespective of meeting delete
9399
- _triggerProxy.default.trigger(_this56, {
10233
+ _triggerProxy.default.trigger(_this58, {
9400
10234
  file: 'meeting/index',
9401
10235
  function: 'endMeetingForAll'
9402
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this56);
10236
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this58);
9403
10237
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_END_ALL_FAILURE, {
9404
- correlation_id: _this56.correlationId,
9405
- locus_id: _this56.locusUrl.split('/').pop(),
10238
+ correlation_id: _this58.correlationId,
10239
+ locus_id: _this58.locusUrl.split('/').pop(),
9406
10240
  reason: error.message,
9407
10241
  stack: error.stack,
9408
10242
  code: error.code
@@ -9423,13 +10257,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9423
10257
  * @memberof Meeting
9424
10258
  */
9425
10259
  function sendReaction(reactionType, skinToneType) {
9426
- var _this$locusInfo7, _this$locusInfo7$cont, _this$locusInfo7$cont2;
9427
- var reactionChannelUrl = (_this$locusInfo7 = this.locusInfo) === null || _this$locusInfo7 === void 0 ? void 0 : (_this$locusInfo7$cont = _this$locusInfo7.controls) === null || _this$locusInfo7$cont === void 0 ? void 0 : (_this$locusInfo7$cont2 = _this$locusInfo7$cont.reactions) === null || _this$locusInfo7$cont2 === void 0 ? void 0 : _this$locusInfo7$cont2.reactionChannelUrl;
10260
+ var _this$locusInfo9, _this$locusInfo9$cont, _this$locusInfo9$cont2;
10261
+ var reactionChannelUrl = (_this$locusInfo9 = this.locusInfo) === null || _this$locusInfo9 === void 0 ? void 0 : (_this$locusInfo9$cont = _this$locusInfo9.controls) === null || _this$locusInfo9$cont === void 0 ? void 0 : (_this$locusInfo9$cont2 = _this$locusInfo9$cont.reactions) === null || _this$locusInfo9$cont2 === void 0 ? void 0 : _this$locusInfo9$cont2.reactionChannelUrl;
9428
10262
  var participantId = this.members.selfId;
9429
- var reactionData = _reactions.Reactions[reactionType];
9430
- if (!reactionData) {
9431
- return _promise.default.reject(new Error("".concat(reactionType, " is not a valid reaction.")));
9432
- }
10263
+ var reactionData = _reactions.Reactions[reactionType] || {
10264
+ type: reactionType
10265
+ };
9433
10266
  var skinToneData = _reactions.SkinTones[skinToneType] || _reactions.SkinTones.normal;
9434
10267
  var reaction = _objectSpread(_objectSpread({}, reactionData), {}, {
9435
10268
  tone: skinToneData
@@ -9454,12 +10287,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9454
10287
  */
9455
10288
  }, {
9456
10289
  key: "extendMeeting",
9457
- value: function extendMeeting(_ref43) {
9458
- var meetingPolicyUrl = _ref43.meetingPolicyUrl,
9459
- meetingInstanceId = _ref43.meetingInstanceId,
9460
- participantId = _ref43.participantId,
9461
- _ref43$extensionMinut = _ref43.extensionMinutes,
9462
- extensionMinutes = _ref43$extensionMinut === void 0 ? 30 : _ref43$extensionMinut;
10290
+ value: function extendMeeting(_ref48) {
10291
+ var meetingPolicyUrl = _ref48.meetingPolicyUrl,
10292
+ meetingInstanceId = _ref48.meetingInstanceId,
10293
+ participantId = _ref48.participantId,
10294
+ _ref48$extensionMinut = _ref48.extensionMinutes,
10295
+ extensionMinutes = _ref48$extensionMinut === void 0 ? 30 : _ref48$extensionMinut;
9463
10296
  if (!meetingInstanceId || !participantId) {
9464
10297
  return _promise.default.reject(new Error('Missing meetingInstanceId or participantId'));
9465
10298
  }
@@ -9485,8 +10318,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9485
10318
  }, {
9486
10319
  key: "toggleReactions",
9487
10320
  value: function toggleReactions(enable) {
9488
- var _this$locusInfo8, _this$locusInfo8$cont, _this$locusInfo8$cont2;
9489
- var isEnabled = (_this$locusInfo8 = this.locusInfo) === null || _this$locusInfo8 === void 0 ? void 0 : (_this$locusInfo8$cont = _this$locusInfo8.controls) === null || _this$locusInfo8$cont === void 0 ? void 0 : (_this$locusInfo8$cont2 = _this$locusInfo8$cont.reactions) === null || _this$locusInfo8$cont2 === void 0 ? void 0 : _this$locusInfo8$cont2.enabled;
10321
+ var _this$locusInfo0, _this$locusInfo0$cont, _this$locusInfo0$cont2;
10322
+ var isEnabled = (_this$locusInfo0 = this.locusInfo) === null || _this$locusInfo0 === void 0 ? void 0 : (_this$locusInfo0$cont = _this$locusInfo0.controls) === null || _this$locusInfo0$cont === void 0 ? void 0 : (_this$locusInfo0$cont2 = _this$locusInfo0$cont.reactions) === null || _this$locusInfo0$cont2 === void 0 ? void 0 : _this$locusInfo0$cont2.enabled;
9490
10323
  if (isEnabled && enable || !isEnabled && !enable) {
9491
10324
  return _promise.default.resolve("Reactions are already ".concat(isEnabled ? 'enabled' : 'disabled', "."));
9492
10325
  }
@@ -9540,39 +10373,39 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9540
10373
  }, {
9541
10374
  key: "enableMusicMode",
9542
10375
  value: (function () {
9543
- var _enableMusicMode = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39(shouldEnableMusicMode) {
9544
- return _regenerator.default.wrap(function (_context39) {
9545
- while (1) switch (_context39.prev = _context39.next) {
10376
+ var _enableMusicMode = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42(shouldEnableMusicMode) {
10377
+ return _regenerator.default.wrap(function (_context42) {
10378
+ while (1) switch (_context42.prev = _context42.next) {
9546
10379
  case 0:
9547
10380
  this.checkMediaConnection();
9548
10381
  if (this.isMultistream) {
9549
- _context39.next = 1;
10382
+ _context42.next = 1;
9550
10383
  break;
9551
10384
  }
9552
10385
  throw new Error('enableMusicMode() only supported with multistream');
9553
10386
  case 1:
9554
10387
  if (!shouldEnableMusicMode) {
9555
- _context39.next = 3;
10388
+ _context42.next = 3;
9556
10389
  break;
9557
10390
  }
9558
- _context39.next = 2;
10391
+ _context42.next = 2;
9559
10392
  return this.sendSlotManager.setCustomCodecParameters(_internalMediaCore.MediaType.AudioMain, _internalMediaCore.MediaCodecMimeType.OPUS, {
9560
10393
  maxaveragebitrate: '64000',
9561
10394
  maxplaybackrate: '48000'
9562
10395
  });
9563
10396
  case 2:
9564
- _context39.next = 4;
10397
+ _context42.next = 4;
9565
10398
  break;
9566
10399
  case 3:
9567
- _context39.next = 4;
10400
+ _context42.next = 4;
9568
10401
  return this.sendSlotManager.markCustomCodecParametersForDeletion(_internalMediaCore.MediaType.AudioMain, _internalMediaCore.MediaCodecMimeType.OPUS, ['maxaveragebitrate', 'maxplaybackrate']);
9569
10402
  case 4:
9570
10403
  case "end":
9571
- return _context39.stop();
10404
+ return _context42.stop();
9572
10405
  }
9573
- }, _callee39, this);
10406
+ }, _callee42, this);
9574
10407
  }));
9575
- function enableMusicMode(_x36) {
10408
+ function enableMusicMode(_x41) {
9576
10409
  return _enableMusicMode.apply(this, arguments);
9577
10410
  }
9578
10411
  return enableMusicMode;
@@ -9593,7 +10426,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9593
10426
  _this$mediaProperties42,
9594
10427
  _this$mediaProperties43,
9595
10428
  _this$mediaProperties44,
9596
- _this57 = this;
10429
+ _this59 = this;
9597
10430
  var LOG_HEADER = 'Meeting:index#updateTranscodedMediaConnection -->';
9598
10431
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " starting"));
9599
10432
  if (!this.canUpdateMedia()) {
@@ -9618,8 +10451,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9618
10451
  }).catch(function (error) {
9619
10452
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error: "), error);
9620
10453
  _metrics.default.sendBehavioralMetric(_constants2.default.UPDATE_MEDIA_FAILURE, {
9621
- correlation_id: _this57.correlationId,
9622
- locus_id: _this57.locusUrl.split('/').pop(),
10454
+ correlation_id: _this59.correlationId,
10455
+ locus_id: _this59.locusUrl.split('/').pop(),
9623
10456
  reason: error.message,
9624
10457
  stack: error.stack
9625
10458
  });
@@ -9663,25 +10496,25 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9663
10496
  }, {
9664
10497
  key: "publishStream",
9665
10498
  value: (function () {
9666
- var _publishStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40(mediaType, stream) {
9667
- return _regenerator.default.wrap(function (_context40) {
9668
- while (1) switch (_context40.prev = _context40.next) {
10499
+ var _publishStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43(mediaType, stream) {
10500
+ return _regenerator.default.wrap(function (_context43) {
10501
+ while (1) switch (_context43.prev = _context43.next) {
9669
10502
  case 0:
9670
10503
  if (stream) {
9671
- _context40.next = 1;
10504
+ _context43.next = 1;
9672
10505
  break;
9673
10506
  }
9674
- return _context40.abrupt("return");
10507
+ return _context43.abrupt("return");
9675
10508
  case 1:
9676
10509
  if (!this.mediaProperties.webrtcMediaConnection) {
9677
- _context40.next = 3;
10510
+ _context43.next = 3;
9678
10511
  break;
9679
10512
  }
9680
10513
  if (!(this.isMultistream && this.mediaProperties.webrtcMediaConnection)) {
9681
- _context40.next = 2;
10514
+ _context43.next = 2;
9682
10515
  break;
9683
10516
  }
9684
- _context40.next = 2;
10517
+ _context43.next = 2;
9685
10518
  return this.sendSlotManager.publishStream(mediaType, stream);
9686
10519
  case 2:
9687
10520
  this.emitPublishStateChangeEvent({
@@ -9692,11 +10525,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9692
10525
  });
9693
10526
  case 3:
9694
10527
  case "end":
9695
- return _context40.stop();
10528
+ return _context43.stop();
9696
10529
  }
9697
- }, _callee40, this);
10530
+ }, _callee43, this);
9698
10531
  }));
9699
- function publishStream(_x37, _x38) {
10532
+ function publishStream(_x42, _x43) {
9700
10533
  return _publishStream.apply(this, arguments);
9701
10534
  }
9702
10535
  return publishStream;
@@ -9712,21 +10545,21 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9712
10545
  }, {
9713
10546
  key: "unpublishStream",
9714
10547
  value: (function () {
9715
- var _unpublishStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41(mediaType, stream) {
9716
- return _regenerator.default.wrap(function (_context41) {
9717
- while (1) switch (_context41.prev = _context41.next) {
10548
+ var _unpublishStream = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44(mediaType, stream) {
10549
+ return _regenerator.default.wrap(function (_context44) {
10550
+ while (1) switch (_context44.prev = _context44.next) {
9718
10551
  case 0:
9719
10552
  if (stream) {
9720
- _context41.next = 1;
10553
+ _context44.next = 1;
9721
10554
  break;
9722
10555
  }
9723
- return _context41.abrupt("return");
10556
+ return _context44.abrupt("return");
9724
10557
  case 1:
9725
10558
  if (!(this.isMultistream && this.mediaProperties.webrtcMediaConnection)) {
9726
- _context41.next = 2;
10559
+ _context44.next = 2;
9727
10560
  break;
9728
10561
  }
9729
- _context41.next = 2;
10562
+ _context44.next = 2;
9730
10563
  return this.sendSlotManager.unpublishStream(mediaType);
9731
10564
  case 2:
9732
10565
  this.emitPublishStateChangeEvent({
@@ -9737,11 +10570,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9737
10570
  });
9738
10571
  case 3:
9739
10572
  case "end":
9740
- return _context41.stop();
10573
+ return _context44.stop();
9741
10574
  }
9742
- }, _callee41, this);
10575
+ }, _callee44, this);
9743
10576
  }));
9744
- function unpublishStream(_x39, _x40) {
10577
+ function unpublishStream(_x44, _x45) {
9745
10578
  return _unpublishStream.apply(this, arguments);
9746
10579
  }
9747
10580
  return unpublishStream;
@@ -9756,19 +10589,19 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9756
10589
  }, {
9757
10590
  key: "publishStreams",
9758
10591
  value: (function () {
9759
- var _publishStreams = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42(streams) {
10592
+ var _publishStreams = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45(streams) {
9760
10593
  var _streams$screenShare, _streams$screenShare2, _streams$screenShare3, _streams$screenShare4, _streams$screenShare5, _streams$screenShare6;
9761
10594
  var streamChecks, _i, _streamChecks, _streamChecks$_i, stream, name, floorRequestNeeded, _streams$screenShare7;
9762
- return _regenerator.default.wrap(function (_context42) {
9763
- while (1) switch (_context42.prev = _context42.next) {
10595
+ return _regenerator.default.wrap(function (_context45) {
10596
+ while (1) switch (_context45.prev = _context45.next) {
9764
10597
  case 0:
9765
10598
  _loggerProxy.default.logger.info("Meeting:index#publishStreams --> called with: ".concat((0, _stringify.default)(streams)));
9766
10599
  this.checkMediaConnection();
9767
10600
  if (!(!streams.microphone && !streams.camera && !((_streams$screenShare = streams.screenShare) !== null && _streams$screenShare !== void 0 && _streams$screenShare.audio) && !((_streams$screenShare2 = streams.screenShare) !== null && _streams$screenShare2 !== void 0 && _streams$screenShare2.video))) {
9768
- _context42.next = 1;
10601
+ _context45.next = 1;
9769
10602
  break;
9770
10603
  }
9771
- return _context42.abrupt("return");
10604
+ return _context45.abrupt("return");
9772
10605
  case 1:
9773
10606
  streamChecks = [{
9774
10607
  stream: streams === null || streams === void 0 ? void 0 : streams.microphone,
@@ -9786,62 +10619,62 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9786
10619
  _i = 0, _streamChecks = streamChecks;
9787
10620
  case 2:
9788
10621
  if (!(_i < _streamChecks.length)) {
9789
- _context42.next = 4;
10622
+ _context45.next = 4;
9790
10623
  break;
9791
10624
  }
9792
10625
  _streamChecks$_i = _streamChecks[_i], stream = _streamChecks$_i.stream, name = _streamChecks$_i.name;
9793
10626
  if (!((stream === null || stream === void 0 ? void 0 : stream.readyState) === 'ended')) {
9794
- _context42.next = 3;
10627
+ _context45.next = 3;
9795
10628
  break;
9796
10629
  }
9797
10630
  throw new Error("Attempted to publish ".concat(name, " stream with ended readyState, correlationId=").concat(this.correlationId));
9798
10631
  case 3:
9799
10632
  _i++;
9800
- _context42.next = 2;
10633
+ _context45.next = 2;
9801
10634
  break;
9802
10635
  case 4:
9803
10636
  floorRequestNeeded = false; // Screenshare Audio is supported only in multi stream. So we check for screenshare audio presence only if it's a multi stream meeting
9804
10637
  if (!(this.isMultistream && (_streams$screenShare5 = streams.screenShare) !== null && _streams$screenShare5 !== void 0 && _streams$screenShare5.audio)) {
9805
- _context42.next = 6;
10638
+ _context45.next = 6;
9806
10639
  break;
9807
10640
  }
9808
- _context42.next = 5;
10641
+ _context45.next = 5;
9809
10642
  return this.setLocalShareAudioStream(streams.screenShare.audio);
9810
10643
  case 5:
9811
10644
  floorRequestNeeded = this.screenShareFloorState === ScreenShareFloorStatus.RELEASED;
9812
10645
  case 6:
9813
10646
  if (!((_streams$screenShare6 = streams.screenShare) !== null && _streams$screenShare6 !== void 0 && _streams$screenShare6.video)) {
9814
- _context42.next = 8;
10647
+ _context45.next = 8;
9815
10648
  break;
9816
10649
  }
9817
- _context42.next = 7;
10650
+ _context45.next = 7;
9818
10651
  return this.setLocalShareVideoStream((_streams$screenShare7 = streams.screenShare) === null || _streams$screenShare7 === void 0 ? void 0 : _streams$screenShare7.video);
9819
10652
  case 7:
9820
10653
  floorRequestNeeded = this.screenShareFloorState === ScreenShareFloorStatus.RELEASED;
9821
10654
  case 8:
9822
10655
  if (!streams.microphone) {
9823
- _context42.next = 9;
10656
+ _context45.next = 9;
9824
10657
  break;
9825
10658
  }
9826
- _context42.next = 9;
10659
+ _context45.next = 9;
9827
10660
  return this.setLocalAudioStream(streams.microphone);
9828
10661
  case 9:
9829
10662
  if (!streams.camera) {
9830
- _context42.next = 10;
10663
+ _context45.next = 10;
9831
10664
  break;
9832
10665
  }
9833
- _context42.next = 10;
10666
+ _context45.next = 10;
9834
10667
  return this.setLocalVideoStream(streams.camera);
9835
10668
  case 10:
9836
10669
  if (this.isMultistream) {
9837
- _context42.next = 11;
10670
+ _context45.next = 11;
9838
10671
  break;
9839
10672
  }
9840
- _context42.next = 11;
10673
+ _context45.next = 11;
9841
10674
  return this.updateTranscodedMediaConnection();
9842
10675
  case 11:
9843
10676
  if (!floorRequestNeeded) {
9844
- _context42.next = 12;
10677
+ _context45.next = 12;
9845
10678
  break;
9846
10679
  }
9847
10680
  this.localShareInstanceId = _uuid.default.v4();
@@ -9872,15 +10705,15 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9872
10705
  // we're sending the http request to Locus to request the screen share floor
9873
10706
  // only after the SDP update, because that's how it's always been done for transcoded meetings
9874
10707
  // and also if sharing from the start, we need confluence to have been created
9875
- _context42.next = 12;
10708
+ _context45.next = 12;
9876
10709
  return this.enqueueScreenShareFloorRequest();
9877
10710
  case 12:
9878
10711
  case "end":
9879
- return _context42.stop();
10712
+ return _context45.stop();
9880
10713
  }
9881
- }, _callee42, this);
10714
+ }, _callee45, this);
9882
10715
  }));
9883
- function publishStreams(_x41) {
10716
+ function publishStreams(_x46) {
9884
10717
  return _publishStreams.apply(this, arguments);
9885
10718
  }
9886
10719
  return publishStreams;
@@ -9895,20 +10728,20 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9895
10728
  }, {
9896
10729
  key: "unpublishStreams",
9897
10730
  value: (function () {
9898
- var _unpublishStreams = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43(streams) {
9899
- var promises, _iterator, _step, stream;
9900
- return _regenerator.default.wrap(function (_context43) {
9901
- while (1) switch (_context43.prev = _context43.next) {
10731
+ var _unpublishStreams = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46(streams) {
10732
+ var promises, _iterator2, _step2, stream;
10733
+ return _regenerator.default.wrap(function (_context46) {
10734
+ while (1) switch (_context46.prev = _context46.next) {
9902
10735
  case 0:
9903
10736
  _loggerProxy.default.logger.info("Meeting:index#unpublishStreams --> called with: ".concat((0, _stringify.default)(streams)));
9904
10737
  this.checkMediaConnection();
9905
10738
  promises = [];
9906
- _iterator = _createForOfIteratorHelper(streams.filter(function (t) {
10739
+ _iterator2 = _createForOfIteratorHelper(streams.filter(function (t) {
9907
10740
  return !!t;
9908
10741
  }));
9909
10742
  try {
9910
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
9911
- stream = _step.value;
10743
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
10744
+ stream = _step2.value;
9912
10745
  if (stream === this.mediaProperties.shareAudioStream) {
9913
10746
  promises.push(this.setLocalShareAudioStream(undefined));
9914
10747
  }
@@ -9923,14 +10756,14 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9923
10756
  }
9924
10757
  }
9925
10758
  } catch (err) {
9926
- _iterator.e(err);
10759
+ _iterator2.e(err);
9927
10760
  } finally {
9928
- _iterator.f();
10761
+ _iterator2.f();
9929
10762
  }
9930
10763
  if (!this.isMultistream) {
9931
10764
  promises.push(this.updateTranscodedMediaConnection());
9932
10765
  }
9933
- _context43.next = 1;
10766
+ _context46.next = 1;
9934
10767
  return _promise.default.all(promises);
9935
10768
  case 1:
9936
10769
  // we're allowing for the SDK to support just audio share as well
@@ -9951,11 +10784,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
9951
10784
  }
9952
10785
  case 2:
9953
10786
  case "end":
9954
- return _context43.stop();
10787
+ return _context46.stop();
9955
10788
  }
9956
- }, _callee43, this);
10789
+ }, _callee46, this);
9957
10790
  }));
9958
- function unpublishStreams(_x42) {
10791
+ function unpublishStreams(_x47) {
9959
10792
  return _unpublishStreams.apply(this, arguments);
9960
10793
  }
9961
10794
  return unpublishStreams;
@@ -10021,16 +10854,16 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
10021
10854
  }, {
10022
10855
  key: "getMediaReachabilityMetricFields",
10023
10856
  value: (function () {
10024
- var _getMediaReachabilityMetricFields = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
10857
+ var _getMediaReachabilityMetricFields = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
10025
10858
  var _this$mediaServerIp, _this$mediaConnection, _this$mediaConnection2, _this$mediaConnection3;
10026
10859
  var reachabilityMetrics, successKeys, totalSuccessCases, selectedSubnetFirstOctet, isSubnetReachable, selectedCluster;
10027
- return _regenerator.default.wrap(function (_context44) {
10028
- while (1) switch (_context44.prev = _context44.next) {
10860
+ return _regenerator.default.wrap(function (_context47) {
10861
+ while (1) switch (_context47.prev = _context47.next) {
10029
10862
  case 0:
10030
- _context44.next = 1;
10863
+ _context47.next = 1;
10031
10864
  return this.webex.meetings.reachability.getReachabilityMetrics();
10032
10865
  case 1:
10033
- reachabilityMetrics = _context44.sent;
10866
+ reachabilityMetrics = _context47.sent;
10034
10867
  successKeys = ['reachability_public_udp_success', 'reachability_public_tcp_success', 'reachability_public_xtls_success', 'reachability_vmn_udp_success', 'reachability_vmn_tcp_success', 'reachability_vmn_xtls_success'];
10035
10868
  totalSuccessCases = successKeys.reduce(function (total, key) {
10036
10869
  var value = reachabilityMetrics[key];
@@ -10047,16 +10880,16 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
10047
10880
  this.webex.meetings.reachability.isSubnetReachable(selectedSubnetFirstOctet);
10048
10881
  }
10049
10882
  selectedCluster = (_this$mediaConnection = (_this$mediaConnection2 = this.mediaConnections) === null || _this$mediaConnection2 === void 0 ? void 0 : (_this$mediaConnection3 = _this$mediaConnection2[0]) === null || _this$mediaConnection3 === void 0 ? void 0 : _this$mediaConnection3.mediaAgentCluster) !== null && _this$mediaConnection !== void 0 ? _this$mediaConnection : null;
10050
- return _context44.abrupt("return", _objectSpread(_objectSpread({}, reachabilityMetrics), {}, {
10883
+ return _context47.abrupt("return", _objectSpread(_objectSpread({}, reachabilityMetrics), {}, {
10051
10884
  subnet_reachable: isSubnetReachable,
10052
10885
  selected_cluster: selectedCluster,
10053
10886
  selected_subnet: selectedSubnetFirstOctet ? "".concat(selectedSubnetFirstOctet, ".X.X.X") : null
10054
10887
  }));
10055
10888
  case 2:
10056
10889
  case "end":
10057
- return _context44.stop();
10890
+ return _context47.stop();
10058
10891
  }
10059
- }, _callee44, this);
10892
+ }, _callee47, this);
10060
10893
  }));
10061
10894
  function getMediaReachabilityMetricFields() {
10062
10895
  return _getMediaReachabilityMetricFields.apply(this, arguments);
@@ -10073,17 +10906,17 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
10073
10906
  }, {
10074
10907
  key: "setStage",
10075
10908
  value: function setStage() {
10076
- var _ref44 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
10077
- _ref44$activeSpeakerP = _ref44.activeSpeakerProportion,
10078
- activeSpeakerProportion = _ref44$activeSpeakerP === void 0 ? 0.5 : _ref44$activeSpeakerP,
10079
- customBackground = _ref44.customBackground,
10080
- customLogo = _ref44.customLogo,
10081
- customNameLabel = _ref44.customNameLabel,
10082
- importantParticipants = _ref44.importantParticipants,
10083
- _ref44$lockAttendeeVi = _ref44.lockAttendeeViewOnStage,
10084
- lockAttendeeViewOnStage = _ref44$lockAttendeeVi === void 0 ? false : _ref44$lockAttendeeVi,
10085
- _ref44$showActiveSpea = _ref44.showActiveSpeaker,
10086
- showActiveSpeaker = _ref44$showActiveSpea === void 0 ? false : _ref44$showActiveSpea;
10909
+ var _ref49 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
10910
+ _ref49$activeSpeakerP = _ref49.activeSpeakerProportion,
10911
+ activeSpeakerProportion = _ref49$activeSpeakerP === void 0 ? 0.5 : _ref49$activeSpeakerP,
10912
+ customBackground = _ref49.customBackground,
10913
+ customLogo = _ref49.customLogo,
10914
+ customNameLabel = _ref49.customNameLabel,
10915
+ importantParticipants = _ref49.importantParticipants,
10916
+ _ref49$lockAttendeeVi = _ref49.lockAttendeeViewOnStage,
10917
+ lockAttendeeViewOnStage = _ref49$lockAttendeeVi === void 0 ? false : _ref49$lockAttendeeVi,
10918
+ _ref49$showActiveSpea = _ref49.showActiveSpeaker,
10919
+ showActiveSpeaker = _ref49$showActiveSpea === void 0 ? false : _ref49$showActiveSpea;
10087
10920
  var videoLayout = {
10088
10921
  overrideDefault: true,
10089
10922
  lockAttendeeViewOnStageOnly: lockAttendeeViewOnStage,
@@ -10187,41 +11020,41 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
10187
11020
  }, {
10188
11021
  key: "refreshDataChannelToken",
10189
11022
  value: (function () {
10190
- var _refreshDataChannelToken = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
10191
- var isPracticeSession, dataChannelTokenType, res, msg, _t36;
10192
- return _regenerator.default.wrap(function (_context45) {
10193
- while (1) switch (_context45.prev = _context45.next) {
11023
+ var _refreshDataChannelToken = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48() {
11024
+ var isPracticeSession, dataChannelTokenType, res, msg, _t39;
11025
+ return _regenerator.default.wrap(function (_context48) {
11026
+ while (1) switch (_context48.prev = _context48.next) {
10194
11027
  case 0:
10195
11028
  isPracticeSession = this.webinar.isJoinPracticeSessionDataChannel();
10196
11029
  dataChannelTokenType = this.getDataChannelTokenType();
10197
- _context45.prev = 1;
10198
- _context45.next = 2;
11030
+ _context48.prev = 1;
11031
+ _context48.next = 2;
10199
11032
  return this.meetingRequest.fetchDatachannelToken({
10200
11033
  locusUrl: this.locusUrl,
10201
11034
  requestingParticipantId: this.members.selfId,
10202
11035
  isPracticeSession: isPracticeSession
10203
11036
  });
10204
11037
  case 2:
10205
- res = _context45.sent;
10206
- return _context45.abrupt("return", {
11038
+ res = _context48.sent;
11039
+ return _context48.abrupt("return", {
10207
11040
  body: {
10208
11041
  datachannelToken: res.body.datachannelToken,
10209
11042
  dataChannelTokenType: dataChannelTokenType
10210
11043
  }
10211
11044
  });
10212
11045
  case 3:
10213
- _context45.prev = 3;
10214
- _t36 = _context45["catch"](1);
10215
- msg = (_t36 === null || _t36 === void 0 ? void 0 : _t36.message) || String(_t36);
11046
+ _context48.prev = 3;
11047
+ _t39 = _context48["catch"](1);
11048
+ msg = (_t39 === null || _t39 === void 0 ? void 0 : _t39.message) || String(_t39);
10216
11049
  _loggerProxy.default.logger.warn("Meeting:index#refreshDataChannelToken --> DataChannel token refresh failed (likely locus changed or participant left): ".concat(msg), {
10217
- statusCode: _t36 === null || _t36 === void 0 ? void 0 : _t36.statusCode
11050
+ statusCode: _t39 === null || _t39 === void 0 ? void 0 : _t39.statusCode
10218
11051
  });
10219
- return _context45.abrupt("return", null);
11052
+ return _context48.abrupt("return", null);
10220
11053
  case 4:
10221
11054
  case "end":
10222
- return _context45.stop();
11055
+ return _context48.stop();
10223
11056
  }
10224
- }, _callee45, this, [[1, 3]]);
11057
+ }, _callee48, this, [[1, 3]]);
10225
11058
  }));
10226
11059
  function refreshDataChannelToken() {
10227
11060
  return _refreshDataChannelToken.apply(this, arguments);