@webex/calling 3.8.0-next.30 → 3.8.0-next.32

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.
@@ -210,7 +210,7 @@ function emitFinalFailure(emitterCb, loggerContext) {
210
210
  * be scheduled to attempt registration again.
211
211
  *
212
212
  */
213
- function handleRegistrationErrors(_x, _x2, _x3, _x4) {
213
+ function handleRegistrationErrors(_x, _x2, _x3, _x4, _x5) {
214
214
  return _handleRegistrationErrors.apply(this, arguments);
215
215
  }
216
216
  /**
@@ -221,8 +221,8 @@ function handleRegistrationErrors(_x, _x2, _x3, _x4) {
221
221
  * @param restoreRegCb - Callback which will try restoring resgistration in case of 403
222
222
  */
223
223
  function _handleRegistrationErrors() {
224
- _handleRegistrationErrors = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(err, emitterCb, loggerContext, restoreRegCb) {
225
- var lineError, errorCode, finalError, errorBody, code, errorMessage, caller, _errorMessage, _errorMessage2, _errorMessage3;
224
+ _handleRegistrationErrors = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(err, emitterCb, loggerContext, retry429Cb, restoreRegCb) {
225
+ var lineError, errorCode, finalError, caller, retryAfter, errorBody, code, errorMessage, _caller, _errorMessage, _errorMessage2, _errorMessage3;
226
226
  return _regenerator.default.wrap(function _callee$(_context) {
227
227
  while (1) switch (_context.prev = _context.next) {
228
228
  case 0:
@@ -231,87 +231,101 @@ function _handleRegistrationErrors() {
231
231
  finalError = false;
232
232
  _Logger.default.warn("Status code: -> ".concat(errorCode), loggerContext);
233
233
  _context.t0 = errorCode;
234
- _context.next = _context.t0 === _types.ERROR_CODE.UNAUTHORIZED ? 7 : _context.t0 === _types.ERROR_CODE.INTERNAL_SERVER_ERROR ? 12 : _context.t0 === _types.ERROR_CODE.SERVICE_UNAVAILABLE ? 16 : _context.t0 === _types.ERROR_CODE.FORBIDDEN ? 20 : _context.t0 === _types.ERROR_CODE.DEVICE_NOT_FOUND ? 55 : 60;
234
+ _context.next = _context.t0 === _types.ERROR_CODE.BAD_REQUEST ? 7 : _context.t0 === _types.ERROR_CODE.UNAUTHORIZED ? 12 : _context.t0 === _types.ERROR_CODE.DEVICE_NOT_FOUND ? 17 : _context.t0 === _types.ERROR_CODE.TOO_MANY_REQUESTS ? 22 : _context.t0 === _types.ERROR_CODE.INTERNAL_SERVER_ERROR ? 26 : _context.t0 === _types.ERROR_CODE.SERVICE_UNAVAILABLE ? 30 : _context.t0 === _types.ERROR_CODE.FORBIDDEN ? 34 : 69;
235
235
  break;
236
236
  case 7:
237
+ finalError = true;
238
+ _Logger.default.warn("400 Bad Request", loggerContext);
239
+ updateLineErrorContext(loggerContext, _types.ERROR_TYPE.SERVER_ERROR, 'Invalid input. Please verify the required parameters, sign out and then sign back in with the valid data', _types2.RegistrationStatus.INACTIVE, lineError);
240
+ emitterCb(lineError, finalError);
241
+ return _context.abrupt("break", 72);
242
+ case 12:
237
243
  // Return it to the Caller
238
244
  finalError = true;
239
245
  _Logger.default.warn("401 Unauthorized", loggerContext);
240
246
  updateLineErrorContext(loggerContext, _types.ERROR_TYPE.TOKEN_ERROR, 'User is unauthorized due to an expired token. Sign out, then sign back in.', _types2.RegistrationStatus.INACTIVE, lineError);
241
247
  emitterCb(lineError, finalError);
242
- return _context.abrupt("break", 63);
243
- case 12:
248
+ return _context.abrupt("break", 72);
249
+ case 17:
250
+ finalError = true;
251
+ _Logger.default.warn("404 Device Not Found", loggerContext);
252
+ updateLineErrorContext(loggerContext, _types.ERROR_TYPE.NOT_FOUND, 'Webex Calling is unable to find your device. Sign out, then sign back in', _types2.RegistrationStatus.INACTIVE, lineError);
253
+ emitterCb(lineError, finalError);
254
+ return _context.abrupt("break", 72);
255
+ case 22:
256
+ _Logger.default.warn("429 Too Many Requests", loggerContext);
257
+ caller = loggerContext.method || 'handleErrors';
258
+ if (retry429Cb && err.headers) {
259
+ retryAfter = Number(err.headers['retry-after']);
260
+ retry429Cb(retryAfter, caller);
261
+ }
262
+ return _context.abrupt("break", 72);
263
+ case 26:
244
264
  _Logger.default.warn("500 Internal Server Error", loggerContext);
245
265
  updateLineErrorContext(loggerContext, _types.ERROR_TYPE.SERVER_ERROR, 'An unknown error occurred while placing the request. Wait a moment and try again.', _types2.RegistrationStatus.INACTIVE, lineError);
246
266
  emitterCb(lineError, finalError);
247
- return _context.abrupt("break", 63);
248
- case 16:
267
+ return _context.abrupt("break", 72);
268
+ case 30:
249
269
  _Logger.default.warn("503 Service Unavailable", loggerContext);
250
270
  updateLineErrorContext(loggerContext, _types.ERROR_TYPE.SERVICE_UNAVAILABLE, 'An error occurred on the server while processing the request. Wait a moment and try again.', _types2.RegistrationStatus.INACTIVE, lineError);
251
271
  emitterCb(lineError, finalError);
252
- return _context.abrupt("break", 63);
253
- case 20:
272
+ return _context.abrupt("break", 72);
273
+ case 34:
254
274
  _Logger.default.warn("403 Forbidden", loggerContext);
255
275
  errorBody = err.body;
256
276
  if (errorBody) {
257
- _context.next = 27;
277
+ _context.next = 41;
258
278
  break;
259
279
  }
260
280
  _Logger.default.warn('Error response has no body, throwing default error', loggerContext);
261
281
  updateLineErrorContext(loggerContext, _types.ERROR_TYPE.FORBIDDEN_ERROR, 'An unauthorized action has been received. This action has been blocked. Please contact the administrator if this persists.', _types2.RegistrationStatus.INACTIVE, lineError);
262
282
  emitterCb(lineError, finalError);
263
283
  return _context.abrupt("return", finalError);
264
- case 27:
284
+ case 41:
265
285
  code = Number(errorBody.errorCode);
266
286
  _Logger.default.warn("Error code found : ".concat(code), loggerContext);
267
287
  _context.t1 = code;
268
- _context.next = _context.t1 === _types.DEVICE_ERROR_CODE.DEVICE_LIMIT_EXCEEDED ? 32 : _context.t1 === _types.DEVICE_ERROR_CODE.DEVICE_CREATION_DISABLED ? 39 : _context.t1 === _types.DEVICE_ERROR_CODE.DEVICE_CREATION_FAILED ? 45 : 50;
288
+ _context.next = _context.t1 === _types.DEVICE_ERROR_CODE.DEVICE_LIMIT_EXCEEDED ? 46 : _context.t1 === _types.DEVICE_ERROR_CODE.DEVICE_CREATION_DISABLED ? 53 : _context.t1 === _types.DEVICE_ERROR_CODE.DEVICE_CREATION_FAILED ? 59 : 64;
269
289
  break;
270
- case 32:
290
+ case 46:
271
291
  errorMessage = 'User device limit exceeded';
272
292
  _Logger.default.warn(errorMessage, loggerContext);
273
293
  if (!restoreRegCb) {
274
- _context.next = 38;
294
+ _context.next = 52;
275
295
  break;
276
296
  }
277
- caller = loggerContext.method || 'handleErrors';
278
- _context.next = 38;
279
- return restoreRegCb(errorBody, caller);
280
- case 38:
281
- return _context.abrupt("break", 54);
282
- case 39:
297
+ _caller = loggerContext.method || 'handleErrors';
298
+ _context.next = 52;
299
+ return restoreRegCb(errorBody, _caller);
300
+ case 52:
301
+ return _context.abrupt("break", 68);
302
+ case 53:
283
303
  _errorMessage = 'User is not configured for WebRTC calling. Please contact the administrator to resolve this issue.';
284
304
  finalError = true;
285
305
  updateLineErrorContext(loggerContext, _types.ERROR_TYPE.FORBIDDEN_ERROR, _errorMessage, _types2.RegistrationStatus.INACTIVE, lineError);
286
306
  _Logger.default.warn(_errorMessage, loggerContext);
287
307
  emitterCb(lineError, true);
288
- return _context.abrupt("break", 54);
289
- case 45:
308
+ return _context.abrupt("break", 68);
309
+ case 59:
290
310
  _errorMessage2 = 'An unknown error occurred while provisioning the device. Wait a moment and try again.';
291
311
  updateLineErrorContext(loggerContext, _types.ERROR_TYPE.FORBIDDEN_ERROR, _errorMessage2, _types2.RegistrationStatus.INACTIVE, lineError);
292
312
  _Logger.default.warn(_errorMessage2, loggerContext);
293
313
  emitterCb(lineError, finalError);
294
- return _context.abrupt("break", 54);
295
- case 50:
314
+ return _context.abrupt("break", 68);
315
+ case 64:
296
316
  _errorMessage3 = 'An unknown error occurred. Wait a moment and try again. Please contact the administrator if the problem persists.';
297
317
  updateLineErrorContext(loggerContext, _types.ERROR_TYPE.FORBIDDEN_ERROR, _errorMessage3, _types2.RegistrationStatus.INACTIVE, lineError);
298
318
  _Logger.default.warn(_errorMessage3, loggerContext);
299
319
  emitterCb(lineError, finalError);
300
- case 54:
301
- return _context.abrupt("break", 63);
302
- case 55:
303
- finalError = true;
304
- _Logger.default.warn("404 Device Not Found", loggerContext);
305
- updateLineErrorContext(loggerContext, _types.ERROR_TYPE.NOT_FOUND, 'The client has unregistered. Please wait for the client to register before attempting the call. If error persists, sign out, sign back in and attempt the call.', _types2.RegistrationStatus.INACTIVE, lineError);
306
- emitterCb(lineError, finalError);
307
- return _context.abrupt("break", 63);
308
- case 60:
320
+ case 68:
321
+ return _context.abrupt("break", 72);
322
+ case 69:
309
323
  updateLineErrorContext(loggerContext, _types.ERROR_TYPE.DEFAULT, 'Unknown error', _types2.RegistrationStatus.INACTIVE, lineError);
310
324
  _Logger.default.warn("Unknown Error", loggerContext);
311
325
  emitterCb(lineError, finalError);
312
- case 63:
326
+ case 72:
313
327
  return _context.abrupt("return", finalError);
314
- case 64:
328
+ case 73:
315
329
  case "end":
316
330
  return _context.stop();
317
331
  }
@@ -319,7 +333,7 @@ function _handleRegistrationErrors() {
319
333
  }));
320
334
  return _handleRegistrationErrors.apply(this, arguments);
321
335
  }
322
- function handleCallingClientErrors(_x5, _x6, _x7) {
336
+ function handleCallingClientErrors(_x6, _x7, _x8) {
323
337
  return _handleCallingClientErrors.apply(this, arguments);
324
338
  }
325
339
  /**
@@ -366,7 +380,7 @@ function _handleCallingClientErrors() {
366
380
  }));
367
381
  return _handleCallingClientErrors.apply(this, arguments);
368
382
  }
369
- function handleCallErrors(_x8, _x9, _x10, _x11, _x12, _x13, _x14) {
383
+ function handleCallErrors(_x9, _x10, _x11, _x12, _x13, _x14, _x15) {
370
384
  return _handleCallErrors.apply(this, arguments);
371
385
  }
372
386
  /**
@@ -478,7 +492,7 @@ function _handleCallErrors() {
478
492
  }));
479
493
  return _handleCallErrors.apply(this, arguments);
480
494
  }
481
- function serviceErrorCodeHandler(_x15, _x16) {
495
+ function serviceErrorCodeHandler(_x16, _x17) {
482
496
  return _serviceErrorCodeHandler.apply(this, arguments);
483
497
  }
484
498
  /**
@@ -849,7 +863,7 @@ function getCallingBackEnd(webex) {
849
863
  * @param callingBackend -.
850
864
  * @returns Promise.
851
865
  */
852
- function getXsiActionEndpoint(_x17, _x18, _x19) {
866
+ function getXsiActionEndpoint(_x18, _x19, _x20) {
853
867
  return _getXsiActionEndpoint.apply(this, arguments);
854
868
  }
855
869
  /**
@@ -955,7 +969,7 @@ function getSortedVoicemailList(voiceMessageList, sortOrder) {
955
969
  * @param filter - A filter for the query.
956
970
  * @returns - Promise.
957
971
  */
958
- function scimQuery(_x20) {
972
+ function scimQuery(_x21) {
959
973
  return _scimQuery.apply(this, arguments);
960
974
  }
961
975
  /**
@@ -992,7 +1006,7 @@ function _scimQuery() {
992
1006
  }));
993
1007
  return _scimQuery.apply(this, arguments);
994
1008
  }
995
- function resolveCallerIdDisplay(_x21) {
1009
+ function resolveCallerIdDisplay(_x22) {
996
1010
  return _resolveCallerIdDisplay.apply(this, arguments);
997
1011
  }
998
1012
  /**
@@ -1069,7 +1083,7 @@ function _resolveCallerIdDisplay() {
1069
1083
  }));
1070
1084
  return _resolveCallerIdDisplay.apply(this, arguments);
1071
1085
  }
1072
- function resolveCallerIdByName(_x22) {
1086
+ function resolveCallerIdByName(_x23) {
1073
1087
  return _resolveCallerIdByName.apply(this, arguments);
1074
1088
  }
1075
1089
  /**
@@ -1133,7 +1147,7 @@ function _resolveCallerIdByName() {
1133
1147
  }));
1134
1148
  return _resolveCallerIdByName.apply(this, arguments);
1135
1149
  }
1136
- function resolveContact(_x23) {
1150
+ function resolveContact(_x24) {
1137
1151
  return _resolveContact.apply(this, arguments);
1138
1152
  }
1139
1153
  /**