@webex/plugin-meetings 3.12.0-next.155 → 3.12.0-next.157

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.
@@ -52,7 +52,7 @@ export default class LocusRetryStatusInterceptor extends Interceptor {
52
52
  if (hasRetriedLocusRequest) {
53
53
  rateLimitExpiryTime.set(this, false);
54
54
 
55
- return Promise.reject(options);
55
+ return Promise.reject(reason);
56
56
  }
57
57
  rateLimitExpiryTime.set(this, true);
58
58
 
@@ -157,6 +157,7 @@ import {
157
157
  Configuration as RemoteMediaManagerConfiguration,
158
158
  RemoteMediaManager,
159
159
  Event as RemoteMediaManagerEvent,
160
+ getRemoteMediaManagerConfigForLogging,
160
161
  } from '../multistream/remoteMediaManager';
161
162
  import {
162
163
  Reaction,
@@ -9049,9 +9050,16 @@ export default class Meeting extends StatelessWebexPlugin {
9049
9050
 
9050
9051
  this.hasMediaConnectionConnectedAtLeastOnce = false;
9051
9052
  const LOG_HEADER = 'Meeting:index#addMedia -->';
9053
+ const optionsForLogging = {
9054
+ ...options,
9055
+ remoteMediaManagerConfig: getRemoteMediaManagerConfigForLogging(
9056
+ options.remoteMediaManagerConfig
9057
+ ),
9058
+ };
9059
+
9052
9060
  LoggerProxy.logger.info(
9053
9061
  `${LOG_HEADER} called with: options=${JSON.stringify(
9054
- options
9062
+ optionsForLogging
9055
9063
  )}, turnServerInfo=${JSON.stringify(
9056
9064
  turnServerInfo
9057
9065
  )}, forceTurnDiscovery=${forceTurnDiscovery}, iceTransportPolicy=${iceTransportPolicy}`
@@ -53,6 +53,28 @@ export interface Configuration {
53
53
  namedMediaGroup?: NamedMediaGroup;
54
54
  }
55
55
 
56
+ export const getRemoteMediaManagerConfigForLogging = (config?: Configuration) => {
57
+ if (!config) {
58
+ return config;
59
+ }
60
+
61
+ const {initialLayoutId, layouts} = config.video;
62
+
63
+ return {
64
+ ...config,
65
+ video: {
66
+ ...config.video,
67
+ layouts: {
68
+ count: Object.keys(layouts).length,
69
+ initial: {
70
+ id: initialLayoutId,
71
+ definition: layouts[initialLayoutId],
72
+ },
73
+ },
74
+ },
75
+ };
76
+ };
77
+
56
78
  /* Predefined layouts: */
57
79
 
58
80
  // An "all equal" grid, with size up to 3 x 3 = 9:
@@ -335,7 +357,7 @@ export class RemoteMediaManager extends EventsScope {
335
357
 
336
358
  LoggerProxy.logger.log(
337
359
  `RemoteMediaManager#constructor --> RemoteMediaManager created with config: ${JSON.stringify(
338
- this.config
360
+ getRemoteMediaManagerConfigForLogging(this.config)
339
361
  )}`
340
362
  );
341
363
  }
@@ -192,6 +192,35 @@ describe('plugin-meetings', () => {
192
192
  });
193
193
  });
194
194
 
195
+ [
196
+ [429, WebexHttpError.TooManyRequests],
197
+ [503, WebexHttpError.ServiceUnavailable],
198
+ ].forEach(([statusCode, ErrorType]) => {
199
+ it(`rejects the HTTP ${statusCode} error after a locus retry is exhausted`, async () => {
200
+ const reason = new ErrorType({
201
+ statusCode,
202
+ options: {
203
+ headers: {trackingid: 'test', 'retry-after': 1000},
204
+ uri: options.uri,
205
+ },
206
+ body: {message: 'Locus request failed'},
207
+ });
208
+ const handleRetryStub = sinon
209
+ .stub(interceptor, 'handleRetryRequestLocusServiceError')
210
+ .resolves();
211
+
212
+ await interceptor.onResponseError(options, reason);
213
+
214
+ return interceptor.onResponseError(options, reason).then(
215
+ () => assert.fail('Expected promise to be rejected'),
216
+ (error) => {
217
+ expect(error).to.equal(reason);
218
+ handleRetryStub.restore();
219
+ }
220
+ );
221
+ });
222
+ });
223
+
195
224
  describe('URI parsing edge cases', () => {
196
225
  const make503Reason = (uri) =>
197
226
  new WebexHttpError.MethodNotAllowed({
@@ -330,4 +359,3 @@ describe('plugin-meetings', () => {
330
359
  });
331
360
  });
332
361
  });
333
-
@@ -3681,6 +3681,41 @@ describe('plugin-meetings', () => {
3681
3681
  assert.exists(meeting.addMedia);
3682
3682
  });
3683
3683
 
3684
+ it('logs a compact remote media manager configuration', async () => {
3685
+ const loggerInfoStub = sinon.stub(LoggerProxy.logger, 'info');
3686
+ const remoteMediaManagerConfig = {
3687
+ audio: {
3688
+ numOfActiveSpeakerStreams: 3,
3689
+ numOfScreenShareStreams: 1,
3690
+ },
3691
+ video: {
3692
+ preferLiveVideo: true,
3693
+ initialLayoutId: 'initial',
3694
+ layouts: {
3695
+ initial: {activeSpeakerVideoPaneGroups: []},
3696
+ excluded: {activeSpeakerVideoPaneGroups: []},
3697
+ },
3698
+ },
3699
+ };
3700
+
3701
+ const error = await assert.isRejected(
3702
+ meeting.addMediaInternal(() => 'JOIN_MEETING_FINAL', false, undefined, undefined, {
3703
+ remoteMediaManagerConfig,
3704
+ })
3705
+ );
3706
+
3707
+ assert.instanceOf(error, MeetingNotActiveError);
3708
+ assert.calledOnceWithExactly(
3709
+ loggerInfoStub,
3710
+ `Meeting:index#addMedia --> called with: options=${JSON.stringify({
3711
+ remoteMediaManagerConfig:
3712
+ RemoteMediaManagerModule.getRemoteMediaManagerConfigForLogging(
3713
+ remoteMediaManagerConfig
3714
+ ),
3715
+ })}, turnServerInfo=undefined, forceTurnDiscovery=false, iceTransportPolicy=undefined`
3716
+ );
3717
+ });
3718
+
3684
3719
  it('should reject promise if meeting is not active and the meeting in lobby is not enabled', async () => {
3685
3720
  const result = await assert.isRejected(meeting.addMedia({allowMediaInLobby: false}));
3686
3721
 
@@ -12,6 +12,7 @@ import * as BrowserDetectionModule from '@webex/plugin-meetings/src/common/brows
12
12
  import PasswordError from '@webex/plugin-meetings/src/common/errors/password-error';
13
13
  import CaptchaError from '@webex/plugin-meetings/src/common/errors/captcha-error';
14
14
  import {ServerRoles} from '@webex/plugin-meetings/src/member/types';
15
+ import {WebexHttpError} from '@webex/webex-core';
15
16
 
16
17
  describe('plugin-meetings', () => {
17
18
  let webex;
@@ -765,7 +766,15 @@ describe('plugin-meetings', () => {
765
766
  });
766
767
 
767
768
  it('should post client event with error when join fails', async () => {
768
- const joinError = new Error('Join failed');
769
+ const joinError = new WebexHttpError.TooManyRequests({
770
+ statusCode: 429,
771
+ body: {message: 'Locus rate limited'},
772
+ options: {
773
+ method: 'POST',
774
+ headers: {},
775
+ uri: 'https://locus.example.com/locus/api/v1/loci/call',
776
+ },
777
+ });
769
778
  meeting.meetingRequest.joinMeeting.rejects(joinError);
770
779
  meeting.meetingInfo = {meetingLookupUrl: 'test-lookup-url'};
771
780
 
@@ -6,6 +6,7 @@ import {MediaType} from '@webex/internal-media-core';
6
6
  import {
7
7
  Configuration,
8
8
  Event,
9
+ getRemoteMediaManagerConfigForLogging,
9
10
  RemoteMediaManager,
10
11
  VideoLayoutChangedEventData,
11
12
  } from '@webex/plugin-meetings/src/multistream/remoteMediaManager';
@@ -120,6 +121,34 @@ const DefaultTestConfiguration: Configuration = {
120
121
  },
121
122
  };
122
123
 
124
+ describe('getRemoteMediaManagerConfigForLogging', () => {
125
+ it('returns undefined when no configuration is provided', () => {
126
+ assert.isUndefined(getRemoteMediaManagerConfigForLogging());
127
+ });
128
+
129
+ it('replaces layouts with their count and initial layout without mutating the configuration', () => {
130
+ const config = cloneDeep(DefaultTestConfiguration);
131
+ const originalConfig = cloneDeep(config);
132
+
133
+ const result = getRemoteMediaManagerConfigForLogging(config);
134
+
135
+ assert.deepEqual(result, {
136
+ ...config,
137
+ video: {
138
+ ...config.video,
139
+ layouts: {
140
+ count: Object.keys(config.video.layouts).length,
141
+ initial: {
142
+ id: config.video.initialLayoutId,
143
+ definition: config.video.layouts[config.video.initialLayoutId],
144
+ },
145
+ },
146
+ },
147
+ });
148
+ assert.deepEqual(config, originalConfig);
149
+ });
150
+ });
151
+
123
152
  describe('RemoteMediaManager', () => {
124
153
  let remoteMediaManager;
125
154
  let fakeReceiveSlotManager;
@@ -663,6 +692,23 @@ describe('RemoteMediaManager', () => {
663
692
  });
664
693
 
665
694
  describe('constructor', () => {
695
+ it('logs the compact remote media manager configuration', () => {
696
+ logger.log.resetHistory();
697
+
698
+ new RemoteMediaManager(
699
+ fakeReceiveSlotManager,
700
+ fakeMediaRequestManagers,
701
+ DefaultTestConfiguration
702
+ );
703
+
704
+ assert.calledOnceWithExactly(
705
+ logger.log,
706
+ `RemoteMediaManager#constructor --> RemoteMediaManager created with config: ${JSON.stringify(
707
+ getRemoteMediaManagerConfigForLogging(DefaultTestConfiguration)
708
+ )}`
709
+ );
710
+ });
711
+
666
712
  it('throws if the initial layout in the config is invalid', () => {
667
713
  const config = cloneDeep(DefaultTestConfiguration);
668
714