@webex/calling 3.8.0-next.9 → 3.8.0-web-workers-keepalive.2
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/CallingClient/line/line.test.js +4 -10
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +333 -333
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +312 -263
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +115 -0
- package/dist/CallingClient/registration/webWorker.js.map +1 -0
- package/dist/CallingClient/registration/webWorker.test.js +256 -0
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -0
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +189 -120
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +199 -4
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/types.js.map +1 -1
- package/dist/common/testUtil.js +3 -0
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js +8 -1
- package/dist/common/types.js.map +1 -1
- package/dist/module/CallingClient/registration/register.js +50 -54
- package/dist/module/CallingClient/registration/webWorker.js +59 -0
- package/dist/module/Voicemail/WxCallBackendConnector.js +17 -1
- package/dist/module/common/testUtil.js +3 -0
- package/dist/module/common/types.js +7 -0
- package/dist/types/CallingClient/registration/register.d.ts +1 -2
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts +2 -0
- package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -0
- package/dist/types/SDKConnector/types.d.ts +3 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/Voicemail.d.ts +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +3 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/types.d.ts +1 -1
- package/dist/types/Voicemail/types.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +3 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +12 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +5 -4
|
@@ -54,7 +54,6 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
54
54
|
(0, _defineProperty2.default)(this, "registrationStatus", void 0);
|
|
55
55
|
(0, _defineProperty2.default)(this, "failbackTimer", void 0);
|
|
56
56
|
(0, _defineProperty2.default)(this, "activeMobiusUrl", void 0);
|
|
57
|
-
(0, _defineProperty2.default)(this, "keepaliveTimer", void 0);
|
|
58
57
|
(0, _defineProperty2.default)(this, "rehomingIntervalMin", void 0);
|
|
59
58
|
(0, _defineProperty2.default)(this, "rehomingIntervalMax", void 0);
|
|
60
59
|
(0, _defineProperty2.default)(this, "mutex", void 0);
|
|
@@ -69,6 +68,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
69
68
|
(0, _defineProperty2.default)(this, "jwe", void 0);
|
|
70
69
|
(0, _defineProperty2.default)(this, "isCCFlow", false);
|
|
71
70
|
(0, _defineProperty2.default)(this, "failoverImmediately", false);
|
|
71
|
+
(0, _defineProperty2.default)(this, "webWorker", void 0);
|
|
72
72
|
this.jwe = jwe;
|
|
73
73
|
this.sdkConnector = _SDKConnector.default;
|
|
74
74
|
this.serviceData = serviceData;
|
|
@@ -112,91 +112,62 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
112
112
|
this.backupMobiusUris = backupMobiusUris;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
/**
|
|
116
|
-
* Implementation of sending keepalive.
|
|
117
|
-
*
|
|
118
|
-
*/
|
|
119
|
-
}, {
|
|
120
|
-
key: "postKeepAlive",
|
|
121
|
-
value: (function () {
|
|
122
|
-
var _postKeepAlive = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url) {
|
|
123
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
124
|
-
while (1) switch (_context.prev = _context.next) {
|
|
125
|
-
case 0:
|
|
126
|
-
return _context.abrupt("return", this.webex.request({
|
|
127
|
-
uri: "".concat(url, "/status"),
|
|
128
|
-
method: _types3.HTTP_METHODS.POST,
|
|
129
|
-
headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.CISCO_DEVICE_URL, this.webex.internal.device.url), _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT),
|
|
130
|
-
service: _types3.ALLOWED_SERVICES.MOBIUS
|
|
131
|
-
}));
|
|
132
|
-
case 1:
|
|
133
|
-
case "end":
|
|
134
|
-
return _context.stop();
|
|
135
|
-
}
|
|
136
|
-
}, _callee, this);
|
|
137
|
-
}));
|
|
138
|
-
function postKeepAlive(_x) {
|
|
139
|
-
return _postKeepAlive.apply(this, arguments);
|
|
140
|
-
}
|
|
141
|
-
return postKeepAlive;
|
|
142
|
-
}()
|
|
143
115
|
/**
|
|
144
116
|
* Implementation of delete device.
|
|
145
117
|
*
|
|
146
118
|
*/
|
|
147
|
-
)
|
|
148
119
|
}, {
|
|
149
120
|
key: "deleteRegistration",
|
|
150
121
|
value: (function () {
|
|
151
|
-
var _deleteRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
122
|
+
var _deleteRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, deviceId, deviceUrl) {
|
|
152
123
|
var _response;
|
|
153
124
|
var response;
|
|
154
|
-
return _regenerator.default.wrap(function
|
|
155
|
-
while (1) switch (
|
|
125
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
126
|
+
while (1) switch (_context.prev = _context.next) {
|
|
156
127
|
case 0:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
128
|
+
_context.prev = 0;
|
|
129
|
+
_context.t0 = fetch;
|
|
130
|
+
_context.t1 = "".concat(url).concat(_constants.DEVICES_ENDPOINT_RESOURCE, "/").concat(deviceId);
|
|
131
|
+
_context.t2 = _types3.HTTP_METHODS.DELETE;
|
|
132
|
+
_context.t3 = _defineProperty2.default;
|
|
133
|
+
_context.t4 = _defineProperty2.default;
|
|
134
|
+
_context.t5 = _defineProperty2.default;
|
|
135
|
+
_context.t6 = (0, _defineProperty2.default)({}, _constants.CISCO_DEVICE_URL, deviceUrl);
|
|
136
|
+
_context.next = 10;
|
|
166
137
|
return this.webex.credentials.getUserToken();
|
|
167
138
|
case 10:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
method:
|
|
177
|
-
headers:
|
|
139
|
+
_context.t7 = _context.sent;
|
|
140
|
+
_context.t8 = (0, _context.t5)(_context.t6, "Authorization", _context.t7);
|
|
141
|
+
_context.t9 = "".concat(_constants.WEBEX_WEB_CLIENT, "_").concat((0, _uuid.v4)());
|
|
142
|
+
_context.t10 = (0, _context.t4)(_context.t8, "trackingId", _context.t9);
|
|
143
|
+
_context.t11 = _constants.SPARK_USER_AGENT;
|
|
144
|
+
_context.t12 = _constants.CALLING_USER_AGENT;
|
|
145
|
+
_context.t13 = (0, _context.t3)(_context.t10, _context.t11, _context.t12);
|
|
146
|
+
_context.t14 = {
|
|
147
|
+
method: _context.t2,
|
|
148
|
+
headers: _context.t13
|
|
178
149
|
};
|
|
179
|
-
|
|
180
|
-
return (0,
|
|
150
|
+
_context.next = 20;
|
|
151
|
+
return (0, _context.t0)(_context.t1, _context.t14);
|
|
181
152
|
case 20:
|
|
182
|
-
response =
|
|
183
|
-
|
|
153
|
+
response = _context.sent;
|
|
154
|
+
_context.next = 26;
|
|
184
155
|
break;
|
|
185
156
|
case 23:
|
|
186
|
-
|
|
187
|
-
|
|
157
|
+
_context.prev = 23;
|
|
158
|
+
_context.t15 = _context["catch"](0);
|
|
188
159
|
_Logger.default.warn("Delete failed with Mobius", {});
|
|
189
160
|
case 26:
|
|
190
161
|
this.setStatus(_types3.RegistrationStatus.INACTIVE);
|
|
191
162
|
this.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
|
|
192
|
-
return
|
|
163
|
+
return _context.abrupt("return", (_response = response) === null || _response === void 0 ? void 0 : _response.json());
|
|
193
164
|
case 29:
|
|
194
165
|
case "end":
|
|
195
|
-
return
|
|
166
|
+
return _context.stop();
|
|
196
167
|
}
|
|
197
|
-
},
|
|
168
|
+
}, _callee, this, [[0, 23]]);
|
|
198
169
|
}));
|
|
199
|
-
function deleteRegistration(_x2, _x3
|
|
170
|
+
function deleteRegistration(_x, _x2, _x3) {
|
|
200
171
|
return _deleteRegistration.apply(this, arguments);
|
|
201
172
|
}
|
|
202
173
|
return deleteRegistration;
|
|
@@ -209,10 +180,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
209
180
|
}, {
|
|
210
181
|
key: "postRegistration",
|
|
211
182
|
value: (function () {
|
|
212
|
-
var _postRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
183
|
+
var _postRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url) {
|
|
213
184
|
var deviceInfo;
|
|
214
|
-
return _regenerator.default.wrap(function
|
|
215
|
-
while (1) switch (
|
|
185
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
186
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
216
187
|
case 0:
|
|
217
188
|
deviceInfo = {
|
|
218
189
|
userId: this.userId,
|
|
@@ -221,7 +192,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
221
192
|
jwe: this.jwe
|
|
222
193
|
}) : this.serviceData
|
|
223
194
|
};
|
|
224
|
-
return
|
|
195
|
+
return _context2.abrupt("return", this.webex.request({
|
|
225
196
|
uri: "".concat(url, "device"),
|
|
226
197
|
method: _types3.HTTP_METHODS.POST,
|
|
227
198
|
headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.CISCO_DEVICE_URL, deviceInfo.clientDeviceUri), _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT),
|
|
@@ -230,11 +201,11 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
230
201
|
}));
|
|
231
202
|
case 2:
|
|
232
203
|
case "end":
|
|
233
|
-
return
|
|
204
|
+
return _context2.stop();
|
|
234
205
|
}
|
|
235
|
-
},
|
|
206
|
+
}, _callee2, this);
|
|
236
207
|
}));
|
|
237
|
-
function postRegistration(
|
|
208
|
+
function postRegistration(_x4) {
|
|
238
209
|
return _postRegistration.apply(this, arguments);
|
|
239
210
|
}
|
|
240
211
|
return postRegistration;
|
|
@@ -247,29 +218,29 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
247
218
|
}, {
|
|
248
219
|
key: "restorePreviousRegistration",
|
|
249
220
|
value: (function () {
|
|
250
|
-
var _restorePreviousRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
221
|
+
var _restorePreviousRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(caller) {
|
|
251
222
|
var abort;
|
|
252
|
-
return _regenerator.default.wrap(function
|
|
253
|
-
while (1) switch (
|
|
223
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
224
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
254
225
|
case 0:
|
|
255
226
|
abort = false;
|
|
256
227
|
if (!this.activeMobiusUrl) {
|
|
257
|
-
|
|
228
|
+
_context3.next = 5;
|
|
258
229
|
break;
|
|
259
230
|
}
|
|
260
|
-
|
|
231
|
+
_context3.next = 4;
|
|
261
232
|
return this.attemptRegistrationWithServers(caller, [this.activeMobiusUrl]);
|
|
262
233
|
case 4:
|
|
263
|
-
abort =
|
|
234
|
+
abort = _context3.sent;
|
|
264
235
|
case 5:
|
|
265
|
-
return
|
|
236
|
+
return _context3.abrupt("return", abort);
|
|
266
237
|
case 6:
|
|
267
238
|
case "end":
|
|
268
|
-
return
|
|
239
|
+
return _context3.stop();
|
|
269
240
|
}
|
|
270
|
-
},
|
|
241
|
+
}, _callee3, this);
|
|
271
242
|
}));
|
|
272
|
-
function restorePreviousRegistration(
|
|
243
|
+
function restorePreviousRegistration(_x5) {
|
|
273
244
|
return _restorePreviousRegistration.apply(this, arguments);
|
|
274
245
|
}
|
|
275
246
|
return restorePreviousRegistration;
|
|
@@ -284,16 +255,16 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
284
255
|
}, {
|
|
285
256
|
key: "scheduleFailback429Retry",
|
|
286
257
|
value: (function () {
|
|
287
|
-
var _scheduleFailback429Retry = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
258
|
+
var _scheduleFailback429Retry = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
288
259
|
var interval, abort;
|
|
289
|
-
return _regenerator.default.wrap(function
|
|
290
|
-
while (1) switch (
|
|
260
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
261
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
291
262
|
case 0:
|
|
292
263
|
if (!(this.failback429RetryAttempts >= _constants.REG_FAILBACK_429_MAX_RETRIES)) {
|
|
293
|
-
|
|
264
|
+
_context4.next = 2;
|
|
294
265
|
break;
|
|
295
266
|
}
|
|
296
|
-
return
|
|
267
|
+
return _context4.abrupt("return");
|
|
297
268
|
case 2:
|
|
298
269
|
this.clearFailbackTimer();
|
|
299
270
|
this.failback429RetryAttempts += 1;
|
|
@@ -303,21 +274,21 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
303
274
|
});
|
|
304
275
|
interval = this.getRegRetryInterval(this.failback429RetryAttempts);
|
|
305
276
|
this.startFailbackTimer(interval);
|
|
306
|
-
|
|
277
|
+
_context4.next = 9;
|
|
307
278
|
return this.restorePreviousRegistration(_constants.FAILBACK_429_RETRY_UTIL);
|
|
308
279
|
case 9:
|
|
309
|
-
abort =
|
|
280
|
+
abort = _context4.sent;
|
|
310
281
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
311
|
-
|
|
282
|
+
_context4.next = 13;
|
|
312
283
|
break;
|
|
313
284
|
}
|
|
314
|
-
|
|
285
|
+
_context4.next = 13;
|
|
315
286
|
return this.restartRegistration(_constants.FAILBACK_429_RETRY_UTIL);
|
|
316
287
|
case 13:
|
|
317
288
|
case "end":
|
|
318
|
-
return
|
|
289
|
+
return _context4.stop();
|
|
319
290
|
}
|
|
320
|
-
},
|
|
291
|
+
}, _callee4, this);
|
|
321
292
|
}));
|
|
322
293
|
function scheduleFailback429Retry() {
|
|
323
294
|
return _scheduleFailback429Retry.apply(this, arguments);
|
|
@@ -348,7 +319,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
348
319
|
}, {
|
|
349
320
|
key: "startFailoverTimer",
|
|
350
321
|
value: (function () {
|
|
351
|
-
var _startFailoverTimer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
322
|
+
var _startFailoverTimer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
352
323
|
var _this = this;
|
|
353
324
|
var attempt,
|
|
354
325
|
timeElapsed,
|
|
@@ -358,12 +329,12 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
358
329
|
excessVal,
|
|
359
330
|
abort,
|
|
360
331
|
scheduledTime,
|
|
361
|
-
|
|
362
|
-
return _regenerator.default.wrap(function
|
|
363
|
-
while (1) switch (
|
|
332
|
+
_args9 = arguments;
|
|
333
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
334
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
364
335
|
case 0:
|
|
365
|
-
attempt =
|
|
366
|
-
timeElapsed =
|
|
336
|
+
attempt = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : 1;
|
|
337
|
+
timeElapsed = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : 0;
|
|
367
338
|
loggerContext = {
|
|
368
339
|
file: _constants.REGISTRATION_FILE,
|
|
369
340
|
method: this.startFailoverTimer.name
|
|
@@ -375,72 +346,72 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
375
346
|
interval -= excessVal;
|
|
376
347
|
}
|
|
377
348
|
if (!(interval > _constants.BASE_REG_RETRY_TIMER_VAL_IN_SEC && !this.failoverImmediately)) {
|
|
378
|
-
|
|
349
|
+
_context9.next = 12;
|
|
379
350
|
break;
|
|
380
351
|
}
|
|
381
352
|
scheduledTime = Math.floor((0, _now.default)() / 1000);
|
|
382
|
-
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
383
|
-
return _regenerator.default.wrap(function
|
|
384
|
-
while (1) switch (
|
|
353
|
+
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
354
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
355
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
385
356
|
case 0:
|
|
386
|
-
|
|
387
|
-
return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
357
|
+
_context6.next = 2;
|
|
358
|
+
return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
388
359
|
var currentTime;
|
|
389
|
-
return _regenerator.default.wrap(function
|
|
390
|
-
while (1) switch (
|
|
360
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
361
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
391
362
|
case 0:
|
|
392
|
-
|
|
363
|
+
_context5.next = 2;
|
|
393
364
|
return _this.attemptRegistrationWithServers(_this.startFailoverTimer.name);
|
|
394
365
|
case 2:
|
|
395
|
-
abort =
|
|
366
|
+
abort = _context5.sent;
|
|
396
367
|
currentTime = Math.floor((0, _now.default)() / 1000);
|
|
397
368
|
if (!(!abort && !_this.isDeviceRegistered())) {
|
|
398
|
-
|
|
369
|
+
_context5.next = 7;
|
|
399
370
|
break;
|
|
400
371
|
}
|
|
401
|
-
|
|
372
|
+
_context5.next = 7;
|
|
402
373
|
return _this.startFailoverTimer(attempt + 1, timeElapsed + (currentTime - scheduledTime));
|
|
403
374
|
case 7:
|
|
404
375
|
case "end":
|
|
405
|
-
return
|
|
376
|
+
return _context5.stop();
|
|
406
377
|
}
|
|
407
|
-
},
|
|
378
|
+
}, _callee5);
|
|
408
379
|
})));
|
|
409
380
|
case 2:
|
|
410
381
|
case "end":
|
|
411
|
-
return
|
|
382
|
+
return _context6.stop();
|
|
412
383
|
}
|
|
413
|
-
},
|
|
384
|
+
}, _callee6);
|
|
414
385
|
})), interval * _constants.SEC_TO_MSEC_MFACTOR);
|
|
415
386
|
_Logger.default.log("Scheduled retry with primary in ".concat(interval, " seconds, number of attempts : ").concat(attempt), loggerContext);
|
|
416
|
-
|
|
387
|
+
_context9.next = 22;
|
|
417
388
|
break;
|
|
418
389
|
case 12:
|
|
419
390
|
if (!this.backupMobiusUris.length) {
|
|
420
|
-
|
|
391
|
+
_context9.next = 21;
|
|
421
392
|
break;
|
|
422
393
|
}
|
|
423
394
|
_Logger.default.log('Failing over to backup servers.', loggerContext);
|
|
424
395
|
this.failoverImmediately = false;
|
|
425
|
-
|
|
396
|
+
_context9.next = 17;
|
|
426
397
|
return this.attemptRegistrationWithServers(this.startFailoverTimer.name, this.backupMobiusUris);
|
|
427
398
|
case 17:
|
|
428
|
-
abort =
|
|
399
|
+
abort = _context9.sent;
|
|
429
400
|
if (!abort && !this.isDeviceRegistered()) {
|
|
430
401
|
interval = this.getRegRetryInterval();
|
|
431
|
-
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
432
|
-
return _regenerator.default.wrap(function
|
|
433
|
-
while (1) switch (
|
|
402
|
+
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
403
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
404
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
434
405
|
case 0:
|
|
435
|
-
|
|
436
|
-
return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
437
|
-
return _regenerator.default.wrap(function
|
|
438
|
-
while (1) switch (
|
|
406
|
+
_context8.next = 2;
|
|
407
|
+
return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
408
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
409
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
439
410
|
case 0:
|
|
440
|
-
|
|
411
|
+
_context7.next = 2;
|
|
441
412
|
return _this.attemptRegistrationWithServers(_this.startFailoverTimer.name, _this.backupMobiusUris);
|
|
442
413
|
case 2:
|
|
443
|
-
abort =
|
|
414
|
+
abort = _context7.sent;
|
|
444
415
|
if (!abort && !_this.isDeviceRegistered()) {
|
|
445
416
|
(0, _common.emitFinalFailure)(function (clientError) {
|
|
446
417
|
_this.lineEmitter(_types4.LINE_EVENTS.ERROR, undefined, clientError);
|
|
@@ -448,19 +419,19 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
448
419
|
}
|
|
449
420
|
case 4:
|
|
450
421
|
case "end":
|
|
451
|
-
return
|
|
422
|
+
return _context7.stop();
|
|
452
423
|
}
|
|
453
|
-
},
|
|
424
|
+
}, _callee7);
|
|
454
425
|
})));
|
|
455
426
|
case 2:
|
|
456
427
|
case "end":
|
|
457
|
-
return
|
|
428
|
+
return _context8.stop();
|
|
458
429
|
}
|
|
459
|
-
},
|
|
430
|
+
}, _callee8);
|
|
460
431
|
})), interval * _constants.SEC_TO_MSEC_MFACTOR);
|
|
461
432
|
_Logger.default.log("Scheduled retry with backup servers in ".concat(interval, " seconds."), loggerContext);
|
|
462
433
|
}
|
|
463
|
-
|
|
434
|
+
_context9.next = 22;
|
|
464
435
|
break;
|
|
465
436
|
case 21:
|
|
466
437
|
(0, _common.emitFinalFailure)(function (clientError) {
|
|
@@ -468,9 +439,9 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
468
439
|
}, loggerContext);
|
|
469
440
|
case 22:
|
|
470
441
|
case "end":
|
|
471
|
-
return
|
|
442
|
+
return _context9.stop();
|
|
472
443
|
}
|
|
473
|
-
},
|
|
444
|
+
}, _callee9, this);
|
|
474
445
|
}));
|
|
475
446
|
function startFailoverTimer() {
|
|
476
447
|
return _startFailoverTimer.apply(this, arguments);
|
|
@@ -536,16 +507,16 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
536
507
|
key: "startFailbackTimer",
|
|
537
508
|
value: function startFailbackTimer(intervalInSeconds) {
|
|
538
509
|
var _this2 = this;
|
|
539
|
-
this.failbackTimer = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
540
|
-
return _regenerator.default.wrap(function
|
|
541
|
-
while (1) switch (
|
|
510
|
+
this.failbackTimer = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
511
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
512
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
542
513
|
case 0:
|
|
543
|
-
return
|
|
514
|
+
return _context10.abrupt("return", _this2.executeFailback());
|
|
544
515
|
case 1:
|
|
545
516
|
case "end":
|
|
546
|
-
return
|
|
517
|
+
return _context10.stop();
|
|
547
518
|
}
|
|
548
|
-
},
|
|
519
|
+
}, _callee10);
|
|
549
520
|
})), intervalInSeconds * _constants.SEC_TO_MSEC_MFACTOR);
|
|
550
521
|
_Logger.default.log("Failback scheduled after ".concat(intervalInSeconds, " seconds."), {
|
|
551
522
|
file: _constants.REGISTRATION_FILE,
|
|
@@ -560,65 +531,65 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
560
531
|
}, {
|
|
561
532
|
key: "executeFailback",
|
|
562
533
|
value: (function () {
|
|
563
|
-
var _executeFailback = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
534
|
+
var _executeFailback = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
564
535
|
var _this3 = this;
|
|
565
|
-
return _regenerator.default.wrap(function
|
|
566
|
-
while (1) switch (
|
|
536
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
537
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
567
538
|
case 0:
|
|
568
|
-
|
|
569
|
-
return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
539
|
+
_context12.next = 2;
|
|
540
|
+
return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
570
541
|
var abort, abortNew;
|
|
571
|
-
return _regenerator.default.wrap(function
|
|
572
|
-
while (1) switch (
|
|
542
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
543
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
573
544
|
case 0:
|
|
574
545
|
if (!_this3.isFailbackRequired()) {
|
|
575
|
-
|
|
546
|
+
_context11.next = 27;
|
|
576
547
|
break;
|
|
577
548
|
}
|
|
578
549
|
if (!((0, _keys.default)(_this3.callManager.getActiveCalls()).length === 0)) {
|
|
579
|
-
|
|
550
|
+
_context11.next = 24;
|
|
580
551
|
break;
|
|
581
552
|
}
|
|
582
553
|
_Logger.default.info("Attempting failback to primary.", {
|
|
583
554
|
file: _constants.REGISTRATION_FILE,
|
|
584
555
|
method: _this3.executeFailback.name
|
|
585
556
|
});
|
|
586
|
-
|
|
557
|
+
_context11.next = 5;
|
|
587
558
|
return _this3.deregister();
|
|
588
559
|
case 5:
|
|
589
|
-
|
|
560
|
+
_context11.next = 7;
|
|
590
561
|
return _this3.attemptRegistrationWithServers(_constants.FAILBACK_UTIL);
|
|
591
562
|
case 7:
|
|
592
|
-
abort =
|
|
563
|
+
abort = _context11.sent;
|
|
593
564
|
if (!(!abort && !_this3.isDeviceRegistered())) {
|
|
594
|
-
|
|
565
|
+
_context11.next = 22;
|
|
595
566
|
break;
|
|
596
567
|
}
|
|
597
|
-
|
|
568
|
+
_context11.next = 11;
|
|
598
569
|
return _this3.restorePreviousRegistration(_constants.FAILBACK_UTIL);
|
|
599
570
|
case 11:
|
|
600
|
-
abortNew =
|
|
571
|
+
abortNew = _context11.sent;
|
|
601
572
|
if (!abortNew) {
|
|
602
|
-
|
|
573
|
+
_context11.next = 15;
|
|
603
574
|
break;
|
|
604
575
|
}
|
|
605
576
|
_this3.clearFailbackTimer();
|
|
606
|
-
return
|
|
577
|
+
return _context11.abrupt("return");
|
|
607
578
|
case 15:
|
|
608
579
|
if (_this3.isDeviceRegistered()) {
|
|
609
|
-
|
|
580
|
+
_context11.next = 20;
|
|
610
581
|
break;
|
|
611
582
|
}
|
|
612
|
-
|
|
583
|
+
_context11.next = 18;
|
|
613
584
|
return _this3.restartRegistration(_this3.executeFailback.name);
|
|
614
585
|
case 18:
|
|
615
|
-
|
|
586
|
+
_context11.next = 22;
|
|
616
587
|
break;
|
|
617
588
|
case 20:
|
|
618
589
|
_this3.failbackTimer = undefined;
|
|
619
590
|
_this3.initiateFailback();
|
|
620
591
|
case 22:
|
|
621
|
-
|
|
592
|
+
_context11.next = 27;
|
|
622
593
|
break;
|
|
623
594
|
case 24:
|
|
624
595
|
_Logger.default.info('Active calls present, deferring failback to next cycle.', {
|
|
@@ -629,15 +600,15 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
629
600
|
_this3.initiateFailback();
|
|
630
601
|
case 27:
|
|
631
602
|
case "end":
|
|
632
|
-
return
|
|
603
|
+
return _context11.stop();
|
|
633
604
|
}
|
|
634
|
-
},
|
|
605
|
+
}, _callee11);
|
|
635
606
|
})));
|
|
636
607
|
case 2:
|
|
637
608
|
case "end":
|
|
638
|
-
return
|
|
609
|
+
return _context12.stop();
|
|
639
610
|
}
|
|
640
|
-
},
|
|
611
|
+
}, _callee12, this);
|
|
641
612
|
}));
|
|
642
613
|
function executeFailback() {
|
|
643
614
|
return _executeFailback.apply(this, arguments);
|
|
@@ -700,10 +671,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
700
671
|
}, {
|
|
701
672
|
key: "restartRegistration",
|
|
702
673
|
value: (function () {
|
|
703
|
-
var _restartRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
674
|
+
var _restartRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(caller) {
|
|
704
675
|
var abort;
|
|
705
|
-
return _regenerator.default.wrap(function
|
|
706
|
-
while (1) switch (
|
|
676
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
677
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
707
678
|
case 0:
|
|
708
679
|
/*
|
|
709
680
|
* Cancel any failback timer running
|
|
@@ -711,23 +682,23 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
711
682
|
*/
|
|
712
683
|
this.clearFailbackTimer();
|
|
713
684
|
this.failback429RetryAttempts = 0;
|
|
714
|
-
|
|
685
|
+
_context13.next = 4;
|
|
715
686
|
return this.attemptRegistrationWithServers(caller, this.primaryMobiusUris);
|
|
716
687
|
case 4:
|
|
717
|
-
abort =
|
|
688
|
+
abort = _context13.sent;
|
|
718
689
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
719
|
-
|
|
690
|
+
_context13.next = 8;
|
|
720
691
|
break;
|
|
721
692
|
}
|
|
722
|
-
|
|
693
|
+
_context13.next = 8;
|
|
723
694
|
return this.startFailoverTimer();
|
|
724
695
|
case 8:
|
|
725
696
|
case "end":
|
|
726
|
-
return
|
|
697
|
+
return _context13.stop();
|
|
727
698
|
}
|
|
728
|
-
},
|
|
699
|
+
}, _callee13, this);
|
|
729
700
|
}));
|
|
730
|
-
function restartRegistration(
|
|
701
|
+
function restartRegistration(_x6) {
|
|
731
702
|
return _restartRegistration.apply(this, arguments);
|
|
732
703
|
}
|
|
733
704
|
return restartRegistration;
|
|
@@ -741,19 +712,19 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
741
712
|
}, {
|
|
742
713
|
key: "handleConnectionRestoration",
|
|
743
714
|
value: (function () {
|
|
744
|
-
var _handleConnectionRestoration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
715
|
+
var _handleConnectionRestoration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(retry) {
|
|
745
716
|
var _this4 = this;
|
|
746
|
-
return _regenerator.default.wrap(function
|
|
747
|
-
while (1) switch (
|
|
717
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
718
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
748
719
|
case 0:
|
|
749
|
-
|
|
750
|
-
return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
720
|
+
_context15.next = 2;
|
|
721
|
+
return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
751
722
|
var abort;
|
|
752
|
-
return _regenerator.default.wrap(function
|
|
753
|
-
while (1) switch (
|
|
723
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
724
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
754
725
|
case 0:
|
|
755
726
|
if (!retry) {
|
|
756
|
-
|
|
727
|
+
_context14.next = 14;
|
|
757
728
|
break;
|
|
758
729
|
}
|
|
759
730
|
_Logger.default.info('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
@@ -762,43 +733,43 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
762
733
|
});
|
|
763
734
|
_this4.clearKeepaliveTimer();
|
|
764
735
|
if (!_this4.isDeviceRegistered()) {
|
|
765
|
-
|
|
736
|
+
_context14.next = 6;
|
|
766
737
|
break;
|
|
767
738
|
}
|
|
768
|
-
|
|
739
|
+
_context14.next = 6;
|
|
769
740
|
return _this4.deregister();
|
|
770
741
|
case 6:
|
|
771
742
|
if (!_this4.activeMobiusUrl) {
|
|
772
|
-
|
|
743
|
+
_context14.next = 13;
|
|
773
744
|
break;
|
|
774
745
|
}
|
|
775
|
-
|
|
746
|
+
_context14.next = 9;
|
|
776
747
|
return _this4.restorePreviousRegistration(_this4.handleConnectionRestoration.name);
|
|
777
748
|
case 9:
|
|
778
|
-
abort =
|
|
749
|
+
abort = _context14.sent;
|
|
779
750
|
if (!(!abort && !_this4.isDeviceRegistered())) {
|
|
780
|
-
|
|
751
|
+
_context14.next = 13;
|
|
781
752
|
break;
|
|
782
753
|
}
|
|
783
|
-
|
|
754
|
+
_context14.next = 13;
|
|
784
755
|
return _this4.restartRegistration(_this4.handleConnectionRestoration.name);
|
|
785
756
|
case 13:
|
|
786
757
|
retry = false;
|
|
787
758
|
case 14:
|
|
788
759
|
case "end":
|
|
789
|
-
return
|
|
760
|
+
return _context14.stop();
|
|
790
761
|
}
|
|
791
|
-
},
|
|
762
|
+
}, _callee14);
|
|
792
763
|
})));
|
|
793
764
|
case 2:
|
|
794
|
-
return
|
|
765
|
+
return _context15.abrupt("return", retry);
|
|
795
766
|
case 3:
|
|
796
767
|
case "end":
|
|
797
|
-
return
|
|
768
|
+
return _context15.stop();
|
|
798
769
|
}
|
|
799
|
-
},
|
|
770
|
+
}, _callee15, this);
|
|
800
771
|
}));
|
|
801
|
-
function handleConnectionRestoration(
|
|
772
|
+
function handleConnectionRestoration(_x7) {
|
|
802
773
|
return _handleConnectionRestoration.apply(this, arguments);
|
|
803
774
|
}
|
|
804
775
|
return handleConnectionRestoration;
|
|
@@ -814,53 +785,53 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
814
785
|
value: function restoreRegistrationCallBack() {
|
|
815
786
|
var _this5 = this;
|
|
816
787
|
return /*#__PURE__*/function () {
|
|
817
|
-
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
788
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(restoreData, caller) {
|
|
818
789
|
var logContext, restore, finalError;
|
|
819
|
-
return _regenerator.default.wrap(function
|
|
820
|
-
while (1) switch (
|
|
790
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
791
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
821
792
|
case 0:
|
|
822
793
|
logContext = {
|
|
823
794
|
file: _constants.REGISTRATION_FILE,
|
|
824
795
|
method: caller
|
|
825
796
|
};
|
|
826
797
|
if (_this5.isRegRetry()) {
|
|
827
|
-
|
|
798
|
+
_context16.next = 17;
|
|
828
799
|
break;
|
|
829
800
|
}
|
|
830
801
|
_Logger.default.info('Registration restoration in progress.', logContext);
|
|
831
802
|
restore = _this5.getExistingDevice(restoreData);
|
|
832
803
|
if (!restore) {
|
|
833
|
-
|
|
804
|
+
_context16.next = 14;
|
|
834
805
|
break;
|
|
835
806
|
}
|
|
836
807
|
_this5.setRegRetry(true);
|
|
837
|
-
|
|
808
|
+
_context16.next = 8;
|
|
838
809
|
return _this5.deregister();
|
|
839
810
|
case 8:
|
|
840
|
-
|
|
811
|
+
_context16.next = 10;
|
|
841
812
|
return _this5.restorePreviousRegistration(caller);
|
|
842
813
|
case 10:
|
|
843
|
-
finalError =
|
|
814
|
+
finalError = _context16.sent;
|
|
844
815
|
_this5.setRegRetry(false);
|
|
845
816
|
if (_this5.isDeviceRegistered()) {
|
|
846
817
|
_Logger.default.info('Registration restored successfully.', logContext);
|
|
847
818
|
}
|
|
848
|
-
return
|
|
819
|
+
return _context16.abrupt("return", finalError);
|
|
849
820
|
case 14:
|
|
850
821
|
_this5.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
|
|
851
|
-
|
|
822
|
+
_context16.next = 18;
|
|
852
823
|
break;
|
|
853
824
|
case 17:
|
|
854
825
|
_this5.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
|
|
855
826
|
case 18:
|
|
856
|
-
return
|
|
827
|
+
return _context16.abrupt("return", false);
|
|
857
828
|
case 19:
|
|
858
829
|
case "end":
|
|
859
|
-
return
|
|
830
|
+
return _context16.stop();
|
|
860
831
|
}
|
|
861
|
-
},
|
|
832
|
+
}, _callee16);
|
|
862
833
|
}));
|
|
863
|
-
return function (
|
|
834
|
+
return function (_x8, _x9) {
|
|
864
835
|
return _ref8.apply(this, arguments);
|
|
865
836
|
};
|
|
866
837
|
}();
|
|
@@ -873,30 +844,30 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
873
844
|
}, {
|
|
874
845
|
key: "triggerRegistration",
|
|
875
846
|
value: (function () {
|
|
876
|
-
var _triggerRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
847
|
+
var _triggerRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
877
848
|
var abort;
|
|
878
|
-
return _regenerator.default.wrap(function
|
|
879
|
-
while (1) switch (
|
|
849
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
850
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
880
851
|
case 0:
|
|
881
852
|
if (!(this.primaryMobiusUris.length > 0)) {
|
|
882
|
-
|
|
853
|
+
_context17.next = 7;
|
|
883
854
|
break;
|
|
884
855
|
}
|
|
885
|
-
|
|
856
|
+
_context17.next = 3;
|
|
886
857
|
return this.attemptRegistrationWithServers(this.triggerRegistration.name, this.primaryMobiusUris);
|
|
887
858
|
case 3:
|
|
888
|
-
abort =
|
|
859
|
+
abort = _context17.sent;
|
|
889
860
|
if (!(!this.isDeviceRegistered() && !abort)) {
|
|
890
|
-
|
|
861
|
+
_context17.next = 7;
|
|
891
862
|
break;
|
|
892
863
|
}
|
|
893
|
-
|
|
864
|
+
_context17.next = 7;
|
|
894
865
|
return this.startFailoverTimer();
|
|
895
866
|
case 7:
|
|
896
867
|
case "end":
|
|
897
|
-
return
|
|
868
|
+
return _context17.stop();
|
|
898
869
|
}
|
|
899
|
-
},
|
|
870
|
+
}, _callee17, this);
|
|
900
871
|
}));
|
|
901
872
|
function triggerRegistration() {
|
|
902
873
|
return _triggerRegistration.apply(this, arguments);
|
|
@@ -915,7 +886,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
915
886
|
}, {
|
|
916
887
|
key: "attemptRegistrationWithServers",
|
|
917
888
|
value: (function () {
|
|
918
|
-
var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
889
|
+
var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(caller) {
|
|
919
890
|
var _this6 = this;
|
|
920
891
|
var servers,
|
|
921
892
|
abort,
|
|
@@ -926,38 +897,38 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
926
897
|
resp,
|
|
927
898
|
body,
|
|
928
899
|
error,
|
|
929
|
-
|
|
930
|
-
return _regenerator.default.wrap(function
|
|
931
|
-
while (1) switch (
|
|
900
|
+
_args18 = arguments;
|
|
901
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
902
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
932
903
|
case 0:
|
|
933
|
-
servers =
|
|
904
|
+
servers = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : this.primaryMobiusUris;
|
|
934
905
|
abort = false;
|
|
935
906
|
if (!this.failoverImmediately) {
|
|
936
|
-
|
|
907
|
+
_context18.next = 4;
|
|
937
908
|
break;
|
|
938
909
|
}
|
|
939
|
-
return
|
|
910
|
+
return _context18.abrupt("return", abort);
|
|
940
911
|
case 4:
|
|
941
912
|
if (!this.isDeviceRegistered()) {
|
|
942
|
-
|
|
913
|
+
_context18.next = 7;
|
|
943
914
|
break;
|
|
944
915
|
}
|
|
945
916
|
_Logger.default.log("[".concat(caller, "] : Device already registered with : ").concat(this.activeMobiusUrl), {
|
|
946
917
|
file: _constants.REGISTRATION_FILE,
|
|
947
918
|
method: this.attemptRegistrationWithServers.name
|
|
948
919
|
});
|
|
949
|
-
return
|
|
920
|
+
return _context18.abrupt("return", abort);
|
|
950
921
|
case 7:
|
|
951
922
|
_iterator = _createForOfIteratorHelper(servers);
|
|
952
|
-
|
|
923
|
+
_context18.prev = 8;
|
|
953
924
|
_iterator.s();
|
|
954
925
|
case 10:
|
|
955
926
|
if ((_step = _iterator.n()).done) {
|
|
956
|
-
|
|
927
|
+
_context18.next = 55;
|
|
957
928
|
break;
|
|
958
929
|
}
|
|
959
930
|
url = _step.value;
|
|
960
|
-
|
|
931
|
+
_context18.prev = 12;
|
|
961
932
|
abort = false;
|
|
962
933
|
this.registrationStatus = _types3.RegistrationStatus.INACTIVE;
|
|
963
934
|
this.lineEmitter(_types4.LINE_EVENTS.CONNECTING);
|
|
@@ -966,10 +937,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
966
937
|
method: this.attemptRegistrationWithServers.name
|
|
967
938
|
});
|
|
968
939
|
// eslint-disable-next-line no-await-in-loop
|
|
969
|
-
|
|
940
|
+
_context18.next = 19;
|
|
970
941
|
return this.postRegistration(url);
|
|
971
942
|
case 19:
|
|
972
|
-
resp =
|
|
943
|
+
resp = _context18.sent;
|
|
973
944
|
this.deviceInfo = resp.body;
|
|
974
945
|
this.registrationStatus = _types3.RegistrationStatus.ACTIVE;
|
|
975
946
|
this.lineEmitter(_types4.LINE_EVENTS.REGISTERED, resp.body);
|
|
@@ -979,12 +950,12 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
979
950
|
this.metricManager.submitRegistrationMetric(_types2.METRIC_EVENT.REGISTRATION, _types2.REG_ACTION.REGISTER, _types2.METRIC_TYPE.BEHAVIORAL, undefined);
|
|
980
951
|
this.startKeepaliveTimer((_this$deviceInfo$devi = this.deviceInfo.device) === null || _this$deviceInfo$devi === void 0 ? void 0 : _this$deviceInfo$devi.uri, this.deviceInfo.keepaliveInterval);
|
|
981
952
|
this.initiateFailback();
|
|
982
|
-
return
|
|
953
|
+
return _context18.abrupt("break", 55);
|
|
983
954
|
case 32:
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
body =
|
|
987
|
-
|
|
955
|
+
_context18.prev = 32;
|
|
956
|
+
_context18.t0 = _context18["catch"](12);
|
|
957
|
+
body = _context18.t0; // eslint-disable-next-line no-await-in-loop, @typescript-eslint/no-unused-vars
|
|
958
|
+
_context18.next = 37;
|
|
988
959
|
return (0, _common.handleRegistrationErrors)(body, function (clientError, finalError) {
|
|
989
960
|
if (finalError) {
|
|
990
961
|
_this6.lineEmitter(_types4.LINE_EVENTS.ERROR, undefined, clientError);
|
|
@@ -997,61 +968,61 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
997
968
|
file: _constants.REGISTRATION_FILE
|
|
998
969
|
}, this.restoreRegistrationCallBack());
|
|
999
970
|
case 37:
|
|
1000
|
-
abort =
|
|
971
|
+
abort = _context18.sent;
|
|
1001
972
|
if (!(this.registrationStatus === _types3.RegistrationStatus.ACTIVE)) {
|
|
1002
|
-
|
|
973
|
+
_context18.next = 41;
|
|
1003
974
|
break;
|
|
1004
975
|
}
|
|
1005
976
|
_Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(this.activeMobiusUrl), {
|
|
1006
977
|
file: _constants.REGISTRATION_FILE,
|
|
1007
978
|
method: this.attemptRegistrationWithServers.name
|
|
1008
979
|
});
|
|
1009
|
-
return
|
|
980
|
+
return _context18.abrupt("break", 55);
|
|
1010
981
|
case 41:
|
|
1011
982
|
if (!abort) {
|
|
1012
|
-
|
|
983
|
+
_context18.next = 46;
|
|
1013
984
|
break;
|
|
1014
985
|
}
|
|
1015
986
|
this.setStatus(_types3.RegistrationStatus.INACTIVE);
|
|
1016
|
-
return
|
|
987
|
+
return _context18.abrupt("break", 55);
|
|
1017
988
|
case 46:
|
|
1018
989
|
if (!(caller === this.executeFailback.name)) {
|
|
1019
|
-
|
|
990
|
+
_context18.next = 53;
|
|
1020
991
|
break;
|
|
1021
992
|
}
|
|
1022
993
|
error = body.statusCode;
|
|
1023
994
|
if (!(error === _types.ERROR_CODE.TOO_MANY_REQUESTS)) {
|
|
1024
|
-
|
|
995
|
+
_context18.next = 53;
|
|
1025
996
|
break;
|
|
1026
997
|
}
|
|
1027
|
-
|
|
998
|
+
_context18.next = 51;
|
|
1028
999
|
return this.scheduleFailback429Retry();
|
|
1029
1000
|
case 51:
|
|
1030
1001
|
abort = true;
|
|
1031
|
-
return
|
|
1002
|
+
return _context18.abrupt("break", 55);
|
|
1032
1003
|
case 53:
|
|
1033
|
-
|
|
1004
|
+
_context18.next = 10;
|
|
1034
1005
|
break;
|
|
1035
1006
|
case 55:
|
|
1036
|
-
|
|
1007
|
+
_context18.next = 60;
|
|
1037
1008
|
break;
|
|
1038
1009
|
case 57:
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
_iterator.e(
|
|
1010
|
+
_context18.prev = 57;
|
|
1011
|
+
_context18.t1 = _context18["catch"](8);
|
|
1012
|
+
_iterator.e(_context18.t1);
|
|
1042
1013
|
case 60:
|
|
1043
|
-
|
|
1014
|
+
_context18.prev = 60;
|
|
1044
1015
|
_iterator.f();
|
|
1045
|
-
return
|
|
1016
|
+
return _context18.finish(60);
|
|
1046
1017
|
case 63:
|
|
1047
|
-
return
|
|
1018
|
+
return _context18.abrupt("return", abort);
|
|
1048
1019
|
case 64:
|
|
1049
1020
|
case "end":
|
|
1050
|
-
return
|
|
1021
|
+
return _context18.stop();
|
|
1051
1022
|
}
|
|
1052
|
-
},
|
|
1023
|
+
}, _callee18, this, [[8, 57, 60, 63], [12, 32]]);
|
|
1053
1024
|
}));
|
|
1054
|
-
function attemptRegistrationWithServers(
|
|
1025
|
+
function attemptRegistrationWithServers(_x10) {
|
|
1055
1026
|
return _attemptRegistrationWithServers.apply(this, arguments);
|
|
1056
1027
|
}
|
|
1057
1028
|
return attemptRegistrationWithServers;
|
|
@@ -1063,103 +1034,132 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1063
1034
|
)
|
|
1064
1035
|
}, {
|
|
1065
1036
|
key: "startKeepaliveTimer",
|
|
1066
|
-
value: function
|
|
1067
|
-
var
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
var RETRY_COUNT_THRESHOLD = this.isCCFlow ? 4 : 5;
|
|
1071
|
-
this.keepaliveTimer = setInterval( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1072
|
-
var logContext;
|
|
1037
|
+
value: (function () {
|
|
1038
|
+
var _startKeepaliveTimer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(url, interval) {
|
|
1039
|
+
var _this7 = this;
|
|
1040
|
+
var RETRY_COUNT_THRESHOLD;
|
|
1073
1041
|
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
1074
1042
|
while (1) switch (_context21.prev = _context21.next) {
|
|
1075
1043
|
case 0:
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
return _this7.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1082
|
-
var res, error, abort;
|
|
1044
|
+
this.clearKeepaliveTimer();
|
|
1045
|
+
RETRY_COUNT_THRESHOLD = this.isCCFlow ? 4 : 5;
|
|
1046
|
+
_context21.next = 4;
|
|
1047
|
+
return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1048
|
+
var accessToken;
|
|
1083
1049
|
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
1084
1050
|
while (1) switch (_context20.prev = _context20.next) {
|
|
1085
1051
|
case 0:
|
|
1086
|
-
if (!
|
|
1087
|
-
_context20.next =
|
|
1088
|
-
break;
|
|
1089
|
-
}
|
|
1090
|
-
_context20.prev = 1;
|
|
1091
|
-
_context20.next = 4;
|
|
1092
|
-
return _this7.postKeepAlive(url);
|
|
1093
|
-
case 4:
|
|
1094
|
-
res = _context20.sent;
|
|
1095
|
-
_Logger.default.info("Sent Keepalive, status: ".concat(res.statusCode), logContext);
|
|
1096
|
-
if (keepAliveRetryCount > 0) {
|
|
1097
|
-
_this7.lineEmitter(_types4.LINE_EVENTS.RECONNECTED);
|
|
1098
|
-
}
|
|
1099
|
-
keepAliveRetryCount = 0;
|
|
1100
|
-
_context20.next = 30;
|
|
1101
|
-
break;
|
|
1102
|
-
case 10:
|
|
1103
|
-
_context20.prev = 10;
|
|
1104
|
-
_context20.t0 = _context20["catch"](1);
|
|
1105
|
-
keepAliveRetryCount += 1;
|
|
1106
|
-
error = _context20.t0;
|
|
1107
|
-
_Logger.default.warn("Keep-alive missed ".concat(keepAliveRetryCount, " times. Status -> ").concat(error.statusCode, " "), logContext);
|
|
1108
|
-
_context20.next = 17;
|
|
1109
|
-
return (0, _common.handleRegistrationErrors)(error, function (clientError, finalError) {
|
|
1110
|
-
if (finalError) {
|
|
1111
|
-
_this7.lineEmitter(_types4.LINE_EVENTS.ERROR, undefined, clientError);
|
|
1112
|
-
}
|
|
1113
|
-
_this7.metricManager.submitRegistrationMetric(_types2.METRIC_EVENT.REGISTRATION, _types2.REG_ACTION.KEEPALIVE_FAILURE, _types2.METRIC_TYPE.BEHAVIORAL, clientError);
|
|
1114
|
-
}, {
|
|
1115
|
-
method: _this7.startKeepaliveTimer.name,
|
|
1116
|
-
file: _constants.REGISTRATION_FILE
|
|
1117
|
-
});
|
|
1118
|
-
case 17:
|
|
1119
|
-
abort = _context20.sent;
|
|
1120
|
-
if (!(abort || keepAliveRetryCount >= RETRY_COUNT_THRESHOLD)) {
|
|
1121
|
-
_context20.next = 29;
|
|
1052
|
+
if (!_this7.isDeviceRegistered()) {
|
|
1053
|
+
_context20.next = 5;
|
|
1122
1054
|
break;
|
|
1123
1055
|
}
|
|
1124
|
-
|
|
1125
|
-
_this7.
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
_this7.
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1056
|
+
_context20.next = 3;
|
|
1057
|
+
return _this7.webex.credentials.getUserToken();
|
|
1058
|
+
case 3:
|
|
1059
|
+
accessToken = _context20.sent;
|
|
1060
|
+
if (!_this7.webWorker) {
|
|
1061
|
+
_this7.webWorker = new Worker(new URL('./webWorker.js', import.meta.url));
|
|
1062
|
+
_this7.webWorker.postMessage({
|
|
1063
|
+
type: _types3.WorkerMessageType.START_KEEPALIVE,
|
|
1064
|
+
accessToken: String(accessToken),
|
|
1065
|
+
deviceUrl: String(_this7.webex.internal.device.url),
|
|
1066
|
+
interval: interval,
|
|
1067
|
+
retryCountThreshold: RETRY_COUNT_THRESHOLD,
|
|
1068
|
+
url: url
|
|
1069
|
+
});
|
|
1070
|
+
_this7.webWorker.onmessage = /*#__PURE__*/function () {
|
|
1071
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(event) {
|
|
1072
|
+
var logContext, error, abort;
|
|
1073
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
1074
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1075
|
+
case 0:
|
|
1076
|
+
logContext = {
|
|
1077
|
+
file: _constants.REGISTRATION_FILE,
|
|
1078
|
+
method: _this7.startKeepaliveTimer.name
|
|
1079
|
+
};
|
|
1080
|
+
if (event.data.type === _types3.WorkerMessageType.KEEPALIVE_SUCCESS) {
|
|
1081
|
+
_Logger.default.info("Sent Keepalive, status: ".concat(event.data.statusCode), logContext);
|
|
1082
|
+
_this7.lineEmitter(_types4.LINE_EVENTS.RECONNECTED);
|
|
1083
|
+
}
|
|
1084
|
+
if (!(event.data.type === _types3.WorkerMessageType.KEEPALIVE_FAILURE)) {
|
|
1085
|
+
_context19.next = 20;
|
|
1086
|
+
break;
|
|
1087
|
+
}
|
|
1088
|
+
error = event.data.err;
|
|
1089
|
+
_Logger.default.warn("Keep-alive missed ".concat(event.data.keepAliveRetryCount, " times. Status -> ").concat(error.statusCode, " "), logContext);
|
|
1090
|
+
_context19.next = 7;
|
|
1091
|
+
return (0, _common.handleRegistrationErrors)(error, function (clientError, finalError) {
|
|
1092
|
+
if (finalError) {
|
|
1093
|
+
_this7.lineEmitter(_types4.LINE_EVENTS.ERROR, undefined, clientError);
|
|
1094
|
+
}
|
|
1095
|
+
_this7.metricManager.submitRegistrationMetric(_types2.METRIC_EVENT.REGISTRATION, _types2.REG_ACTION.KEEPALIVE_FAILURE, _types2.METRIC_TYPE.BEHAVIORAL, clientError);
|
|
1096
|
+
}, {
|
|
1097
|
+
method: _this7.startKeepaliveTimer.name,
|
|
1098
|
+
file: _constants.REGISTRATION_FILE
|
|
1099
|
+
});
|
|
1100
|
+
case 7:
|
|
1101
|
+
abort = _context19.sent;
|
|
1102
|
+
if (!(abort || event.data.keepAliveRetryCount >= RETRY_COUNT_THRESHOLD)) {
|
|
1103
|
+
_context19.next = 19;
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
_this7.failoverImmediately = _this7.isCCFlow;
|
|
1107
|
+
_this7.setStatus(_types3.RegistrationStatus.INACTIVE);
|
|
1108
|
+
_this7.clearKeepaliveTimer();
|
|
1109
|
+
_this7.clearFailbackTimer();
|
|
1110
|
+
_this7.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
|
|
1111
|
+
if (abort) {
|
|
1112
|
+
_context19.next = 17;
|
|
1113
|
+
break;
|
|
1114
|
+
}
|
|
1115
|
+
_context19.next = 17;
|
|
1116
|
+
return _this7.reconnectOnFailure(_this7.startKeepaliveTimer.name);
|
|
1117
|
+
case 17:
|
|
1118
|
+
_context19.next = 20;
|
|
1119
|
+
break;
|
|
1120
|
+
case 19:
|
|
1121
|
+
_this7.lineEmitter(_types4.LINE_EVENTS.RECONNECTING);
|
|
1122
|
+
case 20:
|
|
1123
|
+
case "end":
|
|
1124
|
+
return _context19.stop();
|
|
1125
|
+
}
|
|
1126
|
+
}, _callee19);
|
|
1127
|
+
}));
|
|
1128
|
+
return function (_x13) {
|
|
1129
|
+
return _ref10.apply(this, arguments);
|
|
1130
|
+
};
|
|
1131
|
+
}();
|
|
1132
1132
|
}
|
|
1133
|
-
|
|
1134
|
-
return _this7.reconnectOnFailure(_this7.startKeepaliveTimer.name);
|
|
1135
|
-
case 27:
|
|
1136
|
-
_context20.next = 30;
|
|
1137
|
-
break;
|
|
1138
|
-
case 29:
|
|
1139
|
-
_this7.lineEmitter(_types4.LINE_EVENTS.RECONNECTING);
|
|
1140
|
-
case 30:
|
|
1133
|
+
case 5:
|
|
1141
1134
|
case "end":
|
|
1142
1135
|
return _context20.stop();
|
|
1143
1136
|
}
|
|
1144
|
-
}, _callee20
|
|
1137
|
+
}, _callee20);
|
|
1145
1138
|
})));
|
|
1146
|
-
case
|
|
1139
|
+
case 4:
|
|
1147
1140
|
case "end":
|
|
1148
1141
|
return _context21.stop();
|
|
1149
1142
|
}
|
|
1150
|
-
}, _callee21);
|
|
1151
|
-
}))
|
|
1152
|
-
|
|
1153
|
-
|
|
1143
|
+
}, _callee21, this);
|
|
1144
|
+
}));
|
|
1145
|
+
function startKeepaliveTimer(_x11, _x12) {
|
|
1146
|
+
return _startKeepaliveTimer.apply(this, arguments);
|
|
1147
|
+
}
|
|
1148
|
+
return startKeepaliveTimer;
|
|
1149
|
+
}()
|
|
1154
1150
|
/**
|
|
1155
1151
|
* Clears the keepalive timer if running.
|
|
1156
1152
|
*/
|
|
1153
|
+
)
|
|
1157
1154
|
}, {
|
|
1158
1155
|
key: "clearKeepaliveTimer",
|
|
1159
1156
|
value: function clearKeepaliveTimer() {
|
|
1160
|
-
if (this.
|
|
1161
|
-
|
|
1162
|
-
|
|
1157
|
+
if (this.webWorker) {
|
|
1158
|
+
this.webWorker.postMessage({
|
|
1159
|
+
type: _types3.WorkerMessageType.CLEAR_KEEPALIVE
|
|
1160
|
+
});
|
|
1161
|
+
this.webWorker.terminate();
|
|
1162
|
+
this.webWorker = undefined;
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
1165
|
}, {
|
|
@@ -1295,7 +1295,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
}, _callee23, this);
|
|
1297
1297
|
}));
|
|
1298
|
-
function reconnectOnFailure(
|
|
1298
|
+
function reconnectOnFailure(_x14) {
|
|
1299
1299
|
return _reconnectOnFailure.apply(this, arguments);
|
|
1300
1300
|
}
|
|
1301
1301
|
return reconnectOnFailure;
|