@webex/plugin-meetings 3.3.1 → 3.4.0

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 (126) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +7 -2
  3. package/dist/breakouts/index.js.map +1 -1
  4. package/dist/constants.js +11 -4
  5. package/dist/constants.js.map +1 -1
  6. package/dist/interpretation/index.js +1 -1
  7. package/dist/interpretation/siLanguage.js +1 -1
  8. package/dist/locus-info/selfUtils.js +0 -5
  9. package/dist/locus-info/selfUtils.js.map +1 -1
  10. package/dist/media/MediaConnectionAwaiter.js +70 -15
  11. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  12. package/dist/media/index.js +12 -0
  13. package/dist/media/index.js.map +1 -1
  14. package/dist/meeting/connectionStateHandler.js +67 -0
  15. package/dist/meeting/connectionStateHandler.js.map +1 -0
  16. package/dist/meeting/index.js +552 -357
  17. package/dist/meeting/index.js.map +1 -1
  18. package/dist/meeting/locusMediaRequest.js +7 -0
  19. package/dist/meeting/locusMediaRequest.js.map +1 -1
  20. package/dist/meeting/muteState.js +6 -1
  21. package/dist/meeting/muteState.js.map +1 -1
  22. package/dist/meeting/util.js +1 -0
  23. package/dist/meeting/util.js.map +1 -1
  24. package/dist/meeting-info/index.js +4 -4
  25. package/dist/meeting-info/index.js.map +1 -1
  26. package/dist/meeting-info/meeting-info-v2.js +2 -2
  27. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  28. package/dist/meeting-info/util.js +17 -17
  29. package/dist/meeting-info/util.js.map +1 -1
  30. package/dist/meeting-info/utilv2.js +16 -16
  31. package/dist/meeting-info/utilv2.js.map +1 -1
  32. package/dist/meetings/collection.js +1 -1
  33. package/dist/meetings/collection.js.map +1 -1
  34. package/dist/meetings/index.js +37 -33
  35. package/dist/meetings/index.js.map +1 -1
  36. package/dist/meetings/meetings.types.js +8 -0
  37. package/dist/meetings/meetings.types.js.map +1 -1
  38. package/dist/meetings/util.js +3 -2
  39. package/dist/meetings/util.js.map +1 -1
  40. package/dist/metrics/constants.js +2 -1
  41. package/dist/metrics/constants.js.map +1 -1
  42. package/dist/metrics/index.js +57 -0
  43. package/dist/metrics/index.js.map +1 -1
  44. package/dist/personal-meeting-room/index.js +1 -1
  45. package/dist/personal-meeting-room/index.js.map +1 -1
  46. package/dist/reachability/clusterReachability.js +108 -53
  47. package/dist/reachability/clusterReachability.js.map +1 -1
  48. package/dist/reachability/index.js +415 -56
  49. package/dist/reachability/index.js.map +1 -1
  50. package/dist/types/constants.d.ts +11 -3
  51. package/dist/types/media/MediaConnectionAwaiter.d.ts +24 -4
  52. package/dist/types/meeting/connectionStateHandler.d.ts +30 -0
  53. package/dist/types/meeting/index.d.ts +27 -7
  54. package/dist/types/meeting/locusMediaRequest.d.ts +2 -0
  55. package/dist/types/meeting-info/index.d.ts +3 -2
  56. package/dist/types/meeting-info/meeting-info-v2.d.ts +3 -2
  57. package/dist/types/meeting-info/util.d.ts +5 -4
  58. package/dist/types/meeting-info/utilv2.d.ts +3 -2
  59. package/dist/types/meetings/collection.d.ts +3 -2
  60. package/dist/types/meetings/index.d.ts +4 -3
  61. package/dist/types/meetings/meetings.types.d.ts +9 -0
  62. package/dist/types/metrics/constants.d.ts +1 -0
  63. package/dist/types/metrics/index.d.ts +15 -0
  64. package/dist/types/reachability/clusterReachability.d.ts +31 -3
  65. package/dist/types/reachability/index.d.ts +93 -2
  66. package/dist/webinar/index.js +1 -1
  67. package/package.json +23 -23
  68. package/src/breakouts/index.ts +7 -1
  69. package/src/constants.ts +13 -17
  70. package/src/locus-info/selfUtils.ts +0 -5
  71. package/src/media/MediaConnectionAwaiter.ts +89 -14
  72. package/src/media/index.ts +13 -0
  73. package/src/meeting/connectionStateHandler.ts +65 -0
  74. package/src/meeting/index.ts +526 -292
  75. package/src/meeting/locusMediaRequest.ts +5 -0
  76. package/src/meeting/muteState.ts +6 -1
  77. package/src/meeting/util.ts +1 -0
  78. package/src/meeting-info/index.ts +9 -6
  79. package/src/meeting-info/meeting-info-v2.ts +4 -4
  80. package/src/meeting-info/util.ts +23 -28
  81. package/src/meeting-info/utilv2.ts +18 -24
  82. package/src/meetings/collection.ts +3 -3
  83. package/src/meetings/index.ts +39 -40
  84. package/src/meetings/meetings.types.ts +11 -0
  85. package/src/meetings/util.ts +5 -4
  86. package/src/metrics/constants.ts +1 -0
  87. package/src/metrics/index.ts +44 -0
  88. package/src/personal-meeting-room/index.ts +2 -2
  89. package/src/reachability/clusterReachability.ts +86 -25
  90. package/src/reachability/index.ts +316 -27
  91. package/test/unit/spec/breakouts/index.ts +51 -32
  92. package/test/unit/spec/locus-info/selfUtils.js +25 -23
  93. package/test/unit/spec/media/MediaConnectionAwaiter.ts +131 -32
  94. package/test/unit/spec/media/index.ts +42 -27
  95. package/test/unit/spec/meeting/connectionStateHandler.ts +102 -0
  96. package/test/unit/spec/meeting/index.js +758 -179
  97. package/test/unit/spec/meeting/locusMediaRequest.ts +7 -0
  98. package/test/unit/spec/meeting/muteState.js +24 -0
  99. package/test/unit/spec/meeting-info/index.js +4 -4
  100. package/test/unit/spec/meeting-info/meetinginfov2.js +24 -28
  101. package/test/unit/spec/meeting-info/request.js +2 -2
  102. package/test/unit/spec/meeting-info/utilv2.js +41 -49
  103. package/test/unit/spec/meetings/index.js +14 -0
  104. package/test/unit/spec/metrics/index.js +126 -0
  105. package/test/unit/spec/multistream/mediaRequestManager.ts +2 -2
  106. package/test/unit/spec/personal-meeting-room/personal-meeting-room.js +2 -2
  107. package/test/unit/spec/reachability/clusterReachability.ts +116 -22
  108. package/test/unit/spec/reachability/index.ts +1153 -84
  109. package/test/unit/spec/rtcMetrics/index.ts +1 -0
  110. package/dist/mediaQualityMetrics/config.js +0 -321
  111. package/dist/mediaQualityMetrics/config.js.map +0 -1
  112. package/dist/statsAnalyzer/global.js +0 -44
  113. package/dist/statsAnalyzer/global.js.map +0 -1
  114. package/dist/statsAnalyzer/index.js +0 -1072
  115. package/dist/statsAnalyzer/index.js.map +0 -1
  116. package/dist/statsAnalyzer/mqaUtil.js +0 -368
  117. package/dist/statsAnalyzer/mqaUtil.js.map +0 -1
  118. package/dist/types/mediaQualityMetrics/config.d.ts +0 -247
  119. package/dist/types/statsAnalyzer/global.d.ts +0 -36
  120. package/dist/types/statsAnalyzer/index.d.ts +0 -217
  121. package/dist/types/statsAnalyzer/mqaUtil.d.ts +0 -48
  122. package/src/mediaQualityMetrics/config.ts +0 -255
  123. package/src/statsAnalyzer/global.ts +0 -37
  124. package/src/statsAnalyzer/index.ts +0 -1318
  125. package/src/statsAnalyzer/mqaUtil.ts +0 -463
  126. package/test/unit/spec/stats-analyzer/index.js +0 -1819
@@ -19,6 +19,7 @@ exports.default = exports.ScreenShareFloorStatus = exports.MEDIA_UPDATE_TYPE = v
19
19
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
20
20
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
21
21
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
22
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
22
23
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
23
24
  var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
24
25
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/typeof"));
@@ -41,7 +42,6 @@ var _mediaHelpers = require("@webex/media-helpers");
41
42
  var _internalPluginVoicea = require("@webex/internal-plugin-voicea");
42
43
  var _voiceaMeeting = require("./voicea-meeting");
43
44
  var _webexErrors = require("../common/errors/webex-errors");
44
- var _statsAnalyzer = require("../statsAnalyzer");
45
45
  var _networkQualityMonitor = _interopRequireDefault(require("../networkQualityMonitor"));
46
46
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
47
47
  var _util = _interopRequireDefault(require("../common/events/util"));
@@ -83,6 +83,7 @@ var _recordingController = _interopRequireDefault(require("../recording-controll
83
83
  var _controlsOptionsManager = _interopRequireDefault(require("../controls-options-manager"));
84
84
  var _permission = _interopRequireDefault(require("../common/errors/permission"));
85
85
  var _locusMediaRequest = require("./locusMediaRequest");
86
+ var _connectionStateHandler = require("./connectionStateHandler");
86
87
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
87
88
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
88
89
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -91,6 +92,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
91
92
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
92
93
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } // @ts-ignore - Fix this
93
94
  // @ts-ignore - Types not available for @webex/common
95
+ // default callback so we don't call an undefined function, but in practice it should never be used
96
+ var DEFAULT_ICE_PHASE_CALLBACK = function DEFAULT_ICE_PHASE_CALLBACK() {
97
+ return 'JOIN_MEETING_FINAL';
98
+ };
94
99
  var logRequest = function logRequest(request, _ref) {
95
100
  var _ref$logText = _ref.logText,
96
101
  logText = _ref$logText === void 0 ? '' : _ref$logText;
@@ -497,6 +502,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
497
502
  file: 'meeting/index',
498
503
  function: 'setUpVoiceaListeners'
499
504
  }), "event#").concat(_constants.EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION));
505
+ if (_this.getCurUserType() !== 'host') {
506
+ delete payload.spokenLanguages;
507
+ }
500
508
 
501
509
  // @ts-ignore
502
510
  _this.trigger(_constants.EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION, payload);
@@ -523,13 +531,16 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
523
531
  interimCaptions: _this.transcription.interimCaptions
524
532
  });
525
533
  }));
526
- (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "retriedWithTurnServer", void 0);
534
+ (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "addMediaData", void 0);
527
535
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "sendSlotManager", new _sendSlotManager.default(_loggerProxy.default));
528
536
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "deferSDPAnswer", void 0);
529
537
  // used for waiting for a response
530
538
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "sdpResponseTimer", void 0);
531
539
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "hasMediaConnectionConnectedAtLeastOnce", void 0);
532
540
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "joinWithMediaRetryInfo", void 0);
541
+ (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "connectionStateHandler", void 0);
542
+ (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "iceCandidateErrors", void 0);
543
+ (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "iceCandidatesCount", void 0);
533
544
  /**
534
545
  * Callback called when a relay event is received from meeting LLM Connection
535
546
  * @param {RelayEvent} e Event object coming from LLM Connection
@@ -661,7 +672,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
661
672
  * @returns {undefined}
662
673
  */
663
674
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "setupSdpListeners", function () {
664
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.REMOTE_SDP_ANSWER_PROCESSED, function () {
675
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.REMOTE_SDP_ANSWER_PROCESSED, function () {
665
676
  // @ts-ignore
666
677
  var cdl = _this.webex.internal.newMetrics.callDiagnosticLatencies;
667
678
 
@@ -683,7 +694,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
683
694
  _this.sdpResponseTimer = undefined;
684
695
  }
685
696
  });
686
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.LOCAL_SDP_OFFER_GENERATED, function () {
697
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.LOCAL_SDP_OFFER_GENERATED, function () {
687
698
  // @ts-ignore
688
699
  _this.webex.internal.newMetrics.submitClientEvent({
689
700
  name: 'client.media-engine.local-sdp-generated',
@@ -695,7 +706,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
695
706
  // Instantiate Defer so that the SDP offer/answer exchange timeout can start, see waitForRemoteSDPAnswer()
696
707
  _this.deferSDPAnswer = new _common.Defer();
697
708
  });
698
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.LOCAL_SDP_ANSWER_GENERATED, function () {
709
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.LOCAL_SDP_ANSWER_GENERATED, function () {
699
710
  // we are sending "remote-sdp-received" only after we've generated the answer - this indicates that we've fully processed that incoming offer
700
711
  // @ts-ignore
701
712
  _this.webex.internal.newMetrics.submitClientEvent({
@@ -708,16 +719,16 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
708
719
  });
709
720
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "setupMediaConnectionListeners", function () {
710
721
  _this.setupSdpListeners();
711
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.ROAP_STARTED, function () {
722
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.ROAP_STARTED, function () {
712
723
  _this.isRoapInProgress = true;
713
724
  });
714
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.ROAP_DONE, function () {
725
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.ROAP_DONE, function () {
715
726
  _this.mediaNegotiatedEvent();
716
727
  _this.isRoapInProgress = false;
717
728
  _this.processNextQueuedMediaUpdate();
718
729
  });
719
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.ROAP_FAILURE, _this.handleRoapFailure);
720
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.ROAP_MESSAGE_TO_SEND, function (event) {
730
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.ROAP_FAILURE, _this.handleRoapFailure);
731
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, function (event) {
721
732
  var LOG_HEADER = "Meeting:index#setupMediaConnectionListeners.ROAP_MESSAGE_TO_SEND --> correlationId=".concat(_this.correlationId);
722
733
  switch (event.roapMessage.messageType) {
723
734
  case 'OK':
@@ -743,7 +754,23 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
743
754
  }
744
755
  }), {
745
756
  logText: "".concat(LOG_HEADER, " Roap Offer")
746
- }).catch(function () {
757
+ }).catch(function (error) {
758
+ // @ts-ignore
759
+ _this.webex.internal.newMetrics.submitClientEvent({
760
+ name: 'client.media-engine.remote-sdp-received',
761
+ payload: {
762
+ canProceed: false,
763
+ errors: [
764
+ // @ts-ignore
765
+ _this.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode({
766
+ clientErrorCode: _internalPluginMetrics.CALL_DIAGNOSTIC_CONFIG.MISSING_ROAP_ANSWER_CLIENT_CODE
767
+ })]
768
+ },
769
+ options: {
770
+ meetingId: _this.id,
771
+ rawError: error
772
+ }
773
+ });
747
774
  _this.deferSDPAnswer.reject(new Error('failed to send ROAP SDP offer'));
748
775
  clearTimeout(_this.sdpResponseTimer);
749
776
  _this.sdpResponseTimer = undefined;
@@ -795,7 +822,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
795
822
  });
796
823
 
797
824
  // eslint-disable-next-line no-param-reassign
798
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.REMOTE_TRACK_ADDED, function (event) {
825
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.REMOTE_TRACK_ADDED, function (event) {
799
826
  _loggerProxy.default.logger.log("Meeting:index#setupMediaConnectionListeners --> REMOTE_TRACK_ADDED event received for webrtcMediaConnection: ".concat((0, _stringify.default)(event)));
800
827
  if (event.track) {
801
828
  var mediaTrack = event.track;
@@ -824,7 +851,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
824
851
  if (eventType && mediaTrack) {
825
852
  _triggerProxy.default.trigger((0, _assertThisInitialized2.default)(_this), {
826
853
  file: 'meeting/index',
827
- function: 'setupRemoteTrackListener:Event.REMOTE_TRACK_ADDED'
854
+ function: 'setupRemoteTrackListener:MediaConnectionEventNames.REMOTE_TRACK_ADDED'
828
855
  }, _constants.EVENT_TRIGGERS.MEDIA_READY, {
829
856
  type: eventType,
830
857
  stream: remoteStream.outputStream
@@ -832,7 +859,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
832
859
  }
833
860
  }
834
861
  });
835
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.CONNECTION_STATE_CHANGED, function (event) {
862
+ _this.connectionStateHandler = new _connectionStateHandler.ConnectionStateHandler(_this.mediaProperties.webrtcMediaConnection);
863
+ _this.connectionStateHandler.on(_connectionStateHandler.ConnectionStateEvent.stateChanged, function (event) {
836
864
  var connectionFailed = function connectionFailed() {
837
865
  _metrics.default.sendBehavioralMetric(_constants2.default.CONNECTION_FAILURE, {
838
866
  correlation_id: _this.correlationId,
@@ -909,7 +937,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
909
937
  break;
910
938
  }
911
939
  });
912
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.ACTIVE_SPEAKERS_CHANGED, function (csis) {
940
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.ACTIVE_SPEAKERS_CHANGED, function (csis) {
913
941
  _triggerProxy.default.trigger((0, _assertThisInitialized2.default)(_this), {
914
942
  file: 'meeting/index',
915
943
  function: 'setupMediaConnectionListeners'
@@ -924,7 +952,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
924
952
  })
925
953
  });
926
954
  });
927
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.VIDEO_SOURCES_COUNT_CHANGED, function (numTotalSources, numLiveSources, mediaContent) {
955
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.VIDEO_SOURCES_COUNT_CHANGED, function (numTotalSources, numLiveSources, mediaContent) {
928
956
  _triggerProxy.default.trigger((0, _assertThisInitialized2.default)(_this), {
929
957
  file: 'meeting/index',
930
958
  function: 'setupMediaConnectionListeners'
@@ -937,7 +965,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
937
965
  _this.mediaRequestManagers.video.setNumCurrentSources(numTotalSources, numLiveSources);
938
966
  }
939
967
  });
940
- _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.AUDIO_SOURCES_COUNT_CHANGED, function (numTotalSources, numLiveSources, mediaContent) {
968
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.AUDIO_SOURCES_COUNT_CHANGED, function (numTotalSources, numLiveSources, mediaContent) {
941
969
  _triggerProxy.default.trigger((0, _assertThisInitialized2.default)(_this), {
942
970
  file: 'meeting/index',
943
971
  function: 'setupMediaConnectionListeners'
@@ -947,6 +975,28 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
947
975
  mediaContent: mediaContent
948
976
  });
949
977
  });
978
+ _this.iceCandidateErrors.clear();
979
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.ICE_CANDIDATE_ERROR, function (event) {
980
+ var errorCode = event.error.errorCode;
981
+ var errorText = event.error.errorText;
982
+ if (errorCode === 600 && errorText === 'Address not associated with the desired network interface.') {
983
+ return;
984
+ }
985
+ if (errorText.endsWith('.')) {
986
+ errorText = errorText.slice(0, -1);
987
+ }
988
+ errorText = errorText.toLowerCase();
989
+ errorText = errorText.replace(/ /g, '_');
990
+ var error = "".concat(errorCode, "_").concat(errorText);
991
+ var count = _this.iceCandidateErrors.get(error) || 0;
992
+ _this.iceCandidateErrors.set(error, count + 1);
993
+ });
994
+ _this.iceCandidatesCount = 0;
995
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnectionEventNames.ICE_CANDIDATE, function (event) {
996
+ if (event.candidate) {
997
+ _this.iceCandidatesCount += 1;
998
+ }
999
+ });
950
1000
  });
951
1001
  /**
952
1002
  * Registers for all required StatsAnalyzer events
@@ -955,7 +1005,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
955
1005
  * @memberof Meetings
956
1006
  */
957
1007
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "setupStatsAnalyzerEventHandlers", function () {
958
- _this.statsAnalyzer.on(_statsAnalyzer.EVENTS.MEDIA_QUALITY, function (options) {
1008
+ _this.statsAnalyzer.on(_internalMediaCore.StatsAnalyzerEventNames.MEDIA_QUALITY, function (options) {
959
1009
  var _this$webex$meetings$;
960
1010
  // TODO: might have to send the same event to the developer
961
1011
  // Add ip address info if geo hint is present
@@ -968,14 +1018,14 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
968
1018
  name: 'client.mediaquality.event',
969
1019
  options: {
970
1020
  meetingId: _this.id,
971
- networkType: options.networkType
1021
+ networkType: options.data.networkType
972
1022
  },
973
1023
  payload: {
974
1024
  intervals: [options.data]
975
1025
  }
976
1026
  });
977
1027
  });
978
- _this.statsAnalyzer.on(_statsAnalyzer.EVENTS.LOCAL_MEDIA_STARTED, function (data) {
1028
+ _this.statsAnalyzer.on(_internalMediaCore.StatsAnalyzerEventNames.LOCAL_MEDIA_STARTED, function (data) {
979
1029
  _triggerProxy.default.trigger((0, _assertThisInitialized2.default)(_this), {
980
1030
  file: 'meeting/index',
981
1031
  function: 'addMedia'
@@ -984,28 +1034,28 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
984
1034
  _this.webex.internal.newMetrics.submitClientEvent({
985
1035
  name: 'client.media.tx.start',
986
1036
  payload: {
987
- mediaType: data.type,
988
- shareInstanceId: data.type === 'share' ? _this.localShareInstanceId : undefined
1037
+ mediaType: data.mediaType,
1038
+ shareInstanceId: data.mediaType === 'share' ? _this.localShareInstanceId : undefined
989
1039
  },
990
1040
  options: {
991
1041
  meetingId: _this.id
992
1042
  }
993
1043
  });
994
1044
  });
995
- _this.statsAnalyzer.on(_statsAnalyzer.EVENTS.LOCAL_MEDIA_STOPPED, function (data) {
1045
+ _this.statsAnalyzer.on(_internalMediaCore.StatsAnalyzerEventNames.LOCAL_MEDIA_STOPPED, function (data) {
996
1046
  // @ts-ignore
997
1047
  _this.webex.internal.newMetrics.submitClientEvent({
998
1048
  name: 'client.media.tx.stop',
999
1049
  payload: {
1000
- mediaType: data.type,
1001
- shareInstanceId: data.type === 'share' ? _this.localShareInstanceId : undefined
1050
+ mediaType: data.mediaType,
1051
+ shareInstanceId: data.mediaType === 'share' ? _this.localShareInstanceId : undefined
1002
1052
  },
1003
1053
  options: {
1004
1054
  meetingId: _this.id
1005
1055
  }
1006
1056
  });
1007
1057
  });
1008
- _this.statsAnalyzer.on(_statsAnalyzer.EVENTS.REMOTE_MEDIA_STARTED, function (data) {
1058
+ _this.statsAnalyzer.on(_internalMediaCore.StatsAnalyzerEventNames.REMOTE_MEDIA_STARTED, function (data) {
1009
1059
  _triggerProxy.default.trigger((0, _assertThisInitialized2.default)(_this), {
1010
1060
  file: 'meeting/index',
1011
1061
  function: 'addMedia'
@@ -1014,14 +1064,14 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1014
1064
  _this.webex.internal.newMetrics.submitClientEvent({
1015
1065
  name: 'client.media.rx.start',
1016
1066
  payload: {
1017
- mediaType: data.type,
1018
- shareInstanceId: data.type === 'share' ? _this.remoteShareInstanceId : undefined
1067
+ mediaType: data.mediaType,
1068
+ shareInstanceId: data.mediaType === 'share' ? _this.remoteShareInstanceId : undefined
1019
1069
  },
1020
1070
  options: {
1021
1071
  meetingId: _this.id
1022
1072
  }
1023
1073
  });
1024
- if (data.type === 'share') {
1074
+ if (data.mediaType === 'share') {
1025
1075
  // @ts-ignore
1026
1076
  _this.webex.internal.newMetrics.submitClientEvent({
1027
1077
  name: 'client.media.render.start',
@@ -1035,19 +1085,19 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1035
1085
  });
1036
1086
  }
1037
1087
  });
1038
- _this.statsAnalyzer.on(_statsAnalyzer.EVENTS.REMOTE_MEDIA_STOPPED, function (data) {
1088
+ _this.statsAnalyzer.on(_internalMediaCore.StatsAnalyzerEventNames.REMOTE_MEDIA_STOPPED, function (data) {
1039
1089
  // @ts-ignore
1040
1090
  _this.webex.internal.newMetrics.submitClientEvent({
1041
1091
  name: 'client.media.rx.stop',
1042
1092
  payload: {
1043
- mediaType: data.type,
1044
- shareInstanceId: data.type === 'share' ? _this.remoteShareInstanceId : undefined
1093
+ mediaType: data.mediaType,
1094
+ shareInstanceId: data.mediaType === 'share' ? _this.remoteShareInstanceId : undefined
1045
1095
  },
1046
1096
  options: {
1047
1097
  meetingId: _this.id
1048
1098
  }
1049
1099
  });
1050
- if (data.type === 'share') {
1100
+ if (data.mediaType === 'share') {
1051
1101
  // @ts-ignore
1052
1102
  _this.webex.internal.newMetrics.submitClientEvent({
1053
1103
  name: 'client.media.render.stop',
@@ -1192,10 +1242,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1192
1242
  * @returns {undefined}
1193
1243
  */
1194
1244
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleShareVideoStreamMuteStateChange", function (muted) {
1245
+ var _this$statsAnalyzer;
1195
1246
  _loggerProxy.default.logger.log("Meeting:index#handleShareVideoStreamMuteStateChange --> Share video stream mute state changed to muted ".concat(muted));
1196
1247
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_SHARE_VIDEO_MUTE_STATE_CHANGE, {
1197
1248
  correlationId: _this.correlationId,
1198
- muted: muted
1249
+ muted: muted,
1250
+ encoderImplementation: (_this$statsAnalyzer = _this.statsAnalyzer) === null || _this$statsAnalyzer === void 0 ? void 0 : _this$statsAnalyzer.shareVideoEncoderImplementation
1199
1251
  });
1200
1252
  });
1201
1253
  /**
@@ -2043,13 +2095,19 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2043
2095
  _this.turnServerUsed = false;
2044
2096
 
2045
2097
  /**
2046
- * Whether retry was done using TURN Discovery.
2098
+ * Contains information used during the addMedia() operation:
2099
+ * retriedWithTurnServer - whether retry was done using TURN Discovery
2100
+ * icePhaseCallback - callback for determining the value for icePhase when sending failure event to CA
2101
+ *
2047
2102
  * @instance
2048
- * @type {boolean}
2103
+ * @type {Object}
2049
2104
  * @private
2050
2105
  * @memberof Meeting
2051
2106
  */
2052
- _this.retriedWithTurnServer = false;
2107
+ _this.addMediaData = {
2108
+ retriedWithTurnServer: false,
2109
+ icePhaseCallback: DEFAULT_ICE_PHASE_CALLBACK
2110
+ };
2053
2111
 
2054
2112
  /**
2055
2113
  * Whether or not the media connection has ever successfully connected.
@@ -2071,6 +2129,33 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2071
2129
  isRetry: false,
2072
2130
  prevJoinResponse: undefined
2073
2131
  };
2132
+
2133
+ /**
2134
+ * Connection state handler
2135
+ * @instance
2136
+ * @type {ConnectionStateHandler}
2137
+ * @private
2138
+ * @memberof Meeting
2139
+ */
2140
+ _this.connectionStateHandler = undefined;
2141
+
2142
+ /**
2143
+ * ICE Candidates errors map
2144
+ * @instance
2145
+ * @type {Map<[number, string], number>}
2146
+ * @private
2147
+ * @memberof Meeting
2148
+ */
2149
+ _this.iceCandidateErrors = new _map.default();
2150
+
2151
+ /**
2152
+ * Gathered ICE Candidates count
2153
+ * @instance
2154
+ * @type {number}
2155
+ * @private
2156
+ * @memberof Meeting
2157
+ */
2158
+ _this.iceCandidatesCount = 0;
2074
2159
  return _this;
2075
2160
  }
2076
2161
 
@@ -2342,13 +2427,13 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2342
2427
  _loggerProxy.default.logger.info("Meeting:index#refreshPermissionToken --> cannot refresh the permission token, because we don't have it (reason=".concat(reason, ")"));
2343
2428
  return _context6.abrupt("return");
2344
2429
  case 3:
2345
- isStartingSpaceInstantV2Meeting = this.destinationType === _constants._CONVERSATION_URL_ &&
2430
+ isStartingSpaceInstantV2Meeting = this.destinationType === _constants.DESTINATION_TYPE.CONVERSATION_URL &&
2346
2431
  // @ts-ignore - config coming from registerPlugin
2347
2432
  this.config.experimental.enableAdhocMeetings &&
2348
2433
  // @ts-ignore
2349
2434
  this.webex.meetings.preferredWebexSite;
2350
2435
  destination = isStartingSpaceInstantV2Meeting ? this.meetingInfo.meetingJoinUrl : this.destination;
2351
- destinationType = isStartingSpaceInstantV2Meeting ? _constants._MEETING_LINK_ : this.destinationType;
2436
+ destinationType = isStartingSpaceInstantV2Meeting ? _constants.DESTINATION_TYPE.MEETING_LINK : this.destinationType;
2352
2437
  permissionTokenExpiryInfo = this.getPermissionTokenExpiryInfo();
2353
2438
  timeLeft = permissionTokenExpiryInfo === null || permissionTokenExpiryInfo === void 0 ? void 0 : permissionTokenExpiryInfo.timeLeft;
2354
2439
  expiryTime = permissionTokenExpiryInfo === null || permissionTokenExpiryInfo === void 0 ? void 0 : permissionTokenExpiryInfo.expiryTime;
@@ -3564,6 +3649,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
3564
3649
  correlation_id: _this19.correlationId,
3565
3650
  locus_id: _this19.locusId
3566
3651
  });
3652
+ _loggerProxy.default.logger.info('Meeting:index#setUpLocusInfoSelfListener --> MEDIA_INACTIVITY received, reconnecting...');
3567
3653
  _this19.reconnect();
3568
3654
  });
3569
3655
 
@@ -4633,7 +4719,6 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4633
4719
  }, {
4634
4720
  key: "closePeerConnections",
4635
4721
  value: function closePeerConnections() {
4636
- this.locusMediaRequest = undefined;
4637
4722
  if (this.mediaProperties.webrtcMediaConnection) {
4638
4723
  if (this.remoteMediaManager) {
4639
4724
  this.remoteMediaManager.stop();
@@ -4927,6 +5012,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4927
5012
  key: "joinWithMedia",
4928
5013
  value: (function () {
4929
5014
  var _joinWithMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
5015
+ var _this28 = this;
4930
5016
  var options,
4931
5017
  mediaOptions,
4932
5018
  _options$joinOptions,
@@ -4938,12 +5024,14 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4938
5024
  joinResponse,
4939
5025
  turnServerInfo,
4940
5026
  turnDiscoverySkippedReason,
5027
+ forceTurnDiscovery,
4941
5028
  turnDiscoveryRequest,
4942
5029
  _yield$this$roap$hand,
4943
5030
  mediaResponse,
4944
5031
  _this$locusUrl,
4945
5032
  _leaveError,
4946
5033
  leaveError,
5034
+ shouldRetry,
4947
5035
  _args15 = arguments;
4948
5036
  return _regenerator.default.wrap(function _callee15$(_context15) {
4949
5037
  while (1) switch (_context15.prev = _context15.next) {
@@ -4962,34 +5050,36 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4962
5050
  joined = false;
4963
5051
  joinResponse = prevJoinResponse;
4964
5052
  _context15.prev = 9;
4965
- _context15.next = 12;
5053
+ forceTurnDiscovery = false;
5054
+ if (joinResponse) {
5055
+ _context15.next = 36;
5056
+ break;
5057
+ }
5058
+ _context15.next = 14;
4966
5059
  return this.webex.meetings.reachability.getReachabilityResults();
4967
- case 12:
5060
+ case 14:
4968
5061
  joinOptions.reachability = _context15.sent;
4969
- _context15.next = 15;
5062
+ _context15.next = 17;
4970
5063
  return this.roap.generateTurnDiscoveryRequestMessage(this, true);
4971
- case 15:
5064
+ case 17:
4972
5065
  turnDiscoveryRequest = _context15.sent;
4973
5066
  turnDiscoverySkippedReason = turnDiscoveryRequest.turnDiscoverySkippedReason;
4974
5067
  joinOptions.roapMessage = turnDiscoveryRequest.roapMessage;
4975
- if (joinResponse) {
4976
- _context15.next = 23;
4977
- break;
4978
- }
4979
5068
  _loggerProxy.default.logger.info('Meeting:index#joinWithMedia ---> calling join with joinOptions, ', joinOptions);
4980
- _context15.next = 22;
5069
+ _context15.next = 23;
4981
5070
  return this.join(joinOptions);
4982
- case 22:
4983
- joinResponse = _context15.sent;
4984
5071
  case 23:
5072
+ joinResponse = _context15.sent;
4985
5073
  joined = true;
5074
+
5075
+ // if we sent out TURN discovery Roap message with join, process the TURN discovery response
4986
5076
  if (!joinOptions.roapMessage) {
4987
- _context15.next = 33;
5077
+ _context15.next = 34;
4988
5078
  break;
4989
5079
  }
4990
- _context15.next = 27;
5080
+ _context15.next = 28;
4991
5081
  return this.roap.handleTurnDiscoveryHttpResponse(this, joinResponse);
4992
- case 27:
5082
+ case 28:
4993
5083
  _yield$this$roap$hand = _context15.sent;
4994
5084
  turnServerInfo = _yield$this$roap$hand.turnServerInfo;
4995
5085
  turnDiscoverySkippedReason = _yield$this$roap$hand.turnDiscoverySkippedReason;
@@ -4998,10 +5088,20 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4998
5088
  if (turnServerInfo === undefined) {
4999
5089
  this.roap.abortTurnDiscovery();
5000
5090
  }
5001
- case 33:
5002
- _context15.next = 35;
5003
- return this.addMedia(mediaOptions, turnServerInfo);
5004
- case 35:
5091
+ case 34:
5092
+ _context15.next = 38;
5093
+ break;
5094
+ case 36:
5095
+ // This is a retry, when join succeeded but addMedia failed, so we'll just call addMedia() again,
5096
+ // but we need to ensure that it also does a new TURN discovery
5097
+ forceTurnDiscovery = true;
5098
+ joined = true;
5099
+ case 38:
5100
+ _context15.next = 40;
5101
+ return this.addMediaInternal(function () {
5102
+ return _this28.joinWithMediaRetryInfo.isRetry ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY';
5103
+ }, turnServerInfo, forceTurnDiscovery, mediaOptions);
5104
+ case 40:
5005
5105
  mediaResponse = _context15.sent;
5006
5106
  this.joinWithMediaRetryInfo = {
5007
5107
  isRetry: false,
@@ -5011,30 +5111,30 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5011
5111
  join: joinResponse,
5012
5112
  media: mediaResponse
5013
5113
  });
5014
- case 40:
5015
- _context15.prev = 40;
5114
+ case 45:
5115
+ _context15.prev = 45;
5016
5116
  _context15.t0 = _context15["catch"](9);
5017
5117
  _loggerProxy.default.logger.error('Meeting:index#joinWithMedia --> ', _context15.t0);
5018
5118
  this.roap.abortTurnDiscovery();
5019
5119
  if (!(joined && isRetry)) {
5020
- _context15.next = 54;
5120
+ _context15.next = 59;
5021
5121
  break;
5022
5122
  }
5023
- _context15.prev = 45;
5024
- _context15.next = 48;
5123
+ _context15.prev = 50;
5124
+ _context15.next = 53;
5025
5125
  return this.leave({
5026
5126
  resourceId: joinOptions === null || joinOptions === void 0 ? void 0 : joinOptions.resourceId,
5027
5127
  reason: 'joinWithMedia failure'
5028
5128
  });
5029
- case 48:
5030
- _context15.next = 54;
5129
+ case 53:
5130
+ _context15.next = 59;
5031
5131
  break;
5032
- case 50:
5033
- _context15.prev = 50;
5034
- _context15.t1 = _context15["catch"](45);
5132
+ case 55:
5133
+ _context15.prev = 55;
5134
+ _context15.t1 = _context15["catch"](50);
5035
5135
  _loggerProxy.default.logger.error('Meeting:index#joinWithMedia --> leave error', _context15.t1);
5036
5136
  leaveError = _context15.t1;
5037
- case 54:
5137
+ case 59:
5038
5138
  _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_WITH_MEDIA_FAILURE, {
5039
5139
  correlation_id: this.correlationId,
5040
5140
  locus_id: (_this$locusUrl = this.locusUrl) === null || _this$locusUrl === void 0 ? void 0 : _this$locusUrl.split('/').pop(),
@@ -5046,25 +5146,33 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5046
5146
  }, {
5047
5147
  type: _context15.t0.name
5048
5148
  });
5049
- if (isRetry) {
5050
- _context15.next = 60;
5149
+
5150
+ // if this was the first attempt, let's do a retry
5151
+ shouldRetry = !isRetry;
5152
+ if (_internalPluginMetrics.CallDiagnosticUtils.isSdpOfferCreationError(_context15.t0)) {
5153
+ // errors related to offer creation (for example missing H264 codec) will happen again no matter how many times we try,
5154
+ // so there is no point doing a retry
5155
+ shouldRetry = false;
5156
+ }
5157
+ if (!shouldRetry) {
5158
+ _context15.next = 67;
5051
5159
  break;
5052
5160
  }
5053
5161
  _loggerProxy.default.logger.warn('Meeting:index#joinWithMedia --> retrying call to joinWithMedia');
5054
5162
  this.joinWithMediaRetryInfo.isRetry = true;
5055
5163
  this.joinWithMediaRetryInfo.prevJoinResponse = joinResponse;
5056
5164
  return _context15.abrupt("return", this.joinWithMedia(options));
5057
- case 60:
5165
+ case 67:
5058
5166
  this.joinWithMediaRetryInfo = {
5059
5167
  isRetry: false,
5060
5168
  prevJoinResponse: undefined
5061
5169
  };
5062
5170
  throw _context15.t0;
5063
- case 62:
5171
+ case 69:
5064
5172
  case "end":
5065
5173
  return _context15.stop();
5066
5174
  }
5067
- }, _callee15, this, [[9, 40], [45, 50]]);
5175
+ }, _callee15, this, [[9, 45], [50, 55]]);
5068
5176
  }));
5069
5177
  function joinWithMedia() {
5070
5178
  return _joinWithMedia.apply(this, arguments);
@@ -5083,7 +5191,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5083
5191
  }, {
5084
5192
  key: "reconnect",
5085
5193
  value: function reconnect(options) {
5086
- var _this28 = this;
5194
+ var _this29 = this;
5087
5195
  _loggerProxy.default.logger.log("Meeting:index#reconnect --> attempting to reconnect meeting ".concat(this.id));
5088
5196
  if (!this.reconnectionManager || !this.reconnectionManager.reconnect) {
5089
5197
  return _promise.default.reject(new _parameter.default('Cannot reconnect, ReconnectionManager must first be defined.'));
@@ -5098,10 +5206,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5098
5206
  while (1) switch (_context16.prev = _context16.next) {
5099
5207
  case 0:
5100
5208
  _context16.next = 2;
5101
- return _this28.waitForRemoteSDPAnswer();
5209
+ return _this29.waitForRemoteSDPAnswer();
5102
5210
  case 2:
5103
5211
  _context16.next = 4;
5104
- return _this28.waitForMediaConnectionConnected();
5212
+ return _this29.waitForMediaConnectionConnected();
5105
5213
  case 4:
5106
5214
  case "end":
5107
5215
  return _context16.stop();
@@ -5115,7 +5223,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5115
5223
  return _promise.default.resolve();
5116
5224
  }
5117
5225
  _loggerProxy.default.logger.error('Meeting:index#reconnect --> Meeting reconnect failed', error);
5118
- _this28.uploadLogs({
5226
+ _this29.uploadLogs({
5119
5227
  file: 'meeting/index',
5120
5228
  function: 'reconnect'
5121
5229
  });
@@ -5162,19 +5270,19 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5162
5270
  }, {
5163
5271
  key: "setCaptionLanguage",
5164
5272
  value: function setCaptionLanguage(language) {
5165
- var _this29 = this;
5273
+ var _this30 = this;
5166
5274
  return new _promise.default(function (resolve, reject) {
5167
- if (!_this29.isTranscriptionSupported()) {
5275
+ if (!_this30.isTranscriptionSupported()) {
5168
5276
  _loggerProxy.default.logger.error('Meeting:index#setCaptionLanguage --> Webex Assistant is not enabled/supported');
5169
5277
  reject(new Error('Webex Assistant is not enabled/supported'));
5170
5278
  }
5171
5279
  try {
5172
5280
  var voiceaListenerCaptionUpdate = function voiceaListenerCaptionUpdate(payload) {
5173
5281
  // @ts-ignore
5174
- _this29.webex.internal.voicea.off(_internalPluginVoicea.EVENT_TRIGGERS.CAPTION_LANGUAGE_UPDATE, voiceaListenerCaptionUpdate);
5282
+ _this30.webex.internal.voicea.off(_internalPluginVoicea.EVENT_TRIGGERS.CAPTION_LANGUAGE_UPDATE, voiceaListenerCaptionUpdate);
5175
5283
  var statusCode = payload.statusCode;
5176
5284
  if (statusCode === 200) {
5177
- _this29.transcription.languageOptions = _objectSpread(_objectSpread({}, _this29.transcription.languageOptions), {}, {
5285
+ _this30.transcription.languageOptions = _objectSpread(_objectSpread({}, _this30.transcription.languageOptions), {}, {
5178
5286
  currentCaptionLanguage: language
5179
5287
  });
5180
5288
  resolve(language);
@@ -5183,9 +5291,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5183
5291
  }
5184
5292
  };
5185
5293
  // @ts-ignore
5186
- _this29.webex.internal.voicea.on(_internalPluginVoicea.EVENT_TRIGGERS.CAPTION_LANGUAGE_UPDATE, voiceaListenerCaptionUpdate);
5294
+ _this30.webex.internal.voicea.on(_internalPluginVoicea.EVENT_TRIGGERS.CAPTION_LANGUAGE_UPDATE, voiceaListenerCaptionUpdate);
5187
5295
  // @ts-ignore
5188
- _this29.webex.internal.voicea.requestLanguage(language);
5296
+ _this30.webex.internal.voicea.requestLanguage(language);
5189
5297
  } catch (error) {
5190
5298
  _loggerProxy.default.logger.error("Meeting:index#setCaptionLanguage --> ".concat(error));
5191
5299
  reject(error);
@@ -5201,19 +5309,23 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5201
5309
  }, {
5202
5310
  key: "setSpokenLanguage",
5203
5311
  value: function setSpokenLanguage(language) {
5204
- var _this30 = this;
5312
+ var _this31 = this;
5205
5313
  return new _promise.default(function (resolve, reject) {
5206
- if (!_this30.isTranscriptionSupported()) {
5314
+ if (!_this31.isTranscriptionSupported()) {
5207
5315
  _loggerProxy.default.logger.error('Meeting:index#setCaptionLanguage --> Webex Assistant is not enabled/supported');
5208
5316
  reject(new Error('Webex Assistant is not enabled/supported'));
5209
5317
  }
5318
+ if (_this31.getCurUserType() !== 'host') {
5319
+ _loggerProxy.default.logger.error('Meeting:index#setSpokenLanguage --> Only host can set spoken language');
5320
+ reject(new Error('Only host can set spoken language'));
5321
+ }
5210
5322
  try {
5211
5323
  var voiceaListenerLanguageUpdate = function voiceaListenerLanguageUpdate(payload) {
5212
5324
  // @ts-ignore
5213
- _this30.webex.internal.voicea.off(_internalPluginVoicea.EVENT_TRIGGERS.SPOKEN_LANGUAGE_UPDATE, voiceaListenerLanguageUpdate);
5325
+ _this31.webex.internal.voicea.off(_internalPluginVoicea.EVENT_TRIGGERS.SPOKEN_LANGUAGE_UPDATE, voiceaListenerLanguageUpdate);
5214
5326
  var languageCode = payload.languageCode;
5215
5327
  if (languageCode) {
5216
- _this30.transcription.languageOptions = _objectSpread(_objectSpread({}, _this30.transcription.languageOptions), {}, {
5328
+ _this31.transcription.languageOptions = _objectSpread(_objectSpread({}, _this31.transcription.languageOptions), {}, {
5217
5329
  currentSpokenLanguage: languageCode
5218
5330
  });
5219
5331
  resolve(languageCode);
@@ -5223,10 +5335,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5223
5335
  };
5224
5336
 
5225
5337
  // @ts-ignore
5226
- _this30.webex.internal.voicea.on(_internalPluginVoicea.EVENT_TRIGGERS.SPOKEN_LANGUAGE_UPDATE, voiceaListenerLanguageUpdate);
5338
+ _this31.webex.internal.voicea.on(_internalPluginVoicea.EVENT_TRIGGERS.SPOKEN_LANGUAGE_UPDATE, voiceaListenerLanguageUpdate);
5227
5339
 
5228
5340
  // @ts-ignore
5229
- _this30.webex.internal.voicea.setSpokenLanguage(language);
5341
+ _this31.webex.internal.voicea.setSpokenLanguage(language);
5230
5342
  } catch (error) {
5231
5343
  _loggerProxy.default.logger.error("Meeting:index#setSpokenLanguage --> ".concat(error));
5232
5344
  reject(error);
@@ -5248,7 +5360,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5248
5360
  while (1) switch (_context17.prev = _context17.next) {
5249
5361
  case 0:
5250
5362
  if (!this.isJoined()) {
5251
- _context17.next = 15;
5363
+ _context17.next = 14;
5252
5364
  break;
5253
5365
  }
5254
5366
  _loggerProxy.default.logger.info('Meeting:index#startTranscription --> Attempting to enable transcription!');
@@ -5256,17 +5368,15 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5256
5368
  if (!this.areVoiceaEventsSetup) {
5257
5369
  this.setUpVoiceaListeners();
5258
5370
  }
5259
- if (!(this.getCurUserType() === 'host')) {
5260
- _context17.next = 7;
5261
- break;
5262
- }
5263
- _context17.next = 7;
5371
+
5372
+ // @ts-ignore
5373
+ _context17.next = 6;
5264
5374
  return this.webex.internal.voicea.turnOnCaptions(options === null || options === void 0 ? void 0 : options.spokenLanguage);
5265
- case 7:
5266
- _context17.next = 13;
5375
+ case 6:
5376
+ _context17.next = 12;
5267
5377
  break;
5268
- case 9:
5269
- _context17.prev = 9;
5378
+ case 8:
5379
+ _context17.prev = 8;
5270
5380
  _context17.t0 = _context17["catch"](2);
5271
5381
  _loggerProxy.default.logger.error("Meeting:index#startTranscription --> ".concat(_context17.t0));
5272
5382
  _metrics.default.sendBehavioralMetric(_constants2.default.RECEIVE_TRANSCRIPTION_FAILURE, {
@@ -5274,17 +5384,17 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5274
5384
  reason: _context17.t0.message,
5275
5385
  stack: _context17.t0.stack
5276
5386
  });
5277
- case 13:
5278
- _context17.next = 17;
5387
+ case 12:
5388
+ _context17.next = 16;
5279
5389
  break;
5280
- case 15:
5390
+ case 14:
5281
5391
  _loggerProxy.default.logger.error("Meeting:index#startTranscription --> meeting joined : ".concat(this.isJoined()));
5282
5392
  throw new Error('Meeting is not joined');
5283
- case 17:
5393
+ case 16:
5284
5394
  case "end":
5285
5395
  return _context17.stop();
5286
5396
  }
5287
- }, _callee17, this, [[2, 9]]);
5397
+ }, _callee17, this, [[2, 8]]);
5288
5398
  }));
5289
5399
  function startTranscription(_x15) {
5290
5400
  return _startTranscription.apply(this, arguments);
@@ -5348,7 +5458,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5348
5458
  */
5349
5459
  function () {
5350
5460
  var _join = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
5351
- var _this31 = this;
5461
+ var _this32 = this;
5352
5462
  var options,
5353
5463
  errorMessage,
5354
5464
  error,
@@ -5494,57 +5604,58 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5494
5604
  return _context18.abrupt("return", _promise.default.reject(_context18.t0));
5495
5605
  case 51:
5496
5606
  return _context18.abrupt("return", _util2.default.joinMeetingOptions(this, options).then(function (join) {
5497
- _this31.meetingFiniteStateMachine.join();
5607
+ _this32.meetingFiniteStateMachine.join();
5608
+ _this32.setupLocusMediaRequest();
5498
5609
  _loggerProxy.default.logger.log('Meeting:index#join --> Success');
5499
5610
  _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_SUCCESS, {
5500
- correlation_id: _this31.correlationId
5611
+ correlation_id: _this32.correlationId
5501
5612
  });
5502
5613
  joinSuccess(join);
5503
- _this31.deferJoin = undefined;
5614
+ _this32.deferJoin = undefined;
5504
5615
  return join;
5505
5616
  }).catch(function (error) {
5506
- var _this31$meetingInfo, _error$error;
5507
- _this31.meetingFiniteStateMachine.fail(error);
5617
+ var _this32$meetingInfo, _error$error;
5618
+ _this32.meetingFiniteStateMachine.fail(error);
5508
5619
  _loggerProxy.default.logger.error('Meeting:index#join --> Failed', error);
5509
5620
 
5510
5621
  // @ts-ignore
5511
- _this31.webex.internal.newMetrics.submitClientEvent({
5622
+ _this32.webex.internal.newMetrics.submitClientEvent({
5512
5623
  name: 'client.locus.join.response',
5513
5624
  payload: {
5514
5625
  identifiers: {
5515
- meetingLookupUrl: (_this31$meetingInfo = _this31.meetingInfo) === null || _this31$meetingInfo === void 0 ? void 0 : _this31$meetingInfo.meetingLookupUrl
5626
+ meetingLookupUrl: (_this32$meetingInfo = _this32.meetingInfo) === null || _this32$meetingInfo === void 0 ? void 0 : _this32$meetingInfo.meetingLookupUrl
5516
5627
  }
5517
5628
  },
5518
5629
  options: {
5519
- meetingId: _this31.id,
5630
+ meetingId: _this32.id,
5520
5631
  rawError: error
5521
5632
  }
5522
5633
  });
5523
5634
 
5524
5635
  // TODO: change this to error codes and pre defined dictionary
5525
5636
  _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_FAILURE, {
5526
- correlation_id: _this31.correlationId,
5637
+ correlation_id: _this32.correlationId,
5527
5638
  reason: (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message,
5528
5639
  stack: error.stack
5529
5640
  });
5530
5641
 
5531
5642
  // Upload logs on join Failure
5532
- _triggerProxy.default.trigger(_this31, {
5643
+ _triggerProxy.default.trigger(_this32, {
5533
5644
  file: 'meeting/index',
5534
5645
  function: 'join'
5535
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this31);
5646
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this32);
5536
5647
  joinFailed(error);
5537
- _this31.deferJoin = undefined;
5648
+ _this32.deferJoin = undefined;
5538
5649
  return _promise.default.reject(error);
5539
5650
  }).then(function (join) {
5540
5651
  // @ts-ignore - config coming from registerPlugin
5541
- if (_this31.config.enableAutomaticLLM) {
5652
+ if (_this32.config.enableAutomaticLLM) {
5542
5653
  // @ts-ignore
5543
- _this31.webex.internal.llm.on('online', _this31.handleLLMOnline);
5544
- _this31.updateLLMConnection().catch(function (error) {
5654
+ _this32.webex.internal.llm.on('online', _this32.handleLLMOnline);
5655
+ _this32.updateLLMConnection().catch(function (error) {
5545
5656
  _loggerProxy.default.logger.error('Meeting:index#join --> Transcription Socket Connection Failed', error);
5546
5657
  _metrics.default.sendBehavioralMetric(_constants2.default.LLM_CONNECTION_AFTER_JOIN_FAILURE, {
5547
- correlation_id: _this31.correlationId,
5658
+ correlation_id: _this32.correlationId,
5548
5659
  reason: error === null || error === void 0 ? void 0 : error.message,
5549
5660
  stack: error.stack
5550
5661
  });
@@ -5576,7 +5687,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5576
5687
  key: "updateLLMConnection",
5577
5688
  value: (function () {
5578
5689
  var _updateLLMConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
5579
- var _this32 = this;
5690
+ var _this33 = this;
5580
5691
  var _this$locusInfo6, url, _this$locusInfo6$info, _this$locusInfo6$info2, datachannelUrl, isJoined;
5581
5692
  return _regenerator.default.wrap(function _callee19$(_context19) {
5582
5693
  while (1) switch (_context19.prev = _context19.next) {
@@ -5588,7 +5699,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5588
5699
  _context19.next = 8;
5589
5700
  break;
5590
5701
  }
5591
- if (!(url === this.webex.internal.llm.getLocusUrl() && isJoined)) {
5702
+ if (!(
5703
+ // @ts-ignore - Fix type
5704
+ url === this.webex.internal.llm.getLocusUrl() &&
5705
+ // @ts-ignore - Fix type
5706
+ datachannelUrl === this.webex.internal.llm.getDatachannelUrl() && isJoined)) {
5592
5707
  _context19.next = 5;
5593
5708
  break;
5594
5709
  }
@@ -5608,9 +5723,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5608
5723
  case 10:
5609
5724
  return _context19.abrupt("return", this.webex.internal.llm.registerAndConnect(url, datachannelUrl).then(function (registerAndConnectResult) {
5610
5725
  // @ts-ignore - Fix type
5611
- _this32.webex.internal.llm.off('event:relay.event', _this32.processRelayEvent);
5726
+ _this33.webex.internal.llm.off('event:relay.event', _this33.processRelayEvent);
5612
5727
  // @ts-ignore - Fix type
5613
- _this32.webex.internal.llm.on('event:relay.event', _this32.processRelayEvent);
5728
+ _this33.webex.internal.llm.on('event:relay.event', _this33.processRelayEvent);
5614
5729
  _loggerProxy.default.logger.info('Meeting:index#updateLLMConnection --> enabled to receive relay events!');
5615
5730
  return _promise.default.resolve(registerAndConnectResult);
5616
5731
  }));
@@ -5664,7 +5779,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5664
5779
  }, {
5665
5780
  key: "dialInPstn",
5666
5781
  value: function dialInPstn() {
5667
- var _this33 = this;
5782
+ var _this34 = this;
5668
5783
  if (this.isPhoneProvisioned(this.dialInDeviceStatus)) return _promise.default.resolve(); // prevent multiple dial in devices from being provisioned
5669
5784
 
5670
5785
  var correlationId = this.correlationId,
@@ -5680,10 +5795,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5680
5795
  }).catch(function (error) {
5681
5796
  var _error$error2;
5682
5797
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_DIAL_IN_FAILURE, {
5683
- correlation_id: _this33.correlationId,
5684
- dial_in_url: _this33.dialInUrl,
5798
+ correlation_id: _this34.correlationId,
5799
+ dial_in_url: _this34.dialInUrl,
5685
5800
  locus_id: locusUrl.split('/').pop(),
5686
- client_url: _this33.deviceUrl,
5801
+ client_url: _this34.deviceUrl,
5687
5802
  reason: (_error$error2 = error.error) === null || _error$error2 === void 0 ? void 0 : _error$error2.message,
5688
5803
  stack: error.stack
5689
5804
  });
@@ -5701,7 +5816,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5701
5816
  }, {
5702
5817
  key: "dialOutPstn",
5703
5818
  value: function dialOutPstn(phoneNumber) {
5704
- var _this34 = this;
5819
+ var _this35 = this;
5705
5820
  if (this.isPhoneProvisioned(this.dialOutDeviceStatus)) return _promise.default.resolve(); // prevent multiple dial out devices from being provisioned
5706
5821
 
5707
5822
  var correlationId = this.correlationId,
@@ -5718,10 +5833,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5718
5833
  }).catch(function (error) {
5719
5834
  var _error$error3;
5720
5835
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_DIAL_OUT_FAILURE, {
5721
- correlation_id: _this34.correlationId,
5722
- dial_out_url: _this34.dialOutUrl,
5836
+ correlation_id: _this35.correlationId,
5837
+ dial_out_url: _this35.dialOutUrl,
5723
5838
  locus_id: locusUrl.split('/').pop(),
5724
- client_url: _this34.deviceUrl,
5839
+ client_url: _this35.deviceUrl,
5725
5840
  reason: (_error$error3 = error.error) === null || _error$error3 === void 0 ? void 0 : _error$error3.message,
5726
5841
  stack: error.stack
5727
5842
  });
@@ -5752,7 +5867,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5752
5867
  }, {
5753
5868
  key: "moveTo",
5754
5869
  value: function moveTo(resourceId) {
5755
- var _this35 = this;
5870
+ var _this36 = this;
5756
5871
  if (!resourceId) {
5757
5872
  throw new _parameter.default('Cannot move call without a resourceId.');
5758
5873
  }
@@ -5796,12 +5911,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5796
5911
  while (1) switch (_context20.prev = _context20.next) {
5797
5912
  case 0:
5798
5913
  _context20.prev = 0;
5799
- if (!(_this35.screenShareFloorState === ScreenShareFloorStatus.GRANTED)) {
5914
+ if (!(_this36.screenShareFloorState === ScreenShareFloorStatus.GRANTED)) {
5800
5915
  _context20.next = 4;
5801
5916
  break;
5802
5917
  }
5803
5918
  _context20.next = 4;
5804
- return _this35.releaseScreenShareFloor();
5919
+ return _this36.releaseScreenShareFloor();
5805
5920
  case 4:
5806
5921
  mediaSettings = {
5807
5922
  mediaDirection: {
@@ -5813,37 +5928,37 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5813
5928
  receiveShare: true
5814
5929
  }
5815
5930
  };
5816
- _this35.mediaProperties.setMediaDirection(mediaSettings.mediaDirection);
5817
- _this35.mediaProperties.unsetRemoteMedia();
5931
+ _this36.mediaProperties.setMediaDirection(mediaSettings.mediaDirection);
5932
+ _this36.mediaProperties.unsetRemoteMedia();
5818
5933
 
5819
5934
  // 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
5820
5935
  // once the device answers we close the old connection and create new media server connection with only share enabled
5821
- if (!_this35.statsAnalyzer) {
5936
+ if (!_this36.statsAnalyzer) {
5822
5937
  _context20.next = 10;
5823
5938
  break;
5824
5939
  }
5825
5940
  _context20.next = 10;
5826
- return _this35.statsAnalyzer.stopAnalyzer();
5941
+ return _this36.statsAnalyzer.stopAnalyzer();
5827
5942
  case 10:
5828
5943
  _context20.next = 12;
5829
- return _this35.closeRemoteStreams();
5944
+ return _this36.closeRemoteStreams();
5830
5945
  case 12:
5831
5946
  _context20.next = 14;
5832
- return _this35.closePeerConnections();
5947
+ return _this36.closePeerConnections();
5833
5948
  case 14:
5834
- _this35.cleanupLocalStreams();
5835
- _this35.unsetRemoteStreams();
5836
- _this35.unsetPeerConnections();
5837
- _this35.reconnectionManager.cleanUp();
5949
+ _this36.cleanupLocalStreams();
5950
+ _this36.unsetRemoteStreams();
5951
+ _this36.unsetPeerConnections();
5952
+ _this36.reconnectionManager.cleanUp();
5838
5953
  _context20.next = 20;
5839
- return _this35.addMedia({
5954
+ return _this36.addMedia({
5840
5955
  audioEnabled: false,
5841
5956
  videoEnabled: false,
5842
5957
  shareVideoEnabled: true
5843
5958
  });
5844
5959
  case 20:
5845
5960
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_SUCCESS);
5846
- _this35.isMoveToInProgress = false;
5961
+ _this36.isMoveToInProgress = false;
5847
5962
  _context20.next = 29;
5848
5963
  break;
5849
5964
  case 24:
@@ -5851,12 +5966,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5851
5966
  _context20.t0 = _context20["catch"](0);
5852
5967
  _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', _context20.t0);
5853
5968
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_FAILURE, {
5854
- correlation_id: _this35.correlationId,
5855
- locus_id: _this35.locusUrl.split('/').pop(),
5969
+ correlation_id: _this36.correlationId,
5970
+ locus_id: _this36.locusUrl.split('/').pop(),
5856
5971
  reason: _context20.t0.message,
5857
5972
  stack: _context20.t0.stack
5858
5973
  });
5859
- _this35.isMoveToInProgress = false;
5974
+ _this36.isMoveToInProgress = false;
5860
5975
  case 29:
5861
5976
  case "end":
5862
5977
  return _context20.stop();
@@ -5872,17 +5987,17 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5872
5987
  resourceId: resourceId,
5873
5988
  moveToResource: true
5874
5989
  }).then(function () {
5875
- _this35.meetingFiniteStateMachine.join();
5990
+ _this36.meetingFiniteStateMachine.join();
5876
5991
  }).catch(function (error) {
5877
- _this35.meetingFiniteStateMachine.fail(error);
5992
+ _this36.meetingFiniteStateMachine.fail(error);
5878
5993
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_FAILURE, {
5879
- correlation_id: _this35.correlationId,
5880
- locus_id: _this35.locusUrl.split('/').pop(),
5994
+ correlation_id: _this36.correlationId,
5995
+ locus_id: _this36.locusUrl.split('/').pop(),
5881
5996
  reason: error.message,
5882
5997
  stack: error.stack
5883
5998
  });
5884
5999
  _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', error);
5885
- _this35.isMoveToInProgress = false;
6000
+ _this36.isMoveToInProgress = false;
5886
6001
  return _promise.default.reject(error);
5887
6002
  });
5888
6003
  }
@@ -5897,7 +6012,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5897
6012
  }, {
5898
6013
  key: "moveFrom",
5899
6014
  value: function moveFrom(resourceId) {
5900
- var _this36 = this;
6015
+ var _this37 = this;
5901
6016
  // On moveFrom ask the developer to re capture it moveFrom then updateMedia
5902
6017
  if (!resourceId) {
5903
6018
  throw new _parameter.default('Cannot move call without a resourceId.');
@@ -5912,19 +6027,19 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5912
6027
  }
5913
6028
  });
5914
6029
  return _util2.default.joinMeetingOptions(this).then(function () {
5915
- return _util2.default.leaveMeeting(_this36, {
6030
+ return _util2.default.leaveMeeting(_this37, {
5916
6031
  resourceId: resourceId,
5917
6032
  correlationId: oldCorrelationId,
5918
6033
  moveMeeting: true
5919
6034
  }).then(function () {
5920
- _this36.resourceId = '';
6035
+ _this37.resourceId = '';
5921
6036
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_FROM_SUCCESS);
5922
6037
  });
5923
6038
  }).catch(function (error) {
5924
- _this36.meetingFiniteStateMachine.fail(error);
6039
+ _this37.meetingFiniteStateMachine.fail(error);
5925
6040
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_FROM_FAILURE, {
5926
- correlation_id: _this36.correlationId,
5927
- locus_id: _this36.locusUrl.split('/').pop(),
6041
+ correlation_id: _this37.correlationId,
6042
+ locus_id: _this37.locusUrl.split('/').pop(),
5928
6043
  reason: error.message,
5929
6044
  stack: error.stack
5930
6045
  });
@@ -6031,9 +6146,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6031
6146
  }, {
6032
6147
  key: "forwardEvent",
6033
6148
  value: function forwardEvent(eventEmitter, eventTypeToForward, meetingEventType) {
6034
- var _this37 = this;
6149
+ var _this38 = this;
6035
6150
  eventEmitter.on(eventTypeToForward, function (data) {
6036
- return _triggerProxy.default.trigger(_this37, {
6151
+ return _triggerProxy.default.trigger(_this38, {
6037
6152
  file: 'meetings',
6038
6153
  function: 'addMedia'
6039
6154
  }, meetingEventType, data);
@@ -6103,7 +6218,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6103
6218
  key: "waitForMediaConnectionConnected",
6104
6219
  value: (function () {
6105
6220
  var _waitForMediaConnectionConnected = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
6106
- var _this$mediaProperties6, _this$mediaProperties7, _this$mediaProperties8, _this$mediaProperties9, _this$mediaProperties10, _this$mediaProperties11, _this$mediaProperties12, _this$mediaProperties13, _this$mediaProperties14, _this$mediaProperties15, _this$mediaProperties16, _this$mediaProperties17, _this$mediaProperties18, _this$mediaProperties19;
6221
+ var iceConnected, _this$mediaProperties6, _this$mediaProperties7, _this$mediaProperties8, _this$mediaProperties9, _this$mediaProperties10, _this$mediaProperties11, _this$mediaProperties12;
6107
6222
  return _regenerator.default.wrap(function _callee23$(_context23) {
6108
6223
  while (1) switch (_context23.prev = _context23.next) {
6109
6224
  case 0:
@@ -6111,37 +6226,59 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6111
6226
  _context23.next = 3;
6112
6227
  return this.mediaProperties.waitForMediaConnectionConnected();
6113
6228
  case 3:
6114
- _context23.next = 9;
6229
+ _context23.next = 30;
6115
6230
  break;
6116
6231
  case 5:
6117
6232
  _context23.prev = 5;
6118
6233
  _context23.t0 = _context23["catch"](0);
6119
- if (!this.hasMediaConnectionConnectedAtLeastOnce) {
6120
- // Only send CA event for join flow if we haven't successfully connected media yet
6121
- // @ts-ignore
6122
- this.webex.internal.newMetrics.submitClientEvent({
6123
- name: 'client.ice.end',
6124
- payload: {
6125
- canProceed: !this.turnServerUsed,
6126
- // If we haven't done turn tls retry yet we will proceed with join attempt
6127
- icePhase: this.turnServerUsed ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY',
6128
- errors: [
6129
- // @ts-ignore
6130
- this.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode({
6131
- clientErrorCode: _internalPluginMetrics.CallDiagnosticUtils.generateClientErrorCodeForIceFailure({
6132
- signalingState: ((_this$mediaProperties6 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties6 === void 0 ? void 0 : (_this$mediaProperties7 = _this$mediaProperties6.multistreamConnection) === null || _this$mediaProperties7 === void 0 ? void 0 : (_this$mediaProperties8 = _this$mediaProperties7.pc) === null || _this$mediaProperties8 === void 0 ? void 0 : (_this$mediaProperties9 = _this$mediaProperties8.pc) === null || _this$mediaProperties9 === void 0 ? void 0 : _this$mediaProperties9.signalingState) || ((_this$mediaProperties10 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties10 === void 0 ? void 0 : (_this$mediaProperties11 = _this$mediaProperties10.mediaConnection) === null || _this$mediaProperties11 === void 0 ? void 0 : (_this$mediaProperties12 = _this$mediaProperties11.pc) === null || _this$mediaProperties12 === void 0 ? void 0 : _this$mediaProperties12.signalingState) || 'unknown',
6133
- iceConnectionState: ((_this$mediaProperties13 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties13 === void 0 ? void 0 : (_this$mediaProperties14 = _this$mediaProperties13.multistreamConnection) === null || _this$mediaProperties14 === void 0 ? void 0 : (_this$mediaProperties15 = _this$mediaProperties14.pc) === null || _this$mediaProperties15 === void 0 ? void 0 : (_this$mediaProperties16 = _this$mediaProperties15.pc) === null || _this$mediaProperties16 === void 0 ? void 0 : _this$mediaProperties16.iceConnectionState) || ((_this$mediaProperties17 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties17 === void 0 ? void 0 : (_this$mediaProperties18 = _this$mediaProperties17.mediaConnection) === null || _this$mediaProperties18 === void 0 ? void 0 : (_this$mediaProperties19 = _this$mediaProperties18.pc) === null || _this$mediaProperties19 === void 0 ? void 0 : _this$mediaProperties19.iceConnectionState) || 'unknown',
6134
- turnServerUsed: this.turnServerUsed
6135
- })
6136
- })]
6137
- },
6138
- options: {
6139
- meetingId: this.id
6140
- }
6141
- });
6234
+ iceConnected = _context23.t0.iceConnected;
6235
+ if (this.hasMediaConnectionConnectedAtLeastOnce) {
6236
+ _context23.next = 29;
6237
+ break;
6142
6238
  }
6239
+ _context23.t1 = this.webex.internal.newMetrics;
6240
+ _context23.t2 = !this.turnServerUsed;
6241
+ _context23.t3 = this.addMediaData.icePhaseCallback();
6242
+ _context23.t4 = this.webex.internal.newMetrics.callDiagnosticMetrics;
6243
+ _context23.t5 = _internalPluginMetrics.CallDiagnosticUtils;
6244
+ _context23.t6 = ((_this$mediaProperties6 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties6 === void 0 ? void 0 : (_this$mediaProperties7 = _this$mediaProperties6.multistreamConnection) === null || _this$mediaProperties7 === void 0 ? void 0 : (_this$mediaProperties8 = _this$mediaProperties7.pc) === null || _this$mediaProperties8 === void 0 ? void 0 : (_this$mediaProperties9 = _this$mediaProperties8.pc) === null || _this$mediaProperties9 === void 0 ? void 0 : _this$mediaProperties9.signalingState) || ((_this$mediaProperties10 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties10 === void 0 ? void 0 : (_this$mediaProperties11 = _this$mediaProperties10.mediaConnection) === null || _this$mediaProperties11 === void 0 ? void 0 : (_this$mediaProperties12 = _this$mediaProperties11.pc) === null || _this$mediaProperties12 === void 0 ? void 0 : _this$mediaProperties12.signalingState) || 'unknown';
6245
+ _context23.t7 = iceConnected;
6246
+ _context23.t8 = this.turnServerUsed;
6247
+ _context23.next = 19;
6248
+ return this.webex.meetings.reachability.isWebexMediaBackendUnreachable().catch(function () {
6249
+ return false;
6250
+ });
6251
+ case 19:
6252
+ _context23.t9 = _context23.sent;
6253
+ _context23.t10 = {
6254
+ signalingState: _context23.t6,
6255
+ iceConnected: _context23.t7,
6256
+ turnServerUsed: _context23.t8,
6257
+ unreachable: _context23.t9
6258
+ };
6259
+ _context23.t11 = _context23.t5.generateClientErrorCodeForIceFailure.call(_context23.t5, _context23.t10);
6260
+ _context23.t12 = {
6261
+ clientErrorCode: _context23.t11
6262
+ };
6263
+ _context23.t13 = _context23.t4.getErrorPayloadForClientErrorCode.call(_context23.t4, _context23.t12);
6264
+ _context23.t14 = [_context23.t13];
6265
+ _context23.t15 = {
6266
+ canProceed: _context23.t2,
6267
+ icePhase: _context23.t3,
6268
+ errors: _context23.t14
6269
+ };
6270
+ _context23.t16 = {
6271
+ meetingId: this.id
6272
+ };
6273
+ _context23.t17 = {
6274
+ name: 'client.ice.end',
6275
+ payload: _context23.t15,
6276
+ options: _context23.t16
6277
+ };
6278
+ _context23.t1.submitClientEvent.call(_context23.t1, _context23.t17);
6279
+ case 29:
6143
6280
  throw new Error("Timed out waiting for media connection to be connected, correlationId=".concat(this.correlationId));
6144
- case 9:
6281
+ case 30:
6145
6282
  case "end":
6146
6283
  return _context23.stop();
6147
6284
  }
@@ -6162,16 +6299,16 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6162
6299
  }, {
6163
6300
  key: "createStatsAnalyzer",
6164
6301
  value: function createStatsAnalyzer() {
6165
- var _this38 = this;
6166
6302
  // @ts-ignore - config coming from registerPlugin
6167
6303
  if (this.config.stats.enableStatsAnalyzer) {
6168
6304
  // @ts-ignore - config coming from registerPlugin
6169
6305
  this.networkQualityMonitor = new _networkQualityMonitor.default(this.config.stats);
6170
- this.statsAnalyzer = new _statsAnalyzer.StatsAnalyzer(
6171
- // @ts-ignore - config coming from registerPlugin
6172
- this.config.stats, function (ssrc) {
6173
- return _this38.receiveSlotManager.findReceiveSlotBySsrc(ssrc);
6174
- }, this.networkQualityMonitor);
6306
+ this.statsAnalyzer = new _internalMediaCore.StatsAnalyzer({
6307
+ // @ts-ignore - config coming from registerPlugin
6308
+ config: this.config.stats,
6309
+ networkQualityMonitor: this.networkQualityMonitor,
6310
+ isMultistream: this.isMultistream
6311
+ });
6175
6312
  this.setupStatsAnalyzerEventHandlers();
6176
6313
  this.networkQualityMonitor.on(_constants.EVENT_TRIGGERS.NETWORK_QUALITY, this.sendNetworkQualityEvent.bind(this));
6177
6314
  }
@@ -6196,6 +6333,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6196
6333
  */
6197
6334
  function () {
6198
6335
  var _waitForRemoteSDPAnswer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
6336
+ var _this39 = this;
6199
6337
  var LOG_HEADER, deferSDPAnswer;
6200
6338
  return _regenerator.default.wrap(function _callee24$(_context24) {
6201
6339
  while (1) switch (_context24.prev = _context24.next) {
@@ -6211,6 +6349,22 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6211
6349
  deferSDPAnswer = this.deferSDPAnswer;
6212
6350
  this.sdpResponseTimer = setTimeout(function () {
6213
6351
  _loggerProxy.default.logger.warn("".concat(LOG_HEADER, " timeout! no REMOTE SDP ANSWER received within ").concat(_constants.ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT / 1000, " seconds"));
6352
+ // @ts-ignore
6353
+ _this39.webex.internal.newMetrics.submitClientEvent({
6354
+ name: 'client.media-engine.remote-sdp-received',
6355
+ payload: {
6356
+ canProceed: false,
6357
+ errors: [
6358
+ // @ts-ignore
6359
+ _this39.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode({
6360
+ clientErrorCode: _internalPluginMetrics.CALL_DIAGNOSTIC_CONFIG.MISSING_ROAP_ANSWER_CLIENT_CODE
6361
+ })]
6362
+ },
6363
+ options: {
6364
+ meetingId: _this39.id,
6365
+ rawError: new Error('Timeout waiting for SDP answer')
6366
+ }
6367
+ });
6214
6368
  deferSDPAnswer.reject(new Error('Timed out waiting for REMOTE SDP ANSWER'));
6215
6369
  }, _constants.ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT);
6216
6370
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " waiting for REMOTE SDP ANSWER..."));
@@ -6284,7 +6438,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6284
6438
  return _regenerator.default.wrap(function _callee26$(_context26) {
6285
6439
  while (1) switch (_context26.prev = _context26.next) {
6286
6440
  case 0:
6287
- this.retriedWithTurnServer = true;
6441
+ this.addMediaData.retriedWithTurnServer = true;
6288
6442
  LOG_HEADER = 'Meeting:index#addMedia():retryWithForcedTurnDiscovery -->';
6289
6443
  _context26.next = 4;
6290
6444
  return this.cleanUpBeforeRetryWithTurnServer();
@@ -6400,7 +6554,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6400
6554
  correlation_id: this.correlationId,
6401
6555
  latency: cdl.getTurnDiscoveryTime(),
6402
6556
  turnServerUsed: this.turnServerUsed,
6403
- retriedWithTurnServer: this.retriedWithTurnServer
6557
+ retriedWithTurnServer: this.addMediaData.retriedWithTurnServer
6404
6558
  });
6405
6559
  }
6406
6560
  return _context28.abrupt("return", turnDiscoveryResult);
@@ -6430,12 +6584,13 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6430
6584
  key: "establishMediaConnection",
6431
6585
  value: (function () {
6432
6586
  var _establishMediaConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29(remoteMediaManagerConfig, bundlePolicy, isForced, turnServerInfo) {
6587
+ var _this$locusMediaReque;
6433
6588
  var LOG_HEADER, isReconnecting, _yield$this$doTurnDis, mc;
6434
6589
  return _regenerator.default.wrap(function _callee29$(_context29) {
6435
6590
  while (1) switch (_context29.prev = _context29.next) {
6436
6591
  case 0:
6437
6592
  LOG_HEADER = 'Meeting:index#addMedia():establishMediaConnection -->';
6438
- isReconnecting = this.isMoveToInProgress || this.retriedWithTurnServer; // We are forcing turn discovery if the case is moveTo and a turn server was used already
6593
+ 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
6439
6594
  if (this.isMoveToInProgress && this.turnServerUsed) {
6440
6595
  isForced = true;
6441
6596
  }
@@ -6593,23 +6748,70 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6593
6748
  }
6594
6749
  return cleanUpBeforeRetryWithTurnServer;
6595
6750
  }()
6751
+ /**
6752
+ * Creates an instance of LocusMediaRequest for this meeting - it is needed for doing any calls
6753
+ * to Locus /media API (these are used for sending Roap messages and updating audio/video mute status).
6754
+ *
6755
+ * @returns {void}
6756
+ */
6757
+ )
6758
+ }, {
6759
+ key: "setupLocusMediaRequest",
6760
+ value: function setupLocusMediaRequest() {
6761
+ var _this$webex$meetings$2, _this$webex$meetings$3;
6762
+ this.locusMediaRequest = new _locusMediaRequest.LocusMediaRequest({
6763
+ correlationId: this.correlationId,
6764
+ meetingId: this.id,
6765
+ device: {
6766
+ url: this.deviceUrl,
6767
+ // @ts-ignore
6768
+ deviceType: this.config.deviceType,
6769
+ // @ts-ignore
6770
+ countryCode: (_this$webex$meetings$2 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$2 === void 0 ? void 0 : _this$webex$meetings$2.countryCode,
6771
+ // @ts-ignore
6772
+ regionCode: (_this$webex$meetings$3 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$3 === void 0 ? void 0 : _this$webex$meetings$3.regionCode
6773
+ },
6774
+ preferTranscoding: !this.isMultistream
6775
+ }, {
6776
+ // @ts-ignore
6777
+ parent: this.webex
6778
+ });
6779
+ }
6780
+
6596
6781
  /**
6597
6782
  * Creates a media connection to the server. Media connection is required for sending or receiving any audio/video.
6598
6783
  *
6599
6784
  * @param {AddMediaOptions} options
6600
- * @param {TurnServerInfo} turnServerInfo - TURN server information (used only internally by the SDK)
6601
6785
  * @returns {Promise<void>}
6602
6786
  * @public
6603
6787
  * @memberof Meeting
6604
6788
  */
6605
- )
6606
6789
  }, {
6607
6790
  key: "addMedia",
6791
+ value: function addMedia() {
6792
+ var _this40 = this;
6793
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6794
+ return this.addMediaInternal(function () {
6795
+ return _this40.turnServerUsed ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY';
6796
+ }, undefined, false, options);
6797
+ }
6798
+
6799
+ /**
6800
+ * Internal version of addMedia() with some more arguments for finer control of its behavior
6801
+ *
6802
+ * @param {Function} icePhaseCallback - callback to determine the icePhase for CA "client.ice.end" failure events
6803
+ * @param {TurnServerInfo} turnServerInfo - TURN server information
6804
+ * @param {boolean} forceTurnDiscovery - if true, TURN discovery will be done
6805
+ * @param {AddMediaOptions} options - same as options of the public addMedia() method
6806
+ * @returns {Promise<void>}
6807
+ * @protected
6808
+ * @memberof Meeting
6809
+ */
6810
+ }, {
6811
+ key: "addMediaInternal",
6608
6812
  value: (function () {
6609
- var _addMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
6610
- var _this$webex$meetings$2, _this$webex$meetings$3;
6813
+ var _addMediaInternal = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32(icePhaseCallback, turnServerInfo, forceTurnDiscovery) {
6611
6814
  var options,
6612
- turnServerInfo,
6613
6815
  LOG_HEADER,
6614
6816
  localStreams,
6615
6817
  _options$audioEnabled,
@@ -6628,6 +6830,13 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6628
6830
  selectedCandidatePairChanges,
6629
6831
  numTransports,
6630
6832
  reachabilityStats,
6833
+ _this$mediaProperties13,
6834
+ _this$mediaProperties14,
6835
+ _this$mediaProperties15,
6836
+ _this$mediaProperties16,
6837
+ _this$mediaProperties17,
6838
+ _this$mediaProperties18,
6839
+ _this$mediaProperties19,
6631
6840
  _this$mediaProperties20,
6632
6841
  _this$mediaProperties21,
6633
6842
  _this$mediaProperties22,
@@ -6642,27 +6851,21 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6642
6851
  _this$mediaProperties31,
6643
6852
  _this$mediaProperties32,
6644
6853
  _this$mediaProperties33,
6645
- _this$mediaProperties34,
6646
- _this$mediaProperties35,
6647
- _this$mediaProperties36,
6648
- _this$mediaProperties37,
6649
- _this$mediaProperties38,
6650
- _this$mediaProperties39,
6651
- _this$mediaProperties40,
6652
6854
  reachabilityMetrics,
6653
6855
  _yield$this$mediaProp2,
6654
6856
  _selectedCandidatePairChanges,
6655
6857
  _numTransports,
6858
+ iceCandidateErrors,
6656
6859
  _args32 = arguments;
6657
6860
  return _regenerator.default.wrap(function _callee32$(_context32) {
6658
6861
  while (1) switch (_context32.prev = _context32.next) {
6659
6862
  case 0:
6660
- options = _args32.length > 0 && _args32[0] !== undefined ? _args32[0] : {};
6661
- turnServerInfo = _args32.length > 1 && _args32[1] !== undefined ? _args32[1] : undefined;
6662
- this.retriedWithTurnServer = false;
6863
+ options = _args32.length > 3 && _args32[3] !== undefined ? _args32[3] : {};
6864
+ this.addMediaData.retriedWithTurnServer = false;
6865
+ this.addMediaData.icePhaseCallback = icePhaseCallback;
6663
6866
  this.hasMediaConnectionConnectedAtLeastOnce = false;
6664
6867
  LOG_HEADER = 'Meeting:index#addMedia -->';
6665
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " called with: ").concat((0, _stringify.default)(options), ", ").concat((0, _stringify.default)(turnServerInfo)));
6868
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " called with: options=").concat((0, _stringify.default)(options), ", turnServerInfo=").concat((0, _stringify.default)(turnServerInfo), ", forceTurnDiscovery=").concat(forceTurnDiscovery));
6666
6869
  if (!(options.allowMediaInLobby !== true && this.meetingState !== _constants.FULL_STATE.ACTIVE)) {
6667
6870
  _context32.next = 8;
6668
6871
  break;
@@ -6722,74 +6925,59 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6722
6925
  receiveVideo: videoEnabled,
6723
6926
  receiveShare: shareAudioEnabled || shareVideoEnabled
6724
6927
  });
6725
- this.locusMediaRequest = new _locusMediaRequest.LocusMediaRequest({
6726
- correlationId: this.correlationId,
6727
- meetingId: this.id,
6728
- device: {
6729
- url: this.deviceUrl,
6730
- // @ts-ignore
6731
- deviceType: this.config.deviceType,
6732
- // @ts-ignore
6733
- countryCode: (_this$webex$meetings$2 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$2 === void 0 ? void 0 : _this$webex$meetings$2.countryCode,
6734
- // @ts-ignore
6735
- regionCode: (_this$webex$meetings$3 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$3 === void 0 ? void 0 : _this$webex$meetings$3.regionCode
6736
- },
6737
- preferTranscoding: !this.isMultistream
6738
- }, {
6739
- // @ts-ignore
6740
- parent: this.webex
6741
- });
6742
6928
  this.audio = (0, _muteState.createMuteState)(_constants.AUDIO, this, audioEnabled);
6743
6929
  this.video = (0, _muteState.createMuteState)(_constants.VIDEO, this, videoEnabled);
6744
- _context32.prev = 19;
6745
- _context32.next = 22;
6930
+ _context32.prev = 18;
6931
+ _context32.next = 21;
6746
6932
  return this.setUpLocalStreamReferences(localStreams);
6747
- case 22:
6933
+ case 21:
6748
6934
  this.setMercuryListener();
6749
6935
  this.createStatsAnalyzer();
6750
- _context32.next = 26;
6751
- return this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, false, turnServerInfo);
6752
- case 26:
6936
+ _context32.next = 25;
6937
+ return this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, forceTurnDiscovery, turnServerInfo);
6938
+ case 25:
6753
6939
  if (!(audioEnabled || videoEnabled)) {
6754
- _context32.next = 31;
6940
+ _context32.next = 30;
6755
6941
  break;
6756
6942
  }
6757
- _context32.next = 29;
6943
+ _context32.next = 28;
6758
6944
  return Meeting.handleDeviceLogging();
6759
- case 29:
6760
- _context32.next = 32;
6945
+ case 28:
6946
+ _context32.next = 31;
6761
6947
  break;
6762
- case 31:
6948
+ case 30:
6763
6949
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " device logging not required"));
6764
- case 32:
6950
+ case 31:
6765
6951
  if (!this.mediaProperties.hasLocalShareStream()) {
6766
- _context32.next = 35;
6952
+ _context32.next = 34;
6767
6953
  break;
6768
6954
  }
6769
- _context32.next = 35;
6955
+ _context32.next = 34;
6770
6956
  return this.enqueueScreenShareFloorRequest();
6771
- case 35:
6772
- _context32.next = 37;
6957
+ case 34:
6958
+ _context32.next = 36;
6773
6959
  return this.mediaProperties.getCurrentConnectionInfo();
6774
- case 37:
6960
+ case 36:
6775
6961
  _yield$this$mediaProp = _context32.sent;
6776
6962
  connectionType = _yield$this$mediaProp.connectionType;
6777
6963
  selectedCandidatePairChanges = _yield$this$mediaProp.selectedCandidatePairChanges;
6778
6964
  numTransports = _yield$this$mediaProp.numTransports;
6779
- _context32.next = 43;
6965
+ _context32.next = 42;
6780
6966
  return this.webex.meetings.reachability.getReachabilityMetrics();
6781
- case 43:
6967
+ case 42:
6782
6968
  reachabilityStats = _context32.sent;
6783
- _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_SUCCESS, _objectSpread({
6969
+ _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_SUCCESS, _objectSpread(_objectSpread({
6784
6970
  correlation_id: this.correlationId,
6785
6971
  locus_id: this.locusUrl.split('/').pop(),
6786
6972
  connectionType: connectionType,
6787
6973
  selectedCandidatePairChanges: selectedCandidatePairChanges,
6788
6974
  numTransports: numTransports,
6789
6975
  isMultistream: this.isMultistream,
6790
- retriedWithTurnServer: this.retriedWithTurnServer,
6976
+ retriedWithTurnServer: this.addMediaData.retriedWithTurnServer,
6791
6977
  isJoinWithMediaRetry: this.joinWithMediaRetryInfo.isRetry
6792
- }, reachabilityStats));
6978
+ }, reachabilityStats), {}, {
6979
+ iceCandidatesCount: this.iceCandidatesCount
6980
+ }));
6793
6981
  // @ts-ignore
6794
6982
  this.webex.internal.newMetrics.submitClientEvent({
6795
6983
  name: 'client.media-engine.ready',
@@ -6803,23 +6991,24 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6803
6991
  (_this$remoteMediaMana = this.remoteMediaManager) === null || _this$remoteMediaMana === void 0 ? void 0 : _this$remoteMediaMana.logAllReceiveSlots();
6804
6992
  _context32.next = 67;
6805
6993
  break;
6806
- case 50:
6807
- _context32.prev = 50;
6808
- _context32.t0 = _context32["catch"](19);
6994
+ case 49:
6995
+ _context32.prev = 49;
6996
+ _context32.t0 = _context32["catch"](18);
6809
6997
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " failed to establish media connection: "), _context32.t0);
6810
6998
 
6811
6999
  // @ts-ignore
6812
- _context32.next = 55;
7000
+ _context32.next = 54;
6813
7001
  return this.webex.meetings.reachability.getReachabilityMetrics();
6814
- case 55:
7002
+ case 54:
6815
7003
  reachabilityMetrics = _context32.sent;
6816
- _context32.next = 58;
7004
+ _context32.next = 57;
6817
7005
  return this.mediaProperties.getCurrentConnectionInfo();
6818
- case 58:
7006
+ case 57:
6819
7007
  _yield$this$mediaProp2 = _context32.sent;
6820
7008
  _selectedCandidatePairChanges = _yield$this$mediaProp2.selectedCandidatePairChanges;
6821
7009
  _numTransports = _yield$this$mediaProp2.numTransports;
6822
- _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, _objectSpread({
7010
+ iceCandidateErrors = Object.fromEntries(this.iceCandidateErrors);
7011
+ _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, _objectSpread(_objectSpread(_objectSpread({
6823
7012
  correlation_id: this.correlationId,
6824
7013
  locus_id: this.locusUrl.split('/').pop(),
6825
7014
  reason: _context32.t0.message,
@@ -6829,13 +7018,15 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6829
7018
  numTransports: _numTransports,
6830
7019
  turnDiscoverySkippedReason: this.turnDiscoverySkippedReason,
6831
7020
  turnServerUsed: this.turnServerUsed,
6832
- retriedWithTurnServer: this.retriedWithTurnServer,
7021
+ retriedWithTurnServer: this.addMediaData.retriedWithTurnServer,
6833
7022
  isMultistream: this.isMultistream,
6834
7023
  isJoinWithMediaRetry: this.joinWithMediaRetryInfo.isRetry,
6835
- signalingState: ((_this$mediaProperties20 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties20 === void 0 ? void 0 : (_this$mediaProperties21 = _this$mediaProperties20.multistreamConnection) === null || _this$mediaProperties21 === void 0 ? void 0 : (_this$mediaProperties22 = _this$mediaProperties21.pc) === null || _this$mediaProperties22 === void 0 ? void 0 : (_this$mediaProperties23 = _this$mediaProperties22.pc) === null || _this$mediaProperties23 === void 0 ? void 0 : _this$mediaProperties23.signalingState) || ((_this$mediaProperties24 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties24 === void 0 ? void 0 : (_this$mediaProperties25 = _this$mediaProperties24.mediaConnection) === null || _this$mediaProperties25 === void 0 ? void 0 : (_this$mediaProperties26 = _this$mediaProperties25.pc) === null || _this$mediaProperties26 === void 0 ? void 0 : _this$mediaProperties26.signalingState) || 'unknown',
6836
- connectionState: ((_this$mediaProperties27 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties27 === void 0 ? void 0 : (_this$mediaProperties28 = _this$mediaProperties27.multistreamConnection) === null || _this$mediaProperties28 === void 0 ? void 0 : (_this$mediaProperties29 = _this$mediaProperties28.pc) === null || _this$mediaProperties29 === void 0 ? void 0 : (_this$mediaProperties30 = _this$mediaProperties29.pc) === null || _this$mediaProperties30 === void 0 ? void 0 : _this$mediaProperties30.connectionState) || ((_this$mediaProperties31 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties31 === void 0 ? void 0 : (_this$mediaProperties32 = _this$mediaProperties31.mediaConnection) === null || _this$mediaProperties32 === void 0 ? void 0 : (_this$mediaProperties33 = _this$mediaProperties32.pc) === null || _this$mediaProperties33 === void 0 ? void 0 : _this$mediaProperties33.connectionState) || 'unknown',
6837
- iceConnectionState: ((_this$mediaProperties34 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties34 === void 0 ? void 0 : (_this$mediaProperties35 = _this$mediaProperties34.multistreamConnection) === null || _this$mediaProperties35 === void 0 ? void 0 : (_this$mediaProperties36 = _this$mediaProperties35.pc) === null || _this$mediaProperties36 === void 0 ? void 0 : (_this$mediaProperties37 = _this$mediaProperties36.pc) === null || _this$mediaProperties37 === void 0 ? void 0 : _this$mediaProperties37.iceConnectionState) || ((_this$mediaProperties38 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties38 === void 0 ? void 0 : (_this$mediaProperties39 = _this$mediaProperties38.mediaConnection) === null || _this$mediaProperties39 === void 0 ? void 0 : (_this$mediaProperties40 = _this$mediaProperties39.pc) === null || _this$mediaProperties40 === void 0 ? void 0 : _this$mediaProperties40.iceConnectionState) || 'unknown'
6838
- }, reachabilityMetrics));
7024
+ signalingState: ((_this$mediaProperties13 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties13 === void 0 ? void 0 : (_this$mediaProperties14 = _this$mediaProperties13.multistreamConnection) === null || _this$mediaProperties14 === void 0 ? void 0 : (_this$mediaProperties15 = _this$mediaProperties14.pc) === null || _this$mediaProperties15 === void 0 ? void 0 : (_this$mediaProperties16 = _this$mediaProperties15.pc) === null || _this$mediaProperties16 === void 0 ? void 0 : _this$mediaProperties16.signalingState) || ((_this$mediaProperties17 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties17 === void 0 ? void 0 : (_this$mediaProperties18 = _this$mediaProperties17.mediaConnection) === null || _this$mediaProperties18 === void 0 ? void 0 : (_this$mediaProperties19 = _this$mediaProperties18.pc) === null || _this$mediaProperties19 === void 0 ? void 0 : _this$mediaProperties19.signalingState) || 'unknown',
7025
+ connectionState: ((_this$mediaProperties20 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties20 === void 0 ? void 0 : (_this$mediaProperties21 = _this$mediaProperties20.multistreamConnection) === null || _this$mediaProperties21 === void 0 ? void 0 : (_this$mediaProperties22 = _this$mediaProperties21.pc) === null || _this$mediaProperties22 === void 0 ? void 0 : (_this$mediaProperties23 = _this$mediaProperties22.pc) === null || _this$mediaProperties23 === void 0 ? void 0 : _this$mediaProperties23.connectionState) || ((_this$mediaProperties24 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties24 === void 0 ? void 0 : (_this$mediaProperties25 = _this$mediaProperties24.mediaConnection) === null || _this$mediaProperties25 === void 0 ? void 0 : (_this$mediaProperties26 = _this$mediaProperties25.pc) === null || _this$mediaProperties26 === void 0 ? void 0 : _this$mediaProperties26.connectionState) || 'unknown',
7026
+ iceConnectionState: ((_this$mediaProperties27 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties27 === void 0 ? void 0 : (_this$mediaProperties28 = _this$mediaProperties27.multistreamConnection) === null || _this$mediaProperties28 === void 0 ? void 0 : (_this$mediaProperties29 = _this$mediaProperties28.pc) === null || _this$mediaProperties29 === void 0 ? void 0 : (_this$mediaProperties30 = _this$mediaProperties29.pc) === null || _this$mediaProperties30 === void 0 ? void 0 : _this$mediaProperties30.iceConnectionState) || ((_this$mediaProperties31 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties31 === void 0 ? void 0 : (_this$mediaProperties32 = _this$mediaProperties31.mediaConnection) === null || _this$mediaProperties32 === void 0 ? void 0 : (_this$mediaProperties33 = _this$mediaProperties32.pc) === null || _this$mediaProperties33 === void 0 ? void 0 : _this$mediaProperties33.iceConnectionState) || 'unknown'
7027
+ }, reachabilityMetrics), iceCandidateErrors), {}, {
7028
+ iceCandidatesCount: this.iceCandidatesCount
7029
+ }));
6839
7030
  _context32.next = 64;
6840
7031
  return this.cleanUpOnAddMediaFailure();
6841
7032
  case 64:
@@ -6851,15 +7042,19 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6851
7042
  }
6852
7043
  throw _context32.t0;
6853
7044
  case 67:
7045
+ _context32.prev = 67;
7046
+ this.addMediaData.icePhaseCallback = DEFAULT_ICE_PHASE_CALLBACK;
7047
+ return _context32.finish(67);
7048
+ case 70:
6854
7049
  case "end":
6855
7050
  return _context32.stop();
6856
7051
  }
6857
- }, _callee32, this, [[19, 50]]);
7052
+ }, _callee32, this, [[18, 49, 67, 70]]);
6858
7053
  }));
6859
- function addMedia() {
6860
- return _addMedia.apply(this, arguments);
7054
+ function addMediaInternal(_x32, _x33, _x34) {
7055
+ return _addMediaInternal.apply(this, arguments);
6861
7056
  }
6862
- return addMedia;
7057
+ return addMediaInternal;
6863
7058
  }()
6864
7059
  /**
6865
7060
  * Informs if the peer connection is in a state that can be updated with updateMedia (audio/video/share)
@@ -6886,7 +7081,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6886
7081
  * @memberof Meeting
6887
7082
  */
6888
7083
  function enqueueMediaUpdate(mediaUpdateType) {
6889
- var _this39 = this;
7084
+ var _this41 = this;
6890
7085
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6891
7086
  var canUpdateMediaNow = this.canUpdateMedia();
6892
7087
  return new _promise.default(function (resolve, reject) {
@@ -6897,9 +7092,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6897
7092
  options: options
6898
7093
  };
6899
7094
  _loggerProxy.default.logger.log("Meeting:index#enqueueMediaUpdate --> enqueuing media update type=".concat(mediaUpdateType));
6900
- _this39.queuedMediaUpdates.push(queueItem);
7095
+ _this41.queuedMediaUpdates.push(queueItem);
6901
7096
  if (canUpdateMediaNow) {
6902
- _this39.processNextQueuedMediaUpdate();
7097
+ _this41.processNextQueuedMediaUpdate();
6903
7098
  }
6904
7099
  });
6905
7100
  }
@@ -6988,7 +7183,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6988
7183
  }
6989
7184
  }, _callee33, this);
6990
7185
  }));
6991
- function updateMedia(_x32) {
7186
+ function updateMedia(_x35) {
6992
7187
  return _updateMedia.apply(this, arguments);
6993
7188
  }
6994
7189
  return updateMedia;
@@ -7004,7 +7199,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7004
7199
  }, {
7005
7200
  key: "acknowledge",
7006
7201
  value: function acknowledge(type) {
7007
- var _this40 = this;
7202
+ var _this42 = this;
7008
7203
  if (!type) {
7009
7204
  return _promise.default.reject(new _parameter.default('Type must be set to acknowledge the meeting.'));
7010
7205
  }
@@ -7016,12 +7211,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7016
7211
  }).then(function (response) {
7017
7212
  return _promise.default.resolve(response);
7018
7213
  }).then(function (response) {
7019
- _this40.meetingFiniteStateMachine.ring(type);
7214
+ _this42.meetingFiniteStateMachine.ring(type);
7020
7215
  // @ts-ignore
7021
- _this40.webex.internal.newMetrics.submitClientEvent({
7216
+ _this42.webex.internal.newMetrics.submitClientEvent({
7022
7217
  name: 'client.alert.displayed',
7023
7218
  options: {
7024
- meetingId: _this40.id
7219
+ meetingId: _this42.id
7025
7220
  }
7026
7221
  });
7027
7222
  return _promise.default.resolve({
@@ -7046,12 +7241,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7046
7241
  }, {
7047
7242
  key: "decline",
7048
7243
  value: function decline(reason) {
7049
- var _this41 = this;
7244
+ var _this43 = this;
7050
7245
  return _util2.default.declineMeeting(this, reason).then(function (decline) {
7051
- _this41.meetingFiniteStateMachine.decline();
7246
+ _this43.meetingFiniteStateMachine.decline();
7052
7247
  return _promise.default.resolve(decline);
7053
7248
  }).catch(function (error) {
7054
- _this41.meetingFiniteStateMachine.fail(error);
7249
+ _this43.meetingFiniteStateMachine.fail(error);
7055
7250
  return _promise.default.reject(error);
7056
7251
  });
7057
7252
  }
@@ -7102,7 +7297,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7102
7297
  }, {
7103
7298
  key: "leave",
7104
7299
  value: function leave() {
7105
- var _this42 = this;
7300
+ var _this44 = this;
7106
7301
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7107
7302
  var leaveReason = options.reason || _constants.MEETING_REMOVED_REASON.CLIENT_LEAVE_REQUEST;
7108
7303
 
@@ -7114,7 +7309,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7114
7309
  var payload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7115
7310
  return (
7116
7311
  // @ts-ignore
7117
- _this42.webex.internal.newMetrics.submitClientEvent({
7312
+ _this44.webex.internal.newMetrics.submitClientEvent({
7118
7313
  name: 'client.call.leave',
7119
7314
  payload: _objectSpread({
7120
7315
  trigger: 'user-interaction',
@@ -7122,7 +7317,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7122
7317
  leaveReason: options.clientEventLeaveReason
7123
7318
  }, payload),
7124
7319
  options: {
7125
- meetingId: _this42.id
7320
+ meetingId: _this44.id
7126
7321
  }
7127
7322
  })
7128
7323
  );
@@ -7131,24 +7326,24 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7131
7326
  return _util2.default.leaveMeeting(this, options).then(function (leave) {
7132
7327
  // CA team recommends submitting this *after* locus /leave
7133
7328
  submitLeaveMetric();
7134
- _this42.meetingFiniteStateMachine.leave();
7135
- _this42.clearMeetingData();
7329
+ _this44.meetingFiniteStateMachine.leave();
7330
+ _this44.clearMeetingData();
7136
7331
 
7137
7332
  // upload logs on leave irrespective of meeting delete
7138
- _triggerProxy.default.trigger(_this42, {
7333
+ _triggerProxy.default.trigger(_this44, {
7139
7334
  file: 'meeting/index',
7140
7335
  function: 'leave'
7141
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this42);
7336
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this44);
7142
7337
 
7143
7338
  // TODO: more testing before we remove this code, we are not sure the scenarios for destroy here
7144
- if (_this42.wirelessShare || _this42.guest) {
7339
+ if (_this44.wirelessShare || _this44.guest) {
7145
7340
  // If screen sharing clean the meeting object
7146
- _triggerProxy.default.trigger(_this42, {
7341
+ _triggerProxy.default.trigger(_this44, {
7147
7342
  file: 'meeting/index',
7148
7343
  function: 'leave'
7149
7344
  }, _constants.EVENTS.DESTROY_MEETING, {
7150
7345
  reason: options.reason,
7151
- meetingId: _this42.id
7346
+ meetingId: _this44.id
7152
7347
  });
7153
7348
  }
7154
7349
  _loggerProxy.default.logger.log('Meeting:index#leave --> LEAVE REASON ', leaveReason);
@@ -7165,16 +7360,16 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7165
7360
  shownToUser: false
7166
7361
  }]
7167
7362
  });
7168
- _this42.meetingFiniteStateMachine.fail(error);
7363
+ _this44.meetingFiniteStateMachine.fail(error);
7169
7364
  _loggerProxy.default.logger.error('Meeting:index#leave --> Failed to leave ', error);
7170
7365
  // upload logs on leave irrespective of meeting delete
7171
- _triggerProxy.default.trigger(_this42, {
7366
+ _triggerProxy.default.trigger(_this44, {
7172
7367
  file: 'meeting/index',
7173
7368
  function: 'leave'
7174
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this42);
7369
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this44);
7175
7370
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_LEAVE_FAILURE, {
7176
- correlation_id: _this42.correlationId,
7177
- locus_id: _this42.locusUrl.split('/').pop(),
7371
+ correlation_id: _this44.correlationId,
7372
+ locus_id: _this44.locusUrl.split('/').pop(),
7178
7373
  reason: error.message,
7179
7374
  stack: error.stack,
7180
7375
  code: error.code
@@ -7194,7 +7389,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7194
7389
  }, {
7195
7390
  key: "startWhiteboardShare",
7196
7391
  value: function startWhiteboardShare(channelUrl, resourceToken) {
7197
- var _this43 = this;
7392
+ var _this45 = this;
7198
7393
  var whiteboard = this.locusInfo.mediaShares.find(function (element) {
7199
7394
  return element.name === 'whiteboard';
7200
7395
  });
@@ -7223,13 +7418,13 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7223
7418
  body.resourceToken = resourceToken;
7224
7419
  }
7225
7420
  return this.meetingRequest.changeMeetingFloor(body).then(function () {
7226
- _this43.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
7421
+ _this45.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
7227
7422
  return _promise.default.resolve();
7228
7423
  }).catch(function (error) {
7229
7424
  _loggerProxy.default.logger.error('Meeting:index#startWhiteboardShare --> Error ', error);
7230
7425
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_START_WHITEBOARD_SHARE_FAILURE, {
7231
- correlation_id: _this43.correlationId,
7232
- locus_id: _this43.locusUrl.split('/').pop(),
7426
+ correlation_id: _this45.correlationId,
7427
+ locus_id: _this45.locusUrl.split('/').pop(),
7233
7428
  reason: error.message,
7234
7429
  stack: error.stack,
7235
7430
  board: {
@@ -7252,7 +7447,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7252
7447
  }, {
7253
7448
  key: "stopWhiteboardShare",
7254
7449
  value: function stopWhiteboardShare(channelUrl) {
7255
- var _this44 = this;
7450
+ var _this46 = this;
7256
7451
  var whiteboard = this.locusInfo.mediaShares.find(function (element) {
7257
7452
  return element.name === 'whiteboard';
7258
7453
  });
@@ -7275,8 +7470,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7275
7470
  }).catch(function (error) {
7276
7471
  _loggerProxy.default.logger.error('Meeting:index#stopWhiteboardShare --> Error ', error);
7277
7472
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_STOP_WHITEBOARD_SHARE_FAILURE, {
7278
- correlation_id: _this44.correlationId,
7279
- locus_id: _this44.locusUrl.split('/').pop(),
7473
+ correlation_id: _this46.correlationId,
7474
+ locus_id: _this46.locusUrl.split('/').pop(),
7280
7475
  reason: error.message,
7281
7476
  stack: error.stack,
7282
7477
  board: {
@@ -7298,7 +7493,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7298
7493
  }, {
7299
7494
  key: "requestScreenShareFloor",
7300
7495
  value: function requestScreenShareFloor() {
7301
- var _this45 = this;
7496
+ var _this47 = this;
7302
7497
  if (!this.mediaProperties.hasLocalShareStream() || !this.mediaProperties.mediaDirection.sendShare) {
7303
7498
  _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, ")"));
7304
7499
  this.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
@@ -7329,34 +7524,34 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7329
7524
  resourceUrl: this.resourceUrl,
7330
7525
  shareInstanceId: this.localShareInstanceId
7331
7526
  }).then(function () {
7332
- _this45.screenShareFloorState = ScreenShareFloorStatus.GRANTED;
7527
+ _this47.screenShareFloorState = ScreenShareFloorStatus.GRANTED;
7333
7528
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_SHARE_SUCCESS, {
7334
- correlation_id: _this45.correlationId,
7335
- locus_id: _this45.locusUrl.split('/').pop()
7529
+ correlation_id: _this47.correlationId,
7530
+ locus_id: _this47.locusUrl.split('/').pop()
7336
7531
  });
7337
7532
  return _promise.default.resolve();
7338
7533
  }).catch(function (error) {
7339
7534
  _loggerProxy.default.logger.error('Meeting:index#share --> Error ', error);
7340
7535
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_SHARE_FAILURE, {
7341
- correlation_id: _this45.correlationId,
7342
- locus_id: _this45.locusUrl.split('/').pop(),
7536
+ correlation_id: _this47.correlationId,
7537
+ locus_id: _this47.locusUrl.split('/').pop(),
7343
7538
  reason: error.message,
7344
7539
  stack: error.stack
7345
7540
  });
7346
7541
 
7347
7542
  // @ts-ignore
7348
- _this45.webex.internal.newMetrics.submitClientEvent({
7543
+ _this47.webex.internal.newMetrics.submitClientEvent({
7349
7544
  name: 'client.share.floor-granted.local',
7350
7545
  payload: {
7351
7546
  mediaType: 'share',
7352
7547
  errors: _util2.default.getChangeMeetingFloorErrorPayload(error.message),
7353
- shareInstanceId: _this45.localShareInstanceId
7548
+ shareInstanceId: _this47.localShareInstanceId
7354
7549
  },
7355
7550
  options: {
7356
- meetingId: _this45.id
7551
+ meetingId: _this47.id
7357
7552
  }
7358
7553
  });
7359
- _this45.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
7554
+ _this47.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
7360
7555
  return _promise.default.reject(error);
7361
7556
  });
7362
7557
  }
@@ -7379,10 +7574,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7379
7574
  }, {
7380
7575
  key: "requestScreenShareFloorIfPending",
7381
7576
  value: function requestScreenShareFloorIfPending() {
7382
- var _this46 = this;
7577
+ var _this48 = this;
7383
7578
  if (this.floorGrantPending && this.state === _constants.MEETING_STATE.STATES.JOINED) {
7384
7579
  this.requestScreenShareFloor().then(function () {
7385
- _this46.floorGrantPending = false;
7580
+ _this48.floorGrantPending = false;
7386
7581
  });
7387
7582
  }
7388
7583
  }
@@ -7396,7 +7591,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7396
7591
  }, {
7397
7592
  key: "releaseScreenShareFloor",
7398
7593
  value: function releaseScreenShareFloor() {
7399
- var _this47 = this;
7594
+ var _this49 = this;
7400
7595
  var content = this.locusInfo.mediaShares.find(function (element) {
7401
7596
  return element.name === _constants.CONTENT;
7402
7597
  });
@@ -7431,8 +7626,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7431
7626
  }).catch(function (error) {
7432
7627
  _loggerProxy.default.logger.error('Meeting:index#releaseScreenShareFloor --> Error ', error);
7433
7628
  _metrics.default.sendBehavioralMetric(_constants2.default.STOP_FLOOR_REQUEST_FAILURE, {
7434
- correlation_id: _this47.correlationId,
7435
- locus_id: _this47.locusUrl.split('/').pop(),
7629
+ correlation_id: _this49.correlationId,
7630
+ locus_id: _this49.locusUrl.split('/').pop(),
7436
7631
  reason: error.message,
7437
7632
  stack: error.stack
7438
7633
  });
@@ -7611,14 +7806,14 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7611
7806
  }, {
7612
7807
  key: "changeVideoLayout",
7613
7808
  value: function changeVideoLayout(layoutType) {
7614
- var _this48 = this;
7809
+ var _this50 = this;
7615
7810
  var renderInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7616
7811
  var main = renderInfo.main,
7617
7812
  content = renderInfo.content;
7618
- var _this$mediaProperties41 = this.mediaProperties,
7619
- mediaDirection = _this$mediaProperties41.mediaDirection,
7620
- remoteShareStream = _this$mediaProperties41.remoteShareStream,
7621
- remoteVideoStream = _this$mediaProperties41.remoteVideoStream;
7813
+ var _this$mediaProperties34 = this.mediaProperties,
7814
+ mediaDirection = _this$mediaProperties34.mediaDirection,
7815
+ remoteShareStream = _this$mediaProperties34.remoteShareStream,
7816
+ remoteVideoStream = _this$mediaProperties34.remoteVideoStream;
7622
7817
  var layoutInfo = (0, _lodash.cloneDeep)(this.lastVideoLayoutInfo);
7623
7818
 
7624
7819
  // TODO: We need a real time value for Audio, Video and Share send indicator
@@ -7665,7 +7860,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7665
7860
  }
7666
7861
  this.lastVideoLayoutInfo = (0, _lodash.cloneDeep)(layoutInfo);
7667
7862
  this.locusInfo.once(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_LAYOUT_UPDATED, function (envelope) {
7668
- _triggerProxy.default.trigger(_this48, {
7863
+ _triggerProxy.default.trigger(_this50, {
7669
7864
  file: 'meeting/index',
7670
7865
  function: 'changeVideoLayout'
7671
7866
  }, _constants.EVENT_TRIGGERS.MEETING_CONTROLS_LAYOUT_UPDATE, {
@@ -7781,7 +7976,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7781
7976
  }, {
7782
7977
  key: "endMeetingForAll",
7783
7978
  value: function endMeetingForAll() {
7784
- var _this49 = this;
7979
+ var _this51 = this;
7785
7980
  // @ts-ignore
7786
7981
  this.webex.internal.newMetrics.submitClientEvent({
7787
7982
  name: 'client.call.leave',
@@ -7799,25 +7994,25 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7799
7994
  locus_id: this.locusId
7800
7995
  });
7801
7996
  return _util2.default.endMeetingForAll(this).then(function (end) {
7802
- _this49.meetingFiniteStateMachine.end();
7803
- _this49.clearMeetingData();
7997
+ _this51.meetingFiniteStateMachine.end();
7998
+ _this51.clearMeetingData();
7804
7999
  // upload logs on leave irrespective of meeting delete
7805
- _triggerProxy.default.trigger(_this49, {
8000
+ _triggerProxy.default.trigger(_this51, {
7806
8001
  file: 'meeting/index',
7807
8002
  function: 'endMeetingForAll'
7808
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this49);
8003
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this51);
7809
8004
  return end;
7810
8005
  }).catch(function (error) {
7811
- _this49.meetingFiniteStateMachine.fail(error);
8006
+ _this51.meetingFiniteStateMachine.fail(error);
7812
8007
  _loggerProxy.default.logger.error('Meeting:index#endMeetingForAll --> Failed to end meeting ', error);
7813
8008
  // upload logs on leave irrespective of meeting delete
7814
- _triggerProxy.default.trigger(_this49, {
8009
+ _triggerProxy.default.trigger(_this51, {
7815
8010
  file: 'meeting/index',
7816
8011
  function: 'endMeetingForAll'
7817
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this49);
8012
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this51);
7818
8013
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_END_ALL_FAILURE, {
7819
- correlation_id: _this49.correlationId,
7820
- locus_id: _this49.locusUrl.split('/').pop(),
8014
+ correlation_id: _this51.correlationId,
8015
+ locus_id: _this51.locusUrl.split('/').pop(),
7821
8016
  reason: error.message,
7822
8017
  stack: error.stack,
7823
8018
  code: error.code
@@ -7890,8 +8085,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7890
8085
  }, {
7891
8086
  key: "checkMediaConnection",
7892
8087
  value: function checkMediaConnection() {
7893
- var _this$mediaProperties42;
7894
- if ((_this$mediaProperties42 = this.mediaProperties) !== null && _this$mediaProperties42 !== void 0 && _this$mediaProperties42.webrtcMediaConnection) {
8088
+ var _this$mediaProperties35;
8089
+ if ((_this$mediaProperties35 = this.mediaProperties) !== null && _this$mediaProperties35 !== void 0 && _this$mediaProperties35.webrtcMediaConnection) {
7895
8090
  return;
7896
8091
  }
7897
8092
  throw new _webexErrors.NoMediaEstablishedYetError();
@@ -7938,7 +8133,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7938
8133
  }
7939
8134
  }, _callee34, this);
7940
8135
  }));
7941
- function enableMusicMode(_x33) {
8136
+ function enableMusicMode(_x36) {
7942
8137
  return _enableMusicMode.apply(this, arguments);
7943
8138
  }
7944
8139
  return enableMusicMode;
@@ -7951,15 +8146,15 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7951
8146
  }, {
7952
8147
  key: "updateTranscodedMediaConnection",
7953
8148
  value: function updateTranscodedMediaConnection() {
7954
- var _this$mediaProperties43,
7955
- _this$mediaProperties44,
7956
- _this$mediaProperties45,
7957
- _this$mediaProperties46,
7958
- _this$mediaProperties47,
7959
- _this$mediaProperties48,
7960
- _this$mediaProperties49,
7961
- _this$mediaProperties50,
7962
- _this50 = this;
8149
+ var _this$mediaProperties36,
8150
+ _this$mediaProperties37,
8151
+ _this$mediaProperties38,
8152
+ _this$mediaProperties39,
8153
+ _this$mediaProperties40,
8154
+ _this$mediaProperties41,
8155
+ _this$mediaProperties42,
8156
+ _this$mediaProperties43,
8157
+ _this52 = this;
7963
8158
  var LOG_HEADER = 'Meeting:index#updateTranscodedMediaConnection -->';
7964
8159
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " starting"));
7965
8160
  if (!this.canUpdateMedia()) {
@@ -7968,10 +8163,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7968
8163
  return this.mediaProperties.webrtcMediaConnection.update({
7969
8164
  // TODO: RoapMediaConnection is not ready to use stream classes yet, so we pass the raw MediaStreamTrack for now
7970
8165
  localTracks: {
7971
- audio: ((_this$mediaProperties43 = this.mediaProperties.audioStream) === null || _this$mediaProperties43 === void 0 ? void 0 : (_this$mediaProperties44 = _this$mediaProperties43.outputStream) === null || _this$mediaProperties44 === void 0 ? void 0 : _this$mediaProperties44.getTracks()[0]) || null,
7972
- video: ((_this$mediaProperties45 = this.mediaProperties.videoStream) === null || _this$mediaProperties45 === void 0 ? void 0 : (_this$mediaProperties46 = _this$mediaProperties45.outputStream) === null || _this$mediaProperties46 === void 0 ? void 0 : _this$mediaProperties46.getTracks()[0]) || null,
7973
- screenShareVideo: ((_this$mediaProperties47 = this.mediaProperties.shareVideoStream) === null || _this$mediaProperties47 === void 0 ? void 0 : (_this$mediaProperties48 = _this$mediaProperties47.outputStream) === null || _this$mediaProperties48 === void 0 ? void 0 : _this$mediaProperties48.getTracks()[0]) || null,
7974
- screenShareAudio: ((_this$mediaProperties49 = this.mediaProperties.shareAudioStream) === null || _this$mediaProperties49 === void 0 ? void 0 : (_this$mediaProperties50 = _this$mediaProperties49.outputStream) === null || _this$mediaProperties50 === void 0 ? void 0 : _this$mediaProperties50.getTracks()[0]) || null
8166
+ audio: ((_this$mediaProperties36 = this.mediaProperties.audioStream) === null || _this$mediaProperties36 === void 0 ? void 0 : (_this$mediaProperties37 = _this$mediaProperties36.outputStream) === null || _this$mediaProperties37 === void 0 ? void 0 : _this$mediaProperties37.getTracks()[0]) || null,
8167
+ video: ((_this$mediaProperties38 = this.mediaProperties.videoStream) === null || _this$mediaProperties38 === void 0 ? void 0 : (_this$mediaProperties39 = _this$mediaProperties38.outputStream) === null || _this$mediaProperties39 === void 0 ? void 0 : _this$mediaProperties39.getTracks()[0]) || null,
8168
+ screenShareVideo: ((_this$mediaProperties40 = this.mediaProperties.shareVideoStream) === null || _this$mediaProperties40 === void 0 ? void 0 : (_this$mediaProperties41 = _this$mediaProperties40.outputStream) === null || _this$mediaProperties41 === void 0 ? void 0 : _this$mediaProperties41.getTracks()[0]) || null,
8169
+ screenShareAudio: ((_this$mediaProperties42 = this.mediaProperties.shareAudioStream) === null || _this$mediaProperties42 === void 0 ? void 0 : (_this$mediaProperties43 = _this$mediaProperties42.outputStream) === null || _this$mediaProperties43 === void 0 ? void 0 : _this$mediaProperties43.getTracks()[0]) || null
7975
8170
  },
7976
8171
  direction: {
7977
8172
  audio: _media.default.getDirection(true, this.mediaProperties.mediaDirection.receiveAudio, this.mediaProperties.mediaDirection.sendAudio),
@@ -7984,8 +8179,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7984
8179
  }).catch(function (error) {
7985
8180
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error: "), error);
7986
8181
  _metrics.default.sendBehavioralMetric(_constants2.default.UPDATE_MEDIA_FAILURE, {
7987
- correlation_id: _this50.correlationId,
7988
- locus_id: _this50.locusUrl.split('/').pop(),
8182
+ correlation_id: _this52.correlationId,
8183
+ locus_id: _this52.locusUrl.split('/').pop(),
7989
8184
  reason: error.message,
7990
8185
  stack: error.stack
7991
8186
  });
@@ -8062,7 +8257,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8062
8257
  }
8063
8258
  }, _callee35, this);
8064
8259
  }));
8065
- function publishStream(_x34, _x35) {
8260
+ function publishStream(_x37, _x38) {
8066
8261
  return _publishStream.apply(this, arguments);
8067
8262
  }
8068
8263
  return publishStream;
@@ -8107,7 +8302,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8107
8302
  }
8108
8303
  }, _callee36, this);
8109
8304
  }));
8110
- function unpublishStream(_x36, _x37) {
8305
+ function unpublishStream(_x39, _x40) {
8111
8306
  return _unpublishStream.apply(this, arguments);
8112
8307
  }
8113
8308
  return unpublishStream;
@@ -8214,7 +8409,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8214
8409
  }
8215
8410
  }, _callee37, this);
8216
8411
  }));
8217
- function publishStreams(_x38) {
8412
+ function publishStreams(_x41) {
8218
8413
  return _publishStreams.apply(this, arguments);
8219
8414
  }
8220
8415
  return publishStreams;
@@ -8288,7 +8483,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
8288
8483
  }
8289
8484
  }, _callee38, this);
8290
8485
  }));
8291
- function unpublishStreams(_x39) {
8486
+ function unpublishStreams(_x42) {
8292
8487
  return _unpublishStreams.apply(this, arguments);
8293
8488
  }
8294
8489
  return unpublishStreams;