Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-meetings): added alias as option in joinmeeting #3902

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/samples/browser-plugin-meetings/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ const createMeetingSelectElm = document.querySelector('#createMeetingDest');
const createMeetingActionElm = document.querySelector('#create-meeting-action');
const meetingsJoinDeviceElm = document.querySelector('#meetings-join-device');
const meetingsJoinPinElm = document.querySelector('#meetings-join-pin');
const meetingsGuestName = document.querySelector('#meetings-guest-name');
const meetingsJoinModeratorElm = document.querySelector('#meetings-join-moderator');
const meetingsListCollectElm = document.querySelector('#meetings-list-collect');
const meetingsListMsgElm = document.querySelector('#meetings-list-msg');
Expand Down Expand Up @@ -464,12 +465,13 @@ function joinMeeting({withMedia, withDevice} = {withMedia: false, withDevice: fa

const joinOptions = {
pin: meetingsJoinPinElm.value,
alias: meetingsGuestName.value,
moderator: meetingsJoinModeratorElm.checked,
moveToResource: false,
resourceId,
receiveTranscription: receiveTranscriptionOption
};

const joinMeetingNow = () => {
meeting.join(joinOptions)
.then(() => { // eslint-disable-line
Expand Down
1 change: 1 addition & 0 deletions docs/samples/browser-plugin-meetings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ <h2 class="collapsible">Meeting Management</h2>
<legend>Join Meeting</legend>
<!-- Password, captcha image and input html code -->
<div class="u-mv">
<input id="meetings-guest-name" name="GuestUserName" placeholder="Enter an alias(Optional)" value="" type="text">
<input id="meetings-join-pin" name="meetingPin" placeholder="Password/PIN" value="" type="text">
<div>
<img id="meetings-join-captcha" src="" alt="captcha" style="width: 150px; height: 70px;" hidden>
Expand Down
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,13 @@ describe('plugin-meetings', () => {
};

MeetingUtil.parseLocusJoin = sinon.stub();
await MeetingUtil.joinMeeting(meeting, {});
await MeetingUtil.joinMeeting(meeting, {alias: 'assigned name'});

assert.calledOnce(meeting.meetingRequest.joinMeeting);
const parameter = meeting.meetingRequest.joinMeeting.getCall(0).args[0];

assert.equal(parameter.inviteeAddress, 'meetingJoinUrl');
assert.equal(parameter.alias, 'assigned name');
});

it('#Should fallback sipUrl if meetingJoinUrl does not exists', async () => {
Expand All @@ -156,12 +157,13 @@ describe('plugin-meetings', () => {
};

MeetingUtil.parseLocusJoin = sinon.stub();
await MeetingUtil.joinMeeting(meeting, {});
await MeetingUtil.joinMeeting(meeting, {alias: 'assigned name'});

assert.calledOnce(meeting.meetingRequest.joinMeeting);
const parameter = meeting.meetingRequest.joinMeeting.getCall(0).args[0];

assert.equal(parameter.inviteeAddress, 'sipUri');
assert.equal(parameter.alias, 'assigned name');
});

it('#Should fallback to meetingNumber if meetingJoinUrl/sipUrl does not exists', async () => {
Expand All @@ -174,13 +176,14 @@ describe('plugin-meetings', () => {
};

MeetingUtil.parseLocusJoin = sinon.stub();
await MeetingUtil.joinMeeting(meeting, {});
await MeetingUtil.joinMeeting(meeting, {alias: 'assigned name'});

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, 'assigned name');
});
});

Expand Down
Loading