@webex/plugin-meetings 3.0.0-beta.367 → 3.0.0-beta.368
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/reachability/index.js +14 -20
- package/dist/reachability/index.js.map +1 -1
- package/dist/reconnection-manager/index.js +63 -43
- package/dist/reconnection-manager/index.js.map +1 -1
- package/dist/webinar/index.js +1 -1
- package/package.json +19 -19
- package/src/reachability/index.ts +0 -6
- package/src/reconnection-manager/index.ts +18 -7
- package/test/unit/spec/reachability/index.ts +74 -0
- package/test/unit/spec/reconnection-manager/index.js +36 -1
package/dist/breakouts/index.js
CHANGED
|
@@ -1041,7 +1041,7 @@ var Breakouts = _webexCore.WebexPlugin.extend({
|
|
|
1041
1041
|
this.trigger(_constants.BREAKOUTS.EVENTS.ASK_RETURN_TO_MAIN);
|
|
1042
1042
|
}
|
|
1043
1043
|
},
|
|
1044
|
-
version: "3.0.0-beta.
|
|
1044
|
+
version: "3.0.0-beta.368"
|
|
1045
1045
|
});
|
|
1046
1046
|
var _default = Breakouts;
|
|
1047
1047
|
exports.default = _default;
|
|
@@ -66,41 +66,35 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
66
66
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
67
67
|
while (1) switch (_context.prev = _context.next) {
|
|
68
68
|
case 0:
|
|
69
|
-
_context.
|
|
70
|
-
|
|
71
|
-
case 2:
|
|
72
|
-
_context.next = 4;
|
|
73
|
-
return this.webex.boundedStorage.del(this.namespace, _constants.REACHABILITY.localStorageJoinCookie);
|
|
74
|
-
case 4:
|
|
75
|
-
_context.prev = 4;
|
|
76
|
-
_context.next = 7;
|
|
69
|
+
_context.prev = 0;
|
|
70
|
+
_context.next = 3;
|
|
77
71
|
return this.reachabilityRequest.getClusters(_util.default.getIpVersion(this.webex));
|
|
78
|
-
case
|
|
72
|
+
case 3:
|
|
79
73
|
_yield$this$reachabil = _context.sent;
|
|
80
74
|
clusters = _yield$this$reachabil.clusters;
|
|
81
75
|
joinCookie = _yield$this$reachabil.joinCookie;
|
|
82
|
-
_context.next =
|
|
76
|
+
_context.next = 8;
|
|
83
77
|
return this.performReachabilityChecks(clusters);
|
|
84
|
-
case
|
|
78
|
+
case 8:
|
|
85
79
|
results = _context.sent;
|
|
86
|
-
_context.next =
|
|
80
|
+
_context.next = 11;
|
|
87
81
|
return this.webex.boundedStorage.put(this.namespace, _constants.REACHABILITY.localStorageResult, (0, _stringify.default)(results));
|
|
88
|
-
case
|
|
89
|
-
_context.next =
|
|
82
|
+
case 11:
|
|
83
|
+
_context.next = 13;
|
|
90
84
|
return this.webex.boundedStorage.put(this.namespace, _constants.REACHABILITY.localStorageJoinCookie, (0, _stringify.default)(joinCookie));
|
|
91
|
-
case
|
|
85
|
+
case 13:
|
|
92
86
|
_loggerProxy.default.logger.log('Reachability:index#gatherReachability --> Reachability checks completed');
|
|
93
87
|
return _context.abrupt("return", results);
|
|
94
|
-
case
|
|
95
|
-
_context.prev =
|
|
96
|
-
_context.t0 = _context["catch"](
|
|
88
|
+
case 17:
|
|
89
|
+
_context.prev = 17;
|
|
90
|
+
_context.t0 = _context["catch"](0);
|
|
97
91
|
_loggerProxy.default.logger.error("Reachability:index#gatherReachability --> Error:", _context.t0);
|
|
98
92
|
return _context.abrupt("return", {});
|
|
99
|
-
case
|
|
93
|
+
case 21:
|
|
100
94
|
case "end":
|
|
101
95
|
return _context.stop();
|
|
102
96
|
}
|
|
103
|
-
}, _callee, this, [[
|
|
97
|
+
}, _callee, this, [[0, 17]]);
|
|
104
98
|
}));
|
|
105
99
|
function gatherReachability() {
|
|
106
100
|
return _gatherReachability.apply(this, arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Reachability","webex","REACHABILITY","namespace","reachabilityRequest","ReachabilityRequest","clusterReachability","boundedStorage","del","localStorageResult","localStorageJoinCookie","getClusters","MeetingUtil","getIpVersion","clusters","joinCookie","performReachabilityChecks","results","put","LoggerProxy","logger","log","error","stats","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","updateStats","clusterType","result","udp","outcome","tcp","get","resultsJson","JSON","parse","forEach","isVideoMesh","warn","transportResult","output","key","value","reachable","untested","latencyInMilliseconds","toString","allClusterResults","clusterResult","mapTransportResultToBackendDataFormat","xtls","catch","reachabilityData","reachabilityResults","some","e","unreachableList","getResult","push","name","protocol","list","getUnreachableClusters","clusterList","length","resolve","config","meetings","experimental","enableTcpReachability","clusterReachabilityChecks","map","cluster","includeTcpReachability","ClusterReachability","start","then","all","logUnreachableClusters"],"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 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":";;;;;;;;;;;;;;;;;;;;AAOA;AACA;AAEA;AAEA;AACA;AA6CA;AACA;AACA;AACA;AAHA,IAIqBA,YAAY;EAQ/B;AACF;AAC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C8B,GAAG,CAAC,GAAGb,MAAM;kBACrBjB,OAAO,CAAC8B,GAAG,CAAC,CAACJ,WAAW,GAAGmC,OAAO,CAACnC,WAAW;gBAChD,CAAC,CAAC;cACJ,CAAC,CAAC;cAAA;cAAA,OAEI,iBAAQwC,GAAG,CAACP,yBAAyB,CAAC;YAAA;cAE5C,IAAI,CAACQ,sBAAsB,EAAE;cAAC,kCAEvBnE,OAAO;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA,CACf;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":["Reachability","webex","REACHABILITY","namespace","reachabilityRequest","ReachabilityRequest","clusterReachability","getClusters","MeetingUtil","getIpVersion","clusters","joinCookie","performReachabilityChecks","results","boundedStorage","put","localStorageResult","localStorageJoinCookie","LoggerProxy","logger","log","error","stats","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","updateStats","clusterType","result","udp","outcome","tcp","get","resultsJson","JSON","parse","forEach","isVideoMesh","warn","transportResult","output","key","value","reachable","untested","latencyInMilliseconds","toString","allClusterResults","clusterResult","mapTransportResultToBackendDataFormat","xtls","catch","reachabilityData","reachabilityResults","some","e","unreachableList","getResult","push","name","protocol","list","getUnreachableClusters","clusterList","length","resolve","config","meetings","experimental","enableTcpReachability","clusterReachabilityChecks","map","cluster","includeTcpReachability","ClusterReachability","start","then","all","logUnreachableClusters"],"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":";;;;;;;;;;;;;;;;;;;;AAOA;AACA;AAEA;AAEA;AACA;AA6CA;AACA;AACA;AACA;AAHA,IAIqBA,YAAY;EAQ/B;AACF;AACA;AACA;AACA;EACE,sBAAYC,KAAa,EAAE;IAAA;IAAA,iDAZfC,uBAAY,CAACC,SAAS;IAAA;IAAA;IAAA;IAahC,IAAI,CAACF,KAAK,GAAGA,KAAK;;IAElB;AACJ;AACA;AACA;AACA;AACA;AACA;IACI,IAAI,CAACG,mBAAmB,GAAG,IAAIC,gBAAmB,CAAC,IAAI,CAACJ,KAAK,CAAC;IAE9D,IAAI,CAACK,mBAAmB,GAAG,CAAC,CAAC;EAC/B;;EAEA;AACF;AACA;AACA;AACA;AACA;EALE;IAAA;IAAA;MAAA,kGAMA;QAAA;QAAA;UAAA;YAAA;cAAA;cAAA;cAAA,OAGyC,IAAI,CAACF,mBAAmB,CAACG,WAAW,CACvEC,aAAW,CAACC,YAAY,CAAC,IAAI,CAACR,KAAK,CAAC,CACrC;YAAA;cAAA;cAFMS,QAAQ,yBAARA,QAAQ;cAAEC,UAAU,yBAAVA,UAAU;cAAA;cAAA,OAKL,IAAI,CAACC,yBAAyB,CAACF,QAAQ,CAAC;YAAA;cAAxDG,OAAO;cAAA;cAAA,OAGP,IAAI,CAACZ,KAAK,CAACa,cAAc,CAACC,GAAG,CACjC,IAAI,CAACZ,SAAS,EACdD,uBAAY,CAACc,kBAAkB,EAC/B,wBAAeH,OAAO,CAAC,CACxB;YAAA;cAAA;cAAA,OAEK,IAAI,CAACZ,KAAK,CAACa,cAAc,CAACC,GAAG,CACjC,IAAI,CAACZ,SAAS,EACdD,uBAAY,CAACe,sBAAsB,EACnC,wBAAeN,UAAU,CAAC,CAC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,EAAK;kBAC5DpB,OAAO,CAACiC,GAAG,CAAC,GAAGb,MAAM;kBACrBpB,OAAO,CAACiC,GAAG,CAAC,CAACJ,WAAW,GAAGmC,OAAO,CAACnC,WAAW;gBAChD,CAAC,CAAC;cACJ,CAAC,CAAC;cAAA;cAAA,OAEI,iBAAQwC,GAAG,CAACP,yBAAyB,CAAC;YAAA;cAE5C,IAAI,CAACQ,sBAAsB,EAAE;cAAC,kCAEvBtE,OAAO;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA,CACf;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA;AAAA"}
|
|
@@ -337,12 +337,12 @@ var ReconnectionManager = /*#__PURE__*/function () {
|
|
|
337
337
|
key: "reconnect",
|
|
338
338
|
value: function () {
|
|
339
339
|
var _reconnect = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
340
|
-
var _this3 = this;
|
|
341
340
|
var _ref2,
|
|
342
341
|
_ref2$networkDisconne,
|
|
343
342
|
networkDisconnect,
|
|
344
343
|
_ref2$networkRetry,
|
|
345
344
|
networkRetry,
|
|
345
|
+
media,
|
|
346
346
|
_args2 = arguments;
|
|
347
347
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
348
348
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -372,55 +372,75 @@ var ReconnectionManager = /*#__PURE__*/function () {
|
|
|
372
372
|
}
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
|
-
|
|
375
|
+
_context2.prev = 11;
|
|
376
|
+
_context2.next = 14;
|
|
377
|
+
return this.webex.meetings.startReachability();
|
|
378
|
+
case 14:
|
|
379
|
+
_context2.next = 19;
|
|
380
|
+
break;
|
|
381
|
+
case 16:
|
|
382
|
+
_context2.prev = 16;
|
|
383
|
+
_context2.t1 = _context2["catch"](11);
|
|
384
|
+
_loggerProxy.default.logger.info('ReconnectionManager:index#reconnect --> Reachability failed, continuing with reconnection attempt, err: ', _context2.t1);
|
|
385
|
+
case 19:
|
|
386
|
+
_context2.prev = 19;
|
|
387
|
+
_context2.next = 22;
|
|
388
|
+
return this.executeReconnection({
|
|
376
389
|
networkDisconnect: networkDisconnect
|
|
377
|
-
})
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
_loggerProxy.default.logger.error('ReconnectionManager:index#reconnect --> Reconnection failed.', reconnectError.message);
|
|
392
|
-
_loggerProxy.default.logger.info('ReconnectionManager:index#reconnect --> Sending reconnect abort metric.');
|
|
390
|
+
});
|
|
391
|
+
case 22:
|
|
392
|
+
media = _context2.sent;
|
|
393
|
+
return _context2.abrupt("return", media);
|
|
394
|
+
case 26:
|
|
395
|
+
_context2.prev = 26;
|
|
396
|
+
_context2.t2 = _context2["catch"](19);
|
|
397
|
+
if (!(_context2.t2 instanceof NeedsRetryError)) {
|
|
398
|
+
_context2.next = 32;
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
_loggerProxy.default.logger.info('ReconnectionManager:index#reconnect --> Reconnection not successful, retrying.');
|
|
402
|
+
// Reset our reconnect status since we are looping back to the beginning
|
|
403
|
+
this.status = _constants.RECONNECTION.STATE.DEFAULT_STATUS;
|
|
393
404
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
shownToUser: false
|
|
404
|
-
}]
|
|
405
|
-
},
|
|
406
|
-
options: {
|
|
407
|
-
meetingId: _this3.meeting.id
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
if (reconnectError instanceof NeedsRejoinError) {
|
|
411
|
-
// send call aborded event with catogery as expected as we are trying to rejoin
|
|
405
|
+
// This is a network retry, so we should not log START metrics again
|
|
406
|
+
return _context2.abrupt("return", this.reconnect({
|
|
407
|
+
networkDisconnect: true,
|
|
408
|
+
networkRetry: true
|
|
409
|
+
}));
|
|
410
|
+
case 32:
|
|
411
|
+
// Reconnect has failed
|
|
412
|
+
_loggerProxy.default.logger.error('ReconnectionManager:index#reconnect --> Reconnection failed.', _context2.t2.message);
|
|
413
|
+
_loggerProxy.default.logger.info('ReconnectionManager:index#reconnect --> Sending reconnect abort metric.');
|
|
412
414
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
415
|
+
// send call aborted event with catogery as expected as we are trying to rejoin
|
|
416
|
+
// @ts-ignore
|
|
417
|
+
this.webex.internal.newMetrics.submitClientEvent({
|
|
418
|
+
name: 'client.call.aborted',
|
|
419
|
+
payload: {
|
|
420
|
+
errors: [{
|
|
421
|
+
category: 'expected',
|
|
422
|
+
errorCode: 2008,
|
|
423
|
+
fatal: true,
|
|
424
|
+
name: 'media-engine',
|
|
425
|
+
shownToUser: false
|
|
426
|
+
}]
|
|
427
|
+
},
|
|
428
|
+
options: {
|
|
429
|
+
meetingId: this.meeting.id
|
|
416
430
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
431
|
+
});
|
|
432
|
+
if (!(_context2.t2 instanceof NeedsRejoinError && this.autoRejoinEnabled)) {
|
|
433
|
+
_context2.next = 37;
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
return _context2.abrupt("return", this.rejoinMeeting(_context2.t2.wasSharing));
|
|
437
|
+
case 37:
|
|
438
|
+
throw _context2.t2;
|
|
439
|
+
case 38:
|
|
420
440
|
case "end":
|
|
421
441
|
return _context2.stop();
|
|
422
442
|
}
|
|
423
|
-
}, _callee2, this, [[2, 6]]);
|
|
443
|
+
}, _callee2, this, [[2, 6], [11, 16], [19, 26]]);
|
|
424
444
|
}));
|
|
425
445
|
function reconnect() {
|
|
426
446
|
return _reconnect.apply(this, arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NeedsRetryError","Error","NeedsRejoinError","wasSharing","error","ReconnectionManager","meeting","iceState","disconnected","resolve","timer","undefined","timeoutDuration","config","reconnection","iceReconnectionTimeout","status","RECONNECTION","STATE","DEFAULT_STATUS","tryCount","DEFAULT_TRY_COUNT","webex","maxRejoinAttempts","rejoinAttempts","autoRejoinEnabled","autoRejoin","reset","clearTimeout","LoggerProxy","logger","log","resetReconnectionTimer","reject","setTimeout","reason","unpublishStreams","mediaProperties","shareVideoStream","shareAudioStream","Trigger","trigger","file","function","EVENT_TRIGGERS","MEETING_STOPPED_SHARING_LOCAL","IN_PROGRESS","enabled","COMPLETE","info","ReconnectInProgress","ReconnectionError","networkDisconnect","networkRetry","id","validate","internal","newMetrics","submitClientEvent","name","options","meetingId","executeReconnection","catch","reconnectError","reconnect","message","payload","errors","category","errorCode","fatal","shownToUser","rejoinMeeting","shareStatus","SHARE_STATUS","LOCAL_SHARE_ACTIVE","stopLocalShareStream","SHARE_STOPPED_REASON","MEDIA_RECONNECTION","reconnectMercuryWebSocket","device","url","FAILURE","credentials","isUnverifiedGuest","meetings","syncMeetings","keepOnlyLocusMeetings","getMeetingByType","_ID_","state","_LEFT_","type","_CALL_","reconnectMedia","media","join","rejoin","MEETING_REJOIN","Metrics","sendBehavioralMetric","BEHAVIORAL_METRICS","MEETING_MAX_REJOIN_FAILURE","locus_id","locusUrl","split","pop","stack","roap","doTurnDiscovery","turnServerResult","iceServers","turnServerInfo","push","urls","username","credential","password","webrtcMediaConnection","isMultistream","mediaRequestManagers","forEach","mediaRequestManager","clearPreviousRequests","commit","mercury","connected","disconnect","connect"],"sources":["index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable no-warning-comments */\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport Trigger from '../common/events/trigger-proxy';\nimport {\n EVENT_TRIGGERS,\n RECONNECTION,\n SHARE_STATUS,\n SHARE_STOPPED_REASON,\n _CALL_,\n _LEFT_,\n _ID_,\n RECONNECTION_STATE,\n} from '../constants';\nimport BEHAVIORAL_METRICS from '../metrics/constants';\nimport ReconnectInProgress from '../common/errors/reconnection-in-progress';\nimport Metrics from '../metrics';\nimport Meeting from '../meeting';\nimport {MediaRequestManager} from '../multistream/mediaRequestManager';\nimport ReconnectionError from '../common/errors/reconnection';\n\n/**\n * Used to indicate that the reconnect logic needs to be retried.\n *\n * @class NeedsRetryError\n * @extends {Error}\n */\nclass NeedsRetryError extends Error {}\n\n/**\n * Used to indicate that the meeting needs to be rejoined, not just media reconnected\n *\n * @class NeedsRejoinError\n * @extends {Error}\n */\nclass NeedsRejoinError extends Error {\n wasSharing: any;\n\n /**\n * Creates an instance of NeedsRejoinError.\n * @param {Object} params\n * @param {boolean} params.wasSharing\n * @param {Error} params.error\n * @memberof NeedsRejoinError\n */\n constructor({\n wasSharing,\n error = new Error('Meeting needs to be rejoined'),\n }: {\n wasSharing?: boolean;\n error?: Error;\n }) {\n // @ts-ignore\n super(error);\n\n this.wasSharing = wasSharing;\n }\n}\n\n/**\n * @export\n * @class ReconnectionManager\n */\nexport default class ReconnectionManager {\n autoRejoinEnabled: any;\n iceState: any;\n maxRejoinAttempts: any;\n meeting: any;\n rejoinAttempts: any;\n shareStatus: any;\n status: any;\n tryCount: any;\n webex: any;\n /**\n * @param {Meeting} meeting\n */\n constructor(meeting: Meeting) {\n /**\n * Stores ICE reconnection state data.\n *\n * @instance\n * @type {Object}\n * @private\n * @memberof ReconnectionManager\n */\n this.iceState = {\n disconnected: false,\n resolve: () => {},\n timer: undefined,\n // @ts-ignore\n timeoutDuration: meeting.config.reconnection.iceReconnectionTimeout,\n };\n\n /**\n * @instance\n * @type {RECONNECTION_STATE}\n * @private\n * @memberof ReconnectionManager\n */\n this.status = RECONNECTION.STATE.DEFAULT_STATUS;\n /**\n * @instance\n * @type {Number}\n * @private\n * @memberof ReconnectionManager\n */\n this.tryCount = RECONNECTION.STATE.DEFAULT_TRY_COUNT;\n /**\n * @instance\n * @type {Object}\n * @private\n * @memberof ReconnectionManager\n */\n // TODO : change this logic to not save the meeting instance\n // It gets complicated when meeting ends on remote side , We have a old meeting instance which is not up to date\n // @ts-ignore\n this.webex = meeting.webex;\n /**\n * @instance\n * @type {Meeting}\n * @private\n * @memberof ReconnectionManager\n */\n // TODO: try removing the circular dependency for meeting and reconnection manager\n // try moving this to meetings collection\n this.meeting = meeting;\n\n // @ts-ignore\n this.maxRejoinAttempts = meeting.config.reconnection.maxRejoinAttempts;\n this.rejoinAttempts = RECONNECTION.STATE.DEFAULT_TRY_COUNT;\n // @ts-ignore\n this.autoRejoinEnabled = meeting.config.reconnection.autoRejoin;\n\n // Make sure reconnection state is in default\n this.reset();\n }\n\n /**\n * @public\n * @memberof ReconnectionManager\n * @returns {void}\n */\n resetReconnectionTimer() {\n this.iceState.resolve();\n this.iceState.resolve = () => {};\n\n if (this.iceState.timer) {\n clearTimeout(this.iceState.timer);\n delete this.iceState.timer;\n }\n }\n\n /**\n * Sets the iceState to connected and clears any disconnect timeouts and\n * related timeout data within the iceState.\n *\n * @returns {undefined}\n * @public\n * @memberof ReconnectionManager\n */\n public iceReconnected() {\n if (this.iceState.disconnected) {\n LoggerProxy.logger.log('ReconnectionManager:index#iceReconnected --> ice has reconnected');\n\n this.resetReconnectionTimer();\n\n this.iceState.disconnected = false;\n }\n }\n\n /**\n * Set the iceState to disconnected and generates a timeout that waits for the\n * iceState to reconnect and then resolves. If the ice state is already\n * processing a reconnect, it immediately resolves. Rejects if the timeout\n * duration is reached.\n *\n * @returns {Promise<undefined>}\n * @public\n * @memberof ReconnectionManager\n */\n public waitForIceReconnect() {\n if (!this.iceState.disconnected) {\n LoggerProxy.logger.log(\n 'ReconnectionManager:index#waitForIceReconnect --> waiting for ice reconnect'\n );\n\n this.iceState.disconnected = true;\n\n return new Promise<void>((resolve, reject) => {\n this.iceState.timer = setTimeout(() => {\n if (this.iceState.disconnected === false) {\n resolve();\n } else {\n this.iceState.disconnected = false;\n reject(\n new Error(`ice reconnection did not occur in ${this.iceState.timeoutDuration}ms`)\n );\n }\n }, this.iceState.timeoutDuration);\n\n this.iceState.resolve = resolve;\n });\n }\n\n // return a resolved promise to prevent multiple catch executions of reconnect\n return Promise.resolve();\n }\n\n /**\n * @returns {undefined}\n * @public\n * @memberof ReconnectionManager\n */\n public reset() {\n this.status = RECONNECTION.STATE.DEFAULT_STATUS;\n this.tryCount = RECONNECTION.STATE.DEFAULT_TRY_COUNT;\n this.rejoinAttempts = RECONNECTION.STATE.DEFAULT_TRY_COUNT;\n }\n\n /**\n * @returns {undefined}\n * @public\n * @memberof ReconnectionManager\n */\n public cleanUp() {\n this.reset();\n }\n\n /**\n * Stop the local share stream.\n *\n * @param {string} reason a {@link SHARE_STOPPED_REASON}\n * @returns {undefined}\n * @private\n * @memberof ReconnectionManager\n */\n private async stopLocalShareStream(reason: string) {\n await this.meeting.unpublishStreams([\n this.meeting.mediaProperties.shareVideoStream,\n this.meeting.mediaProperties.shareAudioStream,\n ]);\n Trigger.trigger(\n this.meeting,\n {\n file: 'reconnection-manager/index',\n function: 'stopLocalShareStream',\n },\n EVENT_TRIGGERS.MEETING_STOPPED_SHARING_LOCAL,\n {\n reason,\n }\n );\n }\n\n /**\n * @public\n * @memberof ReconnectionManager\n * @returns {Boolean} true if reconnection operation is in progress\n */\n isReconnectInProgress() {\n return this.status === RECONNECTION.STATE.IN_PROGRESS;\n }\n\n /**\n * Sets the reconnection status\n *\n * @public\n * @param {RECONNECTION_STATE} status\n * @memberof ReconnectionManager\n * @returns {undefined}\n */\n public setStatus(status: RECONNECTION_STATE) {\n this.status = status;\n }\n\n /**\n * @returns {Boolean}\n * @throws {ReconnectionError}\n * @private\n * @memberof ReconnectionManager\n */\n private validate() {\n if (this.meeting.config.reconnection.enabled) {\n if (\n this.status === RECONNECTION.STATE.DEFAULT_STATUS ||\n this.status === RECONNECTION.STATE.COMPLETE\n ) {\n return true;\n }\n\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#validate --> Reconnection already in progress.'\n );\n\n throw new ReconnectInProgress('Reconnection already in progress.');\n }\n\n LoggerProxy.logger.info('ReconnectionManager:index#validate --> Reconnection is not enabled.');\n\n throw new ReconnectionError('Reconnection is not enabled.');\n }\n\n /**\n * Initiates a media reconnect for the active meeting\n * @param {Object} reconnectOptions\n * @param {boolean} [reconnectOptions.networkDisconnect=false] indicates if a network disconnect event happened\n * @param {boolean} [reconnectOptions.networkRetry=false] indicates if we are retrying the reconnect\n * @returns {Promise}\n * @public\n * @memberof ReconnectionManager\n */\n public async reconnect({\n networkDisconnect = false,\n networkRetry = false,\n }: {\n networkDisconnect?: boolean;\n networkRetry?: boolean;\n } = {}) {\n LoggerProxy.logger.info(\n `ReconnectionManager:index#reconnect --> Reconnection start for meeting ${this.meeting.id}.`\n );\n // First, validate that we can reconnect, if not, it will throw an error\n try {\n this.validate();\n } catch (error) {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnect --> Reconnection unable to begin.',\n error\n );\n throw error;\n }\n\n if (!networkRetry) {\n // Only log START metrics on the initial reconnect\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnect --> Sending reconnect start metric.'\n );\n\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.media.reconnecting',\n options: {\n meetingId: this.meeting.id,\n },\n });\n }\n\n return this.executeReconnection({networkDisconnect}).catch((reconnectError) => {\n if (reconnectError instanceof NeedsRetryError) {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnect --> Reconnection not successful, retrying.'\n );\n // Reset our reconnect status since we are looping back to the beginning\n this.status = RECONNECTION.STATE.DEFAULT_STATUS;\n\n // This is a network retry, so we should not log START metrics again\n return this.reconnect({networkDisconnect: true, networkRetry: true});\n }\n\n // Reconnect has failed\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#reconnect --> Reconnection failed.',\n reconnectError.message\n );\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnect --> Sending reconnect abort metric.'\n );\n\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.call.aborted',\n payload: {\n errors: [\n {\n category: 'expected',\n errorCode: 2008,\n fatal: true,\n name: 'media-engine',\n shownToUser: false,\n },\n ],\n },\n options: {\n meetingId: this.meeting.id,\n },\n });\n if (reconnectError instanceof NeedsRejoinError) {\n // send call aborded event with catogery as expected as we are trying to rejoin\n\n if (this.autoRejoinEnabled) {\n return this.rejoinMeeting(reconnectError.wasSharing);\n }\n }\n\n throw reconnectError;\n });\n }\n\n /**\n * @param {Object} reconnectOptions\n * @param {boolean} [reconnectOptions.networkDisconnect=false] indicates if a network disconnect event happened\n * @returns {Promise}\n * @throws {NeedsRetryError}\n * @private\n * @memberof ReconnectionManager\n */\n private async executeReconnection({networkDisconnect = false}: {networkDisconnect?: boolean}) {\n this.status = RECONNECTION.STATE.IN_PROGRESS;\n\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#executeReconnection --> Attempting to reconnect to meeting.'\n );\n\n const wasSharing = this.meeting.shareStatus === SHARE_STATUS.LOCAL_SHARE_ACTIVE;\n\n if (wasSharing) {\n await this.stopLocalShareStream(SHARE_STOPPED_REASON.MEDIA_RECONNECTION);\n }\n\n if (networkDisconnect) {\n try {\n await this.reconnectMercuryWebSocket();\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#executeReconnection --> Websocket reconnected.',\n this.webex.internal.device.url\n );\n } catch (error) {\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#executeReconnection --> Unable to reconnect to websocket, giving up.'\n );\n this.status = RECONNECTION.STATE.FAILURE;\n throw error;\n }\n }\n\n if (!this.webex.credentials.isUnverifiedGuest) {\n try {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#executeReconnection --> Updating meeting data from server.'\n );\n await this.webex.meetings.syncMeetings({keepOnlyLocusMeetings: false});\n } catch (syncError) {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#executeReconnection --> Unable to sync meetings, reconnecting.',\n syncError\n );\n throw new NeedsRetryError(syncError);\n }\n }\n\n // TODO: try to improve this logic as the reconnection manager saves the instance of deleted meeting object\n // So that on rejoin it known what parametrs it was using\n if (!this.meeting || !this.webex.meetings.getMeetingByType(_ID_, this.meeting.id)) {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#executeReconnection --> Meeting got deleted due to inactivity or ended remotely.'\n );\n\n throw new Error('Unable to rejoin a meeting already ended or inactive.');\n }\n\n LoggerProxy.logger.info(\n `ReconnectionManager:index#executeReconnection --> Current state of meeting is ${this.meeting.state}`\n );\n\n // If the meeting state was left, no longer reconnect media\n if (this.meeting.state === _LEFT_) {\n if (this.meeting.type === _CALL_) {\n throw new Error('Unable to rejoin a call in LEFT state.');\n }\n\n throw new NeedsRejoinError({wasSharing});\n }\n\n try {\n const media = await this.reconnectMedia();\n\n LoggerProxy.logger.log(\n 'ReconnectionManager:index#executeReconnection --> webRTC media connection renewed and local sdp offer sent'\n );\n\n return media;\n } catch (error) {\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#executeReconnection --> failed to renew webRTC media connection or initiate offer'\n );\n this.status = RECONNECTION.STATE.FAILURE;\n\n throw error;\n }\n }\n\n /**\n * Rejoins a meeting after detecting the member was in a LEFT state\n *\n * @async\n * @param {boolean} wasSharing\n * @returns {Promise}\n */\n async rejoinMeeting(wasSharing = false) {\n try {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#rejoinMeeting --> attemping meeting rejoin'\n );\n\n await this.meeting.join({rejoin: true});\n LoggerProxy.logger.info('ReconnectionManager:index#rejoinMeeting --> meeting rejoined');\n\n if (wasSharing) {\n await this.stopLocalShareStream(SHARE_STOPPED_REASON.MEETING_REJOIN);\n }\n } catch (joinError) {\n this.rejoinAttempts += 1;\n if (this.rejoinAttempts <= this.maxRejoinAttempts) {\n LoggerProxy.logger.info(\n `ReconnectionManager:index#rejoinMeeting --> Unable to rejoin meeting, attempt #${this.rejoinAttempts}, retrying.`,\n joinError\n );\n this.rejoinMeeting();\n } else {\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#rejoinMeeting --> Unable to rejoin meeting after max attempts.',\n joinError\n );\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEETING_MAX_REJOIN_FAILURE, {\n locus_id: this.meeting.locusUrl.split('/').pop(),\n reason: joinError.message,\n stack: joinError.stack,\n });\n this.status = RECONNECTION.STATE.FAILURE;\n throw joinError;\n }\n }\n\n try {\n await this.reconnectMedia();\n } catch (mediaError) {\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#rejoinMeeting --> Unable to reestablish media after rejoining.',\n mediaError\n );\n throw mediaError;\n }\n }\n\n /**\n * @returns {Promise}\n * @private\n * @memberof ReconnectionManager\n */\n async reconnectMedia() {\n LoggerProxy.logger.log('ReconnectionManager:index#reconnectMedia --> do turn discovery');\n\n // do the TURN server discovery again and ignore reachability results since the TURN server might change\n const turnServerResult = await this.meeting.roap.doTurnDiscovery(this.meeting, true, true);\n\n const iceServers = [];\n\n if (turnServerResult.turnServerInfo) {\n iceServers.push({\n urls: turnServerResult.turnServerInfo.url,\n username: turnServerResult.turnServerInfo.username || '',\n credential: turnServerResult.turnServerInfo.password || '',\n });\n }\n\n LoggerProxy.logger.log(\n 'ReconnectionManager:index#reconnectMedia --> renew webRTC media connection and send local sdp offer'\n );\n\n await this.meeting.mediaProperties.webrtcMediaConnection.reconnect(iceServers);\n\n // resend media requests\n if (this.meeting.isMultistream) {\n Object.values(this.meeting.mediaRequestManagers).forEach(\n (mediaRequestManager: MediaRequestManager) => {\n mediaRequestManager.clearPreviousRequests();\n mediaRequestManager.commit();\n }\n );\n }\n }\n\n /**\n * Attempt to Reconnect Mercury Websocket\n * @returns {Promise}\n * @private\n * @memberof ReconnectionManager\n */\n private async reconnectMercuryWebSocket() {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Reconnecting websocket.'\n );\n // First, attempt to disconnect if we think we are already connected.\n if (this.webex.internal.mercury.connected) {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Disconnecting existing websocket.'\n );\n try {\n await this.webex.internal.mercury.disconnect();\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Websocket disconnected successfully.'\n );\n } catch (disconnectError) {\n // If we can't disconnect, the sdk is in such a bad state that reconnecting is not going to happen.\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Unable to disconnect from websocket, giving up.',\n disconnectError\n );\n throw disconnectError;\n }\n }\n\n try {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Connecting websocket.'\n );\n await this.webex.internal.mercury.connect();\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Websocket connected successfully.'\n );\n } catch (connectError) {\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Unable to connect to websocket, giving up.',\n connectError\n );\n\n throw connectError;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAMA;AACA;AACA;AAUA;AACA;AACA;AAGA;AAA8D;AAAA;AAE9D;AACA;AACA;AACA;AACA;AACA;AALA,IAMMA,eAAe;EAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;AAAA,+CAASC,KAAK;AAEnC;AACA;AACA;AACA;AACA;AACA;AALA,IAMMC,gBAAgB;EAAA;EAAA;EAGpB;AACF;AACA;AACA;AACA;AACA;AACA;EACE,gCAMG;IAAA;IAAA,IALDC,UAAU,QAAVA,UAAU;MAAA,kBACVC,KAAK;MAALA,KAAK,2BAAG,IAAIH,KAAK,CAAC,8BAA8B,CAAC;IAAA;IAKjD;IACA,2BAAMG,KAAK;IAAE;IAEb,MAAKD,UAAU,GAAGA,UAAU;IAAC;EAC/B;EAAC;AAAA,+CArB4BF,KAAK;AAwBpC;AACA;AACA;AACA;AAHA,IAIqBI,mBAAmB;EAUtC;AACF;AACA;EACE,6BAAYC,OAAgB,EAAE;IAA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,CAACsE,OAAO,CAACC,SAAS;gBAAA;gBAAA;cAAA;cACvClG,oBAAW,CAACC,MAAM,CAACmB,IAAI,CACrB,2FAA2F,CAC5F;cAAC;cAAA;cAAA,OAEM,IAAI,CAAC3B,KAAK,CAACkC,QAAQ,CAACsE,OAAO,CAACE,UAAU,EAAE;YAAA;cAC9CnG,oBAAW,CAACC,MAAM,CAACmB,IAAI,CACrB,8FAA8F,CAC/F;cAAC;cAAA;YAAA;cAAA;cAAA;cAEF;cACApB,oBAAW,CAACC,MAAM,CAAC1B,KAAK,CACtB,yGAAyG,eAE1G;cAAC;YAAA;cAAA;cAMJyB,oBAAW,CAACC,MAAM,CAACmB,IAAI,CACrB,+EAA+E,CAChF;cAAC;cAAA,OACI,IAAI,CAAC3B,KAAK,CAACkC,QAAQ,CAACsE,OAAO,CAACG,OAAO,EAAE;YAAA;cAC3CpG,oBAAW,CAACC,MAAM,CAACmB,IAAI,CACrB,2FAA2F,CAC5F;cAAC;cAAA;YAAA;cAAA;cAAA;cAEFpB,oBAAW,CAACC,MAAM,CAAC1B,KAAK,CACtB,oGAAoG,eAErG;cAAC;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA,CAIL;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":["NeedsRetryError","Error","NeedsRejoinError","wasSharing","error","ReconnectionManager","meeting","iceState","disconnected","resolve","timer","undefined","timeoutDuration","config","reconnection","iceReconnectionTimeout","status","RECONNECTION","STATE","DEFAULT_STATUS","tryCount","DEFAULT_TRY_COUNT","webex","maxRejoinAttempts","rejoinAttempts","autoRejoinEnabled","autoRejoin","reset","clearTimeout","LoggerProxy","logger","log","resetReconnectionTimer","reject","setTimeout","reason","unpublishStreams","mediaProperties","shareVideoStream","shareAudioStream","Trigger","trigger","file","function","EVENT_TRIGGERS","MEETING_STOPPED_SHARING_LOCAL","IN_PROGRESS","enabled","COMPLETE","info","ReconnectInProgress","ReconnectionError","networkDisconnect","networkRetry","id","validate","internal","newMetrics","submitClientEvent","name","options","meetingId","meetings","startReachability","executeReconnection","media","reconnect","message","payload","errors","category","errorCode","fatal","shownToUser","rejoinMeeting","shareStatus","SHARE_STATUS","LOCAL_SHARE_ACTIVE","stopLocalShareStream","SHARE_STOPPED_REASON","MEDIA_RECONNECTION","reconnectMercuryWebSocket","device","url","FAILURE","credentials","isUnverifiedGuest","syncMeetings","keepOnlyLocusMeetings","getMeetingByType","_ID_","state","_LEFT_","type","_CALL_","reconnectMedia","join","rejoin","MEETING_REJOIN","Metrics","sendBehavioralMetric","BEHAVIORAL_METRICS","MEETING_MAX_REJOIN_FAILURE","locus_id","locusUrl","split","pop","stack","roap","doTurnDiscovery","turnServerResult","iceServers","turnServerInfo","push","urls","username","credential","password","webrtcMediaConnection","isMultistream","mediaRequestManagers","forEach","mediaRequestManager","clearPreviousRequests","commit","mercury","connected","disconnect","connect"],"sources":["index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable no-warning-comments */\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport Trigger from '../common/events/trigger-proxy';\nimport {\n EVENT_TRIGGERS,\n RECONNECTION,\n SHARE_STATUS,\n SHARE_STOPPED_REASON,\n _CALL_,\n _LEFT_,\n _ID_,\n RECONNECTION_STATE,\n} from '../constants';\nimport BEHAVIORAL_METRICS from '../metrics/constants';\nimport ReconnectInProgress from '../common/errors/reconnection-in-progress';\nimport Metrics from '../metrics';\nimport Meeting from '../meeting';\nimport {MediaRequestManager} from '../multistream/mediaRequestManager';\nimport ReconnectionError from '../common/errors/reconnection';\n\n/**\n * Used to indicate that the reconnect logic needs to be retried.\n *\n * @class NeedsRetryError\n * @extends {Error}\n */\nclass NeedsRetryError extends Error {}\n\n/**\n * Used to indicate that the meeting needs to be rejoined, not just media reconnected\n *\n * @class NeedsRejoinError\n * @extends {Error}\n */\nclass NeedsRejoinError extends Error {\n wasSharing: any;\n\n /**\n * Creates an instance of NeedsRejoinError.\n * @param {Object} params\n * @param {boolean} params.wasSharing\n * @param {Error} params.error\n * @memberof NeedsRejoinError\n */\n constructor({\n wasSharing,\n error = new Error('Meeting needs to be rejoined'),\n }: {\n wasSharing?: boolean;\n error?: Error;\n }) {\n // @ts-ignore\n super(error);\n\n this.wasSharing = wasSharing;\n }\n}\n\n/**\n * @export\n * @class ReconnectionManager\n */\nexport default class ReconnectionManager {\n autoRejoinEnabled: any;\n iceState: any;\n maxRejoinAttempts: any;\n meeting: any;\n rejoinAttempts: any;\n shareStatus: any;\n status: any;\n tryCount: any;\n webex: any;\n /**\n * @param {Meeting} meeting\n */\n constructor(meeting: Meeting) {\n /**\n * Stores ICE reconnection state data.\n *\n * @instance\n * @type {Object}\n * @private\n * @memberof ReconnectionManager\n */\n this.iceState = {\n disconnected: false,\n resolve: () => {},\n timer: undefined,\n // @ts-ignore\n timeoutDuration: meeting.config.reconnection.iceReconnectionTimeout,\n };\n\n /**\n * @instance\n * @type {RECONNECTION_STATE}\n * @private\n * @memberof ReconnectionManager\n */\n this.status = RECONNECTION.STATE.DEFAULT_STATUS;\n /**\n * @instance\n * @type {Number}\n * @private\n * @memberof ReconnectionManager\n */\n this.tryCount = RECONNECTION.STATE.DEFAULT_TRY_COUNT;\n /**\n * @instance\n * @type {Object}\n * @private\n * @memberof ReconnectionManager\n */\n // TODO : change this logic to not save the meeting instance\n // It gets complicated when meeting ends on remote side , We have a old meeting instance which is not up to date\n // @ts-ignore\n this.webex = meeting.webex;\n /**\n * @instance\n * @type {Meeting}\n * @private\n * @memberof ReconnectionManager\n */\n // TODO: try removing the circular dependency for meeting and reconnection manager\n // try moving this to meetings collection\n this.meeting = meeting;\n\n // @ts-ignore\n this.maxRejoinAttempts = meeting.config.reconnection.maxRejoinAttempts;\n this.rejoinAttempts = RECONNECTION.STATE.DEFAULT_TRY_COUNT;\n // @ts-ignore\n this.autoRejoinEnabled = meeting.config.reconnection.autoRejoin;\n\n // Make sure reconnection state is in default\n this.reset();\n }\n\n /**\n * @public\n * @memberof ReconnectionManager\n * @returns {void}\n */\n resetReconnectionTimer() {\n this.iceState.resolve();\n this.iceState.resolve = () => {};\n\n if (this.iceState.timer) {\n clearTimeout(this.iceState.timer);\n delete this.iceState.timer;\n }\n }\n\n /**\n * Sets the iceState to connected and clears any disconnect timeouts and\n * related timeout data within the iceState.\n *\n * @returns {undefined}\n * @public\n * @memberof ReconnectionManager\n */\n public iceReconnected() {\n if (this.iceState.disconnected) {\n LoggerProxy.logger.log('ReconnectionManager:index#iceReconnected --> ice has reconnected');\n\n this.resetReconnectionTimer();\n\n this.iceState.disconnected = false;\n }\n }\n\n /**\n * Set the iceState to disconnected and generates a timeout that waits for the\n * iceState to reconnect and then resolves. If the ice state is already\n * processing a reconnect, it immediately resolves. Rejects if the timeout\n * duration is reached.\n *\n * @returns {Promise<undefined>}\n * @public\n * @memberof ReconnectionManager\n */\n public waitForIceReconnect() {\n if (!this.iceState.disconnected) {\n LoggerProxy.logger.log(\n 'ReconnectionManager:index#waitForIceReconnect --> waiting for ice reconnect'\n );\n\n this.iceState.disconnected = true;\n\n return new Promise<void>((resolve, reject) => {\n this.iceState.timer = setTimeout(() => {\n if (this.iceState.disconnected === false) {\n resolve();\n } else {\n this.iceState.disconnected = false;\n reject(\n new Error(`ice reconnection did not occur in ${this.iceState.timeoutDuration}ms`)\n );\n }\n }, this.iceState.timeoutDuration);\n\n this.iceState.resolve = resolve;\n });\n }\n\n // return a resolved promise to prevent multiple catch executions of reconnect\n return Promise.resolve();\n }\n\n /**\n * @returns {undefined}\n * @public\n * @memberof ReconnectionManager\n */\n public reset() {\n this.status = RECONNECTION.STATE.DEFAULT_STATUS;\n this.tryCount = RECONNECTION.STATE.DEFAULT_TRY_COUNT;\n this.rejoinAttempts = RECONNECTION.STATE.DEFAULT_TRY_COUNT;\n }\n\n /**\n * @returns {undefined}\n * @public\n * @memberof ReconnectionManager\n */\n public cleanUp() {\n this.reset();\n }\n\n /**\n * Stop the local share stream.\n *\n * @param {string} reason a {@link SHARE_STOPPED_REASON}\n * @returns {undefined}\n * @private\n * @memberof ReconnectionManager\n */\n private async stopLocalShareStream(reason: string) {\n await this.meeting.unpublishStreams([\n this.meeting.mediaProperties.shareVideoStream,\n this.meeting.mediaProperties.shareAudioStream,\n ]);\n Trigger.trigger(\n this.meeting,\n {\n file: 'reconnection-manager/index',\n function: 'stopLocalShareStream',\n },\n EVENT_TRIGGERS.MEETING_STOPPED_SHARING_LOCAL,\n {\n reason,\n }\n );\n }\n\n /**\n * @public\n * @memberof ReconnectionManager\n * @returns {Boolean} true if reconnection operation is in progress\n */\n isReconnectInProgress() {\n return this.status === RECONNECTION.STATE.IN_PROGRESS;\n }\n\n /**\n * Sets the reconnection status\n *\n * @public\n * @param {RECONNECTION_STATE} status\n * @memberof ReconnectionManager\n * @returns {undefined}\n */\n public setStatus(status: RECONNECTION_STATE) {\n this.status = status;\n }\n\n /**\n * @returns {Boolean}\n * @throws {ReconnectionError}\n * @private\n * @memberof ReconnectionManager\n */\n private validate() {\n if (this.meeting.config.reconnection.enabled) {\n if (\n this.status === RECONNECTION.STATE.DEFAULT_STATUS ||\n this.status === RECONNECTION.STATE.COMPLETE\n ) {\n return true;\n }\n\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#validate --> Reconnection already in progress.'\n );\n\n throw new ReconnectInProgress('Reconnection already in progress.');\n }\n\n LoggerProxy.logger.info('ReconnectionManager:index#validate --> Reconnection is not enabled.');\n\n throw new ReconnectionError('Reconnection is not enabled.');\n }\n\n /**\n * Initiates a media reconnect for the active meeting\n * @param {Object} reconnectOptions\n * @param {boolean} [reconnectOptions.networkDisconnect=false] indicates if a network disconnect event happened\n * @param {boolean} [reconnectOptions.networkRetry=false] indicates if we are retrying the reconnect\n * @returns {Promise}\n * @public\n * @memberof ReconnectionManager\n */\n public async reconnect({\n networkDisconnect = false,\n networkRetry = false,\n }: {\n networkDisconnect?: boolean;\n networkRetry?: boolean;\n } = {}) {\n LoggerProxy.logger.info(\n `ReconnectionManager:index#reconnect --> Reconnection start for meeting ${this.meeting.id}.`\n );\n // First, validate that we can reconnect, if not, it will throw an error\n try {\n this.validate();\n } catch (error) {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnect --> Reconnection unable to begin.',\n error\n );\n throw error;\n }\n\n if (!networkRetry) {\n // Only log START metrics on the initial reconnect\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnect --> Sending reconnect start metric.'\n );\n\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.media.reconnecting',\n options: {\n meetingId: this.meeting.id,\n },\n });\n }\n\n try {\n await this.webex.meetings.startReachability();\n } catch (err) {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnect --> Reachability failed, continuing with reconnection attempt, err: ',\n err\n );\n }\n\n try {\n const media = await this.executeReconnection({networkDisconnect});\n\n return media;\n } catch (reconnectError) {\n if (reconnectError instanceof NeedsRetryError) {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnect --> Reconnection not successful, retrying.'\n );\n // Reset our reconnect status since we are looping back to the beginning\n this.status = RECONNECTION.STATE.DEFAULT_STATUS;\n\n // This is a network retry, so we should not log START metrics again\n return this.reconnect({networkDisconnect: true, networkRetry: true});\n }\n\n // Reconnect has failed\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#reconnect --> Reconnection failed.',\n reconnectError.message\n );\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnect --> Sending reconnect abort metric.'\n );\n\n // send call aborted event with catogery as expected as we are trying to rejoin\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.call.aborted',\n payload: {\n errors: [\n {\n category: 'expected',\n errorCode: 2008,\n fatal: true,\n name: 'media-engine',\n shownToUser: false,\n },\n ],\n },\n options: {\n meetingId: this.meeting.id,\n },\n });\n\n if (reconnectError instanceof NeedsRejoinError && this.autoRejoinEnabled) {\n return this.rejoinMeeting(reconnectError.wasSharing);\n }\n\n throw reconnectError;\n }\n }\n\n /**\n * @param {Object} reconnectOptions\n * @param {boolean} [reconnectOptions.networkDisconnect=false] indicates if a network disconnect event happened\n * @returns {Promise}\n * @throws {NeedsRetryError}\n * @private\n * @memberof ReconnectionManager\n */\n private async executeReconnection({networkDisconnect = false}: {networkDisconnect?: boolean}) {\n this.status = RECONNECTION.STATE.IN_PROGRESS;\n\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#executeReconnection --> Attempting to reconnect to meeting.'\n );\n\n const wasSharing = this.meeting.shareStatus === SHARE_STATUS.LOCAL_SHARE_ACTIVE;\n\n if (wasSharing) {\n await this.stopLocalShareStream(SHARE_STOPPED_REASON.MEDIA_RECONNECTION);\n }\n\n if (networkDisconnect) {\n try {\n await this.reconnectMercuryWebSocket();\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#executeReconnection --> Websocket reconnected.',\n this.webex.internal.device.url\n );\n } catch (error) {\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#executeReconnection --> Unable to reconnect to websocket, giving up.'\n );\n this.status = RECONNECTION.STATE.FAILURE;\n throw error;\n }\n }\n\n if (!this.webex.credentials.isUnverifiedGuest) {\n try {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#executeReconnection --> Updating meeting data from server.'\n );\n await this.webex.meetings.syncMeetings({keepOnlyLocusMeetings: false});\n } catch (syncError) {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#executeReconnection --> Unable to sync meetings, reconnecting.',\n syncError\n );\n throw new NeedsRetryError(syncError);\n }\n }\n\n // TODO: try to improve this logic as the reconnection manager saves the instance of deleted meeting object\n // So that on rejoin it known what parametrs it was using\n if (!this.meeting || !this.webex.meetings.getMeetingByType(_ID_, this.meeting.id)) {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#executeReconnection --> Meeting got deleted due to inactivity or ended remotely.'\n );\n\n throw new Error('Unable to rejoin a meeting already ended or inactive.');\n }\n\n LoggerProxy.logger.info(\n `ReconnectionManager:index#executeReconnection --> Current state of meeting is ${this.meeting.state}`\n );\n\n // If the meeting state was left, no longer reconnect media\n if (this.meeting.state === _LEFT_) {\n if (this.meeting.type === _CALL_) {\n throw new Error('Unable to rejoin a call in LEFT state.');\n }\n\n throw new NeedsRejoinError({wasSharing});\n }\n\n try {\n const media = await this.reconnectMedia();\n\n LoggerProxy.logger.log(\n 'ReconnectionManager:index#executeReconnection --> webRTC media connection renewed and local sdp offer sent'\n );\n\n return media;\n } catch (error) {\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#executeReconnection --> failed to renew webRTC media connection or initiate offer'\n );\n this.status = RECONNECTION.STATE.FAILURE;\n\n throw error;\n }\n }\n\n /**\n * Rejoins a meeting after detecting the member was in a LEFT state\n *\n * @async\n * @param {boolean} wasSharing\n * @returns {Promise}\n */\n async rejoinMeeting(wasSharing = false) {\n try {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#rejoinMeeting --> attemping meeting rejoin'\n );\n\n await this.meeting.join({rejoin: true});\n LoggerProxy.logger.info('ReconnectionManager:index#rejoinMeeting --> meeting rejoined');\n\n if (wasSharing) {\n await this.stopLocalShareStream(SHARE_STOPPED_REASON.MEETING_REJOIN);\n }\n } catch (joinError) {\n this.rejoinAttempts += 1;\n if (this.rejoinAttempts <= this.maxRejoinAttempts) {\n LoggerProxy.logger.info(\n `ReconnectionManager:index#rejoinMeeting --> Unable to rejoin meeting, attempt #${this.rejoinAttempts}, retrying.`,\n joinError\n );\n this.rejoinMeeting();\n } else {\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#rejoinMeeting --> Unable to rejoin meeting after max attempts.',\n joinError\n );\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEETING_MAX_REJOIN_FAILURE, {\n locus_id: this.meeting.locusUrl.split('/').pop(),\n reason: joinError.message,\n stack: joinError.stack,\n });\n this.status = RECONNECTION.STATE.FAILURE;\n throw joinError;\n }\n }\n\n try {\n await this.reconnectMedia();\n } catch (mediaError) {\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#rejoinMeeting --> Unable to reestablish media after rejoining.',\n mediaError\n );\n throw mediaError;\n }\n }\n\n /**\n * @returns {Promise}\n * @private\n * @memberof ReconnectionManager\n */\n async reconnectMedia() {\n LoggerProxy.logger.log('ReconnectionManager:index#reconnectMedia --> do turn discovery');\n\n // do the TURN server discovery again and ignore reachability results since the TURN server might change\n const turnServerResult = await this.meeting.roap.doTurnDiscovery(this.meeting, true, true);\n\n const iceServers = [];\n\n if (turnServerResult.turnServerInfo) {\n iceServers.push({\n urls: turnServerResult.turnServerInfo.url,\n username: turnServerResult.turnServerInfo.username || '',\n credential: turnServerResult.turnServerInfo.password || '',\n });\n }\n\n LoggerProxy.logger.log(\n 'ReconnectionManager:index#reconnectMedia --> renew webRTC media connection and send local sdp offer'\n );\n\n await this.meeting.mediaProperties.webrtcMediaConnection.reconnect(iceServers);\n\n // resend media requests\n if (this.meeting.isMultistream) {\n Object.values(this.meeting.mediaRequestManagers).forEach(\n (mediaRequestManager: MediaRequestManager) => {\n mediaRequestManager.clearPreviousRequests();\n mediaRequestManager.commit();\n }\n );\n }\n }\n\n /**\n * Attempt to Reconnect Mercury Websocket\n * @returns {Promise}\n * @private\n * @memberof ReconnectionManager\n */\n private async reconnectMercuryWebSocket() {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Reconnecting websocket.'\n );\n // First, attempt to disconnect if we think we are already connected.\n if (this.webex.internal.mercury.connected) {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Disconnecting existing websocket.'\n );\n try {\n await this.webex.internal.mercury.disconnect();\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Websocket disconnected successfully.'\n );\n } catch (disconnectError) {\n // If we can't disconnect, the sdk is in such a bad state that reconnecting is not going to happen.\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Unable to disconnect from websocket, giving up.',\n disconnectError\n );\n throw disconnectError;\n }\n }\n\n try {\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Connecting websocket.'\n );\n await this.webex.internal.mercury.connect();\n LoggerProxy.logger.info(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Websocket connected successfully.'\n );\n } catch (connectError) {\n LoggerProxy.logger.error(\n 'ReconnectionManager:index#reconnectMercuryWebSocket --> Unable to connect to websocket, giving up.',\n connectError\n );\n\n throw connectError;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAMA;AACA;AACA;AAUA;AACA;AACA;AAGA;AAA8D;AAAA;AAE9D;AACA;AACA;AACA;AACA;AACA;AALA,IAMMA,eAAe;EAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;AAAA,+CAASC,KAAK;AAEnC;AACA;AACA;AACA;AACA;AACA;AALA,IAMMC,gBAAgB;EAAA;EAAA;EAGpB;AACF;AACA;AACA;AACA;AACA;AACA;EACE,gCAMG;IAAA;IAAA,IALDC,UAAU,QAAVA,UAAU;MAAA,kBACVC,KAAK;MAALA,KAAK,2BAAG,IAAIH,KAAK,CAAC,8BAA8B,CAAC;IAAA;IAKjD;IACA,2BAAMG,KAAK;IAAE;IAEb,MAAKD,UAAU,GAAGA,UAAU;IAAC;EAC/B;EAAC;AAAA,+CArB4BF,KAAK;AAwBpC;AACA;AACA;AACA;AAHA,IAIqBI,mBAAmB;EAUtC;AACF;AACA;EACE,6BAAYC,OAAgB,EAAE;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAC5B;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACI,IAAI,CAACC,QAAQ,GAAG;MACdC,YAAY,EAAE,KAAK;MACnBC,OAAO,EAAE,mBAAM,CAAC,CAAC;MACjBC,KAAK,EAAEC,SAAS;MAChB;MACAC,eAAe,EAAEN,OAAO,CAACO,MAAM,CAACC,YAAY,CAACC;IAC/C,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IAAI,CAAC3B,KAAK,CAACkC,QAAQ,CAACqE,OAAO,CAACE,UAAU,EAAE;YAAA;cAC9ClG,oBAAW,CAACC,MAAM,CAACmB,IAAI,CACrB,8FAA8F,CAC/F;cAAC;cAAA;YAAA;cAAA;cAAA;cAEF;cACApB,oBAAW,CAACC,MAAM,CAAC1B,KAAK,CACtB,yGAAyG,eAE1G;cAAC;YAAA;cAAA;cAMJyB,oBAAW,CAACC,MAAM,CAACmB,IAAI,CACrB,+EAA+E,CAChF;cAAC;cAAA,OACI,IAAI,CAAC3B,KAAK,CAACkC,QAAQ,CAACqE,OAAO,CAACG,OAAO,EAAE;YAAA;cAC3CnG,oBAAW,CAACC,MAAM,CAACmB,IAAI,CACrB,2FAA2F,CAC5F;cAAC;cAAA;YAAA;cAAA;cAAA;cAEFpB,oBAAW,CAACC,MAAM,CAAC1B,KAAK,CACtB,oGAAoG,eAErG;cAAC;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA,CAIL;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA;AAAA"}
|
package/dist/webinar/index.js
CHANGED
|
@@ -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-beta.
|
|
65
|
+
version: "3.0.0-beta.368"
|
|
66
66
|
});
|
|
67
67
|
var _default = Webinar;
|
|
68
68
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/plugin-meetings",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.368",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
|
|
6
6
|
"contributors": [
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@peculiar/webcrypto": "^1.4.3",
|
|
36
|
-
"@webex/plugin-meetings": "3.0.0-beta.
|
|
37
|
-
"@webex/test-helper-chai": "3.0.0-beta.
|
|
38
|
-
"@webex/test-helper-mocha": "3.0.0-beta.
|
|
39
|
-
"@webex/test-helper-mock-webex": "3.0.0-beta.
|
|
40
|
-
"@webex/test-helper-retry": "3.0.0-beta.
|
|
41
|
-
"@webex/test-helper-test-users": "3.0.0-beta.
|
|
36
|
+
"@webex/plugin-meetings": "3.0.0-beta.368",
|
|
37
|
+
"@webex/test-helper-chai": "3.0.0-beta.368",
|
|
38
|
+
"@webex/test-helper-mocha": "3.0.0-beta.368",
|
|
39
|
+
"@webex/test-helper-mock-webex": "3.0.0-beta.368",
|
|
40
|
+
"@webex/test-helper-retry": "3.0.0-beta.368",
|
|
41
|
+
"@webex/test-helper-test-users": "3.0.0-beta.368",
|
|
42
42
|
"chai": "^4.3.4",
|
|
43
43
|
"chai-as-promised": "^7.1.1",
|
|
44
44
|
"jsdom-global": "3.0.2",
|
|
@@ -47,19 +47,19 @@
|
|
|
47
47
|
"typescript": "^4.7.4"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@webex/common": "3.0.0-beta.
|
|
50
|
+
"@webex/common": "3.0.0-beta.368",
|
|
51
51
|
"@webex/internal-media-core": "2.2.7",
|
|
52
|
-
"@webex/internal-plugin-conversation": "3.0.0-beta.
|
|
53
|
-
"@webex/internal-plugin-device": "3.0.0-beta.
|
|
54
|
-
"@webex/internal-plugin-llm": "3.0.0-beta.
|
|
55
|
-
"@webex/internal-plugin-mercury": "3.0.0-beta.
|
|
56
|
-
"@webex/internal-plugin-metrics": "3.0.0-beta.
|
|
57
|
-
"@webex/internal-plugin-support": "3.0.0-beta.
|
|
58
|
-
"@webex/internal-plugin-user": "3.0.0-beta.
|
|
59
|
-
"@webex/media-helpers": "3.0.0-beta.
|
|
60
|
-
"@webex/plugin-people": "3.0.0-beta.
|
|
61
|
-
"@webex/plugin-rooms": "3.0.0-beta.
|
|
62
|
-
"@webex/webex-core": "3.0.0-beta.
|
|
52
|
+
"@webex/internal-plugin-conversation": "3.0.0-beta.368",
|
|
53
|
+
"@webex/internal-plugin-device": "3.0.0-beta.368",
|
|
54
|
+
"@webex/internal-plugin-llm": "3.0.0-beta.368",
|
|
55
|
+
"@webex/internal-plugin-mercury": "3.0.0-beta.368",
|
|
56
|
+
"@webex/internal-plugin-metrics": "3.0.0-beta.368",
|
|
57
|
+
"@webex/internal-plugin-support": "3.0.0-beta.368",
|
|
58
|
+
"@webex/internal-plugin-user": "3.0.0-beta.368",
|
|
59
|
+
"@webex/media-helpers": "3.0.0-beta.368",
|
|
60
|
+
"@webex/plugin-people": "3.0.0-beta.368",
|
|
61
|
+
"@webex/plugin-rooms": "3.0.0-beta.368",
|
|
62
|
+
"@webex/webex-core": "3.0.0-beta.368",
|
|
63
63
|
"ampersand-collection": "^2.0.2",
|
|
64
64
|
"bowser": "^2.11.0",
|
|
65
65
|
"btoa": "^1.2.1",
|
|
@@ -95,12 +95,6 @@ export default class Reachability {
|
|
|
95
95
|
* @memberof Reachability
|
|
96
96
|
*/
|
|
97
97
|
public async gatherReachability(): Promise<ReachabilityResults> {
|
|
98
|
-
// Remove stored reachability results to ensure no stale data
|
|
99
|
-
// @ts-ignore
|
|
100
|
-
await this.webex.boundedStorage.del(this.namespace, REACHABILITY.localStorageResult);
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
await this.webex.boundedStorage.del(this.namespace, REACHABILITY.localStorageJoinCookie);
|
|
103
|
-
|
|
104
98
|
// Fetch clusters and measure latency
|
|
105
99
|
try {
|
|
106
100
|
const {clusters, joinCookie} = await this.reachabilityRequest.getClusters(
|
|
@@ -349,7 +349,20 @@ export default class ReconnectionManager {
|
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
|
|
352
|
+
try {
|
|
353
|
+
await this.webex.meetings.startReachability();
|
|
354
|
+
} catch (err) {
|
|
355
|
+
LoggerProxy.logger.info(
|
|
356
|
+
'ReconnectionManager:index#reconnect --> Reachability failed, continuing with reconnection attempt, err: ',
|
|
357
|
+
err
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
try {
|
|
362
|
+
const media = await this.executeReconnection({networkDisconnect});
|
|
363
|
+
|
|
364
|
+
return media;
|
|
365
|
+
} catch (reconnectError) {
|
|
353
366
|
if (reconnectError instanceof NeedsRetryError) {
|
|
354
367
|
LoggerProxy.logger.info(
|
|
355
368
|
'ReconnectionManager:index#reconnect --> Reconnection not successful, retrying.'
|
|
@@ -370,6 +383,7 @@ export default class ReconnectionManager {
|
|
|
370
383
|
'ReconnectionManager:index#reconnect --> Sending reconnect abort metric.'
|
|
371
384
|
);
|
|
372
385
|
|
|
386
|
+
// send call aborted event with catogery as expected as we are trying to rejoin
|
|
373
387
|
// @ts-ignore
|
|
374
388
|
this.webex.internal.newMetrics.submitClientEvent({
|
|
375
389
|
name: 'client.call.aborted',
|
|
@@ -388,16 +402,13 @@ export default class ReconnectionManager {
|
|
|
388
402
|
meetingId: this.meeting.id,
|
|
389
403
|
},
|
|
390
404
|
});
|
|
391
|
-
if (reconnectError instanceof NeedsRejoinError) {
|
|
392
|
-
// send call aborded event with catogery as expected as we are trying to rejoin
|
|
393
405
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
406
|
+
if (reconnectError instanceof NeedsRejoinError && this.autoRejoinEnabled) {
|
|
407
|
+
return this.rejoinMeeting(reconnectError.wasSharing);
|
|
397
408
|
}
|
|
398
409
|
|
|
399
410
|
throw reconnectError;
|
|
400
|
-
}
|
|
411
|
+
}
|
|
401
412
|
}
|
|
402
413
|
|
|
403
414
|
/**
|
|
@@ -128,6 +128,11 @@ describe('gatherReachability', () => {
|
|
|
128
128
|
'reachability.result',
|
|
129
129
|
JSON.stringify({old: 'results'})
|
|
130
130
|
);
|
|
131
|
+
await webex.boundedStorage.put(
|
|
132
|
+
'Reachability',
|
|
133
|
+
'reachability.joinCookie',
|
|
134
|
+
JSON.stringify({old: 'joinCookie'})
|
|
135
|
+
);
|
|
131
136
|
});
|
|
132
137
|
|
|
133
138
|
afterEach(() => {
|
|
@@ -169,6 +174,75 @@ describe('gatherReachability', () => {
|
|
|
169
174
|
assert.equal(JSON.stringify(getClustersResult.joinCookie), storedResultForJoinCookie);
|
|
170
175
|
});
|
|
171
176
|
|
|
177
|
+
it('keeps the stored reachability from previous call to gatherReachability if getClusters fails', async () => {
|
|
178
|
+
const reachability = new Reachability(webex);
|
|
179
|
+
|
|
180
|
+
const reachabilityResults = {
|
|
181
|
+
clusters: {
|
|
182
|
+
clusterId: {
|
|
183
|
+
udp: 'testUDP',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
const getClustersResult = {
|
|
188
|
+
clusters: {clusterId: 'cluster'},
|
|
189
|
+
joinCookie: {id: 'id'},
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
reachability.reachabilityRequest.getClusters = sinon.stub().throws();
|
|
193
|
+
|
|
194
|
+
const result = await reachability.gatherReachability();
|
|
195
|
+
|
|
196
|
+
assert.empty(result);
|
|
197
|
+
|
|
198
|
+
const storedResultForReachabilityResult = await webex.boundedStorage.get(
|
|
199
|
+
'Reachability',
|
|
200
|
+
'reachability.result'
|
|
201
|
+
);
|
|
202
|
+
const storedResultForJoinCookie = await webex.boundedStorage.get(
|
|
203
|
+
'Reachability',
|
|
204
|
+
'reachability.joinCookie'
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
assert.equal(JSON.stringify({old: 'results'}), storedResultForReachabilityResult);
|
|
208
|
+
assert.equal(JSON.stringify({old: 'joinCookie'}), storedResultForJoinCookie);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
it('keeps the stored reachability from previous call to gatherReachability if performReachabilityChecks fails', async () => {
|
|
212
|
+
const reachability = new Reachability(webex);
|
|
213
|
+
|
|
214
|
+
const reachabilityResults = {
|
|
215
|
+
clusters: {
|
|
216
|
+
clusterId: {
|
|
217
|
+
udp: 'testUDP',
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
const getClustersResult = {
|
|
222
|
+
clusters: {clusterId: 'cluster'},
|
|
223
|
+
joinCookie: {id: 'id'},
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
reachability.reachabilityRequest.getClusters = sinon.stub().returns(getClustersResult);
|
|
227
|
+
(reachability as any).performReachabilityChecks = sinon.stub().throws();
|
|
228
|
+
|
|
229
|
+
const result = await reachability.gatherReachability();
|
|
230
|
+
|
|
231
|
+
assert.empty(result);
|
|
232
|
+
|
|
233
|
+
const storedResultForReachabilityResult = await webex.boundedStorage.get(
|
|
234
|
+
'Reachability',
|
|
235
|
+
'reachability.result'
|
|
236
|
+
);
|
|
237
|
+
const storedResultForJoinCookie = await webex.boundedStorage.get(
|
|
238
|
+
'Reachability',
|
|
239
|
+
'reachability.joinCookie'
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
assert.equal(JSON.stringify({old: 'results'}), storedResultForReachabilityResult);
|
|
243
|
+
assert.equal(JSON.stringify({old: 'joinCookie'}), storedResultForJoinCookie);
|
|
244
|
+
});
|
|
245
|
+
|
|
172
246
|
it('starts ClusterReachability on each media cluster', async () => {
|
|
173
247
|
webex.config.meetings.experimental = {enableTcpReachability: true};
|
|
174
248
|
|
|
@@ -4,6 +4,8 @@ import chaiAsPromised from 'chai-as-promised';
|
|
|
4
4
|
import sinon from 'sinon';
|
|
5
5
|
import ReconnectionManager from '@webex/plugin-meetings/src/reconnection-manager';
|
|
6
6
|
import { RECONNECTION } from '../../../../src/constants';
|
|
7
|
+
import LoggerProxy from '../../../../src/common/logs/logger-proxy';
|
|
8
|
+
import LoggerConfig from '../../../../src/common/logs/logger-config';
|
|
7
9
|
|
|
8
10
|
const {assert} = chai;
|
|
9
11
|
|
|
@@ -12,8 +14,16 @@ sinon.assert.expose(chai.assert, {prefix: ''});
|
|
|
12
14
|
|
|
13
15
|
describe('plugin-meetings', () => {
|
|
14
16
|
describe('ReconnectionManager.reconnect', () => {
|
|
17
|
+
const sandbox = sinon.createSandbox();
|
|
15
18
|
let fakeMediaConnection;
|
|
16
19
|
let fakeMeeting;
|
|
20
|
+
let loggerSpy;
|
|
21
|
+
|
|
22
|
+
before(() => {
|
|
23
|
+
LoggerConfig.set({ enable: false });
|
|
24
|
+
LoggerProxy.set();
|
|
25
|
+
loggerSpy = sandbox.spy(LoggerProxy.logger, 'info');
|
|
26
|
+
});
|
|
17
27
|
|
|
18
28
|
beforeEach(() => {
|
|
19
29
|
fakeMediaConnection = {
|
|
@@ -65,6 +75,7 @@ describe('plugin-meetings', () => {
|
|
|
65
75
|
meetings: {
|
|
66
76
|
getMeetingByType: sinon.stub().returns(true),
|
|
67
77
|
syncMeetings: sinon.stub().resolves({}),
|
|
78
|
+
startReachability: sinon.stub().resolves({}),
|
|
68
79
|
},
|
|
69
80
|
internal: {
|
|
70
81
|
newMetrics: {
|
|
@@ -75,6 +86,10 @@ describe('plugin-meetings', () => {
|
|
|
75
86
|
};
|
|
76
87
|
});
|
|
77
88
|
|
|
89
|
+
afterEach(() => {
|
|
90
|
+
sandbox.reset();
|
|
91
|
+
});
|
|
92
|
+
|
|
78
93
|
it('syncs meetings if it is not an unverified guest', async () => {
|
|
79
94
|
const rm = new ReconnectionManager(fakeMeeting);
|
|
80
95
|
|
|
@@ -94,6 +109,27 @@ describe('plugin-meetings', () => {
|
|
|
94
109
|
assert.notCalled(rm.webex.meetings.syncMeetings);
|
|
95
110
|
});
|
|
96
111
|
|
|
112
|
+
it('calls startReachability on reconnect', async () => {
|
|
113
|
+
const rm = new ReconnectionManager(fakeMeeting);
|
|
114
|
+
|
|
115
|
+
await rm.reconnect();
|
|
116
|
+
|
|
117
|
+
assert.calledOnce(rm.webex.meetings.startReachability);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('continues with reconnection attempt if startReachability throws an error', async () => {
|
|
121
|
+
const reachabilityError = new Error();
|
|
122
|
+
fakeMeeting.webex.meetings.startReachability = sinon.stub().throws(reachabilityError);
|
|
123
|
+
|
|
124
|
+
const rm = new ReconnectionManager(fakeMeeting);
|
|
125
|
+
|
|
126
|
+
await rm.reconnect();
|
|
127
|
+
|
|
128
|
+
assert.calledOnce(rm.webex.meetings.startReachability);
|
|
129
|
+
assert.calledWith(loggerSpy, 'ReconnectionManager:index#reconnect --> Reachability failed, continuing with reconnection attempt, err: ', reachabilityError);
|
|
130
|
+
assert.calledWith(loggerSpy, 'ReconnectionManager:index#executeReconnection --> Attempting to reconnect to meeting.');
|
|
131
|
+
});
|
|
132
|
+
|
|
97
133
|
it('uses correct TURN TLS information on the reconnection', async () => {
|
|
98
134
|
const rm = new ReconnectionManager(fakeMeeting);
|
|
99
135
|
|
|
@@ -142,7 +178,6 @@ describe('plugin-meetings', () => {
|
|
|
142
178
|
assert.calledOnce(fakeMeeting.mediaRequestManagers.video.commit);
|
|
143
179
|
});
|
|
144
180
|
|
|
145
|
-
|
|
146
181
|
it('sends the correct client event when reconnection fails', async () => {
|
|
147
182
|
sinon.stub(ReconnectionManager.prototype, 'executeReconnection').rejects();
|
|
148
183
|
fakeMeeting.isMultistream = true;
|