@webex/calling 3.10.0-next.1 → 3.10.0-next.11
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 +26 -20
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +109 -0
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +2 -1
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +160 -205
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +152 -290
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +61 -43
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +594 -361
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/constants.js +3 -1
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +8 -5
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Events/impl/index.js +1 -2
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +14 -12
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +2 -1
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/common/Utils.js +68 -39
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +392 -143
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/testUtil.js +2 -1
- package/dist/common/testUtil.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +7 -3
- package/dist/module/CallSettings/WxCallBackendConnector.js +3 -1
- package/dist/module/CallingClient/CallingClient.js +83 -121
- package/dist/module/CallingClient/calling/call.js +35 -23
- package/dist/module/CallingClient/constants.js +1 -0
- package/dist/module/Contacts/ContactsClient.js +9 -5
- package/dist/module/Events/impl/index.js +1 -2
- package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -1
- package/dist/module/Voicemail/UcmBackendConnector.js +2 -1
- package/dist/module/common/Utils.js +27 -3
- package/dist/module/common/testUtil.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +2 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +1 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Events/impl/index.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +10 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/common/Utils.js
CHANGED
|
@@ -356,6 +356,8 @@ function handleCallingClientErrors(_x6, _x7, _x8) {
|
|
|
356
356
|
* @param err - Error Response.
|
|
357
357
|
* @param caller - Caller function.
|
|
358
358
|
* @param file - File name.
|
|
359
|
+
*
|
|
360
|
+
* @returns boolean - whether to abort the call or not.
|
|
359
361
|
*/
|
|
360
362
|
function _handleCallingClientErrors() {
|
|
361
363
|
_handleCallingClientErrors = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(err, emitterCb, loggerContext) {
|
|
@@ -411,10 +413,11 @@ function handleCallErrors(_x9, _x0, _x1, _x10, _x11, _x12, _x13) {
|
|
|
411
413
|
*/
|
|
412
414
|
function _handleCallErrors() {
|
|
413
415
|
_handleCallErrors = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(emitterCb, errorLayer, retryCb, correlationId, err, caller, file) {
|
|
414
|
-
var loggerContext, callError, errorCode, errorBody, retryInterval, code, message;
|
|
416
|
+
var abort, loggerContext, callError, errorCode, isKeepalive, errorBody, retryInterval, code, message, _retryInterval;
|
|
415
417
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
416
418
|
while (1) switch (_context3.prev = _context3.next) {
|
|
417
419
|
case 0:
|
|
420
|
+
abort = false;
|
|
418
421
|
loggerContext = {
|
|
419
422
|
file: file,
|
|
420
423
|
method: caller
|
|
@@ -422,87 +425,113 @@ function _handleCallErrors() {
|
|
|
422
425
|
callError = (0, _CallError.createCallError)('', loggerContext, _types2.ERROR_TYPE.DEFAULT, '', errorLayer);
|
|
423
426
|
errorCode = Number(err.statusCode);
|
|
424
427
|
_Logger.default.warn("Status code: ->".concat(errorCode), loggerContext);
|
|
428
|
+
isKeepalive = caller === _constants.METHODS.HANDLE_CALL_ESTABLISHED;
|
|
425
429
|
_context3.t0 = errorCode;
|
|
426
|
-
_context3.next = _context3.t0 === _types2.ERROR_CODE.UNAUTHORIZED ?
|
|
430
|
+
_context3.next = _context3.t0 === _types2.ERROR_CODE.UNAUTHORIZED ? 9 : _context3.t0 === _types2.ERROR_CODE.FORBIDDEN ? 14 : _context3.t0 === _types2.ERROR_CODE.SERVICE_UNAVAILABLE ? 19 : _context3.t0 === _types2.ERROR_CODE.DEVICE_NOT_FOUND ? 57 : _context3.t0 === _types2.ERROR_CODE.INTERNAL_SERVER_ERROR ? 62 : 67;
|
|
427
431
|
break;
|
|
428
|
-
case
|
|
432
|
+
case 9:
|
|
429
433
|
_Logger.default.warn("401 Unauthorized", loggerContext);
|
|
430
434
|
updateCallErrorContext(loggerContext, _types2.ERROR_TYPE.TOKEN_ERROR, 'User is unauthorized due to an expired token. Sign out, then sign back in.', correlationId, callError);
|
|
431
435
|
emitterCb(callError);
|
|
432
|
-
|
|
433
|
-
|
|
436
|
+
if (isKeepalive) {
|
|
437
|
+
abort = true;
|
|
438
|
+
}
|
|
439
|
+
return _context3.abrupt("break", 68);
|
|
440
|
+
case 14:
|
|
441
|
+
if (!isKeepalive) {
|
|
442
|
+
_context3.next = 19;
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
abort = true;
|
|
446
|
+
updateCallErrorContext(loggerContext, _types2.ERROR_TYPE.FORBIDDEN_ERROR, 'An unauthorized action has been received. This action has been blocked. Please contact the administrator if this persists.', correlationId, callError);
|
|
447
|
+
emitterCb(callError);
|
|
448
|
+
return _context3.abrupt("break", 68);
|
|
449
|
+
case 19:
|
|
434
450
|
errorBody = err.body;
|
|
435
451
|
if (errorBody) {
|
|
436
|
-
_context3.next =
|
|
452
|
+
_context3.next = 25;
|
|
437
453
|
break;
|
|
438
454
|
}
|
|
439
455
|
_Logger.default.warn('Error response has no body, throwing default error', loggerContext);
|
|
440
456
|
updateCallErrorContext(loggerContext, err.statusCode === 403 ? _types2.ERROR_TYPE.FORBIDDEN_ERROR : _types2.ERROR_TYPE.SERVICE_UNAVAILABLE, err.statusCode === 403 ? 'An unauthorized action has been received. This action has been blocked. Please contact the administrator if this persists.' : 'An error occurred on the server while processing the request. Wait a moment and try again.', correlationId, callError);
|
|
441
457
|
emitterCb(callError);
|
|
442
|
-
return _context3.abrupt("return");
|
|
443
|
-
case
|
|
458
|
+
return _context3.abrupt("return", abort);
|
|
459
|
+
case 25:
|
|
444
460
|
if (!(err.headers && 'retry-after' in err.headers && retryCb)) {
|
|
445
|
-
_context3.next =
|
|
461
|
+
_context3.next = 30;
|
|
446
462
|
break;
|
|
447
463
|
}
|
|
448
464
|
retryInterval = Number(err.headers['retry-after']);
|
|
449
465
|
_Logger.default.warn("Retry Interval received: ".concat(retryInterval), loggerContext);
|
|
450
466
|
retryCb(retryInterval);
|
|
451
|
-
return _context3.abrupt("return");
|
|
452
|
-
case
|
|
467
|
+
return _context3.abrupt("return", abort);
|
|
468
|
+
case 30:
|
|
469
|
+
if (isKeepalive) {
|
|
470
|
+
retryCb(_constants.DEFAULT_KEEPALIVE_INTERVAL); // This is applicable only for the keepalive scenario
|
|
471
|
+
}
|
|
472
|
+
|
|
453
473
|
/* Handling various Error codes */
|
|
454
474
|
code = Number(errorBody.errorCode);
|
|
455
475
|
_context3.t1 = code;
|
|
456
|
-
_context3.next = _context3.t1 === _types2.CALL_ERROR_CODE.INVALID_STATUS_UPDATE ?
|
|
476
|
+
_context3.next = _context3.t1 === _types2.CALL_ERROR_CODE.INVALID_STATUS_UPDATE ? 35 : _context3.t1 === _types2.CALL_ERROR_CODE.DEVICE_NOT_REGISTERED ? 37 : _context3.t1 === _types2.CALL_ERROR_CODE.CALL_NOT_FOUND ? 39 : _context3.t1 === _types2.CALL_ERROR_CODE.ERROR_PROCESSING ? 41 : _context3.t1 === _types2.CALL_ERROR_CODE.USER_BUSY ? 43 : _context3.t1 === _types2.CALL_ERROR_CODE.PARSING_ERROR ? 45 : _context3.t1 === _types2.CALL_ERROR_CODE.NOT_ACCEPTABLE ? 47 : _context3.t1 === _types2.CALL_ERROR_CODE.CALL_REJECTED ? 49 : _context3.t1 === _types2.CALL_ERROR_CODE.NOT_AVAILABLE ? 51 : 53;
|
|
457
477
|
break;
|
|
458
|
-
case
|
|
478
|
+
case 35:
|
|
459
479
|
message = 'An invalid status update has been received for the call. Wait a moment and try again.';
|
|
460
|
-
return _context3.abrupt("break",
|
|
461
|
-
case
|
|
480
|
+
return _context3.abrupt("break", 54);
|
|
481
|
+
case 37:
|
|
462
482
|
message = '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.';
|
|
463
|
-
return _context3.abrupt("break",
|
|
464
|
-
case
|
|
483
|
+
return _context3.abrupt("break", 54);
|
|
484
|
+
case 39:
|
|
465
485
|
message = 'Call is not found on the server. Wait a moment and try again.';
|
|
466
|
-
return _context3.abrupt("break",
|
|
467
|
-
case
|
|
486
|
+
return _context3.abrupt("break", 54);
|
|
487
|
+
case 41:
|
|
468
488
|
message = 'An error occurred while processing the call on the server. Wait a moment and try again.';
|
|
469
|
-
return _context3.abrupt("break",
|
|
470
|
-
case
|
|
489
|
+
return _context3.abrupt("break", 54);
|
|
490
|
+
case 43:
|
|
471
491
|
message = 'Called user is busy.';
|
|
472
|
-
return _context3.abrupt("break",
|
|
473
|
-
case
|
|
492
|
+
return _context3.abrupt("break", 54);
|
|
493
|
+
case 45:
|
|
474
494
|
message = 'An error occurred while parsing the provided information. Wait a moment and try again.';
|
|
475
|
-
return _context3.abrupt("break",
|
|
476
|
-
case
|
|
495
|
+
return _context3.abrupt("break", 54);
|
|
496
|
+
case 47:
|
|
477
497
|
message = 'An error occurred on the server while accepting the call. Wait a moment and try again. Please contact the administrator if this persists.';
|
|
478
|
-
return _context3.abrupt("break",
|
|
479
|
-
case
|
|
498
|
+
return _context3.abrupt("break", 54);
|
|
499
|
+
case 49:
|
|
480
500
|
message = 'Call rejected by the server. Wait a moment and try again. Please contact the administrator if this persists.';
|
|
481
|
-
return _context3.abrupt("break",
|
|
482
|
-
case
|
|
501
|
+
return _context3.abrupt("break", 54);
|
|
502
|
+
case 51:
|
|
483
503
|
message = 'Calling services not available. Wait a moment and try again. Please contact the administrator if this persists.';
|
|
484
|
-
return _context3.abrupt("break",
|
|
485
|
-
case
|
|
504
|
+
return _context3.abrupt("break", 54);
|
|
505
|
+
case 53:
|
|
486
506
|
message = 'An unknown error occurred. Wait a moment and try again.';
|
|
487
|
-
case
|
|
507
|
+
case 54:
|
|
488
508
|
/* We just emit the errors to the app */
|
|
489
509
|
|
|
490
510
|
updateCallErrorContext(loggerContext, err.statusCode === 403 ? _types2.ERROR_TYPE.FORBIDDEN_ERROR : _types2.ERROR_TYPE.SERVICE_UNAVAILABLE, message, correlationId, callError);
|
|
491
511
|
emitterCb(callError);
|
|
492
|
-
return _context3.abrupt("break",
|
|
493
|
-
case
|
|
512
|
+
return _context3.abrupt("break", 68);
|
|
513
|
+
case 57:
|
|
494
514
|
_Logger.default.warn("404 Call Not Found", loggerContext);
|
|
495
515
|
updateCallErrorContext(loggerContext, _types2.ERROR_TYPE.NOT_FOUND, 'Call is no longer active. Wait a moment and try again.', correlationId, callError);
|
|
496
516
|
emitterCb(callError);
|
|
497
|
-
|
|
498
|
-
|
|
517
|
+
if (isKeepalive) {
|
|
518
|
+
abort = true;
|
|
519
|
+
}
|
|
520
|
+
return _context3.abrupt("break", 68);
|
|
521
|
+
case 62:
|
|
499
522
|
_Logger.default.warn("500 Internal Server Error", loggerContext);
|
|
500
523
|
updateCallErrorContext(loggerContext, _types2.ERROR_TYPE.SERVER_ERROR, 'An unknown error occurred in the call. Wait a moment and try again.', correlationId, callError);
|
|
501
524
|
emitterCb(callError);
|
|
502
|
-
|
|
503
|
-
|
|
525
|
+
if (isKeepalive && retryCb) {
|
|
526
|
+
_retryInterval = err.headers && 'retry-after' in err.headers ? Number(err.headers['retry-after']) : _constants.DEFAULT_KEEPALIVE_INTERVAL;
|
|
527
|
+
retryCb(_retryInterval);
|
|
528
|
+
}
|
|
529
|
+
return _context3.abrupt("break", 68);
|
|
530
|
+
case 67:
|
|
504
531
|
_Logger.default.warn("Unknown Error", loggerContext);
|
|
505
|
-
case
|
|
532
|
+
case 68:
|
|
533
|
+
return _context3.abrupt("return", abort);
|
|
534
|
+
case 69:
|
|
506
535
|
case "end":
|
|
507
536
|
return _context3.stop();
|
|
508
537
|
}
|