@webex/plugin-meetings 3.3.1 → 3.4.0-next.10

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 (138) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +7 -2
  3. package/dist/breakouts/index.js.map +1 -1
  4. package/dist/constants.js +11 -4
  5. package/dist/constants.js.map +1 -1
  6. package/dist/interpretation/index.js +1 -1
  7. package/dist/interpretation/siLanguage.js +1 -1
  8. package/dist/locus-info/selfUtils.js +0 -5
  9. package/dist/locus-info/selfUtils.js.map +1 -1
  10. package/dist/media/MediaConnectionAwaiter.js +70 -15
  11. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  12. package/dist/media/index.js +18 -9
  13. package/dist/media/index.js.map +1 -1
  14. package/dist/meeting/connectionStateHandler.js +67 -0
  15. package/dist/meeting/connectionStateHandler.js.map +1 -0
  16. package/dist/meeting/index.js +576 -374
  17. package/dist/meeting/index.js.map +1 -1
  18. package/dist/meeting/locusMediaRequest.js +7 -0
  19. package/dist/meeting/locusMediaRequest.js.map +1 -1
  20. package/dist/meeting/muteState.js +6 -1
  21. package/dist/meeting/muteState.js.map +1 -1
  22. package/dist/meeting/util.js +1 -0
  23. package/dist/meeting/util.js.map +1 -1
  24. package/dist/meeting-info/index.js +4 -4
  25. package/dist/meeting-info/index.js.map +1 -1
  26. package/dist/meeting-info/meeting-info-v2.js +2 -2
  27. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  28. package/dist/meeting-info/util.js +17 -17
  29. package/dist/meeting-info/util.js.map +1 -1
  30. package/dist/meeting-info/utilv2.js +16 -16
  31. package/dist/meeting-info/utilv2.js.map +1 -1
  32. package/dist/meetings/collection.js +1 -1
  33. package/dist/meetings/collection.js.map +1 -1
  34. package/dist/meetings/index.js +41 -35
  35. package/dist/meetings/index.js.map +1 -1
  36. package/dist/meetings/meetings.types.js +8 -0
  37. package/dist/meetings/meetings.types.js.map +1 -1
  38. package/dist/meetings/util.js +3 -2
  39. package/dist/meetings/util.js.map +1 -1
  40. package/dist/metrics/constants.js +2 -1
  41. package/dist/metrics/constants.js.map +1 -1
  42. package/dist/metrics/index.js +57 -0
  43. package/dist/metrics/index.js.map +1 -1
  44. package/dist/personal-meeting-room/index.js +1 -1
  45. package/dist/personal-meeting-room/index.js.map +1 -1
  46. package/dist/reachability/clusterReachability.js +108 -53
  47. package/dist/reachability/clusterReachability.js.map +1 -1
  48. package/dist/reachability/index.js +546 -115
  49. package/dist/reachability/index.js.map +1 -1
  50. package/dist/reconnection-manager/index.js +1 -1
  51. package/dist/reconnection-manager/index.js.map +1 -1
  52. package/dist/rtcMetrics/index.js +26 -6
  53. package/dist/rtcMetrics/index.js.map +1 -1
  54. package/dist/types/constants.d.ts +11 -3
  55. package/dist/types/media/MediaConnectionAwaiter.d.ts +24 -4
  56. package/dist/types/meeting/connectionStateHandler.d.ts +30 -0
  57. package/dist/types/meeting/index.d.ts +28 -8
  58. package/dist/types/meeting/locusMediaRequest.d.ts +2 -0
  59. package/dist/types/meeting-info/index.d.ts +3 -2
  60. package/dist/types/meeting-info/meeting-info-v2.d.ts +3 -2
  61. package/dist/types/meeting-info/util.d.ts +5 -4
  62. package/dist/types/meeting-info/utilv2.d.ts +3 -2
  63. package/dist/types/meetings/collection.d.ts +3 -2
  64. package/dist/types/meetings/index.d.ts +6 -4
  65. package/dist/types/meetings/meetings.types.d.ts +9 -0
  66. package/dist/types/metrics/constants.d.ts +1 -0
  67. package/dist/types/metrics/index.d.ts +15 -0
  68. package/dist/types/reachability/clusterReachability.d.ts +31 -3
  69. package/dist/types/reachability/index.d.ts +107 -4
  70. package/dist/types/rtcMetrics/index.d.ts +11 -1
  71. package/dist/webinar/index.js +1 -1
  72. package/package.json +23 -23
  73. package/src/breakouts/index.ts +7 -1
  74. package/src/constants.ts +13 -17
  75. package/src/locus-info/selfUtils.ts +0 -5
  76. package/src/media/MediaConnectionAwaiter.ts +89 -14
  77. package/src/media/index.ts +18 -9
  78. package/src/meeting/connectionStateHandler.ts +65 -0
  79. package/src/meeting/index.ts +541 -298
  80. package/src/meeting/locusMediaRequest.ts +5 -0
  81. package/src/meeting/muteState.ts +6 -1
  82. package/src/meeting/util.ts +1 -0
  83. package/src/meeting-info/index.ts +9 -6
  84. package/src/meeting-info/meeting-info-v2.ts +4 -4
  85. package/src/meeting-info/util.ts +23 -28
  86. package/src/meeting-info/utilv2.ts +18 -24
  87. package/src/meetings/collection.ts +3 -3
  88. package/src/meetings/index.ts +43 -43
  89. package/src/meetings/meetings.types.ts +11 -0
  90. package/src/meetings/util.ts +5 -4
  91. package/src/metrics/constants.ts +1 -0
  92. package/src/metrics/index.ts +44 -0
  93. package/src/personal-meeting-room/index.ts +2 -2
  94. package/src/reachability/clusterReachability.ts +86 -25
  95. package/src/reachability/index.ts +364 -30
  96. package/src/reconnection-manager/index.ts +1 -1
  97. package/src/rtcMetrics/index.ts +25 -5
  98. package/test/unit/spec/breakouts/index.ts +51 -32
  99. package/test/unit/spec/locus-info/selfUtils.js +25 -23
  100. package/test/unit/spec/media/MediaConnectionAwaiter.ts +131 -32
  101. package/test/unit/spec/media/index.ts +75 -34
  102. package/test/unit/spec/meeting/connectionStateHandler.ts +102 -0
  103. package/test/unit/spec/meeting/index.js +807 -185
  104. package/test/unit/spec/meeting/locusMediaRequest.ts +7 -0
  105. package/test/unit/spec/meeting/muteState.js +24 -0
  106. package/test/unit/spec/meeting-info/index.js +4 -4
  107. package/test/unit/spec/meeting-info/meetinginfov2.js +24 -28
  108. package/test/unit/spec/meeting-info/request.js +2 -2
  109. package/test/unit/spec/meeting-info/utilv2.js +41 -49
  110. package/test/unit/spec/meetings/index.js +44 -3
  111. package/test/unit/spec/metrics/index.js +126 -0
  112. package/test/unit/spec/multistream/mediaRequestManager.ts +2 -2
  113. package/test/unit/spec/personal-meeting-room/personal-meeting-room.js +2 -2
  114. package/test/unit/spec/reachability/clusterReachability.ts +116 -22
  115. package/test/unit/spec/reachability/index.ts +1398 -131
  116. package/test/unit/spec/rtcMetrics/index.ts +32 -0
  117. package/dist/mediaQualityMetrics/config.js +0 -321
  118. package/dist/mediaQualityMetrics/config.js.map +0 -1
  119. package/dist/networkQualityMonitor/index.js +0 -227
  120. package/dist/networkQualityMonitor/index.js.map +0 -1
  121. package/dist/statsAnalyzer/global.js +0 -44
  122. package/dist/statsAnalyzer/global.js.map +0 -1
  123. package/dist/statsAnalyzer/index.js +0 -1072
  124. package/dist/statsAnalyzer/index.js.map +0 -1
  125. package/dist/statsAnalyzer/mqaUtil.js +0 -368
  126. package/dist/statsAnalyzer/mqaUtil.js.map +0 -1
  127. package/dist/types/mediaQualityMetrics/config.d.ts +0 -247
  128. package/dist/types/networkQualityMonitor/index.d.ts +0 -70
  129. package/dist/types/statsAnalyzer/global.d.ts +0 -36
  130. package/dist/types/statsAnalyzer/index.d.ts +0 -217
  131. package/dist/types/statsAnalyzer/mqaUtil.d.ts +0 -48
  132. package/src/mediaQualityMetrics/config.ts +0 -255
  133. package/src/networkQualityMonitor/index.ts +0 -211
  134. package/src/statsAnalyzer/global.ts +0 -37
  135. package/src/statsAnalyzer/index.ts +0 -1318
  136. package/src/statsAnalyzer/mqaUtil.ts +0 -463
  137. package/test/unit/spec/networkQualityMonitor/index.js +0 -99
  138. package/test/unit/spec/stats-analyzer/index.js +0 -1819
@@ -9,8 +9,10 @@ export default class MediaConnectionAwaiter {
9
9
  private timer;
10
10
  private defer;
11
11
  private retried;
12
+ private iceConnected;
12
13
  private onTimeoutCallback;
13
- private connectionStateCallback;
14
+ private peerConnectionStateCallback;
15
+ private iceConnectionStateCallback;
14
16
  private iceGatheringStateCallback;
15
17
  /**
16
18
  * @param {MediaConnectionAwaiterProps} mediaConnectionAwaiterProps
@@ -22,6 +24,12 @@ export default class MediaConnectionAwaiter {
22
24
  * @returns {boolean}
23
25
  */
24
26
  private isConnected;
27
+ /**
28
+ * Returns true if the connection is in an unrecoverable "failed" state
29
+ *
30
+ * @returns {boolean}
31
+ */
32
+ private isFailed;
25
33
  /**
26
34
  * Returns true if the ICE Gathering is completed, false otherwise.
27
35
  *
@@ -35,17 +43,29 @@ export default class MediaConnectionAwaiter {
35
43
  */
36
44
  private clearCallbacks;
37
45
  /**
38
- * Listener for connection state change.
46
+ * On connection state change.
47
+ *
48
+ * @returns {void}
49
+ */
50
+ connectionStateChange(): void;
51
+ /**
52
+ * Listener for peer connection state change.
53
+ *
54
+ * @returns {void}
55
+ */
56
+ peerConnectionStateHandler(): void;
57
+ /**
58
+ * Listener for ICE connection state change.
39
59
  *
40
60
  * @returns {void}
41
61
  */
42
- connectionStateListenerCallback(): void;
62
+ iceConnectionStateHandler(): void;
43
63
  /**
44
64
  * Listener for ICE gathering state change.
45
65
  *
46
66
  * @returns {void}
47
67
  */
48
- iceGatheringStateListenerCallback(): void;
68
+ iceGatheringStateHandler(): void;
49
69
  /**
50
70
  * Function called when the timeout is reached.
51
71
  *
@@ -0,0 +1,30 @@
1
+ import { ConnectionState } from '@webex/internal-media-core';
2
+ import EventsScope from '../common/events/events-scope';
3
+ import { Enum } from '../constants';
4
+ export declare const ConnectionStateEvent: {
5
+ readonly stateChanged: "connectionState:changed";
6
+ };
7
+ export type ConnectionStateEvent = Enum<typeof ConnectionStateEvent>;
8
+ export interface ConnectionStateChangedEvent {
9
+ /**
10
+ * Current overall connection state
11
+ */
12
+ state: ConnectionState;
13
+ }
14
+ /**
15
+ * @class ConnectionStateHandler
16
+ */
17
+ export declare class ConnectionStateHandler extends EventsScope {
18
+ private webrtcMediaConnection;
19
+ private mediaConnectionState;
20
+ /**
21
+ * @param {WebRTCMeeting} webrtcMediaConnection
22
+ */
23
+ constructor(webrtcMediaConnection: any);
24
+ /**
25
+ * Handler for connection state change.
26
+ *
27
+ * @returns {void}
28
+ */
29
+ private handleConnectionStateChange;
30
+ }
@@ -2,17 +2,15 @@
2
2
  import { StatelessWebexPlugin } from '@webex/webex-core';
3
3
  import { ClientEvent, ClientEventLeaveReason } from '@webex/internal-plugin-metrics';
4
4
  import { ClientEvent as RawClientEvent } from '@webex/event-dictionary-ts';
5
- import { MediaType } from '@webex/internal-media-core';
5
+ import { MediaType, StatsAnalyzer, NetworkQualityMonitor } from '@webex/internal-media-core';
6
6
  import { LocalStream, LocalCameraStream, LocalDisplayStream, LocalSystemAudioStream, LocalMicrophoneStream } from '@webex/media-helpers';
7
- import { StatsAnalyzer } from '../statsAnalyzer';
8
- import NetworkQualityMonitor from '../networkQualityMonitor';
9
7
  import Roap, { type TurnServerInfo, type TurnDiscoverySkipReason } from '../roap/index';
10
8
  import { type BundlePolicy } from '../media';
11
9
  import MediaProperties from '../media/properties';
12
10
  import ReconnectionManager from '../reconnection-manager';
13
11
  import MeetingRequest from './request';
14
12
  import Members from '../members/index';
15
- import { NETWORK_STATUS } from '../constants';
13
+ import { DESTINATION_TYPE, NETWORK_STATUS } from '../constants';
16
14
  import { ReceiveSlotManager } from '../multistream/receiveSlotManager';
17
15
  import { MediaRequestManager } from '../multistream/mediaRequestManager';
18
16
  import { Configuration as RemoteMediaManagerConfiguration, RemoteMediaManager } from '../multistream/remoteMediaManager';
@@ -344,7 +342,7 @@ export default class Meeting extends StatelessWebexPlugin {
344
342
  conversationUrl: string;
345
343
  callStateForMetrics: CallStateForMetrics;
346
344
  destination: string;
347
- destinationType: string;
345
+ destinationType: DESTINATION_TYPE;
348
346
  deviceUrl: string;
349
347
  hostId: string;
350
348
  id: string;
@@ -450,12 +448,16 @@ export default class Meeting extends StatelessWebexPlugin {
450
448
  areVoiceaEventsSetup: boolean;
451
449
  isMoveToInProgress: boolean;
452
450
  voiceaListenerCallbacks: object;
453
- private retriedWithTurnServer;
451
+ private addMediaData;
454
452
  private sendSlotManager;
455
453
  private deferSDPAnswer?;
456
454
  private sdpResponseTimer?;
457
455
  private hasMediaConnectionConnectedAtLeastOnce;
458
456
  private joinWithMediaRetryInfo?;
457
+ private connectionStateHandler?;
458
+ private iceCandidateErrors;
459
+ private iceCandidatesCount;
460
+ private rtcMetrics?;
459
461
  /**
460
462
  * @param {Object} attrs
461
463
  * @param {Object} options
@@ -1369,16 +1371,34 @@ export default class Meeting extends StatelessWebexPlugin {
1369
1371
  * @returns {Promise<void>}
1370
1372
  */
1371
1373
  private cleanUpBeforeRetryWithTurnServer;
1374
+ /**
1375
+ * Creates an instance of LocusMediaRequest for this meeting - it is needed for doing any calls
1376
+ * to Locus /media API (these are used for sending Roap messages and updating audio/video mute status).
1377
+ *
1378
+ * @returns {void}
1379
+ */
1380
+ private setupLocusMediaRequest;
1372
1381
  /**
1373
1382
  * Creates a media connection to the server. Media connection is required for sending or receiving any audio/video.
1374
1383
  *
1375
1384
  * @param {AddMediaOptions} options
1376
- * @param {TurnServerInfo} turnServerInfo - TURN server information (used only internally by the SDK)
1377
1385
  * @returns {Promise<void>}
1378
1386
  * @public
1379
1387
  * @memberof Meeting
1380
1388
  */
1381
- addMedia(options?: AddMediaOptions, turnServerInfo?: TurnServerInfo): Promise<void>;
1389
+ addMedia(options?: AddMediaOptions): Promise<void>;
1390
+ /**
1391
+ * Internal version of addMedia() with some more arguments for finer control of its behavior
1392
+ *
1393
+ * @param {Function} icePhaseCallback - callback to determine the icePhase for CA "client.ice.end" failure events
1394
+ * @param {TurnServerInfo} turnServerInfo - TURN server information
1395
+ * @param {boolean} forceTurnDiscovery - if true, TURN discovery will be done
1396
+ * @param {AddMediaOptions} options - same as options of the public addMedia() method
1397
+ * @returns {Promise<void>}
1398
+ * @protected
1399
+ * @memberof Meeting
1400
+ */
1401
+ protected addMediaInternal(icePhaseCallback: () => string, turnServerInfo: TurnServerInfo, forceTurnDiscovery: any, options?: AddMediaOptions): Promise<void>;
1382
1402
  /**
1383
1403
  * Informs if the peer connection is in a state that can be updated with updateMedia (audio/video/share)
1384
1404
  * @returns {Boolean}
@@ -72,4 +72,6 @@ export declare class LocusMediaRequest extends WebexPlugin {
72
72
  * Sends a media request to Locus
73
73
  */
74
74
  send(request: Request): Promise<RequestResult>;
75
+ /** Returns true if a confluence on the server is already created */
76
+ isConfluenceCreated(): boolean;
75
77
  }
@@ -1,6 +1,7 @@
1
1
  /*!
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
+ import { DESTINATION_TYPE } from '../constants';
4
5
  /**
5
6
  * @class MeetingInfo
6
7
  */
@@ -48,7 +49,7 @@ export default class MeetingInfo {
48
49
  /**
49
50
  * Fetches meeting info from the server
50
51
  * @param {String} destination one of many different types of destinations to look up info for
51
- * @param {String} [type] to match up with the destination value
52
+ * @param {DESTINATION_TYPE} [type] to match up with the destination value
52
53
  * @param {String} [password] meeting password
53
54
  * @param {Object} [captchaInfo] captcha code and id
54
55
  * @param {String} [installedOrgID]
@@ -59,7 +60,7 @@ export default class MeetingInfo {
59
60
  * @public
60
61
  * @memberof MeetingInfo
61
62
  */
62
- fetchMeetingInfo(destination: string, type?: string, password?: string, captchaInfo?: {
63
+ fetchMeetingInfo(destination: string, type?: DESTINATION_TYPE, password?: string, captchaInfo?: {
63
64
  code: string;
64
65
  id: string;
65
66
  }, installedOrgID?: any, locusId?: any, extraParams?: object, options?: {
@@ -1,3 +1,4 @@
1
+ import { DESTINATION_TYPE } from '../constants';
1
2
  /**
2
3
  * Error to indicate that wbxappapi requires a password
3
4
  */
@@ -100,7 +101,7 @@ export default class MeetingInfoV2 {
100
101
  /**
101
102
  * Fetches meeting info from the server
102
103
  * @param {String} destination one of many different types of destinations to look up info for
103
- * @param {String} [type] to match up with the destination value
104
+ * @param {DESTINATION_TYPE} [type] to match up with the destination value
104
105
  * @param {String} password
105
106
  * @param {Object} captchaInfo
106
107
  * @param {String} captchaInfo.code
@@ -113,7 +114,7 @@ export default class MeetingInfoV2 {
113
114
  * @public
114
115
  * @memberof MeetingInfo
115
116
  */
116
- fetchMeetingInfo(destination: string, type?: string, password?: string, captchaInfo?: {
117
+ fetchMeetingInfo(destination: string, type?: DESTINATION_TYPE, password?: string, captchaInfo?: {
117
118
  code: string;
118
119
  id: string;
119
120
  }, installedOrgID?: any, locusId?: any, extraParams?: object, options?: {
@@ -1,10 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import url from 'url';
3
+ import { DESTINATION_TYPE } from '../constants';
3
4
  /**
4
5
  * @class MeetingInfoUtil
5
6
  */
6
7
  export default class MeetingInfoUtil {
7
- static extractDestination(destination: any, type: any): any;
8
+ static extractDestination(destination: any, type: DESTINATION_TYPE): any;
8
9
  static getParsedUrl(link: any): false | url.UrlWithStringQuery;
9
10
  /**
10
11
  * Helper function to check if a string matches a known meeting link pattern
@@ -36,14 +37,14 @@ export default class MeetingInfoUtil {
36
37
  static generateOptions(from: any): Promise<any>;
37
38
  /**
38
39
  * Helper function to build up a correct locus url depending on the value passed
39
- * @param {String} type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]
40
+ * @param {DESTINATION_TYPE} type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]
40
41
  * @param {Object} value ?? value.value
41
42
  * @returns {Object} returns an object with {resource, method}
42
43
  */
43
- static getResourceUrl(type: string, value: any): {
44
+ static getResourceUrl(type: DESTINATION_TYPE, value: any): {
44
45
  uri: any;
45
46
  resource: string;
46
47
  method: string;
47
48
  };
48
- static getRequestParams(resourceOptions: any, type: any, value: any, api: any): any;
49
+ static getRequestParams(resourceOptions: any, type: DESTINATION_TYPE, value: any, api: any): any;
49
50
  }
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import url from 'url';
3
+ import { DESTINATION_TYPE } from '../constants';
3
4
  /**
4
5
  * @class MeetingInfoUtil
5
6
  */
@@ -36,13 +37,13 @@ export default class MeetingInfoUtil {
36
37
  /**
37
38
  * Helper function to build up a correct locus url depending on the value passed
38
39
  * @param {Object} options type and value to fetch meeting info
39
- * @param {String} options.type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]
40
+ * @param {DESTINATION_TYPE} options.type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]
40
41
  * @param {String} options.installedOrgID org ID of user's machine
41
42
  * @param {Object} options.destination ?? value.value
42
43
  * @returns {Object} returns an object with {resource, method}
43
44
  */
44
45
  static getRequestBody(options: {
45
- type: string;
46
+ type: DESTINATION_TYPE;
46
47
  destination: object;
47
48
  } | any): any;
48
49
  /**
@@ -1,4 +1,5 @@
1
1
  import Collection from '../common/collection';
2
+ import { MEETING_KEY } from './meetings.types';
2
3
  /**
3
4
  * @export
4
5
  * @class MeetingCollection
@@ -13,13 +14,13 @@ export default class MeetingCollection extends Collection {
13
14
  set(meeting: any): any;
14
15
  /**
15
16
  * get a specific meeting searching for key
16
- * @param {String} key
17
+ * @param {MEETING_KEY} key
17
18
  * @param {Any} value
18
19
  * @returns {Meeting} if found, else returns null
19
20
  * @public
20
21
  * @memberof MeetingCollection
21
22
  */
22
- getByKey(key: string, value: any): any;
23
+ getByKey(key: MEETING_KEY, value: any): any;
23
24
  /**
24
25
  * get a specific meeting searching for key
25
26
  * @param {String} breakoutUrl
@@ -4,6 +4,7 @@ import '@webex/internal-plugin-metrics';
4
4
  import { WebexPlugin } from '@webex/webex-core';
5
5
  import * as mediaHelpersModule from '@webex/media-helpers';
6
6
  import 'webrtc-adapter';
7
+ import { DESTINATION_TYPE } from '../constants';
7
8
  import { CallStateForMetrics } from '../meeting';
8
9
  import Reachability from '../reachability';
9
10
  import { INoiseReductionEffect, IVirtualBackgroundEffect } from './meetings.types';
@@ -252,11 +253,12 @@ export default class Meetings extends WebexPlugin {
252
253
  getReachability(): Reachability;
253
254
  /**
254
255
  * initializes and starts gathering reachability for Meetings
256
+ * @param {string} trigger - explains the reason for starting reachability
255
257
  * @returns {Promise}
256
258
  * @public
257
259
  * @memberof Meetings
258
260
  */
259
- startReachability(): Promise<import("../reachability").ReachabilityResults>;
261
+ startReachability(trigger?: string): Promise<import("../reachability").ReachabilityResults>;
260
262
  /**
261
263
  * Get geoHint for info for meetings
262
264
  * @returns {Promise}
@@ -294,7 +296,7 @@ export default class Meetings extends WebexPlugin {
294
296
  * When meeting info passed it should be complete, e.g.: fetched after password or captcha provided
295
297
  *
296
298
  * @param {string} destination - sipURL, phonenumber, or locus object}
297
- * @param {string} [type] - the optional specified type, such as locusId
299
+ * @param {DESTINATION_TYPE} [type] - the optional specified type, such as locusId
298
300
  * @param {Boolean} useRandomDelayForInfo - whether a random delay should be added to fetching meeting info
299
301
  * @param {Object} infoExtraParams extra parameters to be provided when fetching meeting info
300
302
  * @param {string} correlationId - the optional specified correlationId (callStateForMetrics.correlationId can be provided instead)
@@ -306,14 +308,14 @@ export default class Meetings extends WebexPlugin {
306
308
  * @public
307
309
  * @memberof Meetings
308
310
  */
309
- create(destination: string, type?: string, useRandomDelayForInfo?: boolean, infoExtraParams?: {}, correlationId?: string, failOnMissingMeetingInfo?: boolean, callStateForMetrics?: CallStateForMetrics, meetingInfo?: any, meetingLookupUrl?: any): any;
311
+ create(destination: string, type?: DESTINATION_TYPE, useRandomDelayForInfo?: boolean, infoExtraParams?: {}, correlationId?: string, failOnMissingMeetingInfo?: boolean, callStateForMetrics?: CallStateForMetrics, meetingInfo?: any, meetingLookupUrl?: any): any;
310
312
  /**
311
313
  * Create meeting
312
314
  *
313
315
  * When meeting info passed it should be complete, e.g.: fetched after password or captcha provided
314
316
  *
315
317
  * @param {String} destination see create()
316
- * @param {String} type see create()
318
+ * @param {DESTINATION_TYPE} type see create()
317
319
  * @param {Boolean} useRandomDelayForInfo whether a random delay should be added to fetching meeting info
318
320
  * @param {Object} infoExtraParams extra parameters to be provided when fetching meeting info
319
321
  * @param {CallStateForMetrics} callStateForMetrics - information about call state for metrics
@@ -1,4 +1,13 @@
1
1
  import type { NoiseReductionEffectOptions, VirtualBackgroundEffectOptions } from '@webex/media-helpers';
2
+ import { Enum } from '../constants';
2
3
  type INoiseReductionEffect = Omit<NoiseReductionEffectOptions, 'authToken' | 'workletProcessorUrl' | 'legacyProcessorUrl'>;
3
4
  type IVirtualBackgroundEffect = Omit<VirtualBackgroundEffectOptions, 'authToken'>;
4
5
  export type { INoiseReductionEffect, IVirtualBackgroundEffect };
6
+ export declare const MEETING_KEY: {
7
+ readonly CONVERSATION_URL: "conversationUrl";
8
+ readonly SIP_URI: "sipUri";
9
+ readonly LOCUS_URL: "locusUrl";
10
+ readonly MEETINGNUMBER: "meetingNumber";
11
+ readonly CORRELATION_ID: "correlationId";
12
+ };
13
+ export type MEETING_KEY = Enum<typeof MEETING_KEY>;
@@ -66,5 +66,6 @@ declare const BEHAVIORAL_METRICS: {
66
66
  ROAP_OFFER_TO_ANSWER_LATENCY: string;
67
67
  ROAP_HTTP_RESPONSE_MISSING: string;
68
68
  TURN_DISCOVERY_REQUIRES_OK: string;
69
+ REACHABILITY_COMPLETED: string;
69
70
  };
70
71
  export { BEHAVIORAL_METRICS as default };
@@ -40,6 +40,21 @@ declare class Metrics {
40
40
  * @returns {void}
41
41
  */
42
42
  sendBehavioralMetric(metricName: string, metricFields?: object, metricTags?: object): void;
43
+ /**
44
+ * Flattens an object into one that has no nested properties. Each level of nesting is represented
45
+ * by "_" in the flattened object property names.
46
+ * This function is needed, because Amplitude doesn't allow passing nested objects as metricFields.
47
+ * Use this function for metricFields before calling sendBehavioralMetric() if you want to send
48
+ * nested objects in your metrics.
49
+ *
50
+ * If the function is called with a literal, it returns an object with a single property "value"
51
+ * and the literal value in it.
52
+ *
53
+ * @param {any} payload object you want to flatten
54
+ * @param {string} prefix string prefix prepended to any property names in flatten object
55
+ * @returns {Object}
56
+ */
57
+ prepareMetricFields(payload?: any, prefix?: string): {};
43
58
  }
44
59
  declare const instance: Metrics;
45
60
  export default instance;
@@ -1,4 +1,6 @@
1
1
  import { ClusterNode } from './request';
2
+ import EventsScope from '../common/events/events-scope';
3
+ import { Enum } from '../constants';
2
4
  export type TransportResult = {
3
5
  result: 'reachable' | 'unreachable' | 'untested';
4
6
  latencyInMilliseconds?: number;
@@ -9,10 +11,26 @@ export type ClusterReachabilityResult = {
9
11
  tcp: TransportResult;
10
12
  xtls: TransportResult;
11
13
  };
14
+ export type ResultEventData = {
15
+ protocol: 'udp' | 'tcp' | 'xtls';
16
+ result: 'reachable' | 'unreachable' | 'untested';
17
+ latencyInMilliseconds: number;
18
+ clientMediaIPs?: string[];
19
+ };
20
+ export type ClientMediaIpsUpdatedEventData = {
21
+ protocol: 'udp' | 'tcp' | 'xtls';
22
+ clientMediaIPs: string[];
23
+ };
24
+ export declare const Events: {
25
+ readonly resultReady: "resultReady";
26
+ readonly clientMediaIpsUpdated: "clientMediaIpsUpdated";
27
+ };
28
+ export type Events = Enum<typeof Events>;
12
29
  /**
13
30
  * A class that handles reachability checks for a single cluster.
31
+ * It emits events from Events enum
14
32
  */
15
- export declare class ClusterReachability {
33
+ export declare class ClusterReachability extends EventsScope {
16
34
  private numUdpUrls;
17
35
  private numTcpUrls;
18
36
  private numXTlsUrls;
@@ -61,6 +79,12 @@ export declare class ClusterReachability {
61
79
  * @returns {void}
62
80
  */
63
81
  private finishReachabilityCheck;
82
+ /**
83
+ * Aborts the cluster reachability checks by closing the peer connection
84
+ *
85
+ * @returns {void}
86
+ */
87
+ abort(): void;
64
88
  /**
65
89
  * Adds public IP (client media IPs)
66
90
  * @param {string} protocol
@@ -81,13 +105,17 @@ export declare class ClusterReachability {
81
105
  */
82
106
  private haveWeGotAllResults;
83
107
  /**
84
- * Stores the latency in the result for the given protocol and marks it as reachable
108
+ * Saves the latency in the result for the given protocol and marks it as reachable,
109
+ * emits the "resultReady" event if this is the first result for that protocol,
110
+ * emits the "clientMediaIpsUpdated" event if we already had a result and only found
111
+ * a new client IP
85
112
  *
86
113
  * @param {string} protocol
87
114
  * @param {number} latency
115
+ * @param {string|null} [publicIp]
88
116
  * @returns {void}
89
117
  */
90
- private storeLatencyResult;
118
+ private saveResult;
91
119
  /**
92
120
  * Registers a listener for the icecandidate event
93
121
  *
@@ -1,8 +1,10 @@
1
1
  /*!
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
- import ReachabilityRequest from './request';
4
+ import { Defer } from '@webex/common';
5
+ import ReachabilityRequest, { ClusterList } from './request';
5
6
  import { ClusterReachability, ClusterReachabilityResult } from './clusterReachability';
7
+ import EventsScope from '../common/events/events-scope';
6
8
  export type ReachabilityMetrics = {
7
9
  reachability_public_udp_success: number;
8
10
  reachability_public_udp_failed: number;
@@ -40,26 +42,62 @@ export type ReachabilityResults = Record<string, ClusterReachabilityResult & {
40
42
  * @class Reachability
41
43
  * @export
42
44
  */
43
- export default class Reachability {
45
+ export default class Reachability extends EventsScope {
44
46
  namespace: string;
45
47
  webex: object;
46
48
  reachabilityRequest: ReachabilityRequest;
47
49
  clusterReachability: {
48
50
  [key: string]: ClusterReachability;
49
51
  };
52
+ reachabilityDefer?: Defer;
53
+ vmnTimer?: ReturnType<typeof setTimeout>;
54
+ publicCloudTimer?: ReturnType<typeof setTimeout>;
55
+ overallTimer?: ReturnType<typeof setTimeout>;
56
+ expectedResultsCount: {
57
+ videoMesh: {
58
+ udp: number;
59
+ };
60
+ public: {
61
+ udp: number;
62
+ tcp: number;
63
+ xtls: number;
64
+ };
65
+ };
66
+ resultsCount: {
67
+ videoMesh: {
68
+ udp: number;
69
+ };
70
+ public: {
71
+ udp: number;
72
+ tcp: number;
73
+ xtls: number;
74
+ };
75
+ };
76
+ protected lastTrigger?: string;
50
77
  /**
51
78
  * Creates an instance of Reachability.
52
79
  * @param {object} webex
53
80
  * @memberof Reachability
54
81
  */
55
82
  constructor(webex: object);
83
+ /**
84
+ * Fetches the list of media clusters from the backend
85
+ * @param {boolean} isRetry
86
+ * @private
87
+ * @returns {Promise<{clusters: ClusterList, joinCookie: any}>}
88
+ */
89
+ getClusters(isRetry?: boolean): Promise<{
90
+ clusters: ClusterList;
91
+ joinCookie: any;
92
+ }>;
56
93
  /**
57
94
  * Gets a list of media clusters from the backend and performs reachability checks on all the clusters
95
+ * @param {string} trigger - explains the reason for starting reachability
58
96
  * @returns {Promise<ReachabilityResults>} reachability results
59
97
  * @public
60
98
  * @memberof Reachability
61
99
  */
62
- gatherReachability(): Promise<ReachabilityResults>;
100
+ gatherReachability(trigger: string): Promise<ReachabilityResults>;
63
101
  /**
64
102
  * Returns statistics about last reachability results. The returned value is an object
65
103
  * with a flat list of properties so that it can be easily sent with metrics
@@ -111,10 +149,75 @@ export default class Reachability {
111
149
  * @memberof Reachability
112
150
  */
113
151
  private logUnreachableClusters;
152
+ /**
153
+ * Returns true if we've obtained all the reachability results for all the public clusters
154
+ * In other words, it means that all public clusters are reachable over each protocol,
155
+ * because we only get a "result" if we managed to reach a cluster
156
+ *
157
+ * @returns {boolean}
158
+ */
159
+ private areAllPublicClusterResultsReady;
160
+ /**
161
+ * Returns true if we've obtained all the reachability results for all the clusters
162
+ *
163
+ * @returns {boolean}
164
+ */
165
+ private areAllResultsReady;
166
+ /**
167
+ * Resolves the promise returned by gatherReachability() method
168
+ * @returns {void}
169
+ */
170
+ private resolveReachabilityPromise;
171
+ /**
172
+ * Aborts all cluster reachability checks that are in progress
173
+ *
174
+ * @returns {void}
175
+ */
176
+ private abortClusterReachability;
177
+ /**
178
+ * Helper function for calculating min/max/average values of latency
179
+ *
180
+ * @param {Array<any>} results
181
+ * @param {string} protocol
182
+ * @param {boolean} isVideoMesh
183
+ * @returns {{min:number, max: number, average: number}}
184
+ */
185
+ protected getStatistics(results: Array<ClusterReachabilityResult & {
186
+ isVideoMesh: boolean;
187
+ }>, protocol: 'udp' | 'tcp' | 'xtls', isVideoMesh: boolean): {
188
+ min: number;
189
+ max: number;
190
+ average: number;
191
+ };
192
+ /**
193
+ * Sends a metric with all the statistics about how long reachability took
194
+ *
195
+ * @returns {void}
196
+ */
197
+ protected sendMetric(): Promise<void>;
198
+ /**
199
+ * Starts all the timers used for various timeouts
200
+ *
201
+ * @returns {void}
202
+ */
203
+ private startTimers;
204
+ /**
205
+ * Stores given reachability results in local storage
206
+ *
207
+ * @param {ReachabilityResults} results
208
+ * @returns {Promise<void>}
209
+ */
210
+ private storeResults;
211
+ /**
212
+ * Resets all the internal counters that keep track of the results
213
+ *
214
+ * @returns {void}
215
+ */
216
+ private resetResultCounters;
114
217
  /**
115
218
  * Performs reachability checks for all clusters
116
219
  * @param {ClusterList} clusterList
117
- * @returns {Promise<ReachabilityResults>} reachability check results
220
+ * @returns {Promise<void>} promise that's resolved as soon as the checks are started
118
221
  */
119
222
  private performReachabilityChecks;
120
223
  }
@@ -11,6 +11,7 @@ export default class RtcMetrics {
11
11
  meetingId: string;
12
12
  correlationId: string;
13
13
  connectionId: string;
14
+ shouldSendMetricsOnNextStatsReport: boolean;
14
15
  /**
15
16
  * Initialize the interval.
16
17
  *
@@ -25,6 +26,15 @@ export default class RtcMetrics {
25
26
  * @returns {void}
26
27
  */
27
28
  sendMetricsInQueue(): void;
29
+ /**
30
+ * Forces sending metrics when we get the next stats-report
31
+ *
32
+ * This is useful for cases when something important happens that affects the media connection,
33
+ * for example when we move from lobby into the meeting.
34
+ *
35
+ * @returns {void}
36
+ */
37
+ sendNextMetrics(): void;
28
38
  /**
29
39
  * Add metrics items to the metrics queue.
30
40
  *
@@ -51,7 +61,7 @@ export default class RtcMetrics {
51
61
  *
52
62
  * @returns {void}
53
63
  */
54
- private setNewConnectionId;
64
+ private resetConnection;
55
65
  /**
56
66
  * Send metrics to the metrics service.
57
67
  *
@@ -62,7 +62,7 @@ var Webinar = _webexCore.WebexPlugin.extend({
62
62
  updateCanManageWebcast: function updateCanManageWebcast(canManageWebcast) {
63
63
  this.set('canManageWebcast', canManageWebcast);
64
64
  },
65
- version: "3.3.1"
65
+ version: "3.4.0-next.10"
66
66
  });
67
67
  var _default = exports.default = Webinar;
68
68
  //# sourceMappingURL=index.js.map