From 763890c274b14a92f447e6f5e7d4ce1e9da320ed Mon Sep 17 00:00:00 2001 From: Parimala032 Date: Thu, 10 Oct 2024 15:49:39 +0530 Subject: [PATCH] fix(plugin-meetings): added alias as option in joinmeeting --- .../plugin-meetings/src/meeting/request.ts | 7 +++++++ .../@webex/plugin-meetings/src/meeting/util.ts | 1 + .../test/unit/spec/meeting/request.js | 16 ++++++++++++++++ .../test/unit/spec/meeting/utils.js | 11 ++++++++--- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/packages/@webex/plugin-meetings/src/meeting/request.ts b/packages/@webex/plugin-meetings/src/meeting/request.ts index 36bc27d1fbe..f4a0685be49 100644 --- a/packages/@webex/plugin-meetings/src/meeting/request.ts +++ b/packages/@webex/plugin-meetings/src/meeting/request.ts @@ -54,6 +54,7 @@ export default class MeetingRequest extends StatelessWebexPlugin { * @param {boolean} options.pin * @param {boolean} options.moveToResource * @param {Object} options.roapMessage + * @param {String} options.alias * @returns {Promise} */ async joinMeeting(options: { @@ -72,6 +73,7 @@ export default class MeetingRequest extends StatelessWebexPlugin { meetingNumber: any; permissionToken: any; preferTranscoding: any; + alias?: string; }) { const { asResourceOccupant, @@ -88,6 +90,7 @@ export default class MeetingRequest extends StatelessWebexPlugin { moveToResource, roapMessage, preferTranscoding, + alias, } = options; LoggerProxy.logger.info('Meeting:request#joinMeeting --> Joining a meeting', correlationId); @@ -113,6 +116,10 @@ export default class MeetingRequest extends StatelessWebexPlugin { }, }; + if (alias) { + body.alias = alias; + } + // @ts-ignore if (this.webex.meetings.clientRegion) { // @ts-ignore diff --git a/packages/@webex/plugin-meetings/src/meeting/util.ts b/packages/@webex/plugin-meetings/src/meeting/util.ts index dbb3e1d0bcc..eb649ce03c9 100644 --- a/packages/@webex/plugin-meetings/src/meeting/util.ts +++ b/packages/@webex/plugin-meetings/src/meeting/util.ts @@ -101,6 +101,7 @@ MeetingUtil.joinMeeting = (meeting, options) => { resourceId: options.resourceId || null, moderator: options.moderator, pin: options.pin, + alias: options.alias, moveToResource: options.moveToResource, preferTranscoding: options.preferTranscoding, asResourceOccupant: options.asResourceOccupant, diff --git a/packages/@webex/plugin-meetings/test/unit/spec/meeting/request.js b/packages/@webex/plugin-meetings/test/unit/spec/meeting/request.js index b25dc43f8c3..bc42987f6a6 100644 --- a/packages/@webex/plugin-meetings/test/unit/spec/meeting/request.js +++ b/packages/@webex/plugin-meetings/test/unit/spec/meeting/request.js @@ -190,6 +190,22 @@ describe('plugin-meetings', () => { assert.equal(requestParams.uri, 'locusUrl/loci/call?alternateRedirect=true'); assert.equal(requestParams.body.invitee.address, 'sipUrl'); }); + + it('adds alias to request when they are provided', async () => { + await meetingsRequest.joinMeeting({ + alias: 'assigned name', + }); + const requestParams = meetingsRequest.request.getCall(0).args[0]; + + assert.deepEqual(requestParams.body.alias, 'assigned name'); + }); + + it('does not add alias to request when they are not provided', async () => { + await meetingsRequest.joinMeeting({}); + const requestParams = meetingsRequest.request.getCall(0).args[0]; + + assert.deepEqual(requestParams.body.alias, undefined); + }); }); describe('#pstn', () => { diff --git a/packages/@webex/plugin-meetings/test/unit/spec/meeting/utils.js b/packages/@webex/plugin-meetings/test/unit/spec/meeting/utils.js index 86b16f9f497..17ea6864933 100644 --- a/packages/@webex/plugin-meetings/test/unit/spec/meeting/utils.js +++ b/packages/@webex/plugin-meetings/test/unit/spec/meeting/utils.js @@ -4,6 +4,8 @@ import MeetingUtil from '@webex/plugin-meetings/src/meeting/util'; import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy'; import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config'; import Metrics from '@webex/plugin-meetings/src/metrics/index'; +import { options } from 'yargs'; +import { alias } from 'yargs'; describe('plugin-meetings', () => { describe('Meeting utils function', () => { @@ -138,12 +140,13 @@ describe('plugin-meetings', () => { }; MeetingUtil.parseLocusJoin = sinon.stub(); - await MeetingUtil.joinMeeting(meeting, {}); + await MeetingUtil.joinMeeting(meeting, {alias: 'userName'}); assert.calledOnce(meeting.meetingRequest.joinMeeting); const parameter = meeting.meetingRequest.joinMeeting.getCall(0).args[0]; assert.equal(parameter.inviteeAddress, 'meetingJoinUrl'); + assert.equal(parameter.alias, 'userName'); }); it('#Should fallback sipUrl if meetingJoinUrl does not exists', async () => { @@ -156,12 +159,13 @@ describe('plugin-meetings', () => { }; MeetingUtil.parseLocusJoin = sinon.stub(); - await MeetingUtil.joinMeeting(meeting, {}); + await MeetingUtil.joinMeeting(meeting, {alias: 'userName'}); assert.calledOnce(meeting.meetingRequest.joinMeeting); const parameter = meeting.meetingRequest.joinMeeting.getCall(0).args[0]; assert.equal(parameter.inviteeAddress, 'sipUri'); + assert.equal(parameter.alias, 'userName'); }); it('#Should fallback to meetingNumber if meetingJoinUrl/sipUrl does not exists', async () => { @@ -174,13 +178,14 @@ describe('plugin-meetings', () => { }; MeetingUtil.parseLocusJoin = sinon.stub(); - await MeetingUtil.joinMeeting(meeting, {}); + await MeetingUtil.joinMeeting(meeting, {alias: 'userName'}); assert.calledOnce(meeting.meetingRequest.joinMeeting); const parameter = meeting.meetingRequest.joinMeeting.getCall(0).args[0]; assert.isUndefined(parameter.inviteeAddress); assert.equal(parameter.meetingNumber, 'meetingNumber'); + assert.equal(parameter.alias, 'userName'); }); });