@webex/plugin-meetings 3.0.0-beta.198 → 3.0.0-beta.199

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.
@@ -204,7 +204,6 @@ export enum ScreenShareFloorStatus {
204
204
  * @property {String} [meetingQuality.remote]
205
205
  * @property {Boolean} [rejoin]
206
206
  * @property {Boolean} [enableMultistream]
207
- * @property {String} [correlationId]
208
207
  */
209
208
 
210
209
  /**
@@ -593,7 +592,14 @@ export default class Meeting extends StatelessWebexPlugin {
593
592
  * @public
594
593
  * @memberof Meeting
595
594
  */
596
- this.correlationId = this.id;
595
+ if (attrs.correlationId) {
596
+ LoggerProxy.logger.log(
597
+ `Meetings:index#constructor --> Initializing the meeting object with correlation id from app ${this.correlationId}`
598
+ );
599
+ this.correlationId = attrs.correlationId;
600
+ } else {
601
+ this.correlationId = this.id;
602
+ }
597
603
  /**
598
604
  * @instance
599
605
  * @type {String}
@@ -4255,16 +4261,9 @@ export default class Meeting extends StatelessWebexPlugin {
4255
4261
  joinSuccess = resolve;
4256
4262
  });
4257
4263
 
4258
- if (options.correlationId) {
4259
- this.setCorrelationId(options.correlationId);
4260
- LoggerProxy.logger.log(
4261
- `Meeting:index#join --> Using a new correlation id from app ${this.correlationId}`
4262
- );
4263
- }
4264
-
4265
4264
  if (!this.hasJoinedOnce) {
4266
4265
  this.hasJoinedOnce = true;
4267
- } else if (!options.correlationId) {
4266
+ } else {
4268
4267
  LoggerProxy.logger.log(
4269
4268
  `Meeting:index#join --> Generating a new correlation id for meeting ${this.id}`
4270
4269
  );
@@ -4772,7 +4771,7 @@ export default class Meeting extends StatelessWebexPlugin {
4772
4771
  };
4773
4772
 
4774
4773
  if (error instanceof Errors.SdpOfferCreationError) {
4775
- sendBehavioralMetric(BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE, error, this.id);
4774
+ sendBehavioralMetric(BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE, error, this.correlationId);
4776
4775
 
4777
4776
  // @ts-ignore
4778
4777
  this.webex.internal.newMetrics.submitClientEvent({
@@ -4786,7 +4785,7 @@ export default class Meeting extends StatelessWebexPlugin {
4786
4785
  error instanceof Errors.SdpOfferHandlingError ||
4787
4786
  error instanceof Errors.SdpAnswerHandlingError
4788
4787
  ) {
4789
- sendBehavioralMetric(BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE, error, this.id);
4788
+ sendBehavioralMetric(BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE, error, this.correlationId);
4790
4789
 
4791
4790
  // @ts-ignore
4792
4791
  this.webex.internal.newMetrics.submitClientEvent({
@@ -4798,7 +4797,7 @@ export default class Meeting extends StatelessWebexPlugin {
4798
4797
  });
4799
4798
  } else if (error instanceof Errors.SdpError) {
4800
4799
  // this covers also the case of Errors.IceGatheringError which extends Errors.SdpError
4801
- sendBehavioralMetric(BEHAVIORAL_METRICS.INVALID_ICE_CANDIDATE, error, this.id);
4800
+ sendBehavioralMetric(BEHAVIORAL_METRICS.INVALID_ICE_CANDIDATE, error, this.correlationId);
4802
4801
 
4803
4802
  // @ts-ignore
4804
4803
  this.webex.internal.newMetrics.submitClientEvent({
@@ -1054,6 +1054,7 @@ export default class Meetings extends WebexPlugin {
1054
1054
  * @param {string} [type] - the optional specified type, such as locusId
1055
1055
  * @param {Boolean} useRandomDelayForInfo - whether a random delay should be added to fetching meeting info
1056
1056
  * @param {Object} infoExtraParams extra parameters to be provided when fetching meeting info
1057
+ * @param {string} correlationId - the optional specified correlationId
1057
1058
  * @returns {Promise<Meeting>} A new Meeting.
1058
1059
  * @public
1059
1060
  * @memberof Meetings
@@ -1062,7 +1063,8 @@ export default class Meetings extends WebexPlugin {
1062
1063
  destination: string,
1063
1064
  type: string = null,
1064
1065
  useRandomDelayForInfo = false,
1065
- infoExtraParams = {}
1066
+ infoExtraParams = {},
1067
+ correlationId: string = undefined
1066
1068
  ) {
1067
1069
  // TODO: type should be from a dictionary
1068
1070
 
@@ -1112,7 +1114,8 @@ export default class Meetings extends WebexPlugin {
1112
1114
  targetDest,
1113
1115
  type,
1114
1116
  useRandomDelayForInfo,
1115
- infoExtraParams
1117
+ infoExtraParams,
1118
+ correlationId
1116
1119
  ).then((createdMeeting: any) => {
1117
1120
  // If the meeting was successfully created.
1118
1121
  if (createdMeeting && createdMeeting.on) {
@@ -1166,6 +1169,7 @@ export default class Meetings extends WebexPlugin {
1166
1169
  * @param {String} type see create()
1167
1170
  * @param {Boolean} useRandomDelayForInfo whether a random delay should be added to fetching meeting info
1168
1171
  * @param {Object} infoExtraParams extra parameters to be provided when fetching meeting info
1172
+ * @param {String} correlationId the optional specified correlationId
1169
1173
  * @returns {Promise} a new meeting instance complete with meeting info and destination
1170
1174
  * @private
1171
1175
  * @memberof Meetings
@@ -1174,7 +1178,8 @@ export default class Meetings extends WebexPlugin {
1174
1178
  destination: any,
1175
1179
  type: string = null,
1176
1180
  useRandomDelayForInfo = false,
1177
- infoExtraParams = {}
1181
+ infoExtraParams = {},
1182
+ correlationId: string = undefined
1178
1183
  ) {
1179
1184
  const meeting = new Meeting(
1180
1185
  {
@@ -1188,6 +1193,7 @@ export default class Meetings extends WebexPlugin {
1188
1193
  meetingInfoProvider: this.meetingInfo,
1189
1194
  destination,
1190
1195
  destinationType: type,
1196
+ correlationId,
1191
1197
  },
1192
1198
  {
1193
1199
  // @ts-ignore
@@ -185,6 +185,7 @@ describe('plugin-meetings', () => {
185
185
  let testDestination;
186
186
  let membersSpy;
187
187
  let meetingRequestSpy;
188
+ let correlationId;
188
189
 
189
190
  beforeEach(() => {
190
191
  webex = new MockWebex({
@@ -243,6 +244,7 @@ describe('plugin-meetings', () => {
243
244
  test3 = `test3-${uuid.v4()}`;
244
245
  test4 = `test4-${uuid.v4()}`;
245
246
  testDestination = `testDestination-${uuid.v4()}`;
247
+ correlationId = uuid.v4();
246
248
 
247
249
  meeting = new Meeting(
248
250
  {
@@ -252,6 +254,7 @@ describe('plugin-meetings', () => {
252
254
  locus: {url: url1},
253
255
  destination: testDestination,
254
256
  destinationType: _MEETING_ID_,
257
+ correlationId,
255
258
  },
256
259
  {
257
260
  parent: webex,
@@ -270,9 +273,11 @@ describe('plugin-meetings', () => {
270
273
  assert.exists(meeting.options);
271
274
  assert.exists(meeting.attrs);
272
275
  assert.exists(meeting.id);
276
+ assert.exists(meeting.correlationId);
273
277
  assert.equal(meeting.userId, uuid1);
274
278
  assert.equal(meeting.resource, uuid2);
275
279
  assert.equal(meeting.deviceUrl, uuid3);
280
+ assert.equal(meeting.correlationId, correlationId);
276
281
  assert.deepEqual(meeting.meetingInfo, {});
277
282
  assert.instanceOf(meeting.members, Members);
278
283
  assert.calledOnceWithExactly(
@@ -324,6 +329,21 @@ describe('plugin-meetings', () => {
324
329
  assert.instanceOf(meeting.mediaRequestManagers.screenShareVideo, MediaRequestManager);
325
330
  });
326
331
 
332
+ it('uses meeting id as correlation id if not provided in constructor', () => {
333
+ const newMeeting = new Meeting({
334
+ userId: uuid1,
335
+ resource: uuid2,
336
+ deviceUrl: uuid3,
337
+ locus: {url: url1},
338
+ destination: testDestination,
339
+ destinationType: _MEETING_ID_,
340
+ },
341
+ {
342
+ parent: webex,
343
+ });
344
+ assert.equal(newMeeting.correlationId, newMeeting.id);
345
+ })
346
+
327
347
  describe('creates ReceiveSlot manager instance', () => {
328
348
  let mockReceiveSlotManagerCtor;
329
349
  let providedCreateSlotCallback;
@@ -679,23 +679,26 @@ describe('plugin-meetings', () => {
679
679
 
680
680
  it('calls createMeeting and returns its promise', async () => {
681
681
  const FAKE_USE_RANDOM_DELAY = true;
682
- const create = webex.meetings.create(test1, test2, FAKE_USE_RANDOM_DELAY);
682
+ const correlationId = 'my-correlationId';
683
+ const create = webex.meetings.create(test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId);
683
684
 
684
685
  assert.exists(create.then);
685
686
  await create;
686
687
  assert.calledOnce(webex.meetings.createMeeting);
687
- assert.calledWith(webex.meetings.createMeeting, test1, test2, FAKE_USE_RANDOM_DELAY, {});
688
+ assert.calledWith(webex.meetings.createMeeting, test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId);
688
689
  });
689
690
 
690
691
  it('calls createMeeting with extra info params and returns its promise', async () => {
691
692
  const FAKE_USE_RANDOM_DELAY = false;
693
+ const correlationId = 'my-correlationId';
694
+
692
695
  const FAKE_INFO_EXTRA_PARAMS = {mtid: 'm9fe0afd8c435e892afcce9ea25b97046', joinTXId: 'TSmrX61wNF'};
693
- const create = webex.meetings.create(test1, test2, FAKE_USE_RANDOM_DELAY, FAKE_INFO_EXTRA_PARAMS);
696
+ const create = webex.meetings.create(test1, test2, FAKE_USE_RANDOM_DELAY, FAKE_INFO_EXTRA_PARAMS, correlationId);
694
697
 
695
698
  assert.exists(create.then);
696
699
  await create;
697
700
  assert.calledOnce(webex.meetings.createMeeting);
698
- assert.calledWith(webex.meetings.createMeeting, test1, test2, FAKE_USE_RANDOM_DELAY, FAKE_INFO_EXTRA_PARAMS);
701
+ assert.calledWith(webex.meetings.createMeeting, test1, test2, FAKE_USE_RANDOM_DELAY, FAKE_INFO_EXTRA_PARAMS, correlationId);
699
702
  });
700
703
 
701
704
  it('creates a new meeting when a scheduled meeting exists in the conversation', async () => {
@@ -1095,6 +1098,9 @@ describe('plugin-meetings', () => {
1095
1098
  if (expectedMeetingData.meetingJoinUrl) {
1096
1099
  assert.equal(meeting.meetingJoinUrl, expectedMeetingData.meetingJoinUrl);
1097
1100
  }
1101
+ if(expectedMeetingData.correlationId) {
1102
+ assert.equal(meeting.correlationId, expectedMeetingData.correlationId);
1103
+ }
1098
1104
  assert.equal(meeting.destination, destination);
1099
1105
  assert.equal(meeting.destinationType, type);
1100
1106
  assert.calledWith(
@@ -1124,6 +1130,7 @@ describe('plugin-meetings', () => {
1124
1130
  const expectedMeetingData = {
1125
1131
  permissionToken: 'PT',
1126
1132
  meetingJoinUrl: 'meetingJoinUrl',
1133
+ correlationId: meeting.id,
1127
1134
  };
1128
1135
 
1129
1136
  checkCreateWithoutDelay(meeting, 'test destination', 'test type', {}, expectedMeetingData);
@@ -1334,6 +1341,16 @@ describe('plugin-meetings', () => {
1334
1341
  );
1335
1342
  checkCreateWithoutDelay(meeting, FAKE_LOCUS_MEETING, 'test type');
1336
1343
  });
1344
+
1345
+ it('creates meeting with the correlationId provided', async () => {
1346
+ const meeting = await webex.meetings.createMeeting('test destination', 'test type', false, {}, 'my-correlationId');
1347
+
1348
+ const expectedMeetingData = {
1349
+ correlationId: 'my-correlationId',
1350
+ };
1351
+
1352
+ checkCreateWithoutDelay(meeting, 'test destination', 'test type', {}, expectedMeetingData);
1353
+ })
1337
1354
  });
1338
1355
 
1339
1356
  describe('rejected MeetingInfo.#fetchMeetingInfo', () => {