@webex/plugin-meetings 3.12.0-next.13 → 3.12.0-next.130

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