@webex/plugin-meetings 3.8.0-next.8 → 3.8.0-web-workers-keepalive.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 (64) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/config.js +1 -0
  4. package/dist/config.js.map +1 -1
  5. package/dist/interpretation/index.js +1 -1
  6. package/dist/interpretation/siLanguage.js +1 -1
  7. package/dist/locus-info/controlsUtils.js +1 -1
  8. package/dist/locus-info/controlsUtils.js.map +1 -1
  9. package/dist/meeting/index.js +51 -5
  10. package/dist/meeting/index.js.map +1 -1
  11. package/dist/meeting/util.js +4 -1
  12. package/dist/meeting/util.js.map +1 -1
  13. package/dist/meeting-info/meeting-info-v2.js +359 -60
  14. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  15. package/dist/meetings/index.js +60 -1
  16. package/dist/meetings/index.js.map +1 -1
  17. package/dist/member/index.js +10 -0
  18. package/dist/member/index.js.map +1 -1
  19. package/dist/member/util.js +3 -0
  20. package/dist/member/util.js.map +1 -1
  21. package/dist/metrics/constants.js +9 -0
  22. package/dist/metrics/constants.js.map +1 -1
  23. package/dist/reachability/clusterReachability.js +52 -8
  24. package/dist/reachability/clusterReachability.js.map +1 -1
  25. package/dist/reachability/index.js +70 -45
  26. package/dist/reachability/index.js.map +1 -1
  27. package/dist/reachability/reachability.types.js +14 -0
  28. package/dist/reachability/reachability.types.js.map +1 -1
  29. package/dist/reachability/request.js +19 -3
  30. package/dist/reachability/request.js.map +1 -1
  31. package/dist/types/config.d.ts +1 -0
  32. package/dist/types/meeting/index.d.ts +8 -0
  33. package/dist/types/meeting-info/meeting-info-v2.d.ts +80 -0
  34. package/dist/types/meetings/index.d.ts +29 -0
  35. package/dist/types/member/index.d.ts +1 -0
  36. package/dist/types/metrics/constants.d.ts +9 -0
  37. package/dist/types/reachability/clusterReachability.d.ts +13 -1
  38. package/dist/types/reachability/index.d.ts +2 -1
  39. package/dist/types/reachability/reachability.types.d.ts +5 -0
  40. package/dist/webinar/index.js +1 -1
  41. package/package.json +22 -22
  42. package/src/config.ts +1 -0
  43. package/src/locus-info/controlsUtils.ts +2 -2
  44. package/src/meeting/index.ts +51 -7
  45. package/src/meeting/util.ts +2 -1
  46. package/src/meeting-info/meeting-info-v2.ts +247 -6
  47. package/src/meetings/index.ts +72 -1
  48. package/src/member/index.ts +11 -0
  49. package/src/member/util.ts +3 -0
  50. package/src/metrics/constants.ts +9 -0
  51. package/src/reachability/clusterReachability.ts +47 -1
  52. package/src/reachability/index.ts +15 -0
  53. package/src/reachability/reachability.types.ts +6 -0
  54. package/src/reachability/request.ts +7 -0
  55. package/test/unit/spec/locus-info/controlsUtils.js +8 -0
  56. package/test/unit/spec/meeting/index.js +62 -4
  57. package/test/unit/spec/meeting/utils.js +55 -0
  58. package/test/unit/spec/meeting-info/meetinginfov2.js +443 -114
  59. package/test/unit/spec/meetings/index.js +78 -1
  60. package/test/unit/spec/member/index.js +7 -0
  61. package/test/unit/spec/member/util.js +24 -0
  62. package/test/unit/spec/reachability/clusterReachability.ts +47 -1
  63. package/test/unit/spec/reachability/index.ts +12 -0
  64. package/test/unit/spec/reachability/request.js +47 -2
@@ -16,6 +16,9 @@ const CAPTCHA_ERROR_DEFAULT_MESSAGE =
16
16
  'Captcha required. Call fetchMeetingInfo() with captchaInfo argument';
17
17
  const ADHOC_MEETING_DEFAULT_ERROR =
18
18
  'Failed starting the adhoc meeting, Please contact support team ';
19
+ const MEETING_IS_IN_PROGRESS_MESSAGE = 'Meeting is in progress';
20
+ const STATIC_MEETING_LINK_ALREADY_EXISTS_MESSAGE = 'Static meeting link already exists';
21
+ const FETCH_STATIC_MEETING_LINK = 'Meeting link does not exists for conversation';
19
22
  const CAPTCHA_ERROR_REQUIRES_PASSWORD_CODES = [423005, 423006];
20
23
  const CAPTCHA_ERROR_REQUIRES_REGISTRATION_ID_CODES = [423007];
21
24
 
@@ -193,6 +196,77 @@ export class MeetingInfoV2JoinForbiddenError extends Error {
193
196
  }
194
197
  }
195
198
 
199
+ /**
200
+ * Error fetching static link for a conversation when it does not exist
201
+ */
202
+ export class MeetingInfoV2StaticLinkDoesNotExistError extends Error {
203
+ sdkMessage: any;
204
+ wbxAppApiCode: any;
205
+ body: any;
206
+ /**
207
+ *
208
+ * @constructor
209
+ * @param {Number} [wbxAppApiErrorCode]
210
+ * @param {String} [message]
211
+ */
212
+ constructor(wbxAppApiErrorCode?: number, message: string = FETCH_STATIC_MEETING_LINK) {
213
+ super(`${message}, code=${wbxAppApiErrorCode}`);
214
+ this.name = 'MeetingInfoV2StaticLinkDoesNotExistError';
215
+ this.sdkMessage = message;
216
+ this.stack = new Error().stack;
217
+ this.wbxAppApiCode = wbxAppApiErrorCode;
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Error enabling/disabling static meeting link
223
+ */
224
+ export class MeetingInfoV2MeetingIsInProgressError extends Error {
225
+ sdkMessage: any;
226
+ wbxAppApiCode: any;
227
+ body: any;
228
+ /**
229
+ *
230
+ * @constructor
231
+ * @param {Number} [wbxAppApiErrorCode]
232
+ * @param {String} [message]
233
+ * @param {Boolean} [enable]
234
+ */
235
+ constructor(
236
+ wbxAppApiErrorCode?: number,
237
+ message = MEETING_IS_IN_PROGRESS_MESSAGE,
238
+ enable = false
239
+ ) {
240
+ super(`${message}, code=${wbxAppApiErrorCode}, enable=${enable}`);
241
+ this.name = 'MeetingInfoV2MeetingIsInProgressError';
242
+ this.sdkMessage = message;
243
+ this.stack = new Error().stack;
244
+ this.wbxAppApiCode = wbxAppApiErrorCode;
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Error enabling/disabling static meeting link
250
+ */
251
+ export class MeetingInfoV2StaticMeetingLinkAlreadyExists extends Error {
252
+ sdkMessage: any;
253
+ wbxAppApiCode: any;
254
+ body: any;
255
+ /**
256
+ *
257
+ * @constructor
258
+ * @param {Number} [wbxAppApiErrorCode]
259
+ * @param {String} [message]
260
+ */
261
+ constructor(wbxAppApiErrorCode?: number, message = STATIC_MEETING_LINK_ALREADY_EXISTS_MESSAGE) {
262
+ super(`${message}, code=${wbxAppApiErrorCode}`);
263
+ this.name = 'MeetingInfoV2StaticMeetingLinkAlreadyExists';
264
+ this.sdkMessage = message;
265
+ this.stack = new Error().stack;
266
+ this.wbxAppApiCode = wbxAppApiErrorCode;
267
+ }
268
+ }
269
+
196
270
  /**
197
271
  * @class MeetingInfo
198
272
  */
@@ -293,17 +367,20 @@ export default class MeetingInfoV2 {
293
367
  };
294
368
 
295
369
  /**
296
- * Creates adhoc space meetings for a space by fetching the conversation infomation
370
+ * helper function to either create an adhoc space meeting or enable static meeting link
297
371
  * @param {String} conversationUrl conversationUrl to start adhoc meeting on
298
372
  * @param {String} installedOrgID org ID of user's machine
373
+ * @param {Boolean} enableStaticMeetingLink whether or not to enable static meeting link
299
374
  * @returns {Promise} returns a meeting info object
300
375
  * @public
301
376
  * @memberof MeetingInfo
302
377
  */
303
- async createAdhocSpaceMeeting(conversationUrl: string, installedOrgID?: string) {
304
- if (!this.webex.meetings.preferredWebexSite) {
305
- throw Error('No preferred webex site found');
306
- }
378
+ async createAdhocSpaceMeetingOrEnableStaticMeetingLink(
379
+ conversationUrl: string,
380
+ installedOrgID?: string,
381
+ // setting this to true enables static meeting link
382
+ enableStaticMeetingLink = false
383
+ ) {
307
384
  const getInvitees = (particpants = []) => {
308
385
  const invitees = [];
309
386
 
@@ -329,6 +406,7 @@ export default class MeetingInfoV2 {
329
406
  kroUrl: conversation.kmsResourceObjectUrl,
330
407
  invitees: getInvitees(conversation.participants?.items),
331
408
  installedOrgID,
409
+ schedule: enableStaticMeetingLink,
332
410
  };
333
411
 
334
412
  if (installedOrgID) {
@@ -344,7 +422,23 @@ export default class MeetingInfoV2 {
344
422
  uri,
345
423
  body,
346
424
  });
347
- })
425
+ });
426
+ }
427
+
428
+ /**
429
+ * Creates adhoc space meetings for a space by fetching the conversation infomation
430
+ * @param {String} conversationUrl conversationUrl to start adhoc meeting on
431
+ * @param {String} installedOrgID org ID of user's machine
432
+ * @returns {Promise} returns a meeting info object
433
+ * @public
434
+ * @memberof MeetingInfo
435
+ */
436
+ async createAdhocSpaceMeeting(conversationUrl: string, installedOrgID?: string) {
437
+ if (!this.webex.meetings.preferredWebexSite) {
438
+ throw Error('No preferred webex site found');
439
+ }
440
+
441
+ return this.createAdhocSpaceMeetingOrEnableStaticMeetingLink(conversationUrl, installedOrgID)
348
442
  .then((requestResult) => {
349
443
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ADHOC_MEETING_SUCCESS);
350
444
 
@@ -363,6 +457,153 @@ export default class MeetingInfoV2 {
363
457
  });
364
458
  }
365
459
 
460
+ /**
461
+ * Fetches details for static meeting link
462
+ * @param {String} conversationUrl conversationUrl that's required to find static meeting link if it exists
463
+ * @returns {Promise} returns a Promise
464
+ * @public
465
+ * @memberof MeetingInfo
466
+ */
467
+ async fetchStaticMeetingLink(conversationUrl: string) {
468
+ if (!this.webex.meetings.preferredWebexSite) {
469
+ throw Error('No preferred webex site found');
470
+ }
471
+
472
+ const body = {
473
+ spaceUrl: conversationUrl,
474
+ };
475
+
476
+ const uri = this.webex.meetings.preferredWebexSite
477
+ ? `https://${this.webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant/query`
478
+ : '';
479
+
480
+ return this.webex
481
+ .request({
482
+ method: HTTP_VERBS.POST,
483
+ uri,
484
+ body,
485
+ })
486
+ .then((requestResult) => {
487
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.FETCH_STATIC_MEETING_LINK_SUCCESS);
488
+
489
+ return requestResult;
490
+ })
491
+ .catch((err) => {
492
+ if (err?.statusCode === 403) {
493
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEETING_LINK_DOES_NOT_EXIST_ERROR, {
494
+ reason: err.message,
495
+ stack: err.stack,
496
+ });
497
+
498
+ throw new MeetingInfoV2StaticLinkDoesNotExistError(err.body?.code, err.body?.message);
499
+ }
500
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.FETCH_STATIC_MEETING_LINK_FAILURE, {
501
+ reason: err.message,
502
+ stack: err.stack,
503
+ });
504
+
505
+ throw err;
506
+ });
507
+ }
508
+
509
+ /**
510
+ * Enables static meeting link
511
+ * @param {String} conversationUrl conversationUrl that's required to enable static meeting link
512
+ * @returns {Promise} returns a Promise
513
+ * @public
514
+ * @memberof MeetingInfo
515
+ */
516
+ async enableStaticMeetingLink(conversationUrl: string) {
517
+ if (!this.webex.meetings.preferredWebexSite) {
518
+ throw Error('No preferred webex site found');
519
+ }
520
+
521
+ return this.createAdhocSpaceMeetingOrEnableStaticMeetingLink(conversationUrl, undefined, true)
522
+ .then((requestResult) => {
523
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ENABLE_STATIC_METTING_LINK_SUCCESS);
524
+
525
+ return requestResult;
526
+ })
527
+ .catch((err) => {
528
+ if (err?.statusCode === 403) {
529
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEETING_IS_IN_PROGRESS_ERROR, {
530
+ reason: err.message,
531
+ stack: err.stack,
532
+ });
533
+
534
+ throw new MeetingInfoV2MeetingIsInProgressError(err.body?.code, err.body?.message, true);
535
+ }
536
+
537
+ if (err?.statusCode === 409) {
538
+ Metrics.sendBehavioralMetric(
539
+ BEHAVIORAL_METRICS.STATIC_MEETING_LINK_ALREADY_EXISTS_ERROR,
540
+ {
541
+ reason: err.message,
542
+ stack: err.stack,
543
+ }
544
+ );
545
+
546
+ throw new MeetingInfoV2StaticMeetingLinkAlreadyExists(err.body?.code, err.body?.message);
547
+ }
548
+
549
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ENABLE_STATIC_METTING_LINK_FAILURE, {
550
+ reason: err.message,
551
+ stack: err.stack,
552
+ });
553
+
554
+ throw err;
555
+ });
556
+ }
557
+
558
+ /**
559
+ * Disables static meeting link for given conversation url
560
+ * @param {String} conversationUrl conversationUrl that's required to disable static meeting link if it exists
561
+ * @returns {Promise} returns a Promise
562
+ * @public
563
+ * @memberof MeetingInfo
564
+ */
565
+ async disableStaticMeetingLink(conversationUrl: string) {
566
+ if (!this.webex.meetings.preferredWebexSite) {
567
+ throw Error('No preferred webex site found');
568
+ }
569
+
570
+ const body = {
571
+ spaceUrl: conversationUrl,
572
+ };
573
+
574
+ const uri = this.webex.meetings.preferredWebexSite
575
+ ? `https://${this.webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant/deletePersistentMeeting`
576
+ : '';
577
+
578
+ return this.webex
579
+ .request({
580
+ method: HTTP_VERBS.POST,
581
+ uri,
582
+ body,
583
+ })
584
+ .then((requestResult) => {
585
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DISABLE_STATIC_MEETING_LINK_SUCCESS);
586
+
587
+ return requestResult;
588
+ })
589
+ .catch((err) => {
590
+ if (err?.statusCode === 403) {
591
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEETING_IS_IN_PROGRESS_ERROR, {
592
+ reason: err.message,
593
+ stack: err.stack,
594
+ });
595
+
596
+ throw new MeetingInfoV2MeetingIsInProgressError(err.body?.code, err.body?.message);
597
+ }
598
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DISABLE_STATIC_MEETING_LINK_FAILURE, {
599
+ reason: err.message,
600
+ stack: err.stack,
601
+ });
602
+
603
+ throw err;
604
+ });
605
+ }
606
+
366
607
  /**
367
608
  * Fetches meeting info from the server
368
609
  * @param {String} destination one of many different types of destinations to look up info for
@@ -854,7 +854,7 @@ export default class Meetings extends WebexPlugin {
854
854
  this.executeRegistrationStep(
855
855
  () =>
856
856
  this.startReachability('registration').catch((error) => {
857
- LoggerProxy.logger.error(`Meetings:index#register --> GDM error, ${error.message}`);
857
+ LoggerProxy.logger.warn(`Meetings:index#register --> startReachability failed:`, error);
858
858
  }),
859
859
  'startReachability'
860
860
  ),
@@ -1217,6 +1217,29 @@ export default class Meetings extends WebexPlugin {
1217
1217
  );
1218
1218
  }
1219
1219
 
1220
+ /**
1221
+ * Fetch static meeting link for given conversation url.
1222
+ *
1223
+ * @param {string} conversationUrl - url for conversation
1224
+ * @returns {Promise}
1225
+ * @public
1226
+ * @memberof Meetings
1227
+ */
1228
+ public fetchStaticMeetingLink(conversationUrl: string): Promise<any> {
1229
+ return (
1230
+ this.meetingInfo
1231
+ .fetchStaticMeetingLink(conversationUrl)
1232
+ // Catch a failure to fetch static meeting link.
1233
+ .catch((error) => {
1234
+ LoggerProxy.logger.error(
1235
+ `Meetings:index#fetchStaticMeetingLink --> ERROR, unable to fetch persistent meeting link: ${error.message}`
1236
+ );
1237
+
1238
+ return Promise.reject(error);
1239
+ })
1240
+ );
1241
+ }
1242
+
1220
1243
  /**
1221
1244
  * Create a meeting or return an existing meeting.
1222
1245
  *
@@ -1369,6 +1392,54 @@ export default class Meetings extends WebexPlugin {
1369
1392
  );
1370
1393
  }
1371
1394
 
1395
+ /**
1396
+ * Enable static meeting links for given conversation url.
1397
+ *
1398
+ *
1399
+ * @param {string} conversationUrl - url for conversation
1400
+ * @returns {Promise}
1401
+ * @public
1402
+ * @memberof Meetings
1403
+ */
1404
+ public enableStaticMeetingLink(conversationUrl: string): Promise<any> {
1405
+ return (
1406
+ this.meetingInfo
1407
+ .enableStaticMeetingLink(conversationUrl)
1408
+ // Catch a failure to enable static meeting link.
1409
+ .catch((error) => {
1410
+ LoggerProxy.logger.error(
1411
+ `Meetings:index#enableStaticMeetingLink --> ERROR, unable to enable static meeting link: ${error.message}`
1412
+ );
1413
+
1414
+ return Promise.reject(error);
1415
+ })
1416
+ );
1417
+ }
1418
+
1419
+ /**
1420
+ * Disable static meeting links for given conversation url.
1421
+ *
1422
+ *
1423
+ * @param {string} conversationUrl - url for conversation
1424
+ * @returns {Promise}
1425
+ * @public
1426
+ * @memberof Meetings
1427
+ */
1428
+ public disableStaticMeetingLink(conversationUrl: string): Promise<any> {
1429
+ return (
1430
+ this.meetingInfo
1431
+ .disableStaticMeetingLink(conversationUrl)
1432
+ // Catch a failure to disable static meeting link.
1433
+ .catch((error) => {
1434
+ LoggerProxy.logger.error(
1435
+ `Meetings:index#disableStaticMeetingLink --> ERROR, unable to disable static meeting link: ${error.message}`
1436
+ );
1437
+
1438
+ return Promise.reject(error);
1439
+ })
1440
+ );
1441
+ }
1442
+
1372
1443
  /**
1373
1444
  * Create meeting
1374
1445
  *
@@ -23,6 +23,7 @@ export default class Member {
23
23
  isInMeeting: any;
24
24
  isModerator: any;
25
25
  isModeratorAssignmentProhibited: any;
26
+ isPresenterAssignmentProhibited: any;
26
27
  isMutable: any;
27
28
  isNotAdmitted: any;
28
29
  isRecording: any;
@@ -257,6 +258,14 @@ export default class Member {
257
258
  */
258
259
  this.isModeratorAssignmentProhibited = null;
259
260
 
261
+ /**
262
+ * @instance
263
+ * @type {Boolean}
264
+ * @public
265
+ * @memberof Member
266
+ */
267
+ this.isPresenterAssignmentProhibited = null;
268
+
260
269
  /**
261
270
  * @instance
262
271
  * @type {IExternalRoles}
@@ -309,6 +318,8 @@ export default class Member {
309
318
  this.isModerator = MemberUtil.isModerator(participant);
310
319
  this.isModeratorAssignmentProhibited =
311
320
  MemberUtil.isModeratorAssignmentProhibited(participant);
321
+ this.isPresenterAssignmentProhibited =
322
+ MemberUtil.isPresenterAssignmentProhibited(participant);
312
323
  this.processStatus(participant);
313
324
  this.processRoles(participant as ParticipantWithRoles);
314
325
  // must be done last
@@ -127,6 +127,9 @@ MemberUtil.isDevice = (participant: any) => participant && participant.type ===
127
127
  MemberUtil.isModeratorAssignmentProhibited = (participant) =>
128
128
  participant && participant.moderatorAssignmentNotAllowed;
129
129
 
130
+ MemberUtil.isPresenterAssignmentProhibited = (participant) =>
131
+ participant && participant.presenterAssignmentNotAllowed;
132
+
130
133
  /**
131
134
  * checks to see if the participant id is the same as the passed id
132
135
  * there are multiple ids that can be used
@@ -48,10 +48,19 @@ const BEHAVIORAL_METRICS = {
48
48
  UPLOAD_LOGS_FAILURE: 'js_sdk_upload_logs_failure',
49
49
  UPLOAD_LOGS_SUCCESS: 'js_sdk_upload_logs_success',
50
50
  RECEIVE_TRANSCRIPTION_FAILURE: 'js_sdk_receive_transcription_failure',
51
+ MEETING_IS_IN_PROGRESS_ERROR: 'js_sdk_meeting_is_in_progress_error',
52
+ STATIC_MEETING_LINK_ALREADY_EXISTS_ERROR: 'js_sdk_static_meeting_link_already_exists_error',
51
53
  FETCH_MEETING_INFO_V1_SUCCESS: 'js_sdk_fetch_meeting_info_v1_success',
52
54
  FETCH_MEETING_INFO_V1_FAILURE: 'js_sdk_fetch_meeting_info_v1_failure',
55
+ ENABLE_STATIC_METTING_LINK_SUCCESS: 'js_sdk_enable_static_meeting_link_success',
56
+ ENABLE_STATIC_METTING_LINK_FAILURE: 'js_sdk_enable_static_meeting_link_failure',
57
+ DISABLE_STATIC_MEETING_LINK_SUCCESS: 'js_sdk_disable_static_meeting_link_success',
58
+ DISABLE_STATIC_MEETING_LINK_FAILURE: 'js_sdk_disable_static_meeting_link_failure',
53
59
  ADHOC_MEETING_SUCCESS: 'js_sdk_adhoc_meeting_success',
54
60
  ADHOC_MEETING_FAILURE: 'js_sdk_adhoc_meeting_failure',
61
+ FETCH_STATIC_MEETING_LINK_SUCCESS: 'js_sdk_fetch_static_meeting_link_success',
62
+ FETCH_STATIC_MEETING_LINK_FAILURE: 'js_sdk_fetch_static_meeting_link_failure',
63
+ MEETING_LINK_DOES_NOT_EXIST_ERROR: 'js_sdk_meeting_link_does_not_exist_error',
55
64
  VERIFY_PASSWORD_SUCCESS: 'js_sdk_verify_password_success',
56
65
  VERIFY_PASSWORD_ERROR: 'js_sdk_verify_password_error',
57
66
  VERIFY_CAPTCHA_ERROR: 'js_sdk_verify_captcha_error',
@@ -6,7 +6,7 @@ import {convertStunUrlToTurn, convertStunUrlToTurnTls} from './util';
6
6
  import EventsScope from '../common/events/events-scope';
7
7
 
8
8
  import {CONNECTION_STATE, Enum, ICE_GATHERING_STATE} from '../constants';
9
- import {ClusterReachabilityResult} from './reachability.types';
9
+ import {ClusterReachabilityResult, NatType} from './reachability.types';
10
10
 
11
11
  // data for the Events.resultReady event
12
12
  export type ResultEventData = {
@@ -22,9 +22,14 @@ export type ClientMediaIpsUpdatedEventData = {
22
22
  clientMediaIPs: string[];
23
23
  };
24
24
 
25
+ export type NatTypeUpdatedEventData = {
26
+ natType: NatType;
27
+ };
28
+
25
29
  export const Events = {
26
30
  resultReady: 'resultReady', // emitted when a cluster is reached successfully using specific protocol
27
31
  clientMediaIpsUpdated: 'clientMediaIpsUpdated', // emitted when more public IPs are found after resultReady was already sent for a given protocol
32
+ natTypeUpdated: 'natTypeUpdated', // emitted when NAT type is determined
28
33
  } as const;
29
34
 
30
35
  export type Events = Enum<typeof Events>;
@@ -41,6 +46,7 @@ export class ClusterReachability extends EventsScope {
41
46
  private pc?: RTCPeerConnection;
42
47
  private defer: Defer; // this defer is resolved once reachability checks for this cluster are completed
43
48
  private startTimestamp: number;
49
+ private srflxIceCandidates: RTCIceCandidate[] = [];
44
50
  public readonly isVideoMesh: boolean;
45
51
  public readonly name;
46
52
 
@@ -290,6 +296,44 @@ export class ClusterReachability extends EventsScope {
290
296
  }
291
297
  }
292
298
 
299
+ /**
300
+ * Determines NAT Type.
301
+ *
302
+ * @param {RTCIceCandidate} candidate
303
+ * @returns {void}
304
+ */
305
+ private determineNatType(candidate: RTCIceCandidate) {
306
+ this.srflxIceCandidates.push(candidate);
307
+
308
+ if (this.srflxIceCandidates.length > 1) {
309
+ const portsFound: Record<string, Set<number>> = {};
310
+
311
+ this.srflxIceCandidates.forEach((c) => {
312
+ const key = `${c.address}:${c.relatedPort}`;
313
+ if (!portsFound[key]) {
314
+ portsFound[key] = new Set();
315
+ }
316
+ portsFound[key].add(c.port);
317
+ });
318
+
319
+ Object.entries(portsFound).forEach(([, ports]) => {
320
+ if (ports.size > 1) {
321
+ // Found candidates with the same address and relatedPort, but different ports
322
+ this.emit(
323
+ {
324
+ file: 'clusterReachability',
325
+ function: 'determineNatType',
326
+ },
327
+ Events.natTypeUpdated,
328
+ {
329
+ natType: NatType.SymmetricNat,
330
+ }
331
+ );
332
+ }
333
+ });
334
+ }
335
+ }
336
+
293
337
  /**
294
338
  * Registers a listener for the icecandidate event
295
339
  *
@@ -308,6 +352,8 @@ export class ClusterReachability extends EventsScope {
308
352
  if (e.candidate) {
309
353
  if (e.candidate.type === CANDIDATE_TYPES.SERVER_REFLEXIVE) {
310
354
  this.saveResult('udp', latencyInMilliseconds, e.candidate.address);
355
+
356
+ this.determineNatType(e.candidate);
311
357
  }
312
358
 
313
359
  if (e.candidate.type === CANDIDATE_TYPES.RELAY) {
@@ -23,11 +23,13 @@ import {
23
23
  ReachabilityResultsForBackend,
24
24
  TransportResultForBackend,
25
25
  GetClustersTrigger,
26
+ NatType,
26
27
  } from './reachability.types';
27
28
  import {
28
29
  ClientMediaIpsUpdatedEventData,
29
30
  ClusterReachability,
30
31
  Events,
32
+ NatTypeUpdatedEventData,
31
33
  ResultEventData,
32
34
  } from './clusterReachability';
33
35
  import EventsScope from '../common/events/events-scope';
@@ -64,6 +66,7 @@ export default class Reachability extends EventsScope {
64
66
  resultsCount = {videoMesh: {udp: 0}, public: {udp: 0, tcp: 0, xtls: 0}};
65
67
  startTime = undefined;
66
68
  totalDuration = undefined;
69
+ natType = NatType.Unknown;
67
70
 
68
71
  protected lastTrigger?: string;
69
72
 
@@ -143,6 +146,10 @@ export default class Reachability extends EventsScope {
143
146
  * @memberof Reachability
144
147
  */
145
148
  public async gatherReachability(trigger: string): Promise<ReachabilityResults> {
149
+ // @ts-ignore
150
+ if (!this.webex.config.meetings.enableReachabilityChecks) {
151
+ throw new Error('enableReachabilityChecks is disabled in config');
152
+ }
146
153
  // Fetch clusters and measure latency
147
154
  try {
148
155
  this.lastTrigger = trigger;
@@ -305,6 +312,7 @@ export default class Reachability extends EventsScope {
305
312
  reachability_vmn_tcp_failed: 0,
306
313
  reachability_vmn_xtls_success: 0,
307
314
  reachability_vmn_xtls_failed: 0,
315
+ natType: this.natType,
308
316
  };
309
317
 
310
318
  const updateStats = (clusterType: 'public' | 'vmn', result: ClusterReachabilityResult) => {
@@ -963,6 +971,13 @@ export default class Reachability extends EventsScope {
963
971
  }
964
972
  );
965
973
 
974
+ this.clusterReachability[key].on(
975
+ Events.natTypeUpdated,
976
+ async (data: NatTypeUpdatedEventData) => {
977
+ this.natType = data.natType;
978
+ }
979
+ );
980
+
966
981
  this.clusterReachability[key].start(); // not awaiting on purpose
967
982
  });
968
983
  }
@@ -7,6 +7,11 @@ export type TransportResult = {
7
7
  clientMediaIPs?: string[];
8
8
  };
9
9
 
10
+ export enum NatType {
11
+ Unknown = 'unknown',
12
+ SymmetricNat = 'symmetric-nat',
13
+ }
14
+
10
15
  // reachability result for a specific media cluster
11
16
  export type ClusterReachabilityResult = {
12
17
  udp: TransportResult;
@@ -27,6 +32,7 @@ export type ReachabilityMetrics = {
27
32
  reachability_vmn_tcp_failed: number;
28
33
  reachability_vmn_xtls_success: number;
29
34
  reachability_vmn_xtls_failed: number;
35
+ natType: NatType;
30
36
  };
31
37
 
32
38
  /**
@@ -45,6 +45,9 @@ class ReachabilityRequest {
45
45
  joinCookie: any;
46
46
  discoveryOptions?: Record<string, any>;
47
47
  }> => {
48
+ const appType = this.webex?.config?.support?.appType;
49
+ const appVersion = this.webex?.config?.support?.appVersion;
50
+
48
51
  // we only measure latency for the initial startup call, not for other triggers
49
52
  const callWrapper =
50
53
  trigger === 'startup'
@@ -67,6 +70,10 @@ class ReachabilityRequest {
67
70
  'early-call-min-clusters': true,
68
71
  },
69
72
  'previous-report': previousReport,
73
+ ...(appType &&
74
+ appVersion && {
75
+ 'client-environment': {components: {[appType]: appVersion}},
76
+ }),
70
77
  trigger,
71
78
  },
72
79
  timeout: this.webex.config.meetings.reachabilityGetClusterTimeout,
@@ -269,6 +269,14 @@ describe('plugin-meetings', () => {
269
269
  assert.equal(updates.hasPracticeSessionEnabledChanged, true);
270
270
  });
271
271
 
272
+ it('returns hasPracticeSessionEnabledChanged = false when enabled is false and previous state is false', () => {
273
+ const newControls = {practiceSession: {enabled: false}};
274
+
275
+ const {updates} = ControlsUtils.getControls(defaultControls, newControls);
276
+
277
+ assert.equal(updates.hasPracticeSessionEnabledChanged, false);
278
+ });
279
+
272
280
  it('returns hasEntryExitToneChanged = true when mode changed', () => {
273
281
  const newControls = {
274
282
  entryExitTone: {