@webex/plugin-meetings 3.0.0-stream-classes.5 → 3.0.0-test.1

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 (233) hide show
  1. package/README.md +12 -0
  2. package/dist/breakouts/breakout.js +1 -1
  3. package/dist/breakouts/index.js +1 -1
  4. package/dist/common/errors/no-meeting-info.js +51 -0
  5. package/dist/common/errors/no-meeting-info.js.map +1 -0
  6. package/dist/common/errors/reclaim-host-role-errors.js +158 -0
  7. package/dist/common/errors/reclaim-host-role-errors.js.map +1 -0
  8. package/dist/common/errors/webex-errors.js +23 -3
  9. package/dist/common/errors/webex-errors.js.map +1 -1
  10. package/dist/common/logs/request.js +5 -1
  11. package/dist/common/logs/request.js.map +1 -1
  12. package/dist/config.js +1 -1
  13. package/dist/config.js.map +1 -1
  14. package/dist/constants.js +67 -9
  15. package/dist/constants.js.map +1 -1
  16. package/dist/index.js +11 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/interceptors/index.js +15 -0
  19. package/dist/interceptors/index.js.map +1 -0
  20. package/dist/interceptors/locusRetry.js +93 -0
  21. package/dist/interceptors/locusRetry.js.map +1 -0
  22. package/dist/interpretation/index.js +16 -2
  23. package/dist/interpretation/index.js.map +1 -1
  24. package/dist/interpretation/siLanguage.js +1 -1
  25. package/dist/locus-info/index.js +15 -10
  26. package/dist/locus-info/index.js.map +1 -1
  27. package/dist/locus-info/mediaSharesUtils.js +15 -1
  28. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  29. package/dist/locus-info/parser.js +37 -21
  30. package/dist/locus-info/parser.js.map +1 -1
  31. package/dist/media/index.js +10 -6
  32. package/dist/media/index.js.map +1 -1
  33. package/dist/media/properties.js +13 -3
  34. package/dist/media/properties.js.map +1 -1
  35. package/dist/mediaQualityMetrics/config.js +135 -330
  36. package/dist/mediaQualityMetrics/config.js.map +1 -1
  37. package/dist/meeting/in-meeting-actions.js +4 -0
  38. package/dist/meeting/in-meeting-actions.js.map +1 -1
  39. package/dist/meeting/index.js +2143 -1087
  40. package/dist/meeting/index.js.map +1 -1
  41. package/dist/meeting/muteState.js +37 -25
  42. package/dist/meeting/muteState.js.map +1 -1
  43. package/dist/meeting/request.js +33 -18
  44. package/dist/meeting/request.js.map +1 -1
  45. package/dist/meeting/util.js +71 -0
  46. package/dist/meeting/util.js.map +1 -1
  47. package/dist/meeting-info/index.js +48 -23
  48. package/dist/meeting-info/index.js.map +1 -1
  49. package/dist/meeting-info/meeting-info-v2.js +25 -4
  50. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  51. package/dist/meeting-info/utilv2.js +1 -1
  52. package/dist/meeting-info/utilv2.js.map +1 -1
  53. package/dist/meetings/collection.js +17 -0
  54. package/dist/meetings/collection.js.map +1 -1
  55. package/dist/meetings/index.js +142 -57
  56. package/dist/meetings/index.js.map +1 -1
  57. package/dist/meetings/util.js +2 -6
  58. package/dist/meetings/util.js.map +1 -1
  59. package/dist/member/index.js +9 -0
  60. package/dist/member/index.js.map +1 -1
  61. package/dist/member/util.js +11 -0
  62. package/dist/member/util.js.map +1 -1
  63. package/dist/members/index.js +17 -1
  64. package/dist/members/index.js.map +1 -1
  65. package/dist/members/types.js.map +1 -1
  66. package/dist/members/util.js +15 -4
  67. package/dist/members/util.js.map +1 -1
  68. package/dist/metrics/constants.js +13 -1
  69. package/dist/metrics/constants.js.map +1 -1
  70. package/dist/multistream/mediaRequestManager.js +1 -1
  71. package/dist/multistream/mediaRequestManager.js.map +1 -1
  72. package/dist/multistream/remoteMediaGroup.js +16 -2
  73. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  74. package/dist/multistream/remoteMediaManager.js +177 -65
  75. package/dist/multistream/remoteMediaManager.js.map +1 -1
  76. package/dist/multistream/sendSlotManager.js +22 -0
  77. package/dist/multistream/sendSlotManager.js.map +1 -1
  78. package/dist/reachability/clusterReachability.js +356 -0
  79. package/dist/reachability/clusterReachability.js.map +1 -0
  80. package/dist/reachability/index.js +262 -432
  81. package/dist/reachability/index.js.map +1 -1
  82. package/dist/reachability/request.js +1 -1
  83. package/dist/reachability/request.js.map +1 -1
  84. package/dist/reachability/util.js +29 -0
  85. package/dist/reachability/util.js.map +1 -0
  86. package/dist/reconnection-manager/index.js +113 -96
  87. package/dist/reconnection-manager/index.js.map +1 -1
  88. package/dist/roap/index.js +57 -25
  89. package/dist/roap/index.js.map +1 -1
  90. package/dist/roap/request.js +5 -13
  91. package/dist/roap/request.js.map +1 -1
  92. package/dist/roap/turnDiscovery.js +173 -81
  93. package/dist/roap/turnDiscovery.js.map +1 -1
  94. package/dist/rtcMetrics/index.js +68 -6
  95. package/dist/rtcMetrics/index.js.map +1 -1
  96. package/dist/statsAnalyzer/index.js +338 -289
  97. package/dist/statsAnalyzer/index.js.map +1 -1
  98. package/dist/statsAnalyzer/mqaUtil.js +296 -156
  99. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  100. package/dist/types/common/errors/no-meeting-info.d.ts +14 -0
  101. package/dist/types/common/errors/reclaim-host-role-errors.d.ts +60 -0
  102. package/dist/types/common/errors/webex-errors.d.ts +13 -1
  103. package/dist/types/common/logs/request.d.ts +2 -0
  104. package/dist/types/config.d.ts +1 -1
  105. package/dist/types/constants.d.ts +65 -13
  106. package/dist/types/index.d.ts +1 -1
  107. package/dist/types/interceptors/index.d.ts +2 -0
  108. package/dist/types/interceptors/locusRetry.d.ts +27 -0
  109. package/dist/types/locus-info/index.d.ts +1 -1
  110. package/dist/types/locus-info/parser.d.ts +3 -2
  111. package/dist/types/mediaQualityMetrics/config.d.ts +99 -223
  112. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  113. package/dist/types/meeting/index.d.ts +272 -35
  114. package/dist/types/meeting/muteState.d.ts +2 -8
  115. package/dist/types/meeting/request.d.ts +2 -0
  116. package/dist/types/meeting/util.d.ts +16 -0
  117. package/dist/types/meeting-info/index.d.ts +7 -0
  118. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  119. package/dist/types/meetings/collection.d.ts +9 -0
  120. package/dist/types/meetings/index.d.ts +42 -14
  121. package/dist/types/member/index.d.ts +1 -0
  122. package/dist/types/members/types.d.ts +1 -0
  123. package/dist/types/members/util.d.ts +5 -0
  124. package/dist/types/metrics/constants.d.ts +12 -0
  125. package/dist/types/multistream/mediaRequestManager.d.ts +2 -0
  126. package/dist/types/multistream/remoteMediaGroup.d.ts +2 -0
  127. package/dist/types/multistream/remoteMediaManager.d.ts +16 -0
  128. package/dist/types/multistream/sendSlotManager.d.ts +9 -0
  129. package/dist/types/reachability/clusterReachability.d.ts +109 -0
  130. package/dist/types/reachability/index.d.ts +59 -106
  131. package/dist/types/reachability/util.d.ts +8 -0
  132. package/dist/types/reconnection-manager/index.d.ts +10 -0
  133. package/dist/types/roap/index.d.ts +2 -1
  134. package/dist/types/roap/turnDiscovery.d.ts +21 -4
  135. package/dist/types/rtcMetrics/index.d.ts +15 -1
  136. package/dist/types/statsAnalyzer/index.d.ts +28 -11
  137. package/dist/types/statsAnalyzer/mqaUtil.d.ts +28 -4
  138. package/dist/types/webinar/collection.d.ts +16 -0
  139. package/dist/types/webinar/index.d.ts +5 -0
  140. package/dist/webinar/collection.js +44 -0
  141. package/dist/webinar/collection.js.map +1 -0
  142. package/dist/webinar/index.js +69 -0
  143. package/dist/webinar/index.js.map +1 -0
  144. package/package.json +3 -2
  145. package/src/common/errors/no-meeting-info.ts +24 -0
  146. package/src/common/errors/reclaim-host-role-errors.ts +134 -0
  147. package/src/common/errors/webex-errors.ts +19 -2
  148. package/src/common/logs/request.ts +5 -1
  149. package/src/config.ts +1 -1
  150. package/src/constants.ts +70 -6
  151. package/src/index.ts +5 -0
  152. package/src/interceptors/index.ts +3 -0
  153. package/src/interceptors/locusRetry.ts +67 -0
  154. package/src/interpretation/index.ts +18 -1
  155. package/src/locus-info/index.ts +19 -14
  156. package/src/locus-info/mediaSharesUtils.ts +16 -0
  157. package/src/locus-info/parser.ts +40 -21
  158. package/src/media/index.ts +8 -6
  159. package/src/media/properties.ts +17 -2
  160. package/src/mediaQualityMetrics/config.ts +103 -238
  161. package/src/meeting/in-meeting-actions.ts +8 -0
  162. package/src/meeting/index.ts +1471 -533
  163. package/src/meeting/muteState.ts +34 -20
  164. package/src/meeting/request.ts +18 -0
  165. package/src/meeting/util.ts +97 -0
  166. package/src/meeting-info/index.ts +47 -20
  167. package/src/meeting-info/meeting-info-v2.ts +27 -5
  168. package/src/meeting-info/utilv2.ts +1 -1
  169. package/src/meetings/collection.ts +13 -0
  170. package/src/meetings/index.ts +112 -31
  171. package/src/meetings/util.ts +2 -8
  172. package/src/member/index.ts +9 -0
  173. package/src/member/util.ts +14 -0
  174. package/src/members/index.ts +29 -2
  175. package/src/members/types.ts +1 -0
  176. package/src/members/util.ts +15 -1
  177. package/src/metrics/constants.ts +12 -0
  178. package/src/multistream/mediaRequestManager.ts +4 -1
  179. package/src/multistream/remoteMediaGroup.ts +19 -0
  180. package/src/multistream/remoteMediaManager.ts +101 -15
  181. package/src/multistream/sendSlotManager.ts +29 -0
  182. package/src/reachability/clusterReachability.ts +320 -0
  183. package/src/reachability/index.ts +221 -382
  184. package/src/reachability/request.ts +1 -1
  185. package/src/reachability/util.ts +24 -0
  186. package/src/reconnection-manager/index.ts +87 -83
  187. package/src/roap/index.ts +60 -24
  188. package/src/roap/request.ts +3 -16
  189. package/src/roap/turnDiscovery.ts +112 -39
  190. package/src/rtcMetrics/index.ts +71 -5
  191. package/src/statsAnalyzer/index.ts +430 -427
  192. package/src/statsAnalyzer/mqaUtil.ts +317 -168
  193. package/src/webinar/collection.ts +31 -0
  194. package/src/webinar/index.ts +62 -0
  195. package/test/integration/spec/journey.js +22 -22
  196. package/test/unit/spec/interceptors/locusRetry.ts +131 -0
  197. package/test/unit/spec/interpretation/index.ts +36 -3
  198. package/test/unit/spec/locus-info/index.js +87 -11
  199. package/test/unit/spec/locus-info/lib/SeqCmp.json +16 -0
  200. package/test/unit/spec/locus-info/mediaSharesUtils.ts +10 -0
  201. package/test/unit/spec/locus-info/parser.js +54 -13
  202. package/test/unit/spec/media/index.ts +20 -4
  203. package/test/unit/spec/media/properties.ts +2 -2
  204. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  205. package/test/unit/spec/meeting/index.js +4178 -1289
  206. package/test/unit/spec/meeting/muteState.js +219 -67
  207. package/test/unit/spec/meeting/request.js +63 -12
  208. package/test/unit/spec/meeting/utils.js +93 -0
  209. package/test/unit/spec/meeting-info/index.js +180 -61
  210. package/test/unit/spec/meeting-info/meetinginfov2.js +196 -53
  211. package/test/unit/spec/meetings/collection.js +12 -0
  212. package/test/unit/spec/meetings/index.js +617 -204
  213. package/test/unit/spec/meetings/utils.js +35 -12
  214. package/test/unit/spec/member/index.js +8 -7
  215. package/test/unit/spec/member/util.js +32 -0
  216. package/test/unit/spec/members/index.js +130 -17
  217. package/test/unit/spec/members/utils.js +26 -0
  218. package/test/unit/spec/multistream/mediaRequestManager.ts +20 -2
  219. package/test/unit/spec/multistream/remoteMediaGroup.ts +80 -1
  220. package/test/unit/spec/multistream/remoteMediaManager.ts +200 -1
  221. package/test/unit/spec/multistream/sendSlotManager.ts +50 -18
  222. package/test/unit/spec/reachability/clusterReachability.ts +279 -0
  223. package/test/unit/spec/reachability/index.ts +505 -135
  224. package/test/unit/spec/reachability/util.ts +40 -0
  225. package/test/unit/spec/reconnection-manager/index.js +74 -17
  226. package/test/unit/spec/roap/index.ts +181 -61
  227. package/test/unit/spec/roap/request.ts +27 -3
  228. package/test/unit/spec/roap/turnDiscovery.ts +362 -101
  229. package/test/unit/spec/rtcMetrics/index.ts +57 -3
  230. package/test/unit/spec/stats-analyzer/index.js +1225 -12
  231. package/test/unit/spec/webinar/collection.ts +13 -0
  232. package/test/unit/spec/webinar/index.ts +60 -0
  233. package/test/utils/webex-test-users.js +12 -4
@@ -36,6 +36,7 @@ var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
36
36
  var _uuid = _interopRequireDefault(require("uuid"));
37
37
  var _jsonwebtoken = _interopRequireDefault(require("jsonwebtoken"));
38
38
  var _webexCore = require("@webex/webex-core");
39
+ var _common = require("@webex/common");
39
40
  var _internalPluginMetrics = require("@webex/internal-plugin-metrics");
40
41
  var _internalMediaCore = require("@webex/internal-media-core");
41
42
  var _mediaHelpers = require("@webex/media-helpers");
@@ -55,9 +56,10 @@ var _reconnectionManager = _interopRequireDefault(require("../reconnection-manag
55
56
  var _request = _interopRequireDefault(require("./request"));
56
57
  var _index2 = _interopRequireDefault(require("../members/index"));
57
58
  var _util = _interopRequireDefault(require("./util"));
58
- var _util2 = _interopRequireDefault(require("../recording-controller/util"));
59
- var _util3 = _interopRequireDefault(require("../controls-options-manager/util"));
60
- var _util4 = _interopRequireDefault(require("../media/util"));
59
+ var _util2 = _interopRequireDefault(require("../meetings/util"));
60
+ var _util3 = _interopRequireDefault(require("../recording-controller/util"));
61
+ var _util4 = _interopRequireDefault(require("../controls-options-manager/util"));
62
+ var _util5 = _interopRequireDefault(require("../media/util"));
61
63
  var _transcription = _interopRequireDefault(require("../transcription"));
62
64
  var _reactions = require("../reactions/reactions");
63
65
  var _passwordError = _interopRequireDefault(require("../common/errors/password-error"));
@@ -76,6 +78,7 @@ var _remoteMediaManager = require("../multistream/remoteMediaManager");
76
78
  var _breakouts = _interopRequireDefault(require("../breakouts"));
77
79
  var _interpretation = _interopRequireDefault(require("../interpretation"));
78
80
  var _annotation = _interopRequireDefault(require("../annotation"));
81
+ var _webinar = _interopRequireDefault(require("../webinar"));
79
82
  var _inMeetingActions = _interopRequireDefault(require("./in-meeting-actions"));
80
83
  var _constants3 = require("../reactions/constants");
81
84
  var _recordingController = _interopRequireDefault(require("../recording-controller"));
@@ -110,6 +113,12 @@ var MEDIA_UPDATE_TYPE = {
110
113
  };
111
114
  exports.MEDIA_UPDATE_TYPE = MEDIA_UPDATE_TYPE;
112
115
  var ScreenShareFloorStatus;
116
+ exports.ScreenShareFloorStatus = ScreenShareFloorStatus;
117
+ (function (ScreenShareFloorStatus) {
118
+ ScreenShareFloorStatus["PENDING"] = "floor_request_pending";
119
+ ScreenShareFloorStatus["GRANTED"] = "floor_request_granted";
120
+ ScreenShareFloorStatus["RELEASED"] = "floor_released";
121
+ })(ScreenShareFloorStatus || (exports.ScreenShareFloorStatus = ScreenShareFloorStatus = {}));
113
122
  /**
114
123
  * MediaDirection
115
124
  * @typedef {Object} MediaDirection
@@ -356,17 +365,13 @@ var ScreenShareFloorStatus;
356
365
  * @export
357
366
  * @class Meeting
358
367
  */
359
- exports.ScreenShareFloorStatus = ScreenShareFloorStatus;
360
- (function (ScreenShareFloorStatus) {
361
- ScreenShareFloorStatus["PENDING"] = "floor_request_pending";
362
- ScreenShareFloorStatus["GRANTED"] = "floor_request_granted";
363
- ScreenShareFloorStatus["RELEASED"] = "floor_released";
364
- })(ScreenShareFloorStatus || (exports.ScreenShareFloorStatus = ScreenShareFloorStatus = {}));
365
368
  var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
366
369
  (0, _inherits2.default)(Meeting, _StatelessWebexPlugin);
367
370
  var _super = _createSuper(Meeting);
368
371
  // comes from Locus, initialized by updateMeetingObject()
369
372
 
373
+ // used for waiting for a response
374
+
370
375
  /**
371
376
  * @param {Object} attrs
372
377
  * @param {Object} options
@@ -374,7 +379,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
374
379
  * @memberof Meeting
375
380
  */
376
381
  function Meeting(attrs, _options) {
377
- var _this$locusInfo, _this$locusInfo$links, _this$locusInfo$links2, _this$locusInfo$links3, _this$locusInfo2, _this$locusInfo2$full, _this$locusInfo3, _this$locusInfo4;
382
+ var _attrs$callStateForMe, _this$locusInfo, _this$locusInfo$links, _this$locusInfo$links2, _this$locusInfo$links3, _this$locusInfo2, _this$locusInfo2$full, _this$locusInfo3, _this$locusInfo4;
378
383
  var _this;
379
384
  (0, _classCallCheck2.default)(this, Meeting);
380
385
  _this = _super.call(this, {}, _options);
@@ -390,8 +395,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
390
395
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "breakouts", void 0);
391
396
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "simultaneousInterpretation", void 0);
392
397
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "annotation", void 0);
398
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webinar", void 0);
393
399
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "conversationUrl", void 0);
394
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "correlationId", void 0);
400
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callStateForMetrics", void 0);
395
401
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "destination", void 0);
396
402
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "destinationType", void 0);
397
403
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "deviceUrl", void 0);
@@ -441,6 +447,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
441
447
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaRequestManagers", void 0);
442
448
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingInfoFailureReason", void 0);
443
449
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingInfoFailureCode", void 0);
450
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingInfoExtraParams", void 0);
444
451
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "networkQualityMonitor", void 0);
445
452
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "networkStatus", void 0);
446
453
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "passwordStatus", void 0);
@@ -452,6 +459,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
452
459
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "requiredCaptcha", void 0);
453
460
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "receiveSlotManager", void 0);
454
461
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selfUserPolicies", void 0);
462
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "enforceVBGImagesURL", void 0);
455
463
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "shareStatus", void 0);
456
464
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "screenShareFloorState", void 0);
457
465
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "statsAnalyzer", void 0);
@@ -473,6 +481,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
473
481
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingState", void 0);
474
482
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "permissionToken", void 0);
475
483
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "permissionTokenPayload", void 0);
484
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "permissionTokenReceivedLocalTime", void 0);
476
485
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resourceId", void 0);
477
486
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resourceUrl", void 0);
478
487
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selfId", void 0);
@@ -484,7 +493,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
484
493
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "environment", void 0);
485
494
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "namespace", _constants.MEETINGS);
486
495
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "allowMediaInLobby", void 0);
496
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "localShareInstanceId", void 0);
497
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "remoteShareInstanceId", void 0);
498
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "turnDiscoverySkippedReason", void 0);
499
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "turnServerUsed", void 0);
500
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "retriedWithTurnServer", void 0);
487
501
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sendSlotManager", new _sendSlotManager.default(_loggerProxy.default));
502
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "deferSDPAnswer", void 0);
503
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sdpResponseTimer", void 0);
504
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hasMediaConnectionConnectedAtLeastOnce", void 0);
488
505
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "processRelayEvent", function (e) {
489
506
  switch (e.data.relayType) {
490
507
  case _constants3.REACTION_RELAY_TYPES.REACTION:
@@ -570,7 +587,61 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
570
587
  });
571
588
  }
572
589
  });
590
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "roapMessageReceived", function (roapMessage) {
591
+ var mediaServer = _util2.default.getMediaServer(roapMessage.sdp);
592
+ _this.mediaProperties.webrtcMediaConnection.roapMessageReceived(roapMessage);
593
+ if (mediaServer) {
594
+ _this.mediaProperties.webrtcMediaConnection.mediaServer = mediaServer;
595
+ }
596
+ });
597
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setupSdpListeners", function () {
598
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.REMOTE_SDP_ANSWER_PROCESSED, function () {
599
+ // @ts-ignore
600
+ var cdl = _this.webex.internal.newMetrics.callDiagnosticLatencies;
601
+
602
+ // @ts-ignore
603
+ _this.webex.internal.newMetrics.submitClientEvent({
604
+ name: 'client.media-engine.remote-sdp-received',
605
+ options: {
606
+ meetingId: _this.id
607
+ }
608
+ });
609
+ _metrics.default.sendBehavioralMetric(_constants2.default.ROAP_OFFER_TO_ANSWER_LATENCY, {
610
+ correlation_id: _this.correlationId,
611
+ latency: cdl.getLocalSDPGenRemoteSDPRecv(),
612
+ meetingId: _this.id
613
+ });
614
+ if (_this.deferSDPAnswer) {
615
+ _this.deferSDPAnswer.resolve();
616
+ clearTimeout(_this.sdpResponseTimer);
617
+ _this.sdpResponseTimer = undefined;
618
+ }
619
+ });
620
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.LOCAL_SDP_OFFER_GENERATED, function () {
621
+ // @ts-ignore
622
+ _this.webex.internal.newMetrics.submitClientEvent({
623
+ name: 'client.media-engine.local-sdp-generated',
624
+ options: {
625
+ meetingId: _this.id
626
+ }
627
+ });
628
+
629
+ // Instantiate Defer so that the SDP offer/answer exchange timeout can start, see waitForRemoteSDPAnswer()
630
+ _this.deferSDPAnswer = new _common.Defer();
631
+ });
632
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.LOCAL_SDP_ANSWER_GENERATED, function () {
633
+ // we are sending "remote-sdp-received" only after we've generated the answer - this indicates that we've fully processed that incoming offer
634
+ // @ts-ignore
635
+ _this.webex.internal.newMetrics.submitClientEvent({
636
+ name: 'client.media-engine.remote-sdp-received',
637
+ options: {
638
+ meetingId: _this.id
639
+ }
640
+ });
641
+ });
642
+ });
573
643
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setupMediaConnectionListeners", function () {
644
+ _this.setupSdpListeners();
574
645
  _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.ROAP_STARTED, function () {
575
646
  _this.isRoapInProgress = true;
576
647
  });
@@ -584,13 +655,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
584
655
  var LOG_HEADER = "Meeting:index#setupMediaConnectionListeners.ROAP_MESSAGE_TO_SEND --> correlationId=".concat(_this.correlationId);
585
656
  switch (event.roapMessage.messageType) {
586
657
  case 'OK':
587
- // @ts-ignore
588
- _this.webex.internal.newMetrics.submitClientEvent({
589
- name: 'client.media-engine.remote-sdp-received',
590
- options: {
591
- meetingId: _this.id
592
- }
593
- });
594
658
  logRequest(_this.roap.sendRoapOK({
595
659
  seq: event.roapMessage.seq,
596
660
  mediaId: _this.mediaId,
@@ -600,32 +664,26 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
600
664
  });
601
665
  break;
602
666
  case 'OFFER':
603
- // @ts-ignore
604
- _this.webex.internal.newMetrics.submitClientEvent({
605
- name: 'client.media-engine.local-sdp-generated',
606
- options: {
607
- meetingId: _this.id
608
- }
609
- });
610
667
  logRequest(_this.roap.sendRoapMediaRequest({
611
668
  sdp: event.roapMessage.sdp,
612
669
  seq: event.roapMessage.seq,
613
670
  tieBreaker: event.roapMessage.tieBreaker,
614
- meeting: (0, _assertThisInitialized2.default)(_this),
615
- // or can pass meeting ID
616
- reconnect: _this.reconnectionManager.isReconnectInProgress()
671
+ meeting: (0, _assertThisInitialized2.default)(_this) // or can pass meeting ID
672
+ }).then(function (_ref2) {
673
+ var roapAnswer = _ref2.roapAnswer;
674
+ if (roapAnswer) {
675
+ _loggerProxy.default.logger.log("".concat(LOG_HEADER, " received Roap ANSWER in http response"));
676
+ _this.roapMessageReceived(roapAnswer);
677
+ }
617
678
  }), {
618
679
  logText: "".concat(LOG_HEADER, " Roap Offer")
680
+ }).catch(function () {
681
+ _this.deferSDPAnswer.reject();
682
+ clearTimeout(_this.sdpResponseTimer);
683
+ _this.sdpResponseTimer = undefined;
619
684
  });
620
685
  break;
621
686
  case 'ANSWER':
622
- // @ts-ignore
623
- _this.webex.internal.newMetrics.submitClientEvent({
624
- name: 'client.media-engine.remote-sdp-received',
625
- options: {
626
- meetingId: _this.id
627
- }
628
- });
629
687
  logRequest(_this.roap.sendRoapAnswer({
630
688
  sdp: event.roapMessage.sdp,
631
689
  seq: event.roapMessage.seq,
@@ -675,7 +733,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
675
733
  _loggerProxy.default.logger.log("Meeting:index#setupMediaConnectionListeners --> REMOTE_TRACK_ADDED event received for webrtcMediaConnection: ".concat((0, _stringify.default)(event)));
676
734
  if (event.track) {
677
735
  var mediaTrack = event.track;
678
- var remoteStream = new _mediaHelpers.RemoteStream(_util4.default.createMediaStream([mediaTrack]));
736
+ var remoteStream = new _mediaHelpers.RemoteStream(_util5.default.createMediaStream([mediaTrack]));
679
737
 
680
738
  // eslint-disable-next-line @typescript-eslint/no-shadow
681
739
  var eventType;
@@ -710,63 +768,66 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
710
768
  });
711
769
  _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.CONNECTION_STATE_CHANGED, function (event) {
712
770
  var connectionFailed = function connectionFailed() {
713
- // we know the media connection failed and browser will not attempt to recover it any more
714
- // so reset the timer as it's not needed anymore, we want to reconnect immediately
715
- _this.reconnectionManager.resetReconnectionTimer();
716
- _this.reconnect({
717
- networkDisconnect: true
718
- });
719
- // @ts-ignore
720
- _this.webex.internal.newMetrics.submitClientEvent({
721
- name: 'client.ice.end',
722
- payload: {
723
- canProceed: false,
724
- icePhase: 'IN_MEETING',
725
- errors: [
726
- // @ts-ignore
727
- _this.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode({
728
- clientErrorCode: _internalPluginMetrics.CALL_DIAGNOSTIC_CONFIG.ICE_FAILURE_CLIENT_CODE
729
- })]
730
- },
731
- options: {
732
- meetingId: _this.id
733
- }
734
- });
735
- _this.uploadLogs({
736
- file: 'peer-connection-manager/index',
737
- function: 'connectionFailed'
738
- });
739
771
  _metrics.default.sendBehavioralMetric(_constants2.default.CONNECTION_FAILURE, {
740
772
  correlation_id: _this.correlationId,
741
- locus_id: _this.locusId
773
+ locus_id: _this.locusId,
774
+ networkStatus: _this.networkStatus,
775
+ hasMediaConnectionConnectedAtLeastOnce: _this.hasMediaConnectionConnectedAtLeastOnce
742
776
  });
777
+ if (_this.hasMediaConnectionConnectedAtLeastOnce) {
778
+ // we know the media connection failed and browser will not attempt to recover it any more
779
+ // so reset the timer as it's not needed anymore, we want to reconnect immediately
780
+ _this.reconnectionManager.resetReconnectionTimer();
781
+ _this.reconnect({
782
+ networkDisconnect: true
783
+ });
784
+ _this.uploadLogs({
785
+ file: 'peer-connection-manager/index',
786
+ function: 'connectionFailed'
787
+ });
788
+ }
743
789
  };
744
790
  _loggerProxy.default.logger.info("Meeting:index#setupMediaConnectionListeners --> correlationId=".concat(_this.correlationId, " connection state changed to ").concat(event.state));
791
+
792
+ // @ts-ignore
793
+ var cdl = _this.webex.internal.newMetrics.callDiagnosticLatencies;
745
794
  switch (event.state) {
746
795
  case _internalMediaCore.ConnectionState.Connecting:
747
- // @ts-ignore
748
- _this.webex.internal.newMetrics.submitClientEvent({
749
- name: 'client.ice.start',
750
- options: {
751
- meetingId: _this.id
752
- }
753
- });
796
+ if (!_this.hasMediaConnectionConnectedAtLeastOnce) {
797
+ // Only send CA event for join flow if we haven't successfully connected media yet
798
+ // @ts-ignore
799
+ _this.webex.internal.newMetrics.submitClientEvent({
800
+ name: 'client.ice.start',
801
+ options: {
802
+ meetingId: _this.id
803
+ }
804
+ });
805
+ }
754
806
  break;
755
807
  case _internalMediaCore.ConnectionState.Connected:
756
- // @ts-ignore
757
- _this.webex.internal.newMetrics.submitClientEvent({
758
- name: 'client.ice.end',
759
- options: {
760
- meetingId: _this.id
761
- }
762
- });
808
+ if (!_this.hasMediaConnectionConnectedAtLeastOnce) {
809
+ // Only send CA event for join flow if we haven't successfully connected media yet
810
+ // @ts-ignore
811
+ _this.webex.internal.newMetrics.submitClientEvent({
812
+ name: 'client.ice.end',
813
+ payload: {
814
+ canProceed: true,
815
+ icePhase: 'JOIN_MEETING_FINAL'
816
+ },
817
+ options: {
818
+ meetingId: _this.id
819
+ }
820
+ });
821
+ }
763
822
  _metrics.default.sendBehavioralMetric(_constants2.default.CONNECTION_SUCCESS, {
764
823
  correlation_id: _this.correlationId,
765
- locus_id: _this.locusId
824
+ locus_id: _this.locusId,
825
+ latency: cdl.getICESetupTime()
766
826
  });
767
827
  _this.setNetworkStatus(_constants.NETWORK_STATUS.CONNECTED);
768
828
  _this.reconnectionManager.iceReconnected();
769
829
  _this.statsAnalyzer.startAnalyzer(_this.mediaProperties.webrtcMediaConnection);
830
+ _this.hasMediaConnectionConnectedAtLeastOnce = true;
770
831
  break;
771
832
  case _internalMediaCore.ConnectionState.Disconnected:
772
833
  _this.setNetworkStatus(_constants.NETWORK_STATUS.DISCONNECTED);
@@ -851,7 +912,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
851
912
  _this.webex.internal.newMetrics.submitClientEvent({
852
913
  name: 'client.media.tx.start',
853
914
  payload: {
854
- mediaType: data.type
915
+ mediaType: data.type,
916
+ shareInstanceId: data.type === 'share' ? _this.localShareInstanceId : undefined
855
917
  },
856
918
  options: {
857
919
  meetingId: _this.id
@@ -863,7 +925,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
863
925
  _this.webex.internal.newMetrics.submitClientEvent({
864
926
  name: 'client.media.tx.stop',
865
927
  payload: {
866
- mediaType: data.type
928
+ mediaType: data.type,
929
+ shareInstanceId: data.type === 'share' ? _this.localShareInstanceId : undefined
867
930
  },
868
931
  options: {
869
932
  meetingId: _this.id
@@ -879,7 +942,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
879
942
  _this.webex.internal.newMetrics.submitClientEvent({
880
943
  name: 'client.media.rx.start',
881
944
  payload: {
882
- mediaType: data.type
945
+ mediaType: data.type,
946
+ shareInstanceId: data.type === 'share' ? _this.remoteShareInstanceId : undefined
883
947
  },
884
948
  options: {
885
949
  meetingId: _this.id
@@ -891,7 +955,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
891
955
  _this.webex.internal.newMetrics.submitClientEvent({
892
956
  name: 'client.media.rx.stop',
893
957
  payload: {
894
- mediaType: data.type
958
+ mediaType: data.type,
959
+ shareInstanceId: data.type === 'share' ? _this.remoteShareInstanceId : undefined
895
960
  },
896
961
  options: {
897
962
  meetingId: _this.id
@@ -899,6 +964,35 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
899
964
  });
900
965
  });
901
966
  });
967
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "forceSendStatsReport", /*#__PURE__*/function () {
968
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref3) {
969
+ var callFrom, LOG_HEADER, _this$mediaProperties, _this$mediaProperties2;
970
+ return _regenerator.default.wrap(function _callee$(_context) {
971
+ while (1) switch (_context.prev = _context.next) {
972
+ case 0:
973
+ callFrom = _ref3.callFrom;
974
+ LOG_HEADER = "Meeting:index#forceSendStatsReport --> called from ".concat(callFrom, " : ");
975
+ _context.prev = 2;
976
+ _context.next = 5;
977
+ return (_this$mediaProperties = _this.mediaProperties) === null || _this$mediaProperties === void 0 ? void 0 : (_this$mediaProperties2 = _this$mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties2 === void 0 ? void 0 : _this$mediaProperties2.forceRtcMetricsSend();
978
+ case 5:
979
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " successfully uploaded available webrtc telemetry statistics"));
980
+ _context.next = 11;
981
+ break;
982
+ case 8:
983
+ _context.prev = 8;
984
+ _context.t0 = _context["catch"](2);
985
+ _loggerProxy.default.logger.error("".concat(LOG_HEADER, " failed to upload webrtc telemetry statistics: "), _context.t0);
986
+ case 11:
987
+ case "end":
988
+ return _context.stop();
989
+ }
990
+ }, _callee, null, [[2, 8]]);
991
+ }));
992
+ return function (_x) {
993
+ return _ref4.apply(this, arguments);
994
+ };
995
+ }());
902
996
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaNegotiatedEvent", function () {
903
997
  // @ts-ignore - config coming from registerPlugin
904
998
  if (_this.config.experimental.enableMediaNegotiatedEvent) {
@@ -937,67 +1031,74 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
937
1031
  });
938
1032
  }
939
1033
  });
940
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleShareAudioStreamEnded", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
941
- return _regenerator.default.wrap(function _callee$(_context) {
942
- while (1) switch (_context.prev = _context.next) {
1034
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleShareAudioStreamEnded", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
1035
+ return _regenerator.default.wrap(function _callee2$(_context2) {
1036
+ while (1) switch (_context2.prev = _context2.next) {
943
1037
  case 0:
944
1038
  if (!(_this.wirelessShare && !_this.mediaProperties.shareVideoStream)) {
945
- _context.next = 4;
1039
+ _context2.next = 4;
946
1040
  break;
947
1041
  }
948
1042
  _this.leave({
949
1043
  reason: _constants.MEETING_REMOVED_REASON.USER_ENDED_SHARE_STREAMS
950
1044
  });
951
- _context.next = 12;
1045
+ _context2.next = 12;
952
1046
  break;
953
1047
  case 4:
954
- _context.prev = 4;
955
- _context.next = 7;
1048
+ _context2.prev = 4;
1049
+ _context2.next = 7;
956
1050
  return _this.unpublishStreams([_this.mediaProperties.shareAudioStream]);
957
1051
  case 7:
958
- _context.next = 12;
1052
+ _context2.next = 12;
959
1053
  break;
960
1054
  case 9:
961
- _context.prev = 9;
962
- _context.t0 = _context["catch"](4);
963
- _loggerProxy.default.logger.log('Meeting:index#handleShareAudioStreamEnded --> Error stopping share: ', _context.t0);
1055
+ _context2.prev = 9;
1056
+ _context2.t0 = _context2["catch"](4);
1057
+ _loggerProxy.default.logger.log('Meeting:index#handleShareAudioStreamEnded --> Error stopping share: ', _context2.t0);
964
1058
  case 12:
965
1059
  case "end":
966
- return _context.stop();
1060
+ return _context2.stop();
967
1061
  }
968
- }, _callee, null, [[4, 9]]);
1062
+ }, _callee2, null, [[4, 9]]);
969
1063
  })));
970
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleShareVideoStreamEnded", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
971
- return _regenerator.default.wrap(function _callee2$(_context2) {
972
- while (1) switch (_context2.prev = _context2.next) {
1064
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleShareVideoStreamMuteStateChange", function (muted) {
1065
+ _loggerProxy.default.logger.log("Meeting:index#handleShareVideoStreamMuteStateChange --> Share video stream mute state changed to muted ".concat(muted));
1066
+ _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_SHARE_VIDEO_MUTE_STATE_CHANGE, {
1067
+ correlationId: _this.correlationId,
1068
+ muted: muted
1069
+ });
1070
+ });
1071
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleShareVideoStreamEnded", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
1072
+ return _regenerator.default.wrap(function _callee3$(_context3) {
1073
+ while (1) switch (_context3.prev = _context3.next) {
973
1074
  case 0:
974
1075
  if (!(_this.wirelessShare && !_this.mediaProperties.shareAudioStream)) {
975
- _context2.next = 4;
1076
+ _context3.next = 4;
976
1077
  break;
977
1078
  }
978
1079
  _this.leave({
979
1080
  reason: _constants.MEETING_REMOVED_REASON.USER_ENDED_SHARE_STREAMS
980
1081
  });
981
- _context2.next = 12;
1082
+ _context3.next = 12;
982
1083
  break;
983
1084
  case 4:
984
- _context2.prev = 4;
985
- _context2.next = 7;
1085
+ _context3.prev = 4;
1086
+ _context3.next = 7;
986
1087
  return _this.unpublishStreams([_this.mediaProperties.shareVideoStream]);
987
1088
  case 7:
988
- _context2.next = 12;
1089
+ _context3.next = 12;
989
1090
  break;
990
1091
  case 9:
991
- _context2.prev = 9;
992
- _context2.t0 = _context2["catch"](4);
993
- _loggerProxy.default.logger.log('Meeting:index#handleShareVideoStreamEnded --> Error stopping share: ', _context2.t0);
1092
+ _context3.prev = 9;
1093
+ _context3.t0 = _context3["catch"](4);
1094
+ _loggerProxy.default.logger.log('Meeting:index#handleShareVideoStreamEnded --> Error stopping share: ', _context3.t0);
994
1095
  case 12:
995
1096
  _this.triggerStoppedSharing();
996
1097
  case 13:
997
1098
  case "end":
998
- return _context2.stop();
1099
+ return _context3.stop();
999
1100
  }
1000
- }, _callee2, null, [[4, 9]]);
1101
+ }, _callee3, null, [[4, 9]]);
1001
1102
  })));
1002
1103
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "triggerStoppedSharing", function () {
1003
1104
  if (!_this.mediaProperties.hasLocalShareStream()) {
@@ -1078,18 +1179,20 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1078
1179
  */
1079
1180
  _this.id = _uuid.default.v4();
1080
1181
  /**
1081
- * Correlation ID used for network tracking of meeting
1182
+ * Call state used for metrics
1082
1183
  * @instance
1083
- * @type {String}
1184
+ * @type {CallStateForMetrics}
1084
1185
  * @readonly
1085
1186
  * @public
1086
1187
  * @memberof Meeting
1087
1188
  */
1088
- if (attrs.correlationId) {
1089
- _loggerProxy.default.logger.log("Meetings:index#constructor --> Initializing the meeting object with correlation id from app ".concat(_this.correlationId));
1090
- _this.correlationId = attrs.correlationId;
1189
+ _this.callStateForMetrics = attrs.callStateForMetrics || {};
1190
+ var _correlationId = attrs.correlationId || ((_attrs$callStateForMe = attrs.callStateForMetrics) === null || _attrs$callStateForMe === void 0 ? void 0 : _attrs$callStateForMe.correlationId);
1191
+ if (_correlationId) {
1192
+ _loggerProxy.default.logger.log("Meetings:index#constructor --> Initializing the meeting object with correlation id from app ".concat(_correlationId));
1193
+ _this.callStateForMetrics.correlationId = _correlationId;
1091
1194
  } else {
1092
- _this.correlationId = _this.id;
1195
+ _this.callStateForMetrics.correlationId = _this.id;
1093
1196
  }
1094
1197
  /**
1095
1198
  * @instance
@@ -1165,12 +1268,22 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1165
1268
  _this.annotation = new _annotation.default({
1166
1269
  parent: _this.webex
1167
1270
  });
1271
+ /**
1272
+ * @instance
1273
+ * @type {Webinar}
1274
+ * @public
1275
+ * @memberof Meeting
1276
+ */
1277
+ // @ts-ignore
1278
+ _this.webinar = new _webinar.default({}, {
1279
+ parent: _this.webex
1280
+ });
1168
1281
  /**
1169
1282
  * helper class for managing receive slots (for multistream media connections)
1170
1283
  */
1171
1284
  _this.receiveSlotManager = new _receiveSlotManager.ReceiveSlotManager(function (mediaType) {
1172
- var _this$mediaProperties;
1173
- if (!((_this$mediaProperties = _this.mediaProperties) !== null && _this$mediaProperties !== void 0 && _this$mediaProperties.webrtcMediaConnection)) {
1285
+ var _this$mediaProperties3;
1286
+ if (!((_this$mediaProperties3 = _this.mediaProperties) !== null && _this$mediaProperties3 !== void 0 && _this$mediaProperties3.webrtcMediaConnection)) {
1174
1287
  return _promise.default.reject(new Error('Webrtc media connection is missing'));
1175
1288
  }
1176
1289
  return _this.mediaProperties.webrtcMediaConnection.createReceiveSlot(mediaType);
@@ -1524,13 +1637,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1524
1637
  */
1525
1638
  _this.networkQualityMonitor = null;
1526
1639
  /**
1640
+ * Indicates network status of the webrtc media connection
1527
1641
  * @instance
1528
1642
  * @type {String}
1529
1643
  * @readonly
1530
1644
  * @public
1531
1645
  * @memberof Meeting
1532
1646
  */
1533
- _this.networkStatus = null;
1647
+ _this.networkStatus = undefined;
1534
1648
  /**
1535
1649
  * Passing only info as we send basic info for meeting added event
1536
1650
  * @instance
@@ -1653,6 +1767,24 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1653
1767
  */
1654
1768
  _this.keepAliveTimerId = null;
1655
1769
 
1770
+ /**
1771
+ * id for tracking Local Share instances in Call Analyzer
1772
+ * @instance
1773
+ * @type {String}
1774
+ * @private
1775
+ * @memberof Meeting
1776
+ */
1777
+ _this.localShareInstanceId = null;
1778
+
1779
+ /**
1780
+ * id for tracking Remote Share instances in Call Analyzer
1781
+ * @instance
1782
+ * @type {String}
1783
+ * @private
1784
+ * @memberof Meeting
1785
+ */
1786
+ _this.remoteShareInstanceId = null;
1787
+
1656
1788
  /**
1657
1789
  * The class that helps to control recording functions: start, stop, pause, resume, etc
1658
1790
  * @instance
@@ -1686,11 +1818,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1686
1818
  * helper class for managing remote streams
1687
1819
  */
1688
1820
  _this.remoteMediaManager = null;
1689
- _this.localAudioStreamMuteStateHandler = function (muted) {
1690
- _this.audio.handleLocalStreamMuteStateChange((0, _assertThisInitialized2.default)(_this), muted);
1821
+ _this.localAudioStreamMuteStateHandler = function () {
1822
+ _this.audio.handleLocalStreamMuteStateChange((0, _assertThisInitialized2.default)(_this));
1691
1823
  };
1692
- _this.localVideoStreamMuteStateHandler = function (muted) {
1693
- _this.video.handleLocalStreamMuteStateChange((0, _assertThisInitialized2.default)(_this), muted);
1824
+ _this.localVideoStreamMuteStateHandler = function () {
1825
+ _this.video.handleLocalStreamMuteStateChange((0, _assertThisInitialized2.default)(_this));
1694
1826
  };
1695
1827
 
1696
1828
  // The handling of output track changes should be done inside
@@ -1702,6 +1834,60 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1702
1834
  _this.updateTranscodedMediaConnection();
1703
1835
  }
1704
1836
  };
1837
+
1838
+ /**
1839
+ * Promise that exists if SDP offer has been generated, and resolves once sdp answer is received.
1840
+ * @instance
1841
+ * @type {Defer}
1842
+ * @private
1843
+ * @memberof Meeting
1844
+ */
1845
+ _this.deferSDPAnswer = undefined;
1846
+
1847
+ /**
1848
+ * Timer for waiting for sdp answer.
1849
+ * @instance
1850
+ * @type {ReturnType<typeof setTimeout>}
1851
+ * @private
1852
+ * @memberof Meeting
1853
+ */
1854
+ _this.sdpResponseTimer = undefined;
1855
+
1856
+ /**
1857
+ * Reason why TURN discovery is skipped.
1858
+ * @instance
1859
+ * @type {string}
1860
+ * @public
1861
+ * @memberof Meeting
1862
+ */
1863
+ _this.turnDiscoverySkippedReason = undefined;
1864
+
1865
+ /**
1866
+ * Whether TURN discovery is used or not.
1867
+ * @instance
1868
+ * @type {boolean}
1869
+ * @public
1870
+ * @memberof Meeting
1871
+ */
1872
+ _this.turnServerUsed = false;
1873
+
1874
+ /**
1875
+ * Whether retry was done using TURN Discovery.
1876
+ * @instance
1877
+ * @type {boolean}
1878
+ * @private
1879
+ * @memberof Meeting
1880
+ */
1881
+ _this.retriedWithTurnServer = false;
1882
+
1883
+ /**
1884
+ * Whether or not the media connection has ever successfully connected.
1885
+ * @instance
1886
+ * @type {boolean}
1887
+ * @private
1888
+ * @memberof Meeting
1889
+ */
1890
+ _this.hasMediaConnectionConnectedAtLeastOnce = false;
1705
1891
  return _this;
1706
1892
  }
1707
1893
 
@@ -1743,133 +1929,320 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1743
1929
  }
1744
1930
 
1745
1931
  /**
1746
- * Fetches meeting information.
1747
- * @param {Object} options
1748
- * @param {String} [options.password] optional
1749
- * @param {String} [options.captchaCode] optional
1750
- * @public
1751
- * @memberof Meeting
1752
- * @returns {Promise}
1932
+ * Getter - Returns callStateForMetrics.correlationId
1933
+ * @returns {string}
1753
1934
  */
1754
1935
  }, {
1755
- key: "fetchMeetingInfo",
1936
+ key: "correlationId",
1937
+ get: function get() {
1938
+ return this.callStateForMetrics.correlationId;
1939
+ }
1940
+
1941
+ /**
1942
+ * Setter - sets callStateForMetrics.correlationId
1943
+ * @param {string} correlationId
1944
+ */,
1945
+ set: function set(correlationId) {
1946
+ this.callStateForMetrics.correlationId = correlationId;
1947
+ }
1948
+
1949
+ /**
1950
+ * Set meeting info and trigger `MEETING_INFO_AVAILABLE` event
1951
+ * @param {any} info
1952
+ * @param {string} [meetingLookupUrl] Lookup url, defined when the meeting info fetched
1953
+ * @returns {void}
1954
+ */
1955
+ }, {
1956
+ key: "setMeetingInfo",
1957
+ value: function setMeetingInfo(info, meetingLookupUrl) {
1958
+ this.meetingInfo = info ? _objectSpread(_objectSpread({}, info), {}, {
1959
+ meetingLookupUrl: meetingLookupUrl
1960
+ }) : null;
1961
+ this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.NONE;
1962
+ this.requiredCaptcha = null;
1963
+ if (this.passwordStatus === _constants.PASSWORD_STATUS.REQUIRED || this.passwordStatus === _constants.PASSWORD_STATUS.VERIFIED) {
1964
+ this.passwordStatus = _constants.PASSWORD_STATUS.VERIFIED;
1965
+ } else {
1966
+ this.passwordStatus = _constants.PASSWORD_STATUS.NOT_REQUIRED;
1967
+ }
1968
+ _triggerProxy.default.trigger(this, {
1969
+ file: 'meetings',
1970
+ function: 'fetchMeetingInfo'
1971
+ }, _constants.EVENT_TRIGGERS.MEETING_INFO_AVAILABLE);
1972
+ this.updateMeetingActions();
1973
+ }
1974
+
1975
+ /**
1976
+ * Add pre-fetched meeting info
1977
+ *
1978
+ * The passed meeting info should be be complete, e.g.: fetched after password or captcha provided
1979
+ *
1980
+ * @param {Object} meetingInfo - Complete meeting info
1981
+ * @param {FetchMeetingInfoParams} fetchParams - Fetch parameters for validation
1982
+ * @param {String|undefined} meetingLookupUrl - Lookup url, defined when the meeting info fetched
1983
+ * @returns {Promise<void>}
1984
+ */
1985
+ }, {
1986
+ key: "injectMeetingInfo",
1756
1987
  value: function () {
1757
- var _fetchMeetingInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref4) {
1758
- var _ref4$password, password, _ref4$captchaCode, captchaCode, _ref4$extraParams, extraParams, captchaInfo, info, _err$body, _err$body2;
1759
- return _regenerator.default.wrap(function _callee3$(_context3) {
1760
- while (1) switch (_context3.prev = _context3.next) {
1988
+ var _injectMeetingInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(meetingInfo, fetchParams, meetingLookupUrl) {
1989
+ return _regenerator.default.wrap(function _callee4$(_context4) {
1990
+ while (1) switch (_context4.prev = _context4.next) {
1761
1991
  case 0:
1762
- _ref4$password = _ref4.password, password = _ref4$password === void 0 ? null : _ref4$password, _ref4$captchaCode = _ref4.captchaCode, captchaCode = _ref4$captchaCode === void 0 ? null : _ref4$captchaCode, _ref4$extraParams = _ref4.extraParams, extraParams = _ref4$extraParams === void 0 ? {} : _ref4$extraParams;
1763
- // when fetch meeting info is called directly by the client, we want to clear out the random timer for sdk to do it
1764
- if (this.fetchMeetingInfoTimeoutId) {
1765
- clearTimeout(this.fetchMeetingInfoTimeoutId);
1766
- this.fetchMeetingInfoTimeoutId = undefined;
1767
- }
1768
- if (!(captchaCode && !this.requiredCaptcha)) {
1769
- _context3.next = 4;
1770
- break;
1771
- }
1772
- return _context3.abrupt("return", _promise.default.reject(new Error('fetchMeetingInfo() called with captchaCode when captcha was not required')));
1992
+ _context4.next = 2;
1993
+ return this.prepForFetchMeetingInfo(fetchParams, 'injectMeetingInfo');
1994
+ case 2:
1995
+ this.parseMeetingInfo(meetingInfo, this.destination);
1996
+ this.setMeetingInfo(meetingInfo, meetingLookupUrl);
1773
1997
  case 4:
1774
- if (!(password && this.passwordStatus !== _constants.PASSWORD_STATUS.REQUIRED && this.passwordStatus !== _constants.PASSWORD_STATUS.UNKNOWN)) {
1775
- _context3.next = 6;
1776
- break;
1777
- }
1778
- return _context3.abrupt("return", _promise.default.reject(new Error('fetchMeetingInfo() called with password when password was not required')));
1779
- case 6:
1780
- _context3.prev = 6;
1998
+ case "end":
1999
+ return _context4.stop();
2000
+ }
2001
+ }, _callee4, this);
2002
+ }));
2003
+ function injectMeetingInfo(_x2, _x3, _x4) {
2004
+ return _injectMeetingInfo.apply(this, arguments);
2005
+ }
2006
+ return injectMeetingInfo;
2007
+ }()
2008
+ /**
2009
+ * Validate fetch parameters and clear the fetchMeetingInfoTimeout timeout
2010
+ *
2011
+ * @param {FetchMeetingInfoParams} fetchParams - fetch parameters for validation
2012
+ * @param {String} caller - Name of the caller for logging
2013
+ *
2014
+ * @returns {Promise<void>}
2015
+ * @private
2016
+ */
2017
+ }, {
2018
+ key: "prepForFetchMeetingInfo",
2019
+ value: function prepForFetchMeetingInfo(_ref7, caller) {
2020
+ var _ref7$password = _ref7.password,
2021
+ password = _ref7$password === void 0 ? null : _ref7$password,
2022
+ _ref7$captchaCode = _ref7.captchaCode,
2023
+ captchaCode = _ref7$captchaCode === void 0 ? null : _ref7$captchaCode,
2024
+ _ref7$extraParams = _ref7.extraParams,
2025
+ extraParams = _ref7$extraParams === void 0 ? {} : _ref7$extraParams;
2026
+ // when fetch meeting info is called directly by the client, we want to clear out the random timer for sdk to do it
2027
+ if (this.fetchMeetingInfoTimeoutId) {
2028
+ clearTimeout(this.fetchMeetingInfoTimeoutId);
2029
+ this.fetchMeetingInfoTimeoutId = undefined;
2030
+ }
2031
+ if (captchaCode && !this.requiredCaptcha) {
2032
+ return _promise.default.reject(new Error("".concat(caller, "() called with captchaCode when captcha was not required")));
2033
+ }
2034
+ if (password && this.passwordStatus !== _constants.PASSWORD_STATUS.REQUIRED && this.passwordStatus !== _constants.PASSWORD_STATUS.UNKNOWN) {
2035
+ return _promise.default.reject(new Error("".concat(caller, "() called with password when password was not required")));
2036
+ }
2037
+ this.meetingInfoExtraParams = (0, _cloneDeep2.default)(extraParams);
2038
+ return _promise.default.resolve();
2039
+ }
2040
+
2041
+ /**
2042
+ * Internal method for fetching meeting info
2043
+ *
2044
+ * @returns {Promise}
2045
+ */
2046
+ }, {
2047
+ key: "fetchMeetingInfoInternal",
2048
+ value: function () {
2049
+ var _fetchMeetingInfoInternal = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(_ref8) {
2050
+ var destination, destinationType, _ref8$password, password, _ref8$captchaCode, captchaCode, _ref8$extraParams, extraParams, _ref8$sendCAevents, sendCAevents, captchaInfo, info, _err$body, _err$body2;
2051
+ return _regenerator.default.wrap(function _callee5$(_context5) {
2052
+ while (1) switch (_context5.prev = _context5.next) {
2053
+ case 0:
2054
+ destination = _ref8.destination, destinationType = _ref8.destinationType, _ref8$password = _ref8.password, password = _ref8$password === void 0 ? null : _ref8$password, _ref8$captchaCode = _ref8.captchaCode, captchaCode = _ref8$captchaCode === void 0 ? null : _ref8$captchaCode, _ref8$extraParams = _ref8.extraParams, extraParams = _ref8$extraParams === void 0 ? {} : _ref8$extraParams, _ref8$sendCAevents = _ref8.sendCAevents, sendCAevents = _ref8$sendCAevents === void 0 ? false : _ref8$sendCAevents;
2055
+ _context5.prev = 1;
1781
2056
  captchaInfo = captchaCode ? {
1782
2057
  code: captchaCode,
1783
2058
  id: this.requiredCaptcha.captchaId
1784
2059
  } : null;
1785
- _context3.next = 10;
1786
- return this.attrs.meetingInfoProvider.fetchMeetingInfo(this.destination, this.destinationType, password, captchaInfo,
2060
+ _context5.next = 5;
2061
+ return this.attrs.meetingInfoProvider.fetchMeetingInfo(destination, destinationType, password, captchaInfo,
1787
2062
  // @ts-ignore - config coming from registerPlugin
1788
2063
  this.config.installedOrgID, this.locusId, extraParams, {
1789
- meetingId: this.id
2064
+ meetingId: this.id,
2065
+ sendCAevents: sendCAevents
1790
2066
  });
1791
- case 10:
1792
- info = _context3.sent;
1793
- this.parseMeetingInfo(info, this.destination);
1794
- this.meetingInfo = info ? _objectSpread(_objectSpread({}, info.body), {}, {
1795
- meetingLookupUrl: info === null || info === void 0 ? void 0 : info.url
1796
- }) : null;
1797
- this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.NONE;
1798
- this.requiredCaptcha = null;
1799
- if (this.passwordStatus === _constants.PASSWORD_STATUS.REQUIRED || this.passwordStatus === _constants.PASSWORD_STATUS.VERIFIED) {
1800
- this.passwordStatus = _constants.PASSWORD_STATUS.VERIFIED;
1801
- } else {
1802
- this.passwordStatus = _constants.PASSWORD_STATUS.NOT_REQUIRED;
1803
- }
1804
- _triggerProxy.default.trigger(this, {
1805
- file: 'meetings',
1806
- function: 'fetchMeetingInfo'
1807
- }, _constants.EVENT_TRIGGERS.MEETING_INFO_AVAILABLE);
1808
- this.updateMeetingActions();
1809
- return _context3.abrupt("return", _promise.default.resolve());
1810
- case 21:
1811
- _context3.prev = 21;
1812
- _context3.t0 = _context3["catch"](6);
2067
+ case 5:
2068
+ info = _context5.sent;
2069
+ this.parseMeetingInfo(info === null || info === void 0 ? void 0 : info.body, this.destination, info === null || info === void 0 ? void 0 : info.errors);
2070
+ this.setMeetingInfo(info === null || info === void 0 ? void 0 : info.body, info === null || info === void 0 ? void 0 : info.url);
2071
+ return _context5.abrupt("return", _promise.default.resolve());
2072
+ case 11:
2073
+ _context5.prev = 11;
2074
+ _context5.t0 = _context5["catch"](1);
1813
2075
  this.updateMeetingActions();
1814
- if (!(_context3.t0 instanceof _meetingInfoV.MeetingInfoV2PolicyError)) {
1815
- _context3.next = 31;
2076
+ if (!(_context5.t0 instanceof _meetingInfoV.MeetingInfoV2PolicyError)) {
2077
+ _context5.next = 21;
1816
2078
  break;
1817
2079
  }
1818
2080
  this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.POLICY;
1819
- this.meetingInfoFailureCode = _context3.t0.wbxAppApiCode;
1820
- if (_context3.t0.meetingInfo) {
1821
- this.meetingInfo = _context3.t0.meetingInfo;
2081
+ this.meetingInfoFailureCode = _context5.t0.wbxAppApiCode;
2082
+ if (_context5.t0.meetingInfo) {
2083
+ this.meetingInfo = _context5.t0.meetingInfo;
1822
2084
  }
1823
2085
  throw new _permission.default();
1824
- case 31:
1825
- if (!(_context3.t0 instanceof _meetingInfoV.MeetingInfoV2PasswordError)) {
1826
- _context3.next = 43;
2086
+ case 21:
2087
+ if (!(_context5.t0 instanceof _meetingInfoV.MeetingInfoV2PasswordError)) {
2088
+ _context5.next = 33;
1827
2089
  break;
1828
2090
  }
1829
2091
  _loggerProxy.default.logger.info( // @ts-ignore
1830
- "Meeting:index#fetchMeetingInfo --> Info Unable to fetch meeting info for ".concat(this.destination, " - password required (code=").concat(_context3.t0 === null || _context3.t0 === void 0 ? void 0 : (_err$body = _context3.t0.body) === null || _err$body === void 0 ? void 0 : _err$body.code, ")."));
2092
+ "Meeting:index#fetchMeetingInfo --> Info Unable to fetch meeting info for ".concat(this.destination, " - password required (code=").concat(_context5.t0 === null || _context5.t0 === void 0 ? void 0 : (_err$body = _context5.t0.body) === null || _err$body === void 0 ? void 0 : _err$body.code, ")."));
1831
2093
 
1832
2094
  // when wbxappapi requires password it still populates partial meeting info in the response
1833
- if (_context3.t0.meetingInfo) {
1834
- this.meetingInfo = _context3.t0.meetingInfo;
1835
- this.meetingNumber = _context3.t0.meetingInfo.meetingNumber;
2095
+ if (_context5.t0.meetingInfo) {
2096
+ this.meetingInfo = _context5.t0.meetingInfo;
2097
+ this.meetingNumber = _context5.t0.meetingInfo.meetingNumber;
1836
2098
  }
1837
- this.meetingInfoFailureCode = _context3.t0.wbxAppApiCode;
2099
+ this.meetingInfoFailureCode = _context5.t0.wbxAppApiCode;
1838
2100
  this.passwordStatus = _constants.PASSWORD_STATUS.REQUIRED;
1839
2101
  this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.WRONG_PASSWORD;
1840
2102
  if (!this.requiredCaptcha) {
1841
- _context3.next = 40;
2103
+ _context5.next = 30;
1842
2104
  break;
1843
2105
  }
1844
- _context3.next = 40;
2106
+ _context5.next = 30;
1845
2107
  return this.refreshCaptcha();
1846
- case 40:
2108
+ case 30:
1847
2109
  throw new _passwordError.default();
1848
- case 43:
1849
- if (!(_context3.t0 instanceof _meetingInfoV.MeetingInfoV2CaptchaError)) {
1850
- _context3.next = 52;
2110
+ case 33:
2111
+ if (!(_context5.t0 instanceof _meetingInfoV.MeetingInfoV2CaptchaError)) {
2112
+ _context5.next = 42;
1851
2113
  break;
1852
2114
  }
1853
2115
  _loggerProxy.default.logger.info( // @ts-ignore
1854
- "Meeting:index#fetchMeetingInfo --> Info Unable to fetch meeting info for ".concat(this.destination, " - captcha required (code=").concat(_context3.t0 === null || _context3.t0 === void 0 ? void 0 : (_err$body2 = _context3.t0.body) === null || _err$body2 === void 0 ? void 0 : _err$body2.code, ")."));
2116
+ "Meeting:index#fetchMeetingInfo --> Info Unable to fetch meeting info for ".concat(this.destination, " - captcha required (code=").concat(_context5.t0 === null || _context5.t0 === void 0 ? void 0 : (_err$body2 = _context5.t0.body) === null || _err$body2 === void 0 ? void 0 : _err$body2.code, ")."));
1855
2117
  this.meetingInfoFailureReason = this.requiredCaptcha ? _constants.MEETING_INFO_FAILURE_REASON.WRONG_CAPTCHA : _constants.MEETING_INFO_FAILURE_REASON.WRONG_PASSWORD;
1856
- this.meetingInfoFailureCode = _context3.t0.wbxAppApiCode;
1857
- if (_context3.t0.isPasswordRequired) {
2118
+ this.meetingInfoFailureCode = _context5.t0.wbxAppApiCode;
2119
+ if (_context5.t0.isPasswordRequired) {
1858
2120
  this.passwordStatus = _constants.PASSWORD_STATUS.REQUIRED;
1859
2121
  }
1860
- this.requiredCaptcha = _context3.t0.captchaInfo;
2122
+ this.requiredCaptcha = _context5.t0.captchaInfo;
1861
2123
  throw new _captchaError.default();
1862
- case 52:
2124
+ case 42:
1863
2125
  this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.OTHER;
1864
- throw _context3.t0;
1865
- case 54:
2126
+ throw _context5.t0;
2127
+ case 44:
1866
2128
  case "end":
1867
- return _context3.stop();
2129
+ return _context5.stop();
1868
2130
  }
1869
- }, _callee3, this, [[6, 21]]);
2131
+ }, _callee5, this, [[1, 11]]);
1870
2132
  }));
1871
- function fetchMeetingInfo(_x) {
1872
- return _fetchMeetingInfo.apply(this, arguments);
2133
+ function fetchMeetingInfoInternal(_x5) {
2134
+ return _fetchMeetingInfoInternal.apply(this, arguments);
2135
+ }
2136
+ return fetchMeetingInfoInternal;
2137
+ }()
2138
+ /**
2139
+ * Refreshes the meeting info permission token (it's required for joining meetings)
2140
+ *
2141
+ * @param {string} [reason] used for metrics and logging purposes (optional)
2142
+ * @returns {Promise}
2143
+ */
2144
+ }, {
2145
+ key: "refreshPermissionToken",
2146
+ value: function () {
2147
+ var _refreshPermissionToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(reason) {
2148
+ var _this$meetingInfo;
2149
+ var isStartingSpaceInstantV2Meeting, destination, destinationType, permissionTokenExpiryInfo, timeLeft, expiryTime, currentTime;
2150
+ return _regenerator.default.wrap(function _callee6$(_context6) {
2151
+ while (1) switch (_context6.prev = _context6.next) {
2152
+ case 0:
2153
+ if ((_this$meetingInfo = this.meetingInfo) !== null && _this$meetingInfo !== void 0 && _this$meetingInfo.permissionToken) {
2154
+ _context6.next = 3;
2155
+ break;
2156
+ }
2157
+ _loggerProxy.default.logger.info("Meeting:index#refreshPermissionToken --> cannot refresh the permission token, because we don't have it (reason=".concat(reason, ")"));
2158
+ return _context6.abrupt("return");
2159
+ case 3:
2160
+ isStartingSpaceInstantV2Meeting = this.destinationType === _constants._CONVERSATION_URL_ &&
2161
+ // @ts-ignore - config coming from registerPlugin
2162
+ this.config.experimental.enableAdhocMeetings &&
2163
+ // @ts-ignore
2164
+ this.webex.meetings.preferredWebexSite;
2165
+ destination = isStartingSpaceInstantV2Meeting ? this.meetingInfo.meetingJoinUrl : this.destination;
2166
+ destinationType = isStartingSpaceInstantV2Meeting ? _constants._MEETING_LINK_ : this.destinationType;
2167
+ permissionTokenExpiryInfo = this.getPermissionTokenExpiryInfo();
2168
+ timeLeft = permissionTokenExpiryInfo === null || permissionTokenExpiryInfo === void 0 ? void 0 : permissionTokenExpiryInfo.timeLeft;
2169
+ expiryTime = permissionTokenExpiryInfo === null || permissionTokenExpiryInfo === void 0 ? void 0 : permissionTokenExpiryInfo.expiryTime;
2170
+ currentTime = permissionTokenExpiryInfo === null || permissionTokenExpiryInfo === void 0 ? void 0 : permissionTokenExpiryInfo.currentTime;
2171
+ _loggerProxy.default.logger.info("Meeting:index#refreshPermissionToken --> refreshing permission token, destinationType=".concat(destinationType, ", timeLeft=").concat(timeLeft, ", permissionTokenExpiry=").concat(expiryTime, ", currentTimestamp=").concat(currentTime, ",reason=").concat(reason));
2172
+ _metrics.default.sendBehavioralMetric(_constants2.default.PERMISSION_TOKEN_REFRESH, {
2173
+ correlationId: this.correlationId,
2174
+ timeLeft: timeLeft,
2175
+ expiryTime: expiryTime,
2176
+ currentTime: currentTime,
2177
+ reason: reason,
2178
+ destinationType: destinationType
2179
+ });
2180
+ _context6.prev = 12;
2181
+ _context6.next = 15;
2182
+ return this.fetchMeetingInfoInternal({
2183
+ destination: destination,
2184
+ destinationType: destinationType,
2185
+ extraParams: _objectSpread(_objectSpread({}, this.meetingInfoExtraParams), {}, {
2186
+ permissionToken: this.meetingInfo.permissionToken
2187
+ }),
2188
+ sendCAevents: true // because if we're refreshing the permissionToken, it means that user is intending to join that meeting, so we want CA events
2189
+ });
2190
+ case 15:
2191
+ _context6.next = 22;
2192
+ break;
2193
+ case 17:
2194
+ _context6.prev = 17;
2195
+ _context6.t0 = _context6["catch"](12);
2196
+ _loggerProxy.default.logger.info('Meeting:index#refreshPermissionToken --> failed to refresh the permission token:', _context6.t0);
2197
+ _metrics.default.sendBehavioralMetric(_constants2.default.PERMISSION_TOKEN_REFRESH_ERROR, {
2198
+ correlationId: this.correlationId,
2199
+ reason: _context6.t0.message,
2200
+ stack: _context6.t0.stack
2201
+ });
2202
+ throw _context6.t0;
2203
+ case 22:
2204
+ case "end":
2205
+ return _context6.stop();
2206
+ }
2207
+ }, _callee6, this, [[12, 17]]);
2208
+ }));
2209
+ function refreshPermissionToken(_x6) {
2210
+ return _refreshPermissionToken.apply(this, arguments);
2211
+ }
2212
+ return refreshPermissionToken;
2213
+ }()
2214
+ /**
2215
+ * Fetches meeting information.
2216
+ * @param {Object} options
2217
+ * @param {String} [options.password] optional
2218
+ * @param {String} [options.captchaCode] optional
2219
+ * @param {Boolean} [options.sendCAevents] optional - Whether to submit Call Analyzer events or not. Default: false.
2220
+ * @public
2221
+ * @memberof Meeting
2222
+ * @returns {Promise}
2223
+ */
2224
+ }, {
2225
+ key: "fetchMeetingInfo",
2226
+ value: function () {
2227
+ var _fetchMeetingInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(options) {
2228
+ return _regenerator.default.wrap(function _callee7$(_context7) {
2229
+ while (1) switch (_context7.prev = _context7.next) {
2230
+ case 0:
2231
+ _context7.next = 2;
2232
+ return this.prepForFetchMeetingInfo(options, 'fetchMeetingInfo');
2233
+ case 2:
2234
+ return _context7.abrupt("return", this.fetchMeetingInfoInternal(_objectSpread({
2235
+ destination: this.destination,
2236
+ destinationType: this.destinationType
2237
+ }, options)));
2238
+ case 3:
2239
+ case "end":
2240
+ return _context7.stop();
2241
+ }
2242
+ }, _callee7, this);
2243
+ }));
2244
+ function fetchMeetingInfo(_x7) {
2245
+ return _fetchMeetingInfo.apply(this, arguments);
1873
2246
  }
1874
2247
  return fetchMeetingInfo;
1875
2248
  }()
@@ -1878,6 +2251,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1878
2251
  * password and captcha code were correct or not.
1879
2252
  * @param {String} password - this can be either a password or a host key, can be undefined if only captcha was required
1880
2253
  * @param {String} captchaCode - can be undefined if captcha was not required by the server
2254
+ * @param {Boolean} sendCAevents - whether Call Analyzer events should be sent when fetching meeting information
1881
2255
  * @public
1882
2256
  * @memberof Meeting
1883
2257
  * @returns {Promise<{isPasswordValid: boolean, requiredCaptcha: boolean, failureReason: MEETING_INFO_FAILURE_REASON}>}
@@ -1886,9 +2260,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1886
2260
  key: "verifyPassword",
1887
2261
  value: function verifyPassword(password, captchaCode) {
1888
2262
  var _this2 = this;
2263
+ var sendCAevents = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1889
2264
  return this.fetchMeetingInfo({
1890
2265
  password: password,
1891
- captchaCode: captchaCode
2266
+ captchaCode: captchaCode,
2267
+ sendCAevents: sendCAevents
1892
2268
  }).then(function () {
1893
2269
  _metrics.default.sendBehavioralMetric(_constants2.default.VERIFY_PASSWORD_SUCCESS);
1894
2270
  return {
@@ -2158,7 +2534,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2158
2534
 
2159
2535
  /**
2160
2536
  * sets the network status on meeting object
2161
- * @param {String} networkStatus
2537
+ * @param {NETWORK_STATUS} networkStatus
2162
2538
  * @private
2163
2539
  * @returns {undefined}
2164
2540
  * @memberof Meeting
@@ -2312,10 +2688,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2312
2688
  key: "setupLocusControlsListener",
2313
2689
  value: function setupLocusControlsListener() {
2314
2690
  var _this13 = this;
2315
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED, function (_ref5) {
2316
- var state = _ref5.state,
2317
- modifiedBy = _ref5.modifiedBy,
2318
- lastModified = _ref5.lastModified;
2691
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED, function (_ref9) {
2692
+ var state = _ref9.state,
2693
+ modifiedBy = _ref9.modifiedBy,
2694
+ lastModified = _ref9.lastModified;
2319
2695
  var event;
2320
2696
  switch (state) {
2321
2697
  case _constants.RECORDING_STATE.RECORDING:
@@ -2346,8 +2722,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2346
2722
  function: 'setupLocusControlsListener'
2347
2723
  }, event, _this13.recording);
2348
2724
  });
2349
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_CONTAINER_UPDATED, function (_ref6) {
2350
- var meetingContainerUrl = _ref6.meetingContainerUrl;
2725
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_CONTAINER_UPDATED, function (_ref10) {
2726
+ var meetingContainerUrl = _ref10.meetingContainerUrl;
2351
2727
  _triggerProxy.default.trigger(_this13, {
2352
2728
  file: 'meeting/index',
2353
2729
  function: 'setupLocusControlsListener'
@@ -2355,9 +2731,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2355
2731
  meetingContainerUrl: meetingContainerUrl
2356
2732
  });
2357
2733
  });
2358
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_TRANSCRIBE_UPDATED, function (_ref7) {
2359
- var caption = _ref7.caption,
2360
- transcribing = _ref7.transcribing;
2734
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_TRANSCRIBE_UPDATED, function (_ref11) {
2735
+ var caption = _ref11.caption,
2736
+ transcribing = _ref11.transcribing;
2361
2737
  // @ts-ignore - config coming from registerPlugin
2362
2738
  if (transcribing && _this13.transcription && _this13.config.receiveTranscription) {
2363
2739
  _this13.receiveTranscription();
@@ -2371,34 +2747,24 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2371
2747
  });
2372
2748
  }
2373
2749
  });
2374
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_BREAKOUT_UPDATED, function (_ref8) {
2375
- var breakout = _ref8.breakout;
2750
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_BREAKOUT_UPDATED, function (_ref12) {
2751
+ var breakout = _ref12.breakout;
2376
2752
  _this13.breakouts.updateBreakout(breakout);
2377
2753
  _triggerProxy.default.trigger(_this13, {
2378
2754
  file: 'meeting/index',
2379
2755
  function: 'setupLocusControlsListener'
2380
2756
  }, _constants.EVENT_TRIGGERS.MEETING_BREAKOUTS_UPDATE);
2381
2757
  });
2382
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_INTERPRETATION_UPDATED, function (_ref9) {
2383
- var interpretation = _ref9.interpretation;
2758
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_INTERPRETATION_UPDATED, function (_ref13) {
2759
+ var interpretation = _ref13.interpretation;
2384
2760
  _this13.simultaneousInterpretation.updateInterpretation(interpretation);
2385
2761
  _triggerProxy.default.trigger(_this13, {
2386
2762
  file: 'meeting/index',
2387
2763
  function: 'setupLocusControlsListener'
2388
2764
  }, _constants.EVENT_TRIGGERS.MEETING_INTERPRETATION_UPDATE);
2389
2765
  });
2390
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_JOIN_BREAKOUT_FROM_MAIN, function (_ref10) {
2391
- var mainLocusUrl = _ref10.mainLocusUrl;
2392
- _this13.meetingRequest.getLocusStatusByUrl(mainLocusUrl).catch(function (error) {
2393
- // clear main session cache when attendee join into breakout and forbidden to get locus from main locus url,
2394
- // which means main session is not active for the attendee
2395
- if ((error === null || error === void 0 ? void 0 : error.statusCode) === 403) {
2396
- _this13.locusInfo.clearMainSessionLocusCache();
2397
- }
2398
- });
2399
- });
2400
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_ENTRY_EXIT_TONE_UPDATED, function (_ref11) {
2401
- var entryExitTone = _ref11.entryExitTone;
2766
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_ENTRY_EXIT_TONE_UPDATED, function (_ref14) {
2767
+ var entryExitTone = _ref14.entryExitTone;
2402
2768
  _triggerProxy.default.trigger(_this13, {
2403
2769
  file: 'meeting/index',
2404
2770
  function: 'setupLocusControlsListener'
@@ -2406,8 +2772,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2406
2772
  entryExitTone: entryExitTone
2407
2773
  });
2408
2774
  });
2409
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MUTE_ON_ENTRY_CHANGED, function (_ref12) {
2410
- var state = _ref12.state;
2775
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MUTE_ON_ENTRY_CHANGED, function (_ref15) {
2776
+ var state = _ref15.state;
2411
2777
  _triggerProxy.default.trigger(_this13, {
2412
2778
  file: 'meeting/index',
2413
2779
  function: 'setupLocusControlsListener'
@@ -2415,8 +2781,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2415
2781
  state: state
2416
2782
  });
2417
2783
  });
2418
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_SHARE_CONTROL_CHANGED, function (_ref13) {
2419
- var state = _ref13.state;
2784
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_SHARE_CONTROL_CHANGED, function (_ref16) {
2785
+ var state = _ref16.state;
2420
2786
  _triggerProxy.default.trigger(_this13, {
2421
2787
  file: 'meeting/index',
2422
2788
  function: 'setupLocusControlsListener'
@@ -2424,8 +2790,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2424
2790
  state: state
2425
2791
  });
2426
2792
  });
2427
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_DISALLOW_UNMUTE_CHANGED, function (_ref14) {
2428
- var state = _ref14.state;
2793
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_DISALLOW_UNMUTE_CHANGED, function (_ref17) {
2794
+ var state = _ref17.state;
2429
2795
  _triggerProxy.default.trigger(_this13, {
2430
2796
  file: 'meeting/index',
2431
2797
  function: 'setupLocusControlsListener'
@@ -2433,8 +2799,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2433
2799
  state: state
2434
2800
  });
2435
2801
  });
2436
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_REACTIONS_CHANGED, function (_ref15) {
2437
- var state = _ref15.state;
2802
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_REACTIONS_CHANGED, function (_ref18) {
2803
+ var state = _ref18.state;
2438
2804
  _triggerProxy.default.trigger(_this13, {
2439
2805
  file: 'meeting/index',
2440
2806
  function: 'setupLocusControlsListener'
@@ -2442,8 +2808,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2442
2808
  state: state
2443
2809
  });
2444
2810
  });
2445
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_VIEW_THE_PARTICIPANTS_LIST_CHANGED, function (_ref16) {
2446
- var state = _ref16.state;
2811
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_VIEW_THE_PARTICIPANTS_LIST_CHANGED, function (_ref19) {
2812
+ var state = _ref19.state;
2447
2813
  _triggerProxy.default.trigger(_this13, {
2448
2814
  file: 'meeting/index',
2449
2815
  function: 'setupLocusControlsListener'
@@ -2451,8 +2817,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2451
2817
  state: state
2452
2818
  });
2453
2819
  });
2454
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_RAISE_HAND_CHANGED, function (_ref17) {
2455
- var state = _ref17.state;
2820
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_RAISE_HAND_CHANGED, function (_ref20) {
2821
+ var state = _ref20.state;
2456
2822
  _triggerProxy.default.trigger(_this13, {
2457
2823
  file: 'meeting/index',
2458
2824
  function: 'setupLocusControlsListener'
@@ -2460,8 +2826,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2460
2826
  state: state
2461
2827
  });
2462
2828
  });
2463
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_VIDEO_CHANGED, function (_ref18) {
2464
- var state = _ref18.state;
2829
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_VIDEO_CHANGED, function (_ref21) {
2830
+ var state = _ref21.state;
2465
2831
  _triggerProxy.default.trigger(_this13, {
2466
2832
  file: 'meeting/index',
2467
2833
  function: 'setupLocusControlsListener'
@@ -2507,21 +2873,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2507
2873
  var _this14 = this;
2508
2874
  // Will get triggered on local and remote share
2509
2875
  this.locusInfo.on(_constants.EVENTS.LOCUS_INFO_UPDATE_MEDIA_SHARES, /*#__PURE__*/function () {
2510
- var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(payload) {
2876
+ var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(payload) {
2511
2877
  var _payload$previous, _payload$previous2;
2512
2878
  var _payload$current, contentShare, whiteboardShare, previousContentShare, previousWhiteboardShare, newShareStatus, oldShareStatus, sendStartedSharingRemote, _this14$mediaProperti;
2513
- return _regenerator.default.wrap(function _callee4$(_context4) {
2514
- while (1) switch (_context4.prev = _context4.next) {
2879
+ return _regenerator.default.wrap(function _callee8$(_context8) {
2880
+ while (1) switch (_context8.prev = _context8.next) {
2515
2881
  case 0:
2516
2882
  _payload$current = payload.current, contentShare = _payload$current.content, whiteboardShare = _payload$current.whiteboard;
2517
2883
  previousContentShare = (_payload$previous = payload.previous) === null || _payload$previous === void 0 ? void 0 : _payload$previous.content;
2518
2884
  previousWhiteboardShare = (_payload$previous2 = payload.previous) === null || _payload$previous2 === void 0 ? void 0 : _payload$previous2.whiteboard;
2519
2885
  _this14.triggerAnnotationInfoEvent(contentShare, previousContentShare);
2520
- if (!(contentShare.beneficiaryId === (previousContentShare === null || previousContentShare === void 0 ? void 0 : previousContentShare.beneficiaryId) && contentShare.disposition === (previousContentShare === null || previousContentShare === void 0 ? void 0 : previousContentShare.disposition) && whiteboardShare.beneficiaryId === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.beneficiaryId) && whiteboardShare.disposition === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.disposition) && whiteboardShare.resourceUrl === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.resourceUrl))) {
2521
- _context4.next = 6;
2886
+ if (!(contentShare.beneficiaryId === (previousContentShare === null || previousContentShare === void 0 ? void 0 : previousContentShare.beneficiaryId) && contentShare.disposition === (previousContentShare === null || previousContentShare === void 0 ? void 0 : previousContentShare.disposition) && contentShare.deviceUrlSharing === previousContentShare.deviceUrlSharing && whiteboardShare.beneficiaryId === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.beneficiaryId) && whiteboardShare.disposition === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.disposition) && whiteboardShare.resourceUrl === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.resourceUrl))) {
2887
+ _context8.next = 6;
2522
2888
  break;
2523
2889
  }
2524
- return _context4.abrupt("return");
2890
+ return _context8.abrupt("return");
2525
2891
  case 6:
2526
2892
  newShareStatus = _this14.shareStatus; // REMOTE - check if remote started sharing
2527
2893
  if (_this14.selfId !== contentShare.beneficiaryId && contentShare.disposition === _constants.FLOOR_ACTION.GRANTED) {
@@ -2529,10 +2895,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2529
2895
  newShareStatus = _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE;
2530
2896
  }
2531
2897
  // LOCAL - check if we started sharing content
2532
- else if (_this14.selfId === contentShare.beneficiaryId && contentShare.disposition === _constants.FLOOR_ACTION.GRANTED) {
2898
+ else if (_this14.selfId === contentShare.beneficiaryId && contentShare.disposition === _constants.FLOOR_ACTION.GRANTED && contentShare.deviceUrlSharing === _this14.deviceUrl) {
2533
2899
  // CONTENT - sharing content local
2534
2900
  newShareStatus = _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE;
2535
2901
  }
2902
+ // SAME USER REMOTE - check if same user started sharing content from another client
2903
+ else if (_this14.selfId === contentShare.beneficiaryId && contentShare.disposition === _constants.FLOOR_ACTION.GRANTED && contentShare.deviceUrlSharing !== _this14.deviceUrl) {
2904
+ // CONTENT - same user sharing content remote
2905
+ newShareStatus = _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE;
2906
+ }
2536
2907
  // If we did not hit the cases above, no one is sharng content, so we check if we are sharing whiteboard
2537
2908
  // There is no concept of local/remote share for whiteboard
2538
2909
  // It does not matter who requested to share the whiteboard, everyone gets the same view
@@ -2545,22 +2916,22 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2545
2916
  newShareStatus = _constants.SHARE_STATUS.NO_SHARE;
2546
2917
  }
2547
2918
  if (!(newShareStatus !== _this14.shareStatus)) {
2548
- _context4.next = 45;
2919
+ _context8.next = 45;
2549
2920
  break;
2550
2921
  }
2551
2922
  oldShareStatus = _this14.shareStatus; // update our state before we send out any notifications
2552
2923
  _this14.shareStatus = newShareStatus;
2553
2924
 
2554
2925
  // send out "stop" notifications for the old state
2555
- _context4.t0 = oldShareStatus;
2556
- _context4.next = _context4.t0 === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE ? 14 : _context4.t0 === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE ? 16 : _context4.t0 === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE ? 18 : _context4.t0 === _constants.SHARE_STATUS.NO_SHARE ? 20 : 21;
2926
+ _context8.t0 = oldShareStatus;
2927
+ _context8.next = _context8.t0 === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE ? 14 : _context8.t0 === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE ? 16 : _context8.t0 === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE ? 18 : _context8.t0 === _constants.SHARE_STATUS.NO_SHARE ? 20 : 21;
2557
2928
  break;
2558
2929
  case 14:
2559
2930
  _triggerProxy.default.trigger(_this14, {
2560
2931
  file: 'meetings/index',
2561
2932
  function: 'remoteShare'
2562
2933
  }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_REMOTE);
2563
- return _context4.abrupt("break", 22);
2934
+ return _context8.abrupt("break", 22);
2564
2935
  case 16:
2565
2936
  _triggerProxy.default.trigger(_this14, {
2566
2937
  file: 'meeting/index',
@@ -2568,46 +2939,47 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2568
2939
  }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_LOCAL, {
2569
2940
  reason: _constants.SHARE_STOPPED_REASON.SELF_STOPPED
2570
2941
  });
2571
- return _context4.abrupt("break", 22);
2942
+ return _context8.abrupt("break", 22);
2572
2943
  case 18:
2573
2944
  _triggerProxy.default.trigger(_this14, {
2574
2945
  file: 'meeting/index',
2575
2946
  function: 'stopWhiteboardShare'
2576
2947
  }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_WHITEBOARD);
2577
- return _context4.abrupt("break", 22);
2948
+ return _context8.abrupt("break", 22);
2578
2949
  case 20:
2579
- return _context4.abrupt("break", 22);
2950
+ return _context8.abrupt("break", 22);
2580
2951
  case 21:
2581
- return _context4.abrupt("break", 22);
2952
+ return _context8.abrupt("break", 22);
2582
2953
  case 22:
2583
- _context4.t1 = newShareStatus;
2584
- _context4.next = _context4.t1 === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE ? 25 : _context4.t1 === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE ? 34 : _context4.t1 === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE ? 37 : _context4.t1 === _constants.SHARE_STATUS.NO_SHARE ? 40 : 41;
2954
+ _context8.t1 = newShareStatus;
2955
+ _context8.next = _context8.t1 === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE ? 25 : _context8.t1 === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE ? 34 : _context8.t1 === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE ? 37 : _context8.t1 === _constants.SHARE_STATUS.NO_SHARE ? 40 : 41;
2585
2956
  break;
2586
2957
  case 25:
2587
2958
  sendStartedSharingRemote = function sendStartedSharingRemote() {
2959
+ _this14.remoteShareInstanceId = contentShare.shareInstanceId;
2588
2960
  _triggerProxy.default.trigger(_this14, {
2589
2961
  file: 'meetings/index',
2590
2962
  function: 'remoteShare'
2591
2963
  }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_REMOTE, {
2592
2964
  memberId: contentShare.beneficiaryId,
2593
2965
  url: contentShare.url,
2594
- shareInstanceId: contentShare.shareInstanceId,
2966
+ shareInstanceId: _this14.remoteShareInstanceId,
2595
2967
  annotationInfo: contentShare.annotation
2596
2968
  });
2597
2969
  };
2598
- _context4.prev = 26;
2970
+ _context8.prev = 26;
2599
2971
  if (!((_this14$mediaProperti = _this14.mediaProperties.mediaDirection) !== null && _this14$mediaProperti !== void 0 && _this14$mediaProperti.sendShare && oldShareStatus === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE)) {
2600
- _context4.next = 30;
2972
+ _context8.next = 30;
2601
2973
  break;
2602
2974
  }
2603
- _context4.next = 30;
2975
+ _context8.next = 30;
2604
2976
  return _this14.unpublishStreams([_this14.mediaProperties.shareVideoStream, _this14.mediaProperties.shareAudioStream]);
2605
2977
  case 30:
2606
- _context4.prev = 30;
2978
+ _context8.prev = 30;
2607
2979
  sendStartedSharingRemote();
2608
- return _context4.finish(30);
2980
+ return _context8.finish(30);
2609
2981
  case 33:
2610
- return _context4.abrupt("break", 42);
2982
+ return _context8.abrupt("break", 42);
2611
2983
  case 34:
2612
2984
  _triggerProxy.default.trigger(_this14, {
2613
2985
  file: 'meeting/index',
@@ -2617,13 +2989,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2617
2989
  _this14.webex.internal.newMetrics.submitClientEvent({
2618
2990
  name: 'client.share.floor-granted.local',
2619
2991
  payload: {
2620
- mediaType: 'share'
2992
+ mediaType: 'share',
2993
+ shareInstanceId: _this14.localShareInstanceId
2621
2994
  },
2622
2995
  options: {
2623
2996
  meetingId: _this14.id
2624
2997
  }
2625
2998
  });
2626
- return _context4.abrupt("break", 42);
2999
+ return _context8.abrupt("break", 42);
2627
3000
  case 37:
2628
3001
  _triggerProxy.default.trigger(_this14, {
2629
3002
  file: 'meeting/index',
@@ -2642,26 +3015,27 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2642
3015
  meetingId: _this14.id
2643
3016
  }
2644
3017
  });
2645
- return _context4.abrupt("break", 42);
3018
+ return _context8.abrupt("break", 42);
2646
3019
  case 40:
2647
- return _context4.abrupt("break", 42);
3020
+ return _context8.abrupt("break", 42);
2648
3021
  case 41:
2649
- return _context4.abrupt("break", 42);
3022
+ return _context8.abrupt("break", 42);
2650
3023
  case 42:
2651
3024
  _this14.members.locusMediaSharesUpdate(payload);
2652
- _context4.next = 46;
3025
+ _context8.next = 46;
2653
3026
  break;
2654
3027
  case 45:
2655
3028
  if (newShareStatus === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE) {
2656
3029
  // if we got here, then some remote participant has stolen
2657
3030
  // the presentation from another remote participant
3031
+ _this14.remoteShareInstanceId = contentShare.shareInstanceId;
2658
3032
  _triggerProxy.default.trigger(_this14, {
2659
3033
  file: 'meetings/index',
2660
3034
  function: 'remoteShare'
2661
3035
  }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_REMOTE, {
2662
3036
  memberId: contentShare.beneficiaryId,
2663
3037
  url: contentShare.url,
2664
- shareInstanceId: contentShare.shareInstanceId,
3038
+ shareInstanceId: _this14.remoteShareInstanceId,
2665
3039
  annotationInfo: contentShare.annotation
2666
3040
  });
2667
3041
  _this14.members.locusMediaSharesUpdate(payload);
@@ -2689,12 +3063,12 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2689
3063
  }
2690
3064
  case 46:
2691
3065
  case "end":
2692
- return _context4.stop();
3066
+ return _context8.stop();
2693
3067
  }
2694
- }, _callee4, null, [[26,, 30, 33]]);
3068
+ }, _callee8, null, [[26,, 30, 33]]);
2695
3069
  }));
2696
- return function (_x2) {
2697
- return _ref19.apply(this, arguments);
3070
+ return function (_x8) {
3071
+ return _ref22.apply(this, arguments);
2698
3072
  };
2699
3073
  }());
2700
3074
  }
@@ -2720,6 +3094,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2720
3094
  _this15.locusId = (_this15$locusUrl = _this15.locusUrl) === null || _this15$locusUrl === void 0 ? void 0 : _this15$locusUrl.split('/').pop();
2721
3095
  _this15.recordingController.setLocusUrl(_this15.locusUrl);
2722
3096
  _this15.controlsOptionsManager.setLocusUrl(_this15.locusUrl);
3097
+ _this15.webinar.locusUrlUpdate(payload);
2723
3098
  _triggerProxy.default.trigger(_this15, {
2724
3099
  file: 'meeting/index',
2725
3100
  function: 'setUpLocusSelfListener'
@@ -2743,12 +3118,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2743
3118
  value: function setUpLocusServicesListener() {
2744
3119
  var _this16 = this;
2745
3120
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.LINKS_SERVICES, function (payload) {
2746
- var _payload$services, _payload$services$rec, _this16$locusInfo, _this16$locusInfo$ful, _payload$services2, _payload$services2$br, _payload$services3, _payload$services3$ap, _payload$services4, _payload$services4$ap;
3121
+ var _payload$services, _payload$services$rec, _this16$locusInfo, _this16$locusInfo$ful, _payload$services2, _payload$services2$br, _payload$services3, _payload$services3$ap, _payload$services4, _payload$services4$ap, _payload$services5, _payload$services5$we, _payload$services6, _payload$services6$we;
2747
3122
  _this16.recordingController.setServiceUrl(payload === null || payload === void 0 ? void 0 : (_payload$services = payload.services) === null || _payload$services === void 0 ? void 0 : (_payload$services$rec = _payload$services.record) === null || _payload$services$rec === void 0 ? void 0 : _payload$services$rec.url);
2748
3123
  _this16.recordingController.setSessionId((_this16$locusInfo = _this16.locusInfo) === null || _this16$locusInfo === void 0 ? void 0 : (_this16$locusInfo$ful = _this16$locusInfo.fullState) === null || _this16$locusInfo$ful === void 0 ? void 0 : _this16$locusInfo$ful.sessionId);
2749
3124
  _this16.breakouts.breakoutServiceUrlUpdate(payload === null || payload === void 0 ? void 0 : (_payload$services2 = payload.services) === null || _payload$services2 === void 0 ? void 0 : (_payload$services2$br = _payload$services2.breakout) === null || _payload$services2$br === void 0 ? void 0 : _payload$services2$br.url);
2750
3125
  _this16.annotation.approvalUrlUpdate(payload === null || payload === void 0 ? void 0 : (_payload$services3 = payload.services) === null || _payload$services3 === void 0 ? void 0 : (_payload$services3$ap = _payload$services3.approval) === null || _payload$services3$ap === void 0 ? void 0 : _payload$services3$ap.url);
2751
3126
  _this16.simultaneousInterpretation.approvalUrlUpdate(payload === null || payload === void 0 ? void 0 : (_payload$services4 = payload.services) === null || _payload$services4 === void 0 ? void 0 : (_payload$services4$ap = _payload$services4.approval) === null || _payload$services4$ap === void 0 ? void 0 : _payload$services4$ap.url);
3127
+ _this16.webinar.webcastUrlUpdate(payload === null || payload === void 0 ? void 0 : (_payload$services5 = payload.services) === null || _payload$services5 === void 0 ? void 0 : (_payload$services5$we = _payload$services5.webcast) === null || _payload$services5$we === void 0 ? void 0 : _payload$services5$we.url);
3128
+ _this16.webinar.webinarAttendeesSearchingUrlUpdate(payload === null || payload === void 0 ? void 0 : (_payload$services6 = payload.services) === null || _payload$services6 === void 0 ? void 0 : (_payload$services6$we = _payload$services6.webinarAttendeesSearching) === null || _payload$services6$we === void 0 ? void 0 : _payload$services6$we.url);
2752
3129
  });
2753
3130
  }
2754
3131
 
@@ -2782,12 +3159,20 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2782
3159
  });
2783
3160
  }
2784
3161
  });
2785
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.MEETING_INFO_UPDATED, function () {
3162
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.MEETING_INFO_UPDATED, function (_ref23) {
3163
+ var isInitializing = _ref23.isInitializing;
2786
3164
  _this17.updateMeetingActions();
2787
3165
  _this17.recordingController.setDisplayHints(_this17.userDisplayHints);
2788
3166
  _this17.recordingController.setUserPolicy(_this17.selfUserPolicies);
2789
3167
  _this17.controlsOptionsManager.setDisplayHints(_this17.userDisplayHints);
2790
3168
  _this17.handleDataChannelUrlChange(_this17.datachannelUrl);
3169
+ if (!isInitializing) {
3170
+ // send updated trigger only if locus is not initializing the meeting
3171
+ _triggerProxy.default.trigger(_this17, {
3172
+ file: 'meetings',
3173
+ function: 'setUpLocusInfoMeetingInfoListener'
3174
+ }, _constants.EVENT_TRIGGERS.MEETING_INFO_UPDATED);
3175
+ }
2791
3176
  });
2792
3177
  }
2793
3178
 
@@ -2973,17 +3358,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2973
3358
  }, _constants.EVENT_TRIGGERS.MEETING_BREAKOUTS_UPDATE);
2974
3359
  });
2975
3360
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_MEETING_INTERPRETATION_CHANGED, function (payload) {
2976
- _this19.simultaneousInterpretation.updateSelfInterpretation(payload);
3361
+ var targetChanged = _this19.simultaneousInterpretation.updateSelfInterpretation(payload);
2977
3362
  _triggerProxy.default.trigger(_this19, {
2978
3363
  file: 'meeting/index',
2979
3364
  function: 'setUpLocusInfoSelfListener'
2980
3365
  }, _constants.EVENT_TRIGGERS.MEETING_INTERPRETATION_UPDATE);
3366
+ if (targetChanged && _this19.mediaProperties.audioStream) {
3367
+ _this19.setSendNamedMediaGroup(_internalMediaCore.MediaType.AudioMain);
3368
+ }
2981
3369
  });
2982
3370
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_ROLES_CHANGED, function (payload) {
2983
- var _payload$newRoles, _payload$newRoles2, _payload$newRoles3;
3371
+ var _payload$newRoles, _payload$newRoles2, _payload$newRoles3, _payload$newRoles4;
2984
3372
  var isModeratorOrCohost = ((_payload$newRoles = payload.newRoles) === null || _payload$newRoles === void 0 ? void 0 : _payload$newRoles.includes(_constants.SELF_ROLES.MODERATOR)) || ((_payload$newRoles2 = payload.newRoles) === null || _payload$newRoles2 === void 0 ? void 0 : _payload$newRoles2.includes(_constants.SELF_ROLES.COHOST));
2985
3373
  _this19.breakouts.updateCanManageBreakouts(isModeratorOrCohost);
2986
3374
  _this19.simultaneousInterpretation.updateCanManageInterpreters((_payload$newRoles3 = payload.newRoles) === null || _payload$newRoles3 === void 0 ? void 0 : _payload$newRoles3.includes(_constants.SELF_ROLES.MODERATOR));
3375
+ _this19.webinar.updateCanManageWebcast((_payload$newRoles4 = payload.newRoles) === null || _payload$newRoles4 === void 0 ? void 0 : _payload$newRoles4.includes(_constants.SELF_ROLES.MODERATOR));
2987
3376
  _triggerProxy.default.trigger(_this19, {
2988
3377
  file: 'meeting/index',
2989
3378
  function: 'setUpLocusInfoSelfListener'
@@ -3025,48 +3414,48 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3025
3414
  }
3026
3415
  });
3027
3416
  this.locusInfo.on(_constants.EVENTS.DESTROY_MEETING, /*#__PURE__*/function () {
3028
- var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(payload) {
3029
- return _regenerator.default.wrap(function _callee5$(_context5) {
3030
- while (1) switch (_context5.prev = _context5.next) {
3417
+ var _ref24 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(payload) {
3418
+ return _regenerator.default.wrap(function _callee9$(_context9) {
3419
+ while (1) switch (_context9.prev = _context9.next) {
3031
3420
  case 0:
3032
3421
  if (!_this20.wirelessShare) {
3033
- _context5.next = 7;
3422
+ _context9.next = 7;
3034
3423
  break;
3035
3424
  }
3036
3425
  if (!_this20.mediaProperties.shareVideoStream) {
3037
- _context5.next = 4;
3426
+ _context9.next = 4;
3038
3427
  break;
3039
3428
  }
3040
- _context5.next = 4;
3429
+ _context9.next = 4;
3041
3430
  return _this20.setLocalShareVideoStream(undefined);
3042
3431
  case 4:
3043
3432
  if (!_this20.mediaProperties.shareAudioStream) {
3044
- _context5.next = 7;
3433
+ _context9.next = 7;
3045
3434
  break;
3046
3435
  }
3047
- _context5.next = 7;
3436
+ _context9.next = 7;
3048
3437
  return _this20.setLocalShareAudioStream(undefined);
3049
3438
  case 7:
3050
3439
  if (!payload.shouldLeave) {
3051
- _context5.next = 19;
3440
+ _context9.next = 19;
3052
3441
  break;
3053
3442
  }
3054
- _context5.prev = 8;
3055
- _context5.next = 11;
3443
+ _context9.prev = 8;
3444
+ _context9.next = 11;
3056
3445
  return _this20.leave({
3057
3446
  reason: payload.reason
3058
3447
  });
3059
3448
  case 11:
3060
3449
  _loggerProxy.default.logger.warn('Meeting:index#setUpLocusInfoMeetingListener --> DESTROY_MEETING. The meeting has been left, but has not been destroyed, you should see a later event for leave.');
3061
- _context5.next = 17;
3450
+ _context9.next = 17;
3062
3451
  break;
3063
3452
  case 14:
3064
- _context5.prev = 14;
3065
- _context5.t0 = _context5["catch"](8);
3453
+ _context9.prev = 14;
3454
+ _context9.t0 = _context9["catch"](8);
3066
3455
  // @ts-ignore
3067
- _loggerProxy.default.logger.error("Meeting:index#setUpLocusInfoMeetingListener --> DESTROY_MEETING. Issue with leave for meeting, meeting still in collection: ".concat(_this20, ", error: ").concat(_context5.t0));
3456
+ _loggerProxy.default.logger.error("Meeting:index#setUpLocusInfoMeetingListener --> DESTROY_MEETING. Issue with leave for meeting, meeting still in collection: ".concat(_this20, ", error: ").concat(_context9.t0));
3068
3457
  case 17:
3069
- _context5.next = 22;
3458
+ _context9.next = 22;
3070
3459
  break;
3071
3460
  case 19:
3072
3461
  _loggerProxy.default.logger.info('Meeting:index#setUpLocusInfoMeetingListener --> MEETING_REMOVED_REASON', payload.reason);
@@ -3080,12 +3469,12 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3080
3469
  });
3081
3470
  case 22:
3082
3471
  case "end":
3083
- return _context5.stop();
3472
+ return _context9.stop();
3084
3473
  }
3085
- }, _callee5, null, [[8, 14]]);
3474
+ }, _callee9, null, [[8, 14]]);
3086
3475
  }));
3087
- return function (_x3) {
3088
- return _ref20.apply(this, arguments);
3476
+ return function (_x9) {
3477
+ return _ref24.apply(this, arguments);
3089
3478
  };
3090
3479
  }());
3091
3480
  }
@@ -3234,12 +3623,19 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3234
3623
  /**
3235
3624
  * Sets the meeting info on the class instance
3236
3625
  * @param {Object} meetingInfo
3237
- * @param {Object} meetingInfo.body
3238
- * @param {String} meetingInfo.body.conversationUrl
3239
- * @param {String} meetingInfo.body.locusUrl
3240
- * @param {String} meetingInfo.body.sipUri
3241
- * @param {Object} meetingInfo.body.owner
3626
+ * @param {String} meetingInfo.conversationUrl
3627
+ * @param {String} meetingInfo.locusUrl
3628
+ * @param {String} meetingInfo.sipUri
3629
+ * @param {String} [meetingInfo.sipUrl]
3630
+ * @param {String} [meetingInfo.sipMeetingUri]
3631
+ * @param {String} [meetingInfo.meetingNumber]
3632
+ * @param {String} [meetingInfo.meetingJoinUrl]
3633
+ * @param {String} [meetingInfo.hostId]
3634
+ * @param {String} [meetingInfo.permissionToken]
3635
+ * @param {String} [meetingInfo.channel]
3636
+ * @param {Object} meetingInfo.owner
3242
3637
  * @param {Object | String} destination locus object with meeting data or destination string (sip url, meeting link, etc)
3638
+ * @param {Object | String} errors Meeting info request error
3243
3639
  * @returns {undefined}
3244
3640
  * @private
3245
3641
  * @memberof Meeting
@@ -3248,7 +3644,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3248
3644
  key: "parseMeetingInfo",
3249
3645
  value: function parseMeetingInfo(meetingInfo) {
3250
3646
  var destination = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
3251
- var webexMeetingInfo = meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.body;
3647
+ var errors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
3252
3648
  // We try to use as much info from Locus meeting object, stored in destination
3253
3649
 
3254
3650
  var locusMeetingObject;
@@ -3257,28 +3653,28 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3257
3653
  }
3258
3654
 
3259
3655
  // MeetingInfo will be undefined for 1:1 calls
3260
- if (locusMeetingObject || webexMeetingInfo && !(meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.errors && (meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.errors.length) > 0)) {
3656
+ if (locusMeetingObject || meetingInfo && !((errors === null || errors === void 0 ? void 0 : errors.length) > 0)) {
3261
3657
  var _locusMeetingObject, _locusMeetingObject2, _locusMeetingObject3, _locusMeetingObject4, _locusMeetingObject6, _locusMeetingObject7;
3262
- this.conversationUrl = ((_locusMeetingObject = locusMeetingObject) === null || _locusMeetingObject === void 0 ? void 0 : _locusMeetingObject.conversationUrl) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.conversationUrl) || this.conversationUrl;
3263
- this.locusUrl = ((_locusMeetingObject2 = locusMeetingObject) === null || _locusMeetingObject2 === void 0 ? void 0 : _locusMeetingObject2.url) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.locusUrl) || this.locusUrl;
3658
+ this.conversationUrl = ((_locusMeetingObject = locusMeetingObject) === null || _locusMeetingObject === void 0 ? void 0 : _locusMeetingObject.conversationUrl) || (meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.conversationUrl) || this.conversationUrl;
3659
+ this.locusUrl = ((_locusMeetingObject2 = locusMeetingObject) === null || _locusMeetingObject2 === void 0 ? void 0 : _locusMeetingObject2.url) || (meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.locusUrl) || this.locusUrl;
3264
3660
  // @ts-ignore - config coming from registerPlugin
3265
3661
  this.setSipUri(
3266
3662
  // @ts-ignore
3267
- this.config.experimental.enableUnifiedMeetings ? ((_locusMeetingObject3 = locusMeetingObject) === null || _locusMeetingObject3 === void 0 ? void 0 : _locusMeetingObject3.info.sipUri) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.sipUrl) : ((_locusMeetingObject4 = locusMeetingObject) === null || _locusMeetingObject4 === void 0 ? void 0 : _locusMeetingObject4.info.sipUri) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.sipMeetingUri) || this.sipUri);
3663
+ this.config.experimental.enableUnifiedMeetings ? ((_locusMeetingObject3 = locusMeetingObject) === null || _locusMeetingObject3 === void 0 ? void 0 : _locusMeetingObject3.info.sipUri) || (meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.sipUrl) : ((_locusMeetingObject4 = locusMeetingObject) === null || _locusMeetingObject4 === void 0 ? void 0 : _locusMeetingObject4.info.sipUri) || (meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.sipMeetingUri) || this.sipUri);
3268
3664
  // @ts-ignore - config coming from registerPlugin
3269
3665
  if (this.config.experimental.enableUnifiedMeetings) {
3270
3666
  var _locusMeetingObject5;
3271
- this.meetingNumber = ((_locusMeetingObject5 = locusMeetingObject) === null || _locusMeetingObject5 === void 0 ? void 0 : _locusMeetingObject5.info.webExMeetingId) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.meetingNumber);
3272
- this.meetingJoinUrl = webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.meetingJoinUrl;
3667
+ this.meetingNumber = ((_locusMeetingObject5 = locusMeetingObject) === null || _locusMeetingObject5 === void 0 ? void 0 : _locusMeetingObject5.info.webExMeetingId) || (meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.meetingNumber);
3668
+ this.meetingJoinUrl = meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.meetingJoinUrl;
3273
3669
  }
3274
- this.owner = ((_locusMeetingObject6 = locusMeetingObject) === null || _locusMeetingObject6 === void 0 ? void 0 : _locusMeetingObject6.info.owner) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.owner) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.hostId) || this.owner;
3275
- this.permissionToken = webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.permissionToken;
3276
- this.setPermissionTokenPayload(webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.permissionToken);
3670
+ this.owner = ((_locusMeetingObject6 = locusMeetingObject) === null || _locusMeetingObject6 === void 0 ? void 0 : _locusMeetingObject6.info.owner) || (meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.owner) || (meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.hostId) || this.owner;
3671
+ this.permissionToken = meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.permissionToken;
3672
+ this.setPermissionTokenPayload(meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.permissionToken);
3277
3673
  this.setSelfUserPolicies();
3278
3674
  // Need to populate environment when sending CA event
3279
- this.environment = ((_locusMeetingObject7 = locusMeetingObject) === null || _locusMeetingObject7 === void 0 ? void 0 : _locusMeetingObject7.info.channel) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.channel);
3675
+ this.environment = ((_locusMeetingObject7 = locusMeetingObject) === null || _locusMeetingObject7 === void 0 ? void 0 : _locusMeetingObject7.info.channel) || (meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.channel);
3280
3676
  }
3281
- _util.default.parseInterpretationInfo(this, webexMeetingInfo);
3677
+ _util.default.parseInterpretationInfo(this, meetingInfo);
3282
3678
  }
3283
3679
 
3284
3680
  /**
@@ -3310,25 +3706,29 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3310
3706
  }, {
3311
3707
  key: "updateMeetingActions",
3312
3708
  value: function updateMeetingActions() {
3313
- var _this$meetingInfo, _this$meetingInfo2, _this$meetingInfo3, _this$meetingInfo3$vi, _this$meetingInfo4, _this$meetingInfo4$vi;
3709
+ var _this$meetingInfo2, _this$meetingInfo3, _this$meetingInfo4, _this$meetingInfo4$vi, _this$meetingInfo5, _this$meetingInfo5$vi;
3314
3710
  var changed = false;
3315
3711
  changed = this.inMeetingActions.set({
3316
- canUseVoip: ((_this$meetingInfo = this.meetingInfo) === null || _this$meetingInfo === void 0 ? void 0 : _this$meetingInfo.supportVoIP) === true && _util3.default.hasPolicies({
3712
+ canUseVoip: ((_this$meetingInfo2 = this.meetingInfo) === null || _this$meetingInfo2 === void 0 ? void 0 : _this$meetingInfo2.supportVoIP) === true && _util4.default.hasPolicies({
3317
3713
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_VOIP],
3318
3714
  policies: this.selfUserPolicies
3319
3715
  }) || !this.arePolicyRestrictionsSupported(),
3320
- canDoVideo: _util3.default.hasPolicies({
3716
+ canDoVideo: _util4.default.hasPolicies({
3321
3717
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_VIDEO],
3322
3718
  policies: this.selfUserPolicies
3323
- }) && !!((_this$meetingInfo2 = this.meetingInfo) !== null && _this$meetingInfo2 !== void 0 && _this$meetingInfo2.video) || !this.arePolicyRestrictionsSupported(),
3324
- supportHDV: _util3.default.hasPolicies({
3719
+ }) && !!((_this$meetingInfo3 = this.meetingInfo) !== null && _this$meetingInfo3 !== void 0 && _this$meetingInfo3.video) || !this.arePolicyRestrictionsSupported(),
3720
+ supportHDV: _util4.default.hasPolicies({
3325
3721
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_HDV],
3326
3722
  policies: this.selfUserPolicies
3327
- }) && ((_this$meetingInfo3 = this.meetingInfo) === null || _this$meetingInfo3 === void 0 ? void 0 : (_this$meetingInfo3$vi = _this$meetingInfo3.video) === null || _this$meetingInfo3$vi === void 0 ? void 0 : _this$meetingInfo3$vi.supportHDV) || !this.arePolicyRestrictionsSupported(),
3328
- supportHQV: _util3.default.hasPolicies({
3723
+ }) && ((_this$meetingInfo4 = this.meetingInfo) === null || _this$meetingInfo4 === void 0 ? void 0 : (_this$meetingInfo4$vi = _this$meetingInfo4.video) === null || _this$meetingInfo4$vi === void 0 ? void 0 : _this$meetingInfo4$vi.supportHDV) || !this.arePolicyRestrictionsSupported(),
3724
+ enforceVirtualBackground: _util4.default.hasPolicies({
3725
+ requiredPolicies: [_constants.SELF_POLICY.ENFORCE_VIRTUAL_BACKGROUND],
3726
+ policies: this.selfUserPolicies
3727
+ }) && this.arePolicyRestrictionsSupported(),
3728
+ supportHQV: _util4.default.hasPolicies({
3329
3729
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_HQV],
3330
3730
  policies: this.selfUserPolicies
3331
- }) && ((_this$meetingInfo4 = this.meetingInfo) === null || _this$meetingInfo4 === void 0 ? void 0 : (_this$meetingInfo4$vi = _this$meetingInfo4.video) === null || _this$meetingInfo4$vi === void 0 ? void 0 : _this$meetingInfo4$vi.supportHQV) || !this.arePolicyRestrictionsSupported()
3731
+ }) && ((_this$meetingInfo5 = this.meetingInfo) === null || _this$meetingInfo5 === void 0 ? void 0 : (_this$meetingInfo5$vi = _this$meetingInfo5.video) === null || _this$meetingInfo5$vi === void 0 ? void 0 : _this$meetingInfo5$vi.supportHQV) || !this.arePolicyRestrictionsSupported()
3332
3732
  });
3333
3733
  if (this.userDisplayHints !== undefined) {
3334
3734
  changed = this.inMeetingActions.set({
@@ -3337,16 +3737,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3337
3737
  canLock: _util.default.canUserLock(this.userDisplayHints),
3338
3738
  canUnlock: _util.default.canUserUnlock(this.userDisplayHints),
3339
3739
  canShareWhiteBoard: _util.default.canShareWhiteBoard(this.userDisplayHints),
3340
- canSetDisallowUnmute: _util3.default.canSetDisallowUnmute(this.userDisplayHints),
3341
- canUnsetDisallowUnmute: _util3.default.canUnsetDisallowUnmute(this.userDisplayHints),
3342
- canSetMuteOnEntry: _util3.default.canSetMuteOnEntry(this.userDisplayHints),
3343
- canUnsetMuteOnEntry: _util3.default.canUnsetMuteOnEntry(this.userDisplayHints),
3344
- canSetMuted: _util3.default.canSetMuted(this.userDisplayHints),
3345
- canUnsetMuted: _util3.default.canUnsetMuted(this.userDisplayHints),
3346
- canStartRecording: _util2.default.canUserStart(this.userDisplayHints, this.selfUserPolicies),
3347
- canStopRecording: _util2.default.canUserStop(this.userDisplayHints, this.selfUserPolicies),
3348
- canPauseRecording: _util2.default.canUserPause(this.userDisplayHints, this.selfUserPolicies),
3349
- canResumeRecording: _util2.default.canUserResume(this.userDisplayHints, this.selfUserPolicies),
3740
+ canSetDisallowUnmute: _util4.default.canSetDisallowUnmute(this.userDisplayHints),
3741
+ canUnsetDisallowUnmute: _util4.default.canUnsetDisallowUnmute(this.userDisplayHints),
3742
+ canSetMuteOnEntry: _util4.default.canSetMuteOnEntry(this.userDisplayHints),
3743
+ canUnsetMuteOnEntry: _util4.default.canUnsetMuteOnEntry(this.userDisplayHints),
3744
+ canSetMuted: _util4.default.canSetMuted(this.userDisplayHints),
3745
+ canUnsetMuted: _util4.default.canUnsetMuted(this.userDisplayHints),
3746
+ canStartRecording: _util3.default.canUserStart(this.userDisplayHints, this.selfUserPolicies),
3747
+ canStopRecording: _util3.default.canUserStop(this.userDisplayHints, this.selfUserPolicies),
3748
+ canPauseRecording: _util3.default.canUserPause(this.userDisplayHints, this.selfUserPolicies),
3749
+ canResumeRecording: _util3.default.canUserResume(this.userDisplayHints, this.selfUserPolicies),
3350
3750
  canRaiseHand: _util.default.canUserRaiseHand(this.userDisplayHints),
3351
3751
  canLowerAllHands: _util.default.canUserLowerAllHands(this.userDisplayHints),
3352
3752
  canLowerSomeoneElsesHand: _util.default.canUserLowerSomeoneElsesHand(this.userDisplayHints),
@@ -3369,111 +3769,115 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3369
3769
  canUserAskForHelp: _util.default.canUserAskForHelp(this.userDisplayHints),
3370
3770
  canUserRenameSelfAndObserved: _util.default.canUserRenameSelfAndObserved(this.userDisplayHints),
3371
3771
  canUserRenameOthers: _util.default.canUserRenameOthers(this.userDisplayHints),
3372
- canMuteAll: _util3.default.hasHints({
3772
+ canMuteAll: _util4.default.hasHints({
3373
3773
  requiredHints: [_constants.DISPLAY_HINTS.MUTE_ALL],
3374
3774
  displayHints: this.userDisplayHints
3375
3775
  }),
3376
- canUnmuteAll: _util3.default.hasHints({
3776
+ canUnmuteAll: _util4.default.hasHints({
3377
3777
  requiredHints: [_constants.DISPLAY_HINTS.UNMUTE_ALL],
3378
3778
  displayHints: this.userDisplayHints
3379
3779
  }),
3380
- canEnableHardMute: _util3.default.hasHints({
3780
+ canEnableHardMute: _util4.default.hasHints({
3381
3781
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_HARD_MUTE],
3382
3782
  displayHints: this.userDisplayHints
3383
3783
  }),
3384
- canDisableHardMute: _util3.default.hasHints({
3784
+ canDisableHardMute: _util4.default.hasHints({
3385
3785
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_HARD_MUTE],
3386
3786
  displayHints: this.userDisplayHints
3387
3787
  }),
3388
- canEnableMuteOnEntry: _util3.default.hasHints({
3788
+ canEnableMuteOnEntry: _util4.default.hasHints({
3389
3789
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_MUTE_ON_ENTRY],
3390
3790
  displayHints: this.userDisplayHints
3391
3791
  }),
3392
- canDisableMuteOnEntry: _util3.default.hasHints({
3792
+ canDisableMuteOnEntry: _util4.default.hasHints({
3393
3793
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_MUTE_ON_ENTRY],
3394
3794
  displayHints: this.userDisplayHints
3395
3795
  }),
3396
- canEnableReactions: _util3.default.hasHints({
3796
+ canEnableReactions: _util4.default.hasHints({
3397
3797
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_REACTIONS],
3398
3798
  displayHints: this.userDisplayHints
3399
3799
  }),
3400
- canDisableReactions: _util3.default.hasHints({
3800
+ canDisableReactions: _util4.default.hasHints({
3401
3801
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_REACTIONS],
3402
3802
  displayHints: this.userDisplayHints
3403
3803
  }),
3404
- canEnableReactionDisplayNames: _util3.default.hasHints({
3804
+ canEnableReactionDisplayNames: _util4.default.hasHints({
3405
3805
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_SHOW_DISPLAY_NAME],
3406
3806
  displayHints: this.userDisplayHints
3407
3807
  }),
3408
- canDisableReactionDisplayNames: _util3.default.hasHints({
3808
+ canDisableReactionDisplayNames: _util4.default.hasHints({
3409
3809
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_SHOW_DISPLAY_NAME],
3410
3810
  displayHints: this.userDisplayHints
3411
3811
  }),
3412
- canUpdateShareControl: _util3.default.hasHints({
3812
+ canUpdateShareControl: _util4.default.hasHints({
3413
3813
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_CONTROL],
3414
3814
  displayHints: this.userDisplayHints
3415
3815
  }),
3416
- canEnableViewTheParticipantsList: _util3.default.hasHints({
3816
+ canEnableViewTheParticipantsList: _util4.default.hasHints({
3417
3817
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_VIEW_THE_PARTICIPANT_LIST],
3418
3818
  displayHints: this.userDisplayHints
3419
3819
  }),
3420
- canDisableViewTheParticipantsList: _util3.default.hasHints({
3820
+ canDisableViewTheParticipantsList: _util4.default.hasHints({
3421
3821
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_VIEW_THE_PARTICIPANT_LIST],
3422
3822
  displayHints: this.userDisplayHints
3423
3823
  }),
3424
- canEnableRaiseHand: _util3.default.hasHints({
3824
+ canEnableRaiseHand: _util4.default.hasHints({
3425
3825
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_RAISE_HAND],
3426
3826
  displayHints: this.userDisplayHints
3427
3827
  }),
3428
- canDisableRaiseHand: _util3.default.hasHints({
3828
+ canDisableRaiseHand: _util4.default.hasHints({
3429
3829
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_RAISE_HAND],
3430
3830
  displayHints: this.userDisplayHints
3431
3831
  }),
3432
- canEnableVideo: _util3.default.hasHints({
3832
+ canEnableVideo: _util4.default.hasHints({
3433
3833
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_VIDEO],
3434
3834
  displayHints: this.userDisplayHints
3435
3835
  }),
3436
- canDisableVideo: _util3.default.hasHints({
3836
+ canDisableVideo: _util4.default.hasHints({
3437
3837
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_VIDEO],
3438
3838
  displayHints: this.userDisplayHints
3439
3839
  }),
3440
- canShareFile: _util3.default.hasHints({
3840
+ canShareFile: _util4.default.hasHints({
3441
3841
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_FILE],
3442
3842
  displayHints: this.userDisplayHints
3443
- }) && _util3.default.hasPolicies({
3843
+ }) && _util4.default.hasPolicies({
3444
3844
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_FILE_SHARE],
3445
3845
  policies: this.selfUserPolicies
3446
3846
  }) || !this.arePolicyRestrictionsSupported,
3447
- canTransferFile: _util3.default.hasPolicies({
3847
+ canTransferFile: _util4.default.hasPolicies({
3448
3848
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_FILE_TRANSFER],
3449
3849
  policies: this.selfUserPolicies
3450
3850
  }),
3451
- canShareApplication: _util3.default.hasHints({
3851
+ canChat: _util4.default.hasPolicies({
3852
+ requiredPolicies: [_constants.SELF_POLICY.SUPPORT_CHAT],
3853
+ policies: this.selfUserPolicies
3854
+ }),
3855
+ canShareApplication: _util4.default.hasHints({
3452
3856
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_APPLICATION],
3453
3857
  displayHints: this.userDisplayHints
3454
- }) && _util3.default.hasPolicies({
3858
+ }) && _util4.default.hasPolicies({
3455
3859
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_APP_SHARE],
3456
3860
  policies: this.selfUserPolicies
3457
3861
  }) || !this.arePolicyRestrictionsSupported(),
3458
- canShareCamera: _util3.default.hasHints({
3862
+ canShareCamera: _util4.default.hasHints({
3459
3863
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_CAMERA],
3460
3864
  displayHints: this.userDisplayHints
3461
- }) && _util3.default.hasPolicies({
3865
+ }) && _util4.default.hasPolicies({
3462
3866
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_CAMERA_SHARE],
3463
3867
  policies: this.selfUserPolicies
3464
3868
  }),
3465
- canShareDesktop: _util3.default.hasHints({
3869
+ canShareDesktop: _util4.default.hasHints({
3466
3870
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_DESKTOP],
3467
3871
  displayHints: this.userDisplayHints
3468
- }) && _util3.default.hasPolicies({
3872
+ }) && _util4.default.hasPolicies({
3469
3873
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_DESKTOP_SHARE],
3470
3874
  policies: this.selfUserPolicies
3471
3875
  }) || !this.arePolicyRestrictionsSupported(),
3472
- canShareContent: _util3.default.hasHints({
3876
+ canShareContent: _util4.default.hasHints({
3473
3877
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_CONTENT],
3474
3878
  displayHints: this.userDisplayHints
3475
3879
  }) || !this.arePolicyRestrictionsSupported(),
3476
- canAnnotate: _util3.default.hasPolicies({
3880
+ canAnnotate: _util4.default.hasPolicies({
3477
3881
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_ANNOTATION],
3478
3882
  policies: this.selfUserPolicies
3479
3883
  })
@@ -3494,8 +3898,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3494
3898
  }, {
3495
3899
  key: "setSelfUserPolicies",
3496
3900
  value: function setSelfUserPolicies() {
3497
- var _this$permissionToken, _this$permissionToken2;
3901
+ var _this$permissionToken, _this$permissionToken2, _this$permissionToken3, _this$permissionToken4;
3498
3902
  this.selfUserPolicies = (_this$permissionToken = this.permissionTokenPayload) === null || _this$permissionToken === void 0 ? void 0 : (_this$permissionToken2 = _this$permissionToken.permission) === null || _this$permissionToken2 === void 0 ? void 0 : _this$permissionToken2.userPolicies;
3903
+ this.enforceVBGImagesURL = (_this$permissionToken3 = this.permissionTokenPayload) === null || _this$permissionToken3 === void 0 ? void 0 : (_this$permissionToken4 = _this$permissionToken3.permission) === null || _this$permissionToken4 === void 0 ? void 0 : _this$permissionToken4.enforceVBGImagesURL;
3499
3904
  }
3500
3905
 
3501
3906
  /**
@@ -3508,6 +3913,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3508
3913
  key: "setPermissionTokenPayload",
3509
3914
  value: function setPermissionTokenPayload(permissionToken) {
3510
3915
  this.permissionTokenPayload = _jsonwebtoken.default.decode(permissionToken);
3916
+ this.permissionTokenReceivedLocalTime = new Date().getTime();
3511
3917
  }
3512
3918
 
3513
3919
  /**
@@ -3606,11 +4012,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3606
4012
  key: "closeRemoteStreams",
3607
4013
  value: function closeRemoteStreams() {
3608
4014
  var _this22 = this;
3609
- var _this$mediaProperties2 = this.mediaProperties,
3610
- remoteAudioStream = _this$mediaProperties2.remoteAudioStream,
3611
- remoteVideoStream = _this$mediaProperties2.remoteVideoStream,
3612
- remoteShareStream = _this$mediaProperties2.remoteShareStream,
3613
- shareAudioStream = _this$mediaProperties2.shareAudioStream;
4015
+ var _this$mediaProperties4 = this.mediaProperties,
4016
+ remoteAudioStream = _this$mediaProperties4.remoteAudioStream,
4017
+ remoteVideoStream = _this$mediaProperties4.remoteVideoStream,
4018
+ remoteShareStream = _this$mediaProperties4.remoteShareStream;
3614
4019
 
3615
4020
  /**
3616
4021
  * Triggers an event to the developer
@@ -3641,7 +4046,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3641
4046
  triggerMediaStoppedEvent(type);
3642
4047
  });
3643
4048
  };
3644
- return _promise.default.all([stopStream(remoteAudioStream, _constants.EVENT_TYPES.REMOTE_AUDIO), stopStream(remoteVideoStream, _constants.EVENT_TYPES.REMOTE_VIDEO), stopStream(remoteShareStream, _constants.EVENT_TYPES.REMOTE_SHARE), stopStream(shareAudioStream, _constants.EVENT_TYPES.REMOTE_SHARE_AUDIO)]);
4049
+ return _promise.default.all([stopStream(remoteAudioStream, _constants.EVENT_TYPES.REMOTE_AUDIO), stopStream(remoteVideoStream, _constants.EVENT_TYPES.REMOTE_VIDEO), stopStream(remoteShareStream, _constants.EVENT_TYPES.REMOTE_SHARE)]);
3645
4050
  }
3646
4051
 
3647
4052
  /**
@@ -3654,36 +4059,38 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3654
4059
  }, {
3655
4060
  key: "setLocalAudioStream",
3656
4061
  value: function () {
3657
- var _setLocalAudioStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(localStream) {
4062
+ var _setLocalAudioStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(localStream) {
3658
4063
  var oldStream;
3659
- return _regenerator.default.wrap(function _callee6$(_context6) {
3660
- while (1) switch (_context6.prev = _context6.next) {
4064
+ return _regenerator.default.wrap(function _callee10$(_context10) {
4065
+ while (1) switch (_context10.prev = _context10.next) {
3661
4066
  case 0:
3662
4067
  oldStream = this.mediaProperties.audioStream;
3663
- oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.StreamEventNames.MuteStateChange, this.localAudioStreamMuteStateHandler);
4068
+ oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.UserMuteStateChange, this.localAudioStreamMuteStateHandler);
4069
+ oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.localAudioStreamMuteStateHandler);
3664
4070
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3665
4071
 
3666
4072
  // we don't update this.mediaProperties.mediaDirection.sendAudio, because we always keep it as true to avoid extra SDP exchanges
3667
4073
  this.mediaProperties.setLocalAudioStream(localStream);
3668
4074
  this.audio.handleLocalStreamChange(this);
3669
- localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.StreamEventNames.MuteStateChange, this.localAudioStreamMuteStateHandler);
4075
+ localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.UserMuteStateChange, this.localAudioStreamMuteStateHandler);
4076
+ localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.localAudioStreamMuteStateHandler);
3670
4077
  localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3671
4078
  if (!(!this.isMultistream || !localStream)) {
3672
- _context6.next = 10;
4079
+ _context10.next = 12;
3673
4080
  break;
3674
4081
  }
3675
- _context6.next = 10;
4082
+ _context10.next = 12;
3676
4083
  return this.unpublishStream(_internalMediaCore.MediaType.AudioMain, oldStream);
3677
- case 10:
3678
- _context6.next = 12;
3679
- return this.publishStream(_internalMediaCore.MediaType.AudioMain, this.mediaProperties.audioStream);
3680
4084
  case 12:
4085
+ _context10.next = 14;
4086
+ return this.publishStream(_internalMediaCore.MediaType.AudioMain, this.mediaProperties.audioStream);
4087
+ case 14:
3681
4088
  case "end":
3682
- return _context6.stop();
4089
+ return _context10.stop();
3683
4090
  }
3684
- }, _callee6, this);
4091
+ }, _callee10, this);
3685
4092
  }));
3686
- function setLocalAudioStream(_x4) {
4093
+ function setLocalAudioStream(_x10) {
3687
4094
  return _setLocalAudioStream.apply(this, arguments);
3688
4095
  }
3689
4096
  return setLocalAudioStream;
@@ -3698,36 +4105,38 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3698
4105
  }, {
3699
4106
  key: "setLocalVideoStream",
3700
4107
  value: function () {
3701
- var _setLocalVideoStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(localStream) {
4108
+ var _setLocalVideoStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(localStream) {
3702
4109
  var oldStream;
3703
- return _regenerator.default.wrap(function _callee7$(_context7) {
3704
- while (1) switch (_context7.prev = _context7.next) {
4110
+ return _regenerator.default.wrap(function _callee11$(_context11) {
4111
+ while (1) switch (_context11.prev = _context11.next) {
3705
4112
  case 0:
3706
4113
  oldStream = this.mediaProperties.videoStream;
3707
- oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.StreamEventNames.MuteStateChange, this.localVideoStreamMuteStateHandler);
4114
+ oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.UserMuteStateChange, this.localVideoStreamMuteStateHandler);
4115
+ oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.localVideoStreamMuteStateHandler);
3708
4116
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3709
4117
 
3710
4118
  // we don't update this.mediaProperties.mediaDirection.sendVideo, because we always keep it as true to avoid extra SDP exchanges
3711
4119
  this.mediaProperties.setLocalVideoStream(localStream);
3712
4120
  this.video.handleLocalStreamChange(this);
3713
- localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.StreamEventNames.MuteStateChange, this.localVideoStreamMuteStateHandler);
4121
+ localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.UserMuteStateChange, this.localVideoStreamMuteStateHandler);
4122
+ localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.localVideoStreamMuteStateHandler);
3714
4123
  localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3715
4124
  if (!(!this.isMultistream || !localStream)) {
3716
- _context7.next = 10;
4125
+ _context11.next = 12;
3717
4126
  break;
3718
4127
  }
3719
- _context7.next = 10;
4128
+ _context11.next = 12;
3720
4129
  return this.unpublishStream(_internalMediaCore.MediaType.VideoMain, oldStream);
3721
- case 10:
3722
- _context7.next = 12;
3723
- return this.publishStream(_internalMediaCore.MediaType.VideoMain, this.mediaProperties.videoStream);
3724
4130
  case 12:
4131
+ _context11.next = 14;
4132
+ return this.publishStream(_internalMediaCore.MediaType.VideoMain, this.mediaProperties.videoStream);
4133
+ case 14:
3725
4134
  case "end":
3726
- return _context7.stop();
4135
+ return _context11.stop();
3727
4136
  }
3728
- }, _callee7, this);
4137
+ }, _callee11, this);
3729
4138
  }));
3730
- function setLocalVideoStream(_x5) {
4139
+ function setLocalVideoStream(_x11) {
3731
4140
  return _setLocalVideoStream.apply(this, arguments);
3732
4141
  }
3733
4142
  return setLocalVideoStream;
@@ -3743,34 +4152,36 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3743
4152
  }, {
3744
4153
  key: "setLocalShareVideoStream",
3745
4154
  value: function () {
3746
- var _setLocalShareVideoStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(localDisplayStream) {
4155
+ var _setLocalShareVideoStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(localDisplayStream) {
3747
4156
  var oldStream;
3748
- return _regenerator.default.wrap(function _callee8$(_context8) {
3749
- while (1) switch (_context8.prev = _context8.next) {
4157
+ return _regenerator.default.wrap(function _callee12$(_context12) {
4158
+ while (1) switch (_context12.prev = _context12.next) {
3750
4159
  case 0:
3751
4160
  oldStream = this.mediaProperties.shareVideoStream;
4161
+ oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.handleShareVideoStreamMuteStateChange);
3752
4162
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.StreamEventNames.Ended, this.handleShareVideoStreamEnded);
3753
4163
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3754
4164
  this.mediaProperties.setLocalShareVideoStream(localDisplayStream);
4165
+ localDisplayStream === null || localDisplayStream === void 0 ? void 0 : localDisplayStream.on(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.handleShareVideoStreamMuteStateChange);
3755
4166
  localDisplayStream === null || localDisplayStream === void 0 ? void 0 : localDisplayStream.on(_mediaHelpers.StreamEventNames.Ended, this.handleShareVideoStreamEnded);
3756
4167
  localDisplayStream === null || localDisplayStream === void 0 ? void 0 : localDisplayStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3757
4168
  this.mediaProperties.mediaDirection.sendShare = this.mediaProperties.hasLocalShareStream();
3758
4169
  if (!(!this.isMultistream || !localDisplayStream)) {
3759
- _context8.next = 10;
4170
+ _context12.next = 12;
3760
4171
  break;
3761
4172
  }
3762
- _context8.next = 10;
4173
+ _context12.next = 12;
3763
4174
  return this.unpublishStream(_internalMediaCore.MediaType.VideoSlides, oldStream);
3764
- case 10:
3765
- _context8.next = 12;
3766
- return this.publishStream(_internalMediaCore.MediaType.VideoSlides, this.mediaProperties.shareVideoStream);
3767
4175
  case 12:
4176
+ _context12.next = 14;
4177
+ return this.publishStream(_internalMediaCore.MediaType.VideoSlides, this.mediaProperties.shareVideoStream);
4178
+ case 14:
3768
4179
  case "end":
3769
- return _context8.stop();
4180
+ return _context12.stop();
3770
4181
  }
3771
- }, _callee8, this);
4182
+ }, _callee12, this);
3772
4183
  }));
3773
- function setLocalShareVideoStream(_x6) {
4184
+ function setLocalShareVideoStream(_x12) {
3774
4185
  return _setLocalShareVideoStream.apply(this, arguments);
3775
4186
  }
3776
4187
  return setLocalShareVideoStream;
@@ -3785,10 +4196,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3785
4196
  }, {
3786
4197
  key: "setLocalShareAudioStream",
3787
4198
  value: function () {
3788
- var _setLocalShareAudioStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(localSystemAudioStream) {
4199
+ var _setLocalShareAudioStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(localSystemAudioStream) {
3789
4200
  var oldStream;
3790
- return _regenerator.default.wrap(function _callee9$(_context9) {
3791
- while (1) switch (_context9.prev = _context9.next) {
4201
+ return _regenerator.default.wrap(function _callee13$(_context13) {
4202
+ while (1) switch (_context13.prev = _context13.next) {
3792
4203
  case 0:
3793
4204
  oldStream = this.mediaProperties.shareAudioStream;
3794
4205
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.StreamEventNames.Ended, this.handleShareAudioStreamEnded);
@@ -3798,21 +4209,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3798
4209
  localSystemAudioStream === null || localSystemAudioStream === void 0 ? void 0 : localSystemAudioStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3799
4210
  this.mediaProperties.mediaDirection.sendShare = this.mediaProperties.hasLocalShareStream();
3800
4211
  if (!(!this.isMultistream || !localSystemAudioStream)) {
3801
- _context9.next = 10;
4212
+ _context13.next = 10;
3802
4213
  break;
3803
4214
  }
3804
- _context9.next = 10;
4215
+ _context13.next = 10;
3805
4216
  return this.unpublishStream(_internalMediaCore.MediaType.AudioSlides, oldStream);
3806
4217
  case 10:
3807
- _context9.next = 12;
4218
+ _context13.next = 12;
3808
4219
  return this.publishStream(_internalMediaCore.MediaType.AudioSlides, this.mediaProperties.shareAudioStream);
3809
4220
  case 12:
3810
4221
  case "end":
3811
- return _context9.stop();
4222
+ return _context13.stop();
3812
4223
  }
3813
- }, _callee9, this);
4224
+ }, _callee13, this);
3814
4225
  }));
3815
- function setLocalShareAudioStream(_x7) {
4226
+ function setLocalShareAudioStream(_x13) {
3816
4227
  return _setLocalShareAudioStream.apply(this, arguments);
3817
4228
  }
3818
4229
  return setLocalShareAudioStream;
@@ -3850,18 +4261,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3850
4261
  }, {
3851
4262
  key: "cleanupLocalStreams",
3852
4263
  value: function cleanupLocalStreams() {
3853
- var _this$mediaProperties3 = this.mediaProperties,
3854
- audioStream = _this$mediaProperties3.audioStream,
3855
- videoStream = _this$mediaProperties3.videoStream,
3856
- shareAudioStream = _this$mediaProperties3.shareAudioStream,
3857
- shareVideoStream = _this$mediaProperties3.shareVideoStream;
3858
- audioStream === null || audioStream === void 0 ? void 0 : audioStream.off(_mediaHelpers.StreamEventNames.MuteStateChange, this.localAudioStreamMuteStateHandler);
4264
+ var _this$mediaProperties5 = this.mediaProperties,
4265
+ audioStream = _this$mediaProperties5.audioStream,
4266
+ videoStream = _this$mediaProperties5.videoStream,
4267
+ shareAudioStream = _this$mediaProperties5.shareAudioStream,
4268
+ shareVideoStream = _this$mediaProperties5.shareVideoStream;
4269
+ audioStream === null || audioStream === void 0 ? void 0 : audioStream.off(_mediaHelpers.LocalStreamEventNames.UserMuteStateChange, this.localAudioStreamMuteStateHandler);
4270
+ audioStream === null || audioStream === void 0 ? void 0 : audioStream.off(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.localAudioStreamMuteStateHandler);
3859
4271
  audioStream === null || audioStream === void 0 ? void 0 : audioStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3860
- videoStream === null || videoStream === void 0 ? void 0 : videoStream.off(_mediaHelpers.StreamEventNames.MuteStateChange, this.localVideoStreamMuteStateHandler);
4272
+ videoStream === null || videoStream === void 0 ? void 0 : videoStream.off(_mediaHelpers.LocalStreamEventNames.UserMuteStateChange, this.localVideoStreamMuteStateHandler);
4273
+ videoStream === null || videoStream === void 0 ? void 0 : videoStream.off(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.localVideoStreamMuteStateHandler);
3861
4274
  videoStream === null || videoStream === void 0 ? void 0 : videoStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3862
- shareAudioStream === null || shareAudioStream === void 0 ? void 0 : shareAudioStream.off(_mediaHelpers.StreamEventNames.MuteStateChange, this.handleShareAudioStreamEnded);
4275
+ shareAudioStream === null || shareAudioStream === void 0 ? void 0 : shareAudioStream.off(_mediaHelpers.StreamEventNames.Ended, this.handleShareAudioStreamEnded);
3863
4276
  shareAudioStream === null || shareAudioStream === void 0 ? void 0 : shareAudioStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3864
- shareVideoStream === null || shareVideoStream === void 0 ? void 0 : shareVideoStream.off(_mediaHelpers.StreamEventNames.MuteStateChange, this.handleShareVideoStreamEnded);
4277
+ shareVideoStream === null || shareVideoStream === void 0 ? void 0 : shareVideoStream.off(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.handleShareVideoStreamMuteStateChange);
4278
+ shareVideoStream === null || shareVideoStream === void 0 ? void 0 : shareVideoStream.off(_mediaHelpers.StreamEventNames.Ended, this.handleShareVideoStreamEnded);
3865
4279
  shareVideoStream === null || shareVideoStream === void 0 ? void 0 : shareVideoStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3866
4280
  this.mediaProperties.setLocalAudioStream(undefined);
3867
4281
  this.mediaProperties.setLocalVideoStream(undefined);
@@ -3975,6 +4389,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3975
4389
  this.receiveSlotManager.reset();
3976
4390
  this.mediaProperties.webrtcMediaConnection.close();
3977
4391
  this.sendSlotManager.reset();
4392
+ this.setNetworkStatus(undefined);
3978
4393
  }
3979
4394
  this.audio = null;
3980
4395
  this.video = null;
@@ -3996,20 +4411,35 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3996
4411
  if (this.config.reconnection.detection) {
3997
4412
  // @ts-ignore
3998
4413
  this.webex.internal.mercury.off(_constants.ONLINE);
4414
+ // @ts-ignore
4415
+ this.webex.internal.mercury.off(_constants.OFFLINE);
3999
4416
  }
4000
4417
  }
4001
4418
 
4002
4419
  /**
4003
- * Convenience method to set the correlation id for the Meeting
4004
- * @param {String} id correlation id to set on the class
4420
+ * Convenience method to set the correlation id for the callStateForMetrics
4421
+ * @param {String} id correlation id to set on the callStateForMetrics
4005
4422
  * @returns {undefined}
4006
- * @private
4423
+ * @public
4007
4424
  * @memberof Meeting
4008
4425
  */
4009
4426
  }, {
4010
4427
  key: "setCorrelationId",
4011
4428
  value: function setCorrelationId(id) {
4012
- this.correlationId = id;
4429
+ this.callStateForMetrics.correlationId = id;
4430
+ }
4431
+
4432
+ /**
4433
+ * Update the callStateForMetrics
4434
+ * @param {CallStateForMetrics} callStateForMetrics updated values for callStateForMetrics
4435
+ * @returns {undefined}
4436
+ * @public
4437
+ * @memberof Meeting
4438
+ */
4439
+ }, {
4440
+ key: "updateCallStateForMetrics",
4441
+ value: function updateCallStateForMetrics(callStateForMetrics) {
4442
+ this.callStateForMetrics = _objectSpread(_objectSpread({}, this.callStateForMetrics), callStateForMetrics);
4013
4443
  }
4014
4444
 
4015
4445
  /**
@@ -4244,6 +4674,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4244
4674
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4245
4675
  var mediaOptions = options.mediaOptions,
4246
4676
  joinOptions = options.joinOptions;
4677
+ if (!(mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.allowMediaInLobby)) {
4678
+ return _promise.default.reject(new _parameter.default('joinWithMedia() can only be used with allowMediaInLobby set to true'));
4679
+ }
4680
+ _loggerProxy.default.logger.info('Meeting:index#joinWithMedia called');
4247
4681
  return this.join(joinOptions).then(function (joinResponse) {
4248
4682
  return _this28.addMedia(mediaOptions).then(function (mediaResponse) {
4249
4683
  return {
@@ -4304,11 +4738,27 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4304
4738
  function: 'reconnect'
4305
4739
  }, _constants.EVENT_TRIGGERS.MEETING_RECONNECTION_STARTING);
4306
4740
  return this.reconnectionManager.reconnect(options).then(function () {
4741
+ return _this29.waitForRemoteSDPAnswer();
4742
+ }).then(function () {
4743
+ return _this29.waitForMediaConnectionConnected();
4744
+ }).then(function () {
4307
4745
  _triggerProxy.default.trigger(_this29, {
4308
4746
  file: 'meeting/index',
4309
4747
  function: 'reconnect'
4310
4748
  }, _constants.EVENT_TRIGGERS.MEETING_RECONNECTION_SUCCESS);
4311
4749
  _loggerProxy.default.logger.log('Meeting:index#reconnect --> Meeting reconnect success');
4750
+
4751
+ // @ts-ignore
4752
+ _this29.webex.internal.newMetrics.submitClientEvent({
4753
+ name: 'client.media.recovered',
4754
+ payload: {
4755
+ recoveredBy: 'new'
4756
+ },
4757
+ options: {
4758
+ meetingId: _this29.id
4759
+ }
4760
+ });
4761
+ _this29.reconnectionManager.setStatus(_constants.RECONNECTION.STATE.COMPLETE);
4312
4762
  }).catch(function (error) {
4313
4763
  _triggerProxy.default.trigger(_this29, {
4314
4764
  file: 'meeting/index',
@@ -4396,16 +4846,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4396
4846
  }, {
4397
4847
  key: "receiveTranscription",
4398
4848
  value: function () {
4399
- var _receiveTranscription = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
4849
+ var _receiveTranscription = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
4400
4850
  var _this31 = this;
4401
4851
  var datachannelUrl, _yield$this$request, webSocketUrl;
4402
- return _regenerator.default.wrap(function _callee10$(_context10) {
4403
- while (1) switch (_context10.prev = _context10.next) {
4852
+ return _regenerator.default.wrap(function _callee14$(_context14) {
4853
+ while (1) switch (_context14.prev = _context14.next) {
4404
4854
  case 0:
4405
4855
  _loggerProxy.default.logger.info("Meeting:index#receiveTranscription -->\n Attempting to generate a web socket url.");
4406
- _context10.prev = 1;
4856
+ _context14.prev = 1;
4407
4857
  datachannelUrl = this.locusInfo.info.datachannelUrl; // @ts-ignore - fix type
4408
- _context10.next = 5;
4858
+ _context14.next = 5;
4409
4859
  return this.request({
4410
4860
  method: _constants.HTTP_VERBS.POST,
4411
4861
  uri: datachannelUrl,
@@ -4414,7 +4864,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4414
4864
  }
4415
4865
  });
4416
4866
  case 5:
4417
- _yield$this$request = _context10.sent;
4867
+ _yield$this$request = _context14.sent;
4418
4868
  webSocketUrl = _yield$this$request.body.webSocketUrl;
4419
4869
  _loggerProxy.default.logger.info("Meeting:index#receiveTranscription -->\n Generated web socket url succesfully.");
4420
4870
  this.transcription = new _transcription.default(webSocketUrl,
@@ -4435,22 +4885,22 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4435
4885
  this.monitorTranscriptionSocketConnection();
4436
4886
  // @ts-ignore - fix type
4437
4887
  this.transcription.connect(this.webex.credentials.supertoken.access_token);
4438
- _context10.next = 20;
4888
+ _context14.next = 20;
4439
4889
  break;
4440
4890
  case 16:
4441
- _context10.prev = 16;
4442
- _context10.t0 = _context10["catch"](1);
4443
- _loggerProxy.default.logger.error("Meeting:index#receiveTranscription --> ".concat(_context10.t0));
4891
+ _context14.prev = 16;
4892
+ _context14.t0 = _context14["catch"](1);
4893
+ _loggerProxy.default.logger.error("Meeting:index#receiveTranscription --> ".concat(_context14.t0));
4444
4894
  _metrics.default.sendBehavioralMetric(_constants2.default.RECEIVE_TRANSCRIPTION_FAILURE, {
4445
4895
  correlation_id: this.correlationId,
4446
- reason: _context10.t0.message,
4447
- stack: _context10.t0.stack
4896
+ reason: _context14.t0.message,
4897
+ stack: _context14.t0.stack
4448
4898
  });
4449
4899
  case 20:
4450
4900
  case "end":
4451
- return _context10.stop();
4901
+ return _context14.stop();
4452
4902
  }
4453
- }, _callee10, this, [[1, 16]]);
4903
+ }, _callee14, this, [[1, 16]]);
4454
4904
  }));
4455
4905
  function receiveTranscription() {
4456
4906
  return _receiveTranscription.apply(this, arguments);
@@ -4507,228 +4957,241 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4507
4957
  */
4508
4958
  }, {
4509
4959
  key: "join",
4510
- value: function join() {
4511
- var _this32 = this;
4512
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4513
- // @ts-ignore - fix type
4514
- if (!this.webex.meetings.registered) {
4515
- var errorMessage = 'Meeting:index#join --> Device not registered';
4516
- var error = new Error(errorMessage);
4517
- _loggerProxy.default.logger.error(errorMessage);
4518
- return _promise.default.reject(error);
4519
- }
4960
+ value: function () {
4961
+ var _join = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
4962
+ var _this32 = this;
4963
+ var options,
4964
+ errorMessage,
4965
+ error,
4966
+ joinFailed,
4967
+ joinSuccess,
4968
+ _errorMessage,
4969
+ _error,
4970
+ _errorMessage2,
4971
+ _error2,
4972
+ _args15 = arguments;
4973
+ return _regenerator.default.wrap(function _callee15$(_context15) {
4974
+ while (1) switch (_context15.prev = _context15.next) {
4975
+ case 0:
4976
+ options = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
4977
+ if (this.webex.meetings.registered) {
4978
+ _context15.next = 6;
4979
+ break;
4980
+ }
4981
+ errorMessage = 'Meeting:index#join --> Device not registered';
4982
+ error = new Error(errorMessage);
4983
+ _loggerProxy.default.logger.error(errorMessage);
4984
+ return _context15.abrupt("return", _promise.default.reject(error));
4985
+ case 6:
4986
+ if (!this.deferJoin) {
4987
+ _context15.next = 8;
4988
+ break;
4989
+ }
4990
+ return _context15.abrupt("return", this.deferJoin);
4991
+ case 8:
4992
+ // Create a deferred promise for a consistent resolve value from utils.
4993
+ // This also prevents redundant API calls.
4994
+ this.deferJoin = new _promise.default(function (resolve, reject) {
4995
+ joinFailed = reject;
4996
+ joinSuccess = resolve;
4997
+ });
4998
+ if (options.correlationId) {
4999
+ this.setCorrelationId(options.correlationId);
5000
+ _loggerProxy.default.logger.log("Meeting:index#join --> Using a new correlation id from app ".concat(this.correlationId));
5001
+ }
5002
+ if (!this.hasJoinedOnce) {
5003
+ this.hasJoinedOnce = true;
5004
+ } else if (!options.correlationId) {
5005
+ _loggerProxy.default.logger.log("Meeting:index#join --> Generating a new correlation id for meeting ".concat(this.id));
5006
+ _loggerProxy.default.logger.log("Meeting:index#join --> Previous correlation id ".concat(this.correlationId));
5007
+ this.setCorrelationId(_uuid.default.v4());
5008
+ _loggerProxy.default.logger.log("Meeting:index#join --> New correlation id ".concat(this.correlationId));
5009
+ }
5010
+ if (options.rejoin) {
5011
+ this.meetingFiniteStateMachine.reset();
5012
+ }
4520
5013
 
4521
- // If a join request is being processed, refer to the deferred promise.
4522
- if (this.deferJoin) {
4523
- return this.deferJoin;
4524
- }
5014
+ // @ts-ignore
5015
+ this.webex.internal.newMetrics.submitClientEvent({
5016
+ name: 'client.call.initiated',
5017
+ payload: {
5018
+ trigger: this.callStateForMetrics.joinTrigger || 'user-interaction',
5019
+ isRoapCallEnabled: true,
5020
+ pstnAudioType: options === null || options === void 0 ? void 0 : options.pstnAudioType
5021
+ },
5022
+ options: {
5023
+ meetingId: this.id
5024
+ }
5025
+ });
5026
+ _loggerProxy.default.logger.log('Meeting:index#join --> Joining a meeting');
5027
+ if (this.meetingFiniteStateMachine.state === _constants.MEETING_STATE_MACHINE.STATES.ENDED) {
5028
+ this.meetingFiniteStateMachine.reset();
5029
+ }
5030
+ if (this.meetingFiniteStateMachine.state !== _constants.MEETING_STATE_MACHINE.STATES.RINGING) {
5031
+ this.meetingFiniteStateMachine.ring(_constants._JOIN_);
5032
+ }
4525
5033
 
4526
- // Scope-up the resolve/reject methods for handling within join().
4527
- var joinFailed;
4528
- var joinSuccess;
5034
+ // TODO: does this really need to be here?
5035
+ if (options.resourceId && this.destination && options.resourceId === this.destination) {
5036
+ this.wirelessShare = true;
5037
+ }
5038
+ if (!options.meetingQuality) {
5039
+ _context15.next = 36;
5040
+ break;
5041
+ }
5042
+ if (!(typeof options.meetingQuality === 'string')) {
5043
+ _context15.next = 27;
5044
+ break;
5045
+ }
5046
+ if (_constants.QUALITY_LEVELS[options.meetingQuality]) {
5047
+ _context15.next = 26;
5048
+ break;
5049
+ }
5050
+ _errorMessage = "Meeting:index#join --> ".concat(options.meetingQuality, " not defined");
5051
+ _error = new Error(_errorMessage);
5052
+ _loggerProxy.default.logger.error(_errorMessage);
5053
+ joinFailed(_error);
5054
+ this.deferJoin = undefined;
5055
+ return _context15.abrupt("return", _promise.default.reject(_error));
5056
+ case 26:
5057
+ this.mediaProperties.setRemoteQualityLevel(options.meetingQuality);
5058
+ case 27:
5059
+ if (!((0, _typeof2.default)(options.meetingQuality) === 'object')) {
5060
+ _context15.next = 36;
5061
+ break;
5062
+ }
5063
+ if (_constants.QUALITY_LEVELS[options.meetingQuality.remote]) {
5064
+ _context15.next = 35;
5065
+ break;
5066
+ }
5067
+ _errorMessage2 = "Meeting:index#join --> ".concat(options.meetingQuality.remote, " not defined");
5068
+ _loggerProxy.default.logger.error(_errorMessage2);
5069
+ _error2 = new Error(_errorMessage2);
5070
+ joinFailed(_error2);
5071
+ this.deferJoin = undefined;
5072
+ return _context15.abrupt("return", _promise.default.reject(new Error(_errorMessage2)));
5073
+ case 35:
5074
+ if (options.meetingQuality.remote) {
5075
+ this.mediaProperties.setRemoteQualityLevel(options.meetingQuality.remote);
5076
+ }
5077
+ case 36:
5078
+ this.isMultistream = !!options.enableMultistream;
5079
+ _context15.prev = 37;
5080
+ _context15.next = 40;
5081
+ return this.checkAndRefreshPermissionToken(_constants.MEETING_PERMISSION_TOKEN_REFRESH_THRESHOLD_IN_SEC, _constants.MEETING_PERMISSION_TOKEN_REFRESH_REASON);
5082
+ case 40:
5083
+ _context15.next = 51;
5084
+ break;
5085
+ case 42:
5086
+ _context15.prev = 42;
5087
+ _context15.t0 = _context15["catch"](37);
5088
+ _loggerProxy.default.logger.error('Meeting:index#join --> Failed to refresh permission token:', _context15.t0);
5089
+ if (!(_context15.t0 instanceof _captchaError.default || _context15.t0 instanceof _passwordError.default || _context15.t0 instanceof _permission.default)) {
5090
+ _context15.next = 51;
5091
+ break;
5092
+ }
5093
+ this.meetingFiniteStateMachine.fail(_context15.t0);
4529
5094
 
4530
- // Create a deferred promise for a consistent resolve value from utils.
4531
- // This also prevents redundant API calls.
4532
- this.deferJoin = new _promise.default(function (resolve, reject) {
4533
- joinFailed = reject;
4534
- joinSuccess = resolve;
4535
- });
4536
- if (options.correlationId) {
4537
- this.setCorrelationId(options.correlationId);
4538
- _loggerProxy.default.logger.log("Meeting:index#join --> Using a new correlation id from app ".concat(this.correlationId));
4539
- }
4540
- if (!this.hasJoinedOnce) {
4541
- this.hasJoinedOnce = true;
4542
- } else if (!options.correlationId) {
4543
- _loggerProxy.default.logger.log("Meeting:index#join --> Generating a new correlation id for meeting ".concat(this.id));
4544
- _loggerProxy.default.logger.log("Meeting:index#join --> Previous correlation id ".concat(this.correlationId));
4545
- this.setCorrelationId(_uuid.default.v4());
4546
- _loggerProxy.default.logger.log("Meeting:index#join --> New correlation id ".concat(this.correlationId));
4547
- }
4548
- if (options.rejoin) {
4549
- this.meetingFiniteStateMachine.reset();
4550
- }
5095
+ // Upload logs on refreshpermissionToken refresh Failure
5096
+ _triggerProxy.default.trigger(this, {
5097
+ file: 'meeting/index',
5098
+ function: 'join'
5099
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, this);
5100
+ joinFailed(_context15.t0);
5101
+ this.deferJoin = undefined;
5102
+
5103
+ // if refresh permission token requires captcha, password or permission, we are throwing the errors
5104
+ // and bubble it up to client
5105
+ return _context15.abrupt("return", _promise.default.reject(_context15.t0));
5106
+ case 51:
5107
+ return _context15.abrupt("return", _util.default.joinMeetingOptions(this, options).then(function (join) {
5108
+ _this32.meetingFiniteStateMachine.join();
5109
+ _loggerProxy.default.logger.log('Meeting:index#join --> Success');
5110
+ _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_SUCCESS, {
5111
+ correlation_id: _this32.correlationId
5112
+ });
5113
+ joinSuccess(join);
5114
+ _this32.deferJoin = undefined;
5115
+ return join;
5116
+ }).catch(function (error) {
5117
+ var _this32$meetingInfo, _error$error;
5118
+ _this32.meetingFiniteStateMachine.fail(error);
5119
+ _loggerProxy.default.logger.error('Meeting:index#join --> Failed', error);
4551
5120
 
4552
- // @ts-ignore
4553
- this.webex.internal.newMetrics.submitClientEvent({
4554
- name: 'client.call.initiated',
4555
- payload: {
4556
- trigger: 'user-interaction',
4557
- isRoapCallEnabled: true
4558
- },
4559
- options: {
4560
- meetingId: this.id
4561
- }
4562
- });
4563
- if (!(0, _isEmpty2.default)(this.meetingInfo)) {
4564
- var _this$meetingInfo5;
4565
- // @ts-ignore
4566
- this.webex.internal.newMetrics.submitClientEvent({
4567
- name: 'client.meetinginfo.request',
4568
- options: {
4569
- meetingId: this.id
4570
- }
4571
- });
5121
+ // @ts-ignore
5122
+ _this32.webex.internal.newMetrics.submitClientEvent({
5123
+ name: 'client.locus.join.response',
5124
+ payload: {
5125
+ identifiers: {
5126
+ meetingLookupUrl: (_this32$meetingInfo = _this32.meetingInfo) === null || _this32$meetingInfo === void 0 ? void 0 : _this32$meetingInfo.meetingLookupUrl
5127
+ }
5128
+ },
5129
+ options: {
5130
+ meetingId: _this32.id,
5131
+ rawError: error
5132
+ }
5133
+ });
4572
5134
 
4573
- // @ts-ignore
4574
- this.webex.internal.newMetrics.submitClientEvent({
4575
- name: 'client.meetinginfo.response',
4576
- payload: {
4577
- identifiers: {
4578
- meetingLookupUrl: (_this$meetingInfo5 = this.meetingInfo) === null || _this$meetingInfo5 === void 0 ? void 0 : _this$meetingInfo5.meetingLookupUrl
4579
- }
4580
- },
4581
- options: {
4582
- meetingId: this.id
4583
- }
4584
- });
4585
- }
4586
- _loggerProxy.default.logger.log('Meeting:index#join --> Joining a meeting');
4587
- if (this.meetingFiniteStateMachine.state === _constants.MEETING_STATE_MACHINE.STATES.ENDED) {
4588
- this.meetingFiniteStateMachine.reset();
4589
- }
4590
- if (this.meetingFiniteStateMachine.state !== _constants.MEETING_STATE_MACHINE.STATES.RINGING) {
4591
- this.meetingFiniteStateMachine.ring(_constants._JOIN_);
4592
- }
5135
+ // TODO: change this to error codes and pre defined dictionary
5136
+ _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_FAILURE, {
5137
+ correlation_id: _this32.correlationId,
5138
+ reason: (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message,
5139
+ stack: error.stack
5140
+ });
4593
5141
 
4594
- // TODO: does this really need to be here?
4595
- if (options.resourceId && this.destination && options.resourceId === this.destination) {
4596
- this.wirelessShare = true;
4597
- }
4598
- if (options.meetingQuality) {
4599
- if (typeof options.meetingQuality === 'string') {
4600
- if (!_constants.QUALITY_LEVELS[options.meetingQuality]) {
4601
- var _errorMessage = "Meeting:index#join --> ".concat(options.meetingQuality, " not defined");
4602
- var _error = new Error(_errorMessage);
4603
- _loggerProxy.default.logger.error(_errorMessage);
4604
- joinFailed(_error);
4605
- this.deferJoin = undefined;
4606
- return _promise.default.reject(_error);
4607
- }
4608
- this.mediaProperties.setRemoteQualityLevel(options.meetingQuality);
4609
- }
4610
- if ((0, _typeof2.default)(options.meetingQuality) === 'object') {
4611
- if (!_constants.QUALITY_LEVELS[options.meetingQuality.remote]) {
4612
- var _errorMessage2 = "Meeting:index#join --> ".concat(options.meetingQuality.remote, " not defined");
4613
- _loggerProxy.default.logger.error(_errorMessage2);
4614
- var _error2 = new Error(_errorMessage2);
4615
- joinFailed(_error2);
4616
- this.deferJoin = undefined;
4617
- return _promise.default.reject(new Error(_errorMessage2));
4618
- }
4619
- if (options.meetingQuality.remote) {
4620
- this.mediaProperties.setRemoteQualityLevel(options.meetingQuality.remote);
4621
- }
4622
- }
4623
- }
4624
- this.isMultistream = !!options.enableMultistream;
4625
- return _util.default.joinMeetingOptions(this, options).then(function (join) {
4626
- _this32.meetingFiniteStateMachine.join();
4627
- _loggerProxy.default.logger.log('Meeting:index#join --> Success');
4628
- return join;
4629
- }).then(function (join) {
4630
- joinSuccess(join);
4631
- _this32.deferJoin = undefined;
4632
- _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_SUCCESS, {
4633
- correlation_id: _this32.correlationId
4634
- });
4635
- return join;
4636
- }).then( /*#__PURE__*/function () {
4637
- var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(join) {
4638
- return _regenerator.default.wrap(function _callee11$(_context11) {
4639
- while (1) switch (_context11.prev = _context11.next) {
4640
- case 0:
4641
- if (!_this32.config.enableAutomaticLLM) {
4642
- _context11.next = 3;
4643
- break;
4644
- }
4645
- _context11.next = 3;
4646
- return _this32.updateLLMConnection();
4647
- case 3:
4648
- return _context11.abrupt("return", join);
4649
- case 4:
4650
- case "end":
4651
- return _context11.stop();
4652
- }
4653
- }, _callee11);
4654
- }));
4655
- return function (_x8) {
4656
- return _ref21.apply(this, arguments);
4657
- };
4658
- }()).then( /*#__PURE__*/function () {
4659
- var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(join) {
4660
- return _regenerator.default.wrap(function _callee12$(_context12) {
4661
- while (1) switch (_context12.prev = _context12.next) {
4662
- case 0:
4663
- if (!isBrowser) {
4664
- _context12.next = 8;
4665
- break;
4666
- }
4667
- if (!(_this32.config.receiveTranscription || options.receiveTranscription)) {
4668
- _context12.next = 6;
4669
- break;
5142
+ // Upload logs on join Failure
5143
+ _triggerProxy.default.trigger(_this32, {
5144
+ file: 'meeting/index',
5145
+ function: 'join'
5146
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this32);
5147
+ joinFailed(error);
5148
+ _this32.deferJoin = undefined;
5149
+ return _promise.default.reject(error);
5150
+ }).then(function (join) {
5151
+ // @ts-ignore - config coming from registerPlugin
5152
+ if (_this32.config.enableAutomaticLLM) {
5153
+ _this32.updateLLMConnection().catch(function (error) {
5154
+ _loggerProxy.default.logger.error('Meeting:index#join --> Update LLM Connection Failed', error);
5155
+ _metrics.default.sendBehavioralMetric(_constants2.default.LLM_CONNECTION_AFTER_JOIN_FAILURE, {
5156
+ correlation_id: _this32.correlationId,
5157
+ reason: error === null || error === void 0 ? void 0 : error.message,
5158
+ stack: error.stack
5159
+ });
5160
+ });
4670
5161
  }
4671
- if (!_this32.isTranscriptionSupported()) {
4672
- _context12.next = 6;
4673
- break;
5162
+ return join;
5163
+ }).then(function (join) {
5164
+ if (isBrowser) {
5165
+ // @ts-ignore - config coming from registerPlugin
5166
+ if (_this32.config.receiveTranscription || options.receiveTranscription) {
5167
+ if (_this32.isTranscriptionSupported()) {
5168
+ _loggerProxy.default.logger.info('Meeting:index#join --> Attempting to enabled to receive transcription!');
5169
+ _this32.receiveTranscription().catch(function (error) {
5170
+ _loggerProxy.default.logger.error('Meeting:index#join --> Receive Transcription Failed', error);
5171
+ _metrics.default.sendBehavioralMetric(_constants2.default.RECEIVE_TRANSCRIPTION_AFTER_JOIN_FAILURE, {
5172
+ correlation_id: _this32.correlationId,
5173
+ reason: error === null || error === void 0 ? void 0 : error.message,
5174
+ stack: error.stack
5175
+ });
5176
+ });
5177
+ }
5178
+ }
5179
+ } else {
5180
+ _loggerProxy.default.logger.error('Meeting:index#join --> Receving transcription is not supported on this platform');
4674
5181
  }
4675
- _context12.next = 5;
4676
- return _this32.receiveTranscription();
4677
- case 5:
4678
- _loggerProxy.default.logger.info('Meeting:index#join --> enabled to recieve transcription!');
4679
- case 6:
4680
- _context12.next = 9;
4681
- break;
4682
- case 8:
4683
- _loggerProxy.default.logger.error('Meeting:index#join --> Receving transcription is not supported on this platform');
4684
- case 9:
4685
- return _context12.abrupt("return", join);
4686
- case 10:
4687
- case "end":
4688
- return _context12.stop();
4689
- }
4690
- }, _callee12);
4691
- }));
4692
- return function (_x9) {
4693
- return _ref22.apply(this, arguments);
4694
- };
4695
- }()).catch(function (error) {
4696
- var _this32$meetingInfo, _error$error;
4697
- _this32.meetingFiniteStateMachine.fail(error);
4698
- _loggerProxy.default.logger.error('Meeting:index#join --> Failed', error);
4699
-
4700
- // @ts-ignore
4701
- _this32.webex.internal.newMetrics.submitClientEvent({
4702
- name: 'client.locus.join.response',
4703
- payload: {
4704
- identifiers: {
4705
- meetingLookupUrl: (_this32$meetingInfo = _this32.meetingInfo) === null || _this32$meetingInfo === void 0 ? void 0 : _this32$meetingInfo.meetingLookupUrl
4706
- }
4707
- },
4708
- options: {
4709
- meetingId: _this32.id,
4710
- rawError: error
5182
+ return join;
5183
+ }));
5184
+ case 52:
5185
+ case "end":
5186
+ return _context15.stop();
4711
5187
  }
4712
- });
4713
-
4714
- // TODO: change this to error codes and pre defined dictionary
4715
- _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_FAILURE, {
4716
- correlation_id: _this32.correlationId,
4717
- reason: (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message,
4718
- stack: error.stack
4719
- });
4720
-
4721
- // Upload logs on join Failure
4722
- _triggerProxy.default.trigger(_this32, {
4723
- file: 'meeting/index',
4724
- function: 'join'
4725
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this32);
4726
- joinFailed(error);
4727
- _this32.deferJoin = undefined;
4728
- return _promise.default.reject(error);
4729
- });
4730
- }
4731
-
5188
+ }, _callee15, this, [[37, 42]]);
5189
+ }));
5190
+ function join() {
5191
+ return _join.apply(this, arguments);
5192
+ }
5193
+ return join;
5194
+ }()
4732
5195
  /**
4733
5196
  * Connects to low latency mercury and reconnects if the address has changed
4734
5197
  * It will also disconnect if called when the meeting has ended
@@ -4738,38 +5201,38 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4738
5201
  }, {
4739
5202
  key: "updateLLMConnection",
4740
5203
  value: function () {
4741
- var _updateLLMConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
5204
+ var _updateLLMConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
4742
5205
  var _this33 = this;
4743
5206
  var _this$locusInfo6, url, _this$locusInfo6$info, _this$locusInfo6$info2, datachannelUrl, isJoined;
4744
- return _regenerator.default.wrap(function _callee13$(_context13) {
4745
- while (1) switch (_context13.prev = _context13.next) {
5207
+ return _regenerator.default.wrap(function _callee16$(_context16) {
5208
+ while (1) switch (_context16.prev = _context16.next) {
4746
5209
  case 0:
4747
5210
  // @ts-ignore - Fix type
4748
5211
  _this$locusInfo6 = this.locusInfo, url = _this$locusInfo6.url, _this$locusInfo6$info = _this$locusInfo6.info, _this$locusInfo6$info2 = _this$locusInfo6$info === void 0 ? {} : _this$locusInfo6$info, datachannelUrl = _this$locusInfo6$info2.datachannelUrl;
4749
5212
  isJoined = this.isJoined(); // @ts-ignore - Fix type
4750
5213
  if (!this.webex.internal.llm.isConnected()) {
4751
- _context13.next = 8;
5214
+ _context16.next = 8;
4752
5215
  break;
4753
5216
  }
4754
5217
  if (!(url === this.webex.internal.llm.getLocusUrl() && isJoined)) {
4755
- _context13.next = 5;
5218
+ _context16.next = 5;
4756
5219
  break;
4757
5220
  }
4758
- return _context13.abrupt("return", undefined);
5221
+ return _context16.abrupt("return", undefined);
4759
5222
  case 5:
4760
- _context13.next = 7;
5223
+ _context16.next = 7;
4761
5224
  return this.webex.internal.llm.disconnectLLM();
4762
5225
  case 7:
4763
5226
  // @ts-ignore - Fix type
4764
5227
  this.webex.internal.llm.off('event:relay.event', this.processRelayEvent);
4765
5228
  case 8:
4766
5229
  if (isJoined) {
4767
- _context13.next = 10;
5230
+ _context16.next = 10;
4768
5231
  break;
4769
5232
  }
4770
- return _context13.abrupt("return", undefined);
5233
+ return _context16.abrupt("return", undefined);
4771
5234
  case 10:
4772
- return _context13.abrupt("return", this.webex.internal.llm.registerAndConnect(url, datachannelUrl).then(function (registerAndConnectResult) {
5235
+ return _context16.abrupt("return", this.webex.internal.llm.registerAndConnect(url, datachannelUrl).then(function (registerAndConnectResult) {
4773
5236
  // @ts-ignore - Fix type
4774
5237
  _this33.webex.internal.llm.off('event:relay.event', _this33.processRelayEvent);
4775
5238
  // @ts-ignore - Fix type
@@ -4779,9 +5242,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4779
5242
  }));
4780
5243
  case 11:
4781
5244
  case "end":
4782
- return _context13.stop();
5245
+ return _context16.stop();
4783
5246
  }
4784
- }, _callee13, this);
5247
+ }, _callee16, this);
4785
5248
  }));
4786
5249
  function updateLLMConnection() {
4787
5250
  return _updateLLMConnection.apply(this, arguments);
@@ -4952,17 +5415,17 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4952
5415
  meetingId: this.id
4953
5416
  }
4954
5417
  });
4955
- this.locusInfo.once(_constants.LOCUSINFO.EVENTS.SELF_OBSERVING, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
5418
+ this.locusInfo.once(_constants.LOCUSINFO.EVENTS.SELF_OBSERVING, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
4956
5419
  var mediaSettings;
4957
- return _regenerator.default.wrap(function _callee14$(_context14) {
4958
- while (1) switch (_context14.prev = _context14.next) {
5420
+ return _regenerator.default.wrap(function _callee17$(_context17) {
5421
+ while (1) switch (_context17.prev = _context17.next) {
4959
5422
  case 0:
4960
- _context14.prev = 0;
5423
+ _context17.prev = 0;
4961
5424
  if (!(_this36.screenShareFloorState === ScreenShareFloorStatus.GRANTED)) {
4962
- _context14.next = 4;
5425
+ _context17.next = 4;
4963
5426
  break;
4964
5427
  }
4965
- _context14.next = 4;
5428
+ _context17.next = 4;
4966
5429
  return _this36.releaseScreenShareFloor();
4967
5430
  case 4:
4968
5431
  mediaSettings = {
@@ -4982,28 +5445,28 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4982
5445
  // when a move to is intiated by the client , Locus delets the existing media node from the server as soon the DX answers the meeting
4983
5446
  // once the DX answers we establish connection back the media server with only receiveShare enabled
4984
5447
  // @ts-ignore - reconnectMedia does not accept any argument
4985
- _context14.next = 10;
5448
+ _context17.next = 10;
4986
5449
  return _this36.reconnectionManager.reconnectMedia(mediaSettings).then(function () {
4987
5450
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_SUCCESS);
4988
5451
  });
4989
5452
  case 10:
4990
- _context14.next = 16;
5453
+ _context17.next = 16;
4991
5454
  break;
4992
5455
  case 12:
4993
- _context14.prev = 12;
4994
- _context14.t0 = _context14["catch"](0);
4995
- _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', _context14.t0);
5456
+ _context17.prev = 12;
5457
+ _context17.t0 = _context17["catch"](0);
5458
+ _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', _context17.t0);
4996
5459
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_FAILURE, {
4997
5460
  correlation_id: _this36.correlationId,
4998
5461
  locus_id: _this36.locusUrl.split('/').pop(),
4999
- reason: _context14.t0.message,
5000
- stack: _context14.t0.stack
5462
+ reason: _context17.t0.message,
5463
+ stack: _context17.t0.stack
5001
5464
  });
5002
5465
  case 16:
5003
5466
  case "end":
5004
- return _context14.stop();
5467
+ return _context17.stop();
5005
5468
  }
5006
- }, _callee14, null, [[0, 12]]);
5469
+ }, _callee17, null, [[0, 12]]);
5007
5470
  })));
5008
5471
  _loggerProxy.default.logger.info('Meeting:index#moveTo --> Initated moved to using resourceId', resourceId);
5009
5472
  return _util.default.joinMeetingOptions(this, {
@@ -5093,10 +5556,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5093
5556
  }, {
5094
5557
  key: "createMediaConnection",
5095
5558
  value: function () {
5096
- var _createMediaConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(turnServerInfo, bundlePolicy) {
5559
+ var _createMediaConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(turnServerInfo, bundlePolicy) {
5097
5560
  var mc, audioEnabled, videoEnabled, shareEnabled;
5098
- return _regenerator.default.wrap(function _callee15$(_context15) {
5099
- while (1) switch (_context15.prev = _context15.next) {
5561
+ return _regenerator.default.wrap(function _callee18$(_context18) {
5562
+ while (1) switch (_context18.prev = _context18.next) {
5100
5563
  case 0:
5101
5564
  mc = _media.default.createMediaConnection(this.isMultistream, this.getMediaConnectionDebugId(),
5102
5565
  // @ts-ignore
@@ -5114,49 +5577,50 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5114
5577
  this.setupMediaConnectionListeners();
5115
5578
  if (this.isMultistream) {
5116
5579
  audioEnabled = this.mediaProperties.mediaDirection.sendAudio || this.mediaProperties.mediaDirection.receiveAudio, videoEnabled = this.mediaProperties.mediaDirection.sendVideo || this.mediaProperties.mediaDirection.receiveVideo, shareEnabled = this.mediaProperties.mediaDirection.sendShare || this.mediaProperties.mediaDirection.receiveShare;
5117
- this.sendSlotManager.createSlot(mc, _internalMediaCore.MediaType.VideoMain, audioEnabled);
5118
- this.sendSlotManager.createSlot(mc, _internalMediaCore.MediaType.AudioMain, videoEnabled);
5580
+ this.sendSlotManager.createSlot(mc, _internalMediaCore.MediaType.VideoMain, videoEnabled);
5581
+ this.sendSlotManager.createSlot(mc, _internalMediaCore.MediaType.AudioMain, audioEnabled);
5119
5582
  this.sendSlotManager.createSlot(mc, _internalMediaCore.MediaType.VideoSlides, shareEnabled);
5120
5583
  this.sendSlotManager.createSlot(mc, _internalMediaCore.MediaType.AudioSlides, shareEnabled);
5121
5584
  }
5122
5585
 
5123
5586
  // publish the streams
5124
5587
  if (!this.mediaProperties.audioStream) {
5125
- _context15.next = 7;
5588
+ _context18.next = 8;
5126
5589
  break;
5127
5590
  }
5128
- _context15.next = 7;
5591
+ this.setSendNamedMediaGroup(_internalMediaCore.MediaType.AudioMain);
5592
+ _context18.next = 8;
5129
5593
  return this.publishStream(_internalMediaCore.MediaType.AudioMain, this.mediaProperties.audioStream);
5130
- case 7:
5594
+ case 8:
5131
5595
  if (!this.mediaProperties.videoStream) {
5132
- _context15.next = 10;
5596
+ _context18.next = 11;
5133
5597
  break;
5134
5598
  }
5135
- _context15.next = 10;
5599
+ _context18.next = 11;
5136
5600
  return this.publishStream(_internalMediaCore.MediaType.VideoMain, this.mediaProperties.videoStream);
5137
- case 10:
5601
+ case 11:
5138
5602
  if (!this.mediaProperties.shareVideoStream) {
5139
- _context15.next = 13;
5603
+ _context18.next = 14;
5140
5604
  break;
5141
5605
  }
5142
- _context15.next = 13;
5606
+ _context18.next = 14;
5143
5607
  return this.publishStream(_internalMediaCore.MediaType.VideoSlides, this.mediaProperties.shareVideoStream);
5144
- case 13:
5608
+ case 14:
5145
5609
  if (!(this.isMultistream && this.mediaProperties.shareAudioStream)) {
5146
- _context15.next = 16;
5610
+ _context18.next = 17;
5147
5611
  break;
5148
5612
  }
5149
- _context15.next = 16;
5613
+ _context18.next = 17;
5150
5614
  return this.publishStream(_internalMediaCore.MediaType.AudioSlides, this.mediaProperties.shareAudioStream);
5151
- case 16:
5152
- return _context15.abrupt("return", mc);
5153
5615
  case 17:
5616
+ return _context18.abrupt("return", mc);
5617
+ case 18:
5154
5618
  case "end":
5155
- return _context15.stop();
5619
+ return _context18.stop();
5156
5620
  }
5157
- }, _callee15, this);
5621
+ }, _callee18, this);
5158
5622
  }));
5159
- function createMediaConnection(_x10, _x11) {
5623
+ function createMediaConnection(_x14, _x15) {
5160
5624
  return _createMediaConnection.apply(this, arguments);
5161
5625
  }
5162
5626
  return createMediaConnection;
@@ -5183,293 +5647,743 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5183
5647
  }
5184
5648
 
5185
5649
  /**
5186
- * Creates a media connection to the server. Media connection is required for sending or receiving any audio/video.
5650
+ * Sets up all the references to local streams in this.mediaProperties before creating media connection
5651
+ * and before TURN discovery, so that the correct mute state is sent with TURN discovery roap messages.
5187
5652
  *
5188
- * @param {AddMediaOptions} options
5189
- * @returns {Promise}
5190
- * @public
5191
- * @memberof Meeting
5653
+ * @private
5654
+ * @param {LocalStreams} localStreams
5655
+ * @returns {Promise<void>}
5192
5656
  */
5193
5657
  }, {
5194
- key: "addMedia",
5195
- value: function addMedia() {
5196
- var _this$webex$meetings$2,
5197
- _this$webex$meetings$3,
5198
- _localStreams$screenS,
5199
- _localStreams$screenS2,
5200
- _this39 = this;
5201
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5202
- var LOG_HEADER = 'Meeting:index#addMedia -->';
5203
- var turnDiscoverySkippedReason;
5204
- var turnServerUsed = false;
5205
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " called with: ").concat((0, _stringify.default)(options)));
5206
- if (this.meetingState !== _constants.FULL_STATE.ACTIVE) {
5207
- return _promise.default.reject(new _webexErrors.MeetingNotActiveError());
5658
+ key: "setUpLocalStreamReferences",
5659
+ value: function () {
5660
+ var _setUpLocalStreamReferences = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(localStreams) {
5661
+ var _localStreams$screenS, _localStreams$screenS2;
5662
+ var setUpStreamPromises;
5663
+ return _regenerator.default.wrap(function _callee19$(_context19) {
5664
+ while (1) switch (_context19.prev = _context19.next) {
5665
+ case 0:
5666
+ setUpStreamPromises = [];
5667
+ if (localStreams !== null && localStreams !== void 0 && localStreams.microphone) {
5668
+ setUpStreamPromises.push(this.setLocalAudioStream(localStreams.microphone));
5669
+ }
5670
+ if (localStreams !== null && localStreams !== void 0 && localStreams.camera) {
5671
+ setUpStreamPromises.push(this.setLocalVideoStream(localStreams.camera));
5672
+ }
5673
+ if (localStreams !== null && localStreams !== void 0 && (_localStreams$screenS = localStreams.screenShare) !== null && _localStreams$screenS !== void 0 && _localStreams$screenS.video) {
5674
+ setUpStreamPromises.push(this.setLocalShareVideoStream(localStreams.screenShare.video));
5675
+ }
5676
+ if (localStreams !== null && localStreams !== void 0 && (_localStreams$screenS2 = localStreams.screenShare) !== null && _localStreams$screenS2 !== void 0 && _localStreams$screenS2.audio) {
5677
+ setUpStreamPromises.push(this.setLocalShareAudioStream(localStreams.screenShare.audio));
5678
+ }
5679
+ _context19.prev = 5;
5680
+ _context19.next = 8;
5681
+ return _promise.default.all(setUpStreamPromises);
5682
+ case 8:
5683
+ _context19.next = 14;
5684
+ break;
5685
+ case 10:
5686
+ _context19.prev = 10;
5687
+ _context19.t0 = _context19["catch"](5);
5688
+ _loggerProxy.default.logger.error("Meeting:index#addMedia():setUpLocalStreamReferences --> Error , ", _context19.t0);
5689
+ throw _context19.t0;
5690
+ case 14:
5691
+ case "end":
5692
+ return _context19.stop();
5693
+ }
5694
+ }, _callee19, this, [[5, 10]]);
5695
+ }));
5696
+ function setUpLocalStreamReferences(_x16) {
5697
+ return _setUpLocalStreamReferences.apply(this, arguments);
5208
5698
  }
5209
- if (_util.default.isUserInLeftState(this.locusInfo)) {
5210
- return _promise.default.reject(new _webexErrors.UserNotJoinedError());
5699
+ return setUpLocalStreamReferences;
5700
+ }()
5701
+ /**
5702
+ * Calls mediaProperties.waitForMediaConnectionConnected() and sends CA client.ice.end metric on failure
5703
+ *
5704
+ * @private
5705
+ * @returns {Promise<void>}
5706
+ */
5707
+ }, {
5708
+ key: "waitForMediaConnectionConnected",
5709
+ value: function () {
5710
+ var _waitForMediaConnectionConnected = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
5711
+ 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;
5712
+ return _regenerator.default.wrap(function _callee20$(_context20) {
5713
+ while (1) switch (_context20.prev = _context20.next) {
5714
+ case 0:
5715
+ _context20.prev = 0;
5716
+ _context20.next = 3;
5717
+ return this.mediaProperties.waitForMediaConnectionConnected();
5718
+ case 3:
5719
+ _context20.next = 9;
5720
+ break;
5721
+ case 5:
5722
+ _context20.prev = 5;
5723
+ _context20.t0 = _context20["catch"](0);
5724
+ if (!this.hasMediaConnectionConnectedAtLeastOnce) {
5725
+ // Only send CA event for join flow if we haven't successfully connected media yet
5726
+ // @ts-ignore
5727
+ this.webex.internal.newMetrics.submitClientEvent({
5728
+ name: 'client.ice.end',
5729
+ payload: {
5730
+ canProceed: !this.turnServerUsed,
5731
+ // If we haven't done turn tls retry yet we will proceed with join attempt
5732
+ icePhase: this.turnServerUsed ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY',
5733
+ errors: [
5734
+ // @ts-ignore
5735
+ this.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode({
5736
+ clientErrorCode: _internalPluginMetrics.CallDiagnosticUtils.generateClientErrorCodeForIceFailure({
5737
+ 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',
5738
+ 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',
5739
+ turnServerUsed: this.turnServerUsed
5740
+ })
5741
+ })]
5742
+ },
5743
+ options: {
5744
+ meetingId: this.id
5745
+ }
5746
+ });
5747
+ }
5748
+ throw new Error("Timed out waiting for media connection to be connected, correlationId=".concat(this.correlationId));
5749
+ case 9:
5750
+ case "end":
5751
+ return _context20.stop();
5752
+ }
5753
+ }, _callee20, this, [[0, 5]]);
5754
+ }));
5755
+ function waitForMediaConnectionConnected() {
5756
+ return _waitForMediaConnectionConnected.apply(this, arguments);
5211
5757
  }
5212
- var localStreams = options.localStreams,
5213
- _options$audioEnabled = options.audioEnabled,
5214
- audioEnabled = _options$audioEnabled === void 0 ? true : _options$audioEnabled,
5215
- _options$videoEnabled = options.videoEnabled,
5216
- videoEnabled = _options$videoEnabled === void 0 ? true : _options$videoEnabled,
5217
- _options$shareAudioEn = options.shareAudioEnabled,
5218
- shareAudioEnabled = _options$shareAudioEn === void 0 ? true : _options$shareAudioEn,
5219
- _options$shareVideoEn = options.shareVideoEnabled,
5220
- shareVideoEnabled = _options$shareVideoEn === void 0 ? true : _options$shareVideoEn,
5221
- remoteMediaManagerConfig = options.remoteMediaManagerConfig,
5222
- bundlePolicy = options.bundlePolicy,
5223
- allowMediaInLobby = options.allowMediaInLobby;
5224
- this.allowMediaInLobby = options === null || options === void 0 ? void 0 : options.allowMediaInLobby;
5225
-
5226
- // If the user is unjoined or guest waiting in lobby dont allow the user to addMedia
5227
- // @ts-ignore - isUserUnadmitted coming from SelfUtil
5228
- if (this.isUserUnadmitted && !this.wirelessShare && !allowMediaInLobby) {
5229
- return _promise.default.reject(new _webexErrors.UserInLobbyError());
5758
+ return waitForMediaConnectionConnected;
5759
+ }()
5760
+ /**
5761
+ * Enables statsAnalyser if config allows it
5762
+ *
5763
+ * @private
5764
+ * @returns {void}
5765
+ */
5766
+ }, {
5767
+ key: "createStatsAnalyzer",
5768
+ value: function createStatsAnalyzer() {
5769
+ var _this39 = this;
5770
+ // @ts-ignore - config coming from registerPlugin
5771
+ if (this.config.stats.enableStatsAnalyzer) {
5772
+ // @ts-ignore - config coming from registerPlugin
5773
+ this.networkQualityMonitor = new _networkQualityMonitor.default(this.config.stats);
5774
+ this.statsAnalyzer = new _statsAnalyzer.StatsAnalyzer(
5775
+ // @ts-ignore - config coming from registerPlugin
5776
+ this.config.stats, function (ssrc) {
5777
+ return _this39.receiveSlotManager.findReceiveSlotBySsrc(ssrc);
5778
+ }, this.networkQualityMonitor);
5779
+ this.setupStatsAnalyzerEventHandlers();
5780
+ this.networkQualityMonitor.on(_constants.EVENT_TRIGGERS.NETWORK_QUALITY, this.sendNetworkQualityEvent.bind(this));
5230
5781
  }
5782
+ }
5231
5783
 
5232
- // @ts-ignore
5233
- this.webex.internal.newMetrics.submitClientEvent({
5234
- name: 'client.media.capabilities',
5235
- payload: {
5236
- mediaCapabilities: {
5237
- rx: {
5238
- audio: false,
5239
- share: false,
5240
- share_audio: false,
5241
- video: false,
5242
- whiteboard: false
5243
- },
5244
- tx: {
5245
- audio: false,
5246
- share: false,
5247
- share_audio: false,
5248
- video: false,
5249
- whiteboard: false
5250
- }
5784
+ /**
5785
+ * Handles device logging
5786
+ *
5787
+ * @private
5788
+ * @static
5789
+ * @returns {Promise<void>}
5790
+ */
5791
+ }, {
5792
+ key: "waitForRemoteSDPAnswer",
5793
+ value:
5794
+ /**
5795
+ * Returns a promise. This promise is created once the local sdp offer has been successfully created and is resolved
5796
+ * once the remote sdp answer has been received.
5797
+ *
5798
+ * @private
5799
+ * @returns {Promise<void>}
5800
+ */
5801
+ function () {
5802
+ var _waitForRemoteSDPAnswer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
5803
+ var LOG_HEADER, deferSDPAnswer;
5804
+ return _regenerator.default.wrap(function _callee21$(_context21) {
5805
+ while (1) switch (_context21.prev = _context21.next) {
5806
+ case 0:
5807
+ LOG_HEADER = 'Meeting:index#addMedia():waitForRemoteSDPAnswer -->';
5808
+ if (this.deferSDPAnswer) {
5809
+ _context21.next = 4;
5810
+ break;
5811
+ }
5812
+ _loggerProxy.default.logger.warn("".concat(LOG_HEADER, " offer not created yet"));
5813
+ return _context21.abrupt("return", _promise.default.reject(new Error('waitForRemoteSDPAnswer() called before local sdp offer created')));
5814
+ case 4:
5815
+ deferSDPAnswer = this.deferSDPAnswer;
5816
+ this.sdpResponseTimer = setTimeout(function () {
5817
+ _loggerProxy.default.logger.warn("".concat(LOG_HEADER, " timeout! no REMOTE SDP ANSWER received within ").concat(_constants.ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT / 1000, " seconds"));
5818
+ deferSDPAnswer.reject(new Error('Timed out waiting for REMOTE SDP ANSWER'));
5819
+ }, _constants.ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT);
5820
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " waiting for REMOTE SDP ANSWER..."));
5821
+ return _context21.abrupt("return", deferSDPAnswer.promise);
5822
+ case 8:
5823
+ case "end":
5824
+ return _context21.stop();
5251
5825
  }
5252
- },
5253
- options: {
5254
- meetingId: this.id
5255
- }
5256
- });
5257
-
5258
- // when audioEnabled/videoEnabled is true, we set sendAudio/sendVideo to true even before any streams are published
5259
- // to avoid doing an extra SDP exchange when they are published for the first time
5260
- this.mediaProperties.setMediaDirection({
5261
- sendAudio: audioEnabled,
5262
- sendVideo: videoEnabled,
5263
- sendShare: false,
5264
- receiveAudio: audioEnabled,
5265
- receiveVideo: videoEnabled,
5266
- receiveShare: shareAudioEnabled || shareVideoEnabled
5267
- });
5268
- this.locusMediaRequest = new _locusMediaRequest.LocusMediaRequest({
5269
- correlationId: this.correlationId,
5270
- device: {
5271
- url: this.deviceUrl,
5272
- // @ts-ignore
5273
- deviceType: this.config.deviceType,
5274
- // @ts-ignore
5275
- countryCode: (_this$webex$meetings$2 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$2 === void 0 ? void 0 : _this$webex$meetings$2.countryCode,
5276
- // @ts-ignore
5277
- regionCode: (_this$webex$meetings$3 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$3 === void 0 ? void 0 : _this$webex$meetings$3.regionCode
5278
- },
5279
- preferTranscoding: !this.isMultistream
5280
- }, {
5281
- // @ts-ignore
5282
- parent: this.webex
5283
- });
5284
- this.audio = (0, _muteState.createMuteState)(_constants.AUDIO, this, audioEnabled);
5285
- this.video = (0, _muteState.createMuteState)(_constants.VIDEO, this, videoEnabled);
5286
- var promises = [];
5287
-
5288
- // setup all the references to local streams in this.mediaProperties before creating media connection
5289
- // and before TURN discovery, so that the correct mute state is sent with TURN discovery roap messages
5290
- if (localStreams !== null && localStreams !== void 0 && localStreams.microphone) {
5291
- promises.push(this.setLocalAudioStream(localStreams.microphone));
5826
+ }, _callee21, this);
5827
+ }));
5828
+ function waitForRemoteSDPAnswer() {
5829
+ return _waitForRemoteSDPAnswer.apply(this, arguments);
5292
5830
  }
5293
- if (localStreams !== null && localStreams !== void 0 && localStreams.camera) {
5294
- promises.push(this.setLocalVideoStream(localStreams.camera));
5831
+ return waitForRemoteSDPAnswer;
5832
+ }()
5833
+ /**
5834
+ * Calls establishMediaConnection with isForced = true to force turn discovery to happen
5835
+ *
5836
+ * @private
5837
+ * @param {RemoteMediaManagerConfiguration} [remoteMediaManagerConfig]
5838
+ * @param {BundlePolicy} [bundlePolicy]
5839
+ * @returns {Promise<void>}
5840
+ */
5841
+ }, {
5842
+ key: "retryEstablishMediaConnectionWithForcedTurnDiscovery",
5843
+ value: function () {
5844
+ var _retryEstablishMediaConnectionWithForcedTurnDiscovery = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(remoteMediaManagerConfig, bundlePolicy) {
5845
+ var LOG_HEADER;
5846
+ return _regenerator.default.wrap(function _callee22$(_context22) {
5847
+ while (1) switch (_context22.prev = _context22.next) {
5848
+ case 0:
5849
+ LOG_HEADER = 'Meeting:index#addMedia():retryEstablishMediaConnectionWithForcedTurnDiscovery -->';
5850
+ _context22.prev = 1;
5851
+ _context22.next = 4;
5852
+ return this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, true);
5853
+ case 4:
5854
+ _context22.next = 10;
5855
+ break;
5856
+ case 6:
5857
+ _context22.prev = 6;
5858
+ _context22.t0 = _context22["catch"](1);
5859
+ _loggerProxy.default.logger.error("".concat(LOG_HEADER, " retry with TURN-TLS failed, media connection unable to connect, "), _context22.t0);
5860
+ throw _context22.t0;
5861
+ case 10:
5862
+ case "end":
5863
+ return _context22.stop();
5864
+ }
5865
+ }, _callee22, this, [[1, 6]]);
5866
+ }));
5867
+ function retryEstablishMediaConnectionWithForcedTurnDiscovery(_x17, _x18) {
5868
+ return _retryEstablishMediaConnectionWithForcedTurnDiscovery.apply(this, arguments);
5295
5869
  }
5296
- if (localStreams !== null && localStreams !== void 0 && (_localStreams$screenS = localStreams.screenShare) !== null && _localStreams$screenS !== void 0 && _localStreams$screenS.video) {
5297
- promises.push(this.setLocalShareVideoStream(localStreams.screenShare.video));
5870
+ return retryEstablishMediaConnectionWithForcedTurnDiscovery;
5871
+ }()
5872
+ /**
5873
+ * Does relevant clean up before retrying to establish media connection
5874
+ * and performs the retry with forced turn discovery
5875
+ *
5876
+ * @private
5877
+ * @param {RemoteMediaManagerConfiguration} [remoteMediaManagerConfig]
5878
+ * @param {BundlePolicy} [bundlePolicy]
5879
+ * @returns {Promise<void>}
5880
+ */
5881
+ }, {
5882
+ key: "retryWithForcedTurnDiscovery",
5883
+ value: function () {
5884
+ var _retryWithForcedTurnDiscovery = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(remoteMediaManagerConfig, bundlePolicy) {
5885
+ var LOG_HEADER;
5886
+ return _regenerator.default.wrap(function _callee23$(_context23) {
5887
+ while (1) switch (_context23.prev = _context23.next) {
5888
+ case 0:
5889
+ this.retriedWithTurnServer = true;
5890
+ LOG_HEADER = 'Meeting:index#addMedia():retryWithForcedTurnDiscovery -->';
5891
+ _context23.next = 4;
5892
+ return this.cleanUpBeforeRetryWithTurnServer();
5893
+ case 4:
5894
+ _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_RETRY, {
5895
+ correlation_id: this.correlationId,
5896
+ state: this.state,
5897
+ meetingState: this.meetingState,
5898
+ reason: 'forcingTurnTls'
5899
+ });
5900
+ if (!(this.state === _constants.MEETING_STATE.STATES.LEFT)) {
5901
+ _context23.next = 9;
5902
+ break;
5903
+ }
5904
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " meeting state was LEFT after first attempt to establish media connection. Attempting to rejoin. "));
5905
+ _context23.next = 9;
5906
+ return this.join({
5907
+ rejoin: true
5908
+ });
5909
+ case 9:
5910
+ _context23.next = 11;
5911
+ return this.retryEstablishMediaConnectionWithForcedTurnDiscovery(remoteMediaManagerConfig, bundlePolicy);
5912
+ case 11:
5913
+ case "end":
5914
+ return _context23.stop();
5915
+ }
5916
+ }, _callee23, this);
5917
+ }));
5918
+ function retryWithForcedTurnDiscovery(_x19, _x20) {
5919
+ return _retryWithForcedTurnDiscovery.apply(this, arguments);
5298
5920
  }
5299
- if (localStreams !== null && localStreams !== void 0 && (_localStreams$screenS2 = localStreams.screenShare) !== null && _localStreams$screenS2 !== void 0 && _localStreams$screenS2.audio) {
5300
- promises.push(this.setLocalShareAudioStream(localStreams.screenShare.audio));
5921
+ return retryWithForcedTurnDiscovery;
5922
+ }()
5923
+ /**
5924
+ * If waitForMediaConnectionConnected() fails when we haven't done turn discovery then we
5925
+ * attempt to establish a media connection again, but this time using turn discovery. If we
5926
+ * used turn discovery on the first pass we do not attempt connection again.
5927
+ *
5928
+ * @private
5929
+ * @param {Error} error
5930
+ * @param {RemoteMediaManagerConfiguration} [remoteMediaManagerConfig]
5931
+ * @param {BundlePolicy} [bundlePolicy]
5932
+ * @returns {Promise<void>}
5933
+ */
5934
+ }, {
5935
+ key: "handleWaitForMediaConnectionConnectedError",
5936
+ value: function () {
5937
+ var _handleWaitForMediaConnectionConnectedError = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24(error, remoteMediaManagerConfig, bundlePolicy) {
5938
+ var LOG_HEADER;
5939
+ return _regenerator.default.wrap(function _callee24$(_context24) {
5940
+ while (1) switch (_context24.prev = _context24.next) {
5941
+ case 0:
5942
+ LOG_HEADER = 'Meeting:index#addMedia():handleWaitForMediaConnectionConnectedError -->'; // @ts-ignore - config coming from registerPlugin
5943
+ if (this.turnServerUsed) {
5944
+ _context24.next = 7;
5945
+ break;
5946
+ }
5947
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " error waiting for media to connect on UDP, TCP, retrying using TURN-TLS, "), error);
5948
+ _context24.next = 5;
5949
+ return this.retryWithForcedTurnDiscovery(remoteMediaManagerConfig, bundlePolicy);
5950
+ case 5:
5951
+ _context24.next = 9;
5952
+ break;
5953
+ case 7:
5954
+ _loggerProxy.default.logger.error("".concat(LOG_HEADER, " error waiting for media to connect using UDP, TCP and TURN-TLS"), error);
5955
+ throw new _webexErrors.AddMediaFailed();
5956
+ case 9:
5957
+ case "end":
5958
+ return _context24.stop();
5959
+ }
5960
+ }, _callee24, this);
5961
+ }));
5962
+ function handleWaitForMediaConnectionConnectedError(_x21, _x22, _x23) {
5963
+ return _handleWaitForMediaConnectionConnectedError.apply(this, arguments);
5301
5964
  }
5302
- return _promise.default.all(promises).then(function () {
5303
- return _this39.roap.doTurnDiscovery(_this39, false);
5304
- }).then( /*#__PURE__*/function () {
5305
- var _ref24 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(turnDiscoveryObject) {
5306
- var turnServerInfo, mc;
5307
- return _regenerator.default.wrap(function _callee16$(_context16) {
5308
- while (1) switch (_context16.prev = _context16.next) {
5309
- case 0:
5310
- turnDiscoverySkippedReason = turnDiscoveryObject.turnDiscoverySkippedReason;
5311
- turnServerUsed = !turnDiscoverySkippedReason;
5312
- turnServerInfo = turnDiscoveryObject.turnServerInfo;
5313
- _context16.next = 5;
5314
- return _this39.createMediaConnection(turnServerInfo, bundlePolicy);
5315
- case 5:
5316
- mc = _context16.sent;
5317
- if (!_this39.isMultistream) {
5318
- _context16.next = 13;
5319
- break;
5320
- }
5321
- _this39.remoteMediaManager = new _remoteMediaManager.RemoteMediaManager(_this39.receiveSlotManager, _this39.mediaRequestManagers, remoteMediaManagerConfig);
5322
- _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.AudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_AUDIO_CREATED);
5323
- _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.ScreenShareAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED);
5324
- _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.VideoLayoutChanged, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED);
5325
- _context16.next = 13;
5326
- return _this39.remoteMediaManager.start();
5327
- case 13:
5328
- _context16.next = 15;
5329
- return mc.initiateOffer();
5330
- case 15:
5331
- case "end":
5332
- return _context16.stop();
5333
- }
5334
- }, _callee16);
5335
- }));
5336
- return function (_x12) {
5337
- return _ref24.apply(this, arguments);
5338
- };
5339
- }()).then(function () {
5340
- _this39.setMercuryListener();
5341
- }).then(function () {
5342
- return (0, _mediaHelpers.getDevices)().then(function (devices) {
5343
- _util.default.handleDeviceLogging(devices);
5344
- }).catch(function () {});
5345
- } // getDevices may fail if we don't have browser permissions, that's ok, we still can have a media connection
5346
- ).then(function () {
5347
- _this39.handleMediaLogging(_this39.mediaProperties);
5348
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " media connection created"));
5965
+ return handleWaitForMediaConnectionConnectedError;
5966
+ }()
5967
+ /**
5968
+ * Does TURN discovery, SDP offer/answer exhange, establishes ICE connection and DTLS handshake.
5969
+ *
5970
+ * @private
5971
+ * @param {RemoteMediaManagerConfiguration} [remoteMediaManagerConfig]
5972
+ * @param {BundlePolicy} [bundlePolicy]
5973
+ * @param {boolean} [isForced] - let isForced be true to do turn discovery regardless of reachability results
5974
+ * @returns {Promise<void>}
5975
+ */
5976
+ }, {
5977
+ key: "establishMediaConnection",
5978
+ value: function () {
5979
+ var _establishMediaConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25(remoteMediaManagerConfig, bundlePolicy, isForced) {
5980
+ var LOG_HEADER, cdl, isRetry, turnDiscoveryObject, turnServerInfo, mc;
5981
+ return _regenerator.default.wrap(function _callee25$(_context25) {
5982
+ while (1) switch (_context25.prev = _context25.next) {
5983
+ case 0:
5984
+ LOG_HEADER = 'Meeting:index#addMedia():establishMediaConnection -->'; // @ts-ignore
5985
+ cdl = this.webex.internal.newMetrics.callDiagnosticLatencies;
5986
+ isRetry = this.retriedWithTurnServer;
5987
+ _context25.prev = 3;
5988
+ // @ts-ignore
5989
+ this.webex.internal.newMetrics.submitInternalEvent({
5990
+ name: 'internal.client.add-media.turn-discovery.start'
5991
+ });
5992
+ _context25.next = 7;
5993
+ return this.roap.doTurnDiscovery(this, isRetry, isForced);
5994
+ case 7:
5995
+ turnDiscoveryObject = _context25.sent;
5996
+ this.turnDiscoverySkippedReason = turnDiscoveryObject === null || turnDiscoveryObject === void 0 ? void 0 : turnDiscoveryObject.turnDiscoverySkippedReason;
5997
+ this.turnServerUsed = !this.turnDiscoverySkippedReason;
5349
5998
 
5350
- // @ts-ignore - config coming from registerPlugin
5351
- if (_this39.config.stats.enableStatsAnalyzer) {
5352
- // @ts-ignore - config coming from registerPlugin
5353
- _this39.networkQualityMonitor = new _networkQualityMonitor.default(_this39.config.stats);
5354
- _this39.statsAnalyzer = new _statsAnalyzer.StatsAnalyzer(
5355
- // @ts-ignore - config coming from registerPlugin
5356
- _this39.config.stats, function (ssrc) {
5357
- return _this39.receiveSlotManager.findReceiveSlotBySsrc(ssrc);
5358
- }, _this39.networkQualityMonitor);
5359
- _this39.setupStatsAnalyzerEventHandlers();
5360
- _this39.networkQualityMonitor.on(_constants.EVENT_TRIGGERS.NETWORK_QUALITY, _this39.sendNetworkQualityEvent.bind(_this39));
5361
- }
5362
- }).catch(function (error) {
5363
- _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error adding media , setting up peerconnection, "), error);
5364
- throw error;
5365
- }).then(function () {
5366
- return new _promise.default(function (resolve, reject) {
5367
- var timerCount = 0;
5999
+ // @ts-ignore
6000
+ this.webex.internal.newMetrics.submitInternalEvent({
6001
+ name: 'internal.client.add-media.turn-discovery.end'
6002
+ });
6003
+ turnServerInfo = turnDiscoveryObject.turnServerInfo;
6004
+ if (this.turnServerUsed && turnServerInfo) {
6005
+ _metrics.default.sendBehavioralMetric(_constants2.default.TURN_DISCOVERY_LATENCY, {
6006
+ correlation_id: this.correlationId,
6007
+ latency: cdl.getTurnDiscoveryTime(),
6008
+ turnServerUsed: this.turnServerUsed,
6009
+ retriedWithTurnServer: this.retriedWithTurnServer
6010
+ });
6011
+ }
6012
+ _context25.next = 15;
6013
+ return this.createMediaConnection(turnServerInfo, bundlePolicy);
6014
+ case 15:
6015
+ mc = _context25.sent;
6016
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " media connection created"));
6017
+ if (!this.isMultistream) {
6018
+ _context25.next = 25;
6019
+ break;
6020
+ }
6021
+ this.remoteMediaManager = new _remoteMediaManager.RemoteMediaManager(this.receiveSlotManager, this.mediaRequestManagers, remoteMediaManagerConfig);
6022
+ this.forwardEvent(this.remoteMediaManager, _remoteMediaManager.Event.AudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_AUDIO_CREATED);
6023
+ this.forwardEvent(this.remoteMediaManager, _remoteMediaManager.Event.InterpretationAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_INTERPRETATION_AUDIO_CREATED);
6024
+ this.forwardEvent(this.remoteMediaManager, _remoteMediaManager.Event.ScreenShareAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED);
6025
+ this.forwardEvent(this.remoteMediaManager, _remoteMediaManager.Event.VideoLayoutChanged, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED);
6026
+ _context25.next = 25;
6027
+ return this.remoteMediaManager.start();
6028
+ case 25:
6029
+ _context25.next = 27;
6030
+ return mc.initiateOffer();
6031
+ case 27:
6032
+ _context25.next = 29;
6033
+ return this.waitForRemoteSDPAnswer();
6034
+ case 29:
6035
+ this.handleMediaLogging(this.mediaProperties);
6036
+ _context25.next = 36;
6037
+ break;
6038
+ case 32:
6039
+ _context25.prev = 32;
6040
+ _context25.t0 = _context25["catch"](3);
6041
+ _loggerProxy.default.logger.error("".concat(LOG_HEADER, " error establishing media connection, "), _context25.t0);
6042
+ throw _context25.t0;
6043
+ case 36:
6044
+ _context25.prev = 36;
6045
+ _context25.next = 39;
6046
+ return this.waitForMediaConnectionConnected();
6047
+ case 39:
6048
+ _context25.next = 45;
6049
+ break;
6050
+ case 41:
6051
+ _context25.prev = 41;
6052
+ _context25.t1 = _context25["catch"](36);
6053
+ _context25.next = 45;
6054
+ return this.handleWaitForMediaConnectionConnectedError(_context25.t1, remoteMediaManagerConfig, bundlePolicy);
6055
+ case 45:
6056
+ case "end":
6057
+ return _context25.stop();
6058
+ }
6059
+ }, _callee25, this, [[3, 32], [36, 41]]);
6060
+ }));
6061
+ function establishMediaConnection(_x24, _x25, _x26) {
6062
+ return _establishMediaConnection.apply(this, arguments);
6063
+ }
6064
+ return establishMediaConnection;
6065
+ }()
6066
+ /**
6067
+ * Cleans up stats analyzer, peer connection, and turns off listeners
6068
+ *
6069
+ * @private
6070
+ * @returns {Promise<void>}
6071
+ */
6072
+ }, {
6073
+ key: "cleanUpOnAddMediaFailure",
6074
+ value: function () {
6075
+ var _cleanUpOnAddMediaFailure = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
6076
+ return _regenerator.default.wrap(function _callee26$(_context26) {
6077
+ while (1) switch (_context26.prev = _context26.next) {
6078
+ case 0:
6079
+ if (!this.statsAnalyzer) {
6080
+ _context26.next = 3;
6081
+ break;
6082
+ }
6083
+ _context26.next = 3;
6084
+ return this.statsAnalyzer.stopAnalyzer();
6085
+ case 3:
6086
+ this.statsAnalyzer = null;
5368
6087
 
5369
- // eslint-disable-next-line func-names
5370
- // eslint-disable-next-line prefer-arrow-callback
5371
- if (_this39.type === _constants._CALL_ || _this39.meetingState === _constants.FULL_STATE.ACTIVE) {
5372
- resolve();
6088
+ // when media fails, we want to upload a webrtc dump to see whats going on
6089
+ // this function is async, but returns once the stats have been gathered
6090
+ _context26.next = 6;
6091
+ return this.forceSendStatsReport({
6092
+ callFrom: 'addMedia'
6093
+ });
6094
+ case 6:
6095
+ if (this.mediaProperties.webrtcMediaConnection) {
6096
+ this.closePeerConnections();
6097
+ this.unsetPeerConnections();
6098
+ }
6099
+ case 7:
6100
+ case "end":
6101
+ return _context26.stop();
5373
6102
  }
5374
- var joiningTimer = setInterval(function () {
5375
- timerCount += 1;
5376
- if (_this39.meetingState === _constants.FULL_STATE.ACTIVE) {
5377
- clearInterval(joiningTimer);
5378
- resolve();
5379
- }
5380
- if (timerCount === 4) {
5381
- clearInterval(joiningTimer);
5382
- reject(new Error('Meeting is still not active '));
5383
- }
5384
- }, 1000);
5385
- });
5386
- }).then(function () {
5387
- return _this39.mediaProperties.waitForMediaConnectionConnected().catch(function () {
5388
- // @ts-ignore
5389
- _this39.webex.internal.newMetrics.submitClientEvent({
5390
- name: 'client.ice.end',
5391
- payload: {
5392
- canProceed: false,
5393
- icePhase: 'JOIN_MEETING_FINAL',
5394
- errors: [
5395
- // @ts-ignore
5396
- _this39.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode({
5397
- clientErrorCode: _internalPluginMetrics.CALL_DIAGNOSTIC_CONFIG.ICE_FAILURE_CLIENT_CODE
5398
- })]
5399
- },
5400
- options: {
5401
- meetingId: _this39.id
5402
- }
5403
- });
5404
- throw new Error("Timed out waiting for media connection to be connected, correlationId=".concat(_this39.correlationId));
5405
- });
5406
- }).then(function () {
5407
- if (_this39.mediaProperties.hasLocalShareStream()) {
5408
- return _this39.enqueueScreenShareFloorRequest();
5409
- }
5410
- return _promise.default.resolve();
5411
- }).then(function () {
5412
- return _this39.mediaProperties.getCurrentConnectionType();
5413
- }).then(function (connectionType) {
5414
- var _this39$remoteMediaMa;
5415
- _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_SUCCESS, {
5416
- correlation_id: _this39.correlationId,
5417
- locus_id: _this39.locusUrl.split('/').pop(),
5418
- connectionType: connectionType,
5419
- isMultistream: _this39.isMultistream
5420
- });
5421
- // @ts-ignore
5422
- _this39.webex.internal.newMetrics.submitClientEvent({
5423
- name: 'client.media-engine.ready',
5424
- options: {
5425
- meetingId: _this39.id
6103
+ }, _callee26, this);
6104
+ }));
6105
+ function cleanUpOnAddMediaFailure() {
6106
+ return _cleanUpOnAddMediaFailure.apply(this, arguments);
6107
+ }
6108
+ return cleanUpOnAddMediaFailure;
6109
+ }()
6110
+ /**
6111
+ * Sends stats report, closes peer connection and cleans up any media connection
6112
+ * related things before trying to establish media connection again with turn server
6113
+ *
6114
+ * @private
6115
+ * @returns {Promise<void>}
6116
+ */
6117
+ }, {
6118
+ key: "cleanUpBeforeRetryWithTurnServer",
6119
+ value: function () {
6120
+ var _cleanUpBeforeRetryWithTurnServer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27() {
6121
+ return _regenerator.default.wrap(function _callee27$(_context27) {
6122
+ while (1) switch (_context27.prev = _context27.next) {
6123
+ case 0:
6124
+ _context27.next = 2;
6125
+ return this.forceSendStatsReport({
6126
+ callFrom: 'cleanUpBeforeRetryWithTurnServer'
6127
+ });
6128
+ case 2:
6129
+ if (this.mediaProperties.webrtcMediaConnection) {
6130
+ if (this.remoteMediaManager) {
6131
+ this.remoteMediaManager.stop();
6132
+ this.remoteMediaManager = null;
6133
+ }
6134
+ (0, _values.default)(this.mediaRequestManagers).forEach(function (mediaRequestManager) {
6135
+ return mediaRequestManager.reset();
6136
+ });
6137
+ this.receiveSlotManager.reset();
6138
+ this.mediaProperties.webrtcMediaConnection.close();
6139
+ this.sendSlotManager.reset();
6140
+ this.mediaProperties.unsetPeerConnection();
6141
+ }
6142
+ case 3:
6143
+ case "end":
6144
+ return _context27.stop();
5426
6145
  }
5427
- });
5428
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " successfully established media connection, type=").concat(connectionType));
6146
+ }, _callee27, this);
6147
+ }));
6148
+ function cleanUpBeforeRetryWithTurnServer() {
6149
+ return _cleanUpBeforeRetryWithTurnServer.apply(this, arguments);
6150
+ }
6151
+ return cleanUpBeforeRetryWithTurnServer;
6152
+ }()
6153
+ /**
6154
+ * Creates a media connection to the server. Media connection is required for sending or receiving any audio/video.
6155
+ *
6156
+ * @param {AddMediaOptions} options
6157
+ * @returns {Promise<void>}
6158
+ * @public
6159
+ * @memberof Meeting
6160
+ */
6161
+ }, {
6162
+ key: "addMedia",
6163
+ value: function () {
6164
+ var _addMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28() {
6165
+ var _this$webex$meetings$2, _this$webex$meetings$3;
6166
+ var options,
6167
+ LOG_HEADER,
6168
+ localStreams,
6169
+ _options$audioEnabled,
6170
+ audioEnabled,
6171
+ _options$videoEnabled,
6172
+ videoEnabled,
6173
+ _options$shareAudioEn,
6174
+ shareAudioEnabled,
6175
+ _options$shareVideoEn,
6176
+ shareVideoEnabled,
6177
+ remoteMediaManagerConfig,
6178
+ bundlePolicy,
6179
+ allowMediaInLobby,
6180
+ _this$remoteMediaMana,
6181
+ connectionType,
6182
+ reachabilityStats,
6183
+ _this$mediaProperties20,
6184
+ _this$mediaProperties21,
6185
+ _this$mediaProperties22,
6186
+ _this$mediaProperties23,
6187
+ _this$mediaProperties24,
6188
+ _this$mediaProperties25,
6189
+ _this$mediaProperties26,
6190
+ _this$mediaProperties27,
6191
+ _this$mediaProperties28,
6192
+ _this$mediaProperties29,
6193
+ _this$mediaProperties30,
6194
+ _this$mediaProperties31,
6195
+ _this$mediaProperties32,
6196
+ _this$mediaProperties33,
6197
+ _this$mediaProperties34,
6198
+ _this$mediaProperties35,
6199
+ _this$mediaProperties36,
6200
+ _this$mediaProperties37,
6201
+ _this$mediaProperties38,
6202
+ _this$mediaProperties39,
6203
+ _this$mediaProperties40,
6204
+ reachabilityMetrics,
6205
+ _args28 = arguments;
6206
+ return _regenerator.default.wrap(function _callee28$(_context28) {
6207
+ while (1) switch (_context28.prev = _context28.next) {
6208
+ case 0:
6209
+ options = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {};
6210
+ this.retriedWithTurnServer = false;
6211
+ this.hasMediaConnectionConnectedAtLeastOnce = false;
6212
+ LOG_HEADER = 'Meeting:index#addMedia -->';
6213
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " called with: ").concat((0, _stringify.default)(options)));
6214
+ if (!(options.allowMediaInLobby !== true && this.meetingState !== _constants.FULL_STATE.ACTIVE)) {
6215
+ _context28.next = 7;
6216
+ break;
6217
+ }
6218
+ throw new _webexErrors.MeetingNotActiveError();
6219
+ case 7:
6220
+ if (!_util.default.isUserInLeftState(this.locusInfo)) {
6221
+ _context28.next = 9;
6222
+ break;
6223
+ }
6224
+ throw new _webexErrors.UserNotJoinedError();
6225
+ case 9:
6226
+ localStreams = options.localStreams, _options$audioEnabled = options.audioEnabled, audioEnabled = _options$audioEnabled === void 0 ? true : _options$audioEnabled, _options$videoEnabled = options.videoEnabled, videoEnabled = _options$videoEnabled === void 0 ? true : _options$videoEnabled, _options$shareAudioEn = options.shareAudioEnabled, shareAudioEnabled = _options$shareAudioEn === void 0 ? true : _options$shareAudioEn, _options$shareVideoEn = options.shareVideoEnabled, shareVideoEnabled = _options$shareVideoEn === void 0 ? true : _options$shareVideoEn, remoteMediaManagerConfig = options.remoteMediaManagerConfig, bundlePolicy = options.bundlePolicy, allowMediaInLobby = options.allowMediaInLobby;
6227
+ this.allowMediaInLobby = options === null || options === void 0 ? void 0 : options.allowMediaInLobby;
6228
+
6229
+ // If the user is unjoined or guest waiting in lobby dont allow the user to addMedia
6230
+ // @ts-ignore - isUserUnadmitted coming from SelfUtil
6231
+ if (!(this.isUserUnadmitted && !this.wirelessShare && !allowMediaInLobby)) {
6232
+ _context28.next = 13;
6233
+ break;
6234
+ }
6235
+ throw new _webexErrors.UserInLobbyError();
6236
+ case 13:
6237
+ // @ts-ignore
6238
+ this.webex.internal.newMetrics.submitClientEvent({
6239
+ name: 'client.media.capabilities',
6240
+ payload: {
6241
+ mediaCapabilities: {
6242
+ rx: {
6243
+ audio: false,
6244
+ share: false,
6245
+ share_audio: false,
6246
+ video: false,
6247
+ whiteboard: false
6248
+ },
6249
+ tx: {
6250
+ audio: false,
6251
+ share: false,
6252
+ share_audio: false,
6253
+ video: false,
6254
+ whiteboard: false
6255
+ }
6256
+ }
6257
+ },
6258
+ options: {
6259
+ meetingId: this.id
6260
+ }
6261
+ });
5429
6262
 
5430
- // We can log ReceiveSlot SSRCs only after the SDP exchange, so doing it here:
5431
- (_this39$remoteMediaMa = _this39.remoteMediaManager) === null || _this39$remoteMediaMa === void 0 ? void 0 : _this39$remoteMediaMa.logAllReceiveSlots();
5432
- }).catch(function (error) {
5433
- var _this39$mediaProperti, _this39$mediaProperti2, _this39$mediaProperti3, _this39$mediaProperti4, _this39$mediaProperti5, _this39$mediaProperti6, _this39$mediaProperti7, _this39$mediaProperti8, _this39$mediaProperti9, _this39$mediaProperti10, _this39$mediaProperti11, _this39$mediaProperti12, _this39$mediaProperti13, _this39$mediaProperti14, _this39$mediaProperti15, _this39$mediaProperti16, _this39$mediaProperti17, _this39$mediaProperti18, _this39$mediaProperti19, _this39$mediaProperti20, _this39$mediaProperti21;
5434
- _loggerProxy.default.logger.error("".concat(LOG_HEADER, " failed to establish media connection: "), error);
5435
- _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, {
5436
- correlation_id: _this39.correlationId,
5437
- locus_id: _this39.locusUrl.split('/').pop(),
5438
- reason: error.message,
5439
- stack: error.stack,
5440
- code: error.code,
5441
- turnDiscoverySkippedReason: turnDiscoverySkippedReason,
5442
- turnServerUsed: turnServerUsed,
5443
- isMultistream: _this39.isMultistream,
5444
- signalingState: ((_this39$mediaProperti = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti === void 0 ? void 0 : (_this39$mediaProperti2 = _this39$mediaProperti.multistreamConnection) === null || _this39$mediaProperti2 === void 0 ? void 0 : (_this39$mediaProperti3 = _this39$mediaProperti2.pc) === null || _this39$mediaProperti3 === void 0 ? void 0 : (_this39$mediaProperti4 = _this39$mediaProperti3.pc) === null || _this39$mediaProperti4 === void 0 ? void 0 : _this39$mediaProperti4.signalingState) || ((_this39$mediaProperti5 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti5 === void 0 ? void 0 : (_this39$mediaProperti6 = _this39$mediaProperti5.mediaConnection) === null || _this39$mediaProperti6 === void 0 ? void 0 : (_this39$mediaProperti7 = _this39$mediaProperti6.pc) === null || _this39$mediaProperti7 === void 0 ? void 0 : _this39$mediaProperti7.signalingState) || 'unknown',
5445
- connectionState: ((_this39$mediaProperti8 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti8 === void 0 ? void 0 : (_this39$mediaProperti9 = _this39$mediaProperti8.multistreamConnection) === null || _this39$mediaProperti9 === void 0 ? void 0 : (_this39$mediaProperti10 = _this39$mediaProperti9.pc) === null || _this39$mediaProperti10 === void 0 ? void 0 : (_this39$mediaProperti11 = _this39$mediaProperti10.pc) === null || _this39$mediaProperti11 === void 0 ? void 0 : _this39$mediaProperti11.connectionState) || ((_this39$mediaProperti12 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti12 === void 0 ? void 0 : (_this39$mediaProperti13 = _this39$mediaProperti12.mediaConnection) === null || _this39$mediaProperti13 === void 0 ? void 0 : (_this39$mediaProperti14 = _this39$mediaProperti13.pc) === null || _this39$mediaProperti14 === void 0 ? void 0 : _this39$mediaProperti14.connectionState) || 'unknown',
5446
- iceConnectionState: ((_this39$mediaProperti15 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti15 === void 0 ? void 0 : (_this39$mediaProperti16 = _this39$mediaProperti15.multistreamConnection) === null || _this39$mediaProperti16 === void 0 ? void 0 : (_this39$mediaProperti17 = _this39$mediaProperti16.pc) === null || _this39$mediaProperti17 === void 0 ? void 0 : (_this39$mediaProperti18 = _this39$mediaProperti17.pc) === null || _this39$mediaProperti18 === void 0 ? void 0 : _this39$mediaProperti18.iceConnectionState) || ((_this39$mediaProperti19 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti19 === void 0 ? void 0 : (_this39$mediaProperti20 = _this39$mediaProperti19.mediaConnection) === null || _this39$mediaProperti20 === void 0 ? void 0 : (_this39$mediaProperti21 = _this39$mediaProperti20.pc) === null || _this39$mediaProperti21 === void 0 ? void 0 : _this39$mediaProperti21.iceConnectionState) || 'unknown'
5447
- });
6263
+ // when audioEnabled/videoEnabled is true, we set sendAudio/sendVideo to true even before any streams are published
6264
+ // to avoid doing an extra SDP exchange when they are published for the first time
6265
+ this.mediaProperties.setMediaDirection({
6266
+ sendAudio: audioEnabled,
6267
+ sendVideo: videoEnabled,
6268
+ sendShare: false,
6269
+ receiveAudio: audioEnabled,
6270
+ receiveVideo: videoEnabled,
6271
+ receiveShare: shareAudioEnabled || shareVideoEnabled
6272
+ });
6273
+ this.locusMediaRequest = new _locusMediaRequest.LocusMediaRequest({
6274
+ correlationId: this.correlationId,
6275
+ device: {
6276
+ url: this.deviceUrl,
6277
+ // @ts-ignore
6278
+ deviceType: this.config.deviceType,
6279
+ // @ts-ignore
6280
+ countryCode: (_this$webex$meetings$2 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$2 === void 0 ? void 0 : _this$webex$meetings$2.countryCode,
6281
+ // @ts-ignore
6282
+ regionCode: (_this$webex$meetings$3 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$3 === void 0 ? void 0 : _this$webex$meetings$3.regionCode
6283
+ },
6284
+ preferTranscoding: !this.isMultistream
6285
+ }, {
6286
+ // @ts-ignore
6287
+ parent: this.webex
6288
+ });
6289
+ this.audio = (0, _muteState.createMuteState)(_constants.AUDIO, this, audioEnabled);
6290
+ this.video = (0, _muteState.createMuteState)(_constants.VIDEO, this, videoEnabled);
6291
+ _context28.prev = 18;
6292
+ _context28.next = 21;
6293
+ return this.setUpLocalStreamReferences(localStreams);
6294
+ case 21:
6295
+ this.setMercuryListener();
6296
+ this.createStatsAnalyzer();
6297
+ _context28.next = 25;
6298
+ return this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, false);
6299
+ case 25:
6300
+ _context28.next = 27;
6301
+ return Meeting.handleDeviceLogging();
6302
+ case 27:
6303
+ if (!this.mediaProperties.hasLocalShareStream()) {
6304
+ _context28.next = 30;
6305
+ break;
6306
+ }
6307
+ _context28.next = 30;
6308
+ return this.enqueueScreenShareFloorRequest();
6309
+ case 30:
6310
+ _context28.next = 32;
6311
+ return this.mediaProperties.getCurrentConnectionType();
6312
+ case 32:
6313
+ connectionType = _context28.sent;
6314
+ _context28.next = 35;
6315
+ return this.webex.meetings.reachability.getReachabilityMetrics();
6316
+ case 35:
6317
+ reachabilityStats = _context28.sent;
6318
+ _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_SUCCESS, _objectSpread({
6319
+ correlation_id: this.correlationId,
6320
+ locus_id: this.locusUrl.split('/').pop(),
6321
+ connectionType: connectionType,
6322
+ isMultistream: this.isMultistream,
6323
+ retriedWithTurnServer: this.retriedWithTurnServer
6324
+ }, reachabilityStats));
6325
+ // @ts-ignore
6326
+ this.webex.internal.newMetrics.submitClientEvent({
6327
+ name: 'client.media-engine.ready',
6328
+ options: {
6329
+ meetingId: this.id
6330
+ }
6331
+ });
6332
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " successfully established media connection, type=").concat(connectionType));
5448
6333
 
5449
- // Clean up stats analyzer, peer connection, and turn off listeners
5450
- var stopStatsAnalyzer = _this39.statsAnalyzer ? _this39.statsAnalyzer.stopAnalyzer() : _promise.default.resolve();
5451
- return stopStatsAnalyzer.then(function () {
5452
- _this39.statsAnalyzer = null;
5453
- if (_this39.mediaProperties.webrtcMediaConnection) {
5454
- _this39.closePeerConnections();
5455
- _this39.unsetPeerConnections();
5456
- }
6334
+ // We can log ReceiveSlot SSRCs only after the SDP exchange, so doing it here:
6335
+ (_this$remoteMediaMana = this.remoteMediaManager) === null || _this$remoteMediaMana === void 0 ? void 0 : _this$remoteMediaMana.logAllReceiveSlots();
6336
+ _context28.next = 54;
6337
+ break;
6338
+ case 42:
6339
+ _context28.prev = 42;
6340
+ _context28.t0 = _context28["catch"](18);
6341
+ _loggerProxy.default.logger.error("".concat(LOG_HEADER, " failed to establish media connection: "), _context28.t0);
5457
6342
 
5458
- // Upload logs on error while adding media
5459
- _triggerProxy.default.trigger(_this39, {
5460
- file: 'meeting/index',
5461
- function: 'addMedia'
5462
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this39);
5463
- if (error instanceof _internalMediaCore.Errors.SdpError) {
5464
- _this39.leave({
5465
- reason: _constants.MEETING_REMOVED_REASON.MEETING_CONNECTION_FAILED
5466
- });
6343
+ // @ts-ignore
6344
+ _context28.next = 47;
6345
+ return this.webex.meetings.reachability.getReachabilityMetrics();
6346
+ case 47:
6347
+ reachabilityMetrics = _context28.sent;
6348
+ _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, _objectSpread({
6349
+ correlation_id: this.correlationId,
6350
+ locus_id: this.locusUrl.split('/').pop(),
6351
+ reason: _context28.t0.message,
6352
+ stack: _context28.t0.stack,
6353
+ code: _context28.t0.code,
6354
+ turnDiscoverySkippedReason: this.turnDiscoverySkippedReason,
6355
+ turnServerUsed: this.turnServerUsed,
6356
+ retriedWithTurnServer: this.retriedWithTurnServer,
6357
+ isMultistream: this.isMultistream,
6358
+ 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',
6359
+ 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',
6360
+ 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'
6361
+ }, reachabilityMetrics));
6362
+ _context28.next = 51;
6363
+ return this.cleanUpOnAddMediaFailure();
6364
+ case 51:
6365
+ // Upload logs on error while adding media
6366
+ _triggerProxy.default.trigger(this, {
6367
+ file: 'meeting/index',
6368
+ function: 'addMedia'
6369
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, this);
6370
+ if (_context28.t0 instanceof _internalMediaCore.Errors.SdpError) {
6371
+ this.leave({
6372
+ reason: _constants.MEETING_REMOVED_REASON.MEETING_CONNECTION_FAILED
6373
+ });
6374
+ }
6375
+ throw _context28.t0;
6376
+ case 54:
6377
+ case "end":
6378
+ return _context28.stop();
5467
6379
  }
5468
- throw error;
5469
- });
5470
- });
5471
- }
5472
-
6380
+ }, _callee28, this, [[18, 42]]);
6381
+ }));
6382
+ function addMedia() {
6383
+ return _addMedia.apply(this, arguments);
6384
+ }
6385
+ return addMedia;
6386
+ }()
5473
6387
  /**
5474
6388
  * Informs if the peer connection is in a state that can be updated with updateMedia (audio/video/share)
5475
6389
  * @returns {Boolean}
@@ -5483,6 +6397,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5483
6397
  return !this.isRoapInProgress;
5484
6398
  }
5485
6399
 
6400
+ /**
6401
+ * media failed, so collect a stats report from webrtc using the wcme connection to grab the rtc stats report
6402
+ * send a webrtc telemetry dump to the configured server using the internal media core check metrics configured callback
6403
+ * @param {String} callFrom - the function calling this function, optional.
6404
+ * @returns {Promise<void>}
6405
+ */
6406
+ }, {
6407
+ key: "enqueueMediaUpdate",
6408
+ value:
5486
6409
  /**
5487
6410
  * Enqueues a media update operation.
5488
6411
  * @param {String} mediaUpdateType one of MEDIA_UPDATE_TYPE values
@@ -5491,9 +6414,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5491
6414
  * @private
5492
6415
  * @memberof Meeting
5493
6416
  */
5494
- }, {
5495
- key: "enqueueMediaUpdate",
5496
- value: function enqueueMediaUpdate(mediaUpdateType) {
6417
+ function enqueueMediaUpdate(mediaUpdateType) {
5497
6418
  var _this40 = this;
5498
6419
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5499
6420
  var canUpdateMediaNow = this.canUpdateMedia();
@@ -5537,35 +6458,35 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5537
6458
  * @memberof Meeting
5538
6459
  */
5539
6460
  function () {
5540
- var _updateMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(options) {
6461
+ var _updateMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29(options) {
5541
6462
  var audioEnabled, videoEnabled, shareAudioEnabled, shareVideoEnabled;
5542
- return _regenerator.default.wrap(function _callee17$(_context17) {
5543
- while (1) switch (_context17.prev = _context17.next) {
6463
+ return _regenerator.default.wrap(function _callee29$(_context29) {
6464
+ while (1) switch (_context29.prev = _context29.next) {
5544
6465
  case 0:
5545
6466
  this.checkMediaConnection();
5546
6467
  audioEnabled = options.audioEnabled, videoEnabled = options.videoEnabled, shareAudioEnabled = options.shareAudioEnabled, shareVideoEnabled = options.shareVideoEnabled;
5547
6468
  _loggerProxy.default.logger.log("Meeting:index#updateMedia --> called with options=".concat((0, _stringify.default)(options)));
5548
6469
  if (this.canUpdateMedia()) {
5549
- _context17.next = 5;
6470
+ _context29.next = 5;
5550
6471
  break;
5551
6472
  }
5552
- return _context17.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.UPDATE_MEDIA, options));
6473
+ return _context29.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.UPDATE_MEDIA, options));
5553
6474
  case 5:
5554
6475
  if (!this.isMultistream) {
5555
- _context17.next = 10;
6476
+ _context29.next = 10;
5556
6477
  break;
5557
6478
  }
5558
6479
  if (!(shareAudioEnabled !== undefined || shareVideoEnabled !== undefined)) {
5559
- _context17.next = 8;
6480
+ _context29.next = 8;
5560
6481
  break;
5561
6482
  }
5562
6483
  throw new Error('toggling shareAudioEnabled or shareVideoEnabled in a multistream meeting is not supported, to control receiving screen share call meeting.remoteMediaManager.setLayout() with appropriate layout');
5563
6484
  case 8:
5564
- _context17.next = 12;
6485
+ _context29.next = 12;
5565
6486
  break;
5566
6487
  case 10:
5567
6488
  if (!(shareAudioEnabled !== undefined)) {
5568
- _context17.next = 12;
6489
+ _context29.next = 12;
5569
6490
  break;
5570
6491
  }
5571
6492
  throw new Error('toggling shareAudioEnabled in a transcoded meeting is not supported as of now');
@@ -5590,20 +6511,20 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5590
6511
  this.mediaProperties.mediaDirection.receiveShare = !!(shareAudioEnabled || shareVideoEnabled);
5591
6512
  }
5592
6513
  if (this.isMultistream) {
5593
- _context17.next = 18;
6514
+ _context29.next = 18;
5594
6515
  break;
5595
6516
  }
5596
- _context17.next = 18;
6517
+ _context29.next = 18;
5597
6518
  return this.updateTranscodedMediaConnection();
5598
6519
  case 18:
5599
- return _context17.abrupt("return", undefined);
6520
+ return _context29.abrupt("return", undefined);
5600
6521
  case 19:
5601
6522
  case "end":
5602
- return _context17.stop();
6523
+ return _context29.stop();
5603
6524
  }
5604
- }, _callee17, this);
6525
+ }, _callee29, this);
5605
6526
  }));
5606
- function updateMedia(_x13) {
6527
+ function updateMedia(_x27) {
5607
6528
  return _updateMedia.apply(this, arguments);
5608
6529
  }
5609
6530
  return updateMedia;
@@ -5888,9 +6809,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5888
6809
  uri: whiteboard.url
5889
6810
  }).catch(function (error) {
5890
6811
  _loggerProxy.default.logger.error('Meeting:index#stopWhiteboardShare --> Error ', error);
5891
- _metrics.default.sendBehavioralMetric(
5892
- // @ts-ignore - check if STOP_WHITEBOARD_SHARE_FAILURE exists
5893
- _constants2.default.STOP_WHITEBOARD_SHARE_FAILURE, {
6812
+ _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_STOP_WHITEBOARD_SHARE_FAILURE, {
5894
6813
  correlation_id: _this45.correlationId,
5895
6814
  locus_id: _this45.locusUrl.split('/').pop(),
5896
6815
  reason: error.message,
@@ -5928,9 +6847,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5928
6847
  if (content && this.shareStatus !== _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE) {
5929
6848
  // @ts-ignore
5930
6849
  this.webex.internal.newMetrics.submitClientEvent({
5931
- name: 'client.share.initiated',
6850
+ name: 'client.share.floor-grant.request',
5932
6851
  payload: {
5933
- mediaType: 'share'
6852
+ mediaType: 'share',
6853
+ shareInstanceId: this.localShareInstanceId
5934
6854
  },
5935
6855
  options: {
5936
6856
  meetingId: this.id
@@ -5941,9 +6861,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5941
6861
  personUrl: this.locusInfo.self.url,
5942
6862
  deviceUrl: this.deviceUrl,
5943
6863
  uri: content.url,
5944
- resourceUrl: this.resourceUrl
6864
+ resourceUrl: this.resourceUrl,
6865
+ shareInstanceId: this.localShareInstanceId
5945
6866
  }).then(function () {
5946
6867
  _this46.screenShareFloorState = ScreenShareFloorStatus.GRANTED;
6868
+ _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_SHARE_SUCCESS, {
6869
+ correlation_id: _this46.correlationId,
6870
+ locus_id: _this46.locusUrl.split('/').pop()
6871
+ });
5947
6872
  return _promise.default.resolve();
5948
6873
  }).catch(function (error) {
5949
6874
  _loggerProxy.default.logger.error('Meeting:index#share --> Error ', error);
@@ -5953,6 +6878,19 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5953
6878
  reason: error.message,
5954
6879
  stack: error.stack
5955
6880
  });
6881
+
6882
+ // @ts-ignore
6883
+ _this46.webex.internal.newMetrics.submitClientEvent({
6884
+ name: 'client.share.floor-granted.local',
6885
+ payload: {
6886
+ mediaType: 'share',
6887
+ errors: _util.default.getChangeMeetingFloorErrorPayload(error.message),
6888
+ shareInstanceId: _this46.localShareInstanceId
6889
+ },
6890
+ options: {
6891
+ meetingId: _this46.id
6892
+ }
6893
+ });
5956
6894
  _this46.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
5957
6895
  return _promise.default.reject(error);
5958
6896
  });
@@ -6007,7 +6945,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6007
6945
  this.webex.internal.newMetrics.submitClientEvent({
6008
6946
  name: 'client.share.stopped',
6009
6947
  payload: {
6010
- mediaType: 'share'
6948
+ mediaType: 'share',
6949
+ shareInstanceId: this.localShareInstanceId
6011
6950
  },
6012
6951
  options: {
6013
6952
  meetingId: this.id
@@ -6022,7 +6961,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6022
6961
  personUrl: this.locusInfo.self.url,
6023
6962
  deviceUrl: this.deviceUrl,
6024
6963
  uri: content.url,
6025
- resourceUrl: this.resourceUrl
6964
+ resourceUrl: this.resourceUrl,
6965
+ shareInstanceId: this.localShareInstanceId
6026
6966
  }).catch(function (error) {
6027
6967
  _loggerProxy.default.logger.error('Meeting:index#releaseScreenShareFloor --> Error ', error);
6028
6968
  _metrics.default.sendBehavioralMetric(_constants2.default.STOP_FLOOR_REQUEST_FAILURE, {
@@ -6210,10 +7150,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6210
7150
  var renderInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6211
7151
  var main = renderInfo.main,
6212
7152
  content = renderInfo.content;
6213
- var _this$mediaProperties4 = this.mediaProperties,
6214
- mediaDirection = _this$mediaProperties4.mediaDirection,
6215
- remoteShareStream = _this$mediaProperties4.remoteShareStream,
6216
- remoteVideoStream = _this$mediaProperties4.remoteVideoStream;
7153
+ var _this$mediaProperties41 = this.mediaProperties,
7154
+ mediaDirection = _this$mediaProperties41.mediaDirection,
7155
+ remoteShareStream = _this$mediaProperties41.remoteShareStream,
7156
+ remoteVideoStream = _this$mediaProperties41.remoteVideoStream;
6217
7157
  var layoutInfo = (0, _cloneDeep2.default)(this.lastVideoLayoutInfo);
6218
7158
 
6219
7159
  // TODO: We need a real time value for Audio, Video and Share send indicator
@@ -6222,7 +7162,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6222
7162
  }
6223
7163
  if (layoutType) {
6224
7164
  if (!_constants.LAYOUT_TYPES.includes(layoutType)) {
6225
- this.rejectWithErrorLog('Meeting:index#changeVideoLayout --> cannot change video layout, invalid layoutType recieved.');
7165
+ this.rejectWithErrorLog('Meeting:index#changeVideoLayout --> cannot change video layout, invalid layoutType received.');
6226
7166
  }
6227
7167
  layoutInfo.layoutType = layoutType;
6228
7168
  }
@@ -6496,8 +7436,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6496
7436
  }, {
6497
7437
  key: "checkMediaConnection",
6498
7438
  value: function checkMediaConnection() {
6499
- var _this$mediaProperties5;
6500
- if ((_this$mediaProperties5 = this.mediaProperties) !== null && _this$mediaProperties5 !== void 0 && _this$mediaProperties5.webrtcMediaConnection) {
7439
+ var _this$mediaProperties42;
7440
+ if ((_this$mediaProperties42 = this.mediaProperties) !== null && _this$mediaProperties42 !== void 0 && _this$mediaProperties42.webrtcMediaConnection) {
6501
7441
  return;
6502
7442
  }
6503
7443
  throw new _webexErrors.NoMediaEstablishedYetError();
@@ -6512,39 +7452,39 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6512
7452
  }, {
6513
7453
  key: "enableMusicMode",
6514
7454
  value: function () {
6515
- var _enableMusicMode = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(shouldEnableMusicMode) {
6516
- return _regenerator.default.wrap(function _callee18$(_context18) {
6517
- while (1) switch (_context18.prev = _context18.next) {
7455
+ var _enableMusicMode = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30(shouldEnableMusicMode) {
7456
+ return _regenerator.default.wrap(function _callee30$(_context30) {
7457
+ while (1) switch (_context30.prev = _context30.next) {
6518
7458
  case 0:
6519
7459
  this.checkMediaConnection();
6520
7460
  if (this.isMultistream) {
6521
- _context18.next = 3;
7461
+ _context30.next = 3;
6522
7462
  break;
6523
7463
  }
6524
7464
  throw new Error('enableMusicMode() only supported with multistream');
6525
7465
  case 3:
6526
7466
  if (!shouldEnableMusicMode) {
6527
- _context18.next = 8;
7467
+ _context30.next = 8;
6528
7468
  break;
6529
7469
  }
6530
- _context18.next = 6;
7470
+ _context30.next = 6;
6531
7471
  return this.sendSlotManager.setCodecParameters(_internalMediaCore.MediaType.AudioMain, {
6532
7472
  maxaveragebitrate: '64000',
6533
7473
  maxplaybackrate: '48000'
6534
7474
  });
6535
7475
  case 6:
6536
- _context18.next = 10;
7476
+ _context30.next = 10;
6537
7477
  break;
6538
7478
  case 8:
6539
- _context18.next = 10;
7479
+ _context30.next = 10;
6540
7480
  return this.sendSlotManager.deleteCodecParameters(_internalMediaCore.MediaType.AudioMain, ['maxaveragebitrate', 'maxplaybackrate']);
6541
7481
  case 10:
6542
7482
  case "end":
6543
- return _context18.stop();
7483
+ return _context30.stop();
6544
7484
  }
6545
- }, _callee18, this);
7485
+ }, _callee30, this);
6546
7486
  }));
6547
- function enableMusicMode(_x14) {
7487
+ function enableMusicMode(_x28) {
6548
7488
  return _enableMusicMode.apply(this, arguments);
6549
7489
  }
6550
7490
  return enableMusicMode;
@@ -6556,10 +7496,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6556
7496
  }, {
6557
7497
  key: "updateTranscodedMediaConnection",
6558
7498
  value: function updateTranscodedMediaConnection() {
6559
- var _this$mediaProperties6,
6560
- _this$mediaProperties7,
6561
- _this$mediaProperties8,
6562
- _this$mediaProperties9,
7499
+ var _this$mediaProperties43,
7500
+ _this$mediaProperties44,
7501
+ _this$mediaProperties45,
7502
+ _this$mediaProperties46,
7503
+ _this$mediaProperties47,
7504
+ _this$mediaProperties48,
7505
+ _this$mediaProperties49,
7506
+ _this$mediaProperties50,
6563
7507
  _this51 = this;
6564
7508
  var LOG_HEADER = 'Meeting:index#updateTranscodedMediaConnection -->';
6565
7509
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " starting"));
@@ -6569,10 +7513,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6569
7513
  return this.mediaProperties.webrtcMediaConnection.update({
6570
7514
  // TODO: RoapMediaConnection is not ready to use stream classes yet, so we pass the raw MediaStreamTrack for now
6571
7515
  localTracks: {
6572
- audio: ((_this$mediaProperties6 = this.mediaProperties.audioStream) === null || _this$mediaProperties6 === void 0 ? void 0 : _this$mediaProperties6.outputTrack) || null,
6573
- video: ((_this$mediaProperties7 = this.mediaProperties.videoStream) === null || _this$mediaProperties7 === void 0 ? void 0 : _this$mediaProperties7.outputTrack) || null,
6574
- screenShareVideo: ((_this$mediaProperties8 = this.mediaProperties.shareVideoStream) === null || _this$mediaProperties8 === void 0 ? void 0 : _this$mediaProperties8.outputTrack) || null,
6575
- screenShareAudio: ((_this$mediaProperties9 = this.mediaProperties.shareAudioStream) === null || _this$mediaProperties9 === void 0 ? void 0 : _this$mediaProperties9.outputTrack) || null
7516
+ 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,
7517
+ 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,
7518
+ 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,
7519
+ 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
6576
7520
  },
6577
7521
  direction: {
6578
7522
  audio: _media.default.getDirection(true, this.mediaProperties.mediaDirection.receiveAudio, this.mediaProperties.mediaDirection.sendAudio),
@@ -6594,6 +7538,32 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6594
7538
  });
6595
7539
  }
6596
7540
 
7541
+ /**
7542
+ * set sending named media group which the audio should send to
7543
+ * @param {MediaType} mediaType of the stream
7544
+ * @param {number} languageCode of the stream
7545
+ * @returns {void}
7546
+ */
7547
+ }, {
7548
+ key: "setSendNamedMediaGroup",
7549
+ value: function setSendNamedMediaGroup(mediaType) {
7550
+ var languageCode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
7551
+ if (mediaType !== _internalMediaCore.MediaType.AudioMain) {
7552
+ throw new Error("cannot set send named media group which media type is ".concat(mediaType));
7553
+ }
7554
+ var value = languageCode || this.simultaneousInterpretation.getTargetLanguageCode();
7555
+ var groups = [];
7556
+ if (value) {
7557
+ groups = [{
7558
+ type: _constants.NAMED_MEDIA_GROUP_TYPE_AUDIO,
7559
+ value: value
7560
+ }];
7561
+ }
7562
+ if (this.isMultistream && this.mediaProperties.webrtcMediaConnection) {
7563
+ this.sendSlotManager.setNamedMediaGroups(mediaType, groups);
7564
+ }
7565
+ }
7566
+
6597
7567
  /**
6598
7568
  * Publishes a stream.
6599
7569
  *
@@ -6604,25 +7574,25 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6604
7574
  }, {
6605
7575
  key: "publishStream",
6606
7576
  value: function () {
6607
- var _publishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(mediaType, stream) {
6608
- return _regenerator.default.wrap(function _callee19$(_context19) {
6609
- while (1) switch (_context19.prev = _context19.next) {
7577
+ var _publishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31(mediaType, stream) {
7578
+ return _regenerator.default.wrap(function _callee31$(_context31) {
7579
+ while (1) switch (_context31.prev = _context31.next) {
6610
7580
  case 0:
6611
7581
  if (stream) {
6612
- _context19.next = 2;
7582
+ _context31.next = 2;
6613
7583
  break;
6614
7584
  }
6615
- return _context19.abrupt("return");
7585
+ return _context31.abrupt("return");
6616
7586
  case 2:
6617
7587
  if (!this.mediaProperties.webrtcMediaConnection) {
6618
- _context19.next = 7;
7588
+ _context31.next = 7;
6619
7589
  break;
6620
7590
  }
6621
7591
  if (!(this.isMultistream && this.mediaProperties.webrtcMediaConnection)) {
6622
- _context19.next = 6;
7592
+ _context31.next = 6;
6623
7593
  break;
6624
7594
  }
6625
- _context19.next = 6;
7595
+ _context31.next = 6;
6626
7596
  return this.sendSlotManager.publishStream(mediaType, stream);
6627
7597
  case 6:
6628
7598
  this.emitPublishStateChangeEvent({
@@ -6633,11 +7603,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6633
7603
  });
6634
7604
  case 7:
6635
7605
  case "end":
6636
- return _context19.stop();
7606
+ return _context31.stop();
6637
7607
  }
6638
- }, _callee19, this);
7608
+ }, _callee31, this);
6639
7609
  }));
6640
- function publishStream(_x15, _x16) {
7610
+ function publishStream(_x29, _x30) {
6641
7611
  return _publishStream.apply(this, arguments);
6642
7612
  }
6643
7613
  return publishStream;
@@ -6652,21 +7622,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6652
7622
  }, {
6653
7623
  key: "unpublishStream",
6654
7624
  value: function () {
6655
- var _unpublishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(mediaType, stream) {
6656
- return _regenerator.default.wrap(function _callee20$(_context20) {
6657
- while (1) switch (_context20.prev = _context20.next) {
7625
+ var _unpublishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32(mediaType, stream) {
7626
+ return _regenerator.default.wrap(function _callee32$(_context32) {
7627
+ while (1) switch (_context32.prev = _context32.next) {
6658
7628
  case 0:
6659
7629
  if (stream) {
6660
- _context20.next = 2;
7630
+ _context32.next = 2;
6661
7631
  break;
6662
7632
  }
6663
- return _context20.abrupt("return");
7633
+ return _context32.abrupt("return");
6664
7634
  case 2:
6665
7635
  if (!(this.isMultistream && this.mediaProperties.webrtcMediaConnection)) {
6666
- _context20.next = 5;
7636
+ _context32.next = 5;
6667
7637
  break;
6668
7638
  }
6669
- _context20.next = 5;
7639
+ _context32.next = 5;
6670
7640
  return this.sendSlotManager.unpublishStream(mediaType);
6671
7641
  case 5:
6672
7642
  this.emitPublishStateChangeEvent({
@@ -6677,11 +7647,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6677
7647
  });
6678
7648
  case 6:
6679
7649
  case "end":
6680
- return _context20.stop();
7650
+ return _context32.stop();
6681
7651
  }
6682
- }, _callee20, this);
7652
+ }, _callee32, this);
6683
7653
  }));
6684
- function unpublishStream(_x17, _x18) {
7654
+ function unpublishStream(_x31, _x32) {
6685
7655
  return _unpublishStream.apply(this, arguments);
6686
7656
  }
6687
7657
  return unpublishStream;
@@ -6695,72 +7665,93 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6695
7665
  }, {
6696
7666
  key: "publishStreams",
6697
7667
  value: function () {
6698
- var _publishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(streams) {
7668
+ var _publishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33(streams) {
6699
7669
  var _streams$screenShare, _streams$screenShare2, _streams$screenShare3, _streams$screenShare4;
6700
7670
  var floorRequestNeeded, _streams$screenShare5;
6701
- return _regenerator.default.wrap(function _callee21$(_context21) {
6702
- while (1) switch (_context21.prev = _context21.next) {
7671
+ return _regenerator.default.wrap(function _callee33$(_context33) {
7672
+ while (1) switch (_context33.prev = _context33.next) {
6703
7673
  case 0:
6704
7674
  this.checkMediaConnection();
6705
7675
  if (!(!streams.microphone && !streams.camera && !((_streams$screenShare = streams.screenShare) !== null && _streams$screenShare !== void 0 && _streams$screenShare.audio) && !((_streams$screenShare2 = streams.screenShare) !== null && _streams$screenShare2 !== void 0 && _streams$screenShare2.video))) {
6706
- _context21.next = 3;
7676
+ _context33.next = 3;
6707
7677
  break;
6708
7678
  }
6709
- return _context21.abrupt("return");
7679
+ return _context33.abrupt("return");
6710
7680
  case 3:
6711
7681
  floorRequestNeeded = false; // Screenshare Audio is supported only in multi stream. So we check for screenshare audio presence only if it's a multi stream meeting
6712
7682
  if (!(this.isMultistream && (_streams$screenShare3 = streams.screenShare) !== null && _streams$screenShare3 !== void 0 && _streams$screenShare3.audio)) {
6713
- _context21.next = 8;
7683
+ _context33.next = 8;
6714
7684
  break;
6715
7685
  }
6716
- _context21.next = 7;
7686
+ _context33.next = 7;
6717
7687
  return this.setLocalShareAudioStream(streams.screenShare.audio);
6718
7688
  case 7:
6719
7689
  floorRequestNeeded = this.screenShareFloorState === ScreenShareFloorStatus.RELEASED;
6720
7690
  case 8:
6721
7691
  if (!((_streams$screenShare4 = streams.screenShare) !== null && _streams$screenShare4 !== void 0 && _streams$screenShare4.video)) {
6722
- _context21.next = 12;
7692
+ _context33.next = 12;
6723
7693
  break;
6724
7694
  }
6725
- _context21.next = 11;
7695
+ _context33.next = 11;
6726
7696
  return this.setLocalShareVideoStream((_streams$screenShare5 = streams.screenShare) === null || _streams$screenShare5 === void 0 ? void 0 : _streams$screenShare5.video);
6727
7697
  case 11:
6728
7698
  floorRequestNeeded = this.screenShareFloorState === ScreenShareFloorStatus.RELEASED;
6729
7699
  case 12:
6730
7700
  if (!streams.microphone) {
6731
- _context21.next = 15;
7701
+ _context33.next = 15;
6732
7702
  break;
6733
7703
  }
6734
- _context21.next = 15;
7704
+ _context33.next = 15;
6735
7705
  return this.setLocalAudioStream(streams.microphone);
6736
7706
  case 15:
6737
7707
  if (!streams.camera) {
6738
- _context21.next = 18;
7708
+ _context33.next = 18;
6739
7709
  break;
6740
7710
  }
6741
- _context21.next = 18;
7711
+ _context33.next = 18;
6742
7712
  return this.setLocalVideoStream(streams.camera);
6743
7713
  case 18:
6744
7714
  if (this.isMultistream) {
6745
- _context21.next = 21;
7715
+ _context33.next = 21;
6746
7716
  break;
6747
7717
  }
6748
- _context21.next = 21;
7718
+ _context33.next = 21;
6749
7719
  return this.updateTranscodedMediaConnection();
6750
7720
  case 21:
6751
7721
  if (!floorRequestNeeded) {
6752
- _context21.next = 24;
7722
+ _context33.next = 27;
6753
7723
  break;
6754
7724
  }
6755
- _context21.next = 24;
7725
+ this.localShareInstanceId = _uuid.default.v4();
7726
+
7727
+ // @ts-ignore
7728
+ this.webex.internal.newMetrics.submitClientEvent({
7729
+ name: 'client.share.initiated',
7730
+ payload: {
7731
+ mediaType: 'share',
7732
+ shareInstanceId: this.localShareInstanceId
7733
+ },
7734
+ options: {
7735
+ meetingId: this.id
7736
+ }
7737
+ });
7738
+ this.statsAnalyzer.updateMediaStatus({
7739
+ expected: {
7740
+ sendShare: true
7741
+ }
7742
+ });
7743
+ // we're sending the http request to Locus to request the screen share floor
7744
+ // only after the SDP update, because that's how it's always been done for transcoded meetings
7745
+ // and also if sharing from the start, we need confluence to have been created
7746
+ _context33.next = 27;
6756
7747
  return this.enqueueScreenShareFloorRequest();
6757
- case 24:
7748
+ case 27:
6758
7749
  case "end":
6759
- return _context21.stop();
7750
+ return _context33.stop();
6760
7751
  }
6761
- }, _callee21, this);
7752
+ }, _callee33, this);
6762
7753
  }));
6763
- function publishStreams(_x19) {
7754
+ function publishStreams(_x33) {
6764
7755
  return _publishStreams.apply(this, arguments);
6765
7756
  }
6766
7757
  return publishStreams;
@@ -6774,10 +7765,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6774
7765
  }, {
6775
7766
  key: "unpublishStreams",
6776
7767
  value: function () {
6777
- var _unpublishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(streams) {
7768
+ var _unpublishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(streams) {
6778
7769
  var promises, _iterator, _step, stream;
6779
- return _regenerator.default.wrap(function _callee22$(_context22) {
6780
- while (1) switch (_context22.prev = _context22.next) {
7770
+ return _regenerator.default.wrap(function _callee34$(_context34) {
7771
+ while (1) switch (_context34.prev = _context34.next) {
6781
7772
  case 0:
6782
7773
  this.checkMediaConnection();
6783
7774
  promises = [];
@@ -6808,7 +7799,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6808
7799
  if (!this.isMultistream) {
6809
7800
  promises.push(this.updateTranscodedMediaConnection());
6810
7801
  }
6811
- _context22.next = 7;
7802
+ _context34.next = 7;
6812
7803
  return _promise.default.all(promises);
6813
7804
  case 7:
6814
7805
  // we're allowing for the SDK to support just audio share as well
@@ -6817,43 +7808,108 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6817
7808
  if (!this.mediaProperties.hasLocalShareStream()) {
6818
7809
  try {
6819
7810
  this.releaseScreenShareFloor(); // we ignore the returned promise here on purpose
7811
+
7812
+ this.statsAnalyzer.updateMediaStatus({
7813
+ expected: {
7814
+ sendShare: false
7815
+ }
7816
+ });
6820
7817
  } catch (e) {
6821
7818
  // nothing to do here, error is logged already inside releaseScreenShareFloor()
6822
7819
  }
6823
7820
  }
6824
7821
  case 8:
6825
7822
  case "end":
6826
- return _context22.stop();
7823
+ return _context34.stop();
6827
7824
  }
6828
- }, _callee22, this);
7825
+ }, _callee34, this);
6829
7826
  }));
6830
- function unpublishStreams(_x20) {
7827
+ function unpublishStreams(_x34) {
6831
7828
  return _unpublishStreams.apply(this, arguments);
6832
7829
  }
6833
7830
  return unpublishStreams;
6834
7831
  }()
6835
7832
  /**
6836
- * Gets the time left in seconds till the permission token expires
7833
+ * Gets permission token expiry information including timeLeft, expiryTime, currentTime
6837
7834
  * (from the time the function has been fired)
6838
7835
  *
6839
- * @returns {number} time left in seconds
7836
+ * @returns {object} permissionTokenExpiryInfo
7837
+ * @returns {number} permissionTokenExpiryInfo.timeLeft The time left for token to expire
7838
+ * @returns {number} permissionTokenExpiryInfo.expiryTime The expiry time of permission token from the server
7839
+ * @returns {number} permissionTokenExpiryInfo.currentTime The current time of the local machine
6840
7840
  */
6841
7841
  }, {
6842
- key: "getPermissionTokenTimeLeftInSec",
6843
- value: function getPermissionTokenTimeLeftInSec() {
7842
+ key: "getPermissionTokenExpiryInfo",
7843
+ value: function getPermissionTokenExpiryInfo() {
6844
7844
  if (!this.permissionTokenPayload) {
6845
7845
  return undefined;
6846
7846
  }
6847
- var permissionTokenExpValue = Number(this.permissionTokenPayload.exp);
7847
+ var permissionTokenExpiryFromServer = Number(this.permissionTokenPayload.exp);
7848
+ var permissionTokenIssuedTimeFromServer = Number(this.permissionTokenPayload.iat);
7849
+ var shiftInTime = this.permissionTokenReceivedLocalTime - permissionTokenIssuedTimeFromServer;
6848
7850
 
6849
7851
  // using new Date instead of Date.now() to allow for accurate unit testing
6850
7852
  // https://github.com/sinonjs/fake-timers/issues/321
6851
- var now = new Date().getTime();
7853
+ var currentTime = new Date().getTime();
7854
+
7855
+ // adjusted time is calculated in case your machine time is wrong
7856
+ var adjustedCurrentTime = currentTime - shiftInTime;
7857
+ var timeLeft = (permissionTokenExpiryFromServer - adjustedCurrentTime) / 1000;
7858
+ return {
7859
+ timeLeft: timeLeft,
7860
+ expiryTime: permissionTokenExpiryFromServer,
7861
+ currentTime: currentTime
7862
+ };
7863
+ }
6852
7864
 
6853
- // substract current time from the permissionTokenExp
6854
- // (permissionTokenExp is a epoch timestamp, not a time to live duration)
6855
- return (permissionTokenExpValue - now) / 1000;
7865
+ /**
7866
+ * Check if there is enough time left till the permission token expires
7867
+ * If not - refresh the permission token
7868
+ *
7869
+ * @param {number} threshold - time in seconds
7870
+ * @param {string} reason - reason for refreshing the permission token
7871
+ * @returns {Promise<void>}
7872
+ */
7873
+ }, {
7874
+ key: "checkAndRefreshPermissionToken",
7875
+ value: function checkAndRefreshPermissionToken(threshold, reason) {
7876
+ var _this$getPermissionTo;
7877
+ var timeLeft = (_this$getPermissionTo = this.getPermissionTokenExpiryInfo()) === null || _this$getPermissionTo === void 0 ? void 0 : _this$getPermissionTo.timeLeft;
7878
+ if (timeLeft !== undefined && timeLeft <= threshold) {
7879
+ return this.refreshPermissionToken(reason);
7880
+ }
7881
+ return _promise.default.resolve();
6856
7882
  }
7883
+ }], [{
7884
+ key: "handleDeviceLogging",
7885
+ value: function () {
7886
+ var _handleDeviceLogging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35() {
7887
+ var devices;
7888
+ return _regenerator.default.wrap(function _callee35$(_context35) {
7889
+ while (1) switch (_context35.prev = _context35.next) {
7890
+ case 0:
7891
+ _context35.prev = 0;
7892
+ _context35.next = 3;
7893
+ return (0, _mediaHelpers.getDevices)();
7894
+ case 3:
7895
+ devices = _context35.sent;
7896
+ _util.default.handleDeviceLogging(devices);
7897
+ _context35.next = 9;
7898
+ break;
7899
+ case 7:
7900
+ _context35.prev = 7;
7901
+ _context35.t0 = _context35["catch"](0);
7902
+ case 9:
7903
+ case "end":
7904
+ return _context35.stop();
7905
+ }
7906
+ }, _callee35, null, [[0, 7]]);
7907
+ }));
7908
+ function handleDeviceLogging() {
7909
+ return _handleDeviceLogging.apply(this, arguments);
7910
+ }
7911
+ return handleDeviceLogging;
7912
+ }()
6857
7913
  }]);
6858
7914
  return Meeting;
6859
7915
  }(_webexCore.StatelessWebexPlugin);