@webex/plugin-meetings 3.0.0-stream-classes.4 → 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 (239) 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 +69 -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 +40 -11
  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 +42 -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 +2187 -1074
  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 +34 -19
  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 +15 -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 +222 -73
  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 +66 -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 +285 -34
  114. package/dist/types/meeting/locusMediaRequest.d.ts +1 -2
  115. package/dist/types/meeting/muteState.d.ts +2 -8
  116. package/dist/types/meeting/request.d.ts +4 -1
  117. package/dist/types/meeting/util.d.ts +25 -1
  118. package/dist/types/meeting-info/index.d.ts +7 -0
  119. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  120. package/dist/types/meetings/collection.d.ts +9 -0
  121. package/dist/types/meetings/index.d.ts +42 -14
  122. package/dist/types/member/index.d.ts +1 -0
  123. package/dist/types/members/types.d.ts +1 -0
  124. package/dist/types/members/util.d.ts +5 -0
  125. package/dist/types/metrics/constants.d.ts +15 -0
  126. package/dist/types/multistream/mediaRequestManager.d.ts +2 -0
  127. package/dist/types/multistream/remoteMediaGroup.d.ts +2 -0
  128. package/dist/types/multistream/remoteMediaManager.d.ts +25 -1
  129. package/dist/types/multistream/sendSlotManager.d.ts +9 -0
  130. package/dist/types/reachability/clusterReachability.d.ts +109 -0
  131. package/dist/types/reachability/index.d.ts +59 -112
  132. package/dist/types/reachability/request.d.ts +1 -1
  133. package/dist/types/reachability/util.d.ts +8 -0
  134. package/dist/types/reconnection-manager/index.d.ts +10 -0
  135. package/dist/types/roap/index.d.ts +2 -1
  136. package/dist/types/roap/request.d.ts +2 -1
  137. package/dist/types/roap/turnDiscovery.d.ts +21 -4
  138. package/dist/types/rtcMetrics/index.d.ts +15 -1
  139. package/dist/types/statsAnalyzer/index.d.ts +28 -11
  140. package/dist/types/statsAnalyzer/mqaUtil.d.ts +28 -4
  141. package/dist/types/webinar/collection.d.ts +16 -0
  142. package/dist/types/webinar/index.d.ts +5 -0
  143. package/dist/webinar/collection.js +44 -0
  144. package/dist/webinar/collection.js.map +1 -0
  145. package/dist/webinar/index.js +69 -0
  146. package/dist/webinar/index.js.map +1 -0
  147. package/package.json +3 -2
  148. package/src/common/errors/no-meeting-info.ts +24 -0
  149. package/src/common/errors/reclaim-host-role-errors.ts +134 -0
  150. package/src/common/errors/webex-errors.ts +19 -2
  151. package/src/common/logs/request.ts +5 -1
  152. package/src/config.ts +1 -1
  153. package/src/constants.ts +71 -6
  154. package/src/index.ts +5 -0
  155. package/src/interceptors/index.ts +3 -0
  156. package/src/interceptors/locusRetry.ts +67 -0
  157. package/src/interpretation/index.ts +18 -1
  158. package/src/locus-info/index.ts +52 -16
  159. package/src/locus-info/mediaSharesUtils.ts +16 -0
  160. package/src/locus-info/parser.ts +47 -21
  161. package/src/media/index.ts +8 -6
  162. package/src/media/properties.ts +17 -2
  163. package/src/mediaQualityMetrics/config.ts +103 -238
  164. package/src/meeting/in-meeting-actions.ts +8 -0
  165. package/src/meeting/index.ts +1510 -529
  166. package/src/meeting/muteState.ts +34 -20
  167. package/src/meeting/request.ts +19 -1
  168. package/src/meeting/util.ts +97 -0
  169. package/src/meeting-info/index.ts +47 -20
  170. package/src/meeting-info/meeting-info-v2.ts +27 -5
  171. package/src/meeting-info/utilv2.ts +1 -1
  172. package/src/meetings/collection.ts +13 -0
  173. package/src/meetings/index.ts +112 -31
  174. package/src/meetings/util.ts +2 -8
  175. package/src/member/index.ts +9 -0
  176. package/src/member/util.ts +14 -0
  177. package/src/members/index.ts +29 -2
  178. package/src/members/types.ts +1 -0
  179. package/src/members/util.ts +15 -1
  180. package/src/metrics/constants.ts +14 -0
  181. package/src/multistream/mediaRequestManager.ts +4 -1
  182. package/src/multistream/remoteMediaGroup.ts +19 -0
  183. package/src/multistream/remoteMediaManager.ts +141 -18
  184. package/src/multistream/sendSlotManager.ts +29 -0
  185. package/src/reachability/clusterReachability.ts +320 -0
  186. package/src/reachability/index.ts +221 -382
  187. package/src/reachability/request.ts +1 -1
  188. package/src/reachability/util.ts +24 -0
  189. package/src/reconnection-manager/index.ts +87 -83
  190. package/src/roap/index.ts +60 -24
  191. package/src/roap/request.ts +3 -16
  192. package/src/roap/turnDiscovery.ts +112 -39
  193. package/src/rtcMetrics/index.ts +71 -5
  194. package/src/statsAnalyzer/index.ts +430 -427
  195. package/src/statsAnalyzer/mqaUtil.ts +317 -168
  196. package/src/webinar/collection.ts +31 -0
  197. package/src/webinar/index.ts +62 -0
  198. package/test/integration/spec/converged-space-meetings.js +7 -7
  199. package/test/integration/spec/journey.js +86 -104
  200. package/test/integration/spec/space-meeting.js +9 -9
  201. package/test/unit/spec/interceptors/locusRetry.ts +131 -0
  202. package/test/unit/spec/interpretation/index.ts +36 -3
  203. package/test/unit/spec/locus-info/index.js +205 -12
  204. package/test/unit/spec/locus-info/lib/SeqCmp.json +16 -0
  205. package/test/unit/spec/locus-info/mediaSharesUtils.ts +10 -0
  206. package/test/unit/spec/locus-info/parser.js +54 -13
  207. package/test/unit/spec/media/index.ts +20 -4
  208. package/test/unit/spec/media/properties.ts +2 -2
  209. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  210. package/test/unit/spec/meeting/index.js +4027 -1075
  211. package/test/unit/spec/meeting/muteState.js +219 -67
  212. package/test/unit/spec/meeting/request.js +63 -12
  213. package/test/unit/spec/meeting/utils.js +93 -0
  214. package/test/unit/spec/meeting-info/index.js +180 -61
  215. package/test/unit/spec/meeting-info/meetinginfov2.js +196 -53
  216. package/test/unit/spec/meetings/collection.js +12 -0
  217. package/test/unit/spec/meetings/index.js +619 -206
  218. package/test/unit/spec/meetings/utils.js +35 -12
  219. package/test/unit/spec/member/index.js +8 -7
  220. package/test/unit/spec/member/util.js +32 -0
  221. package/test/unit/spec/members/index.js +130 -17
  222. package/test/unit/spec/members/utils.js +26 -0
  223. package/test/unit/spec/multistream/mediaRequestManager.ts +20 -2
  224. package/test/unit/spec/multistream/remoteMediaGroup.ts +80 -1
  225. package/test/unit/spec/multistream/remoteMediaManager.ts +210 -3
  226. package/test/unit/spec/multistream/sendSlotManager.ts +50 -18
  227. package/test/unit/spec/reachability/clusterReachability.ts +279 -0
  228. package/test/unit/spec/reachability/index.ts +505 -135
  229. package/test/unit/spec/reachability/util.ts +40 -0
  230. package/test/unit/spec/reconnection-manager/index.js +74 -17
  231. package/test/unit/spec/roap/index.ts +181 -61
  232. package/test/unit/spec/roap/request.ts +27 -3
  233. package/test/unit/spec/roap/turnDiscovery.ts +362 -101
  234. package/test/unit/spec/rtcMetrics/index.ts +57 -3
  235. package/test/unit/spec/stats-analyzer/index.js +1225 -12
  236. package/test/unit/spec/webinar/collection.ts +13 -0
  237. package/test/unit/spec/webinar/index.ts +60 -0
  238. package/test/utils/integrationTestUtils.js +4 -4
  239. 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);
@@ -472,6 +480,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
472
480
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingNumber", void 0);
473
481
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingState", void 0);
474
482
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "permissionToken", void 0);
483
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "permissionTokenPayload", void 0);
484
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "permissionTokenReceivedLocalTime", void 0);
475
485
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resourceId", void 0);
476
486
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resourceUrl", void 0);
477
487
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selfId", void 0);
@@ -483,7 +493,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
483
493
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "environment", void 0);
484
494
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "namespace", _constants.MEETINGS);
485
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);
486
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);
487
505
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "processRelayEvent", function (e) {
488
506
  switch (e.data.relayType) {
489
507
  case _constants3.REACTION_RELAY_TYPES.REACTION:
@@ -569,7 +587,61 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
569
587
  });
570
588
  }
571
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
+ });
572
643
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setupMediaConnectionListeners", function () {
644
+ _this.setupSdpListeners();
573
645
  _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.ROAP_STARTED, function () {
574
646
  _this.isRoapInProgress = true;
575
647
  });
@@ -583,13 +655,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
583
655
  var LOG_HEADER = "Meeting:index#setupMediaConnectionListeners.ROAP_MESSAGE_TO_SEND --> correlationId=".concat(_this.correlationId);
584
656
  switch (event.roapMessage.messageType) {
585
657
  case 'OK':
586
- // @ts-ignore
587
- _this.webex.internal.newMetrics.submitClientEvent({
588
- name: 'client.media-engine.remote-sdp-received',
589
- options: {
590
- meetingId: _this.id
591
- }
592
- });
593
658
  logRequest(_this.roap.sendRoapOK({
594
659
  seq: event.roapMessage.seq,
595
660
  mediaId: _this.mediaId,
@@ -599,32 +664,26 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
599
664
  });
600
665
  break;
601
666
  case 'OFFER':
602
- // @ts-ignore
603
- _this.webex.internal.newMetrics.submitClientEvent({
604
- name: 'client.media-engine.local-sdp-generated',
605
- options: {
606
- meetingId: _this.id
607
- }
608
- });
609
667
  logRequest(_this.roap.sendRoapMediaRequest({
610
668
  sdp: event.roapMessage.sdp,
611
669
  seq: event.roapMessage.seq,
612
670
  tieBreaker: event.roapMessage.tieBreaker,
613
- meeting: (0, _assertThisInitialized2.default)(_this),
614
- // or can pass meeting ID
615
- 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
+ }
616
678
  }), {
617
679
  logText: "".concat(LOG_HEADER, " Roap Offer")
680
+ }).catch(function () {
681
+ _this.deferSDPAnswer.reject();
682
+ clearTimeout(_this.sdpResponseTimer);
683
+ _this.sdpResponseTimer = undefined;
618
684
  });
619
685
  break;
620
686
  case 'ANSWER':
621
- // @ts-ignore
622
- _this.webex.internal.newMetrics.submitClientEvent({
623
- name: 'client.media-engine.remote-sdp-received',
624
- options: {
625
- meetingId: _this.id
626
- }
627
- });
628
687
  logRequest(_this.roap.sendRoapAnswer({
629
688
  sdp: event.roapMessage.sdp,
630
689
  seq: event.roapMessage.seq,
@@ -674,7 +733,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
674
733
  _loggerProxy.default.logger.log("Meeting:index#setupMediaConnectionListeners --> REMOTE_TRACK_ADDED event received for webrtcMediaConnection: ".concat((0, _stringify.default)(event)));
675
734
  if (event.track) {
676
735
  var mediaTrack = event.track;
677
- var remoteStream = new _mediaHelpers.RemoteStream(_util4.default.createMediaStream([mediaTrack]));
736
+ var remoteStream = new _mediaHelpers.RemoteStream(_util5.default.createMediaStream([mediaTrack]));
678
737
 
679
738
  // eslint-disable-next-line @typescript-eslint/no-shadow
680
739
  var eventType;
@@ -709,61 +768,66 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
709
768
  });
710
769
  _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.CONNECTION_STATE_CHANGED, function (event) {
711
770
  var connectionFailed = function connectionFailed() {
712
- // we know the media connection failed and browser will not attempt to recover it any more
713
- // so reset the timer as it's not needed anymore, we want to reconnect immediately
714
- _this.reconnectionManager.resetReconnectionTimer();
715
- _this.reconnect({
716
- networkDisconnect: true
717
- });
718
- // @ts-ignore
719
- _this.webex.internal.newMetrics.submitClientEvent({
720
- name: 'client.ice.end',
721
- payload: {
722
- canProceed: false,
723
- icePhase: 'IN_MEETING',
724
- errors: [
725
- // @ts-ignore
726
- _this.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode(_internalPluginMetrics.CALL_DIAGNOSTIC_CONFIG.ICE_FAILURE_CLIENT_CODE)]
727
- },
728
- options: {
729
- meetingId: _this.id
730
- }
731
- });
732
- _this.uploadLogs({
733
- file: 'peer-connection-manager/index',
734
- function: 'connectionFailed'
735
- });
736
771
  _metrics.default.sendBehavioralMetric(_constants2.default.CONNECTION_FAILURE, {
737
772
  correlation_id: _this.correlationId,
738
- locus_id: _this.locusId
773
+ locus_id: _this.locusId,
774
+ networkStatus: _this.networkStatus,
775
+ hasMediaConnectionConnectedAtLeastOnce: _this.hasMediaConnectionConnectedAtLeastOnce
739
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
+ }
740
789
  };
741
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;
742
794
  switch (event.state) {
743
795
  case _internalMediaCore.ConnectionState.Connecting:
744
- // @ts-ignore
745
- _this.webex.internal.newMetrics.submitClientEvent({
746
- name: 'client.ice.start',
747
- options: {
748
- meetingId: _this.id
749
- }
750
- });
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
+ }
751
806
  break;
752
807
  case _internalMediaCore.ConnectionState.Connected:
753
- // @ts-ignore
754
- _this.webex.internal.newMetrics.submitClientEvent({
755
- name: 'client.ice.end',
756
- options: {
757
- meetingId: _this.id
758
- }
759
- });
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
+ }
760
822
  _metrics.default.sendBehavioralMetric(_constants2.default.CONNECTION_SUCCESS, {
761
823
  correlation_id: _this.correlationId,
762
- locus_id: _this.locusId
824
+ locus_id: _this.locusId,
825
+ latency: cdl.getICESetupTime()
763
826
  });
764
827
  _this.setNetworkStatus(_constants.NETWORK_STATUS.CONNECTED);
765
828
  _this.reconnectionManager.iceReconnected();
766
829
  _this.statsAnalyzer.startAnalyzer(_this.mediaProperties.webrtcMediaConnection);
830
+ _this.hasMediaConnectionConnectedAtLeastOnce = true;
767
831
  break;
768
832
  case _internalMediaCore.ConnectionState.Disconnected:
769
833
  _this.setNetworkStatus(_constants.NETWORK_STATUS.DISCONNECTED);
@@ -848,7 +912,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
848
912
  _this.webex.internal.newMetrics.submitClientEvent({
849
913
  name: 'client.media.tx.start',
850
914
  payload: {
851
- mediaType: data.type
915
+ mediaType: data.type,
916
+ shareInstanceId: data.type === 'share' ? _this.localShareInstanceId : undefined
852
917
  },
853
918
  options: {
854
919
  meetingId: _this.id
@@ -860,7 +925,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
860
925
  _this.webex.internal.newMetrics.submitClientEvent({
861
926
  name: 'client.media.tx.stop',
862
927
  payload: {
863
- mediaType: data.type
928
+ mediaType: data.type,
929
+ shareInstanceId: data.type === 'share' ? _this.localShareInstanceId : undefined
864
930
  },
865
931
  options: {
866
932
  meetingId: _this.id
@@ -876,7 +942,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
876
942
  _this.webex.internal.newMetrics.submitClientEvent({
877
943
  name: 'client.media.rx.start',
878
944
  payload: {
879
- mediaType: data.type
945
+ mediaType: data.type,
946
+ shareInstanceId: data.type === 'share' ? _this.remoteShareInstanceId : undefined
880
947
  },
881
948
  options: {
882
949
  meetingId: _this.id
@@ -888,7 +955,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
888
955
  _this.webex.internal.newMetrics.submitClientEvent({
889
956
  name: 'client.media.rx.stop',
890
957
  payload: {
891
- mediaType: data.type
958
+ mediaType: data.type,
959
+ shareInstanceId: data.type === 'share' ? _this.remoteShareInstanceId : undefined
892
960
  },
893
961
  options: {
894
962
  meetingId: _this.id
@@ -896,6 +964,35 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
896
964
  });
897
965
  });
898
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
+ }());
899
996
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaNegotiatedEvent", function () {
900
997
  // @ts-ignore - config coming from registerPlugin
901
998
  if (_this.config.experimental.enableMediaNegotiatedEvent) {
@@ -934,67 +1031,74 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
934
1031
  });
935
1032
  }
936
1033
  });
937
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleShareAudioStreamEnded", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
938
- return _regenerator.default.wrap(function _callee$(_context) {
939
- 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) {
940
1037
  case 0:
941
1038
  if (!(_this.wirelessShare && !_this.mediaProperties.shareVideoStream)) {
942
- _context.next = 4;
1039
+ _context2.next = 4;
943
1040
  break;
944
1041
  }
945
1042
  _this.leave({
946
1043
  reason: _constants.MEETING_REMOVED_REASON.USER_ENDED_SHARE_STREAMS
947
1044
  });
948
- _context.next = 12;
1045
+ _context2.next = 12;
949
1046
  break;
950
1047
  case 4:
951
- _context.prev = 4;
952
- _context.next = 7;
1048
+ _context2.prev = 4;
1049
+ _context2.next = 7;
953
1050
  return _this.unpublishStreams([_this.mediaProperties.shareAudioStream]);
954
1051
  case 7:
955
- _context.next = 12;
1052
+ _context2.next = 12;
956
1053
  break;
957
1054
  case 9:
958
- _context.prev = 9;
959
- _context.t0 = _context["catch"](4);
960
- _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);
961
1058
  case 12:
962
1059
  case "end":
963
- return _context.stop();
1060
+ return _context2.stop();
964
1061
  }
965
- }, _callee, null, [[4, 9]]);
1062
+ }, _callee2, null, [[4, 9]]);
966
1063
  })));
967
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleShareVideoStreamEnded", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
968
- return _regenerator.default.wrap(function _callee2$(_context2) {
969
- 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) {
970
1074
  case 0:
971
1075
  if (!(_this.wirelessShare && !_this.mediaProperties.shareAudioStream)) {
972
- _context2.next = 4;
1076
+ _context3.next = 4;
973
1077
  break;
974
1078
  }
975
1079
  _this.leave({
976
1080
  reason: _constants.MEETING_REMOVED_REASON.USER_ENDED_SHARE_STREAMS
977
1081
  });
978
- _context2.next = 12;
1082
+ _context3.next = 12;
979
1083
  break;
980
1084
  case 4:
981
- _context2.prev = 4;
982
- _context2.next = 7;
1085
+ _context3.prev = 4;
1086
+ _context3.next = 7;
983
1087
  return _this.unpublishStreams([_this.mediaProperties.shareVideoStream]);
984
1088
  case 7:
985
- _context2.next = 12;
1089
+ _context3.next = 12;
986
1090
  break;
987
1091
  case 9:
988
- _context2.prev = 9;
989
- _context2.t0 = _context2["catch"](4);
990
- _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);
991
1095
  case 12:
992
1096
  _this.triggerStoppedSharing();
993
1097
  case 13:
994
1098
  case "end":
995
- return _context2.stop();
1099
+ return _context3.stop();
996
1100
  }
997
- }, _callee2, null, [[4, 9]]);
1101
+ }, _callee3, null, [[4, 9]]);
998
1102
  })));
999
1103
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "triggerStoppedSharing", function () {
1000
1104
  if (!_this.mediaProperties.hasLocalShareStream()) {
@@ -1075,18 +1179,20 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1075
1179
  */
1076
1180
  _this.id = _uuid.default.v4();
1077
1181
  /**
1078
- * Correlation ID used for network tracking of meeting
1182
+ * Call state used for metrics
1079
1183
  * @instance
1080
- * @type {String}
1184
+ * @type {CallStateForMetrics}
1081
1185
  * @readonly
1082
1186
  * @public
1083
1187
  * @memberof Meeting
1084
1188
  */
1085
- if (attrs.correlationId) {
1086
- _loggerProxy.default.logger.log("Meetings:index#constructor --> Initializing the meeting object with correlation id from app ".concat(_this.correlationId));
1087
- _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;
1088
1194
  } else {
1089
- _this.correlationId = _this.id;
1195
+ _this.callStateForMetrics.correlationId = _this.id;
1090
1196
  }
1091
1197
  /**
1092
1198
  * @instance
@@ -1162,12 +1268,22 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1162
1268
  _this.annotation = new _annotation.default({
1163
1269
  parent: _this.webex
1164
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
+ });
1165
1281
  /**
1166
1282
  * helper class for managing receive slots (for multistream media connections)
1167
1283
  */
1168
1284
  _this.receiveSlotManager = new _receiveSlotManager.ReceiveSlotManager(function (mediaType) {
1169
- var _this$mediaProperties;
1170
- 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)) {
1171
1287
  return _promise.default.reject(new Error('Webrtc media connection is missing'));
1172
1288
  }
1173
1289
  return _this.mediaProperties.webrtcMediaConnection.createReceiveSlot(mediaType);
@@ -1521,13 +1637,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1521
1637
  */
1522
1638
  _this.networkQualityMonitor = null;
1523
1639
  /**
1640
+ * Indicates network status of the webrtc media connection
1524
1641
  * @instance
1525
1642
  * @type {String}
1526
1643
  * @readonly
1527
1644
  * @public
1528
1645
  * @memberof Meeting
1529
1646
  */
1530
- _this.networkStatus = null;
1647
+ _this.networkStatus = undefined;
1531
1648
  /**
1532
1649
  * Passing only info as we send basic info for meeting added event
1533
1650
  * @instance
@@ -1650,6 +1767,24 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1650
1767
  */
1651
1768
  _this.keepAliveTimerId = null;
1652
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
+
1653
1788
  /**
1654
1789
  * The class that helps to control recording functions: start, stop, pause, resume, etc
1655
1790
  * @instance
@@ -1683,11 +1818,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1683
1818
  * helper class for managing remote streams
1684
1819
  */
1685
1820
  _this.remoteMediaManager = null;
1686
- _this.localAudioStreamMuteStateHandler = function (muted) {
1687
- _this.audio.handleLocalStreamMuteStateChange((0, _assertThisInitialized2.default)(_this), muted);
1821
+ _this.localAudioStreamMuteStateHandler = function () {
1822
+ _this.audio.handleLocalStreamMuteStateChange((0, _assertThisInitialized2.default)(_this));
1688
1823
  };
1689
- _this.localVideoStreamMuteStateHandler = function (muted) {
1690
- _this.video.handleLocalStreamMuteStateChange((0, _assertThisInitialized2.default)(_this), muted);
1824
+ _this.localVideoStreamMuteStateHandler = function () {
1825
+ _this.video.handleLocalStreamMuteStateChange((0, _assertThisInitialized2.default)(_this));
1691
1826
  };
1692
1827
 
1693
1828
  // The handling of output track changes should be done inside
@@ -1699,6 +1834,60 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1699
1834
  _this.updateTranscodedMediaConnection();
1700
1835
  }
1701
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;
1702
1891
  return _this;
1703
1892
  }
1704
1893
 
@@ -1740,133 +1929,320 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1740
1929
  }
1741
1930
 
1742
1931
  /**
1743
- * Fetches meeting information.
1744
- * @param {Object} options
1745
- * @param {String} [options.password] optional
1746
- * @param {String} [options.captchaCode] optional
1747
- * @public
1748
- * @memberof Meeting
1749
- * @returns {Promise}
1932
+ * Getter - Returns callStateForMetrics.correlationId
1933
+ * @returns {string}
1750
1934
  */
1751
1935
  }, {
1752
- 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",
1753
1987
  value: function () {
1754
- var _fetchMeetingInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref4) {
1755
- var _ref4$password, password, _ref4$captchaCode, captchaCode, _ref4$extraParams, extraParams, captchaInfo, info, _err$body, _err$body2;
1756
- return _regenerator.default.wrap(function _callee3$(_context3) {
1757
- 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) {
1758
1991
  case 0:
1759
- _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;
1760
- // when fetch meeting info is called directly by the client, we want to clear out the random timer for sdk to do it
1761
- if (this.fetchMeetingInfoTimeoutId) {
1762
- clearTimeout(this.fetchMeetingInfoTimeoutId);
1763
- this.fetchMeetingInfoTimeoutId = undefined;
1764
- }
1765
- if (!(captchaCode && !this.requiredCaptcha)) {
1766
- _context3.next = 4;
1767
- break;
1768
- }
1769
- 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);
1770
1997
  case 4:
1771
- if (!(password && this.passwordStatus !== _constants.PASSWORD_STATUS.REQUIRED && this.passwordStatus !== _constants.PASSWORD_STATUS.UNKNOWN)) {
1772
- _context3.next = 6;
1773
- break;
1774
- }
1775
- return _context3.abrupt("return", _promise.default.reject(new Error('fetchMeetingInfo() called with password when password was not required')));
1776
- case 6:
1777
- _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;
1778
2056
  captchaInfo = captchaCode ? {
1779
2057
  code: captchaCode,
1780
2058
  id: this.requiredCaptcha.captchaId
1781
2059
  } : null;
1782
- _context3.next = 10;
1783
- 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,
1784
2062
  // @ts-ignore - config coming from registerPlugin
1785
2063
  this.config.installedOrgID, this.locusId, extraParams, {
1786
- meetingId: this.id
2064
+ meetingId: this.id,
2065
+ sendCAevents: sendCAevents
1787
2066
  });
1788
- case 10:
1789
- info = _context3.sent;
1790
- this.parseMeetingInfo(info, this.destination);
1791
- this.meetingInfo = info ? _objectSpread(_objectSpread({}, info.body), {}, {
1792
- meetingLookupUrl: info === null || info === void 0 ? void 0 : info.url
1793
- }) : null;
1794
- this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.NONE;
1795
- this.requiredCaptcha = null;
1796
- if (this.passwordStatus === _constants.PASSWORD_STATUS.REQUIRED || this.passwordStatus === _constants.PASSWORD_STATUS.VERIFIED) {
1797
- this.passwordStatus = _constants.PASSWORD_STATUS.VERIFIED;
1798
- } else {
1799
- this.passwordStatus = _constants.PASSWORD_STATUS.NOT_REQUIRED;
1800
- }
1801
- _triggerProxy.default.trigger(this, {
1802
- file: 'meetings',
1803
- function: 'fetchMeetingInfo'
1804
- }, _constants.EVENT_TRIGGERS.MEETING_INFO_AVAILABLE);
1805
- this.updateMeetingActions();
1806
- return _context3.abrupt("return", _promise.default.resolve());
1807
- case 21:
1808
- _context3.prev = 21;
1809
- _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);
1810
2075
  this.updateMeetingActions();
1811
- if (!(_context3.t0 instanceof _meetingInfoV.MeetingInfoV2PolicyError)) {
1812
- _context3.next = 31;
2076
+ if (!(_context5.t0 instanceof _meetingInfoV.MeetingInfoV2PolicyError)) {
2077
+ _context5.next = 21;
1813
2078
  break;
1814
2079
  }
1815
2080
  this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.POLICY;
1816
- this.meetingInfoFailureCode = _context3.t0.wbxAppApiCode;
1817
- if (_context3.t0.meetingInfo) {
1818
- this.meetingInfo = _context3.t0.meetingInfo;
2081
+ this.meetingInfoFailureCode = _context5.t0.wbxAppApiCode;
2082
+ if (_context5.t0.meetingInfo) {
2083
+ this.meetingInfo = _context5.t0.meetingInfo;
1819
2084
  }
1820
2085
  throw new _permission.default();
1821
- case 31:
1822
- if (!(_context3.t0 instanceof _meetingInfoV.MeetingInfoV2PasswordError)) {
1823
- _context3.next = 43;
2086
+ case 21:
2087
+ if (!(_context5.t0 instanceof _meetingInfoV.MeetingInfoV2PasswordError)) {
2088
+ _context5.next = 33;
1824
2089
  break;
1825
2090
  }
1826
2091
  _loggerProxy.default.logger.info( // @ts-ignore
1827
- "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, ")."));
1828
2093
 
1829
2094
  // when wbxappapi requires password it still populates partial meeting info in the response
1830
- if (_context3.t0.meetingInfo) {
1831
- this.meetingInfo = _context3.t0.meetingInfo;
1832
- this.meetingNumber = _context3.t0.meetingInfo.meetingNumber;
2095
+ if (_context5.t0.meetingInfo) {
2096
+ this.meetingInfo = _context5.t0.meetingInfo;
2097
+ this.meetingNumber = _context5.t0.meetingInfo.meetingNumber;
1833
2098
  }
1834
- this.meetingInfoFailureCode = _context3.t0.wbxAppApiCode;
2099
+ this.meetingInfoFailureCode = _context5.t0.wbxAppApiCode;
1835
2100
  this.passwordStatus = _constants.PASSWORD_STATUS.REQUIRED;
1836
2101
  this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.WRONG_PASSWORD;
1837
2102
  if (!this.requiredCaptcha) {
1838
- _context3.next = 40;
2103
+ _context5.next = 30;
1839
2104
  break;
1840
2105
  }
1841
- _context3.next = 40;
2106
+ _context5.next = 30;
1842
2107
  return this.refreshCaptcha();
1843
- case 40:
2108
+ case 30:
1844
2109
  throw new _passwordError.default();
1845
- case 43:
1846
- if (!(_context3.t0 instanceof _meetingInfoV.MeetingInfoV2CaptchaError)) {
1847
- _context3.next = 52;
2110
+ case 33:
2111
+ if (!(_context5.t0 instanceof _meetingInfoV.MeetingInfoV2CaptchaError)) {
2112
+ _context5.next = 42;
1848
2113
  break;
1849
2114
  }
1850
2115
  _loggerProxy.default.logger.info( // @ts-ignore
1851
- "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, ")."));
1852
2117
  this.meetingInfoFailureReason = this.requiredCaptcha ? _constants.MEETING_INFO_FAILURE_REASON.WRONG_CAPTCHA : _constants.MEETING_INFO_FAILURE_REASON.WRONG_PASSWORD;
1853
- this.meetingInfoFailureCode = _context3.t0.wbxAppApiCode;
1854
- if (_context3.t0.isPasswordRequired) {
2118
+ this.meetingInfoFailureCode = _context5.t0.wbxAppApiCode;
2119
+ if (_context5.t0.isPasswordRequired) {
1855
2120
  this.passwordStatus = _constants.PASSWORD_STATUS.REQUIRED;
1856
2121
  }
1857
- this.requiredCaptcha = _context3.t0.captchaInfo;
2122
+ this.requiredCaptcha = _context5.t0.captchaInfo;
1858
2123
  throw new _captchaError.default();
1859
- case 52:
2124
+ case 42:
1860
2125
  this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.OTHER;
1861
- throw _context3.t0;
1862
- case 54:
2126
+ throw _context5.t0;
2127
+ case 44:
1863
2128
  case "end":
1864
- return _context3.stop();
2129
+ return _context5.stop();
1865
2130
  }
1866
- }, _callee3, this, [[6, 21]]);
2131
+ }, _callee5, this, [[1, 11]]);
1867
2132
  }));
1868
- function fetchMeetingInfo(_x) {
1869
- 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);
1870
2246
  }
1871
2247
  return fetchMeetingInfo;
1872
2248
  }()
@@ -1875,6 +2251,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1875
2251
  * password and captcha code were correct or not.
1876
2252
  * @param {String} password - this can be either a password or a host key, can be undefined if only captcha was required
1877
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
1878
2255
  * @public
1879
2256
  * @memberof Meeting
1880
2257
  * @returns {Promise<{isPasswordValid: boolean, requiredCaptcha: boolean, failureReason: MEETING_INFO_FAILURE_REASON}>}
@@ -1883,9 +2260,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1883
2260
  key: "verifyPassword",
1884
2261
  value: function verifyPassword(password, captchaCode) {
1885
2262
  var _this2 = this;
2263
+ var sendCAevents = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1886
2264
  return this.fetchMeetingInfo({
1887
2265
  password: password,
1888
- captchaCode: captchaCode
2266
+ captchaCode: captchaCode,
2267
+ sendCAevents: sendCAevents
1889
2268
  }).then(function () {
1890
2269
  _metrics.default.sendBehavioralMetric(_constants2.default.VERIFY_PASSWORD_SUCCESS);
1891
2270
  return {
@@ -2155,7 +2534,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2155
2534
 
2156
2535
  /**
2157
2536
  * sets the network status on meeting object
2158
- * @param {String} networkStatus
2537
+ * @param {NETWORK_STATUS} networkStatus
2159
2538
  * @private
2160
2539
  * @returns {undefined}
2161
2540
  * @memberof Meeting
@@ -2309,10 +2688,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2309
2688
  key: "setupLocusControlsListener",
2310
2689
  value: function setupLocusControlsListener() {
2311
2690
  var _this13 = this;
2312
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED, function (_ref5) {
2313
- var state = _ref5.state,
2314
- modifiedBy = _ref5.modifiedBy,
2315
- 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;
2316
2695
  var event;
2317
2696
  switch (state) {
2318
2697
  case _constants.RECORDING_STATE.RECORDING:
@@ -2343,8 +2722,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2343
2722
  function: 'setupLocusControlsListener'
2344
2723
  }, event, _this13.recording);
2345
2724
  });
2346
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_CONTAINER_UPDATED, function (_ref6) {
2347
- var meetingContainerUrl = _ref6.meetingContainerUrl;
2725
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_CONTAINER_UPDATED, function (_ref10) {
2726
+ var meetingContainerUrl = _ref10.meetingContainerUrl;
2348
2727
  _triggerProxy.default.trigger(_this13, {
2349
2728
  file: 'meeting/index',
2350
2729
  function: 'setupLocusControlsListener'
@@ -2352,9 +2731,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2352
2731
  meetingContainerUrl: meetingContainerUrl
2353
2732
  });
2354
2733
  });
2355
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_TRANSCRIBE_UPDATED, function (_ref7) {
2356
- var caption = _ref7.caption,
2357
- 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;
2358
2737
  // @ts-ignore - config coming from registerPlugin
2359
2738
  if (transcribing && _this13.transcription && _this13.config.receiveTranscription) {
2360
2739
  _this13.receiveTranscription();
@@ -2368,34 +2747,24 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2368
2747
  });
2369
2748
  }
2370
2749
  });
2371
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_BREAKOUT_UPDATED, function (_ref8) {
2372
- var breakout = _ref8.breakout;
2750
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_BREAKOUT_UPDATED, function (_ref12) {
2751
+ var breakout = _ref12.breakout;
2373
2752
  _this13.breakouts.updateBreakout(breakout);
2374
2753
  _triggerProxy.default.trigger(_this13, {
2375
2754
  file: 'meeting/index',
2376
2755
  function: 'setupLocusControlsListener'
2377
2756
  }, _constants.EVENT_TRIGGERS.MEETING_BREAKOUTS_UPDATE);
2378
2757
  });
2379
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_INTERPRETATION_UPDATED, function (_ref9) {
2380
- var interpretation = _ref9.interpretation;
2758
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_INTERPRETATION_UPDATED, function (_ref13) {
2759
+ var interpretation = _ref13.interpretation;
2381
2760
  _this13.simultaneousInterpretation.updateInterpretation(interpretation);
2382
2761
  _triggerProxy.default.trigger(_this13, {
2383
2762
  file: 'meeting/index',
2384
2763
  function: 'setupLocusControlsListener'
2385
2764
  }, _constants.EVENT_TRIGGERS.MEETING_INTERPRETATION_UPDATE);
2386
2765
  });
2387
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_JOIN_BREAKOUT_FROM_MAIN, function (_ref10) {
2388
- var mainLocusUrl = _ref10.mainLocusUrl;
2389
- _this13.meetingRequest.getLocusStatusByUrl(mainLocusUrl).catch(function (error) {
2390
- // clear main session cache when attendee join into breakout and forbidden to get locus from main locus url,
2391
- // which means main session is not active for the attendee
2392
- if ((error === null || error === void 0 ? void 0 : error.statusCode) === 403) {
2393
- _this13.locusInfo.clearMainSessionLocusCache();
2394
- }
2395
- });
2396
- });
2397
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_ENTRY_EXIT_TONE_UPDATED, function (_ref11) {
2398
- var entryExitTone = _ref11.entryExitTone;
2766
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_ENTRY_EXIT_TONE_UPDATED, function (_ref14) {
2767
+ var entryExitTone = _ref14.entryExitTone;
2399
2768
  _triggerProxy.default.trigger(_this13, {
2400
2769
  file: 'meeting/index',
2401
2770
  function: 'setupLocusControlsListener'
@@ -2403,8 +2772,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2403
2772
  entryExitTone: entryExitTone
2404
2773
  });
2405
2774
  });
2406
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MUTE_ON_ENTRY_CHANGED, function (_ref12) {
2407
- var state = _ref12.state;
2775
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MUTE_ON_ENTRY_CHANGED, function (_ref15) {
2776
+ var state = _ref15.state;
2408
2777
  _triggerProxy.default.trigger(_this13, {
2409
2778
  file: 'meeting/index',
2410
2779
  function: 'setupLocusControlsListener'
@@ -2412,8 +2781,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2412
2781
  state: state
2413
2782
  });
2414
2783
  });
2415
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_SHARE_CONTROL_CHANGED, function (_ref13) {
2416
- var state = _ref13.state;
2784
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_SHARE_CONTROL_CHANGED, function (_ref16) {
2785
+ var state = _ref16.state;
2417
2786
  _triggerProxy.default.trigger(_this13, {
2418
2787
  file: 'meeting/index',
2419
2788
  function: 'setupLocusControlsListener'
@@ -2421,8 +2790,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2421
2790
  state: state
2422
2791
  });
2423
2792
  });
2424
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_DISALLOW_UNMUTE_CHANGED, function (_ref14) {
2425
- var state = _ref14.state;
2793
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_DISALLOW_UNMUTE_CHANGED, function (_ref17) {
2794
+ var state = _ref17.state;
2426
2795
  _triggerProxy.default.trigger(_this13, {
2427
2796
  file: 'meeting/index',
2428
2797
  function: 'setupLocusControlsListener'
@@ -2430,8 +2799,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2430
2799
  state: state
2431
2800
  });
2432
2801
  });
2433
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_REACTIONS_CHANGED, function (_ref15) {
2434
- var state = _ref15.state;
2802
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_REACTIONS_CHANGED, function (_ref18) {
2803
+ var state = _ref18.state;
2435
2804
  _triggerProxy.default.trigger(_this13, {
2436
2805
  file: 'meeting/index',
2437
2806
  function: 'setupLocusControlsListener'
@@ -2439,8 +2808,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2439
2808
  state: state
2440
2809
  });
2441
2810
  });
2442
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_VIEW_THE_PARTICIPANTS_LIST_CHANGED, function (_ref16) {
2443
- var state = _ref16.state;
2811
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_VIEW_THE_PARTICIPANTS_LIST_CHANGED, function (_ref19) {
2812
+ var state = _ref19.state;
2444
2813
  _triggerProxy.default.trigger(_this13, {
2445
2814
  file: 'meeting/index',
2446
2815
  function: 'setupLocusControlsListener'
@@ -2448,8 +2817,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2448
2817
  state: state
2449
2818
  });
2450
2819
  });
2451
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_RAISE_HAND_CHANGED, function (_ref17) {
2452
- var state = _ref17.state;
2820
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_RAISE_HAND_CHANGED, function (_ref20) {
2821
+ var state = _ref20.state;
2453
2822
  _triggerProxy.default.trigger(_this13, {
2454
2823
  file: 'meeting/index',
2455
2824
  function: 'setupLocusControlsListener'
@@ -2457,8 +2826,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2457
2826
  state: state
2458
2827
  });
2459
2828
  });
2460
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_VIDEO_CHANGED, function (_ref18) {
2461
- var state = _ref18.state;
2829
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_VIDEO_CHANGED, function (_ref21) {
2830
+ var state = _ref21.state;
2462
2831
  _triggerProxy.default.trigger(_this13, {
2463
2832
  file: 'meeting/index',
2464
2833
  function: 'setupLocusControlsListener'
@@ -2504,21 +2873,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2504
2873
  var _this14 = this;
2505
2874
  // Will get triggered on local and remote share
2506
2875
  this.locusInfo.on(_constants.EVENTS.LOCUS_INFO_UPDATE_MEDIA_SHARES, /*#__PURE__*/function () {
2507
- 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) {
2508
2877
  var _payload$previous, _payload$previous2;
2509
2878
  var _payload$current, contentShare, whiteboardShare, previousContentShare, previousWhiteboardShare, newShareStatus, oldShareStatus, sendStartedSharingRemote, _this14$mediaProperti;
2510
- return _regenerator.default.wrap(function _callee4$(_context4) {
2511
- while (1) switch (_context4.prev = _context4.next) {
2879
+ return _regenerator.default.wrap(function _callee8$(_context8) {
2880
+ while (1) switch (_context8.prev = _context8.next) {
2512
2881
  case 0:
2513
2882
  _payload$current = payload.current, contentShare = _payload$current.content, whiteboardShare = _payload$current.whiteboard;
2514
2883
  previousContentShare = (_payload$previous = payload.previous) === null || _payload$previous === void 0 ? void 0 : _payload$previous.content;
2515
2884
  previousWhiteboardShare = (_payload$previous2 = payload.previous) === null || _payload$previous2 === void 0 ? void 0 : _payload$previous2.whiteboard;
2516
2885
  _this14.triggerAnnotationInfoEvent(contentShare, previousContentShare);
2517
- 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))) {
2518
- _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;
2519
2888
  break;
2520
2889
  }
2521
- return _context4.abrupt("return");
2890
+ return _context8.abrupt("return");
2522
2891
  case 6:
2523
2892
  newShareStatus = _this14.shareStatus; // REMOTE - check if remote started sharing
2524
2893
  if (_this14.selfId !== contentShare.beneficiaryId && contentShare.disposition === _constants.FLOOR_ACTION.GRANTED) {
@@ -2526,10 +2895,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2526
2895
  newShareStatus = _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE;
2527
2896
  }
2528
2897
  // LOCAL - check if we started sharing content
2529
- 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) {
2530
2899
  // CONTENT - sharing content local
2531
2900
  newShareStatus = _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE;
2532
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
+ }
2533
2907
  // If we did not hit the cases above, no one is sharng content, so we check if we are sharing whiteboard
2534
2908
  // There is no concept of local/remote share for whiteboard
2535
2909
  // It does not matter who requested to share the whiteboard, everyone gets the same view
@@ -2542,22 +2916,22 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2542
2916
  newShareStatus = _constants.SHARE_STATUS.NO_SHARE;
2543
2917
  }
2544
2918
  if (!(newShareStatus !== _this14.shareStatus)) {
2545
- _context4.next = 45;
2919
+ _context8.next = 45;
2546
2920
  break;
2547
2921
  }
2548
2922
  oldShareStatus = _this14.shareStatus; // update our state before we send out any notifications
2549
2923
  _this14.shareStatus = newShareStatus;
2550
2924
 
2551
2925
  // send out "stop" notifications for the old state
2552
- _context4.t0 = oldShareStatus;
2553
- _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;
2554
2928
  break;
2555
2929
  case 14:
2556
2930
  _triggerProxy.default.trigger(_this14, {
2557
2931
  file: 'meetings/index',
2558
2932
  function: 'remoteShare'
2559
2933
  }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_REMOTE);
2560
- return _context4.abrupt("break", 22);
2934
+ return _context8.abrupt("break", 22);
2561
2935
  case 16:
2562
2936
  _triggerProxy.default.trigger(_this14, {
2563
2937
  file: 'meeting/index',
@@ -2565,46 +2939,47 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2565
2939
  }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_LOCAL, {
2566
2940
  reason: _constants.SHARE_STOPPED_REASON.SELF_STOPPED
2567
2941
  });
2568
- return _context4.abrupt("break", 22);
2942
+ return _context8.abrupt("break", 22);
2569
2943
  case 18:
2570
2944
  _triggerProxy.default.trigger(_this14, {
2571
2945
  file: 'meeting/index',
2572
2946
  function: 'stopWhiteboardShare'
2573
2947
  }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_WHITEBOARD);
2574
- return _context4.abrupt("break", 22);
2948
+ return _context8.abrupt("break", 22);
2575
2949
  case 20:
2576
- return _context4.abrupt("break", 22);
2950
+ return _context8.abrupt("break", 22);
2577
2951
  case 21:
2578
- return _context4.abrupt("break", 22);
2952
+ return _context8.abrupt("break", 22);
2579
2953
  case 22:
2580
- _context4.t1 = newShareStatus;
2581
- _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;
2582
2956
  break;
2583
2957
  case 25:
2584
2958
  sendStartedSharingRemote = function sendStartedSharingRemote() {
2959
+ _this14.remoteShareInstanceId = contentShare.shareInstanceId;
2585
2960
  _triggerProxy.default.trigger(_this14, {
2586
2961
  file: 'meetings/index',
2587
2962
  function: 'remoteShare'
2588
2963
  }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_REMOTE, {
2589
2964
  memberId: contentShare.beneficiaryId,
2590
2965
  url: contentShare.url,
2591
- shareInstanceId: contentShare.shareInstanceId,
2966
+ shareInstanceId: _this14.remoteShareInstanceId,
2592
2967
  annotationInfo: contentShare.annotation
2593
2968
  });
2594
2969
  };
2595
- _context4.prev = 26;
2970
+ _context8.prev = 26;
2596
2971
  if (!((_this14$mediaProperti = _this14.mediaProperties.mediaDirection) !== null && _this14$mediaProperti !== void 0 && _this14$mediaProperti.sendShare && oldShareStatus === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE)) {
2597
- _context4.next = 30;
2972
+ _context8.next = 30;
2598
2973
  break;
2599
2974
  }
2600
- _context4.next = 30;
2975
+ _context8.next = 30;
2601
2976
  return _this14.unpublishStreams([_this14.mediaProperties.shareVideoStream, _this14.mediaProperties.shareAudioStream]);
2602
2977
  case 30:
2603
- _context4.prev = 30;
2978
+ _context8.prev = 30;
2604
2979
  sendStartedSharingRemote();
2605
- return _context4.finish(30);
2980
+ return _context8.finish(30);
2606
2981
  case 33:
2607
- return _context4.abrupt("break", 42);
2982
+ return _context8.abrupt("break", 42);
2608
2983
  case 34:
2609
2984
  _triggerProxy.default.trigger(_this14, {
2610
2985
  file: 'meeting/index',
@@ -2614,13 +2989,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2614
2989
  _this14.webex.internal.newMetrics.submitClientEvent({
2615
2990
  name: 'client.share.floor-granted.local',
2616
2991
  payload: {
2617
- mediaType: 'share'
2992
+ mediaType: 'share',
2993
+ shareInstanceId: _this14.localShareInstanceId
2618
2994
  },
2619
2995
  options: {
2620
2996
  meetingId: _this14.id
2621
2997
  }
2622
2998
  });
2623
- return _context4.abrupt("break", 42);
2999
+ return _context8.abrupt("break", 42);
2624
3000
  case 37:
2625
3001
  _triggerProxy.default.trigger(_this14, {
2626
3002
  file: 'meeting/index',
@@ -2639,26 +3015,27 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2639
3015
  meetingId: _this14.id
2640
3016
  }
2641
3017
  });
2642
- return _context4.abrupt("break", 42);
3018
+ return _context8.abrupt("break", 42);
2643
3019
  case 40:
2644
- return _context4.abrupt("break", 42);
3020
+ return _context8.abrupt("break", 42);
2645
3021
  case 41:
2646
- return _context4.abrupt("break", 42);
3022
+ return _context8.abrupt("break", 42);
2647
3023
  case 42:
2648
3024
  _this14.members.locusMediaSharesUpdate(payload);
2649
- _context4.next = 46;
3025
+ _context8.next = 46;
2650
3026
  break;
2651
3027
  case 45:
2652
3028
  if (newShareStatus === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE) {
2653
3029
  // if we got here, then some remote participant has stolen
2654
3030
  // the presentation from another remote participant
3031
+ _this14.remoteShareInstanceId = contentShare.shareInstanceId;
2655
3032
  _triggerProxy.default.trigger(_this14, {
2656
3033
  file: 'meetings/index',
2657
3034
  function: 'remoteShare'
2658
3035
  }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_REMOTE, {
2659
3036
  memberId: contentShare.beneficiaryId,
2660
3037
  url: contentShare.url,
2661
- shareInstanceId: contentShare.shareInstanceId,
3038
+ shareInstanceId: _this14.remoteShareInstanceId,
2662
3039
  annotationInfo: contentShare.annotation
2663
3040
  });
2664
3041
  _this14.members.locusMediaSharesUpdate(payload);
@@ -2686,12 +3063,12 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2686
3063
  }
2687
3064
  case 46:
2688
3065
  case "end":
2689
- return _context4.stop();
3066
+ return _context8.stop();
2690
3067
  }
2691
- }, _callee4, null, [[26,, 30, 33]]);
3068
+ }, _callee8, null, [[26,, 30, 33]]);
2692
3069
  }));
2693
- return function (_x2) {
2694
- return _ref19.apply(this, arguments);
3070
+ return function (_x8) {
3071
+ return _ref22.apply(this, arguments);
2695
3072
  };
2696
3073
  }());
2697
3074
  }
@@ -2717,6 +3094,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2717
3094
  _this15.locusId = (_this15$locusUrl = _this15.locusUrl) === null || _this15$locusUrl === void 0 ? void 0 : _this15$locusUrl.split('/').pop();
2718
3095
  _this15.recordingController.setLocusUrl(_this15.locusUrl);
2719
3096
  _this15.controlsOptionsManager.setLocusUrl(_this15.locusUrl);
3097
+ _this15.webinar.locusUrlUpdate(payload);
2720
3098
  _triggerProxy.default.trigger(_this15, {
2721
3099
  file: 'meeting/index',
2722
3100
  function: 'setUpLocusSelfListener'
@@ -2740,12 +3118,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2740
3118
  value: function setUpLocusServicesListener() {
2741
3119
  var _this16 = this;
2742
3120
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.LINKS_SERVICES, function (payload) {
2743
- 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;
2744
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);
2745
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);
2746
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);
2747
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);
2748
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);
2749
3129
  });
2750
3130
  }
2751
3131
 
@@ -2779,12 +3159,20 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2779
3159
  });
2780
3160
  }
2781
3161
  });
2782
- 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;
2783
3164
  _this17.updateMeetingActions();
2784
3165
  _this17.recordingController.setDisplayHints(_this17.userDisplayHints);
2785
3166
  _this17.recordingController.setUserPolicy(_this17.selfUserPolicies);
2786
3167
  _this17.controlsOptionsManager.setDisplayHints(_this17.userDisplayHints);
2787
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
+ }
2788
3176
  });
2789
3177
  }
2790
3178
 
@@ -2970,17 +3358,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2970
3358
  }, _constants.EVENT_TRIGGERS.MEETING_BREAKOUTS_UPDATE);
2971
3359
  });
2972
3360
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_MEETING_INTERPRETATION_CHANGED, function (payload) {
2973
- _this19.simultaneousInterpretation.updateSelfInterpretation(payload);
3361
+ var targetChanged = _this19.simultaneousInterpretation.updateSelfInterpretation(payload);
2974
3362
  _triggerProxy.default.trigger(_this19, {
2975
3363
  file: 'meeting/index',
2976
3364
  function: 'setUpLocusInfoSelfListener'
2977
3365
  }, _constants.EVENT_TRIGGERS.MEETING_INTERPRETATION_UPDATE);
3366
+ if (targetChanged && _this19.mediaProperties.audioStream) {
3367
+ _this19.setSendNamedMediaGroup(_internalMediaCore.MediaType.AudioMain);
3368
+ }
2978
3369
  });
2979
3370
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_ROLES_CHANGED, function (payload) {
2980
- var _payload$newRoles, _payload$newRoles2, _payload$newRoles3;
3371
+ var _payload$newRoles, _payload$newRoles2, _payload$newRoles3, _payload$newRoles4;
2981
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));
2982
3373
  _this19.breakouts.updateCanManageBreakouts(isModeratorOrCohost);
2983
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));
2984
3376
  _triggerProxy.default.trigger(_this19, {
2985
3377
  file: 'meeting/index',
2986
3378
  function: 'setUpLocusInfoSelfListener'
@@ -3022,48 +3414,48 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3022
3414
  }
3023
3415
  });
3024
3416
  this.locusInfo.on(_constants.EVENTS.DESTROY_MEETING, /*#__PURE__*/function () {
3025
- var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(payload) {
3026
- return _regenerator.default.wrap(function _callee5$(_context5) {
3027
- 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) {
3028
3420
  case 0:
3029
3421
  if (!_this20.wirelessShare) {
3030
- _context5.next = 7;
3422
+ _context9.next = 7;
3031
3423
  break;
3032
3424
  }
3033
3425
  if (!_this20.mediaProperties.shareVideoStream) {
3034
- _context5.next = 4;
3426
+ _context9.next = 4;
3035
3427
  break;
3036
3428
  }
3037
- _context5.next = 4;
3429
+ _context9.next = 4;
3038
3430
  return _this20.setLocalShareVideoStream(undefined);
3039
3431
  case 4:
3040
3432
  if (!_this20.mediaProperties.shareAudioStream) {
3041
- _context5.next = 7;
3433
+ _context9.next = 7;
3042
3434
  break;
3043
3435
  }
3044
- _context5.next = 7;
3436
+ _context9.next = 7;
3045
3437
  return _this20.setLocalShareAudioStream(undefined);
3046
3438
  case 7:
3047
3439
  if (!payload.shouldLeave) {
3048
- _context5.next = 19;
3440
+ _context9.next = 19;
3049
3441
  break;
3050
3442
  }
3051
- _context5.prev = 8;
3052
- _context5.next = 11;
3443
+ _context9.prev = 8;
3444
+ _context9.next = 11;
3053
3445
  return _this20.leave({
3054
3446
  reason: payload.reason
3055
3447
  });
3056
3448
  case 11:
3057
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.');
3058
- _context5.next = 17;
3450
+ _context9.next = 17;
3059
3451
  break;
3060
3452
  case 14:
3061
- _context5.prev = 14;
3062
- _context5.t0 = _context5["catch"](8);
3453
+ _context9.prev = 14;
3454
+ _context9.t0 = _context9["catch"](8);
3063
3455
  // @ts-ignore
3064
- _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));
3065
3457
  case 17:
3066
- _context5.next = 22;
3458
+ _context9.next = 22;
3067
3459
  break;
3068
3460
  case 19:
3069
3461
  _loggerProxy.default.logger.info('Meeting:index#setUpLocusInfoMeetingListener --> MEETING_REMOVED_REASON', payload.reason);
@@ -3077,12 +3469,12 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3077
3469
  });
3078
3470
  case 22:
3079
3471
  case "end":
3080
- return _context5.stop();
3472
+ return _context9.stop();
3081
3473
  }
3082
- }, _callee5, null, [[8, 14]]);
3474
+ }, _callee9, null, [[8, 14]]);
3083
3475
  }));
3084
- return function (_x3) {
3085
- return _ref20.apply(this, arguments);
3476
+ return function (_x9) {
3477
+ return _ref24.apply(this, arguments);
3086
3478
  };
3087
3479
  }());
3088
3480
  }
@@ -3231,12 +3623,19 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3231
3623
  /**
3232
3624
  * Sets the meeting info on the class instance
3233
3625
  * @param {Object} meetingInfo
3234
- * @param {Object} meetingInfo.body
3235
- * @param {String} meetingInfo.body.conversationUrl
3236
- * @param {String} meetingInfo.body.locusUrl
3237
- * @param {String} meetingInfo.body.sipUri
3238
- * @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
3239
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
3240
3639
  * @returns {undefined}
3241
3640
  * @private
3242
3641
  * @memberof Meeting
@@ -3245,7 +3644,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3245
3644
  key: "parseMeetingInfo",
3246
3645
  value: function parseMeetingInfo(meetingInfo) {
3247
3646
  var destination = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
3248
- var webexMeetingInfo = meetingInfo === null || meetingInfo === void 0 ? void 0 : meetingInfo.body;
3647
+ var errors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
3249
3648
  // We try to use as much info from Locus meeting object, stored in destination
3250
3649
 
3251
3650
  var locusMeetingObject;
@@ -3254,27 +3653,28 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3254
3653
  }
3255
3654
 
3256
3655
  // MeetingInfo will be undefined for 1:1 calls
3257
- 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)) {
3258
3657
  var _locusMeetingObject, _locusMeetingObject2, _locusMeetingObject3, _locusMeetingObject4, _locusMeetingObject6, _locusMeetingObject7;
3259
- this.conversationUrl = ((_locusMeetingObject = locusMeetingObject) === null || _locusMeetingObject === void 0 ? void 0 : _locusMeetingObject.conversationUrl) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.conversationUrl) || this.conversationUrl;
3260
- 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;
3261
3660
  // @ts-ignore - config coming from registerPlugin
3262
3661
  this.setSipUri(
3263
3662
  // @ts-ignore
3264
- 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);
3265
3664
  // @ts-ignore - config coming from registerPlugin
3266
3665
  if (this.config.experimental.enableUnifiedMeetings) {
3267
3666
  var _locusMeetingObject5;
3268
- this.meetingNumber = ((_locusMeetingObject5 = locusMeetingObject) === null || _locusMeetingObject5 === void 0 ? void 0 : _locusMeetingObject5.info.webExMeetingId) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.meetingNumber);
3269
- 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;
3270
3669
  }
3271
- 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;
3272
- this.permissionToken = webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.permissionToken;
3273
- this.setSelfUserPolicies(this.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);
3673
+ this.setSelfUserPolicies();
3274
3674
  // Need to populate environment when sending CA event
3275
- 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);
3276
3676
  }
3277
- _util.default.parseInterpretationInfo(this, webexMeetingInfo);
3677
+ _util.default.parseInterpretationInfo(this, meetingInfo);
3278
3678
  }
3279
3679
 
3280
3680
  /**
@@ -3306,25 +3706,29 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3306
3706
  }, {
3307
3707
  key: "updateMeetingActions",
3308
3708
  value: function updateMeetingActions() {
3309
- 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;
3310
3710
  var changed = false;
3311
3711
  changed = this.inMeetingActions.set({
3312
- 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({
3313
3713
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_VOIP],
3314
3714
  policies: this.selfUserPolicies
3315
3715
  }) || !this.arePolicyRestrictionsSupported(),
3316
- canDoVideo: _util3.default.hasPolicies({
3716
+ canDoVideo: _util4.default.hasPolicies({
3317
3717
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_VIDEO],
3318
3718
  policies: this.selfUserPolicies
3319
- }) && !!((_this$meetingInfo2 = this.meetingInfo) !== null && _this$meetingInfo2 !== void 0 && _this$meetingInfo2.video) || !this.arePolicyRestrictionsSupported(),
3320
- supportHDV: _util3.default.hasPolicies({
3719
+ }) && !!((_this$meetingInfo3 = this.meetingInfo) !== null && _this$meetingInfo3 !== void 0 && _this$meetingInfo3.video) || !this.arePolicyRestrictionsSupported(),
3720
+ supportHDV: _util4.default.hasPolicies({
3321
3721
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_HDV],
3322
3722
  policies: this.selfUserPolicies
3323
- }) && ((_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(),
3324
- 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({
3325
3729
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_HQV],
3326
3730
  policies: this.selfUserPolicies
3327
- }) && ((_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()
3328
3732
  });
3329
3733
  if (this.userDisplayHints !== undefined) {
3330
3734
  changed = this.inMeetingActions.set({
@@ -3333,16 +3737,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3333
3737
  canLock: _util.default.canUserLock(this.userDisplayHints),
3334
3738
  canUnlock: _util.default.canUserUnlock(this.userDisplayHints),
3335
3739
  canShareWhiteBoard: _util.default.canShareWhiteBoard(this.userDisplayHints),
3336
- canSetDisallowUnmute: _util3.default.canSetDisallowUnmute(this.userDisplayHints),
3337
- canUnsetDisallowUnmute: _util3.default.canUnsetDisallowUnmute(this.userDisplayHints),
3338
- canSetMuteOnEntry: _util3.default.canSetMuteOnEntry(this.userDisplayHints),
3339
- canUnsetMuteOnEntry: _util3.default.canUnsetMuteOnEntry(this.userDisplayHints),
3340
- canSetMuted: _util3.default.canSetMuted(this.userDisplayHints),
3341
- canUnsetMuted: _util3.default.canUnsetMuted(this.userDisplayHints),
3342
- canStartRecording: _util2.default.canUserStart(this.userDisplayHints, this.selfUserPolicies),
3343
- canStopRecording: _util2.default.canUserStop(this.userDisplayHints, this.selfUserPolicies),
3344
- canPauseRecording: _util2.default.canUserPause(this.userDisplayHints, this.selfUserPolicies),
3345
- 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),
3346
3750
  canRaiseHand: _util.default.canUserRaiseHand(this.userDisplayHints),
3347
3751
  canLowerAllHands: _util.default.canUserLowerAllHands(this.userDisplayHints),
3348
3752
  canLowerSomeoneElsesHand: _util.default.canUserLowerSomeoneElsesHand(this.userDisplayHints),
@@ -3365,111 +3769,115 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3365
3769
  canUserAskForHelp: _util.default.canUserAskForHelp(this.userDisplayHints),
3366
3770
  canUserRenameSelfAndObserved: _util.default.canUserRenameSelfAndObserved(this.userDisplayHints),
3367
3771
  canUserRenameOthers: _util.default.canUserRenameOthers(this.userDisplayHints),
3368
- canMuteAll: _util3.default.hasHints({
3772
+ canMuteAll: _util4.default.hasHints({
3369
3773
  requiredHints: [_constants.DISPLAY_HINTS.MUTE_ALL],
3370
3774
  displayHints: this.userDisplayHints
3371
3775
  }),
3372
- canUnmuteAll: _util3.default.hasHints({
3776
+ canUnmuteAll: _util4.default.hasHints({
3373
3777
  requiredHints: [_constants.DISPLAY_HINTS.UNMUTE_ALL],
3374
3778
  displayHints: this.userDisplayHints
3375
3779
  }),
3376
- canEnableHardMute: _util3.default.hasHints({
3780
+ canEnableHardMute: _util4.default.hasHints({
3377
3781
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_HARD_MUTE],
3378
3782
  displayHints: this.userDisplayHints
3379
3783
  }),
3380
- canDisableHardMute: _util3.default.hasHints({
3784
+ canDisableHardMute: _util4.default.hasHints({
3381
3785
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_HARD_MUTE],
3382
3786
  displayHints: this.userDisplayHints
3383
3787
  }),
3384
- canEnableMuteOnEntry: _util3.default.hasHints({
3788
+ canEnableMuteOnEntry: _util4.default.hasHints({
3385
3789
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_MUTE_ON_ENTRY],
3386
3790
  displayHints: this.userDisplayHints
3387
3791
  }),
3388
- canDisableMuteOnEntry: _util3.default.hasHints({
3792
+ canDisableMuteOnEntry: _util4.default.hasHints({
3389
3793
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_MUTE_ON_ENTRY],
3390
3794
  displayHints: this.userDisplayHints
3391
3795
  }),
3392
- canEnableReactions: _util3.default.hasHints({
3796
+ canEnableReactions: _util4.default.hasHints({
3393
3797
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_REACTIONS],
3394
3798
  displayHints: this.userDisplayHints
3395
3799
  }),
3396
- canDisableReactions: _util3.default.hasHints({
3800
+ canDisableReactions: _util4.default.hasHints({
3397
3801
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_REACTIONS],
3398
3802
  displayHints: this.userDisplayHints
3399
3803
  }),
3400
- canEnableReactionDisplayNames: _util3.default.hasHints({
3804
+ canEnableReactionDisplayNames: _util4.default.hasHints({
3401
3805
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_SHOW_DISPLAY_NAME],
3402
3806
  displayHints: this.userDisplayHints
3403
3807
  }),
3404
- canDisableReactionDisplayNames: _util3.default.hasHints({
3808
+ canDisableReactionDisplayNames: _util4.default.hasHints({
3405
3809
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_SHOW_DISPLAY_NAME],
3406
3810
  displayHints: this.userDisplayHints
3407
3811
  }),
3408
- canUpdateShareControl: _util3.default.hasHints({
3812
+ canUpdateShareControl: _util4.default.hasHints({
3409
3813
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_CONTROL],
3410
3814
  displayHints: this.userDisplayHints
3411
3815
  }),
3412
- canEnableViewTheParticipantsList: _util3.default.hasHints({
3816
+ canEnableViewTheParticipantsList: _util4.default.hasHints({
3413
3817
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_VIEW_THE_PARTICIPANT_LIST],
3414
3818
  displayHints: this.userDisplayHints
3415
3819
  }),
3416
- canDisableViewTheParticipantsList: _util3.default.hasHints({
3820
+ canDisableViewTheParticipantsList: _util4.default.hasHints({
3417
3821
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_VIEW_THE_PARTICIPANT_LIST],
3418
3822
  displayHints: this.userDisplayHints
3419
3823
  }),
3420
- canEnableRaiseHand: _util3.default.hasHints({
3824
+ canEnableRaiseHand: _util4.default.hasHints({
3421
3825
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_RAISE_HAND],
3422
3826
  displayHints: this.userDisplayHints
3423
3827
  }),
3424
- canDisableRaiseHand: _util3.default.hasHints({
3828
+ canDisableRaiseHand: _util4.default.hasHints({
3425
3829
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_RAISE_HAND],
3426
3830
  displayHints: this.userDisplayHints
3427
3831
  }),
3428
- canEnableVideo: _util3.default.hasHints({
3832
+ canEnableVideo: _util4.default.hasHints({
3429
3833
  requiredHints: [_constants.DISPLAY_HINTS.ENABLE_VIDEO],
3430
3834
  displayHints: this.userDisplayHints
3431
3835
  }),
3432
- canDisableVideo: _util3.default.hasHints({
3836
+ canDisableVideo: _util4.default.hasHints({
3433
3837
  requiredHints: [_constants.DISPLAY_HINTS.DISABLE_VIDEO],
3434
3838
  displayHints: this.userDisplayHints
3435
3839
  }),
3436
- canShareFile: _util3.default.hasHints({
3840
+ canShareFile: _util4.default.hasHints({
3437
3841
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_FILE],
3438
3842
  displayHints: this.userDisplayHints
3439
- }) && _util3.default.hasPolicies({
3843
+ }) && _util4.default.hasPolicies({
3440
3844
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_FILE_SHARE],
3441
3845
  policies: this.selfUserPolicies
3442
3846
  }) || !this.arePolicyRestrictionsSupported,
3443
- canTransferFile: _util3.default.hasPolicies({
3847
+ canTransferFile: _util4.default.hasPolicies({
3444
3848
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_FILE_TRANSFER],
3445
3849
  policies: this.selfUserPolicies
3446
3850
  }),
3447
- 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({
3448
3856
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_APPLICATION],
3449
3857
  displayHints: this.userDisplayHints
3450
- }) && _util3.default.hasPolicies({
3858
+ }) && _util4.default.hasPolicies({
3451
3859
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_APP_SHARE],
3452
3860
  policies: this.selfUserPolicies
3453
3861
  }) || !this.arePolicyRestrictionsSupported(),
3454
- canShareCamera: _util3.default.hasHints({
3862
+ canShareCamera: _util4.default.hasHints({
3455
3863
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_CAMERA],
3456
3864
  displayHints: this.userDisplayHints
3457
- }) && _util3.default.hasPolicies({
3865
+ }) && _util4.default.hasPolicies({
3458
3866
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_CAMERA_SHARE],
3459
3867
  policies: this.selfUserPolicies
3460
3868
  }),
3461
- canShareDesktop: _util3.default.hasHints({
3869
+ canShareDesktop: _util4.default.hasHints({
3462
3870
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_DESKTOP],
3463
3871
  displayHints: this.userDisplayHints
3464
- }) && _util3.default.hasPolicies({
3872
+ }) && _util4.default.hasPolicies({
3465
3873
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_DESKTOP_SHARE],
3466
3874
  policies: this.selfUserPolicies
3467
3875
  }) || !this.arePolicyRestrictionsSupported(),
3468
- canShareContent: _util3.default.hasHints({
3876
+ canShareContent: _util4.default.hasHints({
3469
3877
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_CONTENT],
3470
3878
  displayHints: this.userDisplayHints
3471
3879
  }) || !this.arePolicyRestrictionsSupported(),
3472
- canAnnotate: _util3.default.hasPolicies({
3880
+ canAnnotate: _util4.default.hasPolicies({
3473
3881
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_ANNOTATION],
3474
3882
  policies: this.selfUserPolicies
3475
3883
  })
@@ -3485,14 +3893,27 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3485
3893
 
3486
3894
  /**
3487
3895
  * Sets the self user policies based on the contents of the permission token
3488
- * @param {String} permissionToken
3489
3896
  * @returns {void}
3490
3897
  */
3491
3898
  }, {
3492
3899
  key: "setSelfUserPolicies",
3493
- value: function setSelfUserPolicies(permissionToken) {
3494
- var _jwt$decode, _jwt$decode$permissio;
3495
- this.selfUserPolicies = (_jwt$decode = _jsonwebtoken.default.decode(permissionToken)) === null || _jwt$decode === void 0 ? void 0 : (_jwt$decode$permissio = _jwt$decode.permission) === null || _jwt$decode$permissio === void 0 ? void 0 : _jwt$decode$permissio.userPolicies;
3900
+ value: function setSelfUserPolicies() {
3901
+ var _this$permissionToken, _this$permissionToken2, _this$permissionToken3, _this$permissionToken4;
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;
3904
+ }
3905
+
3906
+ /**
3907
+ * Sets the permission token payload on the class instance
3908
+ *
3909
+ * @param {String} permissionToken
3910
+ * @returns {void}
3911
+ */
3912
+ }, {
3913
+ key: "setPermissionTokenPayload",
3914
+ value: function setPermissionTokenPayload(permissionToken) {
3915
+ this.permissionTokenPayload = _jsonwebtoken.default.decode(permissionToken);
3916
+ this.permissionTokenReceivedLocalTime = new Date().getTime();
3496
3917
  }
3497
3918
 
3498
3919
  /**
@@ -3591,11 +4012,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3591
4012
  key: "closeRemoteStreams",
3592
4013
  value: function closeRemoteStreams() {
3593
4014
  var _this22 = this;
3594
- var _this$mediaProperties2 = this.mediaProperties,
3595
- remoteAudioStream = _this$mediaProperties2.remoteAudioStream,
3596
- remoteVideoStream = _this$mediaProperties2.remoteVideoStream,
3597
- remoteShareStream = _this$mediaProperties2.remoteShareStream,
3598
- 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;
3599
4019
 
3600
4020
  /**
3601
4021
  * Triggers an event to the developer
@@ -3626,7 +4046,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3626
4046
  triggerMediaStoppedEvent(type);
3627
4047
  });
3628
4048
  };
3629
- 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)]);
3630
4050
  }
3631
4051
 
3632
4052
  /**
@@ -3639,36 +4059,38 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3639
4059
  }, {
3640
4060
  key: "setLocalAudioStream",
3641
4061
  value: function () {
3642
- 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) {
3643
4063
  var oldStream;
3644
- return _regenerator.default.wrap(function _callee6$(_context6) {
3645
- while (1) switch (_context6.prev = _context6.next) {
4064
+ return _regenerator.default.wrap(function _callee10$(_context10) {
4065
+ while (1) switch (_context10.prev = _context10.next) {
3646
4066
  case 0:
3647
4067
  oldStream = this.mediaProperties.audioStream;
3648
- 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);
3649
4070
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3650
4071
 
3651
4072
  // we don't update this.mediaProperties.mediaDirection.sendAudio, because we always keep it as true to avoid extra SDP exchanges
3652
4073
  this.mediaProperties.setLocalAudioStream(localStream);
3653
4074
  this.audio.handleLocalStreamChange(this);
3654
- 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);
3655
4077
  localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3656
4078
  if (!(!this.isMultistream || !localStream)) {
3657
- _context6.next = 10;
4079
+ _context10.next = 12;
3658
4080
  break;
3659
4081
  }
3660
- _context6.next = 10;
4082
+ _context10.next = 12;
3661
4083
  return this.unpublishStream(_internalMediaCore.MediaType.AudioMain, oldStream);
3662
- case 10:
3663
- _context6.next = 12;
3664
- return this.publishStream(_internalMediaCore.MediaType.AudioMain, this.mediaProperties.audioStream);
3665
4084
  case 12:
4085
+ _context10.next = 14;
4086
+ return this.publishStream(_internalMediaCore.MediaType.AudioMain, this.mediaProperties.audioStream);
4087
+ case 14:
3666
4088
  case "end":
3667
- return _context6.stop();
4089
+ return _context10.stop();
3668
4090
  }
3669
- }, _callee6, this);
4091
+ }, _callee10, this);
3670
4092
  }));
3671
- function setLocalAudioStream(_x4) {
4093
+ function setLocalAudioStream(_x10) {
3672
4094
  return _setLocalAudioStream.apply(this, arguments);
3673
4095
  }
3674
4096
  return setLocalAudioStream;
@@ -3683,36 +4105,38 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3683
4105
  }, {
3684
4106
  key: "setLocalVideoStream",
3685
4107
  value: function () {
3686
- 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) {
3687
4109
  var oldStream;
3688
- return _regenerator.default.wrap(function _callee7$(_context7) {
3689
- while (1) switch (_context7.prev = _context7.next) {
4110
+ return _regenerator.default.wrap(function _callee11$(_context11) {
4111
+ while (1) switch (_context11.prev = _context11.next) {
3690
4112
  case 0:
3691
4113
  oldStream = this.mediaProperties.videoStream;
3692
- 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);
3693
4116
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3694
4117
 
3695
4118
  // we don't update this.mediaProperties.mediaDirection.sendVideo, because we always keep it as true to avoid extra SDP exchanges
3696
4119
  this.mediaProperties.setLocalVideoStream(localStream);
3697
4120
  this.video.handleLocalStreamChange(this);
3698
- 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);
3699
4123
  localStream === null || localStream === void 0 ? void 0 : localStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3700
4124
  if (!(!this.isMultistream || !localStream)) {
3701
- _context7.next = 10;
4125
+ _context11.next = 12;
3702
4126
  break;
3703
4127
  }
3704
- _context7.next = 10;
4128
+ _context11.next = 12;
3705
4129
  return this.unpublishStream(_internalMediaCore.MediaType.VideoMain, oldStream);
3706
- case 10:
3707
- _context7.next = 12;
3708
- return this.publishStream(_internalMediaCore.MediaType.VideoMain, this.mediaProperties.videoStream);
3709
4130
  case 12:
4131
+ _context11.next = 14;
4132
+ return this.publishStream(_internalMediaCore.MediaType.VideoMain, this.mediaProperties.videoStream);
4133
+ case 14:
3710
4134
  case "end":
3711
- return _context7.stop();
4135
+ return _context11.stop();
3712
4136
  }
3713
- }, _callee7, this);
4137
+ }, _callee11, this);
3714
4138
  }));
3715
- function setLocalVideoStream(_x5) {
4139
+ function setLocalVideoStream(_x11) {
3716
4140
  return _setLocalVideoStream.apply(this, arguments);
3717
4141
  }
3718
4142
  return setLocalVideoStream;
@@ -3728,34 +4152,36 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3728
4152
  }, {
3729
4153
  key: "setLocalShareVideoStream",
3730
4154
  value: function () {
3731
- 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) {
3732
4156
  var oldStream;
3733
- return _regenerator.default.wrap(function _callee8$(_context8) {
3734
- while (1) switch (_context8.prev = _context8.next) {
4157
+ return _regenerator.default.wrap(function _callee12$(_context12) {
4158
+ while (1) switch (_context12.prev = _context12.next) {
3735
4159
  case 0:
3736
4160
  oldStream = this.mediaProperties.shareVideoStream;
4161
+ oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.handleShareVideoStreamMuteStateChange);
3737
4162
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.StreamEventNames.Ended, this.handleShareVideoStreamEnded);
3738
4163
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3739
4164
  this.mediaProperties.setLocalShareVideoStream(localDisplayStream);
4165
+ localDisplayStream === null || localDisplayStream === void 0 ? void 0 : localDisplayStream.on(_mediaHelpers.LocalStreamEventNames.SystemMuteStateChange, this.handleShareVideoStreamMuteStateChange);
3740
4166
  localDisplayStream === null || localDisplayStream === void 0 ? void 0 : localDisplayStream.on(_mediaHelpers.StreamEventNames.Ended, this.handleShareVideoStreamEnded);
3741
4167
  localDisplayStream === null || localDisplayStream === void 0 ? void 0 : localDisplayStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3742
4168
  this.mediaProperties.mediaDirection.sendShare = this.mediaProperties.hasLocalShareStream();
3743
4169
  if (!(!this.isMultistream || !localDisplayStream)) {
3744
- _context8.next = 10;
4170
+ _context12.next = 12;
3745
4171
  break;
3746
4172
  }
3747
- _context8.next = 10;
4173
+ _context12.next = 12;
3748
4174
  return this.unpublishStream(_internalMediaCore.MediaType.VideoSlides, oldStream);
3749
- case 10:
3750
- _context8.next = 12;
3751
- return this.publishStream(_internalMediaCore.MediaType.VideoSlides, this.mediaProperties.shareVideoStream);
3752
4175
  case 12:
4176
+ _context12.next = 14;
4177
+ return this.publishStream(_internalMediaCore.MediaType.VideoSlides, this.mediaProperties.shareVideoStream);
4178
+ case 14:
3753
4179
  case "end":
3754
- return _context8.stop();
4180
+ return _context12.stop();
3755
4181
  }
3756
- }, _callee8, this);
4182
+ }, _callee12, this);
3757
4183
  }));
3758
- function setLocalShareVideoStream(_x6) {
4184
+ function setLocalShareVideoStream(_x12) {
3759
4185
  return _setLocalShareVideoStream.apply(this, arguments);
3760
4186
  }
3761
4187
  return setLocalShareVideoStream;
@@ -3770,10 +4196,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3770
4196
  }, {
3771
4197
  key: "setLocalShareAudioStream",
3772
4198
  value: function () {
3773
- 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) {
3774
4200
  var oldStream;
3775
- return _regenerator.default.wrap(function _callee9$(_context9) {
3776
- while (1) switch (_context9.prev = _context9.next) {
4201
+ return _regenerator.default.wrap(function _callee13$(_context13) {
4202
+ while (1) switch (_context13.prev = _context13.next) {
3777
4203
  case 0:
3778
4204
  oldStream = this.mediaProperties.shareAudioStream;
3779
4205
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.StreamEventNames.Ended, this.handleShareAudioStreamEnded);
@@ -3783,21 +4209,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3783
4209
  localSystemAudioStream === null || localSystemAudioStream === void 0 ? void 0 : localSystemAudioStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3784
4210
  this.mediaProperties.mediaDirection.sendShare = this.mediaProperties.hasLocalShareStream();
3785
4211
  if (!(!this.isMultistream || !localSystemAudioStream)) {
3786
- _context9.next = 10;
4212
+ _context13.next = 10;
3787
4213
  break;
3788
4214
  }
3789
- _context9.next = 10;
4215
+ _context13.next = 10;
3790
4216
  return this.unpublishStream(_internalMediaCore.MediaType.AudioSlides, oldStream);
3791
4217
  case 10:
3792
- _context9.next = 12;
4218
+ _context13.next = 12;
3793
4219
  return this.publishStream(_internalMediaCore.MediaType.AudioSlides, this.mediaProperties.shareAudioStream);
3794
4220
  case 12:
3795
4221
  case "end":
3796
- return _context9.stop();
4222
+ return _context13.stop();
3797
4223
  }
3798
- }, _callee9, this);
4224
+ }, _callee13, this);
3799
4225
  }));
3800
- function setLocalShareAudioStream(_x7) {
4226
+ function setLocalShareAudioStream(_x13) {
3801
4227
  return _setLocalShareAudioStream.apply(this, arguments);
3802
4228
  }
3803
4229
  return setLocalShareAudioStream;
@@ -3835,18 +4261,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3835
4261
  }, {
3836
4262
  key: "cleanupLocalStreams",
3837
4263
  value: function cleanupLocalStreams() {
3838
- var _this$mediaProperties3 = this.mediaProperties,
3839
- audioStream = _this$mediaProperties3.audioStream,
3840
- videoStream = _this$mediaProperties3.videoStream,
3841
- shareAudioStream = _this$mediaProperties3.shareAudioStream,
3842
- shareVideoStream = _this$mediaProperties3.shareVideoStream;
3843
- 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);
3844
4271
  audioStream === null || audioStream === void 0 ? void 0 : audioStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3845
- 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);
3846
4274
  videoStream === null || videoStream === void 0 ? void 0 : videoStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3847
- 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);
3848
4276
  shareAudioStream === null || shareAudioStream === void 0 ? void 0 : shareAudioStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3849
- 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);
3850
4279
  shareVideoStream === null || shareVideoStream === void 0 ? void 0 : shareVideoStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
3851
4280
  this.mediaProperties.setLocalAudioStream(undefined);
3852
4281
  this.mediaProperties.setLocalVideoStream(undefined);
@@ -3960,6 +4389,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3960
4389
  this.receiveSlotManager.reset();
3961
4390
  this.mediaProperties.webrtcMediaConnection.close();
3962
4391
  this.sendSlotManager.reset();
4392
+ this.setNetworkStatus(undefined);
3963
4393
  }
3964
4394
  this.audio = null;
3965
4395
  this.video = null;
@@ -3981,20 +4411,35 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3981
4411
  if (this.config.reconnection.detection) {
3982
4412
  // @ts-ignore
3983
4413
  this.webex.internal.mercury.off(_constants.ONLINE);
4414
+ // @ts-ignore
4415
+ this.webex.internal.mercury.off(_constants.OFFLINE);
3984
4416
  }
3985
4417
  }
3986
4418
 
3987
4419
  /**
3988
- * Convenience method to set the correlation id for the Meeting
3989
- * @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
3990
4422
  * @returns {undefined}
3991
- * @private
4423
+ * @public
3992
4424
  * @memberof Meeting
3993
4425
  */
3994
4426
  }, {
3995
4427
  key: "setCorrelationId",
3996
4428
  value: function setCorrelationId(id) {
3997
- 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);
3998
4443
  }
3999
4444
 
4000
4445
  /**
@@ -4229,6 +4674,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4229
4674
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4230
4675
  var mediaOptions = options.mediaOptions,
4231
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');
4232
4681
  return this.join(joinOptions).then(function (joinResponse) {
4233
4682
  return _this28.addMedia(mediaOptions).then(function (mediaResponse) {
4234
4683
  return {
@@ -4289,11 +4738,27 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4289
4738
  function: 'reconnect'
4290
4739
  }, _constants.EVENT_TRIGGERS.MEETING_RECONNECTION_STARTING);
4291
4740
  return this.reconnectionManager.reconnect(options).then(function () {
4741
+ return _this29.waitForRemoteSDPAnswer();
4742
+ }).then(function () {
4743
+ return _this29.waitForMediaConnectionConnected();
4744
+ }).then(function () {
4292
4745
  _triggerProxy.default.trigger(_this29, {
4293
4746
  file: 'meeting/index',
4294
4747
  function: 'reconnect'
4295
4748
  }, _constants.EVENT_TRIGGERS.MEETING_RECONNECTION_SUCCESS);
4296
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);
4297
4762
  }).catch(function (error) {
4298
4763
  _triggerProxy.default.trigger(_this29, {
4299
4764
  file: 'meeting/index',
@@ -4381,16 +4846,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4381
4846
  }, {
4382
4847
  key: "receiveTranscription",
4383
4848
  value: function () {
4384
- var _receiveTranscription = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
4849
+ var _receiveTranscription = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
4385
4850
  var _this31 = this;
4386
4851
  var datachannelUrl, _yield$this$request, webSocketUrl;
4387
- return _regenerator.default.wrap(function _callee10$(_context10) {
4388
- while (1) switch (_context10.prev = _context10.next) {
4852
+ return _regenerator.default.wrap(function _callee14$(_context14) {
4853
+ while (1) switch (_context14.prev = _context14.next) {
4389
4854
  case 0:
4390
4855
  _loggerProxy.default.logger.info("Meeting:index#receiveTranscription -->\n Attempting to generate a web socket url.");
4391
- _context10.prev = 1;
4856
+ _context14.prev = 1;
4392
4857
  datachannelUrl = this.locusInfo.info.datachannelUrl; // @ts-ignore - fix type
4393
- _context10.next = 5;
4858
+ _context14.next = 5;
4394
4859
  return this.request({
4395
4860
  method: _constants.HTTP_VERBS.POST,
4396
4861
  uri: datachannelUrl,
@@ -4399,7 +4864,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4399
4864
  }
4400
4865
  });
4401
4866
  case 5:
4402
- _yield$this$request = _context10.sent;
4867
+ _yield$this$request = _context14.sent;
4403
4868
  webSocketUrl = _yield$this$request.body.webSocketUrl;
4404
4869
  _loggerProxy.default.logger.info("Meeting:index#receiveTranscription -->\n Generated web socket url succesfully.");
4405
4870
  this.transcription = new _transcription.default(webSocketUrl,
@@ -4420,22 +4885,22 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4420
4885
  this.monitorTranscriptionSocketConnection();
4421
4886
  // @ts-ignore - fix type
4422
4887
  this.transcription.connect(this.webex.credentials.supertoken.access_token);
4423
- _context10.next = 20;
4888
+ _context14.next = 20;
4424
4889
  break;
4425
4890
  case 16:
4426
- _context10.prev = 16;
4427
- _context10.t0 = _context10["catch"](1);
4428
- _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));
4429
4894
  _metrics.default.sendBehavioralMetric(_constants2.default.RECEIVE_TRANSCRIPTION_FAILURE, {
4430
4895
  correlation_id: this.correlationId,
4431
- reason: _context10.t0.message,
4432
- stack: _context10.t0.stack
4896
+ reason: _context14.t0.message,
4897
+ stack: _context14.t0.stack
4433
4898
  });
4434
4899
  case 20:
4435
4900
  case "end":
4436
- return _context10.stop();
4901
+ return _context14.stop();
4437
4902
  }
4438
- }, _callee10, this, [[1, 16]]);
4903
+ }, _callee14, this, [[1, 16]]);
4439
4904
  }));
4440
4905
  function receiveTranscription() {
4441
4906
  return _receiveTranscription.apply(this, arguments);
@@ -4492,228 +4957,241 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4492
4957
  */
4493
4958
  }, {
4494
4959
  key: "join",
4495
- value: function join() {
4496
- var _this32 = this;
4497
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4498
- // @ts-ignore - fix type
4499
- if (!this.webex.meetings.registered) {
4500
- var errorMessage = 'Meeting:index#join --> Device not registered';
4501
- var error = new Error(errorMessage);
4502
- _loggerProxy.default.logger.error(errorMessage);
4503
- return _promise.default.reject(error);
4504
- }
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
+ }
4505
5013
 
4506
- // If a join request is being processed, refer to the deferred promise.
4507
- if (this.deferJoin) {
4508
- return this.deferJoin;
4509
- }
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
+ }
4510
5033
 
4511
- // Scope-up the resolve/reject methods for handling within join().
4512
- var joinFailed;
4513
- 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);
4514
5094
 
4515
- // Create a deferred promise for a consistent resolve value from utils.
4516
- // This also prevents redundant API calls.
4517
- this.deferJoin = new _promise.default(function (resolve, reject) {
4518
- joinFailed = reject;
4519
- joinSuccess = resolve;
4520
- });
4521
- if (options.correlationId) {
4522
- this.setCorrelationId(options.correlationId);
4523
- _loggerProxy.default.logger.log("Meeting:index#join --> Using a new correlation id from app ".concat(this.correlationId));
4524
- }
4525
- if (!this.hasJoinedOnce) {
4526
- this.hasJoinedOnce = true;
4527
- } else if (!options.correlationId) {
4528
- _loggerProxy.default.logger.log("Meeting:index#join --> Generating a new correlation id for meeting ".concat(this.id));
4529
- _loggerProxy.default.logger.log("Meeting:index#join --> Previous correlation id ".concat(this.correlationId));
4530
- this.setCorrelationId(_uuid.default.v4());
4531
- _loggerProxy.default.logger.log("Meeting:index#join --> New correlation id ".concat(this.correlationId));
4532
- }
4533
- if (options.rejoin) {
4534
- this.meetingFiniteStateMachine.reset();
4535
- }
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);
4536
5120
 
4537
- // @ts-ignore
4538
- this.webex.internal.newMetrics.submitClientEvent({
4539
- name: 'client.call.initiated',
4540
- payload: {
4541
- trigger: 'user-interaction',
4542
- isRoapCallEnabled: true
4543
- },
4544
- options: {
4545
- meetingId: this.id
4546
- }
4547
- });
4548
- if (!(0, _isEmpty2.default)(this.meetingInfo)) {
4549
- var _this$meetingInfo5;
4550
- // @ts-ignore
4551
- this.webex.internal.newMetrics.submitClientEvent({
4552
- name: 'client.meetinginfo.request',
4553
- options: {
4554
- meetingId: this.id
4555
- }
4556
- });
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
+ });
4557
5134
 
4558
- // @ts-ignore
4559
- this.webex.internal.newMetrics.submitClientEvent({
4560
- name: 'client.meetinginfo.response',
4561
- payload: {
4562
- identifiers: {
4563
- meetingLookupUrl: (_this$meetingInfo5 = this.meetingInfo) === null || _this$meetingInfo5 === void 0 ? void 0 : _this$meetingInfo5.meetingLookupUrl
4564
- }
4565
- },
4566
- options: {
4567
- meetingId: this.id
4568
- }
4569
- });
4570
- }
4571
- _loggerProxy.default.logger.log('Meeting:index#join --> Joining a meeting');
4572
- if (this.meetingFiniteStateMachine.state === _constants.MEETING_STATE_MACHINE.STATES.ENDED) {
4573
- this.meetingFiniteStateMachine.reset();
4574
- }
4575
- if (this.meetingFiniteStateMachine.state !== _constants.MEETING_STATE_MACHINE.STATES.RINGING) {
4576
- this.meetingFiniteStateMachine.ring(_constants._JOIN_);
4577
- }
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
+ });
4578
5141
 
4579
- // TODO: does this really need to be here?
4580
- if (options.resourceId && this.destination && options.resourceId === this.destination) {
4581
- this.wirelessShare = true;
4582
- }
4583
- if (options.meetingQuality) {
4584
- if (typeof options.meetingQuality === 'string') {
4585
- if (!_constants.QUALITY_LEVELS[options.meetingQuality]) {
4586
- var _errorMessage = "Meeting:index#join --> ".concat(options.meetingQuality, " not defined");
4587
- var _error = new Error(_errorMessage);
4588
- _loggerProxy.default.logger.error(_errorMessage);
4589
- joinFailed(_error);
4590
- this.deferJoin = undefined;
4591
- return _promise.default.reject(_error);
4592
- }
4593
- this.mediaProperties.setRemoteQualityLevel(options.meetingQuality);
4594
- }
4595
- if ((0, _typeof2.default)(options.meetingQuality) === 'object') {
4596
- if (!_constants.QUALITY_LEVELS[options.meetingQuality.remote]) {
4597
- var _errorMessage2 = "Meeting:index#join --> ".concat(options.meetingQuality.remote, " not defined");
4598
- _loggerProxy.default.logger.error(_errorMessage2);
4599
- var _error2 = new Error(_errorMessage2);
4600
- joinFailed(_error2);
4601
- this.deferJoin = undefined;
4602
- return _promise.default.reject(new Error(_errorMessage2));
4603
- }
4604
- if (options.meetingQuality.remote) {
4605
- this.mediaProperties.setRemoteQualityLevel(options.meetingQuality.remote);
4606
- }
4607
- }
4608
- }
4609
- this.isMultistream = !!options.enableMultistream;
4610
- return _util.default.joinMeetingOptions(this, options).then(function (join) {
4611
- _this32.meetingFiniteStateMachine.join();
4612
- _loggerProxy.default.logger.log('Meeting:index#join --> Success');
4613
- return join;
4614
- }).then(function (join) {
4615
- joinSuccess(join);
4616
- _this32.deferJoin = undefined;
4617
- _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_SUCCESS, {
4618
- correlation_id: _this32.correlationId
4619
- });
4620
- return join;
4621
- }).then( /*#__PURE__*/function () {
4622
- var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(join) {
4623
- return _regenerator.default.wrap(function _callee11$(_context11) {
4624
- while (1) switch (_context11.prev = _context11.next) {
4625
- case 0:
4626
- if (!_this32.config.enableAutomaticLLM) {
4627
- _context11.next = 3;
4628
- break;
4629
- }
4630
- _context11.next = 3;
4631
- return _this32.updateLLMConnection();
4632
- case 3:
4633
- return _context11.abrupt("return", join);
4634
- case 4:
4635
- case "end":
4636
- return _context11.stop();
4637
- }
4638
- }, _callee11);
4639
- }));
4640
- return function (_x8) {
4641
- return _ref21.apply(this, arguments);
4642
- };
4643
- }()).then( /*#__PURE__*/function () {
4644
- var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(join) {
4645
- return _regenerator.default.wrap(function _callee12$(_context12) {
4646
- while (1) switch (_context12.prev = _context12.next) {
4647
- case 0:
4648
- if (!isBrowser) {
4649
- _context12.next = 8;
4650
- break;
4651
- }
4652
- if (!(_this32.config.receiveTranscription || options.receiveTranscription)) {
4653
- _context12.next = 6;
4654
- 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
+ });
4655
5161
  }
4656
- if (!_this32.isTranscriptionSupported()) {
4657
- _context12.next = 6;
4658
- 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');
4659
5181
  }
4660
- _context12.next = 5;
4661
- return _this32.receiveTranscription();
4662
- case 5:
4663
- _loggerProxy.default.logger.info('Meeting:index#join --> enabled to recieve transcription!');
4664
- case 6:
4665
- _context12.next = 9;
4666
- break;
4667
- case 8:
4668
- _loggerProxy.default.logger.error('Meeting:index#join --> Receving transcription is not supported on this platform');
4669
- case 9:
4670
- return _context12.abrupt("return", join);
4671
- case 10:
4672
- case "end":
4673
- return _context12.stop();
4674
- }
4675
- }, _callee12);
4676
- }));
4677
- return function (_x9) {
4678
- return _ref22.apply(this, arguments);
4679
- };
4680
- }()).catch(function (error) {
4681
- var _this32$meetingInfo, _error$error;
4682
- _this32.meetingFiniteStateMachine.fail(error);
4683
- _loggerProxy.default.logger.error('Meeting:index#join --> Failed', error);
4684
-
4685
- // @ts-ignore
4686
- _this32.webex.internal.newMetrics.submitClientEvent({
4687
- name: 'client.locus.join.response',
4688
- payload: {
4689
- identifiers: {
4690
- meetingLookupUrl: (_this32$meetingInfo = _this32.meetingInfo) === null || _this32$meetingInfo === void 0 ? void 0 : _this32$meetingInfo.meetingLookupUrl
4691
- }
4692
- },
4693
- options: {
4694
- meetingId: _this32.id,
4695
- rawError: error
5182
+ return join;
5183
+ }));
5184
+ case 52:
5185
+ case "end":
5186
+ return _context15.stop();
4696
5187
  }
4697
- });
4698
-
4699
- // TODO: change this to error codes and pre defined dictionary
4700
- _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_FAILURE, {
4701
- correlation_id: _this32.correlationId,
4702
- reason: (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message,
4703
- stack: error.stack
4704
- });
4705
-
4706
- // Upload logs on join Failure
4707
- _triggerProxy.default.trigger(_this32, {
4708
- file: 'meeting/index',
4709
- function: 'join'
4710
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this32);
4711
- joinFailed(error);
4712
- _this32.deferJoin = undefined;
4713
- return _promise.default.reject(error);
4714
- });
4715
- }
4716
-
5188
+ }, _callee15, this, [[37, 42]]);
5189
+ }));
5190
+ function join() {
5191
+ return _join.apply(this, arguments);
5192
+ }
5193
+ return join;
5194
+ }()
4717
5195
  /**
4718
5196
  * Connects to low latency mercury and reconnects if the address has changed
4719
5197
  * It will also disconnect if called when the meeting has ended
@@ -4723,38 +5201,38 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4723
5201
  }, {
4724
5202
  key: "updateLLMConnection",
4725
5203
  value: function () {
4726
- var _updateLLMConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
5204
+ var _updateLLMConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
4727
5205
  var _this33 = this;
4728
5206
  var _this$locusInfo6, url, _this$locusInfo6$info, _this$locusInfo6$info2, datachannelUrl, isJoined;
4729
- return _regenerator.default.wrap(function _callee13$(_context13) {
4730
- while (1) switch (_context13.prev = _context13.next) {
5207
+ return _regenerator.default.wrap(function _callee16$(_context16) {
5208
+ while (1) switch (_context16.prev = _context16.next) {
4731
5209
  case 0:
4732
5210
  // @ts-ignore - Fix type
4733
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;
4734
5212
  isJoined = this.isJoined(); // @ts-ignore - Fix type
4735
5213
  if (!this.webex.internal.llm.isConnected()) {
4736
- _context13.next = 8;
5214
+ _context16.next = 8;
4737
5215
  break;
4738
5216
  }
4739
5217
  if (!(url === this.webex.internal.llm.getLocusUrl() && isJoined)) {
4740
- _context13.next = 5;
5218
+ _context16.next = 5;
4741
5219
  break;
4742
5220
  }
4743
- return _context13.abrupt("return", undefined);
5221
+ return _context16.abrupt("return", undefined);
4744
5222
  case 5:
4745
- _context13.next = 7;
5223
+ _context16.next = 7;
4746
5224
  return this.webex.internal.llm.disconnectLLM();
4747
5225
  case 7:
4748
5226
  // @ts-ignore - Fix type
4749
5227
  this.webex.internal.llm.off('event:relay.event', this.processRelayEvent);
4750
5228
  case 8:
4751
5229
  if (isJoined) {
4752
- _context13.next = 10;
5230
+ _context16.next = 10;
4753
5231
  break;
4754
5232
  }
4755
- return _context13.abrupt("return", undefined);
5233
+ return _context16.abrupt("return", undefined);
4756
5234
  case 10:
4757
- 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) {
4758
5236
  // @ts-ignore - Fix type
4759
5237
  _this33.webex.internal.llm.off('event:relay.event', _this33.processRelayEvent);
4760
5238
  // @ts-ignore - Fix type
@@ -4764,9 +5242,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4764
5242
  }));
4765
5243
  case 11:
4766
5244
  case "end":
4767
- return _context13.stop();
5245
+ return _context16.stop();
4768
5246
  }
4769
- }, _callee13, this);
5247
+ }, _callee16, this);
4770
5248
  }));
4771
5249
  function updateLLMConnection() {
4772
5250
  return _updateLLMConnection.apply(this, arguments);
@@ -4937,17 +5415,17 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4937
5415
  meetingId: this.id
4938
5416
  }
4939
5417
  });
4940
- 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() {
4941
5419
  var mediaSettings;
4942
- return _regenerator.default.wrap(function _callee14$(_context14) {
4943
- while (1) switch (_context14.prev = _context14.next) {
5420
+ return _regenerator.default.wrap(function _callee17$(_context17) {
5421
+ while (1) switch (_context17.prev = _context17.next) {
4944
5422
  case 0:
4945
- _context14.prev = 0;
5423
+ _context17.prev = 0;
4946
5424
  if (!(_this36.screenShareFloorState === ScreenShareFloorStatus.GRANTED)) {
4947
- _context14.next = 4;
5425
+ _context17.next = 4;
4948
5426
  break;
4949
5427
  }
4950
- _context14.next = 4;
5428
+ _context17.next = 4;
4951
5429
  return _this36.releaseScreenShareFloor();
4952
5430
  case 4:
4953
5431
  mediaSettings = {
@@ -4967,28 +5445,28 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4967
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
4968
5446
  // once the DX answers we establish connection back the media server with only receiveShare enabled
4969
5447
  // @ts-ignore - reconnectMedia does not accept any argument
4970
- _context14.next = 10;
5448
+ _context17.next = 10;
4971
5449
  return _this36.reconnectionManager.reconnectMedia(mediaSettings).then(function () {
4972
5450
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_SUCCESS);
4973
5451
  });
4974
5452
  case 10:
4975
- _context14.next = 16;
5453
+ _context17.next = 16;
4976
5454
  break;
4977
5455
  case 12:
4978
- _context14.prev = 12;
4979
- _context14.t0 = _context14["catch"](0);
4980
- _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);
4981
5459
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_FAILURE, {
4982
5460
  correlation_id: _this36.correlationId,
4983
5461
  locus_id: _this36.locusUrl.split('/').pop(),
4984
- reason: _context14.t0.message,
4985
- stack: _context14.t0.stack
5462
+ reason: _context17.t0.message,
5463
+ stack: _context17.t0.stack
4986
5464
  });
4987
5465
  case 16:
4988
5466
  case "end":
4989
- return _context14.stop();
5467
+ return _context17.stop();
4990
5468
  }
4991
- }, _callee14, null, [[0, 12]]);
5469
+ }, _callee17, null, [[0, 12]]);
4992
5470
  })));
4993
5471
  _loggerProxy.default.logger.info('Meeting:index#moveTo --> Initated moved to using resourceId', resourceId);
4994
5472
  return _util.default.joinMeetingOptions(this, {
@@ -5078,10 +5556,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5078
5556
  }, {
5079
5557
  key: "createMediaConnection",
5080
5558
  value: function () {
5081
- 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) {
5082
5560
  var mc, audioEnabled, videoEnabled, shareEnabled;
5083
- return _regenerator.default.wrap(function _callee15$(_context15) {
5084
- while (1) switch (_context15.prev = _context15.next) {
5561
+ return _regenerator.default.wrap(function _callee18$(_context18) {
5562
+ while (1) switch (_context18.prev = _context18.next) {
5085
5563
  case 0:
5086
5564
  mc = _media.default.createMediaConnection(this.isMultistream, this.getMediaConnectionDebugId(),
5087
5565
  // @ts-ignore
@@ -5099,49 +5577,50 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5099
5577
  this.setupMediaConnectionListeners();
5100
5578
  if (this.isMultistream) {
5101
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;
5102
- this.sendSlotManager.createSlot(mc, _internalMediaCore.MediaType.VideoMain, audioEnabled);
5103
- 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);
5104
5582
  this.sendSlotManager.createSlot(mc, _internalMediaCore.MediaType.VideoSlides, shareEnabled);
5105
5583
  this.sendSlotManager.createSlot(mc, _internalMediaCore.MediaType.AudioSlides, shareEnabled);
5106
5584
  }
5107
5585
 
5108
5586
  // publish the streams
5109
5587
  if (!this.mediaProperties.audioStream) {
5110
- _context15.next = 7;
5588
+ _context18.next = 8;
5111
5589
  break;
5112
5590
  }
5113
- _context15.next = 7;
5591
+ this.setSendNamedMediaGroup(_internalMediaCore.MediaType.AudioMain);
5592
+ _context18.next = 8;
5114
5593
  return this.publishStream(_internalMediaCore.MediaType.AudioMain, this.mediaProperties.audioStream);
5115
- case 7:
5594
+ case 8:
5116
5595
  if (!this.mediaProperties.videoStream) {
5117
- _context15.next = 10;
5596
+ _context18.next = 11;
5118
5597
  break;
5119
5598
  }
5120
- _context15.next = 10;
5599
+ _context18.next = 11;
5121
5600
  return this.publishStream(_internalMediaCore.MediaType.VideoMain, this.mediaProperties.videoStream);
5122
- case 10:
5601
+ case 11:
5123
5602
  if (!this.mediaProperties.shareVideoStream) {
5124
- _context15.next = 13;
5603
+ _context18.next = 14;
5125
5604
  break;
5126
5605
  }
5127
- _context15.next = 13;
5606
+ _context18.next = 14;
5128
5607
  return this.publishStream(_internalMediaCore.MediaType.VideoSlides, this.mediaProperties.shareVideoStream);
5129
- case 13:
5608
+ case 14:
5130
5609
  if (!(this.isMultistream && this.mediaProperties.shareAudioStream)) {
5131
- _context15.next = 16;
5610
+ _context18.next = 17;
5132
5611
  break;
5133
5612
  }
5134
- _context15.next = 16;
5613
+ _context18.next = 17;
5135
5614
  return this.publishStream(_internalMediaCore.MediaType.AudioSlides, this.mediaProperties.shareAudioStream);
5136
- case 16:
5137
- return _context15.abrupt("return", mc);
5138
5615
  case 17:
5616
+ return _context18.abrupt("return", mc);
5617
+ case 18:
5139
5618
  case "end":
5140
- return _context15.stop();
5619
+ return _context18.stop();
5141
5620
  }
5142
- }, _callee15, this);
5621
+ }, _callee18, this);
5143
5622
  }));
5144
- function createMediaConnection(_x10, _x11) {
5623
+ function createMediaConnection(_x14, _x15) {
5145
5624
  return _createMediaConnection.apply(this, arguments);
5146
5625
  }
5147
5626
  return createMediaConnection;
@@ -5168,286 +5647,743 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5168
5647
  }
5169
5648
 
5170
5649
  /**
5171
- * 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.
5172
5652
  *
5173
- * @param {AddMediaOptions} options
5174
- * @returns {Promise}
5175
- * @public
5176
- * @memberof Meeting
5653
+ * @private
5654
+ * @param {LocalStreams} localStreams
5655
+ * @returns {Promise<void>}
5177
5656
  */
5178
5657
  }, {
5179
- key: "addMedia",
5180
- value: function addMedia() {
5181
- var _this$webex$meetings$2,
5182
- _this$webex$meetings$3,
5183
- _localStreams$screenS,
5184
- _localStreams$screenS2,
5185
- _this39 = this;
5186
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5187
- var LOG_HEADER = 'Meeting:index#addMedia -->';
5188
- var turnDiscoverySkippedReason;
5189
- var turnServerUsed = false;
5190
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " called with: ").concat((0, _stringify.default)(options)));
5191
- if (this.meetingState !== _constants.FULL_STATE.ACTIVE) {
5192
- 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);
5193
5698
  }
5194
- if (_util.default.isUserInLeftState(this.locusInfo)) {
5195
- 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);
5196
5757
  }
5197
- var localStreams = options.localStreams,
5198
- _options$audioEnabled = options.audioEnabled,
5199
- audioEnabled = _options$audioEnabled === void 0 ? true : _options$audioEnabled,
5200
- _options$videoEnabled = options.videoEnabled,
5201
- videoEnabled = _options$videoEnabled === void 0 ? true : _options$videoEnabled,
5202
- _options$shareAudioEn = options.shareAudioEnabled,
5203
- shareAudioEnabled = _options$shareAudioEn === void 0 ? true : _options$shareAudioEn,
5204
- _options$shareVideoEn = options.shareVideoEnabled,
5205
- shareVideoEnabled = _options$shareVideoEn === void 0 ? true : _options$shareVideoEn,
5206
- remoteMediaManagerConfig = options.remoteMediaManagerConfig,
5207
- bundlePolicy = options.bundlePolicy,
5208
- allowMediaInLobby = options.allowMediaInLobby;
5209
- this.allowMediaInLobby = options === null || options === void 0 ? void 0 : options.allowMediaInLobby;
5210
-
5211
- // If the user is unjoined or guest waiting in lobby dont allow the user to addMedia
5212
- // @ts-ignore - isUserUnadmitted coming from SelfUtil
5213
- if (this.isUserUnadmitted && !this.wirelessShare && !allowMediaInLobby) {
5214
- 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));
5215
5781
  }
5782
+ }
5216
5783
 
5217
- // @ts-ignore
5218
- this.webex.internal.newMetrics.submitClientEvent({
5219
- name: 'client.media.capabilities',
5220
- payload: {
5221
- mediaCapabilities: {
5222
- rx: {
5223
- audio: false,
5224
- share: false,
5225
- share_audio: false,
5226
- video: false,
5227
- whiteboard: false
5228
- },
5229
- tx: {
5230
- audio: false,
5231
- share: false,
5232
- share_audio: false,
5233
- video: false,
5234
- whiteboard: false
5235
- }
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();
5236
5825
  }
5237
- },
5238
- options: {
5239
- meetingId: this.id
5240
- }
5241
- });
5242
-
5243
- // when audioEnabled/videoEnabled is true, we set sendAudio/sendVideo to true even before any streams are published
5244
- // to avoid doing an extra SDP exchange when they are published for the first time
5245
- this.mediaProperties.setMediaDirection({
5246
- sendAudio: audioEnabled,
5247
- sendVideo: videoEnabled,
5248
- sendShare: false,
5249
- receiveAudio: audioEnabled,
5250
- receiveVideo: videoEnabled,
5251
- receiveShare: shareAudioEnabled || shareVideoEnabled
5252
- });
5253
- this.locusMediaRequest = new _locusMediaRequest.LocusMediaRequest({
5254
- correlationId: this.correlationId,
5255
- device: {
5256
- url: this.deviceUrl,
5257
- // @ts-ignore
5258
- deviceType: this.config.deviceType,
5259
- // @ts-ignore
5260
- countryCode: (_this$webex$meetings$2 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$2 === void 0 ? void 0 : _this$webex$meetings$2.countryCode,
5261
- // @ts-ignore
5262
- regionCode: (_this$webex$meetings$3 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$3 === void 0 ? void 0 : _this$webex$meetings$3.regionCode
5263
- },
5264
- preferTranscoding: !this.isMultistream
5265
- }, {
5266
- // @ts-ignore
5267
- parent: this.webex
5268
- });
5269
- this.audio = (0, _muteState.createMuteState)(_constants.AUDIO, this, audioEnabled);
5270
- this.video = (0, _muteState.createMuteState)(_constants.VIDEO, this, videoEnabled);
5271
- var promises = [];
5272
-
5273
- // setup all the references to local streams in this.mediaProperties before creating media connection
5274
- // and before TURN discovery, so that the correct mute state is sent with TURN discovery roap messages
5275
- if (localStreams !== null && localStreams !== void 0 && localStreams.microphone) {
5276
- promises.push(this.setLocalAudioStream(localStreams.microphone));
5826
+ }, _callee21, this);
5827
+ }));
5828
+ function waitForRemoteSDPAnswer() {
5829
+ return _waitForRemoteSDPAnswer.apply(this, arguments);
5277
5830
  }
5278
- if (localStreams !== null && localStreams !== void 0 && localStreams.camera) {
5279
- 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);
5280
5869
  }
5281
- if (localStreams !== null && localStreams !== void 0 && (_localStreams$screenS = localStreams.screenShare) !== null && _localStreams$screenS !== void 0 && _localStreams$screenS.video) {
5282
- 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);
5283
5920
  }
5284
- if (localStreams !== null && localStreams !== void 0 && (_localStreams$screenS2 = localStreams.screenShare) !== null && _localStreams$screenS2 !== void 0 && _localStreams$screenS2.audio) {
5285
- 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);
5286
5964
  }
5287
- return _promise.default.all(promises).then(function () {
5288
- return _this39.roap.doTurnDiscovery(_this39, false);
5289
- }).then( /*#__PURE__*/function () {
5290
- var _ref24 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(turnDiscoveryObject) {
5291
- var turnServerInfo, mc;
5292
- return _regenerator.default.wrap(function _callee16$(_context16) {
5293
- while (1) switch (_context16.prev = _context16.next) {
5294
- case 0:
5295
- turnDiscoverySkippedReason = turnDiscoveryObject.turnDiscoverySkippedReason;
5296
- turnServerUsed = !turnDiscoverySkippedReason;
5297
- turnServerInfo = turnDiscoveryObject.turnServerInfo;
5298
- _context16.next = 5;
5299
- return _this39.createMediaConnection(turnServerInfo, bundlePolicy);
5300
- case 5:
5301
- mc = _context16.sent;
5302
- if (!_this39.isMultistream) {
5303
- _context16.next = 13;
5304
- break;
5305
- }
5306
- _this39.remoteMediaManager = new _remoteMediaManager.RemoteMediaManager(_this39.receiveSlotManager, _this39.mediaRequestManagers, remoteMediaManagerConfig);
5307
- _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.AudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_AUDIO_CREATED);
5308
- _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.ScreenShareAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED);
5309
- _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.VideoLayoutChanged, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED);
5310
- _context16.next = 13;
5311
- return _this39.remoteMediaManager.start();
5312
- case 13:
5313
- _context16.next = 15;
5314
- return mc.initiateOffer();
5315
- case 15:
5316
- case "end":
5317
- return _context16.stop();
5318
- }
5319
- }, _callee16);
5320
- }));
5321
- return function (_x12) {
5322
- return _ref24.apply(this, arguments);
5323
- };
5324
- }()).then(function () {
5325
- _this39.setMercuryListener();
5326
- }).then(function () {
5327
- return (0, _mediaHelpers.getDevices)().then(function (devices) {
5328
- _util.default.handleDeviceLogging(devices);
5329
- }).catch(function () {});
5330
- } // getDevices may fail if we don't have browser permissions, that's ok, we still can have a media connection
5331
- ).then(function () {
5332
- _this39.handleMediaLogging(_this39.mediaProperties);
5333
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " media connection created"));
5334
-
5335
- // @ts-ignore - config coming from registerPlugin
5336
- if (_this39.config.stats.enableStatsAnalyzer) {
5337
- // @ts-ignore - config coming from registerPlugin
5338
- _this39.networkQualityMonitor = new _networkQualityMonitor.default(_this39.config.stats);
5339
- _this39.statsAnalyzer = new _statsAnalyzer.StatsAnalyzer(
5340
- // @ts-ignore - config coming from registerPlugin
5341
- _this39.config.stats, function (ssrc) {
5342
- return _this39.receiveSlotManager.findReceiveSlotBySsrc(ssrc);
5343
- }, _this39.networkQualityMonitor);
5344
- _this39.setupStatsAnalyzerEventHandlers();
5345
- _this39.networkQualityMonitor.on(_constants.EVENT_TRIGGERS.NETWORK_QUALITY, _this39.sendNetworkQualityEvent.bind(_this39));
5346
- }
5347
- }).catch(function (error) {
5348
- _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error adding media , setting up peerconnection, "), error);
5349
- throw error;
5350
- }).then(function () {
5351
- return new _promise.default(function (resolve, reject) {
5352
- var timerCount = 0;
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;
5353
5998
 
5354
- // eslint-disable-next-line func-names
5355
- // eslint-disable-next-line prefer-arrow-callback
5356
- if (_this39.type === _constants._CALL_ || _this39.meetingState === _constants.FULL_STATE.ACTIVE) {
5357
- resolve();
5358
- }
5359
- var joiningTimer = setInterval(function () {
5360
- timerCount += 1;
5361
- if (_this39.meetingState === _constants.FULL_STATE.ACTIVE) {
5362
- clearInterval(joiningTimer);
5363
- resolve();
5364
- }
5365
- if (timerCount === 4) {
5366
- clearInterval(joiningTimer);
5367
- reject(new Error('Meeting is still not active '));
5368
- }
5369
- }, 1000);
5370
- });
5371
- }).then(function () {
5372
- return _this39.mediaProperties.waitForMediaConnectionConnected().catch(function () {
5373
- // @ts-ignore
5374
- _this39.webex.internal.newMetrics.submitClientEvent({
5375
- name: 'client.ice.end',
5376
- payload: {
5377
- canProceed: false,
5378
- icePhase: 'JOIN_MEETING_FINAL',
5379
- errors: [
5380
5999
  // @ts-ignore
5381
- _this39.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode(_internalPluginMetrics.CALL_DIAGNOSTIC_CONFIG.ICE_FAILURE_CLIENT_CODE)]
5382
- },
5383
- options: {
5384
- meetingId: _this39.id
5385
- }
5386
- });
5387
- throw new Error("Timed out waiting for media connection to be connected, correlationId=".concat(_this39.correlationId));
5388
- });
5389
- }).then(function () {
5390
- if (_this39.mediaProperties.hasLocalShareStream()) {
5391
- return _this39.enqueueScreenShareFloorRequest();
5392
- }
5393
- return _promise.default.resolve();
5394
- }).then(function () {
5395
- return _this39.mediaProperties.getCurrentConnectionType();
5396
- }).then(function (connectionType) {
5397
- _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_SUCCESS, {
5398
- correlation_id: _this39.correlationId,
5399
- locus_id: _this39.locusUrl.split('/').pop(),
5400
- connectionType: connectionType,
5401
- isMultistream: _this39.isMultistream
5402
- });
5403
- // @ts-ignore
5404
- _this39.webex.internal.newMetrics.submitClientEvent({
5405
- name: 'client.media-engine.ready',
5406
- options: {
5407
- meetingId: _this39.id
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();
5408
6058
  }
5409
- });
5410
- }).catch(function (error) {
5411
- 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;
5412
- _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, {
5413
- correlation_id: _this39.correlationId,
5414
- locus_id: _this39.locusUrl.split('/').pop(),
5415
- reason: error.message,
5416
- stack: error.stack,
5417
- code: error.code,
5418
- turnDiscoverySkippedReason: turnDiscoverySkippedReason,
5419
- turnServerUsed: turnServerUsed,
5420
- isMultistream: _this39.isMultistream,
5421
- 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',
5422
- 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',
5423
- 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'
5424
- });
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;
5425
6087
 
5426
- // Clean up stats analyzer, peer connection, and turn off listeners
5427
- var stopStatsAnalyzer = _this39.statsAnalyzer ? _this39.statsAnalyzer.stopAnalyzer() : _promise.default.resolve();
5428
- return stopStatsAnalyzer.then(function () {
5429
- _this39.statsAnalyzer = null;
5430
- if (_this39.mediaProperties.webrtcMediaConnection) {
5431
- _this39.closePeerConnections();
5432
- _this39.unsetPeerConnections();
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();
5433
6102
  }
5434
- _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error adding media failed to initiate PC and send request, "), error);
5435
-
5436
- // Upload logs on error while adding media
5437
- _triggerProxy.default.trigger(_this39, {
5438
- file: 'meeting/index',
5439
- function: 'addMedia'
5440
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this39);
5441
- if (error instanceof _internalMediaCore.Errors.SdpError) {
5442
- _this39.leave({
5443
- reason: _constants.MEETING_REMOVED_REASON.MEETING_CONNECTION_FAILED
5444
- });
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();
5445
6145
  }
5446
- throw error;
5447
- });
5448
- });
5449
- }
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
+ });
6262
+
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));
5450
6333
 
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);
6342
+
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();
6379
+ }
6380
+ }, _callee28, this, [[18, 42]]);
6381
+ }));
6382
+ function addMedia() {
6383
+ return _addMedia.apply(this, arguments);
6384
+ }
6385
+ return addMedia;
6386
+ }()
5451
6387
  /**
5452
6388
  * Informs if the peer connection is in a state that can be updated with updateMedia (audio/video/share)
5453
6389
  * @returns {Boolean}
@@ -5461,6 +6397,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5461
6397
  return !this.isRoapInProgress;
5462
6398
  }
5463
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:
5464
6409
  /**
5465
6410
  * Enqueues a media update operation.
5466
6411
  * @param {String} mediaUpdateType one of MEDIA_UPDATE_TYPE values
@@ -5469,9 +6414,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5469
6414
  * @private
5470
6415
  * @memberof Meeting
5471
6416
  */
5472
- }, {
5473
- key: "enqueueMediaUpdate",
5474
- value: function enqueueMediaUpdate(mediaUpdateType) {
6417
+ function enqueueMediaUpdate(mediaUpdateType) {
5475
6418
  var _this40 = this;
5476
6419
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5477
6420
  var canUpdateMediaNow = this.canUpdateMedia();
@@ -5515,26 +6458,39 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5515
6458
  * @memberof Meeting
5516
6459
  */
5517
6460
  function () {
5518
- 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) {
5519
6462
  var audioEnabled, videoEnabled, shareAudioEnabled, shareVideoEnabled;
5520
- return _regenerator.default.wrap(function _callee17$(_context17) {
5521
- while (1) switch (_context17.prev = _context17.next) {
6463
+ return _regenerator.default.wrap(function _callee29$(_context29) {
6464
+ while (1) switch (_context29.prev = _context29.next) {
5522
6465
  case 0:
5523
6466
  this.checkMediaConnection();
5524
6467
  audioEnabled = options.audioEnabled, videoEnabled = options.videoEnabled, shareAudioEnabled = options.shareAudioEnabled, shareVideoEnabled = options.shareVideoEnabled;
5525
6468
  _loggerProxy.default.logger.log("Meeting:index#updateMedia --> called with options=".concat((0, _stringify.default)(options)));
5526
6469
  if (this.canUpdateMedia()) {
5527
- _context17.next = 5;
6470
+ _context29.next = 5;
5528
6471
  break;
5529
6472
  }
5530
- 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));
5531
6474
  case 5:
5532
- if (!(this.isMultistream && (shareAudioEnabled !== undefined || shareVideoEnabled !== undefined))) {
5533
- _context17.next = 7;
6475
+ if (!this.isMultistream) {
6476
+ _context29.next = 10;
6477
+ break;
6478
+ }
6479
+ if (!(shareAudioEnabled !== undefined || shareVideoEnabled !== undefined)) {
6480
+ _context29.next = 8;
5534
6481
  break;
5535
6482
  }
5536
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');
5537
- case 7:
6484
+ case 8:
6485
+ _context29.next = 12;
6486
+ break;
6487
+ case 10:
6488
+ if (!(shareAudioEnabled !== undefined)) {
6489
+ _context29.next = 12;
6490
+ break;
6491
+ }
6492
+ throw new Error('toggling shareAudioEnabled in a transcoded meeting is not supported as of now');
6493
+ case 12:
5538
6494
  if (audioEnabled !== undefined) {
5539
6495
  this.mediaProperties.mediaDirection.sendAudio = audioEnabled;
5540
6496
  this.mediaProperties.mediaDirection.receiveAudio = audioEnabled;
@@ -5555,20 +6511,20 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5555
6511
  this.mediaProperties.mediaDirection.receiveShare = !!(shareAudioEnabled || shareVideoEnabled);
5556
6512
  }
5557
6513
  if (this.isMultistream) {
5558
- _context17.next = 13;
6514
+ _context29.next = 18;
5559
6515
  break;
5560
6516
  }
5561
- _context17.next = 13;
6517
+ _context29.next = 18;
5562
6518
  return this.updateTranscodedMediaConnection();
5563
- case 13:
5564
- return _context17.abrupt("return", undefined);
5565
- case 14:
6519
+ case 18:
6520
+ return _context29.abrupt("return", undefined);
6521
+ case 19:
5566
6522
  case "end":
5567
- return _context17.stop();
6523
+ return _context29.stop();
5568
6524
  }
5569
- }, _callee17, this);
6525
+ }, _callee29, this);
5570
6526
  }));
5571
- function updateMedia(_x13) {
6527
+ function updateMedia(_x27) {
5572
6528
  return _updateMedia.apply(this, arguments);
5573
6529
  }
5574
6530
  return updateMedia;
@@ -5853,9 +6809,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5853
6809
  uri: whiteboard.url
5854
6810
  }).catch(function (error) {
5855
6811
  _loggerProxy.default.logger.error('Meeting:index#stopWhiteboardShare --> Error ', error);
5856
- _metrics.default.sendBehavioralMetric(
5857
- // @ts-ignore - check if STOP_WHITEBOARD_SHARE_FAILURE exists
5858
- _constants2.default.STOP_WHITEBOARD_SHARE_FAILURE, {
6812
+ _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_STOP_WHITEBOARD_SHARE_FAILURE, {
5859
6813
  correlation_id: _this45.correlationId,
5860
6814
  locus_id: _this45.locusUrl.split('/').pop(),
5861
6815
  reason: error.message,
@@ -5893,9 +6847,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5893
6847
  if (content && this.shareStatus !== _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE) {
5894
6848
  // @ts-ignore
5895
6849
  this.webex.internal.newMetrics.submitClientEvent({
5896
- name: 'client.share.initiated',
6850
+ name: 'client.share.floor-grant.request',
5897
6851
  payload: {
5898
- mediaType: 'share'
6852
+ mediaType: 'share',
6853
+ shareInstanceId: this.localShareInstanceId
5899
6854
  },
5900
6855
  options: {
5901
6856
  meetingId: this.id
@@ -5906,9 +6861,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5906
6861
  personUrl: this.locusInfo.self.url,
5907
6862
  deviceUrl: this.deviceUrl,
5908
6863
  uri: content.url,
5909
- resourceUrl: this.resourceUrl
6864
+ resourceUrl: this.resourceUrl,
6865
+ shareInstanceId: this.localShareInstanceId
5910
6866
  }).then(function () {
5911
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
+ });
5912
6872
  return _promise.default.resolve();
5913
6873
  }).catch(function (error) {
5914
6874
  _loggerProxy.default.logger.error('Meeting:index#share --> Error ', error);
@@ -5918,6 +6878,19 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5918
6878
  reason: error.message,
5919
6879
  stack: error.stack
5920
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
+ });
5921
6894
  _this46.screenShareFloorState = ScreenShareFloorStatus.RELEASED;
5922
6895
  return _promise.default.reject(error);
5923
6896
  });
@@ -5972,7 +6945,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5972
6945
  this.webex.internal.newMetrics.submitClientEvent({
5973
6946
  name: 'client.share.stopped',
5974
6947
  payload: {
5975
- mediaType: 'share'
6948
+ mediaType: 'share',
6949
+ shareInstanceId: this.localShareInstanceId
5976
6950
  },
5977
6951
  options: {
5978
6952
  meetingId: this.id
@@ -5987,7 +6961,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5987
6961
  personUrl: this.locusInfo.self.url,
5988
6962
  deviceUrl: this.deviceUrl,
5989
6963
  uri: content.url,
5990
- resourceUrl: this.resourceUrl
6964
+ resourceUrl: this.resourceUrl,
6965
+ shareInstanceId: this.localShareInstanceId
5991
6966
  }).catch(function (error) {
5992
6967
  _loggerProxy.default.logger.error('Meeting:index#releaseScreenShareFloor --> Error ', error);
5993
6968
  _metrics.default.sendBehavioralMetric(_constants2.default.STOP_FLOOR_REQUEST_FAILURE, {
@@ -6175,10 +7150,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6175
7150
  var renderInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6176
7151
  var main = renderInfo.main,
6177
7152
  content = renderInfo.content;
6178
- var _this$mediaProperties4 = this.mediaProperties,
6179
- mediaDirection = _this$mediaProperties4.mediaDirection,
6180
- remoteShareStream = _this$mediaProperties4.remoteShareStream,
6181
- 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;
6182
7157
  var layoutInfo = (0, _cloneDeep2.default)(this.lastVideoLayoutInfo);
6183
7158
 
6184
7159
  // TODO: We need a real time value for Audio, Video and Share send indicator
@@ -6187,7 +7162,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6187
7162
  }
6188
7163
  if (layoutType) {
6189
7164
  if (!_constants.LAYOUT_TYPES.includes(layoutType)) {
6190
- 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.');
6191
7166
  }
6192
7167
  layoutInfo.layoutType = layoutType;
6193
7168
  }
@@ -6461,8 +7436,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6461
7436
  }, {
6462
7437
  key: "checkMediaConnection",
6463
7438
  value: function checkMediaConnection() {
6464
- var _this$mediaProperties5;
6465
- 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) {
6466
7441
  return;
6467
7442
  }
6468
7443
  throw new _webexErrors.NoMediaEstablishedYetError();
@@ -6477,39 +7452,39 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6477
7452
  }, {
6478
7453
  key: "enableMusicMode",
6479
7454
  value: function () {
6480
- var _enableMusicMode = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(shouldEnableMusicMode) {
6481
- return _regenerator.default.wrap(function _callee18$(_context18) {
6482
- 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) {
6483
7458
  case 0:
6484
7459
  this.checkMediaConnection();
6485
7460
  if (this.isMultistream) {
6486
- _context18.next = 3;
7461
+ _context30.next = 3;
6487
7462
  break;
6488
7463
  }
6489
7464
  throw new Error('enableMusicMode() only supported with multistream');
6490
7465
  case 3:
6491
7466
  if (!shouldEnableMusicMode) {
6492
- _context18.next = 8;
7467
+ _context30.next = 8;
6493
7468
  break;
6494
7469
  }
6495
- _context18.next = 6;
7470
+ _context30.next = 6;
6496
7471
  return this.sendSlotManager.setCodecParameters(_internalMediaCore.MediaType.AudioMain, {
6497
7472
  maxaveragebitrate: '64000',
6498
7473
  maxplaybackrate: '48000'
6499
7474
  });
6500
7475
  case 6:
6501
- _context18.next = 10;
7476
+ _context30.next = 10;
6502
7477
  break;
6503
7478
  case 8:
6504
- _context18.next = 10;
7479
+ _context30.next = 10;
6505
7480
  return this.sendSlotManager.deleteCodecParameters(_internalMediaCore.MediaType.AudioMain, ['maxaveragebitrate', 'maxplaybackrate']);
6506
7481
  case 10:
6507
7482
  case "end":
6508
- return _context18.stop();
7483
+ return _context30.stop();
6509
7484
  }
6510
- }, _callee18, this);
7485
+ }, _callee30, this);
6511
7486
  }));
6512
- function enableMusicMode(_x14) {
7487
+ function enableMusicMode(_x28) {
6513
7488
  return _enableMusicMode.apply(this, arguments);
6514
7489
  }
6515
7490
  return enableMusicMode;
@@ -6521,10 +7496,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6521
7496
  }, {
6522
7497
  key: "updateTranscodedMediaConnection",
6523
7498
  value: function updateTranscodedMediaConnection() {
6524
- var _this$mediaProperties6,
6525
- _this$mediaProperties7,
6526
- _this$mediaProperties8,
6527
- _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,
6528
7507
  _this51 = this;
6529
7508
  var LOG_HEADER = 'Meeting:index#updateTranscodedMediaConnection -->';
6530
7509
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " starting"));
@@ -6534,10 +7513,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6534
7513
  return this.mediaProperties.webrtcMediaConnection.update({
6535
7514
  // TODO: RoapMediaConnection is not ready to use stream classes yet, so we pass the raw MediaStreamTrack for now
6536
7515
  localTracks: {
6537
- audio: ((_this$mediaProperties6 = this.mediaProperties.audioStream) === null || _this$mediaProperties6 === void 0 ? void 0 : _this$mediaProperties6.outputTrack) || null,
6538
- video: ((_this$mediaProperties7 = this.mediaProperties.videoStream) === null || _this$mediaProperties7 === void 0 ? void 0 : _this$mediaProperties7.outputTrack) || null,
6539
- screenShareVideo: ((_this$mediaProperties8 = this.mediaProperties.shareVideoStream) === null || _this$mediaProperties8 === void 0 ? void 0 : _this$mediaProperties8.outputTrack) || null,
6540
- 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
6541
7520
  },
6542
7521
  direction: {
6543
7522
  audio: _media.default.getDirection(true, this.mediaProperties.mediaDirection.receiveAudio, this.mediaProperties.mediaDirection.sendAudio),
@@ -6559,6 +7538,32 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6559
7538
  });
6560
7539
  }
6561
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
+
6562
7567
  /**
6563
7568
  * Publishes a stream.
6564
7569
  *
@@ -6569,25 +7574,25 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6569
7574
  }, {
6570
7575
  key: "publishStream",
6571
7576
  value: function () {
6572
- var _publishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(mediaType, stream) {
6573
- return _regenerator.default.wrap(function _callee19$(_context19) {
6574
- 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) {
6575
7580
  case 0:
6576
7581
  if (stream) {
6577
- _context19.next = 2;
7582
+ _context31.next = 2;
6578
7583
  break;
6579
7584
  }
6580
- return _context19.abrupt("return");
7585
+ return _context31.abrupt("return");
6581
7586
  case 2:
6582
7587
  if (!this.mediaProperties.webrtcMediaConnection) {
6583
- _context19.next = 7;
7588
+ _context31.next = 7;
6584
7589
  break;
6585
7590
  }
6586
7591
  if (!(this.isMultistream && this.mediaProperties.webrtcMediaConnection)) {
6587
- _context19.next = 6;
7592
+ _context31.next = 6;
6588
7593
  break;
6589
7594
  }
6590
- _context19.next = 6;
7595
+ _context31.next = 6;
6591
7596
  return this.sendSlotManager.publishStream(mediaType, stream);
6592
7597
  case 6:
6593
7598
  this.emitPublishStateChangeEvent({
@@ -6598,11 +7603,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6598
7603
  });
6599
7604
  case 7:
6600
7605
  case "end":
6601
- return _context19.stop();
7606
+ return _context31.stop();
6602
7607
  }
6603
- }, _callee19, this);
7608
+ }, _callee31, this);
6604
7609
  }));
6605
- function publishStream(_x15, _x16) {
7610
+ function publishStream(_x29, _x30) {
6606
7611
  return _publishStream.apply(this, arguments);
6607
7612
  }
6608
7613
  return publishStream;
@@ -6617,21 +7622,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6617
7622
  }, {
6618
7623
  key: "unpublishStream",
6619
7624
  value: function () {
6620
- var _unpublishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(mediaType, stream) {
6621
- return _regenerator.default.wrap(function _callee20$(_context20) {
6622
- 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) {
6623
7628
  case 0:
6624
7629
  if (stream) {
6625
- _context20.next = 2;
7630
+ _context32.next = 2;
6626
7631
  break;
6627
7632
  }
6628
- return _context20.abrupt("return");
7633
+ return _context32.abrupt("return");
6629
7634
  case 2:
6630
7635
  if (!(this.isMultistream && this.mediaProperties.webrtcMediaConnection)) {
6631
- _context20.next = 5;
7636
+ _context32.next = 5;
6632
7637
  break;
6633
7638
  }
6634
- _context20.next = 5;
7639
+ _context32.next = 5;
6635
7640
  return this.sendSlotManager.unpublishStream(mediaType);
6636
7641
  case 5:
6637
7642
  this.emitPublishStateChangeEvent({
@@ -6642,11 +7647,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6642
7647
  });
6643
7648
  case 6:
6644
7649
  case "end":
6645
- return _context20.stop();
7650
+ return _context32.stop();
6646
7651
  }
6647
- }, _callee20, this);
7652
+ }, _callee32, this);
6648
7653
  }));
6649
- function unpublishStream(_x17, _x18) {
7654
+ function unpublishStream(_x31, _x32) {
6650
7655
  return _unpublishStream.apply(this, arguments);
6651
7656
  }
6652
7657
  return unpublishStream;
@@ -6660,72 +7665,93 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6660
7665
  }, {
6661
7666
  key: "publishStreams",
6662
7667
  value: function () {
6663
- 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) {
6664
7669
  var _streams$screenShare, _streams$screenShare2, _streams$screenShare3, _streams$screenShare4;
6665
7670
  var floorRequestNeeded, _streams$screenShare5;
6666
- return _regenerator.default.wrap(function _callee21$(_context21) {
6667
- while (1) switch (_context21.prev = _context21.next) {
7671
+ return _regenerator.default.wrap(function _callee33$(_context33) {
7672
+ while (1) switch (_context33.prev = _context33.next) {
6668
7673
  case 0:
6669
7674
  this.checkMediaConnection();
6670
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))) {
6671
- _context21.next = 3;
7676
+ _context33.next = 3;
6672
7677
  break;
6673
7678
  }
6674
- return _context21.abrupt("return");
7679
+ return _context33.abrupt("return");
6675
7680
  case 3:
6676
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
6677
7682
  if (!(this.isMultistream && (_streams$screenShare3 = streams.screenShare) !== null && _streams$screenShare3 !== void 0 && _streams$screenShare3.audio)) {
6678
- _context21.next = 8;
7683
+ _context33.next = 8;
6679
7684
  break;
6680
7685
  }
6681
- _context21.next = 7;
7686
+ _context33.next = 7;
6682
7687
  return this.setLocalShareAudioStream(streams.screenShare.audio);
6683
7688
  case 7:
6684
7689
  floorRequestNeeded = this.screenShareFloorState === ScreenShareFloorStatus.RELEASED;
6685
7690
  case 8:
6686
7691
  if (!((_streams$screenShare4 = streams.screenShare) !== null && _streams$screenShare4 !== void 0 && _streams$screenShare4.video)) {
6687
- _context21.next = 12;
7692
+ _context33.next = 12;
6688
7693
  break;
6689
7694
  }
6690
- _context21.next = 11;
7695
+ _context33.next = 11;
6691
7696
  return this.setLocalShareVideoStream((_streams$screenShare5 = streams.screenShare) === null || _streams$screenShare5 === void 0 ? void 0 : _streams$screenShare5.video);
6692
7697
  case 11:
6693
7698
  floorRequestNeeded = this.screenShareFloorState === ScreenShareFloorStatus.RELEASED;
6694
7699
  case 12:
6695
7700
  if (!streams.microphone) {
6696
- _context21.next = 15;
7701
+ _context33.next = 15;
6697
7702
  break;
6698
7703
  }
6699
- _context21.next = 15;
7704
+ _context33.next = 15;
6700
7705
  return this.setLocalAudioStream(streams.microphone);
6701
7706
  case 15:
6702
7707
  if (!streams.camera) {
6703
- _context21.next = 18;
7708
+ _context33.next = 18;
6704
7709
  break;
6705
7710
  }
6706
- _context21.next = 18;
7711
+ _context33.next = 18;
6707
7712
  return this.setLocalVideoStream(streams.camera);
6708
7713
  case 18:
6709
7714
  if (this.isMultistream) {
6710
- _context21.next = 21;
7715
+ _context33.next = 21;
6711
7716
  break;
6712
7717
  }
6713
- _context21.next = 21;
7718
+ _context33.next = 21;
6714
7719
  return this.updateTranscodedMediaConnection();
6715
7720
  case 21:
6716
7721
  if (!floorRequestNeeded) {
6717
- _context21.next = 24;
7722
+ _context33.next = 27;
6718
7723
  break;
6719
7724
  }
6720
- _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;
6721
7747
  return this.enqueueScreenShareFloorRequest();
6722
- case 24:
7748
+ case 27:
6723
7749
  case "end":
6724
- return _context21.stop();
7750
+ return _context33.stop();
6725
7751
  }
6726
- }, _callee21, this);
7752
+ }, _callee33, this);
6727
7753
  }));
6728
- function publishStreams(_x19) {
7754
+ function publishStreams(_x33) {
6729
7755
  return _publishStreams.apply(this, arguments);
6730
7756
  }
6731
7757
  return publishStreams;
@@ -6739,10 +7765,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6739
7765
  }, {
6740
7766
  key: "unpublishStreams",
6741
7767
  value: function () {
6742
- 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) {
6743
7769
  var promises, _iterator, _step, stream;
6744
- return _regenerator.default.wrap(function _callee22$(_context22) {
6745
- while (1) switch (_context22.prev = _context22.next) {
7770
+ return _regenerator.default.wrap(function _callee34$(_context34) {
7771
+ while (1) switch (_context34.prev = _context34.next) {
6746
7772
  case 0:
6747
7773
  this.checkMediaConnection();
6748
7774
  promises = [];
@@ -6773,7 +7799,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6773
7799
  if (!this.isMultistream) {
6774
7800
  promises.push(this.updateTranscodedMediaConnection());
6775
7801
  }
6776
- _context22.next = 7;
7802
+ _context34.next = 7;
6777
7803
  return _promise.default.all(promises);
6778
7804
  case 7:
6779
7805
  // we're allowing for the SDK to support just audio share as well
@@ -6782,21 +7808,108 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6782
7808
  if (!this.mediaProperties.hasLocalShareStream()) {
6783
7809
  try {
6784
7810
  this.releaseScreenShareFloor(); // we ignore the returned promise here on purpose
7811
+
7812
+ this.statsAnalyzer.updateMediaStatus({
7813
+ expected: {
7814
+ sendShare: false
7815
+ }
7816
+ });
6785
7817
  } catch (e) {
6786
7818
  // nothing to do here, error is logged already inside releaseScreenShareFloor()
6787
7819
  }
6788
7820
  }
6789
7821
  case 8:
6790
7822
  case "end":
6791
- return _context22.stop();
7823
+ return _context34.stop();
6792
7824
  }
6793
- }, _callee22, this);
7825
+ }, _callee34, this);
6794
7826
  }));
6795
- function unpublishStreams(_x20) {
7827
+ function unpublishStreams(_x34) {
6796
7828
  return _unpublishStreams.apply(this, arguments);
6797
7829
  }
6798
7830
  return unpublishStreams;
6799
7831
  }()
7832
+ /**
7833
+ * Gets permission token expiry information including timeLeft, expiryTime, currentTime
7834
+ * (from the time the function has been fired)
7835
+ *
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
7840
+ */
7841
+ }, {
7842
+ key: "getPermissionTokenExpiryInfo",
7843
+ value: function getPermissionTokenExpiryInfo() {
7844
+ if (!this.permissionTokenPayload) {
7845
+ return undefined;
7846
+ }
7847
+ var permissionTokenExpiryFromServer = Number(this.permissionTokenPayload.exp);
7848
+ var permissionTokenIssuedTimeFromServer = Number(this.permissionTokenPayload.iat);
7849
+ var shiftInTime = this.permissionTokenReceivedLocalTime - permissionTokenIssuedTimeFromServer;
7850
+
7851
+ // using new Date instead of Date.now() to allow for accurate unit testing
7852
+ // https://github.com/sinonjs/fake-timers/issues/321
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
+ }
7864
+
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();
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
+ }()
6800
7913
  }]);
6801
7914
  return Meeting;
6802
7915
  }(_webexCore.StatelessWebexPlugin);