@webex/plugin-meetings 3.0.0-next.23 → 3.0.0-next.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"names":["_common","require","_loggerProxy","_interopRequireDefault","_util","_constants","DEFAULT_TIMEOUT","VIDEO_MESH_TIMEOUT","ClusterReachability","exports","name","clusterInfo","_classCallCheck2","default","_defineProperty2","isVideoMesh","numUdpUrls","udp","length","numTcpUrls","tcp","pc","createPeerConnection","defer","Defer","result","xtls","_createClass2","key","value","getElapsedTime","Math","round","performance","now","startTimestamp","buildPeerConnectionConfig","cluster","udpIceServers","map","url","username","credential","urls","tcpIceServers","urlString","convertStunUrlToTurn","iceServers","concat","_toConsumableArray2","iceCandidatePoolSize","iceTransportPolicy","config","peerConnection","RTCPeerConnection","peerConnectionError","LoggerProxy","logger","warn","undefined","getResult","closePeerConnection","onicecandidate","onicegatheringstatechange","close","finishReachabilityCheck","resolve","addPublicIP","protocol","publicIP","clientMediaIPs","includes","push","registerIceGatheringStateChangeListener","_this","COMPLETE","ICE_GATHERING_STATE","iceConnectionState","haveWeGotAllResults","_this2","every","storeLatencyResult","latency","latencyInMilliseconds","log","registerIceCandidateListener","_this3","e","CANDIDATE_TYPES","SERVER_REFLEXIVE","RELAY","candidate","type","address","_start","_asyncToGenerator2","_regenerator","mark","_callee","offer","wrap","_callee$","_context","prev","next","abrupt","createOffer","offerToReceiveAudio","sent","setLocalDescription","gatherIceCandidates","t0","stop","start","apply","arguments","_this4","timeout","setTimeout","CLOSED","CONNECTION_STATE","connectionState","promise"],"sources":["clusterReachability.ts"],"sourcesContent":["import {Defer} from '@webex/common';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {ClusterNode} from './request';\nimport {convertStunUrlToTurn} from './util';\n\nimport {ICE_GATHERING_STATE, CONNECTION_STATE} from '../constants';\n\nconst DEFAULT_TIMEOUT = 3000;\nconst VIDEO_MESH_TIMEOUT = 1000;\n\n// result for a specific transport protocol (like udp or tcp)\nexport type TransportResult = {\n result: 'reachable' | 'unreachable' | 'untested';\n latencyInMilliseconds?: number; // amount of time it took to get the first ICE candidate\n clientMediaIPs?: string[];\n};\n\n// reachability result for a specific media cluster\nexport type ClusterReachabilityResult = {\n udp: TransportResult;\n tcp: TransportResult;\n xtls: TransportResult;\n};\n\n/**\n * A class that handles reachability checks for a single cluster.\n */\nexport class ClusterReachability {\n private numUdpUrls: number;\n private numTcpUrls: number;\n private result: ClusterReachabilityResult;\n private pc?: RTCPeerConnection;\n private defer: Defer; // this defer is resolved once reachability checks for this cluster are completed\n private startTimestamp: number;\n public readonly isVideoMesh: boolean;\n public readonly name;\n\n /**\n * Constructor for ClusterReachability\n * @param {string} name cluster name\n * @param {ClusterNode} clusterInfo information about the media cluster\n */\n constructor(name: string, clusterInfo: ClusterNode) {\n this.name = name;\n this.isVideoMesh = clusterInfo.isVideoMesh;\n this.numUdpUrls = clusterInfo.udp.length;\n this.numTcpUrls = clusterInfo.tcp.length;\n\n this.pc = this.createPeerConnection(clusterInfo);\n\n this.defer = new Defer();\n this.result = {\n udp: {\n result: 'untested',\n },\n tcp: {\n result: 'untested',\n },\n xtls: {\n result: 'untested',\n },\n };\n }\n\n /**\n * Gets total elapsed time, can be called only after start() is called\n * @returns {Number} Milliseconds\n */\n private getElapsedTime() {\n return Math.round(performance.now() - this.startTimestamp);\n }\n\n /**\n * Generate peerConnection config settings\n * @param {ClusterNode} cluster\n * @returns {RTCConfiguration} peerConnectionConfig\n */\n private buildPeerConnectionConfig(cluster: ClusterNode): RTCConfiguration {\n const udpIceServers = cluster.udp.map((url) => ({\n username: '',\n credential: '',\n urls: [url],\n }));\n\n // STUN servers are contacted only using UDP, so in order to test TCP reachability\n // we pretend that Linus is a TURN server, because we can explicitly say \"transport=tcp\" in TURN urls.\n // We then check for relay candidates to know if TURN-TCP worked (see registerIceCandidateListener()).\n const tcpIceServers = cluster.tcp.map((urlString: string) => {\n return {\n username: 'webexturnreachuser',\n credential: 'webexturnreachpwd',\n urls: [convertStunUrlToTurn(urlString, 'tcp')],\n };\n });\n\n return {\n iceServers: [...udpIceServers, ...tcpIceServers],\n iceCandidatePoolSize: 0,\n iceTransportPolicy: 'all',\n };\n }\n\n /**\n * Creates an RTCPeerConnection\n * @param {ClusterNode} clusterInfo information about the media cluster\n * @returns {RTCPeerConnection} peerConnection\n */\n private createPeerConnection(clusterInfo: ClusterNode) {\n try {\n const config = this.buildPeerConnectionConfig(clusterInfo);\n\n const peerConnection = new RTCPeerConnection(config);\n\n return peerConnection;\n } catch (peerConnectionError) {\n LoggerProxy.logger.warn(\n `Reachability:index#createPeerConnection --> Error creating peerConnection:`,\n peerConnectionError\n );\n\n return undefined;\n }\n }\n\n /**\n * @returns {ClusterReachabilityResult} reachability result for this cluster\n */\n getResult() {\n return this.result;\n }\n\n /**\n * Closes the peerConnection\n *\n * @returns {void}\n */\n private closePeerConnection() {\n if (this.pc) {\n this.pc.onicecandidate = null;\n this.pc.onicegatheringstatechange = null;\n this.pc.close();\n }\n }\n\n /**\n * Resolves the defer, indicating that reachability checks for this cluster are completed\n *\n * @returns {void}\n */\n private finishReachabilityCheck() {\n this.defer.resolve();\n }\n\n /**\n * Adds public IP (client media IPs)\n * @param {string} protocol\n * @param {string} publicIP\n * @returns {void}\n */\n private addPublicIP(protocol: 'udp' | 'tcp', publicIP?: string | null) {\n const result = this.result[protocol];\n\n if (publicIP) {\n if (result.clientMediaIPs) {\n if (!result.clientMediaIPs.includes(publicIP)) {\n result.clientMediaIPs.push(publicIP);\n }\n } else {\n result.clientMediaIPs = [publicIP];\n }\n }\n }\n\n /**\n * Registers a listener for the iceGatheringStateChange event\n *\n * @returns {void}\n */\n private registerIceGatheringStateChangeListener() {\n this.pc.onicegatheringstatechange = () => {\n const {COMPLETE} = ICE_GATHERING_STATE;\n\n if (this.pc.iceConnectionState === COMPLETE) {\n this.closePeerConnection();\n this.finishReachabilityCheck();\n }\n };\n }\n\n /**\n * Checks if we have the results for all the protocols (UDP and TCP)\n *\n * @returns {boolean} true if we have all results, false otherwise\n */\n private haveWeGotAllResults(): boolean {\n return ['udp', 'tcp'].every(\n (protocol) =>\n this.result[protocol].result === 'reachable' || this.result[protocol].result === 'untested'\n );\n }\n\n /**\n * Stores the latency in the result for the given protocol and marks it as reachable\n *\n * @param {string} protocol\n * @param {number} latency\n * @returns {void}\n */\n private storeLatencyResult(protocol: 'udp' | 'tcp', latency: number) {\n const result = this.result[protocol];\n\n if (result.latencyInMilliseconds === undefined) {\n LoggerProxy.logger.log(\n // @ts-ignore\n `Reachability:index#storeLatencyResult --> Successfully reached ${this.name} over ${protocol}: ${latency}ms`\n );\n result.latencyInMilliseconds = latency;\n result.result = 'reachable';\n }\n }\n\n /**\n * Registers a listener for the icecandidate event\n *\n * @returns {void}\n */\n private registerIceCandidateListener() {\n this.pc.onicecandidate = (e) => {\n const CANDIDATE_TYPES = {\n SERVER_REFLEXIVE: 'srflx',\n RELAY: 'relay',\n };\n\n if (e.candidate) {\n if (e.candidate.type === CANDIDATE_TYPES.SERVER_REFLEXIVE) {\n this.storeLatencyResult('udp', this.getElapsedTime());\n this.addPublicIP('udp', e.candidate.address);\n }\n\n if (e.candidate.type === CANDIDATE_TYPES.RELAY) {\n this.storeLatencyResult('tcp', this.getElapsedTime());\n // we don't add public IP for TCP, because in the case of relay candidates\n // e.candidate.address is the TURN server address, not the client's public IP\n }\n\n if (this.haveWeGotAllResults()) {\n this.closePeerConnection();\n this.finishReachabilityCheck();\n }\n }\n };\n }\n\n /**\n * Starts the process of doing UDP and TCP reachability checks on the media cluster.\n * XTLS reachability checking is not supported.\n *\n * @returns {Promise}\n */\n async start(): Promise<ClusterReachabilityResult> {\n if (!this.pc) {\n LoggerProxy.logger.warn(\n `Reachability:ClusterReachability#start --> Error: peerConnection is undefined`\n );\n\n return this.result;\n }\n\n // Initialize this.result as saying that nothing is reachable.\n // It will get updated as we go along and successfully gather ICE candidates.\n this.result.udp = {\n result: this.numUdpUrls > 0 ? 'unreachable' : 'untested',\n };\n this.result.tcp = {\n result: this.numTcpUrls > 0 ? 'unreachable' : 'untested',\n };\n\n try {\n const offer = await this.pc.createOffer({offerToReceiveAudio: true});\n\n this.startTimestamp = performance.now();\n\n // not awaiting the next call on purpose, because we're not sending the offer anywhere and there won't be any answer\n // we just need to make this call to trigger the ICE gathering process\n this.pc.setLocalDescription(offer);\n\n await this.gatherIceCandidates();\n } catch (error) {\n LoggerProxy.logger.warn(`Reachability:ClusterReachability#start --> Error: `, error);\n }\n\n return this.result;\n }\n\n /**\n * Starts the process of gathering ICE candidates\n *\n * @returns {Promise} promise that's resolved once reachability checks for this cluster are completed or timeout is reached\n */\n private gatherIceCandidates() {\n const timeout = this.isVideoMesh ? VIDEO_MESH_TIMEOUT : DEFAULT_TIMEOUT;\n\n this.registerIceGatheringStateChangeListener();\n this.registerIceCandidateListener();\n\n // Set maximum timeout\n setTimeout(() => {\n const {CLOSED} = CONNECTION_STATE;\n\n // Close any open peerConnections\n if (this.pc.connectionState !== CLOSED) {\n this.closePeerConnection();\n this.finishReachabilityCheck();\n }\n }, timeout);\n\n return this.defer.promise;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAMK,eAAe,GAAG,IAAI;AAC5B,IAAMC,kBAAkB,GAAG,IAAI;;AAE/B;;AAOA;AAOA;AACA;AACA;AAFA,IAGaC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA;EAU9B;AACF;AACA;AACA;AACA;EACE,SAAAA,oBAAYE,IAAY,EAAEC,WAAwB,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAL,mBAAA;IAAA,IAAAM,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAA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ACF,CAAC,EAAEoD,OAAO,CAAC;MAEX,OAAO,IAAI,CAAC9F,KAAK,CAACmG,OAAO;IAC3B;EAAC;EAAA,OAAAlH,mBAAA;AAAA"}
1
+ {"version":3,"names":["_common","require","_loggerProxy","_interopRequireDefault","_util","_constants","DEFAULT_TIMEOUT","VIDEO_MESH_TIMEOUT","ClusterReachability","exports","name","clusterInfo","_classCallCheck2","default","_defineProperty2","isVideoMesh","numUdpUrls","udp","length","numTcpUrls","tcp","numXTlsUrls","xtls","pc","createPeerConnection","defer","Defer","result","_createClass2","key","value","getElapsedTime","Math","round","performance","now","startTimestamp","buildPeerConnectionConfig","cluster","udpIceServers","map","url","username","credential","urls","tcpIceServers","urlString","convertStunUrlToTurn","turnTlsIceServers","convertStunUrlToTurnTls","iceServers","concat","_toConsumableArray2","iceCandidatePoolSize","iceTransportPolicy","config","peerConnection","RTCPeerConnection","peerConnectionError","LoggerProxy","logger","warn","undefined","getResult","closePeerConnection","onicecandidate","onicegatheringstatechange","close","finishReachabilityCheck","resolve","addPublicIP","protocol","publicIP","clientMediaIPs","includes","push","registerIceGatheringStateChangeListener","_this","COMPLETE","ICE_GATHERING_STATE","iceConnectionState","haveWeGotAllResults","_this2","every","storeLatencyResult","latency","latencyInMilliseconds","log","registerIceCandidateListener","_this3","e","TURN_TLS_PORT","CANDIDATE_TYPES","SERVER_REFLEXIVE","RELAY","candidate","type","address","port","_start","_asyncToGenerator2","_regenerator","mark","_callee","offer","wrap","_callee$","_context","prev","next","abrupt","createOffer","offerToReceiveAudio","sent","setLocalDescription","gatherIceCandidates","t0","stop","start","apply","arguments","_this4","timeout","setTimeout","CLOSED","CONNECTION_STATE","connectionState","promise"],"sources":["clusterReachability.ts"],"sourcesContent":["import {Defer} from '@webex/common';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {ClusterNode} from './request';\nimport {convertStunUrlToTurn, convertStunUrlToTurnTls} from './util';\n\nimport {ICE_GATHERING_STATE, CONNECTION_STATE} from '../constants';\n\nconst DEFAULT_TIMEOUT = 3000;\nconst VIDEO_MESH_TIMEOUT = 1000;\n\n// result for a specific transport protocol (like udp or tcp)\nexport type TransportResult = {\n result: 'reachable' | 'unreachable' | 'untested';\n latencyInMilliseconds?: number; // amount of time it took to get the first ICE candidate\n clientMediaIPs?: string[];\n};\n\n// reachability result for a specific media cluster\nexport type ClusterReachabilityResult = {\n udp: TransportResult;\n tcp: TransportResult;\n xtls: TransportResult;\n};\n\n/**\n * A class that handles reachability checks for a single cluster.\n */\nexport class ClusterReachability {\n private numUdpUrls: number;\n private numTcpUrls: number;\n private numXTlsUrls: number;\n private result: ClusterReachabilityResult;\n private pc?: RTCPeerConnection;\n private defer: Defer; // this defer is resolved once reachability checks for this cluster are completed\n private startTimestamp: number;\n public readonly isVideoMesh: boolean;\n public readonly name;\n\n /**\n * Constructor for ClusterReachability\n * @param {string} name cluster name\n * @param {ClusterNode} clusterInfo information about the media cluster\n */\n constructor(name: string, clusterInfo: ClusterNode) {\n this.name = name;\n this.isVideoMesh = clusterInfo.isVideoMesh;\n this.numUdpUrls = clusterInfo.udp.length;\n this.numTcpUrls = clusterInfo.tcp.length;\n this.numXTlsUrls = clusterInfo.xtls.length;\n\n this.pc = this.createPeerConnection(clusterInfo);\n\n this.defer = new Defer();\n this.result = {\n udp: {\n result: 'untested',\n },\n tcp: {\n result: 'untested',\n },\n xtls: {\n result: 'untested',\n },\n };\n }\n\n /**\n * Gets total elapsed time, can be called only after start() is called\n * @returns {Number} Milliseconds\n */\n private getElapsedTime() {\n return Math.round(performance.now() - this.startTimestamp);\n }\n\n /**\n * Generate peerConnection config settings\n * @param {ClusterNode} cluster\n * @returns {RTCConfiguration} peerConnectionConfig\n */\n private buildPeerConnectionConfig(cluster: ClusterNode): RTCConfiguration {\n const udpIceServers = cluster.udp.map((url) => ({\n username: '',\n credential: '',\n urls: [url],\n }));\n\n // STUN servers are contacted only using UDP, so in order to test TCP reachability\n // we pretend that Linus is a TURN server, because we can explicitly say \"transport=tcp\" in TURN urls.\n // We then check for relay candidates to know if TURN-TCP worked (see registerIceCandidateListener()).\n const tcpIceServers = cluster.tcp.map((urlString: string) => {\n return {\n username: 'webexturnreachuser',\n credential: 'webexturnreachpwd',\n urls: [convertStunUrlToTurn(urlString, 'tcp')],\n };\n });\n\n const turnTlsIceServers = cluster.xtls.map((urlString: string) => {\n return {\n username: 'webexturnreachuser',\n credential: 'webexturnreachpwd',\n urls: [convertStunUrlToTurnTls(urlString)],\n };\n });\n\n return {\n iceServers: [...udpIceServers, ...tcpIceServers, ...turnTlsIceServers],\n iceCandidatePoolSize: 0,\n iceTransportPolicy: 'all',\n };\n }\n\n /**\n * Creates an RTCPeerConnection\n * @param {ClusterNode} clusterInfo information about the media cluster\n * @returns {RTCPeerConnection} peerConnection\n */\n private createPeerConnection(clusterInfo: ClusterNode) {\n try {\n const config = this.buildPeerConnectionConfig(clusterInfo);\n\n const peerConnection = new RTCPeerConnection(config);\n\n return peerConnection;\n } catch (peerConnectionError) {\n LoggerProxy.logger.warn(\n `Reachability:index#createPeerConnection --> Error creating peerConnection:`,\n peerConnectionError\n );\n\n return undefined;\n }\n }\n\n /**\n * @returns {ClusterReachabilityResult} reachability result for this cluster\n */\n getResult() {\n return this.result;\n }\n\n /**\n * Closes the peerConnection\n *\n * @returns {void}\n */\n private closePeerConnection() {\n if (this.pc) {\n this.pc.onicecandidate = null;\n this.pc.onicegatheringstatechange = null;\n this.pc.close();\n }\n }\n\n /**\n * Resolves the defer, indicating that reachability checks for this cluster are completed\n *\n * @returns {void}\n */\n private finishReachabilityCheck() {\n this.defer.resolve();\n }\n\n /**\n * Adds public IP (client media IPs)\n * @param {string} protocol\n * @param {string} publicIP\n * @returns {void}\n */\n private addPublicIP(protocol: 'udp' | 'tcp', publicIP?: string | null) {\n const result = this.result[protocol];\n\n if (publicIP) {\n if (result.clientMediaIPs) {\n if (!result.clientMediaIPs.includes(publicIP)) {\n result.clientMediaIPs.push(publicIP);\n }\n } else {\n result.clientMediaIPs = [publicIP];\n }\n }\n }\n\n /**\n * Registers a listener for the iceGatheringStateChange event\n *\n * @returns {void}\n */\n private registerIceGatheringStateChangeListener() {\n this.pc.onicegatheringstatechange = () => {\n const {COMPLETE} = ICE_GATHERING_STATE;\n\n if (this.pc.iceConnectionState === COMPLETE) {\n this.closePeerConnection();\n this.finishReachabilityCheck();\n }\n };\n }\n\n /**\n * Checks if we have the results for all the protocols (UDP and TCP)\n *\n * @returns {boolean} true if we have all results, false otherwise\n */\n private haveWeGotAllResults(): boolean {\n return ['udp', 'tcp', 'xtls'].every(\n (protocol) =>\n this.result[protocol].result === 'reachable' || this.result[protocol].result === 'untested'\n );\n }\n\n /**\n * Stores the latency in the result for the given protocol and marks it as reachable\n *\n * @param {string} protocol\n * @param {number} latency\n * @returns {void}\n */\n private storeLatencyResult(protocol: 'udp' | 'tcp' | 'xtls', latency: number) {\n const result = this.result[protocol];\n\n if (result.latencyInMilliseconds === undefined) {\n LoggerProxy.logger.log(\n // @ts-ignore\n `Reachability:index#storeLatencyResult --> Successfully reached ${this.name} over ${protocol}: ${latency}ms`\n );\n result.latencyInMilliseconds = latency;\n result.result = 'reachable';\n }\n }\n\n /**\n * Registers a listener for the icecandidate event\n *\n * @returns {void}\n */\n private registerIceCandidateListener() {\n this.pc.onicecandidate = (e) => {\n const TURN_TLS_PORT = 443;\n const CANDIDATE_TYPES = {\n SERVER_REFLEXIVE: 'srflx',\n RELAY: 'relay',\n };\n\n if (e.candidate) {\n if (e.candidate.type === CANDIDATE_TYPES.SERVER_REFLEXIVE) {\n this.storeLatencyResult('udp', this.getElapsedTime());\n this.addPublicIP('udp', e.candidate.address);\n }\n\n if (e.candidate.type === CANDIDATE_TYPES.RELAY) {\n const protocol = e.candidate.port === TURN_TLS_PORT ? 'xtls' : 'tcp';\n this.storeLatencyResult(protocol, this.getElapsedTime());\n // we don't add public IP for TCP, because in the case of relay candidates\n // e.candidate.address is the TURN server address, not the client's public IP\n }\n\n if (this.haveWeGotAllResults()) {\n this.closePeerConnection();\n this.finishReachabilityCheck();\n }\n }\n };\n }\n\n /**\n * Starts the process of doing UDP and TCP reachability checks on the media cluster.\n * XTLS reachability checking is not supported.\n *\n * @returns {Promise}\n */\n async start(): Promise<ClusterReachabilityResult> {\n if (!this.pc) {\n LoggerProxy.logger.warn(\n `Reachability:ClusterReachability#start --> Error: peerConnection is undefined`\n );\n\n return this.result;\n }\n\n // Initialize this.result as saying that nothing is reachable.\n // It will get updated as we go along and successfully gather ICE candidates.\n this.result.udp = {\n result: this.numUdpUrls > 0 ? 'unreachable' : 'untested',\n };\n this.result.tcp = {\n result: this.numTcpUrls > 0 ? 'unreachable' : 'untested',\n };\n this.result.xtls = {\n result: this.numXTlsUrls > 0 ? 'unreachable' : 'untested',\n };\n\n try {\n const offer = await this.pc.createOffer({offerToReceiveAudio: true});\n\n this.startTimestamp = performance.now();\n\n // not awaiting the next call on purpose, because we're not sending the offer anywhere and there won't be any answer\n // we just need to make this call to trigger the ICE gathering process\n this.pc.setLocalDescription(offer);\n\n await this.gatherIceCandidates();\n } catch (error) {\n LoggerProxy.logger.warn(`Reachability:ClusterReachability#start --> Error: `, error);\n }\n\n return this.result;\n }\n\n /**\n * Starts the process of gathering ICE candidates\n *\n * @returns {Promise} promise that's resolved once reachability checks for this cluster are completed or timeout is reached\n */\n private gatherIceCandidates() {\n const timeout = this.isVideoMesh ? VIDEO_MESH_TIMEOUT : DEFAULT_TIMEOUT;\n\n this.registerIceGatheringStateChangeListener();\n this.registerIceCandidateListener();\n\n // Set maximum timeout\n setTimeout(() => {\n const {CLOSED} = CONNECTION_STATE;\n\n // Close any open peerConnections\n if (this.pc.connectionState !== CLOSED) {\n this.closePeerConnection();\n this.finishReachabilityCheck();\n }\n }, timeout);\n\n return this.defer.promise;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,KAAA,GAAA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9
9
  reachability_public_tcp_success: number;
10
10
  reachability_public_tcp_failed: number;
11
+ reachability_public_xtls_success: number;
12
+ reachability_public_xtls_failed: number;
11
13
  reachability_vmn_udp_success: number;
12
14
  reachability_vmn_udp_failed: number;
13
15
  reachability_vmn_tcp_success: number;
14
16
  reachability_vmn_tcp_failed: number;
17
+ reachability_vmn_xtls_success: number;
18
+ reachability_vmn_xtls_failed: number;
15
19
  };
16
20
  /**
17
21
  * This is the type that matches what backend expects us to send to them. It is a bit weird, because
@@ -131,10 +131,14 @@ var Reachability = exports.default = /*#__PURE__*/function () {
131
131
  reachability_public_udp_failed: 0,
132
132
  reachability_public_tcp_success: 0,
133
133
  reachability_public_tcp_failed: 0,
134
+ reachability_public_xtls_success: 0,
135
+ reachability_public_xtls_failed: 0,
134
136
  reachability_vmn_udp_success: 0,
135
137
  reachability_vmn_udp_failed: 0,
136
138
  reachability_vmn_tcp_success: 0,
137
- reachability_vmn_tcp_failed: 0
139
+ reachability_vmn_tcp_failed: 0,
140
+ reachability_vmn_xtls_success: 0,
141
+ reachability_vmn_xtls_failed: 0
138
142
  };
139
143
  updateStats = function updateStats(clusterType, result) {
140
144
  if (result.udp && result.udp.result !== 'untested') {
@@ -145,6 +149,10 @@ var Reachability = exports.default = /*#__PURE__*/function () {
145
149
  var _outcome = result.tcp.result === 'reachable' ? 'success' : 'failed';
146
150
  stats["reachability_".concat(clusterType, "_tcp_").concat(_outcome)] += 1;
147
151
  }
152
+ if (result.xtls && result.xtls.result !== 'untested') {
153
+ var _outcome2 = result.xtls.result === 'reachable' ? 'success' : 'failed';
154
+ stats["reachability_".concat(clusterType, "_xtls_").concat(_outcome2)] += 1;
155
+ }
148
156
  };
149
157
  _context2.prev = 2;
150
158
  _context2.next = 5;
@@ -381,7 +389,9 @@ var Reachability = exports.default = /*#__PURE__*/function () {
381
389
  case 3:
382
390
  _loggerProxy.default.logger.log("Reachability:index#performReachabilityChecks --> doing UDP".concat(
383
391
  // @ts-ignore
384
- this.webex.config.meetings.experimental.enableTcpReachability ? ' and TCP' : '', " reachability checks"));
392
+ this.webex.config.meetings.experimental.enableTcpReachability ? ',TCP' : '').concat(
393
+ // @ts-ignore
394
+ this.webex.config.meetings.experimental.enableTlsReachability ? ',TLS' : '', " reachability checks"));
385
395
  clusterReachabilityChecks = (0, _keys.default)(clusterList).map(function (key) {
386
396
  var cluster = clusterList[key];
387
397
 
@@ -392,6 +402,12 @@ var Reachability = exports.default = /*#__PURE__*/function () {
392
402
  if (!includeTcpReachability) {
393
403
  cluster.tcp = [];
394
404
  }
405
+ var includeTlsReachability =
406
+ // @ts-ignore
407
+ _this2.webex.config.meetings.experimental.enableTlsReachability && !cluster.isVideoMesh;
408
+ if (!includeTlsReachability) {
409
+ cluster.xtls = [];
410
+ }
395
411
  _this2.clusterReachability[key] = new _clusterReachability.ClusterReachability(key, cluster);
396
412
  return _this2.clusterReachability[key].start().then(function (result) {
397
413
  results[key] = result;
@@ -1 +1 @@
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","getClusters","MeetingUtil","getIpVersion","sent","performReachabilityChecks","boundedStorage","put","localStorageResult","_stringify","localStorageJoinCookie","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","clusterReachabilityChecks","_callee5$","_context5","_keys","_promise","resolve","config","meetings","experimental","enableTcpReachability","map","cluster","includeTcpReachability","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 // 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 LoggerProxy.logger.log(\n `Reachability:index#performReachabilityChecks --> doing UDP${\n // @ts-ignore\n this.webex.config.meetings.experimental.enableTcpReachability ? ' and TCP' : ''\n } reachability checks`\n );\n\n const clusterReachabilityChecks = Object.keys(clusterList).map((key) => {\n const cluster = clusterList[key];\n\n // Linus doesn't support TCP reachability checks on video mesh nodes\n const includeTcpReachability =\n // @ts-ignore\n this.webex.config.meetings.experimental.enableTcpReachability && !cluster.isVideoMesh;\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,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;AACA,IAAAM,oBAAA,GAAAN,OAAA;AAbA;AACA;AACA;AAEA;AA0BA;AACA;AACA;AACA;AAcA;AAGA;AAQA;AACA;AACA;AACA;AAHA,IAIqBO,YAAY,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AAC,UAAC9E,MAAM,EAAK;kBAC5D1C,OAAO,CAACV,GAAG,CAAC,GAAGoD,MAAM;kBACrB1C,OAAO,CAACV,GAAG,CAAC,CAAC8D,WAAW,GAAGgE,OAAO,CAAChE,WAAW;gBAChD,CAAC,CAAC;cACJ,CAAC,CAAC;cAAAuD,SAAA,CAAAtG,IAAA;cAAA,OAEIwG,QAAA,CAAAjI,OAAA,CAAQ6I,GAAG,CAAChB,yBAAyB,CAAC;YAAA;cAE5C,IAAI,CAACP,sBAAsB,CAAC,CAAC;cAAC,OAAAS,SAAA,CAAAxF,MAAA,WAEvBnB,OAAO;YAAA;YAAA;cAAA,OAAA2G,SAAA,CAAArF,IAAA;UAAA;QAAA,GAAAgF,QAAA;MAAA,CACf;MAAA,SAAA5F,0BAAAgH,EAAA;QAAA,OAAArB,0BAAA,CAAA7E,KAAA,OAAAC,SAAA;MAAA;MAAA,OAAAf,yBAAA;IAAA;EAAA;EAAA,OAAAhC,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","getClusters","MeetingUtil","getIpVersion","sent","performReachabilityChecks","boundedStorage","put","localStorageResult","_stringify","localStorageJoinCookie","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_public_xtls_success","reachability_public_xtls_failed","reachability_vmn_udp_success","reachability_vmn_udp_failed","reachability_vmn_tcp_success","reachability_vmn_tcp_failed","reachability_vmn_xtls_success","reachability_vmn_xtls_failed","clusterType","result","udp","outcome","concat","tcp","xtls","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","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","clusterReachabilityChecks","_callee5$","_context5","_keys","_promise","resolve","config","meetings","experimental","enableTcpReachability","enableTlsReachability","map","cluster","includeTcpReachability","includeTlsReachability","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_public_xtls_success: number;\n reachability_public_xtls_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 reachability_vmn_xtls_success: number;\n reachability_vmn_xtls_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 // 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_public_xtls_success: 0,\n reachability_public_xtls_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 reachability_vmn_xtls_success: 0,\n reachability_vmn_xtls_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 if (result.xtls && result.xtls.result !== 'untested') {\n const outcome = result.xtls.result === 'reachable' ? 'success' : 'failed';\n stats[`reachability_${clusterType}_xtls_${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 LoggerProxy.logger.log(\n `Reachability:index#performReachabilityChecks --> doing UDP${\n // @ts-ignore\n this.webex.config.meetings.experimental.enableTcpReachability ? ',TCP' : ''\n }${\n // @ts-ignore\n this.webex.config.meetings.experimental.enableTlsReachability ? ',TLS' : ''\n } reachability checks`\n );\n\n const clusterReachabilityChecks = Object.keys(clusterList).map((key) => {\n const cluster = clusterList[key];\n\n // Linus doesn't support TCP reachability checks on video mesh nodes\n const includeTcpReachability =\n // @ts-ignore\n this.webex.config.meetings.experimental.enableTcpReachability && !cluster.isVideoMesh;\n\n if (!includeTcpReachability) {\n cluster.tcp = [];\n }\n\n const includeTlsReachability =\n // @ts-ignore\n this.webex.config.meetings.experimental.enableTlsReachability && !cluster.isVideoMesh;\n\n if (!includeTlsReachability) {\n cluster.xtls = [];\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,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;AACA,IAAAM,oBAAA,GAAAN,OAAA;AAbA;AACA;AACA;AAEA;AA8BA;AACA;AACA;AACA;AAcA;AAGA;AAQA;AACA;AACA;AACA;AAHA,IAIqBO,YAAY,GAAAC,OAAA,CAAAC,OAAA;EAQ/B;AACF;AACA;AACA;AACA;EACE,SAAAF,aAAYG,KAAa,EAAE;IAAA,IAAAC,gBAAA,CAAAF,OAAA,QAAAF,YAAA;IAAA,IAAAK,gBAAA,CAAAH,OAAA,qBAZfI,uBAAY,CAACC,SAAS;IAAA,IAAAF,gBAAA,CAAAH,OAAA;IAAA,IAAAG,gBAAA,CAAAH,OAAA;IAAA,IAAAG,gBAAA,CAAAH,OAAA;IAahC,IAAI,CAACC,KAAK,GAAGA,KAAK;;IAElB;AACJ;AACA;AACA;AACA;AACA;AACA;IACI,IAAI,CAACK,mBAAmB,GAAG,IAAIC,gBAAmB,CAAC,IAAI,CAACN,KAAK,CAAC;IAE9D,IAAI,CAACO,mBAAmB,GAAG,CAAC,CAAC;EAC/B;;EAEA;AACF;AACA;AACA;AACA;AACA;EALE,IAAAC,aAAA,CAAAT,OAAA,EAAAF,YAAA;IAAAY,GAAA;IAAAC,KAAA;MAAA,IAAAC,mBAAA,OAAAC,kBAAA,CAAAb,OAAA,gBAAAc,YAAA,CAAA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,CAACxH,mBAAmB,CAACE,GAAG,CAAC,CAACuI,KAAK,CAAC,CAAC,CAACC,IAAI,CAAC,UAAChF,MAAM,EAAK;kBAC5D9C,OAAO,CAACV,GAAG,CAAC,GAAGwD,MAAM;kBACrB9C,OAAO,CAACV,GAAG,CAAC,CAACmE,WAAW,GAAGgE,OAAO,CAAChE,WAAW;gBAChD,CAAC,CAAC;cACJ,CAAC,CAAC;cAAAsD,SAAA,CAAA1G,IAAA;cAAA,OAEI4G,QAAA,CAAArI,OAAA,CAAQmJ,GAAG,CAAClB,yBAAyB,CAAC;YAAA;cAE5C,IAAI,CAACP,sBAAsB,CAAC,CAAC;cAAC,OAAAS,SAAA,CAAA5F,MAAA,WAEvBnB,OAAO;YAAA;YAAA;cAAA,OAAA+G,SAAA,CAAAzF,IAAA;UAAA;QAAA,GAAAoF,QAAA;MAAA,CACf;MAAA,SAAAhG,0BAAAsH,EAAA;QAAA,OAAAvB,0BAAA,CAAAjF,KAAA,OAAAC,SAAA;MAAA;MAAA,OAAAf,yBAAA;IAAA;EAAA;EAAA,OAAAhC,YAAA;AAAA"}
@@ -6,3 +6,10 @@
6
6
  * @returns {string} url of a turn server
7
7
  */
8
8
  export declare function convertStunUrlToTurn(stunUrl: string, protocol: 'udp' | 'tcp'): string;
9
+ /**
10
+ * Converts a stun url to a turns url
11
+ *
12
+ * @param {string} stunUrl url of a stun server
13
+ * @returns {string} url of a turns server
14
+ */
15
+ export declare function convertStunUrlToTurnTls(stunUrl: string): string;
@@ -5,6 +5,7 @@ _Object$defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.convertStunUrlToTurn = convertStunUrlToTurn;
8
+ exports.convertStunUrlToTurnTls = convertStunUrlToTurnTls;
8
9
  /* eslint-disable import/prefer-default-export */
9
10
  /**
10
11
  * Converts a stun url to a turn url
@@ -26,4 +27,22 @@ function convertStunUrlToTurn(stunUrl, protocol) {
26
27
  }
27
28
  return url.toString();
28
29
  }
30
+
31
+ /**
32
+ * Converts a stun url to a turns url
33
+ *
34
+ * @param {string} stunUrl url of a stun server
35
+ * @returns {string} url of a turns server
36
+ */
37
+ function convertStunUrlToTurnTls(stunUrl) {
38
+ // stunUrl looks like this: "stun:external-media1.public.wjfkm-a-15.prod.infra.webex.com:443"
39
+ // and we need it to be like this: "turns:external-media1.public.wjfkm-a-15.prod.infra.webex.com:443?transport=tcp"
40
+ var url = new URL(stunUrl);
41
+ if (url.protocol !== 'stun:') {
42
+ throw new Error("Not a STUN URL: ".concat(stunUrl));
43
+ }
44
+ url.protocol = 'turns:';
45
+ url.searchParams.append('transport', 'tcp');
46
+ return url.toString();
47
+ }
29
48
  //# sourceMappingURL=util.js.map
@@ -1 +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"}
1
+ {"version":3,"names":["convertStunUrlToTurn","stunUrl","protocol","url","URL","Error","concat","searchParams","append","toString","convertStunUrlToTurnTls"],"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\n/**\n * Converts a stun url to a turns url\n *\n * @param {string} stunUrl url of a stun server\n * @returns {string} url of a turns server\n */\nexport function convertStunUrlToTurnTls(stunUrl: string) {\n // stunUrl looks like this: \"stun:external-media1.public.wjfkm-a-15.prod.infra.webex.com:443\"\n // and we need it to be like this: \"turns:external-media1.public.wjfkm-a-15.prod.infra.webex.com:443?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 = 'turns:';\n url.searchParams.append('transport', 'tcp');\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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CAACT,OAAe,EAAE;EACvD;EACA;EACA,IAAME,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,QAAQ;EACvBC,GAAG,CAACI,YAAY,CAACC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC;EAE3C,OAAOL,GAAG,CAACM,QAAQ,CAAC,CAAC;AACvB"}
@@ -62,7 +62,7 @@ var Webinar = _webexCore.WebexPlugin.extend({
62
62
  updateCanManageWebcast: function updateCanManageWebcast(canManageWebcast) {
63
63
  this.set('canManageWebcast', canManageWebcast);
64
64
  },
65
- version: "3.0.0-next.23"
65
+ version: "3.0.0-next.24"
66
66
  });
67
67
  var _default = exports.default = Webinar;
68
68
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -43,7 +43,7 @@
43
43
  "@webex/eslint-config-legacy": "0.0.0",
44
44
  "@webex/jest-config-legacy": "0.0.0",
45
45
  "@webex/legacy-tools": "0.0.0",
46
- "@webex/plugin-meetings": "3.0.0-next.23",
46
+ "@webex/plugin-meetings": "3.0.0-next.24",
47
47
  "@webex/plugin-rooms": "3.0.0-next.15",
48
48
  "@webex/test-helper-chai": "3.0.0-next.13",
49
49
  "@webex/test-helper-mocha": "3.0.0-next.13",
@@ -70,7 +70,7 @@
70
70
  "@webex/internal-plugin-metrics": "3.0.0-next.13",
71
71
  "@webex/internal-plugin-support": "3.0.0-next.15",
72
72
  "@webex/internal-plugin-user": "3.0.0-next.13",
73
- "@webex/internal-plugin-voicea": "3.0.0-next.23",
73
+ "@webex/internal-plugin-voicea": "3.0.0-next.24",
74
74
  "@webex/media-helpers": "3.0.1-next.14",
75
75
  "@webex/plugin-people": "3.0.0-next.15",
76
76
  "@webex/plugin-rooms": "3.0.0-next.15",
@@ -91,5 +91,5 @@
91
91
  "//": [
92
92
  "TODO: upgrade jwt-decode when moving to node 18"
93
93
  ],
94
- "version": "3.0.0-next.23"
94
+ "version": "3.0.0-next.24"
95
95
  }
package/src/config.ts CHANGED
@@ -87,6 +87,7 @@ export default {
87
87
  enableUnifiedMeetings: true,
88
88
  enableAdhocMeetings: true,
89
89
  enableTcpReachability: false,
90
+ enableTlsReachability: false,
90
91
  },
91
92
  degradationPreferences: {
92
93
  maxMacroblocksLimit: 8192,
@@ -717,6 +717,24 @@ export default class Meetings extends WebexPlugin {
717
717
  }
718
718
  }
719
719
 
720
+ /**
721
+ * API to toggle TLS reachability, needs to be called before webex.meetings.register()
722
+ * @param {Boolean} newValue
723
+ * @private
724
+ * @memberof Meetings
725
+ * @returns {undefined}
726
+ */
727
+ private _toggleTlsReachability(newValue: boolean) {
728
+ if (typeof newValue !== 'boolean') {
729
+ return;
730
+ }
731
+ // @ts-ignore
732
+ if (this.config.experimental.enableTlsReachability !== newValue) {
733
+ // @ts-ignore
734
+ this.config.experimental.enableTlsReachability = newValue;
735
+ }
736
+ }
737
+
720
738
  /**
721
739
  * Explicitly sets up the meetings plugin by registering
722
740
  * the device, connecting to mercury, and listening for locus events.
@@ -2,7 +2,7 @@ import {Defer} from '@webex/common';
2
2
 
3
3
  import LoggerProxy from '../common/logs/logger-proxy';
4
4
  import {ClusterNode} from './request';
5
- import {convertStunUrlToTurn} from './util';
5
+ import {convertStunUrlToTurn, convertStunUrlToTurnTls} from './util';
6
6
 
7
7
  import {ICE_GATHERING_STATE, CONNECTION_STATE} from '../constants';
8
8
 
@@ -29,6 +29,7 @@ export type ClusterReachabilityResult = {
29
29
  export class ClusterReachability {
30
30
  private numUdpUrls: number;
31
31
  private numTcpUrls: number;
32
+ private numXTlsUrls: number;
32
33
  private result: ClusterReachabilityResult;
33
34
  private pc?: RTCPeerConnection;
34
35
  private defer: Defer; // this defer is resolved once reachability checks for this cluster are completed
@@ -46,6 +47,7 @@ export class ClusterReachability {
46
47
  this.isVideoMesh = clusterInfo.isVideoMesh;
47
48
  this.numUdpUrls = clusterInfo.udp.length;
48
49
  this.numTcpUrls = clusterInfo.tcp.length;
50
+ this.numXTlsUrls = clusterInfo.xtls.length;
49
51
 
50
52
  this.pc = this.createPeerConnection(clusterInfo);
51
53
 
@@ -94,8 +96,16 @@ export class ClusterReachability {
94
96
  };
95
97
  });
96
98
 
99
+ const turnTlsIceServers = cluster.xtls.map((urlString: string) => {
100
+ return {
101
+ username: 'webexturnreachuser',
102
+ credential: 'webexturnreachpwd',
103
+ urls: [convertStunUrlToTurnTls(urlString)],
104
+ };
105
+ });
106
+
97
107
  return {
98
- iceServers: [...udpIceServers, ...tcpIceServers],
108
+ iceServers: [...udpIceServers, ...tcpIceServers, ...turnTlsIceServers],
99
109
  iceCandidatePoolSize: 0,
100
110
  iceTransportPolicy: 'all',
101
111
  };
@@ -194,7 +204,7 @@ export class ClusterReachability {
194
204
  * @returns {boolean} true if we have all results, false otherwise
195
205
  */
196
206
  private haveWeGotAllResults(): boolean {
197
- return ['udp', 'tcp'].every(
207
+ return ['udp', 'tcp', 'xtls'].every(
198
208
  (protocol) =>
199
209
  this.result[protocol].result === 'reachable' || this.result[protocol].result === 'untested'
200
210
  );
@@ -207,7 +217,7 @@ export class ClusterReachability {
207
217
  * @param {number} latency
208
218
  * @returns {void}
209
219
  */
210
- private storeLatencyResult(protocol: 'udp' | 'tcp', latency: number) {
220
+ private storeLatencyResult(protocol: 'udp' | 'tcp' | 'xtls', latency: number) {
211
221
  const result = this.result[protocol];
212
222
 
213
223
  if (result.latencyInMilliseconds === undefined) {
@@ -227,6 +237,7 @@ export class ClusterReachability {
227
237
  */
228
238
  private registerIceCandidateListener() {
229
239
  this.pc.onicecandidate = (e) => {
240
+ const TURN_TLS_PORT = 443;
230
241
  const CANDIDATE_TYPES = {
231
242
  SERVER_REFLEXIVE: 'srflx',
232
243
  RELAY: 'relay',
@@ -239,7 +250,8 @@ export class ClusterReachability {
239
250
  }
240
251
 
241
252
  if (e.candidate.type === CANDIDATE_TYPES.RELAY) {
242
- this.storeLatencyResult('tcp', this.getElapsedTime());
253
+ const protocol = e.candidate.port === TURN_TLS_PORT ? 'xtls' : 'tcp';
254
+ this.storeLatencyResult(protocol, this.getElapsedTime());
243
255
  // we don't add public IP for TCP, because in the case of relay candidates
244
256
  // e.candidate.address is the TURN server address, not the client's public IP
245
257
  }
@@ -275,6 +287,9 @@ export class ClusterReachability {
275
287
  this.result.tcp = {
276
288
  result: this.numTcpUrls > 0 ? 'unreachable' : 'untested',
277
289
  };
290
+ this.result.xtls = {
291
+ result: this.numXTlsUrls > 0 ? 'unreachable' : 'untested',
292
+ };
278
293
 
279
294
  try {
280
295
  const offer = await this.pc.createOffer({offerToReceiveAudio: true});
@@ -22,10 +22,14 @@ export type ReachabilityMetrics = {
22
22
  reachability_public_udp_failed: number;
23
23
  reachability_public_tcp_success: number;
24
24
  reachability_public_tcp_failed: number;
25
+ reachability_public_xtls_success: number;
26
+ reachability_public_xtls_failed: number;
25
27
  reachability_vmn_udp_success: number;
26
28
  reachability_vmn_udp_failed: number;
27
29
  reachability_vmn_tcp_success: number;
28
30
  reachability_vmn_tcp_failed: number;
31
+ reachability_vmn_xtls_success: number;
32
+ reachability_vmn_xtls_failed: number;
29
33
  };
30
34
 
31
35
  /**
@@ -141,10 +145,14 @@ export default class Reachability {
141
145
  reachability_public_udp_failed: 0,
142
146
  reachability_public_tcp_success: 0,
143
147
  reachability_public_tcp_failed: 0,
148
+ reachability_public_xtls_success: 0,
149
+ reachability_public_xtls_failed: 0,
144
150
  reachability_vmn_udp_success: 0,
145
151
  reachability_vmn_udp_failed: 0,
146
152
  reachability_vmn_tcp_success: 0,
147
153
  reachability_vmn_tcp_failed: 0,
154
+ reachability_vmn_xtls_success: 0,
155
+ reachability_vmn_xtls_failed: 0,
148
156
  };
149
157
 
150
158
  const updateStats = (clusterType: 'public' | 'vmn', result: ClusterReachabilityResult) => {
@@ -156,6 +164,10 @@ export default class Reachability {
156
164
  const outcome = result.tcp.result === 'reachable' ? 'success' : 'failed';
157
165
  stats[`reachability_${clusterType}_tcp_${outcome}`] += 1;
158
166
  }
167
+ if (result.xtls && result.xtls.result !== 'untested') {
168
+ const outcome = result.xtls.result === 'reachable' ? 'success' : 'failed';
169
+ stats[`reachability_${clusterType}_xtls_${outcome}`] += 1;
170
+ }
159
171
  };
160
172
 
161
173
  try {
@@ -338,7 +350,10 @@ export default class Reachability {
338
350
  LoggerProxy.logger.log(
339
351
  `Reachability:index#performReachabilityChecks --> doing UDP${
340
352
  // @ts-ignore
341
- this.webex.config.meetings.experimental.enableTcpReachability ? ' and TCP' : ''
353
+ this.webex.config.meetings.experimental.enableTcpReachability ? ',TCP' : ''
354
+ }${
355
+ // @ts-ignore
356
+ this.webex.config.meetings.experimental.enableTlsReachability ? ',TLS' : ''
342
357
  } reachability checks`
343
358
  );
344
359
 
@@ -354,6 +369,14 @@ export default class Reachability {
354
369
  cluster.tcp = [];
355
370
  }
356
371
 
372
+ const includeTlsReachability =
373
+ // @ts-ignore
374
+ this.webex.config.meetings.experimental.enableTlsReachability && !cluster.isVideoMesh;
375
+
376
+ if (!includeTlsReachability) {
377
+ cluster.xtls = [];
378
+ }
379
+
357
380
  this.clusterReachability[key] = new ClusterReachability(key, cluster);
358
381
 
359
382
  return this.clusterReachability[key].start().then((result) => {
@@ -22,3 +22,24 @@ export function convertStunUrlToTurn(stunUrl: string, protocol: 'udp' | 'tcp') {
22
22
 
23
23
  return url.toString();
24
24
  }
25
+
26
+ /**
27
+ * Converts a stun url to a turns url
28
+ *
29
+ * @param {string} stunUrl url of a stun server
30
+ * @returns {string} url of a turns server
31
+ */
32
+ export function convertStunUrlToTurnTls(stunUrl: string) {
33
+ // stunUrl looks like this: "stun:external-media1.public.wjfkm-a-15.prod.infra.webex.com:443"
34
+ // and we need it to be like this: "turns:external-media1.public.wjfkm-a-15.prod.infra.webex.com:443?transport=tcp"
35
+ const url = new URL(stunUrl);
36
+
37
+ if (url.protocol !== 'stun:') {
38
+ throw new Error(`Not a STUN URL: ${stunUrl}`);
39
+ }
40
+
41
+ url.protocol = 'turns:';
42
+ url.searchParams.append('transport', 'tcp');
43
+
44
+ return url.toString();
45
+ }
@@ -253,6 +253,19 @@ describe('plugin-meetings', () => {
253
253
  });
254
254
  });
255
255
 
256
+ describe('#_toggleTlsReachability', () => {
257
+ it('should have _toggleTlsReachability', () => {
258
+ assert.equal(typeof webex.meetings._toggleTlsReachability, 'function');
259
+ });
260
+
261
+ describe('success', () => {
262
+ it('should update meetings to do TLS reachability', () => {
263
+ webex.meetings._toggleTlsReachability(true);
264
+ assert.equal(webex.meetings.config.experimental.enableTlsReachability, true);
265
+ });
266
+ });
267
+ });
268
+
256
269
  describe('Public API Contracts', () => {
257
270
  describe('#register', () => {
258
271
  it('emits an event and resolves when register succeeds', async () => {