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