@webex/plugin-meetings 1.151.1 → 1.151.5

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.
@@ -21,7 +21,8 @@ import {
21
21
  MEET,
22
22
  MEET_M,
23
23
  HTTPS_PROTOCOL,
24
- UUID_REG
24
+ UUID_REG,
25
+ VALID_EMAIL_ADDRESS
25
26
  } from '../constants';
26
27
  import ParameterError from '../common/errors/parameter';
27
28
  import LoggerProxy from '../common/logs/logger-proxy';
@@ -116,8 +117,27 @@ MeetingInfoUtil.getSipUriFromHydraPersonId = (destination, webex) => webex.peopl
116
117
 
117
118
 
118
119
  MeetingInfoUtil.getDestinationType = async (from) => {
119
- const {destination, type, webex} = from;
120
+ const {type, webex} = from;
121
+ let {destination} = from;
122
+
123
+ if (type === _PERSONAL_ROOM_) { // this case checks if your type is personal room
124
+ if (!destination) { // if we are not getting anything in desination we fetch org and user ids from webex instance
125
+ destination = {
126
+ userId: webex.internal.device.userId,
127
+ orgId: webex.internal.device.orgId
128
+ };
129
+ }
130
+ else {
131
+ const options = VALID_EMAIL_ADDRESS.test(destination) ? {email: destination} : {id: destination};// we are assuming userId as default
132
+ const res = await webex.people.list(options);
133
+
134
+ let {orgId, id: userId} = res.items[0];
120
135
 
136
+ userId = deconstructHydraId(userId).id;
137
+ orgId = deconstructHydraId(orgId).id;
138
+ destination = {userId, orgId};
139
+ }
140
+ }
121
141
  if (type) {
122
142
  return {
123
143
  destination,
@@ -193,15 +213,17 @@ MeetingInfoUtil.getDestinationType = async (from) => {
193
213
  */
194
214
  MeetingInfoUtil.getRequestBody = (options) => {
195
215
  const {type, destination} = options;
196
- const body = {};
216
+ const body = {
217
+ supportHostKey: true
218
+ };
197
219
 
198
220
  switch (type) {
199
221
  case _SIP_URI_:
200
222
  body.sipUrl = destination;
201
223
  break;
202
224
  case _PERSONAL_ROOM_:
203
- body.userId = destination;
204
- body.orgId = ''; // TODO: when to use the org iD (fetch others PMR)
225
+ body.userId = destination.userId;
226
+ body.orgId = destination.orgId;
205
227
  break;
206
228
  case _MEETING_ID_:
207
229
  body.meetingKey = destination;
@@ -174,6 +174,8 @@ export default class Meetings extends WebexPlugin {
174
174
  getSupportedDevice: Media.getSupportedDevice
175
175
  };
176
176
 
177
+ LoggerProxy.set(this.webex.logger);
178
+
177
179
  this.onReady();
178
180
  MeetingsUtil.checkH264Support({disableNotifications: true});
179
181
  Metrics.initialSetup(this.meetingCollection, this.webex);
@@ -371,7 +373,6 @@ export default class Meetings extends WebexPlugin {
371
373
  this.webex.once(READY, () => {
372
374
  StaticConfig.set(this.config);
373
375
  LoggerConfig.set(this.config.logging);
374
- LoggerProxy.set(this.webex.logger);
375
376
 
376
377
  /**
377
378
  * The MeetingInfo object to interact with server
@@ -68,9 +68,10 @@ skipInNode(describe)('plugin-meetings', () => {
68
68
  {scope: chris.webex.meetings, event: 'meeting:added', user: chris}
69
69
  ])
70
70
  ]).then(() => {
71
- const {meetingNumber} = bob.meeting.meetingInfo;
71
+ // TODO Renenable after unified flag is enabled
72
+ // const {meetingNumber} = bob.meeting.meetingInfo;
72
73
 
73
- assert(meetingNumber === alice.meeting.meetingNumber, 'meetingNumber matches alice meeting number');
74
+ // assert(meetingNumber === alice.meeting.meetingNumber, 'meetingNumber matches alice meeting number');
74
75
  })));
75
76
 
76
77
  xit('Should fetch user info using user hydra id with the new api', () => alice.webex.rooms.create({title: 'sample'})
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
4
 
5
- import {assert} from '@webex/test-helper-chai';
5
+ import {assert, expect} from '@webex/test-helper-chai';
6
6
  import sinon from 'sinon';
7
7
  import {
8
8
  _MEETING_ID_,
@@ -14,8 +14,23 @@ import {
14
14
  _MEETING_UUID_
15
15
  } from '@webex/plugin-meetings/src/constants';
16
16
  import MeetingInfoUtil from '@webex/plugin-meetings/src/meeting-info/utilv2';
17
+ import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
18
+ import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config';
17
19
 
18
20
  describe('plugin-meetings', () => {
21
+ const logger = {
22
+ log: () => {},
23
+ error: () => {},
24
+ warn: () => {},
25
+ trace: () => {},
26
+ debug: () => {}
27
+ };
28
+
29
+ beforeEach(() => {
30
+ LoggerConfig.set({verboseEvents: true, enable: false});
31
+ LoggerProxy.set(logger);
32
+ });
33
+
19
34
  describe('Meeting Info Utils V2', () => {
20
35
  beforeEach(() => {
21
36
  MeetingInfoUtil.getHydraId = sinon.stub().returns(false);
@@ -68,17 +83,78 @@ describe('plugin-meetings', () => {
68
83
  assert.equal(res.type, _CONVERSATION_URL_);
69
84
  assert.equal(res.destination, 'https://conv-a.wbx2.com/conversation/api/v1/conversations/bfb49280');
70
85
  });
86
+
87
+ describe('PMR', () => {
88
+ const mockedListReturn = {userId: '01824b9b-adef-4b10-b5c1-8a2fe2fb7c0e', orgId: '1eb65fdf-9643-417f-9974-ad72cae0e10f'};
89
+ const mockedList = {
90
+ items: [{
91
+ id: 'Y2lzY29zcGFyazovL3VzL1BFT1BMRS8wMTgyNGI5Yi1hZGVmLTRiMTAtYjVjMS04YTJmZTJmYjdjMGU',
92
+ orgId: 'Y2lzY29zcGFyazovL3VzL09SR0FOSVpBVElPTi8xZWI2NWZkZi05NjQzLTQxN2YtOTk3NC1hZDcyY2FlMGUxMGY'
93
+ }]
94
+
95
+ };
96
+
97
+ it('should return a userID and orgID without passing a destination', async () => {
98
+ const res = await MeetingInfoUtil.getDestinationType({
99
+ type: _PERSONAL_ROOM_,
100
+ webex: {
101
+ internal: {
102
+ device: {
103
+ userId: '01824b9b-adef-4b10-b5c1-8a2fe2fb7c0e',
104
+ orgId: '1eb65fdf-9643-417f-9974-ad72cae0e10f'
105
+ }
106
+ }
107
+ }
108
+ });
109
+
110
+ expect(res.destination.userId).to.equal('01824b9b-adef-4b10-b5c1-8a2fe2fb7c0e');
111
+ expect(res.destination.orgId).to.equal('1eb65fdf-9643-417f-9974-ad72cae0e10f');
112
+ });
113
+
114
+ it('should return a userID and orgID when passing an email', async () => {
115
+ const res = await MeetingInfoUtil.getDestinationType({
116
+ type: _PERSONAL_ROOM_,
117
+ destination: 'amritesi@cisco.com',
118
+ webex: {
119
+ people: {list: sinon.stub().returns(mockedList)}
120
+
121
+ }
122
+ });
123
+ const {orgId, userId} = res.destination;
124
+
125
+ expect(userId).to.equal(mockedListReturn.userId);
126
+ expect(orgId).to.equal(mockedListReturn.orgId);
127
+ });
128
+
129
+ it('should return a userID and orgID when passing an id', async () => {
130
+ const res = await MeetingInfoUtil.getDestinationType({
131
+ type: _PERSONAL_ROOM_,
132
+ destination: '01824b9b-adef-4b10-b5c1-8a2fe2fb7c0e',
133
+ webex: {
134
+ people: {list: sinon.stub().returns(mockedList)}
135
+ }
136
+
137
+ });
138
+ const {orgId, userId} = res.destination;
139
+
140
+ expect(userId).to.equal(mockedListReturn.userId);
141
+ expect(orgId).to.equal(mockedListReturn.orgId);
142
+ });
143
+ });
71
144
  });
72
145
 
73
146
  describe('#getRequestBody', () => {
74
147
  it('for _PERSONAL_ROOM_', () => {
75
148
  const res = MeetingInfoUtil.getRequestBody({
76
149
  type: _PERSONAL_ROOM_,
77
- destination: 'userId_1234'
150
+ destination: {
151
+ userId: '01824b9b-adef-4b10-b5c1-8a2fe2fb7c0e',
152
+ orgId: '1eb65fdf-9643-417f-9974-ad72cae0e10f'
153
+ }
78
154
  });
79
155
 
80
- assert.equal(res.orgId, '');
81
- assert.equal(res.userId, 'userId_1234');
156
+ assert.equal(res.orgId, '1eb65fdf-9643-417f-9974-ad72cae0e10f');
157
+ assert.equal(res.userId, '01824b9b-adef-4b10-b5c1-8a2fe2fb7c0e');
82
158
  });
83
159
 
84
160
  it('for _MEETING_ID_', () => {