import '@webex/internal-plugin-mercury'; import '@webex/internal-plugin-conversation'; import '@webex/internal-plugin-metrics'; import { WebexPlugin } from '@webex/webex-core'; import { DeviceRegistrationOptions } from '@webex/internal-plugin-device'; import * as mediaHelpersModule from '@webex/media-helpers'; import 'webrtc-adapter'; import { LOCUSEVENT, DESTINATION_TYPE } from '../constants'; import { CallStateForMetrics } from '../meeting'; import Reachability from '../reachability'; import { INoiseReductionEffect, IVirtualBackgroundEffect, MeetingRegistrationStatus } from './meetings.types'; import { HashTreeMessage } from '../hashTree/hashTreeParser'; export type LocusEvent = { eventType: LOCUSEVENT; locusUrl?: string; locus?: any; stateElementsMessage?: HashTreeMessage; }; /** * Meetings Ready Event * Emitted when the meetings instance on webex is ready * @event meetings:ready * @instance * @memberof Meetings */ /** * Meetings Network Disconnected Event * Emitted when the meetings instance is disconnected from * the internal mercury server * @event network:disconnected * @instance * @memberof Meetings */ /** * Meetings Registered Event * Emitted when the meetings instance has been registered and listening * @event meetings:registered * @instance * @memberof Meetings */ /** * Meeting Removed Event * Emitted when a meeting was removed from the cache of meetings * @event meeting:removed * @instance * @type {Object} * @property {String} meetingId the removed meeting * @property {Object} response the server response * @property {String} type what type of meeting it was * @memberof Meetings */ /** * Meeting Added Event * Emitted when a meeting was added to the cache of meetings * @event meeting:added * @instance * @type {Object} * @property {String} meetingId the added meeting * @property {String} type what type of meeting it was * @memberof Meetings */ /** * Object containing only the most basic information about a meeting. * This is the information that is kept even after the meeting is deleted from the MeetingCollection */ export type BasicMeetingInformation = { allowMediaInLobby: boolean; correlationId: string; environment: string; id: string; locusUrl: string; locusInfo: { url: string; fullState: { lastActive: string; sessionId: string; }; }; meetingInfo: any; sessionCorrelationId: string; roles: string[]; getCurUserType: () => string | null; callStateForMetrics: CallStateForMetrics; }; /** * Maintain a cache of meetings and sync with services. * @class */ export default class Meetings extends WebexPlugin { loggerRequest: any; media: any; meetingCollection: any; deletedMeetings: Map; personalMeetingRoom: any; preferredWebexSite: any; reachability: Reachability; registered: any; registrationPromise: Promise; unregistrationPromise: Promise; request: any; geoHintInfo: any; meetingInfo: any; mediaHelpers: any; breakoutLocusForHandleLater: any; namespace: string; registrationStatus: MeetingRegistrationStatus; /** * Initializes the Meetings Plugin * @constructor * @public * @memberof Meetings */ constructor(...args: any[]); /** * check whether you need to handle this main session's locus data or not * @param {Object} meeting current meeting data * @param {Object} newLocus new locus data * @returns {boolean} * @private * @memberof Meetings */ private isNeedHandleMainLocus; /** * check whether you need to handle this locus data or not * @param {Object} meeting old locus data * @param {Object} newLocus new locus data * @returns {boolean} * @private * @memberof Meetings */ private isNeedHandleLocusDTO; /** * get corresponding meeting object by locus data * @param {Object} data a locus event * @param {String} data.locusUrl * @param {Object} data.locus * @returns {Object} * @private * @memberof Meetings */ getCorrespondingMeetingByLocus(data: LocusEvent): any; /** * handle locus events and takes meeting actions with them as they come in * @param {Object} data a locus event * @param {String} data.locusUrl * @param {Object} data.locus * @param {Boolean} useRandomDelayForInfo whether a random delay should be added to fetching meeting info * @param {String} data.eventType * @returns {undefined} * @private * @memberof Meetings */ private handleLocusEvent; /** * handles locus events through mercury that are not roap or approval request events * @param {Object} envelope * @param {Object} envelope.data * @param {String} envelope.data.eventType * @returns {undefined} * @private * @memberof Meetings */ private handleLocusMercury; /** * handles mecury offline event * @returns {undefined} * @private * @memberof Meetings */ private handleMercuryOffline; /** * registers for locus and roap mercury events * @returns {undefined} * @private * @memberof Meetings */ private listenForEvents; /** * stops listening for locus and roap mercury events * @returns {undefined} * @private * @memberof Meetings */ private stopListeningForEvents; /** * @returns {undefined} * @private * @memberof Meetings */ private onReady; /** * API to change log upload interval. Setting the factor to 0 will disable periodic log uploads. * * @param {number} factor new factor value * @returns {void} */ private _setLogUploadIntervalMultiplicationFactor; /** * API to toggle unified meetings * @param {Boolean} changeState * @private * @memberof Meetings * @returns {undefined} */ private _toggleUnifiedMeetings; /** * API to toggle starting adhoc meeting * @param {Boolean} changeState * @private * @memberof Meetings * @returns {undefined} */ private _toggleAdhocMeetings; /** * API to toggle TCP reachability, needs to be called before webex.meetings.register() * @param {Boolean} newValue * @private * @memberof Meetings * @returns {undefined} */ private _toggleTcpReachability; /** * API to toggle TLS reachability, needs to be called before webex.meetings.register() * @param {Boolean} newValue * @private * @memberof Meetings * @returns {undefined} */ private _toggleTlsReachability; /** * API to toggle backend ipv6 native support config, needs to be called before webex.meetings.register() * * @param {Boolean} newValue * @private * @memberof Meetings * @returns {undefined} */ private _toggleIpv6BackendNativeSupport; /** * API to toggle usage of audio main DTX, needs to be called before webex.meetings.register() * * @param {Boolean} newValue * @private * @memberof Meetings * @returns {undefined} */ private _toggleDisableAudioMainDtx; /** * API to toggle usage of audio twcc support * * @param {Boolean} newValue * @private * @memberof Meetings * @returns {undefined} */ private _toggleEnableAudioTwccForMultistream; /** * API to toggle stopping ICE Candidates Gathering after first relay candidate, * needs to be called before webex.meetings.joinWithMedia() * * @param {Boolean} newValue * @private * @memberof Meetings * @returns {undefined} */ private _toggleStopIceGatheringAfterFirstRelayCandidate; /** * Executes a registration step and updates the registration status. * @param {Function} step - The registration step to execute. * @param {string} stepName - The name of the registration step. * @returns {Promise} A promise that resolves when the step is completed. */ executeRegistrationStep(step: () => Promise, stepName: string): Promise; /** * Explicitly sets up the meetings plugin by registering * the device, connecting to mercury, and listening for locus events. * * @param {DeviceRegistrationOptions} [deviceRegistrationOptions] - The options for registering the device (optional) * @returns {Promise} * @public * @memberof Meetings */ register(deviceRegistrationOptions?: DeviceRegistrationOptions): Promise; /** * Explicitly tears down the meetings plugin by deregistering * the device, disconnecting from mercury, and stops listening to locus events * * @returns {Promise} * @public * @memberof Meetings */ unregister(): Promise; /** * Creates a noise reduction effect * * @param {INoiseReductionEffect} options optional custom effect options * @returns {Promise} noise reduction effect. * @public * @memberof Meetings */ createNoiseReductionEffect: (options?: INoiseReductionEffect) => Promise; /** * Creates a virtual background effect * * @param {IVirtualBackgroundEffect} options optional custom effect options * @returns {Promise} virtual background effect. * @public * @memberof Meetings */ createVirtualBackgroundEffect: (options?: IVirtualBackgroundEffect) => Promise; /** * Uploads logs to the webex services for tracking * @param {Object} [options={}] * @param {String} [options.callStart] Call Start Time * @param {String} [options.feedbackId] ID used for tracking * @param {String} [options.locusId] * @param {String} [options.correlationId] * @param {String} [options.meetingId] webex meeting ID * @param {String} [options.userId] userId * @param {String} [options.orgId] org id * @returns {String} feedback ID logs were submitted under */ uploadLogs(options?: { autoupload?: boolean; callStart?: string; feedbackId?: string; locussessionid?: string; locusId?: string; correlationId?: string; meetingId?: string; userId?: string; orgId?: string; }): any; /** * gets the reachability instance for Meetings * @returns {Reachability} * @public * @memberof Meetings */ getReachability(): Reachability; /** * initializes and starts gathering reachability for Meetings * @param {string} trigger - explains the reason for starting reachability * @returns {Promise} * @public * @memberof Meetings */ startReachability(trigger?: string): Promise; /** * Get geoHint for info for meetings * @returns {Promise} * @private * @memberof Meetings */ getGeoHint(): any; /** * Fetch user preferred webex site information * This also has other infomation about the user * @returns {Promise} * @private * @memberof Meetings */ fetchUserPreferredWebexSite(): any; /** * gets the personal meeting room instance, for saved PMR values for this user * @returns {PersonalMeetingRoom} * @public * @memberof Meetings */ getPersonalMeetingRoom(): any; /** * Returns basic information about a meeting that exists or * used to exist in the MeetingCollection * * @param {string} meetingId * @returns {BasicMeetingInformation|undefined} */ getBasicMeetingInformation(meetingId: string): BasicMeetingInformation; /** * @param {Meeting} meeting * @param {Object} reason * @param {String} type * @returns {Undefined} * @private * @memberof Meetings */ private destroy; /** * Fetch static meeting link for given conversation url. * * @param {string} conversationUrl - url for conversation * @returns {Promise} * @public * @memberof Meetings */ fetchStaticMeetingLink(conversationUrl: string): Promise; /** * Create a meeting or return an existing meeting. * * When meeting info passed it should be complete, e.g.: fetched after password or captcha provided * * @param {string} destination - sipURL, phonenumber, or locus object} * @param {DESTINATION_TYPE} [type] - the optional specified type, such as locusId * @param {Boolean} useRandomDelayForInfo - whether a random delay should be added to fetching meeting info * @param {Object} infoExtraParams extra parameters to be provided when fetching meeting info * @param {string} correlationId - the optional specified correlationId (callStateForMetrics.correlationId can be provided instead) * @param {Boolean} failOnMissingMeetingInfo - whether to throw an error if meeting info fails to fetch (for calls that are not 1:1 or content share) * @param {CallStateForMetrics} callStateForMetrics - information about call state for metrics * @param {Object} [meetingInfo] - Pre-fetched complete meeting info * @param {String} [meetingLookupUrl] - meeting info prefetch url * @param {string} sessionCorrelationId - the optional specified sessionCorrelationId (callStateForMetrics.sessionCorrelationId) can be provided instead * @param {String} classificationId - If space support classification, it will provide it while start instant meeting * @returns {Promise} A new Meeting. * @public * @memberof Meetings */ create(destination: string, type?: DESTINATION_TYPE, useRandomDelayForInfo?: boolean, infoExtraParams?: {}, correlationId?: string, failOnMissingMeetingInfo?: boolean, callStateForMetrics?: CallStateForMetrics, meetingInfo?: any, meetingLookupUrl?: any, sessionCorrelationId?: string, classificationId?: string): any; /** * Enable static meeting links for given conversation url. * * * @param {string} conversationUrl - url for conversation * @returns {Promise} * @public * @memberof Meetings */ enableStaticMeetingLink(conversationUrl: string): Promise; /** * Disable static meeting links for given conversation url. * * * @param {string} conversationUrl - url for conversation * @returns {Promise} * @public * @memberof Meetings */ disableStaticMeetingLink(conversationUrl: string): Promise; /** * Create meeting * * When meeting info passed it should be complete, e.g.: fetched after password or captcha provided * * @param {String} destination see create() * @param {DESTINATION_TYPE} type see create() * @param {Boolean} useRandomDelayForInfo whether a random delay should be added to fetching meeting info * @param {Object} infoExtraParams extra parameters to be provided when fetching meeting info * @param {CallStateForMetrics} callStateForMetrics - information about call state for metrics * @param {Boolean} failOnMissingMeetingInfo - whether to throw an error if meeting info fails to fetch (for calls that are not 1:1 or content share) * @param {Object} [meetingInfo] - Pre-fetched complete meeting info * @param {String} [meetingLookupUrl] - meeting info prefetch url * @param {String} classificationId see create() * @returns {Promise} a new meeting instance complete with meeting info and destination * @private * @memberof Meetings */ private createMeeting; /** * get a specifc meeting given it's type matched to the value, i.e., locus url * @param {String} type * @param {Object} value * @returns {Meeting} * @public * @memberof Meetings */ getMeetingByType(type: string, value: object): any; /** * Get all meetings. * @returns {Object} All currently active meetings. * @public * @memberof Meetings */ getAllMeetings(): any; /** * Syncs all the meetings from server. Does nothing and returns immediately if unverified guest. * @param {boolean} keepOnlyLocusMeetings - whether the sync should keep only locus meetings or any other meeting in meetingCollection * @returns {Promise} * @public * @memberof Meetings */ syncMeetings({ keepOnlyLocusMeetings }?: { keepOnlyLocusMeetings?: boolean; }): Promise; /** * sort out locus array for initial creating * @param {Array} loci original locus array * @returns {undefined} * @public * @memberof Meetings */ sortLocusArrayToUpdate(loci: any[]): any[]; /** * check breakout locus which waiting for main locus's meeting to be created, then handle the breakout locus * @param {Object} newCreatedLocus the locus which just create meeting object of it * @returns {undefined} * @public * @memberof Meetings */ checkHandleBreakoutLocus(newCreatedLocus: any): void; /** * Get the logger instance for plugin-meetings * @returns {Logger} */ getLogger(): any; /** * Returns the first meeting it finds that has the webrtc media connection created. * Useful for debugging in the console. * * @private * @returns {Meeting} Meeting object that has a webrtc media connection, else undefined */ getActiveWebrtcMeeting(): any; }