@webex/plugin-meetings 2.60.0-next.9 → 2.60.1-next.1

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.
Files changed (55) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/config.d.ts +1 -0
  4. package/dist/config.js +2 -1
  5. package/dist/config.js.map +1 -1
  6. package/dist/index.js +5 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/interceptors/index.d.ts +2 -0
  9. package/dist/interceptors/index.js +15 -0
  10. package/dist/interceptors/index.js.map +1 -0
  11. package/dist/interceptors/locusRetry.d.ts +27 -0
  12. package/dist/interceptors/locusRetry.js +94 -0
  13. package/dist/interceptors/locusRetry.js.map +1 -0
  14. package/dist/interpretation/index.js +1 -1
  15. package/dist/interpretation/siLanguage.js +1 -1
  16. package/dist/meeting/index.js +6 -2
  17. package/dist/meeting/index.js.map +1 -1
  18. package/dist/meetings/index.d.ts +1 -11
  19. package/dist/meetings/index.js +4 -3
  20. package/dist/meetings/index.js.map +1 -1
  21. package/dist/reachability/clusterReachability.d.ts +109 -0
  22. package/dist/reachability/clusterReachability.js +357 -0
  23. package/dist/reachability/clusterReachability.js.map +1 -0
  24. package/dist/reachability/index.d.ts +32 -121
  25. package/dist/reachability/index.js +173 -459
  26. package/dist/reachability/index.js.map +1 -1
  27. package/dist/reachability/util.d.ts +8 -0
  28. package/dist/reachability/util.js +29 -0
  29. package/dist/reachability/util.js.map +1 -0
  30. package/dist/statsAnalyzer/index.d.ts +22 -0
  31. package/dist/statsAnalyzer/index.js +60 -0
  32. package/dist/statsAnalyzer/index.js.map +1 -1
  33. package/dist/statsAnalyzer/mqaUtil.js +4 -0
  34. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  35. package/dist/webinar/index.js +1 -1
  36. package/package.json +25 -22
  37. package/src/config.ts +1 -0
  38. package/src/index.ts +4 -0
  39. package/src/interceptors/index.ts +3 -0
  40. package/src/interceptors/locusRetry.ts +67 -0
  41. package/src/meeting/index.ts +10 -2
  42. package/src/meetings/index.ts +4 -3
  43. package/src/reachability/clusterReachability.ts +320 -0
  44. package/src/reachability/index.ts +124 -421
  45. package/src/reachability/util.ts +24 -0
  46. package/src/statsAnalyzer/index.ts +64 -1
  47. package/src/statsAnalyzer/mqaUtil.ts +4 -0
  48. package/test/unit/spec/interceptors/locusRetry.ts +131 -0
  49. package/test/unit/spec/meeting/index.js +8 -1
  50. package/test/unit/spec/meetings/index.js +28 -25
  51. package/test/unit/spec/reachability/clusterReachability.ts +279 -0
  52. package/test/unit/spec/reachability/index.ts +159 -226
  53. package/test/unit/spec/reachability/util.ts +40 -0
  54. package/test/unit/spec/roap/request.ts +26 -3
  55. package/test/unit/spec/stats-analyzer/index.js +100 -20
@@ -1 +1 @@
1
- {"version":3,"names":["_lodash","require","_loggerProxy","_interopRequireDefault","_util","_constants","_request","DEFAULT_TIMEOUT","VIDEO_MESH_TIMEOUT","Reachability","exports","default","webex","_classCallCheck2","_defineProperty2","REACHABILITY","namespace","reachabilityRequest","ReachabilityRequest","clusterLatencyResults","_createClass2","key","value","_gatherReachability","_asyncToGenerator2","_regenerator","mark","_callee","_yield$this$reachabil","clusters","joinCookie","results","wrap","_callee$","_context","prev","next","setup","boundedStorage","del","localStorageResult","localStorageJoinCookie","getClusters","MeetingUtil","getIpVersion","sent","performReachabilityCheck","put","_stringify","LoggerProxy","logger","log","abrupt","t0","error","concat","stop","gatherReachability","apply","arguments","_getReachabilityMetrics","_callee2","stats","updateStats","resultsJson","internalResults","_callee2$","_context2","reachability_public_udp_success","reachability_public_udp_failed","reachability_public_tcp_success","reachability_public_tcp_failed","reachability_vmn_udp_success","reachability_vmn_udp_failed","reachability_vmn_tcp_success","reachability_vmn_tcp_failed","clusterType","result","_result$udp","_result$tcp","udp","reachable","outcome","tcp","get","JSON","parse","_values","forEach","isVideoMesh","warn","getReachabilityMetrics","_getReachabilityResults","_callee3","reachabilityResultsProps","_callee3$","_context3","mapValues","pick","getReachabilityResults","_isAnyPublicClusterReachable","_callee4","reachabilityData","reachabilityResults","_callee4$","_context4","catch","some","_result$udp2","_result$tcp2","e","isAnyPublicClusterReachable","buildPeerConnectionConfig","cluster","iceServers","uniq","map","url","username","credential","urls","_toConsumableArray2","iceCandidatePoolSize","iceTransportPolicy","createPeerConnection","config","peerConnection","window","RTCPeerConnection","peerConnectionError","getElapsedTime","startTime","begin","_now","getLocalSDPForClusters","clusterList","_this","_keys","_ref","_callee5","description","_callee5$","_context5","createOffer","offerToReceiveAudio","setLocalDescription","iceGatheringState","iceGatheringStateError","_x","_promise","all","then","parseIceResultsToInternalReachabilityResults","reachabilityLatencyResults","logUnreachableClusters","getUnreachablClusters","unreachableList","unreachable","push","handleIceGatheringStateChange","_this2","onicegatheringstatechange","COMPLETE","ICE_GATHERING_STATE","iceConnectionState","elapsed","setLatencyAndClose","handleOnIceCandidate","_this3","onicecandidate","SERVER_REFLEXIVE","candidate","String","type","toLowerCase","addPublicIP","address","_this4","ELAPSED","timeout","resolve","peerConnectionProxy","Proxy","target","property","targetMember","bind","set","clusterId","publicIPs","Reflect","setTimeout","CLOSED","CONNECTION_STATE","connectionState","list","iceResults","reachabilityMap","_ref2","latencyResult","_assign","latencyInMilliseconds","toString","clientMediaIPs","untested","xtls","_this5","length","localSDPData","publicIP","modifiedPeerConnection","REACHABLE","UNREACHABLE","resultKey","intialState","close"],"sources":["index.ts"],"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 {uniq, mapValues, pick} from 'lodash';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport MeetingUtil from '../meeting/util';\n\nimport {ICE_GATHERING_STATE, CONNECTION_STATE, REACHABILITY} from '../constants';\n\nimport ReachabilityRequest from './request';\n\nconst DEFAULT_TIMEOUT = 3000;\nconst VIDEO_MESH_TIMEOUT = 1000;\n\nexport type ReachabilityMetrics = {\n reachability_public_udp_success: number;\n reachability_public_udp_failed: number;\n reachability_public_tcp_success: number;\n reachability_public_tcp_failed: number;\n reachability_vmn_udp_success: number;\n reachability_vmn_udp_failed: number;\n reachability_vmn_tcp_success: number;\n reachability_vmn_tcp_failed: number;\n};\n\n// result for a specific transport protocol (like udp or tcp)\nexport type TransportResult = {\n reachable?: 'true' | 'false';\n latencyInMilliseconds?: string;\n clientMediaIPs?: string[];\n untested?: 'true';\n};\n\n// reachability result for a specifc media cluster\ntype ReachabilityResult = {\n udp: TransportResult;\n tcp: TransportResult;\n xtls: {\n untested: 'true';\n };\n};\n// this is the type that is required by the backend when we send them reachability results\nexport type ReachabilityResults = Record<string, ReachabilityResult>;\n\n// this is the type used by Reachability class internally and stored in local storage\ntype InternalReachabilityResults = Record<\n string,\n ReachabilityResult & {\n isVideoMesh?: boolean;\n }\n>;\n\nexport type ICECandidateResult = {\n clusterId: string;\n isVideoMesh: boolean;\n elapsed?: string | null;\n publicIPs?: string[];\n};\n/**\n * @class Reachability\n * @export\n */\nexport default class Reachability {\n namespace = REACHABILITY.namespace;\n webex: object;\n reachabilityRequest: any;\n clusterLatencyResults: any;\n\n /**\n * Creates an instance of Reachability.\n * @param {object} webex\n * @memberof Reachability\n */\n constructor(webex: object) {\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 * fetches reachability data\n * @returns {Object} reachability data\n * @public\n * @async\n * @memberof Reachability\n */\n public async gatherReachability(): Promise<InternalReachabilityResults> {\n this.setup();\n\n // Remove stored reachability results to ensure no stale data\n // @ts-ignore\n await this.webex.boundedStorage.del(this.namespace, REACHABILITY.localStorageResult);\n // @ts-ignore\n await this.webex.boundedStorage.del(this.namespace, REACHABILITY.localStorageJoinCookie);\n\n // Fetch clusters and measure latency\n try {\n const {clusters, joinCookie} = await this.reachabilityRequest.getClusters(\n MeetingUtil.getIpVersion(this.webex)\n );\n\n // Perform Reachability Check\n const results = await this.performReachabilityCheck(clusters);\n\n // @ts-ignore\n await this.webex.boundedStorage.put(\n this.namespace,\n REACHABILITY.localStorageResult,\n JSON.stringify(results)\n );\n // @ts-ignore\n await this.webex.boundedStorage.put(\n this.namespace,\n REACHABILITY.localStorageJoinCookie,\n JSON.stringify(joinCookie)\n );\n\n LoggerProxy.logger.log(\n 'Reachability:index#gatherReachability --> Reachability checks completed'\n );\n\n return results;\n } catch (getClusterError) {\n LoggerProxy.logger.error(\n `Reachability:index#gatherReachability --> Error in calling getClusters(): ${getClusterError}`\n );\n\n return {};\n }\n }\n\n /**\n * Returns statistics about last reachability results. The returned value is an object\n * with a flat list of properties so that it can be easily sent with metrics\n *\n * @returns {Promise} Promise with metrics values, it never rejects/throws.\n */\n async getReachabilityMetrics(): Promise<ReachabilityMetrics> {\n const stats: ReachabilityMetrics = {\n reachability_public_udp_success: 0,\n reachability_public_udp_failed: 0,\n reachability_public_tcp_success: 0,\n reachability_public_tcp_failed: 0,\n reachability_vmn_udp_success: 0,\n reachability_vmn_udp_failed: 0,\n reachability_vmn_tcp_success: 0,\n reachability_vmn_tcp_failed: 0,\n };\n\n const updateStats = (clusterType: 'public' | 'vmn', result: ReachabilityResult) => {\n if (result.udp?.reachable) {\n const outcome = result.udp.reachable === 'true' ? 'success' : 'failed';\n stats[`reachability_${clusterType}_udp_${outcome}`] += 1;\n }\n if (result.tcp?.reachable) {\n const outcome = result.tcp.reachable === 'true' ? 'success' : 'failed';\n stats[`reachability_${clusterType}_tcp_${outcome}`] += 1;\n }\n };\n\n try {\n // @ts-ignore\n const resultsJson = await this.webex.boundedStorage.get(\n REACHABILITY.namespace,\n REACHABILITY.localStorageResult\n );\n\n const internalResults: InternalReachabilityResults = JSON.parse(resultsJson);\n\n Object.values(internalResults).forEach((result) => {\n updateStats(result.isVideoMesh ? 'vmn' : 'public', result);\n });\n } catch (e) {\n // empty storage, that's ok\n LoggerProxy.logger.warn(\n 'Roap:request#getReachabilityMetrics --> Error parsing reachability data: ',\n e\n );\n }\n\n return stats;\n }\n\n /**\n * Reachability results as an object in the format that backend expects\n *\n * @returns {any} reachability results that need to be sent to the backend\n */\n async getReachabilityResults(): Promise<ReachabilityResults | undefined> {\n let results: ReachabilityResults;\n\n // these are the only props that backend needs in the reachability results:\n const reachabilityResultsProps: Array<keyof ReachabilityResult> = ['udp', 'tcp', 'xtls'];\n\n try {\n // @ts-ignore\n const resultsJson = await this.webex.boundedStorage.get(\n REACHABILITY.namespace,\n REACHABILITY.localStorageResult\n );\n\n const internalResults: InternalReachabilityResults = JSON.parse(resultsJson);\n\n results = mapValues(internalResults, (result) => pick(result, reachabilityResultsProps));\n } catch (e) {\n // empty storage, that's ok\n LoggerProxy.logger.warn(\n 'Roap:request#attachReachabilityData --> Error parsing reachability data: ',\n e\n );\n }\n\n return results;\n }\n\n /**\n * fetches reachability data and checks for cluster reachability\n * @returns {boolean}\n * @public\n * @memberof Reachability\n */\n async isAnyPublicClusterReachable() {\n let reachable = false;\n // @ts-ignore\n const reachabilityData = await this.webex.boundedStorage\n .get(this.namespace, REACHABILITY.localStorageResult)\n .catch(() => {});\n\n if (reachabilityData) {\n try {\n const reachabilityResults: InternalReachabilityResults = JSON.parse(reachabilityData);\n\n reachable = Object.values(reachabilityResults).some(\n (result) =>\n !result.isVideoMesh &&\n (result.udp?.reachable === 'true' || result.tcp?.reachable === 'true')\n );\n } catch (e) {\n LoggerProxy.logger.error(\n `Roap:request#attachReachabilityData --> Error in parsing reachability data: ${e}`\n );\n }\n }\n\n return reachable;\n }\n\n /**\n * Generate peerConnection config settings\n * @param {object} cluster\n * @returns {object} peerConnectionConfig\n * @private\n * @memberof Reachability\n */\n private buildPeerConnectionConfig(cluster: any) {\n const iceServers = uniq(cluster.udp).map((url) => ({\n username: '',\n credential: '',\n urls: [url],\n }));\n\n return {\n iceServers: [...iceServers],\n iceCandidatePoolSize: '0',\n iceTransportPolicy: 'all',\n };\n }\n\n /**\n * Creates an RTCPeerConnection\n * @param {object} cluster\n * @returns {RTCPeerConnection} peerConnection\n * @private\n * @memberof Reachability\n */\n private createPeerConnection(cluster: any) {\n const {key, config} = cluster;\n\n try {\n const peerConnection = new window.RTCPeerConnection(config);\n\n // @ts-ignore\n peerConnection.key = key;\n\n return peerConnection;\n } catch (peerConnectionError) {\n LoggerProxy.logger.log(\n `Reachability:index#createPeerConnection --> Error creating peerConnection: ${peerConnectionError}`\n );\n\n return null;\n }\n }\n\n /**\n * Gets total elapsed time\n * @param {RTCPeerConnection} peerConnection\n * @returns {Number} Milliseconds\n * @private\n * @memberof Reachability\n */\n private getElapsedTime(peerConnection: any) {\n const startTime = peerConnection.begin;\n\n delete peerConnection.begin;\n\n return Date.now() - startTime;\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 private getLocalSDPForClusters(clusterList: object): Promise<InternalReachabilityResults> {\n let clusters: any[] = [...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 // @ts-ignore\n peerConnection.begin = Date.now();\n peerConnection.setLocalDescription(description);\n\n return this.iceGatheringState(peerConnection, cluster.isVideoMesh).catch(\n (iceGatheringStateError) => {\n LoggerProxy.logger.log(\n `Reachability:index#getLocalSDPForClusters --> Error in getLocalSDP : ${iceGatheringStateError}`\n );\n }\n );\n });\n\n return Promise.all(clusters)\n .then(this.parseIceResultsToInternalReachabilityResults)\n .then((reachabilityLatencyResults) => {\n this.logUnreachableClusters();\n\n // return results\n return reachabilityLatencyResults;\n });\n }\n\n /**\n * Get list of all unreachable clusters\n * @returns {array} Unreachable clusters\n * @private\n * @memberof Reachability\n */\n private 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 * 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 private handleIceGatheringStateChange(peerConnection: RTCPeerConnection) {\n peerConnection.onicegatheringstatechange = () => {\n const {COMPLETE} = ICE_GATHERING_STATE;\n\n if (peerConnection.iceConnectionState === COMPLETE) {\n const elapsed = this.getElapsedTime(peerConnection);\n\n // @ts-ignore\n LoggerProxy.logger.log(\n // @ts-ignore\n `Reachability:index#onIceGatheringStateChange --> Successfully pinged ${peerConnection.key}:`,\n elapsed\n );\n this.setLatencyAndClose(peerConnection, elapsed);\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 private handleOnIceCandidate(peerConnection: RTCPeerConnection) {\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(\n // @ts-ignore\n `Reachability:index#onIceCandidate --> Successfully pinged ${peerConnection.key}:`,\n elapsed\n );\n // order is important\n this.addPublicIP(peerConnection, e.candidate.address);\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 {boolean} isVideoMesh\n * @returns {Promise}\n */\n private iceGatheringState(peerConnection: RTCPeerConnection, isVideoMesh: boolean) {\n const ELAPSED = 'elapsed';\n\n const timeout = isVideoMesh ? VIDEO_MESH_TIMEOUT : DEFAULT_TIMEOUT;\n\n return new Promise<ICECandidateResult>((resolve) => {\n const peerConnectionProxy = new window.Proxy(peerConnection, {\n // eslint-disable-next-line require-jsdoc\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({\n // @ts-ignore\n clusterId: peerConnection.key,\n isVideoMesh,\n // @ts-ignore\n publicIPs: target.publicIPs,\n elapsed: value,\n });\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 // order is important\n this.addPublicIP(peerConnectionProxy, null);\n this.setLatencyAndClose(peerConnectionProxy, null);\n }\n }, timeout);\n });\n }\n\n /**\n * Make a log of unreachable clusters.\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n private logUnreachableClusters() {\n const list = this.getUnreachablClusters();\n\n list.forEach((cluster) => {\n LoggerProxy.logger.log(\n `Reachability:index#logUnreachableClusters --> No ice candidate for ${cluster}.`\n );\n });\n }\n\n /**\n * Calculates time to establish connection\n * @param {Array<ICECandidateResult>} iceResults iceResults\n * @returns {object} reachabilityMap\n * @protected\n * @memberof Reachability\n */\n protected parseIceResultsToInternalReachabilityResults(\n iceResults: Array<ICECandidateResult>\n ): InternalReachabilityResults {\n const reachabilityMap = {};\n\n iceResults.forEach(({clusterId, isVideoMesh, elapsed, publicIPs}) => {\n const latencyResult = {};\n\n if (!elapsed) {\n Object.assign(latencyResult, {reachable: 'false'});\n } else {\n Object.assign(latencyResult, {\n reachable: 'true',\n latencyInMilliseconds: elapsed.toString(),\n });\n }\n\n if (publicIPs) {\n Object.assign(latencyResult, {\n clientMediaIPs: publicIPs,\n });\n }\n\n reachabilityMap[clusterId] = {\n udp: latencyResult,\n tcp: {untested: 'true'},\n xtls: {untested: 'true'},\n isVideoMesh,\n };\n });\n\n return reachabilityMap;\n }\n\n /**\n * fetches reachability data\n * @param {object} clusterList\n * @returns {Promise<InternalReachabilityResults>} reachability check results\n * @private\n * @memberof Reachability\n */\n private performReachabilityCheck(clusterList: object): Promise<InternalReachabilityResults> {\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(\n 'Reachability:index#performReachabilityCheck --> Local SDP is empty or has missing elements..returning'\n );\n resolve({});\n } else {\n resolve(localSDPData);\n }\n })\n .catch((error) => {\n LoggerProxy.logger.error(\n `Reachability:index#performReachabilityCheck --> Error in getLocalSDPForClusters: ${error}`\n );\n resolve({});\n });\n });\n }\n\n /**\n * Adds public IP (client media IPs)\n * @param {RTCPeerConnection} peerConnection\n * @param {string} publicIP\n * @returns {void}\n */\n protected addPublicIP(peerConnection: RTCPeerConnection, publicIP?: string | null) {\n const modifiedPeerConnection: RTCPeerConnection & {publicIPs?: string[]} = peerConnection;\n const {CLOSED} = CONNECTION_STATE;\n\n if (modifiedPeerConnection.connectionState === CLOSED) {\n LoggerProxy.logger.log(\n `Reachability:index#addPublicIP --> Attempting to set publicIP of ${publicIP} on closed peerConnection.`\n );\n }\n\n if (publicIP) {\n if (modifiedPeerConnection.publicIPs) {\n modifiedPeerConnection.publicIPs.push(publicIP);\n } else {\n modifiedPeerConnection.publicIPs = [publicIP];\n }\n } else {\n modifiedPeerConnection.publicIPs = null;\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 private setLatencyAndClose(peerConnection: RTCPeerConnection, elapsed: number) {\n const REACHABLE = 'reachable';\n const UNREACHABLE = 'unreachable';\n const {CLOSED} = CONNECTION_STATE;\n // @ts-ignore\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(\n `Reachability:index#setLatencyAndClose --> Attempting to set latency of ${elapsed} on closed peerConnection.`\n );\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 // @ts-ignore\n peerConnection.elapsed = elapsed;\n }\n\n /**\n * utility function\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n private setup() {\n this.clusterLatencyResults = {};\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,QAAA,GAAAH,sBAAA,CAAAF,OAAA;AAbA;AACA;AACA;;AAEA;AACA;;AAUA,IAAMM,eAAe,GAAG,IAAI;AAC5B,IAAMC,kBAAkB,GAAG,IAAI;;AAa/B;;AAQA;;AAQA;;AAGA;AAcA;AACA;AACA;AACA;AAHA,IAIqBC,YAAY,GAAAC,OAAA,CAAAC,OAAA;EAM/B;AACF;AACA;AACA;AACA;EACE,SAAAF,aAAYG,KAAa,EAAE;IAAA,IAAAC,gBAAA,CAAAF,OAAA,QAAAF,Y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GAAGhD,OAAO,KAAK,IAAI,GAAG+C,WAAW,GAAGD,SAAS;MAC5D,IAAMG,WAAW,OAAAxM,gBAAA,CAAAH,OAAA,MAAAG,gBAAA,CAAAH,OAAA,MAAKwM,SAAS,EAAG,CAAC,GAAGC,WAAW,EAAG,CAAC,CAAC;MAEtD,IAAItF,cAAc,CAACoE,eAAe,KAAKF,MAAM,EAAE;QAC7C/I,oBAAW,CAACC,MAAM,CAACC,GAAG,2EAAAI,MAAA,CACsD8G,OAAO,+BACnF,CAAC;QAED;MACF;MAEA,IAAI,CAAClJ,qBAAqB,CAACE,GAAG,CAAC,GAAG,IAAI,CAACF,qBAAqB,CAACE,GAAG,CAAC,IAAIiM,WAAW;MAChF,IAAI,CAACnM,qBAAqB,CAACE,GAAG,CAAC,CAACgM,SAAS,CAAC,IAAI,CAAC;;MAE/C;MACA;MACAvF,cAAc,CAAC2C,cAAc,GAAG,IAAI;MACpC3C,cAAc,CAACyF,KAAK,CAAC,CAAC;MACtB;MACAzF,cAAc,CAACuC,OAAO,GAAGA,OAAO;IAClC;;IAEA;AACF;AACA;AACA;AACA;AACA;EALE;IAAAhJ,GAAA;IAAAC,KAAA,EAMA,SAAAe,MAAA,EAAgB;MACd,IAAI,CAAClB,qBAAqB,GAAG,CAAC,CAAC;IACjC;EAAC;EAAA,OAAAV,YAAA;AAAA"}
1
+ {"version":3,"names":["_lodash","require","_loggerProxy","_interopRequireDefault","_util","_constants","_request","_clusterReachability","Reachability","exports","default","webex","_classCallCheck2","_defineProperty2","REACHABILITY","namespace","reachabilityRequest","ReachabilityRequest","clusterReachability","_createClass2","key","value","_gatherReachability","_asyncToGenerator2","_regenerator","mark","_callee","_yield$this$reachabil","clusters","joinCookie","results","wrap","_callee$","_context","prev","next","boundedStorage","del","localStorageResult","localStorageJoinCookie","getClusters","MeetingUtil","getIpVersion","sent","performReachabilityChecks","put","_stringify","LoggerProxy","logger","log","abrupt","t0","error","stop","gatherReachability","apply","arguments","_getReachabilityMetrics","_callee2","stats","updateStats","resultsJson","_callee2$","_context2","reachability_public_udp_success","reachability_public_udp_failed","reachability_public_tcp_success","reachability_public_tcp_failed","reachability_vmn_udp_success","reachability_vmn_udp_failed","reachability_vmn_tcp_success","reachability_vmn_tcp_failed","clusterType","result","udp","outcome","concat","tcp","get","JSON","parse","_values","forEach","isVideoMesh","warn","getReachabilityMetrics","mapTransportResultToBackendDataFormat","transportResult","output","_i","_Object$entries","_entries","length","_Object$entries$_i","_slicedToArray2","reachable","untested","latencyInMilliseconds","toString","_getReachabilityResults","_callee3","_this","allClusterResults","_callee3$","_context3","mapValues","clusterResult","xtls","getReachabilityResults","_isAnyPublicClusterReachable","_callee4","reachabilityData","reachabilityResults","_callee4$","_context4","catch","some","_result$udp","_result$tcp","e","isAnyPublicClusterReachable","getUnreachableClusters","unreachableList","_ref","_ref2","getResult","push","name","protocol","logUnreachableClusters","list","_ref3","_performReachabilityChecks","_callee5","clusterList","_this2","includeTcpReachability","clusterReachabilityChecks","_callee5$","_context5","_keys","_promise","resolve","config","meetings","experimental","enableTcpReachability","map","cluster","ClusterReachability","start","then","all","_x"],"sources":["index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable class-methods-use-this */\nimport {mapValues} from 'lodash';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport MeetingUtil from '../meeting/util';\n\nimport {REACHABILITY} from '../constants';\n\nimport ReachabilityRequest, {ClusterList} from './request';\nimport {\n ClusterReachability,\n ClusterReachabilityResult,\n TransportResult,\n} from './clusterReachability';\n\nexport type ReachabilityMetrics = {\n reachability_public_udp_success: number;\n reachability_public_udp_failed: number;\n reachability_public_tcp_success: number;\n reachability_public_tcp_failed: number;\n reachability_vmn_udp_success: number;\n reachability_vmn_udp_failed: number;\n reachability_vmn_tcp_success: number;\n reachability_vmn_tcp_failed: number;\n};\n\n/**\n * This is the type that matches what backend expects us to send to them. It is a bit weird, because\n * it uses strings instead of booleans and numbers, but that's what they require.\n */\nexport type TransportResultForBackend = {\n reachable?: 'true' | 'false';\n latencyInMilliseconds?: string;\n clientMediaIPs?: string[];\n untested?: 'true';\n};\n\nexport type ReachabilityResultForBackend = {\n udp: TransportResultForBackend;\n tcp: TransportResultForBackend;\n xtls: TransportResultForBackend;\n};\n\n// this is the type that is required by the backend when we send them reachability results\nexport type ReachabilityResultsForBackend = Record<string, ReachabilityResultForBackend>;\n\n// this is the type used by Reachability class internally and stored in local storage\nexport type ReachabilityResults = Record<\n string,\n ClusterReachabilityResult & {\n isVideoMesh?: boolean;\n }\n>;\n\n/**\n * @class Reachability\n * @export\n */\nexport default class Reachability {\n namespace = REACHABILITY.namespace;\n webex: object;\n reachabilityRequest: ReachabilityRequest;\n clusterReachability: {\n [key: string]: ClusterReachability;\n };\n\n /**\n * Creates an instance of Reachability.\n * @param {object} webex\n * @memberof Reachability\n */\n constructor(webex: object) {\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 this.clusterReachability = {};\n }\n\n /**\n * Gets a list of media clusters from the backend and performs reachability checks on all the clusters\n * @returns {Promise<ReachabilityResults>} reachability results\n * @public\n * @memberof Reachability\n */\n public async gatherReachability(): Promise<ReachabilityResults> {\n // Remove stored reachability results to ensure no stale data\n // @ts-ignore\n await this.webex.boundedStorage.del(this.namespace, REACHABILITY.localStorageResult);\n // @ts-ignore\n await this.webex.boundedStorage.del(this.namespace, REACHABILITY.localStorageJoinCookie);\n\n // Fetch clusters and measure latency\n try {\n const {clusters, joinCookie} = await this.reachabilityRequest.getClusters(\n MeetingUtil.getIpVersion(this.webex)\n );\n\n // Perform Reachability Check\n const results = await this.performReachabilityChecks(clusters);\n\n // @ts-ignore\n await this.webex.boundedStorage.put(\n this.namespace,\n REACHABILITY.localStorageResult,\n JSON.stringify(results)\n );\n // @ts-ignore\n await this.webex.boundedStorage.put(\n this.namespace,\n REACHABILITY.localStorageJoinCookie,\n JSON.stringify(joinCookie)\n );\n\n LoggerProxy.logger.log(\n 'Reachability:index#gatherReachability --> Reachability checks completed'\n );\n\n return results;\n } catch (error) {\n LoggerProxy.logger.error(`Reachability:index#gatherReachability --> Error:`, error);\n\n return {};\n }\n }\n\n /**\n * Returns statistics about last reachability results. The returned value is an object\n * with a flat list of properties so that it can be easily sent with metrics\n *\n * @returns {Promise} Promise with metrics values, it never rejects/throws.\n */\n async getReachabilityMetrics(): Promise<ReachabilityMetrics> {\n const stats: ReachabilityMetrics = {\n reachability_public_udp_success: 0,\n reachability_public_udp_failed: 0,\n reachability_public_tcp_success: 0,\n reachability_public_tcp_failed: 0,\n reachability_vmn_udp_success: 0,\n reachability_vmn_udp_failed: 0,\n reachability_vmn_tcp_success: 0,\n reachability_vmn_tcp_failed: 0,\n };\n\n const updateStats = (clusterType: 'public' | 'vmn', result: ClusterReachabilityResult) => {\n if (result.udp && result.udp.result !== 'untested') {\n const outcome = result.udp.result === 'reachable' ? 'success' : 'failed';\n stats[`reachability_${clusterType}_udp_${outcome}`] += 1;\n }\n if (result.tcp && result.tcp.result !== 'untested') {\n const outcome = result.tcp.result === 'reachable' ? 'success' : 'failed';\n stats[`reachability_${clusterType}_tcp_${outcome}`] += 1;\n }\n };\n\n try {\n // @ts-ignore\n const resultsJson = await this.webex.boundedStorage.get(\n REACHABILITY.namespace,\n REACHABILITY.localStorageResult\n );\n\n const results: ReachabilityResults = JSON.parse(resultsJson);\n\n Object.values(results).forEach((result) => {\n updateStats(result.isVideoMesh ? 'vmn' : 'public', result);\n });\n } catch (e) {\n // empty storage, that's ok\n LoggerProxy.logger.warn(\n 'Roap:request#getReachabilityMetrics --> Error parsing reachability data: ',\n e\n );\n }\n\n return stats;\n }\n\n /**\n * Maps our internal transport result to the format that backend expects\n * @param {TransportResult} transportResult\n * @returns {TransportResultForBackend}\n */\n private mapTransportResultToBackendDataFormat(\n transportResult: TransportResult\n ): TransportResultForBackend {\n const output: TransportResultForBackend = {};\n\n for (const [key, value] of Object.entries(transportResult)) {\n switch (key) {\n case 'result':\n switch (value) {\n case 'reachable':\n output.reachable = 'true';\n break;\n case 'unreachable':\n output.reachable = 'false';\n break;\n case 'untested':\n output.untested = 'true';\n break;\n }\n break;\n case 'latencyInMilliseconds':\n output.latencyInMilliseconds = value.toString();\n break;\n default:\n output[key] = value;\n }\n }\n\n return output;\n }\n\n /**\n * Reachability results as an object in the format that backend expects\n *\n * @returns {any} reachability results that need to be sent to the backend\n */\n async getReachabilityResults(): Promise<ReachabilityResultsForBackend | undefined> {\n let results: ReachabilityResultsForBackend;\n\n try {\n // @ts-ignore\n const resultsJson = await this.webex.boundedStorage.get(\n REACHABILITY.namespace,\n REACHABILITY.localStorageResult\n );\n\n const allClusterResults: ReachabilityResults = JSON.parse(resultsJson);\n\n results = mapValues(allClusterResults, (clusterResult) => ({\n udp: this.mapTransportResultToBackendDataFormat(clusterResult.udp || {result: 'untested'}),\n tcp: this.mapTransportResultToBackendDataFormat(clusterResult.tcp || {result: 'untested'}),\n xtls: this.mapTransportResultToBackendDataFormat(\n clusterResult.xtls || {result: 'untested'}\n ),\n }));\n } catch (e) {\n // empty storage, that's ok\n LoggerProxy.logger.warn(\n 'Roap:request#attachReachabilityData --> Error parsing reachability data: ',\n e\n );\n }\n\n return results;\n }\n\n /**\n * fetches reachability data and checks for cluster reachability\n * @returns {boolean}\n * @public\n * @memberof Reachability\n */\n async isAnyPublicClusterReachable() {\n let reachable = false;\n // @ts-ignore\n const reachabilityData = await this.webex.boundedStorage\n .get(this.namespace, REACHABILITY.localStorageResult)\n .catch(() => {});\n\n if (reachabilityData) {\n try {\n const reachabilityResults: ReachabilityResults = JSON.parse(reachabilityData);\n\n reachable = Object.values(reachabilityResults).some(\n (result) =>\n !result.isVideoMesh &&\n (result.udp?.result === 'reachable' || result.tcp?.result === 'reachable')\n );\n } catch (e) {\n LoggerProxy.logger.error(\n `Roap:request#attachReachabilityData --> Error in parsing reachability data: ${e}`\n );\n }\n }\n\n return reachable;\n }\n\n /**\n * Get list of all unreachable clusters\n * @returns {array} Unreachable clusters\n * @private\n * @memberof Reachability\n */\n private getUnreachableClusters(): Array<{name: string; protocol: string}> {\n const unreachableList = [];\n\n Object.entries(this.clusterReachability).forEach(([key, clusterReachability]) => {\n const result = clusterReachability.getResult();\n\n if (result.udp.result === 'unreachable') {\n unreachableList.push({name: key, protocol: 'udp'});\n }\n if (result.tcp.result === 'unreachable') {\n unreachableList.push({name: key, protocol: 'tcp'});\n }\n });\n\n return unreachableList;\n }\n\n /**\n * Make a log of unreachable clusters.\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n private logUnreachableClusters() {\n const list = this.getUnreachableClusters();\n\n list.forEach(({name, protocol}) => {\n LoggerProxy.logger.log(\n `Reachability:index#logUnreachableClusters --> failed to reach ${name} over ${protocol}`\n );\n });\n }\n\n /**\n * Performs reachability checks for all clusters\n * @param {ClusterList} clusterList\n * @returns {Promise<ReachabilityResults>} reachability check results\n */\n private async performReachabilityChecks(clusterList: ClusterList): Promise<ReachabilityResults> {\n const results: ReachabilityResults = {};\n\n if (!clusterList || !Object.keys(clusterList).length) {\n return Promise.resolve(results);\n }\n\n // @ts-ignore\n const includeTcpReachability = this.webex.config.meetings.experimental.enableTcpReachability;\n\n LoggerProxy.logger.log(\n `Reachability:index#performReachabilityChecks --> doing UDP${\n includeTcpReachability ? ' and TCP' : ''\n } reachability checks`\n );\n\n const clusterReachabilityChecks = Object.keys(clusterList).map((key) => {\n const cluster = clusterList[key];\n\n if (!includeTcpReachability) {\n cluster.tcp = [];\n }\n\n this.clusterReachability[key] = new ClusterReachability(key, cluster);\n\n return this.clusterReachability[key].start().then((result) => {\n results[key] = result;\n results[key].isVideoMesh = cluster.isVideoMesh;\n });\n });\n\n await Promise.all(clusterReachabilityChecks);\n\n this.logUnreachableClusters();\n\n return results;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAKA,IAAAA,OAAA,GAA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B4D,sBAAsB,GAAG,UAAU,GAAG,EAAE,yBAE5C,CAAC;cAEKC,yBAAyB,GAAG,IAAAG,KAAA,CAAAlI,OAAA,EAAY4H,WAAW,CAAC,CAACa,GAAG,CAAC,UAAC/H,GAAG,EAAK;gBACtE,IAAMgI,OAAO,GAAGd,WAAW,CAAClH,GAAG,CAAC;gBAEhC,IAAI,CAACoH,sBAAsB,EAAE;kBAC3BY,OAAO,CAACvE,GAAG,GAAG,EAAE;gBAClB;gBAEA0D,MAAI,CAACrH,mBAAmB,CAACE,GAAG,CAAC,GAAG,IAAIiI,wCAAmB,CAACjI,GAAG,EAAEgI,OAAO,CAAC;gBAErE,OAAOb,MAAI,CAACrH,mBAAmB,CAACE,GAAG,CAAC,CAACkI,KAAK,CAAC,CAAC,CAACC,IAAI,CAAC,UAAC9E,MAAM,EAAK;kBAC5D3C,OAAO,CAACV,GAAG,CAAC,GAAGqD,MAAM;kBACrB3C,OAAO,CAACV,GAAG,CAAC,CAAC+D,WAAW,GAAGiE,OAAO,CAACjE,WAAW;gBAChD,CAAC,CAAC;cACJ,CAAC,CAAC;cAAAwD,SAAA,CAAAxG,IAAA;cAAA,OAEI0G,QAAA,CAAAnI,OAAA,CAAQ8I,GAAG,CAACf,yBAAyB,CAAC;YAAA;cAE5C,IAAI,CAACR,sBAAsB,CAAC,CAAC;cAAC,OAAAU,SAAA,CAAAzF,MAAA,WAEvBpB,OAAO;YAAA;YAAA;cAAA,OAAA6G,SAAA,CAAAtF,IAAA;UAAA;QAAA,GAAAgF,QAAA;MAAA,CACf;MAAA,SAAAzF,0BAAA6G,EAAA;QAAA,OAAArB,0BAAA,CAAA7E,KAAA,OAAAC,SAAA;MAAA;MAAA,OAAAZ,yBAAA;IAAA;EAAA;EAAA,OAAApC,YAAA;AAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Converts a stun url to a turn url
3
+ *
4
+ * @param {string} stunUrl url of a stun server
5
+ * @param {'tcp'|'udp'} protocol what protocol to use for the turn server
6
+ * @returns {string} url of a turn server
7
+ */
8
+ export declare function convertStunUrlToTurn(stunUrl: string, protocol: 'udp' | 'tcp'): string;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.convertStunUrlToTurn = convertStunUrlToTurn;
8
+ /* eslint-disable import/prefer-default-export */
9
+ /**
10
+ * Converts a stun url to a turn url
11
+ *
12
+ * @param {string} stunUrl url of a stun server
13
+ * @param {'tcp'|'udp'} protocol what protocol to use for the turn server
14
+ * @returns {string} url of a turn server
15
+ */
16
+ function convertStunUrlToTurn(stunUrl, protocol) {
17
+ // stunUrl looks like this: "stun:external-media91.public.wjfkm-a-10.prod.infra.webex.com:5004"
18
+ // and we need it to be like this: "turn:external-media91.public.wjfkm-a-10.prod.infra.webex.com:5004?transport=tcp"
19
+ var url = new URL(stunUrl);
20
+ if (url.protocol !== 'stun:') {
21
+ throw new Error("Not a STUN URL: ".concat(stunUrl));
22
+ }
23
+ url.protocol = 'turn:';
24
+ if (protocol === 'tcp') {
25
+ url.searchParams.append('transport', 'tcp');
26
+ }
27
+ return url.toString();
28
+ }
29
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["convertStunUrlToTurn","stunUrl","protocol","url","URL","Error","concat","searchParams","append","toString"],"sources":["util.ts"],"sourcesContent":["/* eslint-disable import/prefer-default-export */\n/**\n * Converts a stun url to a turn url\n *\n * @param {string} stunUrl url of a stun server\n * @param {'tcp'|'udp'} protocol what protocol to use for the turn server\n * @returns {string} url of a turn server\n */\nexport function convertStunUrlToTurn(stunUrl: string, protocol: 'udp' | 'tcp') {\n // stunUrl looks like this: \"stun:external-media91.public.wjfkm-a-10.prod.infra.webex.com:5004\"\n // and we need it to be like this: \"turn:external-media91.public.wjfkm-a-10.prod.infra.webex.com:5004?transport=tcp\"\n const url = new URL(stunUrl);\n\n if (url.protocol !== 'stun:') {\n throw new Error(`Not a STUN URL: ${stunUrl}`);\n }\n\n url.protocol = 'turn:';\n if (protocol === 'tcp') {\n url.searchParams.append('transport', 'tcp');\n }\n\n return url.toString();\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,oBAAoBA,CAACC,OAAe,EAAEC,QAAuB,EAAE;EAC7E;EACA;EACA,IAAMC,GAAG,GAAG,IAAIC,GAAG,CAACH,OAAO,CAAC;EAE5B,IAAIE,GAAG,CAACD,QAAQ,KAAK,OAAO,EAAE;IAC5B,MAAM,IAAIG,KAAK,oBAAAC,MAAA,CAAoBL,OAAO,CAAE,CAAC;EAC/C;EAEAE,GAAG,CAACD,QAAQ,GAAG,OAAO;EACtB,IAAIA,QAAQ,KAAK,KAAK,EAAE;IACtBC,GAAG,CAACI,YAAY,CAACC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC;EAC7C;EAEA,OAAOL,GAAG,CAACM,QAAQ,CAAC,CAAC;AACvB"}
@@ -31,6 +31,7 @@ export declare class StatsAnalyzer extends EventsScope {
31
31
  statsResults: any;
32
32
  statsStarted: any;
33
33
  successfulCandidatePair: any;
34
+ localIpAddress: string;
34
35
  receiveSlotCallback: ReceiveSlotCallback;
35
36
  /**
36
37
  * Creates a new instance of StatsAnalyzer
@@ -76,6 +77,13 @@ export declare class StatsAnalyzer extends EventsScope {
76
77
  * @returns {void}
77
78
  */
78
79
  updateMediaConnection(mediaConnection: any): void;
80
+ /**
81
+ * Returns the local IP address for diagnostics.
82
+ * this is the local IP of the interface used for the current media connection
83
+ * a host can have many local Ip Addresses
84
+ * @returns {string | undefined} The local IP address.
85
+ */
86
+ getLocalIpAddress(): string;
79
87
  /**
80
88
  * Starts the stats analyzer on interval
81
89
  *
@@ -167,6 +175,20 @@ export declare class StatsAnalyzer extends EventsScope {
167
175
  * @returns {void}
168
176
  */
169
177
  private processInboundRTPResult;
178
+ /**
179
+ * extracts the local Ip address from the statsResult object by looking at stats results candidates
180
+ * and matches that ID with the successful candidate pair. It looks at the type of local candidate it is
181
+ * and then extracts the IP address from the relatedAddress or address property based on conditions known in webrtc
182
+ * note, there are known incompatibilities and it is possible for this to set undefined, or for the IP address to be the public IP address
183
+ * for example, firefox does not set the relayProtocol, and if the user is behind a NAT it might be the public IP
184
+ * @private
185
+ * @param {string} successfulCandidatePairId - The ID of the successful candidate pair.
186
+ * @param {Object} candidates - the stats result candidates
187
+ * @returns {void}
188
+ */
189
+ extractAndSetLocalIpAddressInfoForDiagnostics: (successfulCandidatePairId: string, candidates: {
190
+ [key: string]: Record<string, unknown>;
191
+ }) => void;
170
192
  /**
171
193
  * Processes remote and local candidate result and stores
172
194
  * @private
@@ -90,6 +90,8 @@ var StatsAnalyzer = exports.StatsAnalyzer = /*#__PURE__*/function (_EventsScope)
90
90
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "statsResults", void 0);
91
91
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "statsStarted", void 0);
92
92
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "successfulCandidatePair", void 0);
93
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "localIpAddress", void 0);
94
+ // Returns the local IP address for diagnostics. this is the local IP of the interface used for the current media connection a host can have many local Ip Addresses
93
95
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "receiveSlotCallback", void 0);
94
96
  /**
95
97
  * emits started/stopped events for local/remote media by checking
@@ -138,6 +140,44 @@ var StatsAnalyzer = exports.StatsAnalyzer = /*#__PURE__*/function (_EventsScope)
138
140
  });
139
141
  }
140
142
  });
143
+ /**
144
+ * extracts the local Ip address from the statsResult object by looking at stats results candidates
145
+ * and matches that ID with the successful candidate pair. It looks at the type of local candidate it is
146
+ * and then extracts the IP address from the relatedAddress or address property based on conditions known in webrtc
147
+ * note, there are known incompatibilities and it is possible for this to set undefined, or for the IP address to be the public IP address
148
+ * for example, firefox does not set the relayProtocol, and if the user is behind a NAT it might be the public IP
149
+ * @private
150
+ * @param {string} successfulCandidatePairId - The ID of the successful candidate pair.
151
+ * @param {Object} candidates - the stats result candidates
152
+ * @returns {void}
153
+ */
154
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "extractAndSetLocalIpAddressInfoForDiagnostics", function (successfulCandidatePairId, candidates) {
155
+ var newIpAddress = '';
156
+ if (successfulCandidatePairId && !(0, _lodash.isEmpty)(candidates)) {
157
+ var localCandidate = candidates[successfulCandidatePairId];
158
+ if (localCandidate) {
159
+ if (localCandidate.candidateType === 'host') {
160
+ // if it's a host candidate, use the address property - it will be the local IP
161
+ newIpAddress = "".concat(localCandidate.address);
162
+ } else if (localCandidate.candidateType === 'prflx') {
163
+ // if it's a peer reflexive candidate and we're not using a relay (there is no relayProtocol set)
164
+ // then look at the relatedAddress - it will be the local
165
+ //
166
+ // Firefox doesn't populate the relayProtocol property
167
+ if (!localCandidate.relayProtocol) {
168
+ newIpAddress = "".concat(localCandidate.relatedAddress);
169
+ } else {
170
+ // if it's a peer reflexive candidate and we are using a relay -
171
+ // in that case the relatedAddress will be the IP of the TURN server (Linus),
172
+ // so we can only look at the address, but it might be local IP or public IP,
173
+ // depending on if the user is behind a NAT or not
174
+ newIpAddress = "".concat(localCandidate.address);
175
+ }
176
+ }
177
+ }
178
+ }
179
+ _this.localIpAddress = newIpAddress;
180
+ });
141
181
  /**
142
182
  * Processes remote and local candidate result and stores
143
183
  * @private
@@ -173,6 +213,11 @@ var StatsAnalyzer = exports.StatsAnalyzer = /*#__PURE__*/function (_EventsScope)
173
213
  candidateType: result.candidateType,
174
214
  ipAddress: result.ip,
175
215
  // TODO: add ports
216
+ relatedAddress: result.relatedAddress,
217
+ relatedPort: result.relatedPort,
218
+ relayProtocol: result.relayProtocol,
219
+ protocol: result.protocol,
220
+ address: result.address,
176
221
  portNumber: result.port,
177
222
  networkType: result.networkType,
178
223
  priority: result.priority,
@@ -198,6 +243,7 @@ var StatsAnalyzer = exports.StatsAnalyzer = /*#__PURE__*/function (_EventsScope)
198
243
  _this.lastEmittedStartStopEvent = {};
199
244
  _this.receiveSlotCallback = receiveSlotCallback;
200
245
  _this.successfulCandidatePair = {};
246
+ _this.localIpAddress = '';
201
247
  return _this;
202
248
  }
203
249
 
@@ -348,6 +394,18 @@ var StatsAnalyzer = exports.StatsAnalyzer = /*#__PURE__*/function (_EventsScope)
348
394
  this.mediaConnection = mediaConnection;
349
395
  }
350
396
 
397
+ /**
398
+ * Returns the local IP address for diagnostics.
399
+ * this is the local IP of the interface used for the current media connection
400
+ * a host can have many local Ip Addresses
401
+ * @returns {string | undefined} The local IP address.
402
+ */
403
+ }, {
404
+ key: "getLocalIpAddress",
405
+ value: function getLocalIpAddress() {
406
+ return this.localIpAddress;
407
+ }
408
+
351
409
  /**
352
410
  * Starts the stats analyzer on interval
353
411
  *
@@ -485,9 +543,11 @@ var StatsAnalyzer = exports.StatsAnalyzer = /*#__PURE__*/function (_EventsScope)
485
543
  }
486
544
  });
487
545
  if (this.statsResults[type]) {
546
+ var _this$successfulCandi2, _this$statsResults;
488
547
  this.statsResults[type].direction = statsItem.currentDirection;
489
548
  this.statsResults[type].trackLabel = statsItem.localTrackLabel;
490
549
  this.statsResults[type].csi = statsItem.csi;
550
+ this.extractAndSetLocalIpAddressInfoForDiagnostics((_this$successfulCandi2 = this.successfulCandidatePair) === null || _this$successfulCandi2 === void 0 ? void 0 : _this$successfulCandi2.localCandidateId, (_this$statsResults = this.statsResults) === null || _this$statsResults === void 0 ? void 0 : _this$statsResults.candidates);
491
551
  // reset the successful candidate pair.
492
552
  this.successfulCandidatePair = {};
493
553
  }