@webex/plugin-meetings 2.29.2 → 2.29.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.
- package/README.md +2 -1
- package/dist/common/collection.js +1 -1
- package/dist/common/collection.js.map +1 -1
- package/dist/meeting/index.js +2 -1
- package/dist/meeting/index.js.map +1 -1
- package/dist/metrics/index.js +4 -0
- package/dist/metrics/index.js.map +1 -1
- package/dist/peer-connection-manager/index.js +3 -3
- package/dist/peer-connection-manager/index.js.map +1 -1
- package/dist/reachability/index.js +17 -13
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/request.js +16 -7
- package/dist/reachability/request.js.map +1 -1
- package/internal-README.md +18 -9
- package/package.json +59 -41
- package/src/common/collection.ts +1 -1
- package/src/meeting/index.js +1 -1
- package/src/metrics/index.js +3 -0
- package/src/peer-connection-manager/index.js +3 -3
- package/src/reachability/index.js +12 -8
- package/src/reachability/{request.js → request.ts} +23 -6
- package/test/integration/spec/journey.js +2 -0
- package/test/integration/spec/space-meeting.js +1 -1
- package/test/unit/spec/meeting/index.js +3 -1
- package/test/.eslintrc.json +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Reachability","webex","reachabilityRequest","ReachabilityRequest","clusterLatencyResults","setup","window","localStorage","removeItem","REACHABILITY","LoggerProxy","logger","error","getClusters","clusters","performReachabilityCheck","results","setItem","cluster","iceServers","udp","tcp","map","url","username","credential","urls","iceCandidatePoolSize","iceTransportPolicy","key","config","peerConnection","RTCPeerConnection","peerConnectionError","log","startTime","begin","clusterList","buildPeerConnectionConfig","createPeerConnection","createOffer","offerToReceiveAudio","description","setLocalDescription","iceGatheringState","catch","iceGatheringStateError","all","then","parseIceResultsToReachabilityResults","reachabilityLatencyResults","logUnreachableClusters","unreachableList","forEach","unreachable","reachable","push","onicegatheringstatechange","COMPLETE","ICE_GATHERING_STATE","iceConnectionState","elapsed","getElapsedTime","setLatencyAndClose","onicecandidate","e","SERVER_REFLEXIVE","candidate","String","type","toLowerCase","ELAPSED","waitTime","resolve","peerConnectionProxy","Proxy","get","target","property","targetMember","bind","set","value","clusterId","Reflect","handleIceGatheringStateChange","handleOnIceCandidate","setTimeout","CLOSED","CONNECTION_STATE","connectionState","list","getUnreachablClusters","iceResults","reachabilityMap","latencyResult","latencyInMilliseconds","toString","length","getLocalSDPForClusters","localSDPData","REACHABLE","UNREACHABLE","resultKey","intialState","close"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable class-methods-use-this */\n/* globals window */\nimport _ from 'lodash';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {\n ICE_GATHERING_STATE,\n CONNECTION_STATE,\n REACHABILITY\n} from '../constants';\n\nimport ReachabilityRequest from './request';\n\n/**\n * @class Reachability\n * @export\n */\nexport default class Reachability {\n /**\n * Creates an instance of Reachability.\n * @param {object} webex\n * @memberof Reachability\n */\n constructor(webex) {\n this.webex = webex;\n\n /**\n * internal request object for the server\n * @instance\n * @type {Array}\n * @private\n * @memberof Reachability\n */\n this.reachabilityRequest = new ReachabilityRequest(this.webex);\n\n /**\n * internal object of clusters latency results\n * @instance\n * @type {object}\n * @private\n * @memberof Reachability\n */\n this.clusterLatencyResults = {};\n }\n\n\n /**\n * fetches reachability data\n * @returns {Object} reachability data\n * @public\n * @async\n * @memberof Reachability\n */\n async gatherReachability() {\n this.setup();\n\n // Remove stored reachability results to ensure no stale data\n if (window?.localStorage?.removeItem) {\n window.localStorage.removeItem(REACHABILITY.localStorage);\n }\n else {\n LoggerProxy.logger.error('Reachability:index#gatherReachability --> Error in accessing LocalStorage.');\n\n return {};\n }\n\n // Fetch clusters and measure latency\n try {\n const clusters = await this.reachabilityRequest.getClusters();\n\n // Perform Reachability Check\n const results = await this.performReachabilityCheck(clusters);\n\n window.localStorage.setItem(REACHABILITY.localStorage, JSON.stringify(results));\n\n return results;\n }\n catch (getClusterError) {\n LoggerProxy.logger.error(`Reachability:index#gatherReachability --> Error in calling getClusters(): ${getClusterError}`);\n\n return {};\n }\n }\n\n\n /**\n * Generate peerConnection config settings\n * @param {object} cluster\n * @returns {object} peerConnectionConfig\n * @private\n * @memberof Reachability\n */\n buildPeerConnectionConfig(cluster) {\n const iceServers = _.uniq([\n ...cluster.udp,\n ...cluster.tcp\n ]).map((url) => ({\n username: '',\n credential: '',\n urls: [url]\n }));\n\n return {\n iceServers: [\n ...iceServers\n ],\n iceCandidatePoolSize: '0',\n iceTransportPolicy: 'all'\n };\n }\n\n\n /**\n * Creates an RTCPeerConnection\n * @param {object} cluster\n * @returns {RTCPeerConnection} peerConnection\n * @private\n * @memberof Reachability\n */\n createPeerConnection(cluster) {\n const {key, config} = cluster;\n\n try {\n const peerConnection = new window.RTCPeerConnection(config);\n\n peerConnection.key = key;\n\n return peerConnection;\n }\n catch (peerConnectionError) {\n LoggerProxy.logger.log(`Reachability:index#getLocalSDPForClusters --> Error creating peerConnection: ${peerConnectionError}`);\n\n return null;\n }\n }\n\n\n /**\n * Gets total elapsed time\n * @param {RTCPeerConnection} peerConnection\n * @returns {Number} Milliseconds\n * @private\n * @memberof Reachability\n */\n getElapsedTime(peerConnection) {\n const startTime = peerConnection.begin;\n\n delete peerConnection.begin;\n\n return Date.now() - startTime;\n }\n\n\n /**\n * creates offer and generates localSDP\n * @param {object} clusterList cluster List\n * @returns {Promise} Reachability latency results\n * @private\n * @memberof Reachability\n */\n getLocalSDPForClusters(clusterList) {\n let clusters = [...Object.keys(clusterList)];\n\n clusters = clusters.map(async (key) => {\n const cluster = clusterList[key];\n const config = this.buildPeerConnectionConfig(cluster);\n const peerConnection = this.createPeerConnection({key, config});\n const description = await peerConnection.createOffer({offerToReceiveAudio: true});\n\n peerConnection.begin = Date.now();\n peerConnection.setLocalDescription(description);\n\n return this.iceGatheringState(peerConnection)\n .catch((iceGatheringStateError) => {\n LoggerProxy.logger.log(`Reachability:index#getLocalSDPForClusters --> Error in getLocalSDP : ${iceGatheringStateError}`);\n });\n });\n\n return Promise.all(clusters)\n .then(this.parseIceResultsToReachabilityResults)\n .then((reachabilityLatencyResults) => {\n this.logUnreachableClusters();\n\n // return results\n return reachabilityLatencyResults;\n });\n }\n\n\n /**\n * Get list of all unreachable clusters\n * @returns {array} Unreachable clusters\n * @private\n * @memberof Reachability\n */\n getUnreachablClusters() {\n const unreachableList = [];\n const clusters = this.clusterLatencyResults;\n\n Object.keys(clusters).forEach((key) => {\n const cluster = clusters[key];\n\n if (cluster.unreachable && !cluster.reachable) {\n unreachableList.push(key);\n }\n });\n\n return unreachableList;\n }\n\n\n /**\n * Attach an event handler for the icegatheringstatechange\n * event and measure latency.\n * @param {RTCPeerConnection} peerConnection\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n handleIceGatheringStateChange(peerConnection) {\n peerConnection.onicegatheringstatechange = () => {\n const {COMPLETE} = ICE_GATHERING_STATE;\n\n if (peerConnection.iceConnectionState === COMPLETE) {\n const elapsed = this.getElapsedTime(peerConnection);\n\n LoggerProxy.logger.log(`Reachability:index#onIceGatheringStateChange --> Successfully pinged ${peerConnection.key}:`, elapsed);\n this.setLatencyAndClose(peerConnection, elapsed);\n }\n };\n }\n\n\n /**\n * Attach an event handler for the icecandidate\n * event and measure latency.\n * @param {RTCPeerConnection} peerConnection\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n handleOnIceCandidate(peerConnection) {\n peerConnection.onicecandidate = (e) => {\n const SERVER_REFLEXIVE = 'srflx';\n\n if (e.candidate && String(e.candidate.type).toLowerCase() === SERVER_REFLEXIVE) {\n const elapsed = this.getElapsedTime(peerConnection);\n\n LoggerProxy.logger.log(`Reachability:index#onIceCandidate --> Successfully pinged ${peerConnection.key}:`, elapsed);\n this.setLatencyAndClose(peerConnection, elapsed);\n }\n };\n }\n\n\n /**\n * An event handler on an RTCPeerConnection when the state of the ICE\n * candidate gathering process changes. Used to measure connection\n * speed.\n * @private\n * @param {RTCPeerConnection} peerConnection\n * @returns {Promise}\n */\n iceGatheringState(peerConnection) {\n const ELAPSED = 'elapsed';\n const waitTime = 5e3;\n\n return new Promise((resolve) => {\n const peerConnectionProxy = new window.Proxy(peerConnection, {\n get(target, property) {\n const targetMember = target[property];\n\n if (typeof (targetMember) === 'function') {\n return targetMember.bind(target);\n }\n\n return targetMember;\n },\n set: (target, property, value) => {\n // only intercept elapsed property\n if (property === ELAPSED) {\n resolve({clusterId: peerConnection.key, elapsed: value});\n\n return true;\n }\n\n // pass thru\n return window.Reflect.set(target, property, value);\n }\n });\n\n // Using peerConnection proxy so handle functions below\n // won't be coupled to our promise implementation\n this.handleIceGatheringStateChange(peerConnectionProxy);\n this.handleOnIceCandidate(peerConnectionProxy);\n\n // Set maximum timeout\n window.setTimeout(() => {\n const CLOSED = {CONNECTION_STATE};\n\n // Close any open peerConnections\n if (peerConnectionProxy.connectionState !== CLOSED) {\n this.setLatencyAndClose(peerConnectionProxy, null);\n }\n }, waitTime);\n });\n }\n\n\n /**\n * Make a log of unreachable clusters.\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n logUnreachableClusters() {\n const list = this.getUnreachablClusters();\n\n list.forEach((cluster) => {\n LoggerProxy.logger.log(`Reachability:index#getLocalSDPForClusters --> No ice candidate for ${cluster}.`);\n });\n }\n\n\n /**\n * Calculates time to establish connection\n * @param {array} iceResults iceResults\n * @returns {object} reachabilityMap\n * @private\n * @memberof Reachability\n */\n parseIceResultsToReachabilityResults(iceResults) {\n const reachabilityMap = {};\n\n iceResults.forEach(({clusterId, elapsed}) => {\n let latencyResult;\n\n if (elapsed === null) {\n latencyResult = {reachable: 'false'};\n }\n else {\n latencyResult = {\n reachable: 'true',\n latencyInMilliseconds: (elapsed).toString()\n };\n }\n\n reachabilityMap[clusterId] = {\n udp: latencyResult,\n tcp: latencyResult\n };\n });\n\n return reachabilityMap;\n }\n\n\n /**\n * fetches reachability data\n * @param {object} clusterList\n * @returns {Promise<localSDPData>} reachability check results\n * @private\n * @memberof Reachability\n */\n performReachabilityCheck(clusterList) {\n if (!clusterList || !Object.keys(clusterList).length) {\n return Promise.resolve({});\n }\n\n return new Promise((resolve) => {\n this.getLocalSDPForClusters(clusterList)\n .then((localSDPData) => {\n if (!localSDPData || !Object.keys(localSDPData).length) {\n // TODO: handle the error condition properly and try retry\n LoggerProxy.logger.log('Reachability:index#performReachabilityCheck --> Local SDP is empty or has missing elements..returning');\n resolve({});\n }\n else {\n resolve(localSDPData);\n }\n })\n .catch((error) => {\n LoggerProxy.logger.error(`Reachability:index#performReachabilityCheck --> Error in getLocalSDPForClusters: ${error}`);\n resolve({});\n });\n });\n }\n\n\n /**\n * Records latency and closes the peerConnection\n * @param {RTCPeerConnection} peerConnection\n * @param {number} elapsed Latency in milliseconds\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n setLatencyAndClose(peerConnection, elapsed) {\n const REACHABLE = 'reachable';\n const UNREACHABLE = 'unreachable';\n const {CLOSED} = CONNECTION_STATE;\n const {key} = peerConnection;\n const resultKey = elapsed === null ? UNREACHABLE : REACHABLE;\n const intialState = {[REACHABLE]: 0, [UNREACHABLE]: 0};\n\n if (peerConnection.connectionState === CLOSED) {\n LoggerProxy.logger.log(`Reachability:index#setLatencyAndClose --> Attempting to set latency of ${elapsed} on closed peerConnection.`);\n\n return;\n }\n\n this.clusterLatencyResults[key] = this.clusterLatencyResults[key] || intialState;\n this.clusterLatencyResults[key][resultKey] += 1;\n\n // Set to null in case this fired from\n // an event other than onIceCandidate\n peerConnection.onicecandidate = null;\n peerConnection.close();\n peerConnection.elapsed = elapsed;\n }\n\n\n /**\n * utility function\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n setup() {\n this.clusterLatencyResults = {};\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;AACA;;AAMA;;AAEA;AACA;AACA;AACA;IACqBA,Y;EACnB;AACF;AACA;AACA;AACA;EACE,sBAAYC,KAAZ,EAAmB;IAAA;IACjB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6GA,KAA7G;;UACA6D,OAAO,CAAC,EAAD,CAAP;QACD,CAdH;MAeD,CAhBM,CAAP;IAiBD;IAGD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACE,4BAAmB1C,cAAnB,EAAmC8B,OAAnC,EAA4C;MAAA;;MAC1C,IAAMwC,SAAS,GAAG,WAAlB;MACA,IAAMC,WAAW,GAAG,aAApB;MACA,IAAOd,MAAP,GAAiBC,2BAAjB,CAAOD,MAAP;MACA,IAAO3D,GAAP,GAAcE,cAAd,CAAOF,GAAP;MACA,IAAM0E,SAAS,GAAG1C,OAAO,KAAK,IAAZ,GAAmByC,WAAnB,GAAiCD,SAAnD;MACA,IAAMG,WAAW,mEAAKH,SAAL,EAAiB,CAAjB,+CAAqBC,WAArB,EAAmC,CAAnC,gBAAjB;;MAEA,IAAIvE,cAAc,CAAC2D,eAAf,KAAmCF,MAAvC,EAA+C;QAC7C9E,oBAAA,CAAYC,MAAZ,CAAmBuB,GAAnB,kFAAiG2B,OAAjG;;QAEA;MACD;;MAED,KAAKzD,qBAAL,CAA2ByB,GAA3B,IAAkC,KAAKzB,qBAAL,CAA2ByB,GAA3B,KAAmC2E,WAArE;MACA,KAAKpG,qBAAL,CAA2ByB,GAA3B,EAAgC0E,SAAhC,KAA8C,CAA9C,CAf0C,CAiB1C;MACA;;MACAxE,cAAc,CAACiC,cAAf,GAAgC,IAAhC;MACAjC,cAAc,CAAC0E,KAAf;MACA1E,cAAc,CAAC8B,OAAf,GAAyBA,OAAzB;IACD;IAGD;AACF;AACA;AACA;AACA;AACA;;;;WACE,iBAAQ;MACN,KAAKzD,qBAAL,GAA6B,EAA7B;IACD"}
|
|
1
|
+
{"version":3,"names":["DEFAULT_TIMEOUT","VIDEO_MESH_TIMEOUT","Reachability","webex","reachabilityRequest","ReachabilityRequest","clusterLatencyResults","setup","window","localStorage","removeItem","REACHABILITY","LoggerProxy","logger","error","getClusters","clusters","performReachabilityCheck","results","setItem","log","cluster","iceServers","udp","tcp","map","url","username","credential","urls","iceCandidatePoolSize","iceTransportPolicy","key","config","peerConnection","RTCPeerConnection","peerConnectionError","startTime","begin","clusterList","buildPeerConnectionConfig","createPeerConnection","createOffer","offerToReceiveAudio","description","setLocalDescription","iceGatheringState","isVideoMesh","catch","iceGatheringStateError","all","then","parseIceResultsToReachabilityResults","reachabilityLatencyResults","logUnreachableClusters","unreachableList","forEach","unreachable","reachable","push","onicegatheringstatechange","COMPLETE","ICE_GATHERING_STATE","iceConnectionState","elapsed","getElapsedTime","setLatencyAndClose","onicecandidate","e","SERVER_REFLEXIVE","candidate","String","type","toLowerCase","timeout","ELAPSED","resolve","peerConnectionProxy","Proxy","get","target","property","targetMember","bind","set","value","clusterId","Reflect","handleIceGatheringStateChange","handleOnIceCandidate","setTimeout","CLOSED","CONNECTION_STATE","connectionState","list","getUnreachablClusters","iceResults","reachabilityMap","latencyResult","latencyInMilliseconds","toString","length","getLocalSDPForClusters","localSDPData","REACHABLE","UNREACHABLE","resultKey","intialState","close"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable class-methods-use-this */\n/* globals window */\nimport _ from 'lodash';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {\n ICE_GATHERING_STATE,\n CONNECTION_STATE,\n REACHABILITY\n} from '../constants';\n\nimport ReachabilityRequest from './request';\n\nconst DEFAULT_TIMEOUT = 3000;\nconst VIDEO_MESH_TIMEOUT = 1000;\n\n/**\n * @class Reachability\n * @export\n */\nexport default class Reachability {\n /**\n * Creates an instance of Reachability.\n * @param {object} webex\n * @memberof Reachability\n */\n constructor(webex) {\n this.webex = webex;\n\n /**\n * internal request object for the server\n * @instance\n * @type {Array}\n * @private\n * @memberof Reachability\n */\n this.reachabilityRequest = new ReachabilityRequest(this.webex);\n\n /**\n * internal object of clusters latency results\n * @instance\n * @type {object}\n * @private\n * @memberof Reachability\n */\n this.clusterLatencyResults = {};\n }\n\n\n /**\n * fetches reachability data\n * @returns {Object} reachability data\n * @public\n * @async\n * @memberof Reachability\n */\n async gatherReachability() {\n this.setup();\n\n // Remove stored reachability results to ensure no stale data\n if (window?.localStorage?.removeItem) {\n window.localStorage.removeItem(REACHABILITY.localStorage);\n }\n else {\n LoggerProxy.logger.error('Reachability:index#gatherReachability --> Error in accessing LocalStorage.');\n\n return {};\n }\n\n // Fetch clusters and measure latency\n try {\n const clusters = await this.reachabilityRequest.getClusters();\n\n // Perform Reachability Check\n const results = await this.performReachabilityCheck(clusters);\n\n window.localStorage.setItem(REACHABILITY.localStorage, JSON.stringify(results));\n\n LoggerProxy.logger.log('Reachability:index#gatherReachability --> Reachability checks completed');\n\n return results;\n }\n catch (getClusterError) {\n LoggerProxy.logger.error(`Reachability:index#gatherReachability --> Error in calling getClusters(): ${getClusterError}`);\n\n return {};\n }\n }\n\n\n /**\n * Generate peerConnection config settings\n * @param {object} cluster\n * @returns {object} peerConnectionConfig\n * @private\n * @memberof Reachability\n */\n buildPeerConnectionConfig(cluster) {\n const iceServers = _.uniq([\n ...cluster.udp,\n ...cluster.tcp\n ]).map((url) => ({\n username: '',\n credential: '',\n urls: [url]\n }));\n\n return {\n iceServers: [\n ...iceServers\n ],\n iceCandidatePoolSize: '0',\n iceTransportPolicy: 'all'\n };\n }\n\n\n /**\n * Creates an RTCPeerConnection\n * @param {object} cluster\n * @returns {RTCPeerConnection} peerConnection\n * @private\n * @memberof Reachability\n */\n createPeerConnection(cluster) {\n const {key, config} = cluster;\n\n try {\n const peerConnection = new window.RTCPeerConnection(config);\n\n peerConnection.key = key;\n\n return peerConnection;\n }\n catch (peerConnectionError) {\n LoggerProxy.logger.log(`Reachability:index#createPeerConnection --> Error creating peerConnection: ${peerConnectionError}`);\n\n return null;\n }\n }\n\n\n /**\n * Gets total elapsed time\n * @param {RTCPeerConnection} peerConnection\n * @returns {Number} Milliseconds\n * @private\n * @memberof Reachability\n */\n getElapsedTime(peerConnection) {\n const startTime = peerConnection.begin;\n\n delete peerConnection.begin;\n\n return Date.now() - startTime;\n }\n\n\n /**\n * creates offer and generates localSDP\n * @param {object} clusterList cluster List\n * @returns {Promise} Reachability latency results\n * @private\n * @memberof Reachability\n */\n getLocalSDPForClusters(clusterList) {\n let clusters = [...Object.keys(clusterList)];\n\n clusters = clusters.map(async (key) => {\n const cluster = clusterList[key];\n const config = this.buildPeerConnectionConfig(cluster);\n const peerConnection = this.createPeerConnection({key, config});\n const description = await peerConnection.createOffer({offerToReceiveAudio: true});\n\n peerConnection.begin = Date.now();\n peerConnection.setLocalDescription(description);\n\n return this.iceGatheringState(peerConnection, cluster.isVideoMesh ? VIDEO_MESH_TIMEOUT : DEFAULT_TIMEOUT)\n .catch((iceGatheringStateError) => {\n LoggerProxy.logger.log(`Reachability:index#getLocalSDPForClusters --> Error in getLocalSDP : ${iceGatheringStateError}`);\n });\n });\n\n return Promise.all(clusters)\n .then(this.parseIceResultsToReachabilityResults)\n .then((reachabilityLatencyResults) => {\n this.logUnreachableClusters();\n\n // return results\n return reachabilityLatencyResults;\n });\n }\n\n\n /**\n * Get list of all unreachable clusters\n * @returns {array} Unreachable clusters\n * @private\n * @memberof Reachability\n */\n getUnreachablClusters() {\n const unreachableList = [];\n const clusters = this.clusterLatencyResults;\n\n Object.keys(clusters).forEach((key) => {\n const cluster = clusters[key];\n\n if (cluster.unreachable && !cluster.reachable) {\n unreachableList.push(key);\n }\n });\n\n return unreachableList;\n }\n\n\n /**\n * Attach an event handler for the icegatheringstatechange\n * event and measure latency.\n * @param {RTCPeerConnection} peerConnection\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n handleIceGatheringStateChange(peerConnection) {\n peerConnection.onicegatheringstatechange = () => {\n const {COMPLETE} = ICE_GATHERING_STATE;\n\n if (peerConnection.iceConnectionState === COMPLETE) {\n const elapsed = this.getElapsedTime(peerConnection);\n\n LoggerProxy.logger.log(`Reachability:index#onIceGatheringStateChange --> Successfully pinged ${peerConnection.key}:`, elapsed);\n this.setLatencyAndClose(peerConnection, elapsed);\n }\n };\n }\n\n\n /**\n * Attach an event handler for the icecandidate\n * event and measure latency.\n * @param {RTCPeerConnection} peerConnection\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n handleOnIceCandidate(peerConnection) {\n peerConnection.onicecandidate = (e) => {\n const SERVER_REFLEXIVE = 'srflx';\n\n if (e.candidate && String(e.candidate.type).toLowerCase() === SERVER_REFLEXIVE) {\n const elapsed = this.getElapsedTime(peerConnection);\n\n LoggerProxy.logger.log(`Reachability:index#onIceCandidate --> Successfully pinged ${peerConnection.key}:`, elapsed);\n this.setLatencyAndClose(peerConnection, elapsed);\n }\n };\n }\n\n /**\n * An event handler on an RTCPeerConnection when the state of the ICE\n * candidate gathering process changes. Used to measure connection\n * speed.\n * @private\n * @param {RTCPeerConnection} peerConnection\n * @param {number} timeout\n * @returns {Promise}\n */\n iceGatheringState(peerConnection, timeout) {\n const ELAPSED = 'elapsed';\n\n return new Promise((resolve) => {\n const peerConnectionProxy = new window.Proxy(peerConnection, {\n get(target, property) {\n const targetMember = target[property];\n\n if (typeof (targetMember) === 'function') {\n return targetMember.bind(target);\n }\n\n return targetMember;\n },\n set: (target, property, value) => {\n // only intercept elapsed property\n if (property === ELAPSED) {\n resolve({clusterId: peerConnection.key, elapsed: value});\n\n return true;\n }\n\n // pass thru\n return window.Reflect.set(target, property, value);\n }\n });\n\n // Using peerConnection proxy so handle functions below\n // won't be coupled to our promise implementation\n this.handleIceGatheringStateChange(peerConnectionProxy);\n this.handleOnIceCandidate(peerConnectionProxy);\n\n // Set maximum timeout\n window.setTimeout(() => {\n const {CLOSED} = CONNECTION_STATE;\n\n // Close any open peerConnections\n if (peerConnectionProxy.connectionState !== CLOSED) {\n this.setLatencyAndClose(peerConnectionProxy, null);\n }\n }, timeout);\n });\n }\n\n\n /**\n * Make a log of unreachable clusters.\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n logUnreachableClusters() {\n const list = this.getUnreachablClusters();\n\n list.forEach((cluster) => {\n LoggerProxy.logger.log(`Reachability:index#logUnreachableClusters --> No ice candidate for ${cluster}.`);\n });\n }\n\n\n /**\n * Calculates time to establish connection\n * @param {array} iceResults iceResults\n * @returns {object} reachabilityMap\n * @private\n * @memberof Reachability\n */\n parseIceResultsToReachabilityResults(iceResults) {\n const reachabilityMap = {};\n\n iceResults.forEach(({clusterId, elapsed}) => {\n let latencyResult;\n\n if (elapsed === null) {\n latencyResult = {reachable: 'false'};\n }\n else {\n latencyResult = {\n reachable: 'true',\n latencyInMilliseconds: (elapsed).toString()\n };\n }\n\n reachabilityMap[clusterId] = {\n udp: latencyResult,\n tcp: latencyResult\n };\n });\n\n return reachabilityMap;\n }\n\n\n /**\n * fetches reachability data\n * @param {object} clusterList\n * @returns {Promise<localSDPData>} reachability check results\n * @private\n * @memberof Reachability\n */\n performReachabilityCheck(clusterList) {\n if (!clusterList || !Object.keys(clusterList).length) {\n return Promise.resolve({});\n }\n\n return new Promise((resolve) => {\n this.getLocalSDPForClusters(clusterList)\n .then((localSDPData) => {\n if (!localSDPData || !Object.keys(localSDPData).length) {\n // TODO: handle the error condition properly and try retry\n LoggerProxy.logger.log('Reachability:index#performReachabilityCheck --> Local SDP is empty or has missing elements..returning');\n resolve({});\n }\n else {\n resolve(localSDPData);\n }\n })\n .catch((error) => {\n LoggerProxy.logger.error(`Reachability:index#performReachabilityCheck --> Error in getLocalSDPForClusters: ${error}`);\n resolve({});\n });\n });\n }\n\n\n /**\n * Records latency and closes the peerConnection\n * @param {RTCPeerConnection} peerConnection\n * @param {number} elapsed Latency in milliseconds\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n setLatencyAndClose(peerConnection, elapsed) {\n const REACHABLE = 'reachable';\n const UNREACHABLE = 'unreachable';\n const {CLOSED} = CONNECTION_STATE;\n const {key} = peerConnection;\n const resultKey = elapsed === null ? UNREACHABLE : REACHABLE;\n const intialState = {[REACHABLE]: 0, [UNREACHABLE]: 0};\n\n if (peerConnection.connectionState === CLOSED) {\n LoggerProxy.logger.log(`Reachability:index#setLatencyAndClose --> Attempting to set latency of ${elapsed} on closed peerConnection.`);\n\n return;\n }\n\n this.clusterLatencyResults[key] = this.clusterLatencyResults[key] || intialState;\n this.clusterLatencyResults[key][resultKey] += 1;\n\n // Set to null in case this fired from\n // an event other than onIceCandidate\n peerConnection.onicecandidate = null;\n peerConnection.close();\n peerConnection.elapsed = elapsed;\n }\n\n\n /**\n * utility function\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n setup() {\n this.clusterLatencyResults = {};\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;AACA;;AAMA;;AAEA,IAAMA,eAAe,GAAG,IAAxB;AACA,IAAMC,kBAAkB,GAAG,IAA3B;AAEA;AACA;AACA;AACA;;IACqBC,Y;EACnB;AACF;AACA;AACA;AACA;EACE,sBAAYC,KAAZ,EAAmB;IAAA;IACjB,KAAKA,KAAL,GAAaA,KAAb;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;;IACI,KAAKC,mBAAL,GAA2B,IAAIC,gBAAJ,CAAwB,KAAKF,KAA7B,CAA3B;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;;IACI,KAAKG,qBAAL,GAA6B,EAA7B;EACD;EAGD;AACF;AACA;AACA;AACA;AACA;AACA;;;;;;wGACE;QAAA;;QAAA;QAAA;UAAA;YAAA;cAAA;gBACE,KAAKC,KAAL,GADF,CAGE;;gBAHF,iBAIMC,MAJN,4DAIM,QAAQC,YAJd,iDAIM,qBAAsBC,UAJ5B;kBAAA;kBAAA;gBAAA;;gBAKIF,MAAM,CAACC,YAAP,CAAoBC,UAApB,CAA+BC,uBAAA,CAAaF,YAA5C;gBALJ;gBAAA;;cAAA;gBAQIG,oBAAA,CAAYC,MAAZ,CAAmBC,KAAnB,CAAyB,4EAAzB;;gBARJ,iCAUW,EAVX;;cAAA;gBAAA;gBAAA;gBAAA,OAe2B,KAAKV,mBAAL,CAAyBW,WAAzB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C;QAC7C/E,oBAAA,CAAYC,MAAZ,CAAmBO,GAAnB,kFAAiG4C,OAAjG;;QAEA;MACD;;MAED,KAAK1D,qBAAL,CAA2B0B,GAA3B,IAAkC,KAAK1B,qBAAL,CAA2B0B,GAA3B,KAAmC2E,WAArE;MACA,KAAKrG,qBAAL,CAA2B0B,GAA3B,EAAgC0E,SAAhC,KAA8C,CAA9C,CAf0C,CAiB1C;MACA;;MACAxE,cAAc,CAACiC,cAAf,GAAgC,IAAhC;MACAjC,cAAc,CAAC0E,KAAf;MACA1E,cAAc,CAAC8B,OAAf,GAAyBA,OAAzB;IACD;IAGD;AACF;AACA;AACA;AACA;AACA;;;;WACE,iBAAQ;MACN,KAAK1D,qBAAL,GAA6B,EAA7B;IACD"}
|
|
@@ -10,6 +10,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
10
10
|
|
|
11
11
|
exports.default = void 0;
|
|
12
12
|
|
|
13
|
+
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
14
|
+
|
|
13
15
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
14
16
|
|
|
15
17
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
@@ -23,18 +25,18 @@ var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy")
|
|
|
23
25
|
var _constants = require("../constants");
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
|
-
* @class
|
|
28
|
+
* @class ReachabilityRequest
|
|
27
29
|
*/
|
|
28
|
-
var
|
|
30
|
+
var ReachabilityRequest = /*#__PURE__*/(0, _createClass2.default)(
|
|
29
31
|
/**
|
|
30
|
-
* Creates an instance of
|
|
32
|
+
* Creates an instance of ReachabilityRequest.
|
|
31
33
|
* @param {object} webex
|
|
32
|
-
* @memberof
|
|
34
|
+
* @memberof ReachabilityRequest
|
|
33
35
|
*/
|
|
34
|
-
function
|
|
36
|
+
function ReachabilityRequest(webex) {
|
|
35
37
|
var _this = this;
|
|
36
38
|
|
|
37
|
-
(0, _classCallCheck2.default)(this,
|
|
39
|
+
(0, _classCallCheck2.default)(this, ReachabilityRequest);
|
|
38
40
|
(0, _defineProperty2.default)(this, "getClusters", function () {
|
|
39
41
|
return _this.webex.request({
|
|
40
42
|
method: _constants.HTTP_VERBS.GET,
|
|
@@ -43,6 +45,11 @@ function RechabilityRequest(webex) {
|
|
|
43
45
|
resource: _constants.RESOURCE.CLUSTERS
|
|
44
46
|
}).then(function (res) {
|
|
45
47
|
var clusters = res.body.clusters;
|
|
48
|
+
(0, _keys.default)(clusters).forEach(function (key) {
|
|
49
|
+
var _res$body$clusterClas, _res$body$clusterClas2;
|
|
50
|
+
|
|
51
|
+
clusters[key].isVideoMesh = (_res$body$clusterClas = res.body.clusterClasses) === null || _res$body$clusterClas === void 0 ? void 0 : (_res$body$clusterClas2 = _res$body$clusterClas.hybridMedia) === null || _res$body$clusterClas2 === void 0 ? void 0 : _res$body$clusterClas2.includes(key);
|
|
52
|
+
});
|
|
46
53
|
|
|
47
54
|
_loggerProxy.default.logger.log("Reachability:request#getClusters --> get clusters successful:".concat((0, _stringify.default)(clusters)));
|
|
48
55
|
|
|
@@ -68,9 +75,11 @@ function RechabilityRequest(webex) {
|
|
|
68
75
|
}
|
|
69
76
|
/**
|
|
70
77
|
* gets the cluster information
|
|
78
|
+
*
|
|
79
|
+
* @param {boolean} includeVideoMesh whether to include the video mesh clusters in the result or not
|
|
71
80
|
* @returns {Promise}
|
|
72
81
|
*/
|
|
73
82
|
);
|
|
74
|
-
var _default =
|
|
83
|
+
var _default = ReachabilityRequest;
|
|
75
84
|
exports.default = _default;
|
|
76
85
|
//# sourceMappingURL=request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ReachabilityRequest","webex","request","method","HTTP_VERBS","GET","shouldRefreshAccessToken","api","API","CALLIOPEDISCOVERY","resource","RESOURCE","CLUSTERS","then","res","clusters","body","forEach","key","isVideoMesh","clusterClasses","hybridMedia","includes","LoggerProxy","logger","log","localSDPList","POST","REACHABILITY","offers"],"sources":["request.ts"],"sourcesContent":["import LoggerProxy from '../common/logs/logger-proxy';\nimport {\n HTTP_VERBS,\n RESOURCE,\n API\n} from '../constants';\n\nexport interface ClusterNode {\n isVideoMesh: boolean;\n udp: Array<string>;\n tcp: Array<string>;\n xtls: Array<string>;\n}\n\nexport type ClusterList = {\n [key:string]: ClusterNode;\n}\n\n/**\n * @class ReachabilityRequest\n */\nclass ReachabilityRequest {\n /**\n * Creates an instance of ReachabilityRequest.\n * @param {object} webex\n * @memberof ReachabilityRequest\n */\n constructor(webex) {\n this.webex = webex;\n }\n\n /**\n * gets the cluster information\n *\n * @param {boolean} includeVideoMesh whether to include the video mesh clusters in the result or not\n * @returns {Promise}\n */\n getClusters = (): Promise<ClusterList> => this.webex.request({\n method: HTTP_VERBS.GET,\n shouldRefreshAccessToken: false,\n api: API.CALLIOPEDISCOVERY,\n resource: RESOURCE.CLUSTERS\n })\n .then((res) => {\n const {clusters} = res.body;\n\n Object.keys(clusters).forEach((key) => {\n clusters[key].isVideoMesh = res.body.clusterClasses?.hybridMedia?.includes(key);\n });\n\n LoggerProxy.logger.log(`Reachability:request#getClusters --> get clusters successful:${JSON.stringify(clusters)}`);\n\n return clusters;\n });\n\n /**\n * gets remote SDP For Clusters\n * @param {Object} localSDPList localSDPs for the cluster\n * @returns {Object}\n */\n remoteSDPForClusters = (localSDPList) => this.webex.request({\n method: HTTP_VERBS.POST,\n shouldRefreshAccessToken: false,\n api: API.CALLIOPEDISCOVERY,\n resource: RESOURCE.REACHABILITY,\n body: {offers: localSDPList}\n })\n .then((res) => {\n LoggerProxy.logger.log('Reachability:request#remoteSDPForClusters --> Remote SDPs got succcessfully');\n\n return res.body;\n });\n}\n\nexport default ReachabilityRequest;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAiBA;AACA;AACA;I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,CAjCJ;EACjB,KAAKf,KAAL,GAAaA,KAAb;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;eAsCeD,mB"}
|
package/internal-README.md
CHANGED
|
@@ -80,26 +80,30 @@ git checkout -b 39555-new-feature plugin-meetings
|
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
82
|
# Point all package.json files to the src directory instead of the dist directory.
|
|
83
|
-
|
|
83
|
+
yarn run distsrc
|
|
84
|
+
|
|
84
85
|
```
|
|
85
86
|
|
|
86
87
|
#### Testers
|
|
87
88
|
|
|
88
89
|
```bash
|
|
89
90
|
# Transpile the code into the dist directory.
|
|
90
|
-
|
|
91
|
+
yarn run build
|
|
92
|
+
|
|
91
93
|
```
|
|
92
94
|
|
|
93
95
|
> Individual packages containing samples can usually be run this way:
|
|
94
96
|
> ```
|
|
95
|
-
>
|
|
97
|
+
> yarn run serve:package --env.package @webex/plugin-meetings
|
|
98
|
+
|
|
96
99
|
> ```
|
|
97
100
|
> However, `webex` does not get compiled properly for `plugin-meetings` using this method, so do the following instead.
|
|
98
101
|
|
|
99
102
|
|
|
100
103
|
```bash
|
|
101
104
|
# Run the "sample app" sample.
|
|
102
|
-
|
|
105
|
+
yarn run samples:meetings
|
|
106
|
+
|
|
103
107
|
```
|
|
104
108
|
|
|
105
109
|
- Visit https://localhost:8000/
|
|
@@ -118,13 +122,16 @@ npm run samples:meetings
|
|
|
118
122
|
|
|
119
123
|
### Run tests
|
|
120
124
|
|
|
121
|
-
Use `
|
|
125
|
+
Use `yarn run distsrc` to point each package's `main` entry at the raw src and let `babel` compile on the fly.
|
|
126
|
+
|
|
122
127
|
|
|
123
128
|
```bash
|
|
124
129
|
# Point all package.json files to the src directory instead of the dist directory.
|
|
125
|
-
|
|
130
|
+
yarn run distsrc
|
|
131
|
+
|
|
126
132
|
# Run the package tests.
|
|
127
|
-
|
|
133
|
+
yarn run test --packages @webex/plugin-meetings
|
|
134
|
+
|
|
128
135
|
```
|
|
129
136
|
|
|
130
137
|
You can use the `--unit`, `--integration`, `--automation`, and `--documentation` switches to control what types of tests you run and `--node` and `--browser` to control which environments your tests run in.
|
|
@@ -133,14 +140,16 @@ You can use the `--unit`, `--integration`, `--automation`, and `--documentation`
|
|
|
133
140
|
|
|
134
141
|
```bash
|
|
135
142
|
# Example running browser tests in debug mode.
|
|
136
|
-
|
|
143
|
+
yarn run test --packages @webex/plugin-teams --browser --karma-debug
|
|
144
|
+
|
|
137
145
|
```
|
|
138
146
|
|
|
139
147
|
> See [SCRIPTS.md](https://github.com/webex/webex-js-sdk/blob/master/SCRIPTS.md) to learn how to run tests on [SauceLabs](https://saucelabs.com/) and more.
|
|
140
148
|
|
|
141
149
|
```bash
|
|
142
150
|
# Point all package.json files back to the dist directory.
|
|
143
|
-
|
|
151
|
+
yarn run srcdist
|
|
152
|
+
|
|
144
153
|
```
|
|
145
154
|
|
|
146
155
|
### Commit changes
|
package/package.json
CHANGED
|
@@ -1,43 +1,61 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
2
|
+
"name": "@webex/plugin-meetings",
|
|
3
|
+
"version": "2.29.5",
|
|
4
|
+
"description": "",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"contributors": [
|
|
7
|
+
"Adam Weeks <adweeks@cisco.com> (https://adamweeks.com/)",
|
|
8
|
+
"Arun Ganeshan <arungane@cisco.com>",
|
|
9
|
+
"Christopher DuBois <chdubois@cisco.com> (https://chrisadubois.github.io/)",
|
|
10
|
+
"Matt Norris <matnorri@cisco.com> (http://mattnorris.me)",
|
|
11
|
+
"Moriah Maney <momaney@cisco.com>",
|
|
12
|
+
"Taymoor Khan <taykhan@cisco.com>"
|
|
13
|
+
],
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"devMain": "src/index.js",
|
|
16
|
+
"repository": "https://github.com/webex/webex-js-sdk/tree/master/packages/@webex/plugin-meetings",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=14"
|
|
19
|
+
},
|
|
20
|
+
"browserify": {
|
|
21
|
+
"transform": [
|
|
22
|
+
"babelify",
|
|
23
|
+
"envify"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@webex/plugin-meetings": "workspace:^",
|
|
28
|
+
"@webex/test-helper-chai": "workspace:^",
|
|
29
|
+
"@webex/test-helper-mocha": "workspace:^",
|
|
30
|
+
"@webex/test-helper-mock-webex": "workspace:^",
|
|
31
|
+
"@webex/test-helper-retry": "workspace:^",
|
|
32
|
+
"@webex/test-helper-test-users": "workspace:^",
|
|
33
|
+
"chai": "^4.3.4",
|
|
34
|
+
"chai-as-promised": "^7.1.1",
|
|
35
|
+
"jsdom-global": "3.0.2",
|
|
36
|
+
"sinon": "^9.2.4"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@webex/common": "workspace:^",
|
|
40
|
+
"@webex/internal-media-core": "^0.0.7-beta",
|
|
41
|
+
"@webex/internal-plugin-conversation": "workspace:^",
|
|
42
|
+
"@webex/internal-plugin-device": "workspace:^",
|
|
43
|
+
"@webex/internal-plugin-mercury": "workspace:^",
|
|
44
|
+
"@webex/internal-plugin-metrics": "workspace:^",
|
|
45
|
+
"@webex/internal-plugin-support": "workspace:^",
|
|
46
|
+
"@webex/internal-plugin-user": "workspace:^",
|
|
47
|
+
"@webex/plugin-people": "workspace:^",
|
|
48
|
+
"@webex/plugin-rooms": "workspace:^",
|
|
49
|
+
"@webex/webex-core": "workspace:^",
|
|
50
|
+
"bowser": "^2.11.0",
|
|
51
|
+
"btoa": "^1.2.1",
|
|
52
|
+
"dotenv": "^4.0.0",
|
|
53
|
+
"global": "^4.4.0",
|
|
54
|
+
"ip-anonymize": "^0.1.0",
|
|
55
|
+
"javascript-state-machine": "^3.1.0",
|
|
56
|
+
"lodash": "^4.17.21",
|
|
57
|
+
"sdp-transform": "^2.12.0",
|
|
58
|
+
"uuid": "^3.3.2",
|
|
59
|
+
"webrtc-adapter": "^7.7.0"
|
|
60
|
+
}
|
|
43
61
|
}
|
package/src/common/collection.ts
CHANGED
package/src/meeting/index.js
CHANGED
|
@@ -3510,7 +3510,7 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
3510
3510
|
Metrics.postEvent({
|
|
3511
3511
|
event: eventType.CALL_INITIATED,
|
|
3512
3512
|
meeting: this,
|
|
3513
|
-
data: {trigger: trigger.USER_INTERACTION}
|
|
3513
|
+
data: {trigger: trigger.USER_INTERACTION, isRoapCallEnabled: true}
|
|
3514
3514
|
});
|
|
3515
3515
|
|
|
3516
3516
|
LoggerProxy.logger.log('Meeting:index#join --> Joining a meeting');
|
package/src/metrics/index.js
CHANGED
|
@@ -121,7 +121,7 @@ const isSdpInvalid = (sdp) => {
|
|
|
121
121
|
|
|
122
122
|
for (const mediaLine of parsedSdp.media) {
|
|
123
123
|
if (!mediaLine.candidates || mediaLine.candidates?.length === 0) {
|
|
124
|
-
LoggerProxy.logger.error('PeerConnectionManager:index#isSdpInvalid --> iceCandidate: Ice
|
|
124
|
+
LoggerProxy.logger.error('PeerConnectionManager:index#isSdpInvalid --> iceCandidate: Ice candidate never completed');
|
|
125
125
|
|
|
126
126
|
return 'iceCandidate: Ice gathering never completed';
|
|
127
127
|
}
|
|
@@ -378,7 +378,7 @@ pc.setRemoteSessionDetails = (
|
|
|
378
378
|
};
|
|
379
379
|
|
|
380
380
|
/**
|
|
381
|
-
*
|
|
381
|
+
* Create offer with a valid parameter
|
|
382
382
|
* @param {Object} peerConnection
|
|
383
383
|
* @param {Object} meetingProperties
|
|
384
384
|
* @param {string} meetingProperties.meetingId
|
|
@@ -403,7 +403,7 @@ pc.createOffer = (peerConnection, {
|
|
|
403
403
|
.createOffer()
|
|
404
404
|
.then((description) => {
|
|
405
405
|
// bug https://bugs.chromium.org/p/chromium/issues/detail?id=1020642
|
|
406
|
-
// chrome currently generates RTX line irrespective of
|
|
406
|
+
// chrome currently generates RTX line irrespective of whether the server side supports it
|
|
407
407
|
// we are removing apt as well because its associated with rtx line
|
|
408
408
|
|
|
409
409
|
if (!enableRtx) {
|
|
@@ -15,6 +15,9 @@ import {
|
|
|
15
15
|
|
|
16
16
|
import ReachabilityRequest from './request';
|
|
17
17
|
|
|
18
|
+
const DEFAULT_TIMEOUT = 3000;
|
|
19
|
+
const VIDEO_MESH_TIMEOUT = 1000;
|
|
20
|
+
|
|
18
21
|
/**
|
|
19
22
|
* @class Reachability
|
|
20
23
|
* @export
|
|
@@ -77,6 +80,8 @@ export default class Reachability {
|
|
|
77
80
|
|
|
78
81
|
window.localStorage.setItem(REACHABILITY.localStorage, JSON.stringify(results));
|
|
79
82
|
|
|
83
|
+
LoggerProxy.logger.log('Reachability:index#gatherReachability --> Reachability checks completed');
|
|
84
|
+
|
|
80
85
|
return results;
|
|
81
86
|
}
|
|
82
87
|
catch (getClusterError) {
|
|
@@ -132,7 +137,7 @@ export default class Reachability {
|
|
|
132
137
|
return peerConnection;
|
|
133
138
|
}
|
|
134
139
|
catch (peerConnectionError) {
|
|
135
|
-
LoggerProxy.logger.log(`Reachability:index#
|
|
140
|
+
LoggerProxy.logger.log(`Reachability:index#createPeerConnection --> Error creating peerConnection: ${peerConnectionError}`);
|
|
136
141
|
|
|
137
142
|
return null;
|
|
138
143
|
}
|
|
@@ -174,7 +179,7 @@ export default class Reachability {
|
|
|
174
179
|
peerConnection.begin = Date.now();
|
|
175
180
|
peerConnection.setLocalDescription(description);
|
|
176
181
|
|
|
177
|
-
return this.iceGatheringState(peerConnection)
|
|
182
|
+
return this.iceGatheringState(peerConnection, cluster.isVideoMesh ? VIDEO_MESH_TIMEOUT : DEFAULT_TIMEOUT)
|
|
178
183
|
.catch((iceGatheringStateError) => {
|
|
179
184
|
LoggerProxy.logger.log(`Reachability:index#getLocalSDPForClusters --> Error in getLocalSDP : ${iceGatheringStateError}`);
|
|
180
185
|
});
|
|
@@ -256,18 +261,17 @@ export default class Reachability {
|
|
|
256
261
|
};
|
|
257
262
|
}
|
|
258
263
|
|
|
259
|
-
|
|
260
264
|
/**
|
|
261
265
|
* An event handler on an RTCPeerConnection when the state of the ICE
|
|
262
266
|
* candidate gathering process changes. Used to measure connection
|
|
263
267
|
* speed.
|
|
264
268
|
* @private
|
|
265
269
|
* @param {RTCPeerConnection} peerConnection
|
|
270
|
+
* @param {number} timeout
|
|
266
271
|
* @returns {Promise}
|
|
267
272
|
*/
|
|
268
|
-
iceGatheringState(peerConnection) {
|
|
273
|
+
iceGatheringState(peerConnection, timeout) {
|
|
269
274
|
const ELAPSED = 'elapsed';
|
|
270
|
-
const waitTime = 5e3;
|
|
271
275
|
|
|
272
276
|
return new Promise((resolve) => {
|
|
273
277
|
const peerConnectionProxy = new window.Proxy(peerConnection, {
|
|
@@ -300,13 +304,13 @@ export default class Reachability {
|
|
|
300
304
|
|
|
301
305
|
// Set maximum timeout
|
|
302
306
|
window.setTimeout(() => {
|
|
303
|
-
const CLOSED =
|
|
307
|
+
const {CLOSED} = CONNECTION_STATE;
|
|
304
308
|
|
|
305
309
|
// Close any open peerConnections
|
|
306
310
|
if (peerConnectionProxy.connectionState !== CLOSED) {
|
|
307
311
|
this.setLatencyAndClose(peerConnectionProxy, null);
|
|
308
312
|
}
|
|
309
|
-
},
|
|
313
|
+
}, timeout);
|
|
310
314
|
});
|
|
311
315
|
}
|
|
312
316
|
|
|
@@ -321,7 +325,7 @@ export default class Reachability {
|
|
|
321
325
|
const list = this.getUnreachablClusters();
|
|
322
326
|
|
|
323
327
|
list.forEach((cluster) => {
|
|
324
|
-
LoggerProxy.logger.log(`Reachability:index#
|
|
328
|
+
LoggerProxy.logger.log(`Reachability:index#logUnreachableClusters --> No ice candidate for ${cluster}.`);
|
|
325
329
|
});
|
|
326
330
|
}
|
|
327
331
|
|
|
@@ -5,14 +5,25 @@ import {
|
|
|
5
5
|
API
|
|
6
6
|
} from '../constants';
|
|
7
7
|
|
|
8
|
+
export interface ClusterNode {
|
|
9
|
+
isVideoMesh: boolean;
|
|
10
|
+
udp: Array<string>;
|
|
11
|
+
tcp: Array<string>;
|
|
12
|
+
xtls: Array<string>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type ClusterList = {
|
|
16
|
+
[key:string]: ClusterNode;
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
/**
|
|
9
|
-
* @class
|
|
20
|
+
* @class ReachabilityRequest
|
|
10
21
|
*/
|
|
11
|
-
class
|
|
22
|
+
class ReachabilityRequest {
|
|
12
23
|
/**
|
|
13
|
-
* Creates an instance of
|
|
24
|
+
* Creates an instance of ReachabilityRequest.
|
|
14
25
|
* @param {object} webex
|
|
15
|
-
* @memberof
|
|
26
|
+
* @memberof ReachabilityRequest
|
|
16
27
|
*/
|
|
17
28
|
constructor(webex) {
|
|
18
29
|
this.webex = webex;
|
|
@@ -20,9 +31,11 @@ class RechabilityRequest {
|
|
|
20
31
|
|
|
21
32
|
/**
|
|
22
33
|
* gets the cluster information
|
|
34
|
+
*
|
|
35
|
+
* @param {boolean} includeVideoMesh whether to include the video mesh clusters in the result or not
|
|
23
36
|
* @returns {Promise}
|
|
24
37
|
*/
|
|
25
|
-
getClusters = () => this.webex.request({
|
|
38
|
+
getClusters = (): Promise<ClusterList> => this.webex.request({
|
|
26
39
|
method: HTTP_VERBS.GET,
|
|
27
40
|
shouldRefreshAccessToken: false,
|
|
28
41
|
api: API.CALLIOPEDISCOVERY,
|
|
@@ -31,6 +44,10 @@ class RechabilityRequest {
|
|
|
31
44
|
.then((res) => {
|
|
32
45
|
const {clusters} = res.body;
|
|
33
46
|
|
|
47
|
+
Object.keys(clusters).forEach((key) => {
|
|
48
|
+
clusters[key].isVideoMesh = res.body.clusterClasses?.hybridMedia?.includes(key);
|
|
49
|
+
});
|
|
50
|
+
|
|
34
51
|
LoggerProxy.logger.log(`Reachability:request#getClusters --> get clusters successful:${JSON.stringify(clusters)}`);
|
|
35
52
|
|
|
36
53
|
return clusters;
|
|
@@ -55,4 +72,4 @@ class RechabilityRequest {
|
|
|
55
72
|
});
|
|
56
73
|
}
|
|
57
74
|
|
|
58
|
-
export default
|
|
75
|
+
export default ReachabilityRequest;
|
|
@@ -41,7 +41,7 @@ import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config';
|
|
|
41
41
|
import TriggerProxy from '@webex/plugin-meetings/src/common/events/trigger-proxy';
|
|
42
42
|
import BrowserDetection from '@webex/plugin-meetings/src/common/browser-detection';
|
|
43
43
|
import Metrics from '@webex/plugin-meetings/src/metrics';
|
|
44
|
-
import {eventType} from '@webex/plugin-meetings/src/metrics/config';
|
|
44
|
+
import {trigger, eventType} from '@webex/plugin-meetings/src/metrics/config';
|
|
45
45
|
import BEHAVIORAL_METRICS from '@webex/plugin-meetings/src/metrics/constants';
|
|
46
46
|
|
|
47
47
|
import locus from '../fixture/locus';
|
|
@@ -783,6 +783,8 @@ describe('plugin-meetings', () => {
|
|
|
783
783
|
it('should join the meeting and return promise', async () => {
|
|
784
784
|
const join = meeting.join();
|
|
785
785
|
|
|
786
|
+
assert.calledWithMatch(Metrics.postEvent, {event: eventType.CALL_INITIATED, data: {trigger: trigger.USER_INTERACTION, isRoapCallEnabled: true}});
|
|
787
|
+
|
|
786
788
|
assert.exists(join.then);
|
|
787
789
|
await join;
|
|
788
790
|
assert.calledOnce(MeetingUtil.joinMeeting);
|