Skip to content

Commit

Permalink
fix(plugin-meetings): added alias as option in joinmeeting
Browse files Browse the repository at this point in the history
  • Loading branch information
Parimala032 committed Oct 10, 2024
1 parent 708b356 commit 763890c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
7 changes: 7 additions & 0 deletions packages/@webex/plugin-meetings/src/meeting/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -72,6 +73,7 @@ export default class MeetingRequest extends StatelessWebexPlugin {
meetingNumber: any;
permissionToken: any;
preferTranscoding: any;
alias?: string;
}) {
const {
asResourceOccupant,
Expand All @@ -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);
Expand All @@ -113,6 +116,10 @@ export default class MeetingRequest extends StatelessWebexPlugin {
},
};

if (alias) {
body.alias = alias;
}

// @ts-ignore
if (this.webex.meetings.clientRegion) {
// @ts-ignore
Expand Down
1 change: 1 addition & 0 deletions packages/@webex/plugin-meetings/src/meeting/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 16 additions & 0 deletions packages/@webex/plugin-meetings/test/unit/spec/meeting/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
11 changes: 8 additions & 3 deletions packages/@webex/plugin-meetings/test/unit/spec/meeting/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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');
});
});

Expand Down

0 comments on commit 763890c

Please sign in to comment.