@webex/calling 3.10.0 → 3.11.0-next.10
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/CallHistory/CallHistory.js +128 -133
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +289 -186
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +17 -18
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +14 -14
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +72 -25
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +138 -48
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +138 -145
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +149 -150
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +407 -359
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +378 -401
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +7 -8
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +666 -624
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +908 -556
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +22 -18
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +114 -114
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/constants.js +7 -1
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +57 -74
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +22 -22
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +675 -527
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +657 -309
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +24 -24
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +20 -20
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +259 -268
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +64 -63
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +7 -10
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +6 -9
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +6 -8
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +6 -9
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Events/impl/index.js +12 -14
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Logger/index.js +3 -3
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/Metrics/index.js +1 -2
- package/dist/Metrics/index.js.map +1 -1
- package/dist/SDKConnector/index.js +1 -2
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +131 -139
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +106 -98
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +88 -92
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +103 -131
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +20 -20
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +117 -131
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +180 -154
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/common/Utils.js +198 -166
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +436 -191
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +3 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +5 -4
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +20 -11
- package/dist/module/CallSettings/UcmBackendConnector.js +21 -8
- package/dist/module/CallSettings/WxCallBackendConnector.js +10 -15
- package/dist/module/CallingClient/CallingClient.js +125 -123
- package/dist/module/CallingClient/calling/call.js +76 -60
- package/dist/module/CallingClient/calling/callManager.js +7 -0
- package/dist/module/CallingClient/constants.js +5 -0
- package/dist/module/CallingClient/registration/register.js +93 -5
- package/dist/module/CallingClient/registration/webWorker.js +2 -2
- package/dist/module/CallingClient/registration/webWorkerStr.js +2 -2
- package/dist/module/Contacts/ContactsClient.js +19 -25
- package/dist/module/Events/impl/index.js +1 -1
- package/dist/module/Logger/index.js +2 -2
- package/dist/module/Voicemail/BroadworksBackendConnector.js +10 -18
- package/dist/module/Voicemail/UcmBackendConnector.js +7 -11
- package/dist/module/Voicemail/Voicemail.js +42 -68
- package/dist/module/Voicemail/WxCallBackendConnector.js +14 -28
- package/dist/module/common/Utils.js +31 -5
- package/dist/module/common/constants.js +2 -0
- package/dist/module/common/testUtil.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +2 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +4 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +5 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +6 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +8 -1
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +2 -1
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Logger/index.d.ts +1 -2
- package/dist/types/Logger/index.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +16 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +4 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -15,9 +15,11 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
17
|
exports.createRegistration = exports.Registration = void 0;
|
|
18
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
19
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
18
20
|
var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
|
|
19
21
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
20
|
-
var
|
|
22
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
|
|
21
23
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
22
24
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
23
25
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
@@ -93,7 +95,81 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
93
95
|
this.primaryMobiusUris = [];
|
|
94
96
|
this.backupMobiusUris = [];
|
|
95
97
|
}
|
|
96
|
-
(0, _createClass2.default)(Registration, [{
|
|
98
|
+
return (0, _createClass2.default)(Registration, [{
|
|
99
|
+
key: "getFailoverCacheKey",
|
|
100
|
+
value: function getFailoverCacheKey() {
|
|
101
|
+
return "".concat(_constants2.FAILOVER_CACHE_PREFIX, ".").concat(this.userId || 'unknown');
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "saveFailoverState",
|
|
105
|
+
value: function saveFailoverState(failoverState) {
|
|
106
|
+
try {
|
|
107
|
+
localStorage.setItem(this.getFailoverCacheKey(), (0, _stringify.default)(failoverState));
|
|
108
|
+
} catch (error) {
|
|
109
|
+
_Logger.default.warn("Storing failover state in cache failed with error: ".concat(String(error)), {
|
|
110
|
+
file: _constants2.REGISTRATION_FILE,
|
|
111
|
+
method: 'saveFailoverState'
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
key: "clearFailoverState",
|
|
117
|
+
value: function clearFailoverState() {
|
|
118
|
+
try {
|
|
119
|
+
localStorage.removeItem(this.getFailoverCacheKey());
|
|
120
|
+
} catch (_unused) {
|
|
121
|
+
_Logger.default.warn('Clearing failover state from localStorage failed', {
|
|
122
|
+
file: _constants2.REGISTRATION_FILE,
|
|
123
|
+
method: 'clearFailoverState'
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
key: "resumeFailover",
|
|
129
|
+
value: function () {
|
|
130
|
+
var _resumeFailover = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
131
|
+
var cachedState, failoverState, currentTime, newElapsed, _t;
|
|
132
|
+
return _regenerator.default.wrap(function (_context) {
|
|
133
|
+
while (1) switch (_context.prev = _context.next) {
|
|
134
|
+
case 0:
|
|
135
|
+
_context.prev = 0;
|
|
136
|
+
cachedState = localStorage.getItem(this.getFailoverCacheKey());
|
|
137
|
+
failoverState = cachedState ? JSON.parse(cachedState) : undefined;
|
|
138
|
+
if (!(failoverState && !this.isDeviceRegistered())) {
|
|
139
|
+
_context.next = 2;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
currentTime = Math.floor((0, _now.default)() / 1000);
|
|
143
|
+
newElapsed = failoverState.timeElapsed + (currentTime - failoverState.retryScheduledTime);
|
|
144
|
+
this.clearFailoverState();
|
|
145
|
+
_context.next = 1;
|
|
146
|
+
return this.startFailoverTimer(failoverState.attempt, newElapsed);
|
|
147
|
+
case 1:
|
|
148
|
+
return _context.abrupt("return", true);
|
|
149
|
+
case 2:
|
|
150
|
+
_context.next = 4;
|
|
151
|
+
break;
|
|
152
|
+
case 3:
|
|
153
|
+
_context.prev = 3;
|
|
154
|
+
_t = _context["catch"](0);
|
|
155
|
+
_Logger.default.warn("No failover state found in cache", {
|
|
156
|
+
file: _constants2.REGISTRATION_FILE,
|
|
157
|
+
method: 'triggerRegistration'
|
|
158
|
+
});
|
|
159
|
+
case 4:
|
|
160
|
+
return _context.abrupt("return", false);
|
|
161
|
+
case 5:
|
|
162
|
+
case "end":
|
|
163
|
+
return _context.stop();
|
|
164
|
+
}
|
|
165
|
+
}, _callee, this, [[0, 3]]);
|
|
166
|
+
}));
|
|
167
|
+
function resumeFailover() {
|
|
168
|
+
return _resumeFailover.apply(this, arguments);
|
|
169
|
+
}
|
|
170
|
+
return resumeFailover;
|
|
171
|
+
}()
|
|
172
|
+
}, {
|
|
97
173
|
key: "getActiveMobiusUrl",
|
|
98
174
|
value: function getActiveMobiusUrl() {
|
|
99
175
|
return this.activeMobiusUrl;
|
|
@@ -108,6 +184,21 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
108
184
|
this.activeMobiusUrl = url;
|
|
109
185
|
this.callManager.updateActiveMobius(url);
|
|
110
186
|
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Populate deviceInfo using a devices response body.
|
|
190
|
+
*/
|
|
191
|
+
}, {
|
|
192
|
+
key: "setDeviceInfo",
|
|
193
|
+
value: function setDeviceInfo(devicesInfo) {
|
|
194
|
+
var _devicesInfo$devices = (0, _slicedToArray2.default)(devicesInfo.devices, 1),
|
|
195
|
+
device = _devicesInfo$devices[0];
|
|
196
|
+
this.deviceInfo = {
|
|
197
|
+
userId: devicesInfo.userId,
|
|
198
|
+
device: device,
|
|
199
|
+
devices: devicesInfo.devices
|
|
200
|
+
};
|
|
201
|
+
}
|
|
111
202
|
}, {
|
|
112
203
|
key: "setMobiusServers",
|
|
113
204
|
value: function setMobiusServers(primaryMobiusUris, backupMobiusUris) {
|
|
@@ -126,58 +217,51 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
126
217
|
}, {
|
|
127
218
|
key: "deleteRegistration",
|
|
128
219
|
value: (function () {
|
|
129
|
-
var _deleteRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
220
|
+
var _deleteRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(url, deviceId, deviceUrl) {
|
|
130
221
|
var _response;
|
|
131
|
-
var response;
|
|
132
|
-
return _regenerator.default.wrap(function
|
|
133
|
-
while (1) switch (
|
|
222
|
+
var response, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
|
|
223
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
224
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
134
225
|
case 0:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
226
|
+
_context2.prev = 0;
|
|
227
|
+
_t2 = fetch;
|
|
228
|
+
_t3 = "".concat(url).concat(_constants2.DEVICES_ENDPOINT_RESOURCE, "/").concat(deviceId);
|
|
229
|
+
_t4 = _types2.HTTP_METHODS.DELETE;
|
|
230
|
+
_t5 = _defineProperty2.default;
|
|
231
|
+
_t6 = _defineProperty2.default;
|
|
232
|
+
_t7 = _defineProperty2.default;
|
|
233
|
+
_t8 = (0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, deviceUrl);
|
|
234
|
+
_context2.next = 1;
|
|
144
235
|
return this.webex.credentials.getUserToken();
|
|
145
|
-
case
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
headers: _context.t13
|
|
156
|
-
};
|
|
157
|
-
_context.next = 20;
|
|
158
|
-
return (0, _context.t0)(_context.t1, _context.t14);
|
|
159
|
-
case 20:
|
|
160
|
-
response = _context.sent;
|
|
161
|
-
_context.next = 28;
|
|
236
|
+
case 1:
|
|
237
|
+
_t9 = _t5(_t6(_t7(_t8, "Authorization", _context2.sent), "trackingId", "".concat(_constants2.WEBEX_WEB_CLIENT, "_").concat((0, _uuid.v4)())), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT);
|
|
238
|
+
_context2.next = 2;
|
|
239
|
+
return _t2(_t3, {
|
|
240
|
+
method: _t4,
|
|
241
|
+
headers: _t9
|
|
242
|
+
});
|
|
243
|
+
case 2:
|
|
244
|
+
response = _context2.sent;
|
|
245
|
+
_context2.next = 4;
|
|
162
246
|
break;
|
|
163
|
-
case
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
_Logger.default.warn("Delete failed with Mobius ".concat(
|
|
247
|
+
case 3:
|
|
248
|
+
_context2.prev = 3;
|
|
249
|
+
_t0 = _context2["catch"](0);
|
|
250
|
+
_Logger.default.warn("Delete failed with Mobius: ".concat((0, _stringify.default)(_t0)), {
|
|
167
251
|
file: _constants2.REGISTRATION_FILE,
|
|
168
252
|
method: _constants2.METHODS.DELETE_REGISTRATION
|
|
169
253
|
});
|
|
170
|
-
|
|
254
|
+
_context2.next = 4;
|
|
171
255
|
return (0, _common.uploadLogs)();
|
|
172
|
-
case
|
|
256
|
+
case 4:
|
|
173
257
|
this.setStatus(_types2.RegistrationStatus.INACTIVE);
|
|
174
258
|
this.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
175
|
-
return
|
|
176
|
-
case
|
|
259
|
+
return _context2.abrupt("return", (_response = response) === null || _response === void 0 ? void 0 : _response.json());
|
|
260
|
+
case 5:
|
|
177
261
|
case "end":
|
|
178
|
-
return
|
|
262
|
+
return _context2.stop();
|
|
179
263
|
}
|
|
180
|
-
},
|
|
264
|
+
}, _callee2, this, [[0, 3]]);
|
|
181
265
|
}));
|
|
182
266
|
function deleteRegistration(_x, _x2, _x3) {
|
|
183
267
|
return _deleteRegistration.apply(this, arguments);
|
|
@@ -192,10 +276,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
192
276
|
}, {
|
|
193
277
|
key: "postRegistration",
|
|
194
278
|
value: (function () {
|
|
195
|
-
var _postRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
279
|
+
var _postRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(url) {
|
|
196
280
|
var deviceInfo;
|
|
197
|
-
return _regenerator.default.wrap(function
|
|
198
|
-
while (1) switch (
|
|
281
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
282
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
199
283
|
case 0:
|
|
200
284
|
deviceInfo = {
|
|
201
285
|
userId: this.userId,
|
|
@@ -204,18 +288,18 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
204
288
|
jwe: this.jwe
|
|
205
289
|
}) : this.serviceData
|
|
206
290
|
};
|
|
207
|
-
return
|
|
291
|
+
return _context3.abrupt("return", this.webex.request({
|
|
208
292
|
uri: "".concat(url, "device"),
|
|
209
293
|
method: _types2.HTTP_METHODS.POST,
|
|
210
294
|
headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, deviceInfo.clientDeviceUri), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
|
|
211
295
|
body: deviceInfo,
|
|
212
296
|
service: _types2.ALLOWED_SERVICES.MOBIUS
|
|
213
297
|
}));
|
|
214
|
-
case
|
|
298
|
+
case 1:
|
|
215
299
|
case "end":
|
|
216
|
-
return
|
|
300
|
+
return _context3.stop();
|
|
217
301
|
}
|
|
218
|
-
},
|
|
302
|
+
}, _callee3, this);
|
|
219
303
|
}));
|
|
220
304
|
function postRegistration(_x4) {
|
|
221
305
|
return _postRegistration.apply(this, arguments);
|
|
@@ -230,27 +314,68 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
230
314
|
}, {
|
|
231
315
|
key: "restorePreviousRegistration",
|
|
232
316
|
value: (function () {
|
|
233
|
-
var _restorePreviousRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
317
|
+
var _restorePreviousRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(caller) {
|
|
318
|
+
var _this = this;
|
|
234
319
|
var abort;
|
|
235
|
-
return _regenerator.default.wrap(function
|
|
236
|
-
while (1) switch (
|
|
320
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
321
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
237
322
|
case 0:
|
|
238
323
|
abort = false;
|
|
239
324
|
if (!this.activeMobiusUrl) {
|
|
240
|
-
|
|
325
|
+
_context5.next = 6;
|
|
241
326
|
break;
|
|
242
327
|
}
|
|
243
|
-
|
|
328
|
+
_context5.next = 1;
|
|
244
329
|
return this.attemptRegistrationWithServers(caller, [this.activeMobiusUrl]);
|
|
330
|
+
case 1:
|
|
331
|
+
abort = _context5.sent;
|
|
332
|
+
if (!this.retryAfter) {
|
|
333
|
+
_context5.next = 6;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
if (!(this.retryAfter < _constants2.RETRY_TIMER_UPPER_LIMIT)) {
|
|
337
|
+
_context5.next = 2;
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
// If retry-after is less than threshold, honor it and schedule retry
|
|
341
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
342
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
343
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
344
|
+
case 0:
|
|
345
|
+
_context4.next = 1;
|
|
346
|
+
return _this.restartRegistration(caller);
|
|
347
|
+
case 1:
|
|
348
|
+
case "end":
|
|
349
|
+
return _context4.stop();
|
|
350
|
+
}
|
|
351
|
+
}, _callee4);
|
|
352
|
+
})), this.retryAfter * 1000);
|
|
353
|
+
_context5.next = 5;
|
|
354
|
+
break;
|
|
355
|
+
case 2:
|
|
356
|
+
if (!(this.primaryMobiusUris.includes(this.activeMobiusUrl) && this.backupMobiusUris.length > 0)) {
|
|
357
|
+
_context5.next = 4;
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
_context5.next = 3;
|
|
361
|
+
return this.attemptRegistrationWithServers(caller, this.backupMobiusUris);
|
|
362
|
+
case 3:
|
|
363
|
+
abort = _context5.sent;
|
|
364
|
+
_context5.next = 5;
|
|
365
|
+
break;
|
|
245
366
|
case 4:
|
|
246
|
-
|
|
367
|
+
// If we are using backup and got 429, restart registration
|
|
368
|
+
this.restartRegistration(caller);
|
|
247
369
|
case 5:
|
|
248
|
-
|
|
370
|
+
this.retryAfter = undefined;
|
|
371
|
+
return _context5.abrupt("return", true);
|
|
249
372
|
case 6:
|
|
373
|
+
return _context5.abrupt("return", abort);
|
|
374
|
+
case 7:
|
|
250
375
|
case "end":
|
|
251
|
-
return
|
|
376
|
+
return _context5.stop();
|
|
252
377
|
}
|
|
253
|
-
},
|
|
378
|
+
}, _callee5, this);
|
|
254
379
|
}));
|
|
255
380
|
function restorePreviousRegistration(_x5) {
|
|
256
381
|
return _restorePreviousRegistration.apply(this, arguments);
|
|
@@ -264,30 +389,30 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
264
389
|
}, {
|
|
265
390
|
key: "handle404KeepaliveFailure",
|
|
266
391
|
value: (function () {
|
|
267
|
-
var _handle404KeepaliveFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
392
|
+
var _handle404KeepaliveFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(caller) {
|
|
268
393
|
var abort;
|
|
269
|
-
return _regenerator.default.wrap(function
|
|
270
|
-
while (1) switch (
|
|
394
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
395
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
271
396
|
case 0:
|
|
272
397
|
if (!(caller === _constants2.KEEPALIVE_UTIL)) {
|
|
273
|
-
|
|
398
|
+
_context6.next = 2;
|
|
274
399
|
break;
|
|
275
400
|
}
|
|
276
|
-
|
|
401
|
+
_context6.next = 1;
|
|
277
402
|
return this.attemptRegistrationWithServers(caller);
|
|
278
|
-
case
|
|
279
|
-
abort =
|
|
403
|
+
case 1:
|
|
404
|
+
abort = _context6.sent;
|
|
280
405
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
281
|
-
|
|
406
|
+
_context6.next = 2;
|
|
282
407
|
break;
|
|
283
408
|
}
|
|
284
|
-
|
|
409
|
+
_context6.next = 2;
|
|
285
410
|
return this.startFailoverTimer();
|
|
286
|
-
case
|
|
411
|
+
case 2:
|
|
287
412
|
case "end":
|
|
288
|
-
return
|
|
413
|
+
return _context6.stop();
|
|
289
414
|
}
|
|
290
|
-
},
|
|
415
|
+
}, _callee6, this);
|
|
291
416
|
}));
|
|
292
417
|
function handle404KeepaliveFailure(_x6) {
|
|
293
418
|
return _handle404KeepaliveFailure.apply(this, arguments);
|
|
@@ -301,22 +426,22 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
301
426
|
}, {
|
|
302
427
|
key: "handle429Retry",
|
|
303
428
|
value: (function () {
|
|
304
|
-
var _handle429Retry = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
305
|
-
var
|
|
429
|
+
var _handle429Retry = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(retryAfter, caller) {
|
|
430
|
+
var _this2 = this;
|
|
306
431
|
var interval, abort;
|
|
307
|
-
return _regenerator.default.wrap(function
|
|
308
|
-
while (1) switch (
|
|
432
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
433
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
309
434
|
case 0:
|
|
310
435
|
if (!(caller === _constants2.FAILBACK_UTIL)) {
|
|
311
|
-
|
|
436
|
+
_context8.next = 4;
|
|
312
437
|
break;
|
|
313
438
|
}
|
|
314
439
|
if (!(this.failback429RetryAttempts >= _constants2.REG_FAILBACK_429_MAX_RETRIES)) {
|
|
315
|
-
|
|
440
|
+
_context8.next = 1;
|
|
316
441
|
break;
|
|
317
442
|
}
|
|
318
|
-
return
|
|
319
|
-
case
|
|
443
|
+
return _context8.abrupt("return");
|
|
444
|
+
case 1:
|
|
320
445
|
this.clearFailbackTimer();
|
|
321
446
|
this.failback429RetryAttempts += 1;
|
|
322
447
|
_Logger.default.log("Received 429 while rehoming, 429 retry count : ".concat(this.failback429RetryAttempts), {
|
|
@@ -326,26 +451,26 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
326
451
|
interval = this.getRegRetryInterval(this.failback429RetryAttempts);
|
|
327
452
|
this.startFailbackTimer(interval);
|
|
328
453
|
this.scheduled429Retry = true;
|
|
329
|
-
|
|
454
|
+
_context8.next = 2;
|
|
330
455
|
return this.restorePreviousRegistration(_constants2.REG_429_RETRY_UTIL);
|
|
331
|
-
case
|
|
332
|
-
abort =
|
|
456
|
+
case 2:
|
|
457
|
+
abort = _context8.sent;
|
|
333
458
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
334
|
-
|
|
459
|
+
_context8.next = 3;
|
|
335
460
|
break;
|
|
336
461
|
}
|
|
337
|
-
|
|
462
|
+
_context8.next = 3;
|
|
338
463
|
return this.restartRegistration(_constants2.REG_429_RETRY_UTIL);
|
|
339
|
-
case
|
|
340
|
-
|
|
464
|
+
case 3:
|
|
465
|
+
_context8.next = 5;
|
|
341
466
|
break;
|
|
342
|
-
case
|
|
467
|
+
case 4:
|
|
343
468
|
if (caller === _constants2.KEEPALIVE_UTIL) {
|
|
344
469
|
this.clearKeepaliveTimer();
|
|
345
|
-
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
346
|
-
var
|
|
347
|
-
return _regenerator.default.wrap(function
|
|
348
|
-
while (1) switch (
|
|
470
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
471
|
+
var _this2$deviceInfo$dev;
|
|
472
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
473
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
349
474
|
case 0:
|
|
350
475
|
_Logger.default.log("Resuming keepalive after ".concat(retryAfter, " seconds"), {
|
|
351
476
|
file: _constants2.REGISTRATION_FILE,
|
|
@@ -353,22 +478,22 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
353
478
|
});
|
|
354
479
|
|
|
355
480
|
// Resume the keepalive after waiting for the retry after period
|
|
356
|
-
|
|
357
|
-
return
|
|
358
|
-
case
|
|
481
|
+
_context7.next = 1;
|
|
482
|
+
return _this2.startKeepaliveTimer((_this2$deviceInfo$dev = _this2.deviceInfo.device) === null || _this2$deviceInfo$dev === void 0 ? void 0 : _this2$deviceInfo$dev.uri, _this2.deviceInfo.keepaliveInterval, 'UNKNOWN');
|
|
483
|
+
case 1:
|
|
359
484
|
case "end":
|
|
360
|
-
return
|
|
485
|
+
return _context7.stop();
|
|
361
486
|
}
|
|
362
|
-
},
|
|
487
|
+
}, _callee7);
|
|
363
488
|
})), retryAfter * 1000);
|
|
364
489
|
} else {
|
|
365
490
|
this.retryAfter = retryAfter;
|
|
366
491
|
}
|
|
367
|
-
case
|
|
492
|
+
case 5:
|
|
368
493
|
case "end":
|
|
369
|
-
return
|
|
494
|
+
return _context8.stop();
|
|
370
495
|
}
|
|
371
|
-
},
|
|
496
|
+
}, _callee8, this);
|
|
372
497
|
}));
|
|
373
498
|
function handle429Retry(_x7, _x8) {
|
|
374
499
|
return _handle429Retry.apply(this, arguments);
|
|
@@ -399,8 +524,8 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
399
524
|
}, {
|
|
400
525
|
key: "startFailoverTimer",
|
|
401
526
|
value: (function () {
|
|
402
|
-
var _startFailoverTimer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
403
|
-
var
|
|
527
|
+
var _startFailoverTimer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
528
|
+
var _this3 = this;
|
|
404
529
|
var attempt,
|
|
405
530
|
timeElapsed,
|
|
406
531
|
loggerContext,
|
|
@@ -409,12 +534,12 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
409
534
|
excessVal,
|
|
410
535
|
abort,
|
|
411
536
|
scheduledTime,
|
|
412
|
-
|
|
413
|
-
return _regenerator.default.wrap(function
|
|
414
|
-
while (1) switch (
|
|
537
|
+
_args11 = arguments;
|
|
538
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
539
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
415
540
|
case 0:
|
|
416
|
-
attempt =
|
|
417
|
-
timeElapsed =
|
|
541
|
+
attempt = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : 1;
|
|
542
|
+
timeElapsed = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : 0;
|
|
418
543
|
loggerContext = {
|
|
419
544
|
file: _constants2.REGISTRATION_FILE,
|
|
420
545
|
method: _constants2.FAILOVER_UTIL
|
|
@@ -429,116 +554,128 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
429
554
|
this.failoverImmediately = this.retryAfter + timeElapsed > TIMER_THRESHOLD;
|
|
430
555
|
}
|
|
431
556
|
if (!(interval > _constants2.BASE_REG_RETRY_TIMER_VAL_IN_SEC && !this.failoverImmediately)) {
|
|
432
|
-
|
|
557
|
+
_context11.next = 1;
|
|
433
558
|
break;
|
|
434
559
|
}
|
|
435
560
|
scheduledTime = Math.floor((0, _now.default)() / 1000);
|
|
436
561
|
if (this.retryAfter != null) {
|
|
437
562
|
interval = Math.max(interval, this.retryAfter);
|
|
438
563
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
564
|
+
this.saveFailoverState({
|
|
565
|
+
attempt: attempt,
|
|
566
|
+
timeElapsed: timeElapsed,
|
|
567
|
+
retryScheduledTime: scheduledTime,
|
|
568
|
+
serverType: 'primary'
|
|
569
|
+
});
|
|
570
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
571
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
572
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
442
573
|
case 0:
|
|
443
|
-
|
|
444
|
-
return
|
|
574
|
+
_context0.next = 1;
|
|
575
|
+
return _this3.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
445
576
|
var currentTime;
|
|
446
|
-
return _regenerator.default.wrap(function
|
|
447
|
-
while (1) switch (
|
|
577
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
578
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
448
579
|
case 0:
|
|
449
|
-
|
|
450
|
-
return
|
|
451
|
-
case
|
|
452
|
-
abort =
|
|
580
|
+
_context9.next = 1;
|
|
581
|
+
return _this3.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL);
|
|
582
|
+
case 1:
|
|
583
|
+
abort = _context9.sent;
|
|
453
584
|
currentTime = Math.floor((0, _now.default)() / 1000);
|
|
454
|
-
if (!(!abort && !
|
|
455
|
-
|
|
585
|
+
if (!(!abort && !_this3.isDeviceRegistered())) {
|
|
586
|
+
_context9.next = 2;
|
|
456
587
|
break;
|
|
457
588
|
}
|
|
458
|
-
|
|
459
|
-
return
|
|
460
|
-
case
|
|
589
|
+
_context9.next = 2;
|
|
590
|
+
return _this3.startFailoverTimer(attempt + 1, timeElapsed + (currentTime - scheduledTime));
|
|
591
|
+
case 2:
|
|
461
592
|
case "end":
|
|
462
|
-
return
|
|
593
|
+
return _context9.stop();
|
|
463
594
|
}
|
|
464
|
-
},
|
|
595
|
+
}, _callee9);
|
|
465
596
|
})));
|
|
466
|
-
case
|
|
597
|
+
case 1:
|
|
467
598
|
case "end":
|
|
468
|
-
return
|
|
599
|
+
return _context0.stop();
|
|
469
600
|
}
|
|
470
|
-
},
|
|
601
|
+
}, _callee0);
|
|
471
602
|
})), interval * _constants2.SEC_TO_MSEC_MFACTOR);
|
|
472
603
|
_Logger.default.log("Scheduled retry with primary in ".concat(interval, " seconds, number of attempts : ").concat(attempt), loggerContext);
|
|
473
|
-
|
|
604
|
+
_context11.next = 5;
|
|
474
605
|
break;
|
|
475
|
-
case
|
|
606
|
+
case 1:
|
|
476
607
|
if (!this.backupMobiusUris.length) {
|
|
477
|
-
|
|
608
|
+
_context11.next = 3;
|
|
478
609
|
break;
|
|
479
610
|
}
|
|
611
|
+
this.saveFailoverState({
|
|
612
|
+
attempt: attempt,
|
|
613
|
+
timeElapsed: timeElapsed,
|
|
614
|
+
retryScheduledTime: Math.floor((0, _now.default)() / 1000),
|
|
615
|
+
serverType: 'backup'
|
|
616
|
+
});
|
|
480
617
|
_Logger.default.info('Failing over to backup servers.', loggerContext);
|
|
481
618
|
this.failoverImmediately = false;
|
|
482
|
-
|
|
619
|
+
_context11.next = 2;
|
|
483
620
|
return this.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL, this.backupMobiusUris);
|
|
484
|
-
case
|
|
485
|
-
abort =
|
|
621
|
+
case 2:
|
|
622
|
+
abort = _context11.sent;
|
|
486
623
|
if (!abort && !this.isDeviceRegistered()) {
|
|
487
624
|
interval = this.getRegRetryInterval();
|
|
488
625
|
if (this.retryAfter != null && this.retryAfter < _constants2.RETRY_TIMER_UPPER_LIMIT) {
|
|
489
626
|
interval = interval < this.retryAfter ? this.retryAfter : interval;
|
|
490
627
|
}
|
|
491
|
-
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
492
|
-
return _regenerator.default.wrap(function
|
|
493
|
-
while (1) switch (
|
|
628
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
629
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
630
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
494
631
|
case 0:
|
|
495
|
-
|
|
496
|
-
return
|
|
497
|
-
return _regenerator.default.wrap(function
|
|
498
|
-
while (1) switch (
|
|
632
|
+
_context10.next = 1;
|
|
633
|
+
return _this3.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
634
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
635
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
499
636
|
case 0:
|
|
500
|
-
|
|
501
|
-
return
|
|
502
|
-
case
|
|
503
|
-
abort =
|
|
504
|
-
if (!(!abort && !
|
|
505
|
-
|
|
637
|
+
_context1.next = 1;
|
|
638
|
+
return _this3.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL, _this3.backupMobiusUris);
|
|
639
|
+
case 1:
|
|
640
|
+
abort = _context1.sent;
|
|
641
|
+
if (!(!abort && !_this3.isDeviceRegistered())) {
|
|
642
|
+
_context1.next = 3;
|
|
506
643
|
break;
|
|
507
644
|
}
|
|
508
|
-
|
|
645
|
+
_context1.next = 2;
|
|
509
646
|
return (0, _common.uploadLogs)();
|
|
510
|
-
case
|
|
647
|
+
case 2:
|
|
511
648
|
(0, _common.emitFinalFailure)(function (clientError) {
|
|
512
|
-
|
|
649
|
+
_this3.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
|
|
513
650
|
}, loggerContext);
|
|
514
|
-
case
|
|
651
|
+
case 3:
|
|
515
652
|
case "end":
|
|
516
|
-
return
|
|
653
|
+
return _context1.stop();
|
|
517
654
|
}
|
|
518
|
-
},
|
|
655
|
+
}, _callee1);
|
|
519
656
|
})));
|
|
520
|
-
case
|
|
657
|
+
case 1:
|
|
521
658
|
case "end":
|
|
522
|
-
return
|
|
659
|
+
return _context10.stop();
|
|
523
660
|
}
|
|
524
|
-
},
|
|
661
|
+
}, _callee10);
|
|
525
662
|
})), interval * _constants2.SEC_TO_MSEC_MFACTOR);
|
|
526
663
|
_Logger.default.log("Scheduled retry with backup servers in ".concat(interval, " seconds."), loggerContext);
|
|
527
664
|
}
|
|
528
|
-
|
|
665
|
+
_context11.next = 5;
|
|
529
666
|
break;
|
|
530
|
-
case
|
|
531
|
-
|
|
667
|
+
case 3:
|
|
668
|
+
_context11.next = 4;
|
|
532
669
|
return (0, _common.uploadLogs)();
|
|
533
|
-
case
|
|
670
|
+
case 4:
|
|
534
671
|
(0, _common.emitFinalFailure)(function (clientError) {
|
|
535
|
-
|
|
672
|
+
_this3.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
|
|
536
673
|
}, loggerContext);
|
|
537
|
-
case
|
|
674
|
+
case 5:
|
|
538
675
|
case "end":
|
|
539
|
-
return
|
|
676
|
+
return _context11.stop();
|
|
540
677
|
}
|
|
541
|
-
},
|
|
678
|
+
}, _callee11, this);
|
|
542
679
|
}));
|
|
543
680
|
function startFailoverTimer() {
|
|
544
681
|
return _startFailoverTimer.apply(this, arguments);
|
|
@@ -560,34 +697,34 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
560
697
|
}, {
|
|
561
698
|
key: "isPrimaryActive",
|
|
562
699
|
value: function () {
|
|
563
|
-
var _isPrimaryActive = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
564
|
-
var status, _iterator, _step, mobiusUrl, baseUri, response,
|
|
565
|
-
return _regenerator.default.wrap(function
|
|
566
|
-
while (1) switch (
|
|
700
|
+
var _isPrimaryActive = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
701
|
+
var status, _iterator, _step, mobiusUrl, baseUri, response, _ref7, statusCode, _t1, _t10;
|
|
702
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
703
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
567
704
|
case 0:
|
|
568
705
|
_iterator = _createForOfIteratorHelper(this.primaryMobiusUris);
|
|
569
|
-
|
|
706
|
+
_context12.prev = 1;
|
|
570
707
|
_iterator.s();
|
|
571
|
-
case
|
|
708
|
+
case 2:
|
|
572
709
|
if ((_step = _iterator.n()).done) {
|
|
573
|
-
|
|
710
|
+
_context12.next = 8;
|
|
574
711
|
break;
|
|
575
712
|
}
|
|
576
713
|
mobiusUrl = _step.value;
|
|
577
|
-
|
|
714
|
+
_context12.prev = 3;
|
|
578
715
|
baseUri = mobiusUrl.replace(_constants2.URL_ENDPOINT, '/'); // eslint-disable-next-line no-await-in-loop
|
|
579
|
-
|
|
716
|
+
_context12.next = 4;
|
|
580
717
|
return this.webex.request({
|
|
581
718
|
uri: "".concat(baseUri, "ping"),
|
|
582
719
|
method: _types2.HTTP_METHODS.GET,
|
|
583
720
|
headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, this.webex.internal.device.url), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
|
|
584
721
|
service: _types2.ALLOWED_SERVICES.MOBIUS
|
|
585
722
|
});
|
|
586
|
-
case
|
|
587
|
-
response =
|
|
588
|
-
|
|
723
|
+
case 4:
|
|
724
|
+
response = _context12.sent;
|
|
725
|
+
_ref7 = response, statusCode = _ref7.statusCode;
|
|
589
726
|
if (!(statusCode === 200)) {
|
|
590
|
-
|
|
727
|
+
_context12.next = 5;
|
|
591
728
|
break;
|
|
592
729
|
}
|
|
593
730
|
_Logger.default.info("Ping successful for primary Mobius: ".concat(mobiusUrl), {
|
|
@@ -595,39 +732,39 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
595
732
|
method: _constants2.FAILBACK_UTIL
|
|
596
733
|
});
|
|
597
734
|
status = 'up';
|
|
598
|
-
return
|
|
599
|
-
case
|
|
600
|
-
|
|
735
|
+
return _context12.abrupt("continue", 8);
|
|
736
|
+
case 5:
|
|
737
|
+
_context12.next = 7;
|
|
601
738
|
break;
|
|
602
|
-
case
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
_Logger.default.warn("Ping failed for primary Mobius: ".concat(mobiusUrl, " with error: ").concat(
|
|
739
|
+
case 6:
|
|
740
|
+
_context12.prev = 6;
|
|
741
|
+
_t1 = _context12["catch"](3);
|
|
742
|
+
_Logger.default.warn("Ping failed for primary Mobius: ".concat(mobiusUrl, " with error: ").concat((0, _stringify.default)(_t1)), {
|
|
606
743
|
file: _constants2.REGISTRATION_FILE,
|
|
607
744
|
method: _constants2.FAILBACK_UTIL
|
|
608
745
|
});
|
|
609
746
|
status = 'down';
|
|
610
|
-
case
|
|
611
|
-
|
|
747
|
+
case 7:
|
|
748
|
+
_context12.next = 2;
|
|
612
749
|
break;
|
|
613
|
-
case
|
|
614
|
-
|
|
750
|
+
case 8:
|
|
751
|
+
_context12.next = 10;
|
|
615
752
|
break;
|
|
616
|
-
case
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
_iterator.e(
|
|
620
|
-
case
|
|
621
|
-
|
|
753
|
+
case 9:
|
|
754
|
+
_context12.prev = 9;
|
|
755
|
+
_t10 = _context12["catch"](1);
|
|
756
|
+
_iterator.e(_t10);
|
|
757
|
+
case 10:
|
|
758
|
+
_context12.prev = 10;
|
|
622
759
|
_iterator.f();
|
|
623
|
-
return
|
|
624
|
-
case
|
|
625
|
-
return
|
|
626
|
-
case
|
|
760
|
+
return _context12.finish(10);
|
|
761
|
+
case 11:
|
|
762
|
+
return _context12.abrupt("return", status === 'up');
|
|
763
|
+
case 12:
|
|
627
764
|
case "end":
|
|
628
|
-
return
|
|
765
|
+
return _context12.stop();
|
|
629
766
|
}
|
|
630
|
-
},
|
|
767
|
+
}, _callee12, this, [[1, 9, 10, 11], [3, 6]]);
|
|
631
768
|
}));
|
|
632
769
|
function isPrimaryActive() {
|
|
633
770
|
return _isPrimaryActive.apply(this, arguments);
|
|
@@ -679,17 +816,17 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
679
816
|
}, {
|
|
680
817
|
key: "startFailbackTimer",
|
|
681
818
|
value: function startFailbackTimer(intervalInSeconds) {
|
|
682
|
-
var
|
|
683
|
-
this.failbackTimer = setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
684
|
-
return _regenerator.default.wrap(function
|
|
685
|
-
while (1) switch (
|
|
819
|
+
var _this4 = this;
|
|
820
|
+
this.failbackTimer = setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
821
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
822
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
686
823
|
case 0:
|
|
687
|
-
return
|
|
824
|
+
return _context13.abrupt("return", _this4.executeFailback());
|
|
688
825
|
case 1:
|
|
689
826
|
case "end":
|
|
690
|
-
return
|
|
827
|
+
return _context13.stop();
|
|
691
828
|
}
|
|
692
|
-
},
|
|
829
|
+
}, _callee13);
|
|
693
830
|
})), intervalInSeconds * _constants2.SEC_TO_MSEC_MFACTOR);
|
|
694
831
|
_Logger.default.log("Failback scheduled after ".concat(intervalInSeconds, " seconds."), {
|
|
695
832
|
file: _constants2.REGISTRATION_FILE,
|
|
@@ -704,90 +841,90 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
704
841
|
}, {
|
|
705
842
|
key: "executeFailback",
|
|
706
843
|
value: (function () {
|
|
707
|
-
var _executeFailback = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
708
|
-
var
|
|
709
|
-
return _regenerator.default.wrap(function
|
|
710
|
-
while (1) switch (
|
|
844
|
+
var _executeFailback = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
845
|
+
var _this5 = this;
|
|
846
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
847
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
711
848
|
case 0:
|
|
712
|
-
|
|
713
|
-
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
849
|
+
_context15.next = 1;
|
|
850
|
+
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
714
851
|
var primaryServerStatus, abort, abortNew;
|
|
715
|
-
return _regenerator.default.wrap(function
|
|
716
|
-
while (1) switch (
|
|
852
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
853
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
717
854
|
case 0:
|
|
718
|
-
if (!
|
|
719
|
-
|
|
855
|
+
if (!_this5.isFailbackRequired()) {
|
|
856
|
+
_context14.next = 11;
|
|
720
857
|
break;
|
|
721
858
|
}
|
|
722
|
-
|
|
723
|
-
return
|
|
724
|
-
case
|
|
725
|
-
primaryServerStatus =
|
|
726
|
-
if (!((0, _keys.default)(
|
|
727
|
-
|
|
859
|
+
_context14.next = 1;
|
|
860
|
+
return _this5.isPrimaryActive();
|
|
861
|
+
case 1:
|
|
862
|
+
primaryServerStatus = _context14.sent;
|
|
863
|
+
if (!((0, _keys.default)(_this5.callManager.getActiveCalls()).length === 0 && primaryServerStatus)) {
|
|
864
|
+
_context14.next = 10;
|
|
728
865
|
break;
|
|
729
866
|
}
|
|
730
867
|
_Logger.default.info("Attempting failback to primary.", {
|
|
731
868
|
file: _constants2.REGISTRATION_FILE,
|
|
732
|
-
method:
|
|
869
|
+
method: _this5.executeFailback.name
|
|
733
870
|
});
|
|
734
|
-
|
|
735
|
-
return
|
|
736
|
-
case
|
|
737
|
-
|
|
738
|
-
return
|
|
739
|
-
case
|
|
740
|
-
abort =
|
|
741
|
-
if (!(
|
|
742
|
-
|
|
871
|
+
_context14.next = 2;
|
|
872
|
+
return _this5.deregister();
|
|
873
|
+
case 2:
|
|
874
|
+
_context14.next = 3;
|
|
875
|
+
return _this5.attemptRegistrationWithServers(_constants2.FAILBACK_UTIL);
|
|
876
|
+
case 3:
|
|
877
|
+
abort = _context14.sent;
|
|
878
|
+
if (!(_this5.scheduled429Retry || abort || _this5.isDeviceRegistered())) {
|
|
879
|
+
_context14.next = 4;
|
|
743
880
|
break;
|
|
744
881
|
}
|
|
745
|
-
return
|
|
746
|
-
case
|
|
747
|
-
|
|
748
|
-
return
|
|
749
|
-
case
|
|
750
|
-
abortNew =
|
|
882
|
+
return _context14.abrupt("return");
|
|
883
|
+
case 4:
|
|
884
|
+
_context14.next = 5;
|
|
885
|
+
return _this5.restorePreviousRegistration(_constants2.FAILBACK_UTIL);
|
|
886
|
+
case 5:
|
|
887
|
+
abortNew = _context14.sent;
|
|
751
888
|
if (!abortNew) {
|
|
752
|
-
|
|
889
|
+
_context14.next = 6;
|
|
753
890
|
break;
|
|
754
891
|
}
|
|
755
|
-
|
|
756
|
-
return
|
|
757
|
-
case
|
|
758
|
-
if (
|
|
759
|
-
|
|
892
|
+
_this5.clearFailbackTimer();
|
|
893
|
+
return _context14.abrupt("return");
|
|
894
|
+
case 6:
|
|
895
|
+
if (_this5.isDeviceRegistered()) {
|
|
896
|
+
_context14.next = 8;
|
|
760
897
|
break;
|
|
761
898
|
}
|
|
762
|
-
|
|
763
|
-
return
|
|
764
|
-
case
|
|
765
|
-
|
|
899
|
+
_context14.next = 7;
|
|
900
|
+
return _this5.restartRegistration(_this5.executeFailback.name);
|
|
901
|
+
case 7:
|
|
902
|
+
_context14.next = 9;
|
|
766
903
|
break;
|
|
767
|
-
case
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
case
|
|
771
|
-
|
|
904
|
+
case 8:
|
|
905
|
+
_this5.failbackTimer = undefined;
|
|
906
|
+
_this5.initiateFailback();
|
|
907
|
+
case 9:
|
|
908
|
+
_context14.next = 11;
|
|
772
909
|
break;
|
|
773
|
-
case
|
|
910
|
+
case 10:
|
|
774
911
|
_Logger.default.info('Active calls present or primary Mobius is down, deferring failback to next cycle.', {
|
|
775
912
|
file: _constants2.REGISTRATION_FILE,
|
|
776
|
-
method:
|
|
913
|
+
method: _this5.executeFailback.name
|
|
777
914
|
});
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
case
|
|
915
|
+
_this5.failbackTimer = undefined;
|
|
916
|
+
_this5.initiateFailback();
|
|
917
|
+
case 11:
|
|
781
918
|
case "end":
|
|
782
|
-
return
|
|
919
|
+
return _context14.stop();
|
|
783
920
|
}
|
|
784
|
-
},
|
|
921
|
+
}, _callee14);
|
|
785
922
|
})));
|
|
786
|
-
case
|
|
923
|
+
case 1:
|
|
787
924
|
case "end":
|
|
788
|
-
return
|
|
925
|
+
return _context15.stop();
|
|
789
926
|
}
|
|
790
|
-
},
|
|
927
|
+
}, _callee15, this);
|
|
791
928
|
}));
|
|
792
929
|
function executeFailback() {
|
|
793
930
|
return _executeFailback.apply(this, arguments);
|
|
@@ -850,10 +987,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
850
987
|
}, {
|
|
851
988
|
key: "restartRegistration",
|
|
852
989
|
value: (function () {
|
|
853
|
-
var _restartRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
990
|
+
var _restartRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16(caller) {
|
|
854
991
|
var abort;
|
|
855
|
-
return _regenerator.default.wrap(function
|
|
856
|
-
while (1) switch (
|
|
992
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
993
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
857
994
|
case 0:
|
|
858
995
|
/*
|
|
859
996
|
* Cancel any failback timer running
|
|
@@ -861,21 +998,21 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
861
998
|
*/
|
|
862
999
|
this.clearFailbackTimer();
|
|
863
1000
|
this.failback429RetryAttempts = 0;
|
|
864
|
-
|
|
1001
|
+
_context16.next = 1;
|
|
865
1002
|
return this.attemptRegistrationWithServers(caller, this.primaryMobiusUris);
|
|
866
|
-
case
|
|
867
|
-
abort =
|
|
1003
|
+
case 1:
|
|
1004
|
+
abort = _context16.sent;
|
|
868
1005
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
869
|
-
|
|
1006
|
+
_context16.next = 2;
|
|
870
1007
|
break;
|
|
871
1008
|
}
|
|
872
|
-
|
|
1009
|
+
_context16.next = 2;
|
|
873
1010
|
return this.startFailoverTimer();
|
|
874
|
-
case
|
|
1011
|
+
case 2:
|
|
875
1012
|
case "end":
|
|
876
|
-
return
|
|
1013
|
+
return _context16.stop();
|
|
877
1014
|
}
|
|
878
|
-
},
|
|
1015
|
+
}, _callee16, this);
|
|
879
1016
|
}));
|
|
880
1017
|
function restartRegistration(_x9) {
|
|
881
1018
|
return _restartRegistration.apply(this, arguments);
|
|
@@ -891,66 +1028,66 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
891
1028
|
}, {
|
|
892
1029
|
key: "handleConnectionRestoration",
|
|
893
1030
|
value: (function () {
|
|
894
|
-
var _handleConnectionRestoration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
895
|
-
var
|
|
896
|
-
return _regenerator.default.wrap(function
|
|
897
|
-
while (1) switch (
|
|
1031
|
+
var _handleConnectionRestoration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18(retry) {
|
|
1032
|
+
var _this6 = this;
|
|
1033
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1034
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
898
1035
|
case 0:
|
|
899
1036
|
_Logger.default.info(_constants.METHOD_START_MESSAGE, {
|
|
900
1037
|
method: _constants2.METHODS.HANDLE_CONNECTION_RESTORATION,
|
|
901
1038
|
file: _constants2.REGISTRATION_FILE
|
|
902
1039
|
});
|
|
903
|
-
|
|
904
|
-
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1040
|
+
_context18.next = 1;
|
|
1041
|
+
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
905
1042
|
var abort;
|
|
906
|
-
return _regenerator.default.wrap(function
|
|
907
|
-
while (1) switch (
|
|
1043
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
1044
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
908
1045
|
case 0:
|
|
909
1046
|
if (!retry) {
|
|
910
|
-
|
|
1047
|
+
_context17.next = 4;
|
|
911
1048
|
break;
|
|
912
1049
|
}
|
|
913
1050
|
_Logger.default.log('Network is up again, re-registering with Webex Calling if needed', {
|
|
914
1051
|
file: _constants2.REGISTRATION_FILE,
|
|
915
1052
|
method: _constants2.METHODS.HANDLE_CONNECTION_RESTORATION
|
|
916
1053
|
});
|
|
917
|
-
|
|
918
|
-
if (!
|
|
919
|
-
|
|
1054
|
+
_this6.clearKeepaliveTimer();
|
|
1055
|
+
if (!_this6.isDeviceRegistered()) {
|
|
1056
|
+
_context17.next = 1;
|
|
920
1057
|
break;
|
|
921
1058
|
}
|
|
922
|
-
|
|
923
|
-
return
|
|
924
|
-
case
|
|
925
|
-
if (!
|
|
926
|
-
|
|
1059
|
+
_context17.next = 1;
|
|
1060
|
+
return _this6.deregister();
|
|
1061
|
+
case 1:
|
|
1062
|
+
if (!_this6.activeMobiusUrl) {
|
|
1063
|
+
_context17.next = 3;
|
|
927
1064
|
break;
|
|
928
1065
|
}
|
|
929
|
-
|
|
930
|
-
return
|
|
931
|
-
case
|
|
932
|
-
abort =
|
|
933
|
-
if (!(!abort && !
|
|
934
|
-
|
|
1066
|
+
_context17.next = 2;
|
|
1067
|
+
return _this6.restorePreviousRegistration(_constants2.METHODS.HANDLE_CONNECTION_RESTORATION);
|
|
1068
|
+
case 2:
|
|
1069
|
+
abort = _context17.sent;
|
|
1070
|
+
if (!(!abort && !_this6.isDeviceRegistered())) {
|
|
1071
|
+
_context17.next = 3;
|
|
935
1072
|
break;
|
|
936
1073
|
}
|
|
937
|
-
|
|
938
|
-
return
|
|
939
|
-
case
|
|
1074
|
+
_context17.next = 3;
|
|
1075
|
+
return _this6.restartRegistration(_constants2.METHODS.HANDLE_CONNECTION_RESTORATION);
|
|
1076
|
+
case 3:
|
|
940
1077
|
retry = false;
|
|
941
|
-
case
|
|
1078
|
+
case 4:
|
|
942
1079
|
case "end":
|
|
943
|
-
return
|
|
1080
|
+
return _context17.stop();
|
|
944
1081
|
}
|
|
945
|
-
},
|
|
1082
|
+
}, _callee17);
|
|
946
1083
|
})));
|
|
947
|
-
case
|
|
948
|
-
return
|
|
949
|
-
case
|
|
1084
|
+
case 1:
|
|
1085
|
+
return _context18.abrupt("return", retry);
|
|
1086
|
+
case 2:
|
|
950
1087
|
case "end":
|
|
951
|
-
return
|
|
1088
|
+
return _context18.stop();
|
|
952
1089
|
}
|
|
953
|
-
},
|
|
1090
|
+
}, _callee18, this);
|
|
954
1091
|
}));
|
|
955
1092
|
function handleConnectionRestoration(_x0) {
|
|
956
1093
|
return _handleConnectionRestoration.apply(this, arguments);
|
|
@@ -966,56 +1103,56 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
966
1103
|
}, {
|
|
967
1104
|
key: "restoreRegistrationCallBack",
|
|
968
1105
|
value: function restoreRegistrationCallBack() {
|
|
969
|
-
var
|
|
1106
|
+
var _this7 = this;
|
|
970
1107
|
return /*#__PURE__*/function () {
|
|
971
|
-
var
|
|
1108
|
+
var _ref1 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19(restoreData, caller) {
|
|
972
1109
|
var logContext, restore, finalError;
|
|
973
|
-
return _regenerator.default.wrap(function
|
|
974
|
-
while (1) switch (
|
|
1110
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1111
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
975
1112
|
case 0:
|
|
976
1113
|
logContext = {
|
|
977
1114
|
file: _constants2.REGISTRATION_FILE,
|
|
978
1115
|
method: caller
|
|
979
1116
|
};
|
|
980
|
-
if (
|
|
981
|
-
|
|
1117
|
+
if (_this7.isRegRetry()) {
|
|
1118
|
+
_context19.next = 4;
|
|
982
1119
|
break;
|
|
983
1120
|
}
|
|
984
1121
|
_Logger.default.info('Registration restoration in progress.', logContext);
|
|
985
|
-
restore =
|
|
1122
|
+
restore = _this7.getExistingDevice(restoreData);
|
|
986
1123
|
if (!restore) {
|
|
987
|
-
|
|
1124
|
+
_context19.next = 3;
|
|
988
1125
|
break;
|
|
989
1126
|
}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
return
|
|
993
|
-
case
|
|
994
|
-
|
|
995
|
-
return
|
|
996
|
-
case
|
|
997
|
-
finalError =
|
|
998
|
-
|
|
999
|
-
if (
|
|
1127
|
+
_this7.setRegRetry(true);
|
|
1128
|
+
_context19.next = 1;
|
|
1129
|
+
return _this7.deregister();
|
|
1130
|
+
case 1:
|
|
1131
|
+
_context19.next = 2;
|
|
1132
|
+
return _this7.restorePreviousRegistration(caller);
|
|
1133
|
+
case 2:
|
|
1134
|
+
finalError = _context19.sent;
|
|
1135
|
+
_this7.setRegRetry(false);
|
|
1136
|
+
if (_this7.isDeviceRegistered()) {
|
|
1000
1137
|
_Logger.default.info('Registration restored successfully.', logContext);
|
|
1001
1138
|
}
|
|
1002
|
-
return
|
|
1003
|
-
case
|
|
1004
|
-
|
|
1005
|
-
|
|
1139
|
+
return _context19.abrupt("return", finalError);
|
|
1140
|
+
case 3:
|
|
1141
|
+
_this7.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
1142
|
+
_context19.next = 5;
|
|
1006
1143
|
break;
|
|
1007
|
-
case
|
|
1008
|
-
|
|
1009
|
-
case
|
|
1010
|
-
return
|
|
1011
|
-
case
|
|
1144
|
+
case 4:
|
|
1145
|
+
_this7.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
1146
|
+
case 5:
|
|
1147
|
+
return _context19.abrupt("return", false);
|
|
1148
|
+
case 6:
|
|
1012
1149
|
case "end":
|
|
1013
|
-
return
|
|
1150
|
+
return _context19.stop();
|
|
1014
1151
|
}
|
|
1015
|
-
},
|
|
1152
|
+
}, _callee19);
|
|
1016
1153
|
}));
|
|
1017
1154
|
return function (_x1, _x10) {
|
|
1018
|
-
return
|
|
1155
|
+
return _ref1.apply(this, arguments);
|
|
1019
1156
|
};
|
|
1020
1157
|
}();
|
|
1021
1158
|
}
|
|
@@ -1027,30 +1164,39 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1027
1164
|
}, {
|
|
1028
1165
|
key: "triggerRegistration",
|
|
1029
1166
|
value: (function () {
|
|
1030
|
-
var _triggerRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1167
|
+
var _triggerRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1031
1168
|
var abort;
|
|
1032
|
-
return _regenerator.default.wrap(function
|
|
1033
|
-
while (1) switch (
|
|
1169
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1170
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1034
1171
|
case 0:
|
|
1172
|
+
_context20.next = 1;
|
|
1173
|
+
return this.resumeFailover();
|
|
1174
|
+
case 1:
|
|
1175
|
+
if (!_context20.sent) {
|
|
1176
|
+
_context20.next = 2;
|
|
1177
|
+
break;
|
|
1178
|
+
}
|
|
1179
|
+
return _context20.abrupt("return");
|
|
1180
|
+
case 2:
|
|
1035
1181
|
if (!(this.primaryMobiusUris.length > 0)) {
|
|
1036
|
-
|
|
1182
|
+
_context20.next = 4;
|
|
1037
1183
|
break;
|
|
1038
1184
|
}
|
|
1039
|
-
|
|
1185
|
+
_context20.next = 3;
|
|
1040
1186
|
return this.attemptRegistrationWithServers(_constants2.REGISTRATION_UTIL, this.primaryMobiusUris);
|
|
1041
1187
|
case 3:
|
|
1042
|
-
abort =
|
|
1188
|
+
abort = _context20.sent;
|
|
1043
1189
|
if (!(!this.isDeviceRegistered() && !abort)) {
|
|
1044
|
-
|
|
1190
|
+
_context20.next = 4;
|
|
1045
1191
|
break;
|
|
1046
1192
|
}
|
|
1047
|
-
|
|
1193
|
+
_context20.next = 4;
|
|
1048
1194
|
return this.startFailoverTimer();
|
|
1049
|
-
case
|
|
1195
|
+
case 4:
|
|
1050
1196
|
case "end":
|
|
1051
|
-
return
|
|
1197
|
+
return _context20.stop();
|
|
1052
1198
|
}
|
|
1053
|
-
},
|
|
1199
|
+
}, _callee20, this);
|
|
1054
1200
|
}));
|
|
1055
1201
|
function triggerRegistration() {
|
|
1056
1202
|
return _triggerRegistration.apply(this, arguments);
|
|
@@ -1069,156 +1215,158 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1069
1215
|
}, {
|
|
1070
1216
|
key: "attemptRegistrationWithServers",
|
|
1071
1217
|
value: (function () {
|
|
1072
|
-
var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1073
|
-
var
|
|
1218
|
+
var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21(caller) {
|
|
1219
|
+
var _this8 = this;
|
|
1074
1220
|
var servers,
|
|
1075
1221
|
abort,
|
|
1076
1222
|
_iterator2,
|
|
1077
1223
|
_step2,
|
|
1078
1224
|
_loop,
|
|
1079
1225
|
_ret,
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1226
|
+
_args22 = arguments,
|
|
1227
|
+
_t12;
|
|
1228
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
1229
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1083
1230
|
case 0:
|
|
1084
|
-
servers =
|
|
1231
|
+
servers = _args22.length > 1 && _args22[1] !== undefined ? _args22[1] : this.primaryMobiusUris;
|
|
1085
1232
|
abort = false;
|
|
1086
1233
|
this.retryAfter = undefined;
|
|
1087
1234
|
if (!this.failoverImmediately) {
|
|
1088
|
-
|
|
1235
|
+
_context22.next = 1;
|
|
1089
1236
|
break;
|
|
1090
1237
|
}
|
|
1091
|
-
return
|
|
1092
|
-
case
|
|
1238
|
+
return _context22.abrupt("return", abort);
|
|
1239
|
+
case 1:
|
|
1093
1240
|
if (!this.isDeviceRegistered()) {
|
|
1094
|
-
|
|
1241
|
+
_context22.next = 2;
|
|
1095
1242
|
break;
|
|
1096
1243
|
}
|
|
1097
1244
|
_Logger.default.info("[".concat(caller, "] : Device already registered with : ").concat(this.activeMobiusUrl), {
|
|
1098
1245
|
file: _constants2.REGISTRATION_FILE,
|
|
1099
1246
|
method: _constants2.REGISTER_UTIL
|
|
1100
1247
|
});
|
|
1101
|
-
return
|
|
1102
|
-
case
|
|
1248
|
+
return _context22.abrupt("return", abort);
|
|
1249
|
+
case 2:
|
|
1103
1250
|
_iterator2 = _createForOfIteratorHelper(servers);
|
|
1104
|
-
|
|
1251
|
+
_context22.prev = 3;
|
|
1105
1252
|
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
|
|
1106
|
-
var
|
|
1107
|
-
var url, serverType,
|
|
1108
|
-
return _regenerator.default.wrap(function
|
|
1109
|
-
while (1) switch (
|
|
1253
|
+
var _this8$backupMobiusUr;
|
|
1254
|
+
var url, serverType, _this8$deviceInfo$dev, _resp$headers, _resp$headers$trackin, _resp$headers2, _this8$deviceInfo$dev2, resp, body, _t11;
|
|
1255
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
1256
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1110
1257
|
case 0:
|
|
1111
1258
|
url = _step2.value;
|
|
1112
|
-
serverType =
|
|
1113
|
-
|
|
1259
|
+
serverType = _this8.primaryMobiusUris.includes(url) && 'PRIMARY' || ((_this8$backupMobiusUr = _this8.backupMobiusUris) === null || _this8$backupMobiusUr === void 0 ? void 0 : _this8$backupMobiusUr.includes(url)) && 'BACKUP' || 'UNKNOWN';
|
|
1260
|
+
_context21.prev = 1;
|
|
1114
1261
|
abort = false;
|
|
1115
|
-
|
|
1116
|
-
|
|
1262
|
+
_this8.registrationStatus = _types2.RegistrationStatus.INACTIVE;
|
|
1263
|
+
_this8.lineEmitter(_types3.LINE_EVENTS.CONNECTING);
|
|
1117
1264
|
_Logger.default.info("[".concat(caller, "] : Mobius url to contact: ").concat(url), {
|
|
1118
1265
|
file: _constants2.REGISTRATION_FILE,
|
|
1119
1266
|
method: _constants2.REGISTER_UTIL
|
|
1120
1267
|
});
|
|
1121
1268
|
// eslint-disable-next-line no-await-in-loop
|
|
1122
|
-
|
|
1123
|
-
return
|
|
1124
|
-
case
|
|
1125
|
-
resp =
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1269
|
+
_context21.next = 2;
|
|
1270
|
+
return _this8.postRegistration(url);
|
|
1271
|
+
case 2:
|
|
1272
|
+
resp = _context21.sent;
|
|
1273
|
+
_this8.clearFailoverState();
|
|
1274
|
+
_this8.deviceInfo = resp.body;
|
|
1275
|
+
_this8.registrationStatus = _types2.RegistrationStatus.ACTIVE;
|
|
1276
|
+
_this8.setActiveMobiusUrl(url);
|
|
1277
|
+
_this8.lineEmitter(_types3.LINE_EVENTS.REGISTERED, resp.body);
|
|
1278
|
+
_Logger.default.log("Registration successful for deviceId: ".concat((_this8$deviceInfo$dev = _this8.deviceInfo.device) === null || _this8$deviceInfo$dev === void 0 ? void 0 : _this8$deviceInfo$dev.deviceId, " userId: ").concat(_this8.userId, " responseTrackingId: ").concat((_resp$headers = resp.headers) === null || _resp$headers === void 0 ? void 0 : _resp$headers.trackingid), {
|
|
1131
1279
|
file: _constants2.REGISTRATION_FILE,
|
|
1132
1280
|
method: _constants2.METHODS.REGISTER
|
|
1133
1281
|
});
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
return
|
|
1140
|
-
case
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
body =
|
|
1144
|
-
|
|
1282
|
+
_this8.setIntervalValues(_this8.deviceInfo);
|
|
1283
|
+
_this8.metricManager.setDeviceInfo(_this8.deviceInfo);
|
|
1284
|
+
_this8.metricManager.submitRegistrationMetric(_types.METRIC_EVENT.REGISTRATION, _types.REG_ACTION.REGISTER, _types.METRIC_TYPE.BEHAVIORAL, caller, serverType, (_resp$headers$trackin = (_resp$headers2 = resp.headers) === null || _resp$headers2 === void 0 ? void 0 : _resp$headers2.trackingid) !== null && _resp$headers$trackin !== void 0 ? _resp$headers$trackin : '', undefined, undefined);
|
|
1285
|
+
_this8.startKeepaliveTimer((_this8$deviceInfo$dev2 = _this8.deviceInfo.device) === null || _this8$deviceInfo$dev2 === void 0 ? void 0 : _this8$deviceInfo$dev2.uri, _this8.deviceInfo.keepaliveInterval, serverType);
|
|
1286
|
+
_this8.initiateFailback();
|
|
1287
|
+
return _context21.abrupt("return", 0);
|
|
1288
|
+
case 3:
|
|
1289
|
+
_context21.prev = 3;
|
|
1290
|
+
_t11 = _context21["catch"](1);
|
|
1291
|
+
body = _t11; // eslint-disable-next-line no-await-in-loop, @typescript-eslint/no-unused-vars
|
|
1292
|
+
_context21.next = 4;
|
|
1145
1293
|
return (0, _common.handleRegistrationErrors)(body, function (clientError, finalError) {
|
|
1146
1294
|
var _body$headers$trackin, _body$headers;
|
|
1147
1295
|
if (finalError) {
|
|
1148
|
-
|
|
1296
|
+
_this8.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
|
|
1149
1297
|
} else {
|
|
1150
|
-
|
|
1298
|
+
_this8.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
1151
1299
|
}
|
|
1152
|
-
|
|
1300
|
+
_this8.metricManager.submitRegistrationMetric(_types.METRIC_EVENT.REGISTRATION_ERROR, _types.REG_ACTION.REGISTER, _types.METRIC_TYPE.BEHAVIORAL, caller, serverType, (_body$headers$trackin = (_body$headers = body.headers) === null || _body$headers === void 0 ? void 0 : _body$headers.trackingid) !== null && _body$headers$trackin !== void 0 ? _body$headers$trackin : '', undefined, clientError);
|
|
1153
1301
|
}, {
|
|
1154
1302
|
method: caller,
|
|
1155
1303
|
file: _constants2.REGISTRATION_FILE
|
|
1156
1304
|
}, function (retryAfter, retryCaller) {
|
|
1157
|
-
return
|
|
1158
|
-
},
|
|
1159
|
-
case
|
|
1160
|
-
abort =
|
|
1161
|
-
if (!(
|
|
1162
|
-
|
|
1305
|
+
return _this8.handle429Retry(retryAfter, retryCaller);
|
|
1306
|
+
}, _this8.restoreRegistrationCallBack());
|
|
1307
|
+
case 4:
|
|
1308
|
+
abort = _context21.sent;
|
|
1309
|
+
if (!(_this8.registrationStatus === _types2.RegistrationStatus.ACTIVE)) {
|
|
1310
|
+
_context21.next = 5;
|
|
1163
1311
|
break;
|
|
1164
1312
|
}
|
|
1165
|
-
_Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(
|
|
1313
|
+
_Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(_this8.activeMobiusUrl), {
|
|
1166
1314
|
file: _constants2.REGISTRATION_FILE,
|
|
1167
|
-
method:
|
|
1315
|
+
method: _this8.attemptRegistrationWithServers.name
|
|
1168
1316
|
});
|
|
1169
|
-
return
|
|
1170
|
-
case
|
|
1317
|
+
return _context21.abrupt("return", 0);
|
|
1318
|
+
case 5:
|
|
1171
1319
|
if (!abort) {
|
|
1172
|
-
|
|
1320
|
+
_context21.next = 7;
|
|
1173
1321
|
break;
|
|
1174
1322
|
}
|
|
1175
|
-
|
|
1323
|
+
_this8.setStatus(_types2.RegistrationStatus.INACTIVE);
|
|
1176
1324
|
// eslint-disable-next-line no-await-in-loop
|
|
1177
|
-
|
|
1325
|
+
_context21.next = 6;
|
|
1178
1326
|
return (0, _common.uploadLogs)();
|
|
1179
|
-
case
|
|
1180
|
-
return
|
|
1181
|
-
case
|
|
1327
|
+
case 6:
|
|
1328
|
+
return _context21.abrupt("return", 0);
|
|
1329
|
+
case 7:
|
|
1182
1330
|
case "end":
|
|
1183
|
-
return
|
|
1331
|
+
return _context21.stop();
|
|
1184
1332
|
}
|
|
1185
|
-
}, _loop, null, [[
|
|
1333
|
+
}, _loop, null, [[1, 3]]);
|
|
1186
1334
|
});
|
|
1187
1335
|
_iterator2.s();
|
|
1188
|
-
case
|
|
1336
|
+
case 4:
|
|
1189
1337
|
if ((_step2 = _iterator2.n()).done) {
|
|
1190
|
-
|
|
1338
|
+
_context22.next = 7;
|
|
1191
1339
|
break;
|
|
1192
1340
|
}
|
|
1193
|
-
return
|
|
1194
|
-
case
|
|
1195
|
-
_ret =
|
|
1341
|
+
return _context22.delegateYield(_loop(), "t0", 5);
|
|
1342
|
+
case 5:
|
|
1343
|
+
_ret = _context22.t0;
|
|
1196
1344
|
if (!(_ret === 0)) {
|
|
1197
|
-
|
|
1345
|
+
_context22.next = 6;
|
|
1198
1346
|
break;
|
|
1199
1347
|
}
|
|
1200
|
-
return
|
|
1201
|
-
case
|
|
1202
|
-
|
|
1348
|
+
return _context22.abrupt("continue", 7);
|
|
1349
|
+
case 6:
|
|
1350
|
+
_context22.next = 4;
|
|
1203
1351
|
break;
|
|
1204
|
-
case
|
|
1205
|
-
|
|
1352
|
+
case 7:
|
|
1353
|
+
_context22.next = 9;
|
|
1206
1354
|
break;
|
|
1207
|
-
case
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
_iterator2.e(
|
|
1211
|
-
case
|
|
1212
|
-
|
|
1355
|
+
case 8:
|
|
1356
|
+
_context22.prev = 8;
|
|
1357
|
+
_t12 = _context22["catch"](3);
|
|
1358
|
+
_iterator2.e(_t12);
|
|
1359
|
+
case 9:
|
|
1360
|
+
_context22.prev = 9;
|
|
1213
1361
|
_iterator2.f();
|
|
1214
|
-
return
|
|
1215
|
-
case
|
|
1216
|
-
return
|
|
1217
|
-
case
|
|
1362
|
+
return _context22.finish(9);
|
|
1363
|
+
case 10:
|
|
1364
|
+
return _context22.abrupt("return", abort);
|
|
1365
|
+
case 11:
|
|
1218
1366
|
case "end":
|
|
1219
|
-
return
|
|
1367
|
+
return _context22.stop();
|
|
1220
1368
|
}
|
|
1221
|
-
},
|
|
1369
|
+
}, _callee21, this, [[3, 8, 9, 10]]);
|
|
1222
1370
|
}));
|
|
1223
1371
|
function attemptRegistrationWithServers(_x11) {
|
|
1224
1372
|
return _attemptRegistrationWithServers.apply(this, arguments);
|
|
@@ -1233,48 +1381,48 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1233
1381
|
}, {
|
|
1234
1382
|
key: "startKeepaliveTimer",
|
|
1235
1383
|
value: (function () {
|
|
1236
|
-
var _startKeepaliveTimer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1237
|
-
var
|
|
1384
|
+
var _startKeepaliveTimer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24(url, interval, serverType) {
|
|
1385
|
+
var _this9 = this;
|
|
1238
1386
|
var RETRY_COUNT_THRESHOLD;
|
|
1239
|
-
return _regenerator.default.wrap(function
|
|
1240
|
-
while (1) switch (
|
|
1387
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
1388
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1241
1389
|
case 0:
|
|
1242
1390
|
this.clearKeepaliveTimer();
|
|
1243
1391
|
RETRY_COUNT_THRESHOLD = this.isCCFlow ? 4 : 5;
|
|
1244
|
-
|
|
1245
|
-
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1392
|
+
_context25.next = 1;
|
|
1393
|
+
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1246
1394
|
var accessToken, blob, blobUrl;
|
|
1247
|
-
return _regenerator.default.wrap(function
|
|
1248
|
-
while (1) switch (
|
|
1395
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
1396
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1249
1397
|
case 0:
|
|
1250
|
-
if (!
|
|
1251
|
-
|
|
1398
|
+
if (!_this9.isDeviceRegistered()) {
|
|
1399
|
+
_context24.next = 2;
|
|
1252
1400
|
break;
|
|
1253
1401
|
}
|
|
1254
|
-
|
|
1255
|
-
return
|
|
1256
|
-
case
|
|
1257
|
-
accessToken =
|
|
1258
|
-
if (!
|
|
1402
|
+
_context24.next = 1;
|
|
1403
|
+
return _this9.webex.credentials.getUserToken();
|
|
1404
|
+
case 1:
|
|
1405
|
+
accessToken = _context24.sent;
|
|
1406
|
+
if (!_this9.webWorker) {
|
|
1259
1407
|
blob = new Blob([_webWorkerStr.default], {
|
|
1260
1408
|
type: 'application/javascript'
|
|
1261
1409
|
});
|
|
1262
1410
|
blobUrl = URL.createObjectURL(blob);
|
|
1263
|
-
|
|
1411
|
+
_this9.webWorker = new Worker(blobUrl);
|
|
1264
1412
|
URL.revokeObjectURL(blobUrl);
|
|
1265
|
-
|
|
1413
|
+
_this9.webWorker.postMessage({
|
|
1266
1414
|
type: _types2.WorkerMessageType.START_KEEPALIVE,
|
|
1267
1415
|
accessToken: String(accessToken),
|
|
1268
|
-
deviceUrl: String(
|
|
1416
|
+
deviceUrl: String(_this9.webex.internal.device.url),
|
|
1269
1417
|
interval: interval,
|
|
1270
1418
|
retryCountThreshold: RETRY_COUNT_THRESHOLD,
|
|
1271
1419
|
url: url
|
|
1272
1420
|
});
|
|
1273
|
-
|
|
1274
|
-
var
|
|
1421
|
+
_this9.webWorker.onmessage = /*#__PURE__*/function () {
|
|
1422
|
+
var _ref11 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22(event) {
|
|
1275
1423
|
var logContext, error, abort;
|
|
1276
|
-
return _regenerator.default.wrap(function
|
|
1277
|
-
while (1) switch (
|
|
1424
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
1425
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1278
1426
|
case 0:
|
|
1279
1427
|
logContext = {
|
|
1280
1428
|
file: _constants2.REGISTRATION_FILE,
|
|
@@ -1282,81 +1430,81 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1282
1430
|
};
|
|
1283
1431
|
if (event.data.type === _types2.WorkerMessageType.KEEPALIVE_SUCCESS) {
|
|
1284
1432
|
_Logger.default.info("Sent Keepalive, status: ".concat(event.data.statusCode), logContext);
|
|
1285
|
-
|
|
1433
|
+
_this9.lineEmitter(_types3.LINE_EVENTS.RECONNECTED);
|
|
1286
1434
|
}
|
|
1287
1435
|
if (!(event.data.type === _types2.WorkerMessageType.KEEPALIVE_FAILURE)) {
|
|
1288
|
-
|
|
1436
|
+
_context23.next = 7;
|
|
1289
1437
|
break;
|
|
1290
1438
|
}
|
|
1291
1439
|
error = event.data.err;
|
|
1292
1440
|
_Logger.default.warn("Keep-alive missed ".concat(event.data.keepAliveRetryCount, " times. Status -> ").concat(error.statusCode, " "), logContext);
|
|
1293
|
-
|
|
1441
|
+
_context23.next = 1;
|
|
1294
1442
|
return (0, _common.handleRegistrationErrors)(error, function (clientError, finalError) {
|
|
1295
1443
|
var _error$headers$tracki, _error$headers;
|
|
1296
1444
|
if (finalError) {
|
|
1297
|
-
|
|
1445
|
+
_this9.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
|
|
1298
1446
|
}
|
|
1299
|
-
|
|
1447
|
+
_this9.metricManager.submitRegistrationMetric(_types.METRIC_EVENT.KEEPALIVE_ERROR, _types.REG_ACTION.KEEPALIVE_FAILURE, _types.METRIC_TYPE.BEHAVIORAL, _constants2.KEEPALIVE_UTIL, serverType, (_error$headers$tracki = (_error$headers = error.headers) === null || _error$headers === void 0 ? void 0 : _error$headers.trackingid) !== null && _error$headers$tracki !== void 0 ? _error$headers$tracki : '', event.data.keepAliveRetryCount, clientError);
|
|
1300
1448
|
}, {
|
|
1301
1449
|
method: _constants2.KEEPALIVE_UTIL,
|
|
1302
1450
|
file: _constants2.REGISTRATION_FILE
|
|
1303
1451
|
}, function (retryAfter, retryCaller) {
|
|
1304
|
-
return
|
|
1452
|
+
return _this9.handle429Retry(retryAfter, retryCaller);
|
|
1305
1453
|
});
|
|
1306
|
-
case
|
|
1307
|
-
abort =
|
|
1454
|
+
case 1:
|
|
1455
|
+
abort = _context23.sent;
|
|
1308
1456
|
if (!(abort || event.data.keepAliveRetryCount >= RETRY_COUNT_THRESHOLD)) {
|
|
1309
|
-
|
|
1457
|
+
_context23.next = 6;
|
|
1310
1458
|
break;
|
|
1311
1459
|
}
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1460
|
+
_this9.failoverImmediately = _this9.isCCFlow;
|
|
1461
|
+
_this9.setStatus(_types2.RegistrationStatus.INACTIVE);
|
|
1462
|
+
_this9.clearKeepaliveTimer();
|
|
1463
|
+
_this9.clearFailbackTimer();
|
|
1464
|
+
_this9.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
1465
|
+
_context23.next = 2;
|
|
1318
1466
|
return (0, _common.uploadLogs)();
|
|
1319
|
-
case
|
|
1467
|
+
case 2:
|
|
1320
1468
|
if (abort) {
|
|
1321
|
-
|
|
1469
|
+
_context23.next = 4;
|
|
1322
1470
|
break;
|
|
1323
1471
|
}
|
|
1324
|
-
|
|
1325
|
-
return
|
|
1326
|
-
case
|
|
1327
|
-
|
|
1472
|
+
_context23.next = 3;
|
|
1473
|
+
return _this9.reconnectOnFailure(_constants2.RECONNECT_ON_FAILURE_UTIL);
|
|
1474
|
+
case 3:
|
|
1475
|
+
_context23.next = 5;
|
|
1328
1476
|
break;
|
|
1329
|
-
case
|
|
1477
|
+
case 4:
|
|
1330
1478
|
if (error.statusCode === 404) {
|
|
1331
|
-
|
|
1479
|
+
_this9.handle404KeepaliveFailure(_constants2.KEEPALIVE_UTIL);
|
|
1332
1480
|
}
|
|
1333
|
-
case
|
|
1334
|
-
|
|
1481
|
+
case 5:
|
|
1482
|
+
_context23.next = 7;
|
|
1335
1483
|
break;
|
|
1336
|
-
case
|
|
1337
|
-
|
|
1338
|
-
case
|
|
1484
|
+
case 6:
|
|
1485
|
+
_this9.lineEmitter(_types3.LINE_EVENTS.RECONNECTING);
|
|
1486
|
+
case 7:
|
|
1339
1487
|
case "end":
|
|
1340
|
-
return
|
|
1488
|
+
return _context23.stop();
|
|
1341
1489
|
}
|
|
1342
|
-
},
|
|
1490
|
+
}, _callee22);
|
|
1343
1491
|
}));
|
|
1344
1492
|
return function (_x15) {
|
|
1345
|
-
return
|
|
1493
|
+
return _ref11.apply(this, arguments);
|
|
1346
1494
|
};
|
|
1347
1495
|
}();
|
|
1348
1496
|
}
|
|
1349
|
-
case
|
|
1497
|
+
case 2:
|
|
1350
1498
|
case "end":
|
|
1351
|
-
return
|
|
1499
|
+
return _context24.stop();
|
|
1352
1500
|
}
|
|
1353
|
-
},
|
|
1501
|
+
}, _callee23);
|
|
1354
1502
|
})));
|
|
1355
|
-
case
|
|
1503
|
+
case 1:
|
|
1356
1504
|
case "end":
|
|
1357
|
-
return
|
|
1505
|
+
return _context25.stop();
|
|
1358
1506
|
}
|
|
1359
|
-
},
|
|
1507
|
+
}, _callee24, this);
|
|
1360
1508
|
}));
|
|
1361
1509
|
function startKeepaliveTimer(_x12, _x13, _x14) {
|
|
1362
1510
|
return _startKeepaliveTimer.apply(this, arguments);
|
|
@@ -1386,36 +1534,37 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1386
1534
|
}, {
|
|
1387
1535
|
key: "deregister",
|
|
1388
1536
|
value: function () {
|
|
1389
|
-
var _deregister = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1390
|
-
var _this$deviceInfo$
|
|
1391
|
-
return _regenerator.default.wrap(function
|
|
1392
|
-
while (1) switch (
|
|
1537
|
+
var _deregister = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
1538
|
+
var _this$deviceInfo$devi, _this$deviceInfo$devi2, _t13;
|
|
1539
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
1540
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1393
1541
|
case 0:
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
return this.deleteRegistration(this.activeMobiusUrl, (_this$deviceInfo$
|
|
1397
|
-
case
|
|
1542
|
+
_context26.prev = 0;
|
|
1543
|
+
_context26.next = 1;
|
|
1544
|
+
return this.deleteRegistration(this.activeMobiusUrl, (_this$deviceInfo$devi = this.deviceInfo.device) === null || _this$deviceInfo$devi === void 0 ? void 0 : _this$deviceInfo$devi.deviceId, (_this$deviceInfo$devi2 = this.deviceInfo.device) === null || _this$deviceInfo$devi2 === void 0 ? void 0 : _this$deviceInfo$devi2.clientDeviceUri);
|
|
1545
|
+
case 1:
|
|
1398
1546
|
_Logger.default.log('Registration successfully deregistered', {
|
|
1399
1547
|
file: _constants2.REGISTRATION_FILE,
|
|
1400
1548
|
method: _constants2.METHODS.DEREGISTER
|
|
1401
1549
|
});
|
|
1402
|
-
|
|
1550
|
+
_context26.next = 3;
|
|
1403
1551
|
break;
|
|
1404
|
-
case
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
_Logger.default.warn("Delete failed with Mobius: ".concat(
|
|
1552
|
+
case 2:
|
|
1553
|
+
_context26.prev = 2;
|
|
1554
|
+
_t13 = _context26["catch"](0);
|
|
1555
|
+
_Logger.default.warn("Delete failed with Mobius: ".concat((0, _stringify.default)(_t13)), {
|
|
1408
1556
|
file: _constants2.REGISTRATION_FILE,
|
|
1409
1557
|
method: _constants2.METHODS.DEREGISTER
|
|
1410
1558
|
});
|
|
1411
|
-
case
|
|
1559
|
+
case 3:
|
|
1412
1560
|
this.clearKeepaliveTimer();
|
|
1413
1561
|
this.setStatus(_types2.RegistrationStatus.INACTIVE);
|
|
1414
|
-
|
|
1562
|
+
this.clearFailoverState();
|
|
1563
|
+
case 4:
|
|
1415
1564
|
case "end":
|
|
1416
|
-
return
|
|
1565
|
+
return _context26.stop();
|
|
1417
1566
|
}
|
|
1418
|
-
},
|
|
1567
|
+
}, _callee25, this, [[0, 2]]);
|
|
1419
1568
|
}));
|
|
1420
1569
|
function deregister() {
|
|
1421
1570
|
return _deregister.apply(this, arguments);
|
|
@@ -1479,10 +1628,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1479
1628
|
}, {
|
|
1480
1629
|
key: "reconnectOnFailure",
|
|
1481
1630
|
value: (function () {
|
|
1482
|
-
var _reconnectOnFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1631
|
+
var _reconnectOnFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26(caller) {
|
|
1483
1632
|
var abort;
|
|
1484
|
-
return _regenerator.default.wrap(function
|
|
1485
|
-
while (1) switch (
|
|
1633
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
1634
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1486
1635
|
case 0:
|
|
1487
1636
|
_Logger.default.info(_constants.METHOD_START_MESSAGE, {
|
|
1488
1637
|
method: _constants2.METHODS.RECONNECT_ON_FAILURE,
|
|
@@ -1490,37 +1639,37 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1490
1639
|
});
|
|
1491
1640
|
this.reconnectPending = false;
|
|
1492
1641
|
if (this.isDeviceRegistered()) {
|
|
1493
|
-
|
|
1642
|
+
_context27.next = 4;
|
|
1494
1643
|
break;
|
|
1495
1644
|
}
|
|
1496
1645
|
if (!((0, _keys.default)(this.callManager.getActiveCalls()).length === 0)) {
|
|
1497
|
-
|
|
1646
|
+
_context27.next = 3;
|
|
1498
1647
|
break;
|
|
1499
1648
|
}
|
|
1500
|
-
|
|
1649
|
+
_context27.next = 1;
|
|
1501
1650
|
return this.restorePreviousRegistration(caller);
|
|
1502
|
-
case
|
|
1503
|
-
abort =
|
|
1651
|
+
case 1:
|
|
1652
|
+
abort = _context27.sent;
|
|
1504
1653
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
1505
|
-
|
|
1654
|
+
_context27.next = 2;
|
|
1506
1655
|
break;
|
|
1507
1656
|
}
|
|
1508
|
-
|
|
1657
|
+
_context27.next = 2;
|
|
1509
1658
|
return this.restartRegistration(caller);
|
|
1510
|
-
case
|
|
1511
|
-
|
|
1659
|
+
case 2:
|
|
1660
|
+
_context27.next = 4;
|
|
1512
1661
|
break;
|
|
1513
|
-
case
|
|
1662
|
+
case 3:
|
|
1514
1663
|
this.reconnectPending = true;
|
|
1515
1664
|
_Logger.default.info('Active call(s) present, deferred reconnect till call cleanup.', {
|
|
1516
1665
|
file: _constants2.REGISTRATION_FILE,
|
|
1517
1666
|
method: _constants2.METHODS.RECONNECT_ON_FAILURE
|
|
1518
1667
|
});
|
|
1519
|
-
case
|
|
1668
|
+
case 4:
|
|
1520
1669
|
case "end":
|
|
1521
|
-
return
|
|
1670
|
+
return _context27.stop();
|
|
1522
1671
|
}
|
|
1523
|
-
},
|
|
1672
|
+
}, _callee26, this);
|
|
1524
1673
|
}));
|
|
1525
1674
|
function reconnectOnFailure(_x16) {
|
|
1526
1675
|
return _reconnectOnFailure.apply(this, arguments);
|
|
@@ -1528,7 +1677,6 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1528
1677
|
return reconnectOnFailure;
|
|
1529
1678
|
}())
|
|
1530
1679
|
}]);
|
|
1531
|
-
return Registration;
|
|
1532
1680
|
}();
|
|
1533
1681
|
/*
|
|
1534
1682
|
*/
|