@webex/plugin-meetings 1.151.7 → 1.152.0

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"names":["Meetings","args","MEETINGS","request","Request","parent","webex","loggerRequest","LoggerRequest","meetingCollection","MeetingCollection","personalMeetingRoom","reachability","registered","media","getUserMedia","Media","getSupportedDevice","LoggerProxy","set","logger","onReady","MeetingsUtil","checkH264Support","disableNotifications","Metrics","initialSetup","data","meeting","getByKey","LOCUS_URL","locusUrl","CORRELATION_ID","checkForCorrelationId","internal","device","url","locus","SIP_URI","self","callbackInfo","callbackAddress","CONVERSATION_URL","conversationUrl","replaces","length","fullState","state","LOCUS","STATE","INACTIVE","warn","_LEFT_","removed","create","_LOCUS_ID_","then","newMeeting","eventType","LOCUSEVENT","DIFFERENCE","locusInfo","catch","e","console","log","finally","getMeetingByType","_ID_","id","postEvent","event","REMOTE_STARTED","trigger","MERCURY_EVENT","Trigger","file","function","EVENT_TRIGGERS","MEETING_ADDED","type","_MEETING_","_JOIN_","_INCOMING_","parse","envelope","MESSAGE_ROAP","handleLocusEvent","MEETINGS_NETWORK_DISCONNECTED","mercury","on","LOCUS_MERCURY","handleLocusMercury","ROAP","ROAP_MERCURY","handleRoapMercury","ONLINE","syncMeetings","OFFLINE","handleMercuryOffline","off","once","READY","StaticConfig","config","LoggerConfig","logging","meetingInfo","experimental","enableUnifiedMeetings","MeetingInfoV2","MeetingInfo","PersonalMeetingRoom","MEETINGS_READY","canAuthorize","error","reject","Error","info","resolve","all","getGeoHint","startReachability","message","register","connect","call","listenForEvents","MEETINGS_REGISTERED","stopListeningForEvents","disconnect","unregister","MEETINGS_UNREGISTERED","options","uploadLogs","uploadResult","MEETING_LOG_UPLOAD_SUCCESS","meetingId","details","uploadError","MEETING_LOG_UPLOAD_FAILURE","reason","sendOperationalMetric","METRICS_OPERATIONAL_MEASURES","UPLOAD_LOGS_FAILURE","meetingsId","stack","code","Reachability","setReachability","getReachability","gatherReachability","fetchGeoHint","res","geoHintInfo","MeetingUtil","cleanUp","delete","MEETING_REMOVED","destination","fetchInfoOptions","targetDest","_CONVERSATION_URL_","createMeeting","createdMeeting","EVENTS","DESTROY_MEETING","payload","autoUploadLogs","callStart","lastActive","correlationId","feedbackId","locusId","webExMeetingId","destroy","REQUEST_UPLOAD_LOGS","meetingInstance","Meeting","userId","deviceUrl","orgId","roapSeq","fetchMeetingInfo","parseMeetingInfo","body","debug","sipUri","setSipUri","meetingAddedType","getMeetingAddedType","value","getAll","getActiveMeetings","locusArray","activeLocusUrl","loci","forEach","push","meetingsCollection","includes","MEETING_REMOVED_REASON","NO_MEETINGS_TO_SYNC","scheduled","get","StatsAnalyzer","StatsCalculator","WebexPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAwBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;IACqBA,Q;;;;;AAGjB;AACJ;AACA;AACA;AACA;AACA;AACI,sBAAqB;AAAA;;AAAA;;AAAA,sCAANC,IAAM;AAANA,MAAAA,IAAM;AAAA;;AACnB,oDAASA,IAAT;AAEA;AACN;AACA;AACA;AACA;AACA;AACA;;AATyB,4FARTC,mBAQS;AAUnB,UAAKC,OAAL,GAAe,IAAIC,iBAAJ,CAAY,EAAZ,EAAgB;AAACC,MAAAA,MAAM,EAAE,MAAKC;AAAd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D,cAAAA,KAAK,EAALA,KADoB;AAEpBN,cAAAA,QAAQ,EAAEM,KAAK,CAACD;AAFI,aAAtB;AAID,WAND;AAOD;;AACD,YAAMmK,kBAAkB,GAAG,OAAI,CAAC9L,iBAAL,CAAuBuL,MAAvB,EAA3B;;AAEA,YAAI,mBAAYO,kBAAZ,EAAgC1J,MAAhC,GAAyC,CAA7C,EAAgD;AAC9C;AACA;AACA,4CAAsB,qBAAc0J,kBAAd,CAAtB,oCAAyD;AAApD,gBAAM3K,OAAO,qBAAb;;AACH,gBAAI,CAACuK,cAAc,CAACK,QAAf,CAAwB5K,OAAO,CAACG,QAAhC,CAAL,EAAgD;AAC9C;AACA,cAAA,OAAI,CAACgJ,OAAL,CAAanJ,OAAb,EAAsB6K,kCAAuBC,mBAA7C;AACD;AACF;AACF;AACF,OAxBM,CAAP;AAyBD;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,gCAAuB;AACrB,aAAO,KAAKjM,iBAAL,CAAuBuL,MAAvB,CAA8B;AAACW,QAAAA,SAAS,EAAE;AAAZ,OAA9B,CAAP;AACD;AAED;AACJ;AACA;AACA;;;;WACI,qBAAY;AACV,aAAOzL,qBAAY0L,GAAZ,EAAP;AACD;AAED;AACJ;AACA;AACA;AACA;AACA;;;;WACI,uBAAc;AACZ,aAAOC,iBAAP;AACD;AAED;AACJ;AACA;AACA;AACA;AACA;;;;WACI,yBAAgB;AACd,aAAOC,mBAAP;AACD;;;EA/wBiCC,sB","sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n*/\n\nimport '@webex/internal-plugin-mercury';\nimport {WebexPlugin} from '@webex/webex-core';\n\nimport 'webrtc-adapter';\n\nimport Metrics from '../metrics';\nimport {trigger, eventType} from '../metrics/config';\nimport LoggerConfig from '../common/logs/logger-config';\nimport StaticConfig from '../common/config';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport LoggerRequest from '../common/logs/request';\nimport Trigger from '../common/events/trigger-proxy';\nimport Media from '../media';\nimport MeetingUtil from '../meeting/util';\nimport {\n MEETINGS,\n EVENTS,\n EVENT_TRIGGERS,\n READY,\n LOCUSEVENT,\n LOCUS_URL,\n ROAP,\n ONLINE,\n OFFLINE,\n _MEETING_,\n _JOIN_,\n _LOCUS_ID_,\n _INCOMING_,\n LOCUS,\n CORRELATION_ID,\n SIP_URI,\n _LEFT_,\n _ID_,\n MEETING_REMOVED_REASON,\n _CONVERSATION_URL_,\n CONVERSATION_URL,\n METRICS_OPERATIONAL_MEASURES\n} from '../constants';\nimport MeetingInfo from '../meeting-info';\nimport MeetingInfoV2 from '../meeting-info/meeting-info-v2';\nimport Meeting from '../meeting';\nimport PersonalMeetingRoom from '../personal-meeting-room';\nimport Reachability from '../reachability';\nimport Request from '../meetings/request';\nimport StatsAnalyzer from '../analyzer/analyzer';\nimport StatsCalculator from '../analyzer/calculator';\n\nimport MeetingCollection from './collection';\nimport MeetingsUtil from './util';\n\n\n/**\n * Meetings Ready Event\n * Emitted when the meetings instance on webex is ready\n * @event meetings:ready\n * @instance\n * @memberof Meetings\n */\n\n/**\n * Meetings Network Disconnected Event\n * Emitted when the meetings instance is disconnected from\n * the internal mercury server\n * @event network:disconnected\n * @instance\n * @memberof Meetings\n */\n\n/**\n * Meetings Registered Event\n * Emitted when the meetings instance has been registered and listening\n * @event meetings:registered\n * @instance\n * @memberof Meetings\n */\n\n/**\n * Meeting Removed Event\n * Emitted when a meeting was removed from the cache of meetings\n * @event meeting:removed\n * @instance\n * @type {Object}\n * @property {String} meetingId the removed meeting\n * @property {Object} response the server response\n * @property {String} type what type of meeting it was\n * @memberof Meetings\n */\n\n/**\n * Meeting Added Event\n * Emitted when a meeting was added to the cache of meetings\n * @event meeting:added\n * @instance\n * @type {Object}\n * @property {String} meetingId the added meeting\n * @property {String} type what type of meeting it was\n * @memberof Meetings\n */\n\n/**\n * Maintain a cache of meetings and sync with services.\n * @class\n */\nexport default class Meetings extends WebexPlugin {\n namespace = MEETINGS;\n\n /**\n * Initializes the Meetings Plugin\n * @constructor\n * @public\n * @memberof Meetings\n */\n constructor(...args) {\n super(...args);\n\n /**\n * The Meetings request to interact with server\n * @instance\n * @type {Object}\n * @private\n * @memberof Meetings\n */\n this.request = new Request({}, {parent: this.webex});\n /**\n * Log upload request helper\n * @instance\n * @type {Object}\n * @private\n * @memberof Meetings\n */\n this.loggerRequest = new LoggerRequest({webex: this.webex});\n this.meetingCollection = new MeetingCollection();\n /**\n * The PersonalMeetingRoom object to interact with server\n * @instance\n * @type {Object}\n * @public\n * @memberof Meetings\n */\n this.personalMeetingRoom = null;\n /**\n * The Reachability object to interact with server, starts as null until {@link Meeting#setReachability} is called\n * starts as null\n * @instance\n * @type {Object}\n * @private\n * @memberof Meetings\n */\n this.reachability = null;\n\n /**\n * If the meetings plugin has been registered and listening via {@link Meetings#register}\n * @instance\n * @type {Boolean}\n * @public\n * @memberof Meetings\n */\n this.registered = false;\n\n /**\n * The public interface for the internal Media util files. These are helpful to expose outside the context\n * of a meeting so that a user can access media without creating a meeting instance.\n * @instance\n * @type {Object}\n * @private\n * @memberof Meetings\n */\n this.media = {\n getUserMedia: Media.getUserMedia,\n getSupportedDevice: Media.getSupportedDevice\n };\n\n LoggerProxy.set(this.webex.logger);\n\n this.onReady();\n MeetingsUtil.checkH264Support({disableNotifications: true});\n Metrics.initialSetup(this.meetingCollection, this.webex);\n }\n\n /**\n * handle locus events and takes meeting actions with them as they come in\n * @param {Object} data a locus event\n * @param {String} data.locusUrl\n * @param {Object} data.locus\n * @param {String} data.eventType\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n handleLocusEvent(data) {\n let meeting = null;\n\n // getting meeting by correlationId. This will happen for the new event\n // Either the locus\n // TODO : Add check for the callBack Address\n meeting = this.meetingCollection.getByKey(LOCUS_URL, data.locusUrl) ||\n this.meetingCollection.getByKey(CORRELATION_ID, MeetingsUtil.checkForCorrelationId(this.webex.internal.device.url, data.locus)) ||\n this.meetingCollection.getByKey(SIP_URI, data.locus.self && data.locus.self.callbackInfo && data.locus.self.callbackInfo.callbackAddress) ||\n this.meetingCollection.getByKey(CONVERSATION_URL, data.locus.conversationUrl);\n\n // Special case when locus has got replaced, This only happend once if a replace locus exists\n // https://sqbu-github.cisco.com/WebExSquared/locus/wiki/Locus-changing-mid-call\n\n if (!meeting && data.locus?.replaces?.length > 0) {\n // Always the last element in the replace is the active one\n meeting = this.meetingCollection.getByKey(LOCUS_URL, data.locus.replaces[data.locus.replaces.length - 1].locusUrl);\n }\n\n if (!meeting) {\n // TODO: create meeting when we get a meeting object\n // const checkForEnded = (locus) => {\n // TODO: you already ended the meeting but you got an event later\n // Mainly for 1:1 Callsor meeting\n // Happens mainly after refresh\n\n // 1:1 Meeting\n // 1) You ended a call before but you got a mercury event\n // Make sure end the call and cleanup the meeting only if the mercury\n // event says so\n // 2) Maintain lastSync time in the meetings object which helps to compare\n // If the meeting came befor or after the sync . ANy meeting start time before the sync time is invalid\n\n // For space Meeting\n // Check the locus object and see who has joined\n\n // };\n // rather then locus object change to locus url\n\n if (data.locus && data.locus.fullState && data.locus.fullState.state === LOCUS.STATE.INACTIVE) {\n // just ignore the event as its already ended and not active\n LoggerProxy.logger.warn('Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.');\n\n return;\n }\n\n\n // When its wireless share or guest and user leaves the meeting we dont have to keep the meeting object\n // Any future events will be neglected\n\n if (data.locus && data.locus.self && (data.locus.self.state === _LEFT_ && data.locus.self.removed === true)) {\n // just ignore the event as its already ended and not active\n LoggerProxy.logger.warn('Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.');\n\n return;\n }\n\n this.create(data.locus, _LOCUS_ID_).then((newMeeting) => {\n meeting = newMeeting;\n\n if (data.eventType === LOCUSEVENT.DIFFERENCE) {\n // its a delta object and we have a new meeting\n meeting.locusInfo.initialSetup(data.locus, meeting);\n }\n else {\n // Its a new meeting and have a fresh locus object\n meeting.locusInfo.initialSetup(data.locus);\n }\n }).catch((e) => {\n console.log(e);\n })\n .finally(() => {\n // There will be cases where locus event comes in gets created and deleted because its a 1:1 and meeting gets deleted\n // because the other user left so before sending 'added' event make sure it exists in the collection\n\n if (this.getMeetingByType(_ID_, meeting.id)) {\n Metrics.postEvent({event: eventType.REMOTE_STARTED, meeting, data: {trigger: trigger.MERCURY_EVENT}});\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'handleLocusEvent'\n },\n EVENT_TRIGGERS.MEETING_ADDED,\n {\n meeting,\n type: meeting.type === _MEETING_ ? _JOIN_ : _INCOMING_\n }\n );\n }\n else {\n // Meeting got added but was not found in the collection. It might have got destroyed\n LoggerProxy.logger.warn('Meetings:index#handleLocusEvent --> Created and destroyed meeting object before sending an event');\n }\n });\n }\n else {\n meeting.locusInfo.parse(meeting, data);\n }\n }\n\n /**\n * handles locus events through mercury that are not roap\n * @param {Object} envelope\n * @param {Object} envelope.data\n * @param {String} envelope.data.eventType\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n handleLocusMercury(envelope) {\n const {data} = envelope;\n const {eventType} = data;\n\n if (eventType && eventType !== LOCUSEVENT.MESSAGE_ROAP) {\n this.handleLocusEvent(data);\n }\n }\n\n\n /**\n * handles mecury offline event\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n handleMercuryOffline() {\n Trigger.trigger(\n this,\n {\n file: 'meetings/index',\n function: 'handleMercuryOffline'\n },\n EVENT_TRIGGERS.MEETINGS_NETWORK_DISCONNECTED,\n );\n }\n\n\n /**\n * registers for locus and roap mercury events\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n listenForEvents() {\n this.webex.internal.mercury.on(LOCUSEVENT.LOCUS_MERCURY, (envelope) => {\n this.handleLocusMercury(envelope);\n });\n this.webex.internal.mercury.on(ROAP.ROAP_MERCURY, (envelope) => {\n MeetingsUtil.handleRoapMercury(envelope, this.meetingCollection);\n });\n\n this.webex.internal.mercury.on(ONLINE, () => {\n this.syncMeetings();\n });\n\n this.webex.internal.mercury.on(OFFLINE, () => {\n this.handleMercuryOffline();\n });\n }\n\n /**\n * stops listening for locus and roap mercury events\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n stopListeningForEvents() {\n this.webex.internal.mercury.off(LOCUSEVENT.LOCUS_MERCURY);\n this.webex.internal.mercury.off(ROAP.ROAP_MERCURY);\n this.webex.internal.mercury.off(ONLINE);\n }\n\n /**\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n onReady() {\n this.webex.once(READY, () => {\n StaticConfig.set(this.config);\n LoggerConfig.set(this.config.logging);\n\n /**\n * The MeetingInfo object to interact with server\n * @instance\n * @type {Object}\n * @private\n * @memberof Meetings\n */\n this.meetingInfo = this.config.experimental.enableUnifiedMeetings ? new MeetingInfoV2(this.webex) : new MeetingInfo(this.webex);\n this.personalMeetingRoom = new PersonalMeetingRoom({meetingInfo: this.meetingInfo}, {parent: this.webex});\n\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'onReady'\n },\n EVENT_TRIGGERS.MEETINGS_READY\n );\n });\n }\n\n /**\n * Explicitly sets up the meetings plugin by registering\n * the device, connecting to mercury, and listening for locus events.\n *\n * @returns {Promise}\n * @public\n * @memberof Meetings\n */\n register() {\n if (!this.webex.canAuthorize) {\n LoggerProxy.logger.error('Meetings:index#register --> ERROR, Unable to register, SDK cannot authorize');\n\n return Promise.reject(new Error('SDK cannot authorize'));\n }\n\n\n if (this.registered) {\n LoggerProxy.logger.info('Meetings:index#register --> INFO, Meetings plugin already registered');\n\n return Promise.resolve();\n }\n\n return Promise.all([\n this.getGeoHint(),\n this.startReachability().catch((error) => {\n LoggerProxy.logger.error(`Meetings:index#register --> GDM error, ${error.message}`);\n }),\n this.webex.internal.device.register()\n .then(() => LoggerProxy.logger.info(`Meetings:index#register --> INFO, Device registered ${this.webex.internal.device.url}`))\n .then(() => this.webex.internal.mercury.connect()),\n MeetingsUtil.checkH264Support.call(this)\n ]).then(() => {\n this.listenForEvents();\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'register'\n },\n EVENT_TRIGGERS.MEETINGS_REGISTERED\n );\n this.registered = true;\n })\n .catch((error) => {\n LoggerProxy.logger.error(`Meetings:index#register --> ERROR, Unable to register, ${error.message}`);\n\n return Promise.reject(error);\n });\n }\n\n /**\n * Explicitly tears down the meetings plugin by deregistering\n * the device, disconnecting from mercury, and stops listening to locus events\n *\n * @returns {Promise}\n * @public\n * @memberof Meetings\n */\n unregister() {\n if (!this.registered) {\n LoggerProxy.logger.info('Meetings:index#unregister --> INFO, Meetings plugin already unregistered');\n\n return Promise.resolve();\n }\n\n this.stopListeningForEvents();\n\n return this.webex.internal.mercury.disconnect()\n .then(() => this.webex.internal.device.unregister())\n .then(() => {\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'unregister'\n },\n EVENT_TRIGGERS.MEETINGS_UNREGISTERED\n );\n this.registered = false;\n });\n }\n\n /**\n * Uploads logs to the webex services for tracking\n * @param {Object} [options={}]\n * @param {String} [options.callStart] Call Start Time\n * @param {String} [options.feedbackId] ID used for tracking\n * @param {String} [options.locusId]\n * @param {String} [options.correlationId]\n * @param {String} [options.meetingId] webex meeting ID\n * @param {String} [options.userId] userId\n * @param {String} [options.orgId] org id\n * @returns {String} feedback ID logs were submitted under\n */\n uploadLogs(options = {}) {\n LoggerProxy.logger.info('Meetings:index#uploadLogs --> uploading logs');\n\n return this.loggerRequest.uploadLogs(options)\n .then((uploadResult) => {\n LoggerProxy.logger.info('Meetings:index#uploadLogs --> Upload logs for meeting completed.', uploadResult);\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'uploadLogs'\n },\n EVENT_TRIGGERS.MEETING_LOG_UPLOAD_SUCCESS,\n {\n meetingId: options.meetingId,\n details: uploadResult\n }\n );\n })\n .catch((uploadError) => {\n LoggerProxy.logger.error('Meetings:index#uploadLogs --> Unable to upload logs for meeting', uploadError);\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'uploadLogs'\n },\n EVENT_TRIGGERS.MEETING_LOG_UPLOAD_FAILURE,\n {\n meetingId: options.meetingId,\n reason: uploadError\n }\n );\n\n Metrics.sendOperationalMetric(\n METRICS_OPERATIONAL_MEASURES.UPLOAD_LOGS_FAILURE,\n {\n meetingId: options.meetingsId,\n reason: uploadError.message,\n stack: uploadError.stack,\n code: uploadError.code\n }\n );\n });\n }\n\n /**\n * initializes the reachability instance for Meetings\n * @returns {undefined}\n * @public\n * @memberof Meetings\n */\n setReachability() {\n this.reachability = new Reachability(this.webex);\n }\n\n /**\n * gets the reachability instance for Meetings\n * @returns {Reachability}\n * @public\n * @memberof Meetings\n */\n getReachability() {\n return this.reachability;\n }\n\n /**\n * initializes and starts gathering reachability for Meetings\n * @returns {Promise}\n * @public\n * @memberof Meetings\n */\n startReachability() {\n if (!this.reachability) {\n this.setReachability();\n }\n\n return this.getReachability().gatherReachability();\n }\n\n /**\n * Get geoHint for info for meetings\n * @returns {Promise}\n * @private\n * @memberof Meetings\n */\n getGeoHint() {\n return this.request.fetchGeoHint().then((res) => {\n this.geoHintInfo = res;\n });\n }\n\n /**\n * gets the personal meeting room instance, for saved PMR values for this user\n * @returns {PersonalMeetingRoom}\n * @public\n * @memberof Meetings\n */\n getPersonalMeetingRoom() {\n return this.personalMeetingRoom;\n }\n\n /**\n * @param {Meeting} meeting\n * @param {Object} reason\n * @param {String} type\n * @returns {Undefined}\n * @private\n * @memberof Meetings\n */\n destroy(meeting, reason) {\n MeetingUtil.cleanUp(meeting);\n this.meetingCollection.delete(meeting.id);\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'destroy'\n },\n EVENT_TRIGGERS.MEETING_REMOVED,\n {\n meetingId: meeting.id,\n reason\n }\n );\n }\n\n /**\n * Create a meeting.\n * @param {string} destination - sipURL, spaceId, phonenumber, or locus object}\n * @param {string} [type] - the optional specified type, such as locusId\n * @returns {Promise<Meeting>} A new Meeting.\n * @public\n * @memberof Meetings\n */\n create(destination, type = null) {\n // TODO: type should be from a dictionary\n\n // Validate meeting information based on the provided destination and\n // type. This must be performed prior to determining if the meeting is\n // found in the collection, as we mutate the destination for hydra person\n // id values.\n return this.meetingInfo.fetchInfoOptions(destination, type)\n // Catch a failure to fetch info options.\n .catch((error) => {\n LoggerProxy.logger.info(`Meetings:index#create --> INFO, unable to determine info options: ${error.message}`);\n })\n .then((options = {}) => {\n // Normalize the destination.\n const targetDest = options.destination || destination;\n\n // check for the conversation URL then sip Url\n let meeting = null;\n\n if (type === _CONVERSATION_URL_ || options.type === _CONVERSATION_URL_) {\n meeting = this.meetingCollection.getByKey(CONVERSATION_URL, targetDest);\n }\n\n // Attempt to collect the meeting if it exists.\n if (!meeting) {\n meeting = this.meetingCollection.getByKey(SIP_URI, targetDest);\n }\n\n\n // Validate if a meeting was found.\n if (!meeting) {\n // Create a meeting based on the normalized destination and type.\n return this.createMeeting(targetDest, type)\n .then((createdMeeting) => {\n // If the meeting was successfully created.\n if (createdMeeting && createdMeeting.on) {\n // Create a destruction event for the meeting.\n createdMeeting.on(EVENTS.DESTROY_MEETING, (payload) => {\n if (this.config.autoUploadLogs) {\n this.uploadLogs({\n callStart: createdMeeting.locusInfo?.fullState?.lastActive,\n correlationId: createdMeeting.correlationId,\n feedbackId: createdMeeting.correlationId,\n locusId: createdMeeting.locusId,\n meetingId: createdMeeting.locusInfo?.info?.webExMeetingId\n }).then(() => this.destroy(createdMeeting, payload.reason));\n }\n else {\n this.destroy(createdMeeting, payload.reason);\n }\n });\n\n createdMeeting.on(EVENTS.REQUEST_UPLOAD_LOGS, (meetingInstance) => {\n if (this.config.autoUploadLogs) {\n this.uploadLogs({\n callStart: meetingInstance?.locusInfo?.fullState?.lastActive,\n correlationId: meetingInstance.correlationId,\n feedbackId: meetingInstance.correlationId,\n locusId: meetingInstance.locusId,\n meetingId: meetingInstance.locusInfo?.info?.webExMeetingId\n });\n }\n });\n }\n else {\n LoggerProxy.logger.error(`Meetings:index#create --> ERROR, meeting does not have on method, will not be destroyed, meeting cleanup impossible for meeting: ${meeting}`);\n }\n\n // Return the newly created meeting.\n return Promise.resolve(createdMeeting);\n });\n }\n\n // Return the existing meeting.\n return Promise.resolve(meeting);\n });\n }\n\n /**\n * @param {String} destination see create()\n * @param {String} type see create()\n * @returns {Promise} a new meeting instance complete with meeting info and destination\n * @private\n * @memberof Meetings\n */\n async createMeeting(destination, type = null) {\n const meeting = new Meeting(\n {\n userId: this.webex.internal.device.userId,\n deviceUrl: this.webex.internal.device.url,\n orgId: this.webex.internal.device.orgId,\n roapSeq: 0,\n locus: type === _LOCUS_ID_ ? destination : null // pass the locus object if present\n },\n {\n parent: this.webex\n }\n );\n\n this.meetingCollection.set(meeting);\n\n try {\n const info = await this.meetingInfo.fetchMeetingInfo(destination, type);\n\n meeting.parseMeetingInfo(info);\n meeting.meetingInfo = info ? info.body : null;\n }\n catch (err) {\n // if there is no meeting info we assume its a 1:1 call or wireless share\n LoggerProxy.logger.info(`Meetings:index#createMeeting --> Info Unable to fetch meeting info for ${destination}.`);\n LoggerProxy.logger.info('Meetings:index#createMeeting --> Info assuming this destination is a 1:1 or wireless share');\n LoggerProxy.logger.debug(`Meetings:index#createMeeting --> Debug ${err} fetching /meetingInfo for creation.`);\n // We need to save this info for future reference\n meeting.destination = destination;\n }\n finally {\n // For type LOCUS_ID we need to parse the locus object to get the information\n // about the caller and callee\n // Meeting Added event will be created in `handleLocusEvent`\n if (type !== _LOCUS_ID_) {\n if (!meeting.sipUri) {\n meeting.setSipUri(destination);\n }\n\n // TODO: check if we have to move this to parser\n const meetingAddedType = MeetingsUtil.getMeetingAddedType(type);\n\n // We typically shouldn't need to trigger both and event and return a promise.\n // Is this a special case? We want to make the public API usage as simple as possible.\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'createMeeting'\n },\n EVENT_TRIGGERS.MEETING_ADDED,\n {\n meeting,\n type: meetingAddedType\n }\n );\n }\n }\n\n return meeting;\n\n // Create the meeting calling the necessary service endpoints.\n\n // Internally, there are many more destinations:\n //\n // - locusID\n // - meetingURL\n // - globalMeetingID, e.g, *00*meetingID\n // - meetingID\n // - meetingURL\n // - PSTN\n // - phone number\n //\n // Our job is to determine the appropriate one\n // and its corresponding service so that developers\n // need only sipURL or spaceID to get a meeting\n // and its ID, but have the option to use createWithType()\n // and specify those types to get meetingInfo\n }\n\n /**\n * get a specifc meeting given it's type matched to the value, i.e., locus url\n * @param {String} type\n * @param {Object} value\n * @returns {Meeting}\n * @public\n * @memberof Meetings\n */\n getMeetingByType(type, value) {\n return this.meetingCollection.getByKey(type, value);\n }\n\n /**\n * Get all meetings.\n * @param {object} options\n * @param {object} options.startDate - get meetings after this start date\n * @param {object} options.endDate - get meetings before this end date\n * @returns {Object} All currently active meetings.\n * @public\n * @memberof Meetings\n */\n getAllMeetings(options = {}) {\n // Options may include other parameters to filter this collection\n // of meetings.\n return this.meetingCollection.getAll(options);\n }\n\n /**\n * syncs all the meeting from server\n * @returns {undefined}\n * @public\n * @memberof Meetings\n */\n syncMeetings() {\n return this.request.getActiveMeetings().then((locusArray) => {\n const activeLocusUrl = [];\n\n if (locusArray?.loci && locusArray.loci.length > 0) {\n locusArray.loci.forEach((locus) => {\n activeLocusUrl.push(locus.url);\n this.handleLocusEvent({\n locus,\n locusUrl: locus.url\n });\n });\n }\n const meetingsCollection = this.meetingCollection.getAll();\n\n if (Object.keys(meetingsCollection).length > 0) {\n // Some time the mercury event is missed after mercury reconnect\n // if sync returns no locus then clear all the meetings\n for (const meeting of Object.values(meetingsCollection)) {\n if (!activeLocusUrl.includes(meeting.locusUrl)) {\n // destroy function also uploads logs\n this.destroy(meeting, MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);\n }\n }\n }\n });\n }\n\n /**\n * Get all scheduled meetings.\n * @param {object} options\n * @param {object} options.startDate - get meetings after this start date\n * @param {object} options.endDate - get meetings before this end date\n * @returns {Object} All scheduled meetings.\n * @memberof Meetings\n */\n getScheduledMeetings() {\n return this.meetingCollection.getAll({scheduled: true});\n }\n\n /**\n * Get the logger instance for plugin-meetings\n * @returns {Logger}\n */\n getLogger() {\n return LoggerProxy.get();\n }\n\n /**\n * Get the Stats Analyzer singleton\n * @returns {StatsAnalyzer}\n * @public\n * @memberof Meetings\n */\n getAnalyzer() {\n return StatsAnalyzer;\n }\n\n /**\n * Get the Stats Calculator singleton\n * @returns {StatsCalculator}\n * @public\n * @memberof Meetings\n */\n getCalculator() {\n return StatsCalculator;\n }\n}\n"]}
1
+ {"version":3,"sources":["index.js"],"names":["Meetings","args","MEETINGS","request","Request","parent","webex","loggerRequest","LoggerRequest","meetingCollection","MeetingCollection","personalMeetingRoom","reachability","registered","media","getUserMedia","Media","getSupportedDevice","LoggerProxy","set","logger","onReady","MeetingsUtil","checkH264Support","disableNotifications","Metrics","initialSetup","data","meeting","getByKey","LOCUS_URL","locusUrl","CORRELATION_ID","checkForCorrelationId","internal","device","url","locus","SIP_URI","self","callbackInfo","callbackAddress","CONVERSATION_URL","conversationUrl","replaces","length","fullState","state","LOCUS","STATE","INACTIVE","warn","_LEFT_","removed","create","_LOCUS_ID_","then","newMeeting","eventType","LOCUSEVENT","DIFFERENCE","locusInfo","catch","e","console","log","finally","getMeetingByType","_ID_","id","postEvent","event","REMOTE_STARTED","trigger","MERCURY_EVENT","Trigger","file","function","EVENT_TRIGGERS","MEETING_ADDED","type","_MEETING_","_JOIN_","_INCOMING_","parse","envelope","MESSAGE_ROAP","handleLocusEvent","MEETINGS_NETWORK_DISCONNECTED","mercury","on","LOCUS_MERCURY","handleLocusMercury","ROAP","ROAP_MERCURY","handleRoapMercury","ONLINE","syncMeetings","OFFLINE","handleMercuryOffline","off","once","READY","StaticConfig","config","LoggerConfig","logging","meetingInfo","experimental","enableUnifiedMeetings","MeetingInfoV2","MeetingInfo","PersonalMeetingRoom","MEETINGS_READY","canAuthorize","error","reject","Error","info","resolve","all","getGeoHint","startReachability","message","register","connect","call","listenForEvents","MEETINGS_REGISTERED","stopListeningForEvents","disconnect","unregister","MEETINGS_UNREGISTERED","options","uploadLogs","uploadResult","MEETING_LOG_UPLOAD_SUCCESS","meetingId","details","uploadError","MEETING_LOG_UPLOAD_FAILURE","reason","sendOperationalMetric","METRICS_OPERATIONAL_MEASURES","UPLOAD_LOGS_FAILURE","meetingsId","stack","code","Reachability","setReachability","getReachability","gatherReachability","fetchGeoHint","res","geoHintInfo","MeetingUtil","cleanUp","delete","MEETING_REMOVED","destination","fetchInfoOptions","targetDest","_CONVERSATION_URL_","createMeeting","createdMeeting","EVENTS","DESTROY_MEETING","payload","autoUploadLogs","callStart","lastActive","correlationId","feedbackId","locusId","webExMeetingId","destroy","REQUEST_UPLOAD_LOGS","meetingInstance","Meeting","userId","deviceUrl","orgId","roapSeq","meetingInfoProvider","fetchMeetingInfo","CaptchaError","PasswordError","debug","sipUri","setSipUri","meetingAddedType","getMeetingAddedType","value","getAll","getActiveMeetings","locusArray","activeLocusUrl","loci","forEach","push","meetingsCollection","includes","MEETING_REMOVED_REASON","NO_MEETINGS_TO_SYNC","scheduled","get","StatsAnalyzer","StatsCalculator","WebexPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAwBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;IACqBA,Q;;;;;AAGjB;AACJ;AACA;AACA;AACA;AACA;AACI,sBAAqB;AAAA;;AAAA;;AAAA,sCAANC,IAAM;AAANA,MAAAA,IAAM;AAAA;;AACnB,oDAASA,IAAT;AAEA;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,CAAwB,UAACjK,KAAD,EAAW;AACjC+J,YAAAA,cAAc,CAACG,IAAf,CAAoBlK,KAAK,CAACD,GAA1B;;AACA,YAAA,OAAI,CAACmD,gBAAL,CAAsB;AACpBlD,cAAAA,KAAK,EAALA,KADoB;AAEpBN,cAAAA,QAAQ,EAAEM,KAAK,CAACD;AAFI,aAAtB;AAID,WAND;AAOD;;AACD,YAAMoK,kBAAkB,GAAG,OAAI,CAAC/L,iBAAL,CAAuBwL,MAAvB,EAA3B;;AAEA,YAAI,mBAAYO,kBAAZ,EAAgC3J,MAAhC,GAAyC,CAA7C,EAAgD;AAC9C;AACA;AACA,4CAAsB,qBAAc2J,kBAAd,CAAtB,oCAAyD;AAApD,gBAAM5K,OAAO,qBAAb;;AACH,gBAAI,CAACwK,cAAc,CAACK,QAAf,CAAwB7K,OAAO,CAACG,QAAhC,CAAL,EAAgD;AAC9C;AACA,cAAA,OAAI,CAACgJ,OAAL,CAAanJ,OAAb,EAAsB8K,kCAAuBC,mBAA7C;AACD;AACF;AACF;AACF,OAxBM,CAAP;AAyBD;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,gCAAuB;AACrB,aAAO,KAAKlM,iBAAL,CAAuBwL,MAAvB,CAA8B;AAACW,QAAAA,SAAS,EAAE;AAAZ,OAA9B,CAAP;AACD;AAED;AACJ;AACA;AACA;;;;WACI,qBAAY;AACV,aAAO1L,qBAAY2L,GAAZ,EAAP;AACD;AAED;AACJ;AACA;AACA;AACA;AACA;;;;WACI,uBAAc;AACZ,aAAOC,iBAAP;AACD;AAED;AACJ;AACA;AACA;AACA;AACA;;;;WACI,yBAAgB;AACd,aAAOC,mBAAP;AACD;;;EA/wBiCC,sB","sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n*/\n\nimport '@webex/internal-plugin-mercury';\nimport {WebexPlugin} from '@webex/webex-core';\n\nimport 'webrtc-adapter';\n\nimport Metrics from '../metrics';\nimport {trigger, eventType} from '../metrics/config';\nimport LoggerConfig from '../common/logs/logger-config';\nimport StaticConfig from '../common/config';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport LoggerRequest from '../common/logs/request';\nimport Trigger from '../common/events/trigger-proxy';\nimport Media from '../media';\nimport MeetingUtil from '../meeting/util';\nimport {\n MEETINGS,\n EVENTS,\n EVENT_TRIGGERS,\n READY,\n LOCUSEVENT,\n LOCUS_URL,\n ROAP,\n ONLINE,\n OFFLINE,\n _MEETING_,\n _JOIN_,\n _LOCUS_ID_,\n _INCOMING_,\n LOCUS,\n CORRELATION_ID,\n SIP_URI,\n _LEFT_,\n _ID_,\n MEETING_REMOVED_REASON,\n _CONVERSATION_URL_,\n CONVERSATION_URL,\n METRICS_OPERATIONAL_MEASURES\n} from '../constants';\nimport MeetingInfo from '../meeting-info';\nimport MeetingInfoV2 from '../meeting-info/meeting-info-v2';\nimport Meeting from '../meeting';\nimport PersonalMeetingRoom from '../personal-meeting-room';\nimport Reachability from '../reachability';\nimport Request from '../meetings/request';\nimport StatsAnalyzer from '../analyzer/analyzer';\nimport StatsCalculator from '../analyzer/calculator';\nimport PasswordError from '../common/errors/password-error';\nimport CaptchaError from '../common/errors/captcha-error';\n\nimport MeetingCollection from './collection';\nimport MeetingsUtil from './util';\n\n\n/**\n * Meetings Ready Event\n * Emitted when the meetings instance on webex is ready\n * @event meetings:ready\n * @instance\n * @memberof Meetings\n */\n\n/**\n * Meetings Network Disconnected Event\n * Emitted when the meetings instance is disconnected from\n * the internal mercury server\n * @event network:disconnected\n * @instance\n * @memberof Meetings\n */\n\n/**\n * Meetings Registered Event\n * Emitted when the meetings instance has been registered and listening\n * @event meetings:registered\n * @instance\n * @memberof Meetings\n */\n\n/**\n * Meeting Removed Event\n * Emitted when a meeting was removed from the cache of meetings\n * @event meeting:removed\n * @instance\n * @type {Object}\n * @property {String} meetingId the removed meeting\n * @property {Object} response the server response\n * @property {String} type what type of meeting it was\n * @memberof Meetings\n */\n\n/**\n * Meeting Added Event\n * Emitted when a meeting was added to the cache of meetings\n * @event meeting:added\n * @instance\n * @type {Object}\n * @property {String} meetingId the added meeting\n * @property {String} type what type of meeting it was\n * @memberof Meetings\n */\n\n/**\n * Maintain a cache of meetings and sync with services.\n * @class\n */\nexport default class Meetings extends WebexPlugin {\n namespace = MEETINGS;\n\n /**\n * Initializes the Meetings Plugin\n * @constructor\n * @public\n * @memberof Meetings\n */\n constructor(...args) {\n super(...args);\n\n /**\n * The Meetings request to interact with server\n * @instance\n * @type {Object}\n * @private\n * @memberof Meetings\n */\n this.request = new Request({}, {parent: this.webex});\n /**\n * Log upload request helper\n * @instance\n * @type {Object}\n * @private\n * @memberof Meetings\n */\n this.loggerRequest = new LoggerRequest({webex: this.webex});\n this.meetingCollection = new MeetingCollection();\n /**\n * The PersonalMeetingRoom object to interact with server\n * @instance\n * @type {Object}\n * @public\n * @memberof Meetings\n */\n this.personalMeetingRoom = null;\n /**\n * The Reachability object to interact with server, starts as null until {@link Meeting#setReachability} is called\n * starts as null\n * @instance\n * @type {Object}\n * @private\n * @memberof Meetings\n */\n this.reachability = null;\n\n /**\n * If the meetings plugin has been registered and listening via {@link Meetings#register}\n * @instance\n * @type {Boolean}\n * @public\n * @memberof Meetings\n */\n this.registered = false;\n\n /**\n * The public interface for the internal Media util files. These are helpful to expose outside the context\n * of a meeting so that a user can access media without creating a meeting instance.\n * @instance\n * @type {Object}\n * @private\n * @memberof Meetings\n */\n this.media = {\n getUserMedia: Media.getUserMedia,\n getSupportedDevice: Media.getSupportedDevice\n };\n\n LoggerProxy.set(this.webex.logger);\n\n this.onReady();\n MeetingsUtil.checkH264Support({disableNotifications: true});\n Metrics.initialSetup(this.meetingCollection, this.webex);\n }\n\n /**\n * handle locus events and takes meeting actions with them as they come in\n * @param {Object} data a locus event\n * @param {String} data.locusUrl\n * @param {Object} data.locus\n * @param {String} data.eventType\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n handleLocusEvent(data) {\n let meeting = null;\n\n // getting meeting by correlationId. This will happen for the new event\n // Either the locus\n // TODO : Add check for the callBack Address\n meeting = this.meetingCollection.getByKey(LOCUS_URL, data.locusUrl) ||\n this.meetingCollection.getByKey(CORRELATION_ID, MeetingsUtil.checkForCorrelationId(this.webex.internal.device.url, data.locus)) ||\n this.meetingCollection.getByKey(SIP_URI, data.locus.self && data.locus.self.callbackInfo && data.locus.self.callbackInfo.callbackAddress) ||\n this.meetingCollection.getByKey(CONVERSATION_URL, data.locus.conversationUrl);\n\n // Special case when locus has got replaced, This only happend once if a replace locus exists\n // https://sqbu-github.cisco.com/WebExSquared/locus/wiki/Locus-changing-mid-call\n\n if (!meeting && data.locus?.replaces?.length > 0) {\n // Always the last element in the replace is the active one\n meeting = this.meetingCollection.getByKey(LOCUS_URL, data.locus.replaces[data.locus.replaces.length - 1].locusUrl);\n }\n\n if (!meeting) {\n // TODO: create meeting when we get a meeting object\n // const checkForEnded = (locus) => {\n // TODO: you already ended the meeting but you got an event later\n // Mainly for 1:1 Callsor meeting\n // Happens mainly after refresh\n\n // 1:1 Meeting\n // 1) You ended a call before but you got a mercury event\n // Make sure end the call and cleanup the meeting only if the mercury\n // event says so\n // 2) Maintain lastSync time in the meetings object which helps to compare\n // If the meeting came befor or after the sync . ANy meeting start time before the sync time is invalid\n\n // For space Meeting\n // Check the locus object and see who has joined\n\n // };\n // rather then locus object change to locus url\n\n if (data.locus && data.locus.fullState && data.locus.fullState.state === LOCUS.STATE.INACTIVE) {\n // just ignore the event as its already ended and not active\n LoggerProxy.logger.warn('Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.');\n\n return;\n }\n\n\n // When its wireless share or guest and user leaves the meeting we dont have to keep the meeting object\n // Any future events will be neglected\n\n if (data.locus && data.locus.self && (data.locus.self.state === _LEFT_ && data.locus.self.removed === true)) {\n // just ignore the event as its already ended and not active\n LoggerProxy.logger.warn('Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.');\n\n return;\n }\n\n this.create(data.locus, _LOCUS_ID_).then((newMeeting) => {\n meeting = newMeeting;\n\n if (data.eventType === LOCUSEVENT.DIFFERENCE) {\n // its a delta object and we have a new meeting\n meeting.locusInfo.initialSetup(data.locus, meeting);\n }\n else {\n // Its a new meeting and have a fresh locus object\n meeting.locusInfo.initialSetup(data.locus);\n }\n }).catch((e) => {\n console.log(e);\n })\n .finally(() => {\n // There will be cases where locus event comes in gets created and deleted because its a 1:1 and meeting gets deleted\n // because the other user left so before sending 'added' event make sure it exists in the collection\n\n if (this.getMeetingByType(_ID_, meeting.id)) {\n Metrics.postEvent({event: eventType.REMOTE_STARTED, meeting, data: {trigger: trigger.MERCURY_EVENT}});\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'handleLocusEvent'\n },\n EVENT_TRIGGERS.MEETING_ADDED,\n {\n meeting,\n type: meeting.type === _MEETING_ ? _JOIN_ : _INCOMING_\n }\n );\n }\n else {\n // Meeting got added but was not found in the collection. It might have got destroyed\n LoggerProxy.logger.warn('Meetings:index#handleLocusEvent --> Created and destroyed meeting object before sending an event');\n }\n });\n }\n else {\n meeting.locusInfo.parse(meeting, data);\n }\n }\n\n /**\n * handles locus events through mercury that are not roap\n * @param {Object} envelope\n * @param {Object} envelope.data\n * @param {String} envelope.data.eventType\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n handleLocusMercury(envelope) {\n const {data} = envelope;\n const {eventType} = data;\n\n if (eventType && eventType !== LOCUSEVENT.MESSAGE_ROAP) {\n this.handleLocusEvent(data);\n }\n }\n\n\n /**\n * handles mecury offline event\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n handleMercuryOffline() {\n Trigger.trigger(\n this,\n {\n file: 'meetings/index',\n function: 'handleMercuryOffline'\n },\n EVENT_TRIGGERS.MEETINGS_NETWORK_DISCONNECTED,\n );\n }\n\n\n /**\n * registers for locus and roap mercury events\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n listenForEvents() {\n this.webex.internal.mercury.on(LOCUSEVENT.LOCUS_MERCURY, (envelope) => {\n this.handleLocusMercury(envelope);\n });\n this.webex.internal.mercury.on(ROAP.ROAP_MERCURY, (envelope) => {\n MeetingsUtil.handleRoapMercury(envelope, this.meetingCollection);\n });\n\n this.webex.internal.mercury.on(ONLINE, () => {\n this.syncMeetings();\n });\n\n this.webex.internal.mercury.on(OFFLINE, () => {\n this.handleMercuryOffline();\n });\n }\n\n /**\n * stops listening for locus and roap mercury events\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n stopListeningForEvents() {\n this.webex.internal.mercury.off(LOCUSEVENT.LOCUS_MERCURY);\n this.webex.internal.mercury.off(ROAP.ROAP_MERCURY);\n this.webex.internal.mercury.off(ONLINE);\n }\n\n /**\n * @returns {undefined}\n * @private\n * @memberof Meetings\n */\n onReady() {\n this.webex.once(READY, () => {\n StaticConfig.set(this.config);\n LoggerConfig.set(this.config.logging);\n\n /**\n * The MeetingInfo object to interact with server\n * @instance\n * @type {Object}\n * @private\n * @memberof Meetings\n */\n this.meetingInfo = this.config.experimental.enableUnifiedMeetings ? new MeetingInfoV2(this.webex) : new MeetingInfo(this.webex);\n this.personalMeetingRoom = new PersonalMeetingRoom({meetingInfo: this.meetingInfo}, {parent: this.webex});\n\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'onReady'\n },\n EVENT_TRIGGERS.MEETINGS_READY\n );\n });\n }\n\n /**\n * Explicitly sets up the meetings plugin by registering\n * the device, connecting to mercury, and listening for locus events.\n *\n * @returns {Promise}\n * @public\n * @memberof Meetings\n */\n register() {\n if (!this.webex.canAuthorize) {\n LoggerProxy.logger.error('Meetings:index#register --> ERROR, Unable to register, SDK cannot authorize');\n\n return Promise.reject(new Error('SDK cannot authorize'));\n }\n\n\n if (this.registered) {\n LoggerProxy.logger.info('Meetings:index#register --> INFO, Meetings plugin already registered');\n\n return Promise.resolve();\n }\n\n return Promise.all([\n this.getGeoHint(),\n this.startReachability().catch((error) => {\n LoggerProxy.logger.error(`Meetings:index#register --> GDM error, ${error.message}`);\n }),\n this.webex.internal.device.register()\n .then(() => LoggerProxy.logger.info(`Meetings:index#register --> INFO, Device registered ${this.webex.internal.device.url}`))\n .then(() => this.webex.internal.mercury.connect()),\n MeetingsUtil.checkH264Support.call(this)\n ]).then(() => {\n this.listenForEvents();\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'register'\n },\n EVENT_TRIGGERS.MEETINGS_REGISTERED\n );\n this.registered = true;\n })\n .catch((error) => {\n LoggerProxy.logger.error(`Meetings:index#register --> ERROR, Unable to register, ${error.message}`);\n\n return Promise.reject(error);\n });\n }\n\n /**\n * Explicitly tears down the meetings plugin by deregistering\n * the device, disconnecting from mercury, and stops listening to locus events\n *\n * @returns {Promise}\n * @public\n * @memberof Meetings\n */\n unregister() {\n if (!this.registered) {\n LoggerProxy.logger.info('Meetings:index#unregister --> INFO, Meetings plugin already unregistered');\n\n return Promise.resolve();\n }\n\n this.stopListeningForEvents();\n\n return this.webex.internal.mercury.disconnect()\n .then(() => this.webex.internal.device.unregister())\n .then(() => {\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'unregister'\n },\n EVENT_TRIGGERS.MEETINGS_UNREGISTERED\n );\n this.registered = false;\n });\n }\n\n /**\n * Uploads logs to the webex services for tracking\n * @param {Object} [options={}]\n * @param {String} [options.callStart] Call Start Time\n * @param {String} [options.feedbackId] ID used for tracking\n * @param {String} [options.locusId]\n * @param {String} [options.correlationId]\n * @param {String} [options.meetingId] webex meeting ID\n * @param {String} [options.userId] userId\n * @param {String} [options.orgId] org id\n * @returns {String} feedback ID logs were submitted under\n */\n uploadLogs(options = {}) {\n LoggerProxy.logger.info('Meetings:index#uploadLogs --> uploading logs');\n\n return this.loggerRequest.uploadLogs(options)\n .then((uploadResult) => {\n LoggerProxy.logger.info('Meetings:index#uploadLogs --> Upload logs for meeting completed.', uploadResult);\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'uploadLogs'\n },\n EVENT_TRIGGERS.MEETING_LOG_UPLOAD_SUCCESS,\n {\n meetingId: options.meetingId,\n details: uploadResult\n }\n );\n })\n .catch((uploadError) => {\n LoggerProxy.logger.error('Meetings:index#uploadLogs --> Unable to upload logs for meeting', uploadError);\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'uploadLogs'\n },\n EVENT_TRIGGERS.MEETING_LOG_UPLOAD_FAILURE,\n {\n meetingId: options.meetingId,\n reason: uploadError\n }\n );\n\n Metrics.sendOperationalMetric(\n METRICS_OPERATIONAL_MEASURES.UPLOAD_LOGS_FAILURE,\n {\n meetingId: options.meetingsId,\n reason: uploadError.message,\n stack: uploadError.stack,\n code: uploadError.code\n }\n );\n });\n }\n\n /**\n * initializes the reachability instance for Meetings\n * @returns {undefined}\n * @public\n * @memberof Meetings\n */\n setReachability() {\n this.reachability = new Reachability(this.webex);\n }\n\n /**\n * gets the reachability instance for Meetings\n * @returns {Reachability}\n * @public\n * @memberof Meetings\n */\n getReachability() {\n return this.reachability;\n }\n\n /**\n * initializes and starts gathering reachability for Meetings\n * @returns {Promise}\n * @public\n * @memberof Meetings\n */\n startReachability() {\n if (!this.reachability) {\n this.setReachability();\n }\n\n return this.getReachability().gatherReachability();\n }\n\n /**\n * Get geoHint for info for meetings\n * @returns {Promise}\n * @private\n * @memberof Meetings\n */\n getGeoHint() {\n return this.request.fetchGeoHint().then((res) => {\n this.geoHintInfo = res;\n });\n }\n\n /**\n * gets the personal meeting room instance, for saved PMR values for this user\n * @returns {PersonalMeetingRoom}\n * @public\n * @memberof Meetings\n */\n getPersonalMeetingRoom() {\n return this.personalMeetingRoom;\n }\n\n /**\n * @param {Meeting} meeting\n * @param {Object} reason\n * @param {String} type\n * @returns {Undefined}\n * @private\n * @memberof Meetings\n */\n destroy(meeting, reason) {\n MeetingUtil.cleanUp(meeting);\n this.meetingCollection.delete(meeting.id);\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'destroy'\n },\n EVENT_TRIGGERS.MEETING_REMOVED,\n {\n meetingId: meeting.id,\n reason\n }\n );\n }\n\n /**\n * Create a meeting.\n * @param {string} destination - sipURL, spaceId, phonenumber, or locus object}\n * @param {string} [type] - the optional specified type, such as locusId\n * @returns {Promise<Meeting>} A new Meeting.\n * @public\n * @memberof Meetings\n */\n create(destination, type = null) {\n // TODO: type should be from a dictionary\n\n // Validate meeting information based on the provided destination and\n // type. This must be performed prior to determining if the meeting is\n // found in the collection, as we mutate the destination for hydra person\n // id values.\n return this.meetingInfo.fetchInfoOptions(destination, type)\n // Catch a failure to fetch info options.\n .catch((error) => {\n LoggerProxy.logger.info(`Meetings:index#create --> INFO, unable to determine info options: ${error.message}`);\n })\n .then((options = {}) => {\n // Normalize the destination.\n const targetDest = options.destination || destination;\n\n // check for the conversation URL then sip Url\n let meeting = null;\n\n if (type === _CONVERSATION_URL_ || options.type === _CONVERSATION_URL_) {\n meeting = this.meetingCollection.getByKey(CONVERSATION_URL, targetDest);\n }\n\n // Attempt to collect the meeting if it exists.\n if (!meeting) {\n meeting = this.meetingCollection.getByKey(SIP_URI, targetDest);\n }\n\n\n // Validate if a meeting was found.\n if (!meeting) {\n // Create a meeting based on the normalized destination and type.\n return this.createMeeting(targetDest, type)\n .then((createdMeeting) => {\n // If the meeting was successfully created.\n if (createdMeeting && createdMeeting.on) {\n // Create a destruction event for the meeting.\n createdMeeting.on(EVENTS.DESTROY_MEETING, (payload) => {\n if (this.config.autoUploadLogs) {\n this.uploadLogs({\n callStart: createdMeeting.locusInfo?.fullState?.lastActive,\n correlationId: createdMeeting.correlationId,\n feedbackId: createdMeeting.correlationId,\n locusId: createdMeeting.locusId,\n meetingId: createdMeeting.locusInfo?.info?.webExMeetingId\n }).then(() => this.destroy(createdMeeting, payload.reason));\n }\n else {\n this.destroy(createdMeeting, payload.reason);\n }\n });\n\n createdMeeting.on(EVENTS.REQUEST_UPLOAD_LOGS, (meetingInstance) => {\n if (this.config.autoUploadLogs) {\n this.uploadLogs({\n callStart: meetingInstance?.locusInfo?.fullState?.lastActive,\n correlationId: meetingInstance.correlationId,\n feedbackId: meetingInstance.correlationId,\n locusId: meetingInstance.locusId,\n meetingId: meetingInstance.locusInfo?.info?.webExMeetingId\n });\n }\n });\n }\n else {\n LoggerProxy.logger.error(`Meetings:index#create --> ERROR, meeting does not have on method, will not be destroyed, meeting cleanup impossible for meeting: ${meeting}`);\n }\n\n // Return the newly created meeting.\n return Promise.resolve(createdMeeting);\n });\n }\n\n // Return the existing meeting.\n return Promise.resolve(meeting);\n });\n }\n\n /**\n * @param {String} destination see create()\n * @param {String} type see create()\n * @returns {Promise} a new meeting instance complete with meeting info and destination\n * @private\n * @memberof Meetings\n */\n async createMeeting(destination, type = null) {\n const meeting = new Meeting(\n {\n userId: this.webex.internal.device.userId,\n deviceUrl: this.webex.internal.device.url,\n orgId: this.webex.internal.device.orgId,\n roapSeq: 0,\n locus: type === _LOCUS_ID_ ? destination : null, // pass the locus object if present\n meetingInfoProvider: this.meetingInfo\n },\n {\n parent: this.webex\n }\n );\n\n this.meetingCollection.set(meeting);\n\n try {\n await meeting.fetchMeetingInfo({destination, type});\n }\n catch (err) {\n if (!(err instanceof CaptchaError) && !(err instanceof PasswordError)) {\n // if there is no meeting info we assume its a 1:1 call or wireless share\n LoggerProxy.logger.info(`Meetings:index#createMeeting --> Info Unable to fetch meeting info for ${destination}.`);\n LoggerProxy.logger.info('Meetings:index#createMeeting --> Info assuming this destination is a 1:1 or wireless share');\n }\n LoggerProxy.logger.debug(`Meetings:index#createMeeting --> Debug ${err} fetching /meetingInfo for creation.`);\n // We need to save this info for future reference\n meeting.destination = destination;\n }\n finally {\n // For type LOCUS_ID we need to parse the locus object to get the information\n // about the caller and callee\n // Meeting Added event will be created in `handleLocusEvent`\n if (type !== _LOCUS_ID_) {\n if (!meeting.sipUri) {\n meeting.setSipUri(destination);\n }\n\n // TODO: check if we have to move this to parser\n const meetingAddedType = MeetingsUtil.getMeetingAddedType(type);\n\n // We typically shouldn't need to trigger both and event and return a promise.\n // Is this a special case? We want to make the public API usage as simple as possible.\n Trigger.trigger(\n this,\n {\n file: 'meetings',\n function: 'createMeeting'\n },\n EVENT_TRIGGERS.MEETING_ADDED,\n {\n meeting,\n type: meetingAddedType\n }\n );\n }\n }\n\n return meeting;\n\n // Create the meeting calling the necessary service endpoints.\n\n // Internally, there are many more destinations:\n //\n // - locusID\n // - meetingURL\n // - globalMeetingID, e.g, *00*meetingID\n // - meetingID\n // - meetingURL\n // - PSTN\n // - phone number\n //\n // Our job is to determine the appropriate one\n // and its corresponding service so that developers\n // need only sipURL or spaceID to get a meeting\n // and its ID, but have the option to use createWithType()\n // and specify those types to get meetingInfo\n }\n\n /**\n * get a specifc meeting given it's type matched to the value, i.e., locus url\n * @param {String} type\n * @param {Object} value\n * @returns {Meeting}\n * @public\n * @memberof Meetings\n */\n getMeetingByType(type, value) {\n return this.meetingCollection.getByKey(type, value);\n }\n\n /**\n * Get all meetings.\n * @param {object} options\n * @param {object} options.startDate - get meetings after this start date\n * @param {object} options.endDate - get meetings before this end date\n * @returns {Object} All currently active meetings.\n * @public\n * @memberof Meetings\n */\n getAllMeetings(options = {}) {\n // Options may include other parameters to filter this collection\n // of meetings.\n return this.meetingCollection.getAll(options);\n }\n\n /**\n * syncs all the meeting from server\n * @returns {undefined}\n * @public\n * @memberof Meetings\n */\n syncMeetings() {\n return this.request.getActiveMeetings().then((locusArray) => {\n const activeLocusUrl = [];\n\n if (locusArray?.loci && locusArray.loci.length > 0) {\n locusArray.loci.forEach((locus) => {\n activeLocusUrl.push(locus.url);\n this.handleLocusEvent({\n locus,\n locusUrl: locus.url\n });\n });\n }\n const meetingsCollection = this.meetingCollection.getAll();\n\n if (Object.keys(meetingsCollection).length > 0) {\n // Some time the mercury event is missed after mercury reconnect\n // if sync returns no locus then clear all the meetings\n for (const meeting of Object.values(meetingsCollection)) {\n if (!activeLocusUrl.includes(meeting.locusUrl)) {\n // destroy function also uploads logs\n this.destroy(meeting, MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);\n }\n }\n }\n });\n }\n\n /**\n * Get all scheduled meetings.\n * @param {object} options\n * @param {object} options.startDate - get meetings after this start date\n * @param {object} options.endDate - get meetings before this end date\n * @returns {Object} All scheduled meetings.\n * @memberof Meetings\n */\n getScheduledMeetings() {\n return this.meetingCollection.getAll({scheduled: true});\n }\n\n /**\n * Get the logger instance for plugin-meetings\n * @returns {Logger}\n */\n getLogger() {\n return LoggerProxy.get();\n }\n\n /**\n * Get the Stats Analyzer singleton\n * @returns {StatsAnalyzer}\n * @public\n * @memberof Meetings\n */\n getAnalyzer() {\n return StatsAnalyzer;\n }\n\n /**\n * Get the Stats Calculator singleton\n * @returns {StatsCalculator}\n * @public\n * @memberof Meetings\n */\n getCalculator() {\n return StatsCalculator;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/plugin-meetings",
3
- "version": "1.151.7",
3
+ "version": "1.152.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -24,18 +24,18 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@babel/runtime-corejs2": "^7.14.8",
27
- "@webex/webex-core": "1.151.7",
28
- "@webex/internal-plugin-mercury": "1.151.7",
27
+ "@webex/webex-core": "1.152.0",
28
+ "@webex/internal-plugin-mercury": "1.152.0",
29
29
  "webrtc-adapter": "^7.7.0",
30
30
  "lodash": "^4.17.21",
31
31
  "uuid": "^3.3.2",
32
32
  "global": "^4.4.0",
33
33
  "ip-anonymize": "^0.1.0",
34
- "@webex/common": "1.151.7",
34
+ "@webex/common": "1.152.0",
35
35
  "bowser": "^2.11.0",
36
36
  "sdp-transform": "^2.12.0",
37
37
  "readable-stream": "^3.6.0",
38
- "@webex/common-timers": "1.151.7",
38
+ "@webex/common-timers": "1.152.0",
39
39
  "btoa": "^1.2.1",
40
40
  "javascript-state-machine": "^3.1.0",
41
41
  "envify": "^4.1.0"
@@ -0,0 +1,21 @@
1
+ import {ERROR_DICTIONARY} from '../../constants';
2
+
3
+ /**
4
+ * Extended Error object to signify captcha related errors
5
+ */
6
+ export default class CaptchaError extends Error {
7
+ /**
8
+ *
9
+ * @constructor
10
+ * @param {String} [message]
11
+ * @param {Object} [error]
12
+ */
13
+ constructor(message = ERROR_DICTIONARY.CAPTCHA.MESSAGE, error = null) {
14
+ super(message);
15
+ this.name = ERROR_DICTIONARY.CAPTCHA.NAME;
16
+ this.sdkMessage = ERROR_DICTIONARY.CAPTCHA.MESSAGE;
17
+ this.error = error;
18
+ this.stack = error ? error.stack : (new Error()).stack;
19
+ this.code = ERROR_DICTIONARY.CAPTCHA.CODE;
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ import {ERROR_DICTIONARY} from '../../constants';
2
+
3
+ /**
4
+ * Extended Error object to signify password related errors
5
+ */
6
+ export default class PasswordError extends Error {
7
+ /**
8
+ *
9
+ * @constructor
10
+ * @param {String} [message]
11
+ * @param {Object} [error]
12
+ */
13
+ constructor(message = ERROR_DICTIONARY.PASSWORD.MESSAGE, error = null) {
14
+ super(message);
15
+ this.name = ERROR_DICTIONARY.PASSWORD.NAME;
16
+ this.sdkMessage = ERROR_DICTIONARY.PASSWORD.MESSAGE;
17
+ this.error = error;
18
+ this.stack = error ? error.stack : (new Error()).stack;
19
+ this.code = ERROR_DICTIONARY.PASSWORD.CODE;
20
+ }
21
+ }
package/src/constants.js CHANGED
@@ -559,6 +559,16 @@ export const ERROR_DICTIONARY = {
559
559
  NAME: 'StatsError',
560
560
  MESSAGE: 'An error occurred with getStats, stats may not continue for this data stream.',
561
561
  CODE: 6
562
+ },
563
+ PASSWORD: {
564
+ NAME: 'PasswordError',
565
+ MESSAGE: 'Password is required, please use verifyPassword()',
566
+ CODE: 7
567
+ },
568
+ CAPTCHA: {
569
+ NAME: 'CaptchaError',
570
+ MESSAGE: 'Captcha is required.',
571
+ CODE: 8
562
572
  }
563
573
  };
564
574
 
@@ -1251,3 +1261,17 @@ export const PSTN_STATUS = {
1251
1261
  SUCCESS: 'SUCCESS', // happens after the transfer (TRANSFERRING) is successful
1252
1262
  UNKNOWN: '' // placeholder if we haven't been told what the status is
1253
1263
  };
1264
+
1265
+ export const PASSWORD_STATUS = {
1266
+ NOT_REQUIRED: 'NOT_REQUIRED', // password is not required to join the meeting
1267
+ REQUIRED: 'REQUIRED', // client needs to provide the password by calling verifyPassword() before calling join()
1268
+ UNKNOWN: 'UNKNOWN', // we are waiting for information from the backend if password is required or not
1269
+ VERIFIED: 'VERIFIED' // client has already provided the password and it has been verified, client can proceed to call join()
1270
+ };
1271
+
1272
+ export const MEETING_INFO_FAILURE_REASON = {
1273
+ NONE: 'NONE', // meeting info was retrieved succesfully
1274
+ WRONG_PASSWORD: 'WRONG_PASSWORD', // meeting requires password and no password or wrong one was provided
1275
+ WRONG_CAPTCHA: 'WRONG_CAPTCHA', // wbxappapi requires a captcha code or a wrong captcha code was provided
1276
+ OTHER: 'OTHER' // any other error (network, etc)
1277
+ };
@@ -29,12 +29,15 @@ import WebRTCStats from '../stats/index';
29
29
  import StatsMetrics from '../stats/metrics';
30
30
  import StatsUtil from '../stats/util';
31
31
  import Transcription from '../transcription';
32
+ import PasswordError from '../common/errors/password-error';
33
+ import CaptchaError from '../common/errors/captcha-error';
32
34
  import ReconnectionError from '../common/errors/reconnection';
33
35
  import ReconnectInProgress from '../common/errors/reconnection-in-progress';
34
36
  import {
35
37
  _CALL_,
36
38
  _INCOMING_,
37
39
  _JOIN_,
40
+ _SIP_URI_,
38
41
  AUDIO,
39
42
  CONNECTION_STATE,
40
43
  CONTENT,
@@ -47,6 +50,7 @@ import {
47
50
  LAYOUT_TYPES,
48
51
  LIVE,
49
52
  LOCUSINFO,
53
+ MEETING_INFO_FAILURE_REASON,
50
54
  MEETING_REMOVED_REASON,
51
55
  MEETING_STATE_MACHINE,
52
56
  MEETING_STATE,
@@ -57,6 +61,7 @@ import {
57
61
  NETWORK_STATUS,
58
62
  ONLINE,
59
63
  OFFLINE,
64
+ PASSWORD_STATUS,
60
65
  PC_BAIL_TIMEOUT,
61
66
  PSTN_STATUS,
62
67
  QUALITY_LEVELS,
@@ -73,6 +78,7 @@ import {
73
78
  } from '../constants';
74
79
  import ParameterError from '../common/errors/parameter';
75
80
  import MediaError from '../common/errors/media';
81
+ import {MeetingInfoV2PasswordError, MeetingInfoV2CaptchaError} from '../meeting-info/meeting-info-v2';
76
82
  import MQAProcessor from '../metrics/mqa-processor';
77
83
  import BrowserDetection from '../common/browser-detection';
78
84
  import RoapCollection from '../roap/collection';
@@ -846,11 +852,175 @@ export default class Meeting extends StatelessWebexPlugin {
846
852
  */
847
853
  this.transcription = undefined;
848
854
 
855
+ /**
856
+ * Password status. If it's PASSWORD_STATUS.REQUIRED then verifyPassword() needs to be called
857
+ * with the correct password before calling join()
858
+ * @instance
859
+ * @type {PASSWORD_STATUS}
860
+ * @public
861
+ * @memberof Meeting
862
+ */
863
+ this.passwordStatus = PASSWORD_STATUS.UNKNOWN;
864
+
865
+ /**
866
+ * Information about required captcha. If null, then no captcha is required. status. If it's PASSWORD_STATUS.REQUIRED then verifyPassword() needs to be called
867
+ * with the correct password before calling join()
868
+ * @instance
869
+ * @type {Object}
870
+ * @property {string} captchaId captcha id
871
+ * @property {string} verificationImageURL Url of the captcha image
872
+ * @property {string} verificationAudioURL Url of the captcha audio file
873
+ * @property {string} refreshURL Url used for refreshing the captcha (don't use it directly, call refreshCaptcha() instead)
874
+ * @public
875
+ * @memberof Meeting
876
+ */
877
+ this.requiredCaptcha = null;
878
+
879
+ /**
880
+ * Indicates the reason for last failure to obtain meeting.meetingInfo. MEETING_INFO_FAILURE_REASON.NONE if meeting info was
881
+ * retrieved successfully
882
+ * @instance
883
+ * @type {MEETING_INFO_FAILURE_REASON}
884
+ * @private
885
+ * @memberof Meeting
886
+ */
887
+ this.meetingInfoFailureReason = undefined;
888
+
849
889
  this.setUpLocusInfoListeners();
850
890
  this.locusInfo.init(attrs.locus ? attrs.locus : {});
851
891
  this.isCreated = true;
852
892
  }
853
893
 
894
+ /**
895
+ * Fetches meeting information.
896
+ * @param {Object} options
897
+ * @param {String} options.destination
898
+ * @param {String} options.type
899
+ * @private
900
+ * @memberof Meeting
901
+ * @returns {Promise}
902
+ */
903
+ async fetchMeetingInfo({
904
+ destination, type, password = null, captchaCode = null
905
+ }) {
906
+ if (captchaCode && !this.requiredCaptcha) {
907
+ return Promise.reject(new Error('fetchMeetingInfo() called with captchaCode when captcha was not required'));
908
+ }
909
+ if (password && (this.passwordStatus !== PASSWORD_STATUS.REQUIRED && this.passwordStatus !== PASSWORD_STATUS.UNKNOWN)) {
910
+ return Promise.reject(new Error('fetchMeetingInfo() called with password when password was not required'));
911
+ }
912
+
913
+ try {
914
+ const captchaInfo = captchaCode ? {code: captchaCode, id: this.requiredCaptcha.captchaId} : null;
915
+
916
+ const info = await this.attrs.meetingInfoProvider.fetchMeetingInfo(destination, type, password, captchaInfo);
917
+
918
+ this.parseMeetingInfo(info);
919
+ this.meetingInfo = info ? info.body : null;
920
+ this.meetingInfoFailureReason = MEETING_INFO_FAILURE_REASON.NONE;
921
+ this.requiredCaptcha = null;
922
+ if ((this.passwordStatus === PASSWORD_STATUS.REQUIRED) || (this.passwordStatus === PASSWORD_STATUS.VERIFIED)) {
923
+ this.passwordStatus = PASSWORD_STATUS.VERIFIED;
924
+ }
925
+ else {
926
+ this.passwordStatus = PASSWORD_STATUS.NOT_REQUIRED;
927
+ }
928
+
929
+ return Promise.resolve();
930
+ }
931
+ catch (err) {
932
+ if (err instanceof MeetingInfoV2PasswordError) {
933
+ LoggerProxy.logger.info(`Meeting:index#fetchMeetingInfo --> Info Unable to fetch meeting info for ${destination} - password required (code=${err?.body?.code}).`);
934
+
935
+ // when wbxappapi requires password it still populates partial meeting info in the response
936
+ if (err.meetingInfo) {
937
+ this.meetingInfo = err.meetingInfo;
938
+ this.meetingNumber = err.meetingInfo.meetingNumber;
939
+ }
940
+
941
+ this.passwordStatus = PASSWORD_STATUS.REQUIRED;
942
+ this.meetingInfoFailureReason = MEETING_INFO_FAILURE_REASON.WRONG_PASSWORD;
943
+ if (this.requiredCaptcha) {
944
+ // this is a workaround for captcha service bug, see WEBEX-224862
945
+ await this.refreshCaptcha();
946
+ }
947
+
948
+ throw (new PasswordError());
949
+ }
950
+ else if (err instanceof MeetingInfoV2CaptchaError) {
951
+ LoggerProxy.logger.info(`Meeting:index#fetchMeetingInfo --> Info Unable to fetch meeting info for ${destination} - captcha required (code=${err?.body?.code}).`);
952
+
953
+ this.meetingInfoFailureReason = (this.requiredCaptcha) ?
954
+ MEETING_INFO_FAILURE_REASON.WRONG_CAPTCHA :
955
+ MEETING_INFO_FAILURE_REASON.WRONG_PASSWORD;
956
+
957
+ if (err.isPasswordRequired) {
958
+ this.passwordStatus = PASSWORD_STATUS.REQUIRED;
959
+ }
960
+
961
+ this.requiredCaptcha = err.captchaInfo;
962
+ throw (new CaptchaError());
963
+ }
964
+ else {
965
+ this.meetingInfoFailureReason = MEETING_INFO_FAILURE_REASON.OTHER;
966
+ throw (err);
967
+ }
968
+ }
969
+ }
970
+
971
+ /**
972
+ * Checks if the supplied password/host key is correct. It returns a promise with information whether the
973
+ * password and captcha code were correct or not.
974
+ * @param {String} password - this can be either a password or a host key, can be undefined if only captcha was required
975
+ * @param {String} captchaCode - can be undefined if captcha was not required by the server
976
+ * @public
977
+ * @memberof Meeting
978
+ * @returns {Promise<{isPasswordValid: boolean, requiredCaptcha: boolean, failureReason: MEETING_INFO_FAILURE_REASON}>}
979
+ */
980
+ verifyPassword(password, captchaCode) {
981
+ return this.fetchMeetingInfo({
982
+ destination: this.sipUri, type: _SIP_URI_, password, captchaCode
983
+ })
984
+ .then(() => ({isPasswordValid: true, requiredCaptcha: null, failureReason: MEETING_INFO_FAILURE_REASON.NONE}))
985
+ .catch((error) => {
986
+ if (error instanceof PasswordError || error instanceof CaptchaError) {
987
+ return {
988
+ isPasswordValid: this.passwordStatus === PASSWORD_STATUS.VERIFIED,
989
+ requiredCaptcha: this.requiredCaptcha,
990
+ failureReason: this.meetingInfoFailureReason
991
+ };
992
+ }
993
+ throw (error);
994
+ });
995
+ }
996
+
997
+ /**
998
+ * Refreshes the captcha. As a result the meeting will have new captcha id, image and audio.
999
+ * If the refresh operation fails, meeting remains with the old captcha properties.
1000
+ * @public
1001
+ * @memberof Meeting
1002
+ * @returns {Promise}
1003
+ */
1004
+ refreshCaptcha() {
1005
+ if (!this.requiredCaptcha) {
1006
+ return Promise.reject(new Error('There is no captcha to refresh'));
1007
+ }
1008
+
1009
+ // in order to get fully populated uris for captcha audio and image in response to refresh captcha request
1010
+ // we have to pass the wbxappapi hostname as the siteFullName parameter
1011
+ const {hostname} = new URL(this.requiredCaptcha.refreshURL);
1012
+
1013
+ return this.meetingRequest.refreshCaptcha({
1014
+ captchaRefreshUrl: `${this.requiredCaptcha.refreshURL}&siteFullName=${hostname}`,
1015
+ captchaId: this.requiredCaptcha.captchaId
1016
+ })
1017
+ .then((response) => {
1018
+ this.requiredCaptcha.captchaId = response.body.captchaID;
1019
+ this.requiredCaptcha.verificationImageURL = response.body.verificationImageURL;
1020
+ this.requiredCaptcha.verificationAudioURL = response.body.verificationAudioURL;
1021
+ });
1022
+ }
1023
+
854
1024
  /**
855
1025
  * Proxy function for all the listener set ups
856
1026
  * @returns {undefined}
@@ -140,6 +140,33 @@ export default class MeetingRequest extends StatelessWebexPlugin {
140
140
  });
141
141
  }
142
142
 
143
+ /**
144
+ * Send a request to refresh the captcha
145
+ * @param {Object} options
146
+ * @param {String} options.captchaRefreshUrl
147
+ * @param {String} options.captchaId
148
+ * @returns {Promise}
149
+ * @private
150
+ */
151
+ refreshCaptcha({
152
+ captchaRefreshUrl,
153
+ captchaId
154
+ }) {
155
+ const body = {
156
+ captchaId
157
+ };
158
+
159
+ return this.request({
160
+ method: HTTP_VERBS.POST,
161
+ uri: captchaRefreshUrl,
162
+ body
163
+ }).catch((err) => {
164
+ LoggerProxy.logger.error(`Meeting:request#refreshCaptcha --> Error: ${err}`);
165
+
166
+ throw err;
167
+ });
168
+ }
169
+
143
170
  /**
144
171
  * Make a network request to add a dial in device
145
172
  * @param {Object} options
@@ -7,19 +7,23 @@ import {eventType, trigger, mediaType} from '../metrics/config';
7
7
  import Media from '../media';
8
8
  import LoggerProxy from '../common/logs/logger-proxy';
9
9
  import WebRTCStats from '../stats/index';
10
- import {INTENT_TO_JOIN,
10
+ import {
11
+ INTENT_TO_JOIN,
11
12
  _LEFT_,
12
13
  _IDLE_,
13
14
  _JOINED_,
14
15
  STATS,
15
- EVENT_TRIGGERS
16
- , FULL_STATE} from '../constants';
16
+ EVENT_TRIGGERS,
17
+ FULL_STATE,
18
+ PASSWORD_STATUS
19
+ } from '../constants';
17
20
  import Trigger from '../common/events/trigger-proxy';
18
21
  import IntentToJoinError from '../common/errors/intent-to-join';
19
22
  import JoinMeetingError from '../common/errors/join-meeting';
20
23
  import ParameterError from '../common/errors/parameter';
21
24
  import PermissionError from '../common/errors/permission';
22
-
25
+ import PasswordError from '../common/errors/password-error';
26
+ import CaptchaError from '../common/errors/captcha-error';
23
27
 
24
28
  const MeetingUtil = {};
25
29
 
@@ -240,6 +244,13 @@ MeetingUtil.isMediaEstablished = (currentMediaStatus) =>
240
244
  MeetingUtil.joinMeetingOptions = (meeting, options = {}) => {
241
245
  meeting.resourceId = meeting.resourceId || options.resourceId;
242
246
 
247
+ if (meeting.requiredCaptcha) {
248
+ return Promise.reject(new CaptchaError());
249
+ }
250
+ if (meeting.passwordStatus === PASSWORD_STATUS.REQUIRED) {
251
+ return Promise.reject(new PasswordError());
252
+ }
253
+
243
254
  if (options.pin) {
244
255
  Metrics.postEvent({
245
256
  event: eventType.PIN_COLLECTED,