@webex/calling 3.11.0-webex-services-ready.1 → 3.12.0-mobius-socket.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.
Files changed (110) hide show
  1. package/dist/CallHistory/CallHistory.js +68 -51
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallingClient/CallingClient.js +489 -165
  4. package/dist/CallingClient/CallingClient.js.map +1 -1
  5. package/dist/CallingClient/CallingClient.test.js +207 -6
  6. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  7. package/dist/CallingClient/calling/call.js +20 -16
  8. package/dist/CallingClient/calling/call.js.map +1 -1
  9. package/dist/CallingClient/calling/call.test.js +467 -387
  10. package/dist/CallingClient/calling/call.test.js.map +1 -1
  11. package/dist/CallingClient/calling/callManager.js +53 -32
  12. package/dist/CallingClient/calling/callManager.js.map +1 -1
  13. package/dist/CallingClient/calling/callManager.test.js +35 -0
  14. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  15. package/dist/CallingClient/calling/types.js +2 -0
  16. package/dist/CallingClient/calling/types.js.map +1 -1
  17. package/dist/CallingClient/constants.js +11 -3
  18. package/dist/CallingClient/constants.js.map +1 -1
  19. package/dist/CallingClient/line/line.test.js +15 -0
  20. package/dist/CallingClient/line/line.test.js.map +1 -1
  21. package/dist/CallingClient/registration/register.js +114 -71
  22. package/dist/CallingClient/registration/register.js.map +1 -1
  23. package/dist/CallingClient/registration/register.test.js +21 -12
  24. package/dist/CallingClient/registration/register.test.js.map +1 -1
  25. package/dist/CallingClient/registration/types.js.map +1 -1
  26. package/dist/CallingClient/registration/webWorker.js +2 -0
  27. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  28. package/dist/CallingClient/types.js.map +1 -1
  29. package/dist/CallingClient/utils/constants.js +46 -0
  30. package/dist/CallingClient/utils/constants.js.map +1 -0
  31. package/dist/CallingClient/utils/index.js +63 -0
  32. package/dist/CallingClient/utils/index.js.map +1 -0
  33. package/dist/CallingClient/utils/mobiusSocketMapper.js +106 -0
  34. package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -0
  35. package/dist/CallingClient/utils/request.js +267 -0
  36. package/dist/CallingClient/utils/request.js.map +1 -0
  37. package/dist/CallingClient/utils/types.js +7 -0
  38. package/dist/CallingClient/utils/types.js.map +1 -0
  39. package/dist/CallingClient/utils/wsFeatureFlag.js +20 -0
  40. package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -0
  41. package/dist/Events/types.js +1 -11
  42. package/dist/Events/types.js.map +1 -1
  43. package/dist/SDKConnector/index.js +32 -0
  44. package/dist/SDKConnector/index.js.map +1 -1
  45. package/dist/SDKConnector/types.js.map +1 -1
  46. package/dist/common/Utils.js +69 -10
  47. package/dist/common/Utils.js.map +1 -1
  48. package/dist/common/testUtil.js +5 -0
  49. package/dist/common/testUtil.js.map +1 -1
  50. package/dist/common/types.js.map +1 -1
  51. package/dist/module/CallHistory/CallHistory.js +28 -17
  52. package/dist/module/CallingClient/CallingClient.js +157 -4
  53. package/dist/module/CallingClient/calling/call.js +12 -8
  54. package/dist/module/CallingClient/calling/callManager.js +29 -10
  55. package/dist/module/CallingClient/calling/types.js +2 -0
  56. package/dist/module/CallingClient/constants.js +8 -0
  57. package/dist/module/CallingClient/registration/register.js +46 -16
  58. package/dist/module/CallingClient/utils/constants.js +30 -0
  59. package/dist/module/CallingClient/utils/index.js +5 -0
  60. package/dist/module/CallingClient/utils/mobiusSocketMapper.js +56 -0
  61. package/dist/module/CallingClient/utils/request.js +112 -0
  62. package/dist/module/CallingClient/utils/types.js +1 -0
  63. package/dist/module/CallingClient/utils/wsFeatureFlag.js +5 -0
  64. package/dist/module/Events/types.js +0 -10
  65. package/dist/module/SDKConnector/index.js +17 -0
  66. package/dist/module/common/Utils.js +35 -4
  67. package/dist/module/common/testUtil.js +3 -0
  68. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  69. package/dist/types/CallingClient/CallingClient.d.ts +10 -1
  70. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  71. package/dist/types/CallingClient/calling/call.d.ts +1 -0
  72. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  73. package/dist/types/CallingClient/calling/callManager.d.ts +5 -4
  74. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  75. package/dist/types/CallingClient/calling/types.d.ts +21 -9
  76. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  77. package/dist/types/CallingClient/constants.d.ts +8 -0
  78. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  79. package/dist/types/CallingClient/registration/register.d.ts +3 -1
  80. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  81. package/dist/types/CallingClient/registration/types.d.ts +2 -1
  82. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  83. package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
  84. package/dist/types/CallingClient/types.d.ts +3 -1
  85. package/dist/types/CallingClient/types.d.ts.map +1 -1
  86. package/dist/types/CallingClient/utils/constants.d.ts +30 -0
  87. package/dist/types/CallingClient/utils/constants.d.ts.map +1 -0
  88. package/dist/types/CallingClient/utils/index.d.ts +6 -0
  89. package/dist/types/CallingClient/utils/index.d.ts.map +1 -0
  90. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts +4 -0
  91. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -0
  92. package/dist/types/CallingClient/utils/request.d.ts +20 -0
  93. package/dist/types/CallingClient/utils/request.d.ts.map +1 -0
  94. package/dist/types/CallingClient/utils/types.d.ts +23 -0
  95. package/dist/types/CallingClient/utils/types.d.ts.map +1 -0
  96. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts +4 -0
  97. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -0
  98. package/dist/types/Events/types.d.ts +0 -10
  99. package/dist/types/Events/types.d.ts.map +1 -1
  100. package/dist/types/SDKConnector/index.d.ts +2 -0
  101. package/dist/types/SDKConnector/index.d.ts.map +1 -1
  102. package/dist/types/SDKConnector/types.d.ts +11 -0
  103. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  104. package/dist/types/common/Utils.d.ts +4 -1
  105. package/dist/types/common/Utils.d.ts.map +1 -1
  106. package/dist/types/common/testUtil.d.ts +3 -0
  107. package/dist/types/common/testUtil.d.ts.map +1 -1
  108. package/dist/types/common/types.d.ts +5 -0
  109. package/dist/types/common/types.d.ts.map +1 -1
  110. package/package.json +8 -4
@@ -12,7 +12,7 @@ var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/n
12
12
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
13
13
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
14
14
  var InternalMediaCoreModule = _interopRequireWildcard(require("@webex/internal-media-core"));
15
- var _webMediaEffects = require("@webex/web-media-effects");
15
+ var _mediaHelpers = require("@webex/media-helpers");
16
16
  var _types = require("../../Errors/types");
17
17
  var _Utils = _interopRequireWildcard(require("../../common/Utils"));
18
18
  var Utils = _Utils;
@@ -27,11 +27,19 @@ var _callManager = require("./callManager");
27
27
  var _Logger = _interopRequireDefault(require("../../Logger"));
28
28
  var _Errors = require("../../Errors");
29
29
  var _constants2 = require("../../common/constants");
30
+ var _request = require("../utils/request");
30
31
  function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
31
32
  /* eslint-disable @typescript-eslint/no-explicit-any */
32
33
  /* eslint-disable dot-notation */
33
34
  /* eslint-disable @typescript-eslint/no-shadow */
34
35
 
36
+ jest.mock('@webex/internal-plugin-mobius-socket', function () {
37
+ return {
38
+ getMobiusSocketInstance: jest.fn().mockReturnValue({
39
+ sendWssRequest: jest.fn()
40
+ })
41
+ };
42
+ });
35
43
  jest.mock('@webex/internal-media-core');
36
44
  var uploadLogsSpy = jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
37
45
  var webex = (0, _testUtil.getTestUtilsWebex)();
@@ -116,6 +124,11 @@ describe('Call Tests', function () {
116
124
  webex.request = jest.fn();
117
125
  });
118
126
  beforeEach(function () {
127
+ _request.APIRequest.resetInstance();
128
+ _request.APIRequest.getInstance({
129
+ webex: webex,
130
+ isMobiusSocketEnabled: false
131
+ });
119
132
  callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
120
133
  });
121
134
  it('create call object', function () {
@@ -463,8 +476,8 @@ describe('Call Tests', function () {
463
476
  bnrMetricSpy.mockClear();
464
477
  /* Invoking the callback function to trigger EffectAdded event to simulate adding effect to the stream */
465
478
  onStreamSpy.mock.calls[1][1](mockEffect);
466
- expect(onEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Enabled, expect.any(Function));
467
- expect(onEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Disabled, expect.any(Function));
479
+ expect(onEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Enabled, expect.any(Function));
480
+ expect(onEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Disabled, expect.any(Function));
468
481
 
469
482
  /* Send Enabled event on the effect, update track and send metrics for BNR disabled */
470
483
  onStreamSpy.mock.calls[0][1](mockTrack);
@@ -494,8 +507,8 @@ describe('Call Tests', function () {
494
507
  expect(offStreamSpy).toBeCalledTimes(2);
495
508
  expect(offStreamSpy).toBeCalledWith(InternalMediaCoreModule.LocalStreamEventNames.OutputTrackChange, expect.any(Function));
496
509
  expect(offStreamSpy).toBeCalledWith(InternalMediaCoreModule.LocalStreamEventNames.EffectAdded, expect.any(Function));
497
- expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Enabled, expect.any(Function));
498
- expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Disabled, expect.any(Function));
510
+ expect(offEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Enabled, expect.any(Function));
511
+ expect(offEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Disabled, expect.any(Function));
499
512
  case 2:
500
513
  case "end":
501
514
  return _context9.stop();
@@ -799,6 +812,11 @@ describe('State Machine handler tests', function () {
799
812
  var call;
800
813
  var dtmfMock;
801
814
  beforeEach(function () {
815
+ _request.APIRequest.resetInstance();
816
+ _request.APIRequest.getInstance({
817
+ webex: webex,
818
+ isMobiusSocketEnabled: false
819
+ });
802
820
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
803
821
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
804
822
  var dummy = 10;
@@ -879,7 +897,9 @@ describe('State Machine handler tests', function () {
879
897
  _context14.next = 2;
880
898
  return _promise.default.resolve();
881
899
  case 2:
882
- expect(clearInterval).toHaveBeenCalledTimes(1);
900
+ // clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
901
+ // and once in handleCallKeepaliveError when clearing timer due to error
902
+ expect(clearInterval).toHaveBeenCalledTimes(2);
883
903
  expect(funcSpy).toBeCalledTimes(1);
884
904
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
885
905
  case 3:
@@ -913,7 +933,9 @@ describe('State Machine handler tests', function () {
913
933
  _context15.next = 1;
914
934
  return (0, _testUtil.flushPromises)(2);
915
935
  case 1:
916
- expect(clearInterval).toHaveBeenCalledTimes(1);
936
+ // clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
937
+ // and once in handleCallKeepaliveError when clearing timer due to error
938
+ expect(clearInterval).toHaveBeenCalledTimes(2);
917
939
  expect(funcSpy).toBeCalledTimes(1);
918
940
  case 2:
919
941
  case "end":
@@ -960,10 +982,45 @@ describe('State Machine handler tests', function () {
960
982
  }
961
983
  }, _callee16);
962
984
  })));
963
- it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
964
- var errorPayload, warnSpy, postStatusSpy;
985
+ it('scheduleCallKeepaliveInterval clears existing interval before creating new one', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
986
+ var firstTimer, secondTimer;
965
987
  return _regenerator.default.wrap(function (_context17) {
966
988
  while (1) switch (_context17.prev = _context17.next) {
989
+ case 0:
990
+ jest.spyOn(global, 'setInterval');
991
+ jest.spyOn(global, 'clearInterval');
992
+
993
+ // Setup the first keepalive interval
994
+ call['handleCallEstablished']({});
995
+
996
+ // At this point, scheduleCallKeepaliveInterval was called once
997
+ // It should have called clearInterval once (at the start) and setInterval once
998
+ expect(clearInterval).toHaveBeenCalledTimes(1);
999
+ expect(setInterval).toHaveBeenCalledTimes(1);
1000
+ firstTimer = call['sessionTimer'];
1001
+ expect(firstTimer).toBeDefined();
1002
+
1003
+ // Manually call scheduleCallKeepaliveInterval again to simulate a retry scenario
1004
+ call['scheduleCallKeepaliveInterval']();
1005
+
1006
+ // clearInterval should have been called again to clear the previous timer
1007
+ expect(clearInterval).toHaveBeenCalledTimes(2);
1008
+ // A new interval should have been created
1009
+ expect(setInterval).toHaveBeenCalledTimes(2);
1010
+
1011
+ // The sessionTimer should be different (new timer)
1012
+ secondTimer = call['sessionTimer'];
1013
+ expect(secondTimer).toBeDefined();
1014
+ case 1:
1015
+ case "end":
1016
+ return _context17.stop();
1017
+ }
1018
+ }, _callee17);
1019
+ })));
1020
+ it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
1021
+ var errorPayload, warnSpy, postStatusSpy;
1022
+ return _regenerator.default.wrap(function (_context18) {
1023
+ while (1) switch (_context18.prev = _context18.next) {
967
1024
  case 0:
968
1025
  errorPayload = {
969
1026
  statusCode: 500,
@@ -982,25 +1039,25 @@ describe('State Machine handler tests', function () {
982
1039
 
983
1040
  // Advance timer to trigger the first failure (uses DEFAULT_SESSION_TIMER)
984
1041
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
985
- _context17.next = 1;
1042
+ _context18.next = 1;
986
1043
  return (0, _testUtil.flushPromises)(2);
987
1044
  case 1:
988
1045
  // Now advance by 1 second for each of the 4 retry attempts (retry-after: 1 second each)
989
1046
  // Need to do this separately to allow state machine to process and create new intervals
990
1047
  jest.advanceTimersByTime(1000);
991
- _context17.next = 2;
1048
+ _context18.next = 2;
992
1049
  return (0, _testUtil.flushPromises)(2);
993
1050
  case 2:
994
1051
  jest.advanceTimersByTime(1000);
995
- _context17.next = 3;
1052
+ _context18.next = 3;
996
1053
  return (0, _testUtil.flushPromises)(2);
997
1054
  case 3:
998
1055
  jest.advanceTimersByTime(1000);
999
- _context17.next = 4;
1056
+ _context18.next = 4;
1000
1057
  return (0, _testUtil.flushPromises)(2);
1001
1058
  case 4:
1002
1059
  jest.advanceTimersByTime(1000);
1003
- _context17.next = 5;
1060
+ _context18.next = 5;
1004
1061
  return (0, _testUtil.flushPromises)(2);
1005
1062
  case 5:
1006
1063
  // The error handler should detect we're at max retry count and stop
@@ -1012,14 +1069,14 @@ describe('State Machine handler tests', function () {
1012
1069
  expect(call['callKeepaliveRetryCount']).toBe(4);
1013
1070
  case 6:
1014
1071
  case "end":
1015
- return _context17.stop();
1072
+ return _context18.stop();
1016
1073
  }
1017
- }, _callee17);
1074
+ }, _callee18);
1018
1075
  })));
1019
- it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
1076
+ it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1020
1077
  var statusPayload, dummyEvent, postMediaSpy, deleteSpy, dummyOkEvent;
1021
- return _regenerator.default.wrap(function (_context18) {
1022
- while (1) switch (_context18.prev = _context18.next) {
1078
+ return _regenerator.default.wrap(function (_context19) {
1079
+ while (1) switch (_context19.prev = _context19.next) {
1023
1080
  case 0:
1024
1081
  statusPayload = {
1025
1082
  statusCode: 200,
@@ -1075,14 +1132,14 @@ describe('State Machine handler tests', function () {
1075
1132
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1076
1133
  case 1:
1077
1134
  case "end":
1078
- return _context18.stop();
1135
+ return _context19.stop();
1079
1136
  }
1080
- }, _callee18);
1137
+ }, _callee19);
1081
1138
  })));
1082
- it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1139
+ it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1083
1140
  var statusPayload, dummyEvent;
1084
- return _regenerator.default.wrap(function (_context19) {
1085
- while (1) switch (_context19.prev = _context19.next) {
1141
+ return _regenerator.default.wrap(function (_context20) {
1142
+ while (1) switch (_context20.prev = _context20.next) {
1086
1143
  case 0:
1087
1144
  call['direction'] = _types3.CallDirection.INBOUND;
1088
1145
  statusPayload = {
@@ -1100,7 +1157,7 @@ describe('State Machine handler tests', function () {
1100
1157
  webex.request.mockReturnValue(statusPayload);
1101
1158
  call.sendCallStateMachineEvt(dummyEvent);
1102
1159
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
1103
- _context19.next = 1;
1160
+ _context20.next = 1;
1104
1161
  return call['handleOutgoingCallConnect']({
1105
1162
  type: 'E_SEND_CALL_CONNECT'
1106
1163
  });
@@ -1114,14 +1171,14 @@ describe('State Machine handler tests', function () {
1114
1171
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1115
1172
  case 2:
1116
1173
  case "end":
1117
- return _context19.stop();
1174
+ return _context20.stop();
1118
1175
  }
1119
- }, _callee19);
1176
+ }, _callee20);
1120
1177
  })));
1121
- it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1178
+ it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1122
1179
  var callManager, statusPayload, call, dummyEvent, dummyOkEvent, emitSpy, startCallerIdSpy, mobiusProgressEvent;
1123
- return _regenerator.default.wrap(function (_context20) {
1124
- while (1) switch (_context20.prev = _context20.next) {
1180
+ return _regenerator.default.wrap(function (_context21) {
1181
+ while (1) switch (_context21.prev = _context21.next) {
1125
1182
  case 0:
1126
1183
  callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
1127
1184
  statusPayload = {
@@ -1215,14 +1272,14 @@ describe('State Machine handler tests', function () {
1215
1272
  expect(call.earlyMedia).not.toBe(true);
1216
1273
  case 1:
1217
1274
  case "end":
1218
- return _context20.stop();
1275
+ return _context21.stop();
1219
1276
  }
1220
- }, _callee20);
1277
+ }, _callee21);
1221
1278
  })));
1222
- it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1279
+ it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1223
1280
  var warnSpy, errorSpy, stateMachineSpy, statusPayload, roapMessage;
1224
- return _regenerator.default.wrap(function (_context21) {
1225
- while (1) switch (_context21.prev = _context21.next) {
1281
+ return _regenerator.default.wrap(function (_context22) {
1282
+ while (1) switch (_context22.prev = _context22.next) {
1226
1283
  case 0:
1227
1284
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1228
1285
  errorSpy = jest.spyOn(_Logger.default, 'error');
@@ -1249,7 +1306,7 @@ describe('State Machine handler tests', function () {
1249
1306
  webex.request.mockRejectedValueOnce({
1250
1307
  statusCode: 403
1251
1308
  }).mockResolvedValue(statusPayload);
1252
- _context21.next = 1;
1309
+ _context22.next = 1;
1253
1310
  return call['handleOutgoingCallConnect']({
1254
1311
  type: 'E_SEND_CALL_CONNECT'
1255
1312
  });
@@ -1260,14 +1317,14 @@ describe('State Machine handler tests', function () {
1260
1317
  expect(errorSpy).toBeCalledTimes(1);
1261
1318
  case 2:
1262
1319
  case "end":
1263
- return _context21.stop();
1320
+ return _context22.stop();
1264
1321
  }
1265
- }, _callee21);
1322
+ }, _callee22);
1266
1323
  })));
1267
- it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1324
+ it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1268
1325
  var statusPayload, dummyEvent, postMediaSpy, logSpy, dummyOkEvent;
1269
- return _regenerator.default.wrap(function (_context22) {
1270
- while (1) switch (_context22.prev = _context22.next) {
1326
+ return _regenerator.default.wrap(function (_context23) {
1327
+ while (1) switch (_context23.prev = _context23.next) {
1271
1328
  case 0:
1272
1329
  statusPayload = {
1273
1330
  statusCode: 200,
@@ -1343,14 +1400,14 @@ describe('State Machine handler tests', function () {
1343
1400
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1344
1401
  case 1:
1345
1402
  case "end":
1346
- return _context22.stop();
1403
+ return _context23.stop();
1347
1404
  }
1348
- }, _callee22);
1405
+ }, _callee23);
1349
1406
  })));
1350
- it('outgoing call where we receive connect directly after setup. Media established before connect. test call and media state changes', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1407
+ it('outgoing call where we receive connect directly after setup. Media established before connect. test call and media state changes', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
1351
1408
  var statusPayload, dummySetupEvent, dummyConnectEvent, dummyOfferEvent, dummyAnswerEvent, dummyOkEvent, postMediaSpy;
1352
- return _regenerator.default.wrap(function (_context23) {
1353
- while (1) switch (_context23.prev = _context23.next) {
1409
+ return _regenerator.default.wrap(function (_context24) {
1410
+ while (1) switch (_context24.prev = _context24.next) {
1354
1411
  case 0:
1355
1412
  statusPayload = {
1356
1413
  statusCode: 200,
@@ -1418,14 +1475,14 @@ describe('State Machine handler tests', function () {
1418
1475
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1419
1476
  case 1:
1420
1477
  case "end":
1421
- return _context23.stop();
1478
+ return _context24.stop();
1422
1479
  }
1423
- }, _callee23);
1480
+ }, _callee24);
1424
1481
  })));
1425
- it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
1482
+ it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
1426
1483
  var statusPayload, dummyEvent;
1427
- return _regenerator.default.wrap(function (_context24) {
1428
- while (1) switch (_context24.prev = _context24.next) {
1484
+ return _regenerator.default.wrap(function (_context25) {
1485
+ while (1) switch (_context25.prev = _context25.next) {
1429
1486
  case 0:
1430
1487
  statusPayload = {
1431
1488
  statusCode: 200,
@@ -1464,14 +1521,14 @@ describe('State Machine handler tests', function () {
1464
1521
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1465
1522
  case 1:
1466
1523
  case "end":
1467
- return _context24.stop();
1524
+ return _context25.stop();
1468
1525
  }
1469
- }, _callee24);
1526
+ }, _callee25);
1470
1527
  })));
1471
- it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
1528
+ it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1472
1529
  var statusPayload, dummyEvent, errorSpy;
1473
- return _regenerator.default.wrap(function (_context25) {
1474
- while (1) switch (_context25.prev = _context25.next) {
1530
+ return _regenerator.default.wrap(function (_context26) {
1531
+ while (1) switch (_context26.prev = _context26.next) {
1475
1532
  case 0:
1476
1533
  statusPayload = {
1477
1534
  statusCode: 403,
@@ -1488,25 +1545,31 @@ describe('State Machine handler tests', function () {
1488
1545
  webex.request.mockRejectedValueOnce(statusPayload);
1489
1546
  errorSpy = jest.spyOn(_Logger.default, 'error');
1490
1547
  call.sendCallStateMachineEvt(dummyEvent);
1491
- _context25.next = 1;
1548
+ _context26.next = 1;
1492
1549
  return (0, _testUtil.flushPromises)(3);
1493
1550
  case 1:
1551
+ _context26.next = 2;
1552
+ return _promise.default.resolve();
1553
+ case 2:
1554
+ _context26.next = 3;
1555
+ return _promise.default.resolve();
1556
+ case 3:
1494
1557
  expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
1495
1558
  expect(errorSpy).toHaveBeenCalled();
1496
1559
  expect(uploadLogsSpy).toHaveBeenCalledWith({
1497
1560
  correlationId: call.getCorrelationId(),
1498
1561
  callId: call.getCallId()
1499
1562
  });
1500
- case 2:
1563
+ case 4:
1501
1564
  case "end":
1502
- return _context25.stop();
1565
+ return _context26.stop();
1503
1566
  }
1504
- }, _callee25);
1567
+ }, _callee26);
1505
1568
  })));
1506
- it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1569
+ it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1507
1570
  var statusPayload, dummyEvent, warnSpy;
1508
- return _regenerator.default.wrap(function (_context26) {
1509
- while (1) switch (_context26.prev = _context26.next) {
1571
+ return _regenerator.default.wrap(function (_context27) {
1572
+ while (1) switch (_context27.prev = _context27.next) {
1510
1573
  case 0:
1511
1574
  statusPayload = {
1512
1575
  statusCode: 403,
@@ -1525,12 +1588,18 @@ describe('State Machine handler tests', function () {
1525
1588
  webex.request.mockRejectedValue(statusPayload);
1526
1589
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1527
1590
  jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
1528
- _context26.next = 1;
1591
+ _context27.next = 1;
1529
1592
  return call['handleRoapEstablished']({}, dummyEvent);
1530
1593
  case 1:
1531
- _context26.next = 2;
1594
+ _context27.next = 2;
1532
1595
  return (0, _testUtil.flushPromises)(2);
1533
1596
  case 2:
1597
+ _context27.next = 3;
1598
+ return _promise.default.resolve();
1599
+ case 3:
1600
+ _context27.next = 4;
1601
+ return _promise.default.resolve();
1602
+ case 4:
1534
1603
  expect(call.isConnected()).toBe(false);
1535
1604
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1536
1605
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
@@ -1542,16 +1611,16 @@ describe('State Machine handler tests', function () {
1542
1611
  file: 'call',
1543
1612
  method: 'handleRoapError'
1544
1613
  });
1545
- case 3:
1614
+ case 5:
1546
1615
  case "end":
1547
- return _context26.stop();
1616
+ return _context27.stop();
1548
1617
  }
1549
- }, _callee26);
1618
+ }, _callee27);
1550
1619
  })));
1551
- it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1620
+ it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
1552
1621
  var statusPayload, dummyEvent;
1553
- return _regenerator.default.wrap(function (_context27) {
1554
- while (1) switch (_context27.prev = _context27.next) {
1622
+ return _regenerator.default.wrap(function (_context28) {
1623
+ while (1) switch (_context28.prev = _context28.next) {
1555
1624
  case 0:
1556
1625
  statusPayload = {
1557
1626
  statusCode: 403,
@@ -1574,14 +1643,14 @@ describe('State Machine handler tests', function () {
1574
1643
  expect(_testUtil.mediaConnection.initiateOffer).toBeCalledOnceWith();
1575
1644
  case 1:
1576
1645
  case "end":
1577
- return _context27.stop();
1646
+ return _context28.stop();
1578
1647
  }
1579
- }, _callee27);
1648
+ }, _callee28);
1580
1649
  })));
1581
- it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
1650
+ it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
1582
1651
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1583
- return _regenerator.default.wrap(function (_context28) {
1584
- while (1) switch (_context28.prev = _context28.next) {
1652
+ return _regenerator.default.wrap(function (_context29) {
1653
+ while (1) switch (_context29.prev = _context29.next) {
1585
1654
  case 0:
1586
1655
  statusPayload = {
1587
1656
  statusCode: 503,
@@ -1603,7 +1672,7 @@ describe('State Machine handler tests', function () {
1603
1672
  }
1604
1673
  };
1605
1674
  call['connected'] = true;
1606
- _context28.next = 1;
1675
+ _context29.next = 1;
1607
1676
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1608
1677
  case 1:
1609
1678
  jest.advanceTimersByTime(1005);
@@ -1615,14 +1684,14 @@ describe('State Machine handler tests', function () {
1615
1684
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1616
1685
  case 2:
1617
1686
  case "end":
1618
- return _context28.stop();
1687
+ return _context29.stop();
1619
1688
  }
1620
- }, _callee28);
1689
+ }, _callee29);
1621
1690
  })));
1622
- it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
1691
+ it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
1623
1692
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1624
- return _regenerator.default.wrap(function (_context29) {
1625
- while (1) switch (_context29.prev = _context29.next) {
1693
+ return _regenerator.default.wrap(function (_context30) {
1694
+ while (1) switch (_context30.prev = _context30.next) {
1626
1695
  case 0:
1627
1696
  statusPayload = {
1628
1697
  statusCode: 503,
@@ -1644,7 +1713,7 @@ describe('State Machine handler tests', function () {
1644
1713
  }
1645
1714
  };
1646
1715
  call['connected'] = false;
1647
- _context29.next = 1;
1716
+ _context30.next = 1;
1648
1717
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1649
1718
  case 1:
1650
1719
  jest.advanceTimersByTime(1005);
@@ -1655,14 +1724,14 @@ describe('State Machine handler tests', function () {
1655
1724
  expect(stateMachineSpy).not.toBeCalled();
1656
1725
  case 2:
1657
1726
  case "end":
1658
- return _context29.stop();
1727
+ return _context30.stop();
1659
1728
  }
1660
- }, _callee29);
1729
+ }, _callee30);
1661
1730
  })));
1662
- it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
1731
+ it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1663
1732
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1664
- return _regenerator.default.wrap(function (_context30) {
1665
- while (1) switch (_context30.prev = _context30.next) {
1733
+ return _regenerator.default.wrap(function (_context31) {
1734
+ while (1) switch (_context31.prev = _context31.next) {
1666
1735
  case 0:
1667
1736
  statusPayload = {
1668
1737
  statusCode: 503,
@@ -1684,7 +1753,7 @@ describe('State Machine handler tests', function () {
1684
1753
  };
1685
1754
  call['connected'] = true;
1686
1755
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_OFFER';
1687
- _context30.next = 1;
1756
+ _context31.next = 1;
1688
1757
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1689
1758
  case 1:
1690
1759
  jest.advanceTimersByTime(1005);
@@ -1696,14 +1765,14 @@ describe('State Machine handler tests', function () {
1696
1765
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1697
1766
  case 2:
1698
1767
  case "end":
1699
- return _context30.stop();
1768
+ return _context31.stop();
1700
1769
  }
1701
- }, _callee30);
1770
+ }, _callee31);
1702
1771
  })));
1703
- it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1772
+ it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1704
1773
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1705
- return _regenerator.default.wrap(function (_context31) {
1706
- while (1) switch (_context31.prev = _context31.next) {
1774
+ return _regenerator.default.wrap(function (_context32) {
1775
+ while (1) switch (_context32.prev = _context32.next) {
1707
1776
  case 0:
1708
1777
  statusPayload = {
1709
1778
  statusCode: 503,
@@ -1724,7 +1793,7 @@ describe('State Machine handler tests', function () {
1724
1793
  }
1725
1794
  };
1726
1795
  call['connected'] = false;
1727
- _context31.next = 1;
1796
+ _context32.next = 1;
1728
1797
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1729
1798
  case 1:
1730
1799
  jest.advanceTimersByTime(1005);
@@ -1736,14 +1805,14 @@ describe('State Machine handler tests', function () {
1736
1805
  expect(stateMachineSpy).not.toBeCalled();
1737
1806
  case 2:
1738
1807
  case "end":
1739
- return _context31.stop();
1808
+ return _context32.stop();
1740
1809
  }
1741
- }, _callee31);
1810
+ }, _callee32);
1742
1811
  })));
1743
- it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1812
+ it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
1744
1813
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1745
- return _regenerator.default.wrap(function (_context32) {
1746
- while (1) switch (_context32.prev = _context32.next) {
1814
+ return _regenerator.default.wrap(function (_context33) {
1815
+ while (1) switch (_context33.prev = _context33.next) {
1747
1816
  case 0:
1748
1817
  statusPayload = {
1749
1818
  statusCode: 200,
@@ -1768,14 +1837,14 @@ describe('State Machine handler tests', function () {
1768
1837
  expect(stateMachineSpy).not.toHaveBeenCalled();
1769
1838
  case 1:
1770
1839
  case "end":
1771
- return _context32.stop();
1840
+ return _context33.stop();
1772
1841
  }
1773
- }, _callee32);
1842
+ }, _callee33);
1774
1843
  })));
1775
- it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
1844
+ it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
1776
1845
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1777
- return _regenerator.default.wrap(function (_context33) {
1778
- while (1) switch (_context33.prev = _context33.next) {
1846
+ return _regenerator.default.wrap(function (_context34) {
1847
+ while (1) switch (_context34.prev = _context34.next) {
1779
1848
  case 0:
1780
1849
  statusPayload = {
1781
1850
  statusCode: 503,
@@ -1797,7 +1866,7 @@ describe('State Machine handler tests', function () {
1797
1866
  };
1798
1867
  call['connected'] = true;
1799
1868
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
1800
- _context33.next = 1;
1869
+ _context34.next = 1;
1801
1870
  return call['handleRoapEstablished']({}, dummyEvent);
1802
1871
  case 1:
1803
1872
  jest.advanceTimersByTime(1005);
@@ -1809,14 +1878,14 @@ describe('State Machine handler tests', function () {
1809
1878
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1810
1879
  case 2:
1811
1880
  case "end":
1812
- return _context33.stop();
1881
+ return _context34.stop();
1813
1882
  }
1814
- }, _callee33);
1883
+ }, _callee34);
1815
1884
  })));
1816
- it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
1885
+ it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
1817
1886
  var statusPayload, stateMachineSpy, funcSpy, errorEvent;
1818
- return _regenerator.default.wrap(function (_context34) {
1819
- while (1) switch (_context34.prev = _context34.next) {
1887
+ return _regenerator.default.wrap(function (_context35) {
1888
+ while (1) switch (_context35.prev = _context35.next) {
1820
1889
  case 0:
1821
1890
  statusPayload = {
1822
1891
  statusCode: 403,
@@ -1839,14 +1908,14 @@ describe('State Machine handler tests', function () {
1839
1908
  expect(stateMachineSpy).not.toHaveBeenCalled();
1840
1909
  case 1:
1841
1910
  case "end":
1842
- return _context34.stop();
1911
+ return _context35.stop();
1843
1912
  }
1844
- }, _callee34);
1913
+ }, _callee35);
1845
1914
  })));
1846
- it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
1915
+ it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
1847
1916
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1848
- return _regenerator.default.wrap(function (_context35) {
1849
- while (1) switch (_context35.prev = _context35.next) {
1917
+ return _regenerator.default.wrap(function (_context36) {
1918
+ while (1) switch (_context36.prev = _context36.next) {
1850
1919
  case 0:
1851
1920
  statusPayload = {
1852
1921
  statusCode: 200,
@@ -1864,7 +1933,7 @@ describe('State Machine handler tests', function () {
1864
1933
  }
1865
1934
  };
1866
1935
  call['connected'] = false;
1867
- _context35.next = 1;
1936
+ _context36.next = 1;
1868
1937
  return call['handleRoapError']({}, errorEvent);
1869
1938
  case 1:
1870
1939
  expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
@@ -1880,14 +1949,14 @@ describe('State Machine handler tests', function () {
1880
1949
  });
1881
1950
  case 2:
1882
1951
  case "end":
1883
- return _context35.stop();
1952
+ return _context36.stop();
1884
1953
  }
1885
- }, _callee35);
1954
+ }, _callee36);
1886
1955
  })));
1887
- it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
1956
+ it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
1888
1957
  var statusPayload, warnSpy, postMediaSpy, setupEvent, connectEvent, offerEvent, answerEvent;
1889
- return _regenerator.default.wrap(function (_context36) {
1890
- while (1) switch (_context36.prev = _context36.next) {
1958
+ return _regenerator.default.wrap(function (_context37) {
1959
+ while (1) switch (_context37.prev = _context37.next) {
1891
1960
  case 0:
1892
1961
  statusPayload = {
1893
1962
  statusCode: 403,
@@ -1925,12 +1994,18 @@ describe('State Machine handler tests', function () {
1925
1994
  messageType: 'ANSWER'
1926
1995
  }
1927
1996
  };
1928
- _context36.next = 1;
1997
+ _context37.next = 1;
1929
1998
  return call.sendMediaStateMachineEvt(answerEvent);
1930
1999
  case 1:
1931
- _context36.next = 2;
2000
+ _context37.next = 2;
1932
2001
  return (0, _testUtil.flushPromises)(2);
1933
2002
  case 2:
2003
+ _context37.next = 3;
2004
+ return _promise.default.resolve();
2005
+ case 3:
2006
+ _context37.next = 4;
2007
+ return _promise.default.resolve();
2008
+ case 4:
1934
2009
  expect(postMediaSpy).toBeCalledOnceWith(answerEvent.data);
1935
2010
  expect(warnSpy).toHaveBeenCalledWith('Failed to send MediaAnswer request', {
1936
2011
  file: 'call',
@@ -1944,16 +2019,16 @@ describe('State Machine handler tests', function () {
1944
2019
  // Final state should be torn down and cleared for unconnected call
1945
2020
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1946
2021
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
1947
- case 3:
2022
+ case 5:
1948
2023
  case "end":
1949
- return _context36.stop();
2024
+ return _context37.stop();
1950
2025
  }
1951
- }, _callee36);
2026
+ }, _callee37);
1952
2027
  })));
1953
- it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
2028
+ it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
1954
2029
  var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
1955
- return _regenerator.default.wrap(function (_context37) {
1956
- while (1) switch (_context37.prev = _context37.next) {
2030
+ return _regenerator.default.wrap(function (_context38) {
2031
+ while (1) switch (_context38.prev = _context38.next) {
1957
2032
  case 0:
1958
2033
  statusPayload = {
1959
2034
  statusCode: 200,
@@ -1986,7 +2061,7 @@ describe('State Machine handler tests', function () {
1986
2061
  seq: 1,
1987
2062
  messageType: 'ANSWER'
1988
2063
  };
1989
- _context37.next = 1;
2064
+ _context38.next = 1;
1990
2065
  return call.sendMediaStateMachineEvt(dummyEvent);
1991
2066
  case 1:
1992
2067
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -2008,7 +2083,7 @@ describe('State Machine handler tests', function () {
2008
2083
  seq: 2,
2009
2084
  messageType: 'OFFER_REQUEST'
2010
2085
  };
2011
- _context37.next = 2;
2086
+ _context38.next = 2;
2012
2087
  return call.sendMediaStateMachineEvt(dummyEvent);
2013
2088
  case 2:
2014
2089
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -2058,7 +2133,7 @@ describe('State Machine handler tests', function () {
2058
2133
  };
2059
2134
  call.sendCallStateMachineEvt(dummyEvent);
2060
2135
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2061
- _context37.next = 3;
2136
+ _context38.next = 3;
2062
2137
  return call.sendMediaStateMachineEvt(dummyEvent);
2063
2138
  case 3:
2064
2139
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2067,7 +2142,7 @@ describe('State Machine handler tests', function () {
2067
2142
  seq: 3,
2068
2143
  messageType: 'ANSWER'
2069
2144
  };
2070
- _context37.next = 4;
2145
+ _context38.next = 4;
2071
2146
  return call.sendMediaStateMachineEvt(dummyEvent);
2072
2147
  case 4:
2073
2148
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2086,7 +2161,7 @@ describe('State Machine handler tests', function () {
2086
2161
  messageType: 'OK'
2087
2162
  }
2088
2163
  };
2089
- _context37.next = 5;
2164
+ _context38.next = 5;
2090
2165
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2091
2166
  case 5:
2092
2167
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
@@ -2101,14 +2176,14 @@ describe('State Machine handler tests', function () {
2101
2176
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2102
2177
  case 6:
2103
2178
  case "end":
2104
- return _context37.stop();
2179
+ return _context38.stop();
2105
2180
  }
2106
- }, _callee37);
2181
+ }, _callee38);
2107
2182
  })));
2108
- it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
2183
+ it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
2109
2184
  var mockStatusBody, statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
2110
- return _regenerator.default.wrap(function (_context38) {
2111
- while (1) switch (_context38.prev = _context38.next) {
2185
+ return _regenerator.default.wrap(function (_context39) {
2186
+ while (1) switch (_context39.prev = _context39.next) {
2112
2187
  case 0:
2113
2188
  mockStatusBody = {
2114
2189
  device: {
@@ -2148,7 +2223,7 @@ describe('State Machine handler tests', function () {
2148
2223
  seq: 1,
2149
2224
  messageType: 'ANSWER'
2150
2225
  };
2151
- _context38.next = 1;
2226
+ _context39.next = 1;
2152
2227
  return call.sendMediaStateMachineEvt(dummyEvent);
2153
2228
  case 1:
2154
2229
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -2170,7 +2245,7 @@ describe('State Machine handler tests', function () {
2170
2245
  seq: 2,
2171
2246
  messageType: 'OFFER_REQUEST'
2172
2247
  };
2173
- _context38.next = 2;
2248
+ _context39.next = 2;
2174
2249
  return call.sendMediaStateMachineEvt(dummyEvent);
2175
2250
  case 2:
2176
2251
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -2220,7 +2295,7 @@ describe('State Machine handler tests', function () {
2220
2295
  };
2221
2296
  call.sendCallStateMachineEvt(dummyEvent);
2222
2297
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2223
- _context38.next = 3;
2298
+ _context39.next = 3;
2224
2299
  return call.sendMediaStateMachineEvt(dummyEvent);
2225
2300
  case 3:
2226
2301
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2229,7 +2304,7 @@ describe('State Machine handler tests', function () {
2229
2304
  seq: 3,
2230
2305
  messageType: 'ANSWER'
2231
2306
  };
2232
- _context38.next = 4;
2307
+ _context39.next = 4;
2233
2308
  return call.sendMediaStateMachineEvt(dummyEvent);
2234
2309
  case 4:
2235
2310
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2246,7 +2321,7 @@ describe('State Machine handler tests', function () {
2246
2321
  }
2247
2322
  };
2248
2323
  call.sendMediaStateMachineEvt(dummyEvent);
2249
- _context38.next = 5;
2324
+ _context39.next = 5;
2250
2325
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2251
2326
  case 5:
2252
2327
  expect(call['receivedRoapOKSeq']).toBe(3);
@@ -2262,14 +2337,14 @@ describe('State Machine handler tests', function () {
2262
2337
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2263
2338
  case 6:
2264
2339
  case "end":
2265
- return _context38.stop();
2340
+ return _context39.stop();
2266
2341
  }
2267
- }, _callee38);
2342
+ }, _callee39);
2268
2343
  })));
2269
- it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
2344
+ it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
2270
2345
  var statusPayload, dummyEvent, postMediaSpy, infoSpy, dummyOkEvent;
2271
- return _regenerator.default.wrap(function (_context39) {
2272
- while (1) switch (_context39.prev = _context39.next) {
2346
+ return _regenerator.default.wrap(function (_context40) {
2347
+ while (1) switch (_context40.prev = _context40.next) {
2273
2348
  case 0:
2274
2349
  statusPayload = {
2275
2350
  statusCode: 200,
@@ -2336,14 +2411,14 @@ describe('State Machine handler tests', function () {
2336
2411
  });
2337
2412
  case 1:
2338
2413
  case "end":
2339
- return _context39.stop();
2414
+ return _context40.stop();
2340
2415
  }
2341
- }, _callee39);
2416
+ }, _callee40);
2342
2417
  })));
2343
- it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
2418
+ it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2344
2419
  var emitSpy, deleteSpy;
2345
- return _regenerator.default.wrap(function (_context40) {
2346
- while (1) switch (_context40.prev = _context40.next) {
2420
+ return _regenerator.default.wrap(function (_context41) {
2421
+ while (1) switch (_context41.prev = _context41.next) {
2347
2422
  case 0:
2348
2423
  emitSpy = jest.spyOn(call, 'emit');
2349
2424
  deleteSpy = jest.spyOn(call, 'delete').mockResolvedValue({
@@ -2352,7 +2427,7 @@ describe('State Machine handler tests', function () {
2352
2427
  call.sendCallStateMachineEvt({
2353
2428
  type: 'E_RECV_CALL_DISCONNECT'
2354
2429
  });
2355
- _context40.next = 1;
2430
+ _context41.next = 1;
2356
2431
  return (0, _testUtil.flushPromises)(1);
2357
2432
  case 1:
2358
2433
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
@@ -2360,9 +2435,9 @@ describe('State Machine handler tests', function () {
2360
2435
  expect(emitSpy.mock.invocationCallOrder[0]).toBeLessThan(deleteSpy.mock.invocationCallOrder[0]);
2361
2436
  case 2:
2362
2437
  case "end":
2363
- return _context40.stop();
2438
+ return _context41.stop();
2364
2439
  }
2365
- }, _callee40);
2440
+ }, _callee41);
2366
2441
  })));
2367
2442
  describe('Call event timers tests', function () {
2368
2443
  var callManager;
@@ -2373,10 +2448,10 @@ describe('State Machine handler tests', function () {
2373
2448
  afterEach(function () {
2374
2449
  jest.clearAllTimers();
2375
2450
  });
2376
- it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2451
+ it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
2377
2452
  var statusPayload, dummyEvent, logSpy, emitSpy, deleteSpy, dummyOkEvent;
2378
- return _regenerator.default.wrap(function (_context41) {
2379
- while (1) switch (_context41.prev = _context41.next) {
2453
+ return _regenerator.default.wrap(function (_context42) {
2454
+ while (1) switch (_context42.prev = _context42.next) {
2380
2455
  case 0:
2381
2456
  statusPayload = {
2382
2457
  statusCode: 200,
@@ -2393,7 +2468,7 @@ describe('State Machine handler tests', function () {
2393
2468
  webex.request.mockReturnValue(statusPayload);
2394
2469
 
2395
2470
  // handleOutgoingCallSetup is asynchronous
2396
- _context41.next = 1;
2471
+ _context42.next = 1;
2397
2472
  return call.sendCallStateMachineEvt(dummyEvent);
2398
2473
  case 1:
2399
2474
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
@@ -2436,14 +2511,14 @@ describe('State Machine handler tests', function () {
2436
2511
  expect(callManager.callCollection).toStrictEqual({});
2437
2512
  case 2:
2438
2513
  case "end":
2439
- return _context41.stop();
2514
+ return _context42.stop();
2440
2515
  }
2441
- }, _callee41);
2516
+ }, _callee42);
2442
2517
  })));
2443
- it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
2518
+ it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
2444
2519
  var statusPayload, dummyEvent, call, emitSpy, deleteSpy, logSpy;
2445
- return _regenerator.default.wrap(function (_context42) {
2446
- while (1) switch (_context42.prev = _context42.next) {
2520
+ return _regenerator.default.wrap(function (_context43) {
2521
+ while (1) switch (_context43.prev = _context43.next) {
2447
2522
  case 0:
2448
2523
  statusPayload = {
2449
2524
  statusCode: 200,
@@ -2462,7 +2537,7 @@ describe('State Machine handler tests', function () {
2462
2537
  expect((0, _keys.default)(callManager.callCollection)[0]).toBe(call.getCorrelationId());
2463
2538
 
2464
2539
  // handleOutgoingCallSetup is asynchronous
2465
- _context42.next = 1;
2540
+ _context43.next = 1;
2466
2541
  return call.sendCallStateMachineEvt(dummyEvent);
2467
2542
  case 1:
2468
2543
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
@@ -2474,9 +2549,9 @@ describe('State Machine handler tests', function () {
2474
2549
  expect(callManager.callCollection).toStrictEqual({});
2475
2550
  case 2:
2476
2551
  case "end":
2477
- return _context42.stop();
2552
+ return _context43.stop();
2478
2553
  }
2479
- }, _callee42);
2554
+ }, _callee43);
2480
2555
  })));
2481
2556
  });
2482
2557
  });
@@ -2495,6 +2570,11 @@ describe('Supplementary Services tests', function () {
2495
2570
  };
2496
2571
  var call;
2497
2572
  beforeEach(function () {
2573
+ _request.APIRequest.resetInstance();
2574
+ _request.APIRequest.getInstance({
2575
+ webex: webex,
2576
+ isMobiusSocketEnabled: false
2577
+ });
2498
2578
  /* Since we are not actually testing from the start of a call , so it's good to set the below
2499
2579
  * parameters manually
2500
2580
  */
@@ -2536,10 +2616,10 @@ describe('Supplementary Services tests', function () {
2536
2616
  beforeEach(function () {
2537
2617
  call.removeAllListeners();
2538
2618
  });
2539
- it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
2619
+ it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
2540
2620
  var responsePayload, warnSpy, roapEvent;
2541
- return _regenerator.default.wrap(function (_context44) {
2542
- while (1) switch (_context44.prev = _context44.next) {
2621
+ return _regenerator.default.wrap(function (_context45) {
2622
+ while (1) switch (_context45.prev = _context45.next) {
2543
2623
  case 0:
2544
2624
  expect.assertions(7);
2545
2625
  responsePayload = {
@@ -2552,25 +2632,25 @@ describe('Supplementary Services tests', function () {
2552
2632
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2553
2633
  call['held'] = false;
2554
2634
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2555
- var _ref44 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43(correlationId) {
2556
- return _regenerator.default.wrap(function (_context43) {
2557
- while (1) switch (_context43.prev = _context43.next) {
2635
+ var _ref45 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44(correlationId) {
2636
+ return _regenerator.default.wrap(function (_context44) {
2637
+ while (1) switch (_context44.prev = _context44.next) {
2558
2638
  case 0:
2559
2639
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2560
2640
  case 1:
2561
2641
  case "end":
2562
- return _context43.stop();
2642
+ return _context44.stop();
2563
2643
  }
2564
- }, _callee43);
2644
+ }, _callee44);
2565
2645
  }));
2566
2646
  return function (_x) {
2567
- return _ref44.apply(this, arguments);
2647
+ return _ref45.apply(this, arguments);
2568
2648
  };
2569
2649
  }());
2570
- _context44.next = 1;
2650
+ _context45.next = 1;
2571
2651
  return call.doHoldResume();
2572
2652
  case 1:
2573
- _context44.next = 2;
2653
+ _context45.next = 2;
2574
2654
  return (0, _testUtil.flushPromises)(2);
2575
2655
  case 2:
2576
2656
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2586,11 +2666,11 @@ describe('Supplementary Services tests', function () {
2586
2666
  call['handleIncomingRoapOffer']({}, dummyEvent);
2587
2667
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2588
2668
  roapEvent.data.type = 'ANSWER';
2589
- _context44.next = 3;
2669
+ _context45.next = 3;
2590
2670
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2591
2671
  case 3:
2592
2672
  roapEvent.data.type = 'OK';
2593
- _context44.next = 4;
2673
+ _context45.next = 4;
2594
2674
  return call['handleRoapEstablished']({}, dummyEvent);
2595
2675
  case 4:
2596
2676
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -2605,14 +2685,14 @@ describe('Supplementary Services tests', function () {
2605
2685
  });
2606
2686
  case 5:
2607
2687
  case "end":
2608
- return _context44.stop();
2688
+ return _context45.stop();
2609
2689
  }
2610
- }, _callee44);
2690
+ }, _callee45);
2611
2691
  })));
2612
- it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
2692
+ it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
2613
2693
  var responsePayload, warnSpy, roapEvent;
2614
- return _regenerator.default.wrap(function (_context46) {
2615
- while (1) switch (_context46.prev = _context46.next) {
2694
+ return _regenerator.default.wrap(function (_context47) {
2695
+ while (1) switch (_context47.prev = _context47.next) {
2616
2696
  case 0:
2617
2697
  expect.assertions(8);
2618
2698
  responsePayload = {
@@ -2625,26 +2705,26 @@ describe('Supplementary Services tests', function () {
2625
2705
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2626
2706
  call['held'] = false;
2627
2707
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2628
- var _ref46 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45(correlationId) {
2629
- return _regenerator.default.wrap(function (_context45) {
2630
- while (1) switch (_context45.prev = _context45.next) {
2708
+ var _ref47 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46(correlationId) {
2709
+ return _regenerator.default.wrap(function (_context46) {
2710
+ while (1) switch (_context46.prev = _context46.next) {
2631
2711
  case 0:
2632
2712
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2633
2713
  case 1:
2634
2714
  case "end":
2635
- return _context45.stop();
2715
+ return _context46.stop();
2636
2716
  }
2637
- }, _callee45);
2717
+ }, _callee46);
2638
2718
  }));
2639
2719
  return function (_x2) {
2640
- return _ref46.apply(this, arguments);
2720
+ return _ref47.apply(this, arguments);
2641
2721
  };
2642
2722
  }());
2643
2723
  call.doHoldResume();
2644
- _context46.next = 1;
2724
+ _context47.next = 1;
2645
2725
  return _promise.default.resolve();
2646
2726
  case 1:
2647
- _context46.next = 2;
2727
+ _context47.next = 2;
2648
2728
  return _promise.default.resolve();
2649
2729
  case 2:
2650
2730
  expect(setTimeout).not.toHaveBeenCalled();
@@ -2660,11 +2740,11 @@ describe('Supplementary Services tests', function () {
2660
2740
  call['handleIncomingRoapOffer']({}, dummyEvent);
2661
2741
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2662
2742
  roapEvent.data.type = 'ANSWER';
2663
- _context46.next = 3;
2743
+ _context47.next = 3;
2664
2744
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2665
2745
  case 3:
2666
2746
  roapEvent.data.type = 'OK';
2667
- _context46.next = 4;
2747
+ _context47.next = 4;
2668
2748
  return call['handleRoapEstablished']({}, dummyEvent);
2669
2749
  case 4:
2670
2750
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -2679,14 +2759,14 @@ describe('Supplementary Services tests', function () {
2679
2759
  });
2680
2760
  case 5:
2681
2761
  case "end":
2682
- return _context46.stop();
2762
+ return _context47.stop();
2683
2763
  }
2684
- }, _callee46);
2764
+ }, _callee47);
2685
2765
  })));
2686
- it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48() {
2766
+ it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
2687
2767
  var responsePayload;
2688
- return _regenerator.default.wrap(function (_context48) {
2689
- while (1) switch (_context48.prev = _context48.next) {
2768
+ return _regenerator.default.wrap(function (_context49) {
2769
+ while (1) switch (_context49.prev = _context49.next) {
2690
2770
  case 0:
2691
2771
  expect.assertions(4);
2692
2772
  responsePayload = {
@@ -2696,26 +2776,26 @@ describe('Supplementary Services tests', function () {
2696
2776
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2697
2777
  call['held'] = false;
2698
2778
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2699
- var _ref48 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47(errObj) {
2700
- return _regenerator.default.wrap(function (_context47) {
2701
- while (1) switch (_context47.prev = _context47.next) {
2779
+ var _ref49 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48(errObj) {
2780
+ return _regenerator.default.wrap(function (_context48) {
2781
+ while (1) switch (_context48.prev = _context48.next) {
2702
2782
  case 0:
2703
2783
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2704
2784
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2705
2785
  case 1:
2706
2786
  case "end":
2707
- return _context47.stop();
2787
+ return _context48.stop();
2708
2788
  }
2709
- }, _callee47);
2789
+ }, _callee48);
2710
2790
  }));
2711
2791
  return function (_x3) {
2712
- return _ref48.apply(this, arguments);
2792
+ return _ref49.apply(this, arguments);
2713
2793
  };
2714
2794
  }());
2715
- _context48.next = 1;
2795
+ _context49.next = 1;
2716
2796
  return call.doHoldResume();
2717
2797
  case 1:
2718
- _context48.next = 2;
2798
+ _context49.next = 2;
2719
2799
  return (0, _testUtil.flushPromises)(2);
2720
2800
  case 2:
2721
2801
  expect(call.isHeld()).toStrictEqual(false);
@@ -2725,14 +2805,14 @@ describe('Supplementary Services tests', function () {
2725
2805
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2726
2806
  case 3:
2727
2807
  case "end":
2728
- return _context48.stop();
2808
+ return _context49.stop();
2729
2809
  }
2730
- }, _callee48);
2810
+ }, _callee49);
2731
2811
  })));
2732
- it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
2812
+ it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
2733
2813
  var responsePayload, rejectPayload, roapEvent;
2734
- return _regenerator.default.wrap(function (_context50) {
2735
- while (1) switch (_context50.prev = _context50.next) {
2814
+ return _regenerator.default.wrap(function (_context51) {
2815
+ while (1) switch (_context51.prev = _context51.next) {
2736
2816
  case 0:
2737
2817
  expect.assertions(5);
2738
2818
  responsePayload = {
@@ -2746,24 +2826,24 @@ describe('Supplementary Services tests', function () {
2746
2826
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2747
2827
  call['held'] = false;
2748
2828
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2749
- var _ref50 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49(errObj) {
2750
- return _regenerator.default.wrap(function (_context49) {
2751
- while (1) switch (_context49.prev = _context49.next) {
2829
+ var _ref51 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50(errObj) {
2830
+ return _regenerator.default.wrap(function (_context50) {
2831
+ while (1) switch (_context50.prev = _context50.next) {
2752
2832
  case 0:
2753
2833
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2754
2834
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2755
2835
  case 1:
2756
2836
  case "end":
2757
- return _context49.stop();
2837
+ return _context50.stop();
2758
2838
  }
2759
- }, _callee49);
2839
+ }, _callee50);
2760
2840
  }));
2761
2841
  return function (_x4) {
2762
- return _ref50.apply(this, arguments);
2842
+ return _ref51.apply(this, arguments);
2763
2843
  };
2764
2844
  }());
2765
2845
  call.doHoldResume();
2766
- _context50.next = 1;
2846
+ _context51.next = 1;
2767
2847
  return (0, _testUtil.flushPromises)(2);
2768
2848
  case 1:
2769
2849
  /* the Call State should transition to S_CALL_ESTABLISHED
@@ -2773,7 +2853,7 @@ describe('Supplementary Services tests', function () {
2773
2853
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2774
2854
  /* We are intentionally failing the ROAP ANSWER */
2775
2855
  roapEvent.data.type = 'ANSWER';
2776
- _context50.next = 2;
2856
+ _context51.next = 2;
2777
2857
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2778
2858
  case 2:
2779
2859
  expect(call.isHeld()).toStrictEqual(false);
@@ -2781,14 +2861,14 @@ describe('Supplementary Services tests', function () {
2781
2861
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2782
2862
  case 3:
2783
2863
  case "end":
2784
- return _context50.stop();
2864
+ return _context51.stop();
2785
2865
  }
2786
- }, _callee50);
2866
+ }, _callee51);
2787
2867
  })));
2788
- it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
2868
+ it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
2789
2869
  var responsePayload, warnSpy, roapEvent;
2790
- return _regenerator.default.wrap(function (_context51) {
2791
- while (1) switch (_context51.prev = _context51.next) {
2870
+ return _regenerator.default.wrap(function (_context52) {
2871
+ while (1) switch (_context52.prev = _context52.next) {
2792
2872
  case 0:
2793
2873
  responsePayload = {
2794
2874
  statusCode: 200,
@@ -2799,10 +2879,10 @@ describe('Supplementary Services tests', function () {
2799
2879
  jest.spyOn(global, 'clearTimeout');
2800
2880
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2801
2881
  call['held'] = false;
2802
- _context51.next = 1;
2882
+ _context52.next = 1;
2803
2883
  return call.doHoldResume();
2804
2884
  case 1:
2805
- _context51.next = 2;
2885
+ _context52.next = 2;
2806
2886
  return (0, _testUtil.flushPromises)(2);
2807
2887
  case 2:
2808
2888
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2817,19 +2897,19 @@ describe('Supplementary Services tests', function () {
2817
2897
  call['handleIncomingRoapOffer']({}, dummyEvent);
2818
2898
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2819
2899
  roapEvent.data.type = 'ANSWER';
2820
- _context51.next = 3;
2900
+ _context52.next = 3;
2821
2901
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2822
2902
  case 3:
2823
2903
  jest.spyOn(webex, 'request').mockRejectedValue({
2824
2904
  statusCode: 403
2825
2905
  });
2826
2906
  roapEvent.data.type = 'OK';
2827
- _context51.next = 4;
2907
+ _context52.next = 4;
2828
2908
  return call['handleRoapEstablished']({}, dummyEvent);
2829
2909
  case 4:
2830
2910
  /* this is for coverage */
2831
2911
  call['callStateMachine'].state.value = 'S_CALL_HOLD';
2832
- _context51.next = 5;
2912
+ _context52.next = 5;
2833
2913
  return call['handleRoapEstablished']({}, dummyEvent);
2834
2914
  case 5:
2835
2915
  expect(call.isHeld()).toStrictEqual(false);
@@ -2841,14 +2921,14 @@ describe('Supplementary Services tests', function () {
2841
2921
  });
2842
2922
  case 6:
2843
2923
  case "end":
2844
- return _context51.stop();
2924
+ return _context52.stop();
2845
2925
  }
2846
- }, _callee51);
2926
+ }, _callee52);
2847
2927
  })));
2848
- it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
2928
+ it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
2849
2929
  var responsePayload, warnSpy, roapEvent;
2850
- return _regenerator.default.wrap(function (_context52) {
2851
- while (1) switch (_context52.prev = _context52.next) {
2930
+ return _regenerator.default.wrap(function (_context53) {
2931
+ while (1) switch (_context53.prev = _context53.next) {
2852
2932
  case 0:
2853
2933
  responsePayload = {
2854
2934
  statusCode: 200,
@@ -2859,10 +2939,10 @@ describe('Supplementary Services tests', function () {
2859
2939
  jest.spyOn(global, 'clearTimeout');
2860
2940
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2861
2941
  call['held'] = true;
2862
- _context52.next = 1;
2942
+ _context53.next = 1;
2863
2943
  return call.doHoldResume();
2864
2944
  case 1:
2865
- _context52.next = 2;
2945
+ _context53.next = 2;
2866
2946
  return (0, _testUtil.flushPromises)(2);
2867
2947
  case 2:
2868
2948
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2877,14 +2957,14 @@ describe('Supplementary Services tests', function () {
2877
2957
  call['handleIncomingRoapOffer']({}, dummyEvent);
2878
2958
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2879
2959
  roapEvent.data.type = 'ANSWER';
2880
- _context52.next = 3;
2960
+ _context53.next = 3;
2881
2961
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2882
2962
  case 3:
2883
2963
  jest.spyOn(webex, 'request').mockRejectedValue({
2884
2964
  statusCode: 403
2885
2965
  });
2886
2966
  roapEvent.data.type = 'OK';
2887
- _context52.next = 4;
2967
+ _context53.next = 4;
2888
2968
  return call['handleRoapEstablished']({}, dummyEvent);
2889
2969
  case 4:
2890
2970
  expect(call.isHeld()).toStrictEqual(true);
@@ -2896,14 +2976,14 @@ describe('Supplementary Services tests', function () {
2896
2976
  });
2897
2977
  case 5:
2898
2978
  case "end":
2899
- return _context52.stop();
2979
+ return _context53.stop();
2900
2980
  }
2901
- }, _callee52);
2981
+ }, _callee53);
2902
2982
  })));
2903
- it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54() {
2983
+ it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
2904
2984
  var responsePayload, roapEvent;
2905
- return _regenerator.default.wrap(function (_context54) {
2906
- while (1) switch (_context54.prev = _context54.next) {
2985
+ return _regenerator.default.wrap(function (_context55) {
2986
+ while (1) switch (_context55.prev = _context55.next) {
2907
2987
  case 0:
2908
2988
  expect.assertions(5);
2909
2989
  responsePayload = {
@@ -2913,25 +2993,25 @@ describe('Supplementary Services tests', function () {
2913
2993
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
2914
2994
  call['held'] = false;
2915
2995
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2916
- var _ref54 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53(errObj) {
2917
- return _regenerator.default.wrap(function (_context53) {
2918
- while (1) switch (_context53.prev = _context53.next) {
2996
+ var _ref55 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54(errObj) {
2997
+ return _regenerator.default.wrap(function (_context54) {
2998
+ while (1) switch (_context54.prev = _context54.next) {
2919
2999
  case 0:
2920
3000
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
2921
3001
  expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
2922
3002
  case 1:
2923
3003
  case "end":
2924
- return _context53.stop();
3004
+ return _context54.stop();
2925
3005
  }
2926
- }, _callee53);
3006
+ }, _callee54);
2927
3007
  }));
2928
3008
  return function (_x5) {
2929
- return _ref54.apply(this, arguments);
3009
+ return _ref55.apply(this, arguments);
2930
3010
  };
2931
3011
  }());
2932
3012
  jest.runAllTimers();
2933
3013
  call.doHoldResume();
2934
- _context54.next = 1;
3014
+ _context55.next = 1;
2935
3015
  return (0, _testUtil.flushPromises)(2);
2936
3016
  case 1:
2937
3017
  /* At this point, the Call State should be S_CALL_HOLD
@@ -2944,11 +3024,11 @@ describe('Supplementary Services tests', function () {
2944
3024
  call['handleIncomingRoapOffer']({}, dummyEvent);
2945
3025
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2946
3026
  roapEvent.data.type = 'ANSWER';
2947
- _context54.next = 2;
3027
+ _context55.next = 2;
2948
3028
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2949
3029
  case 2:
2950
3030
  roapEvent.data.type = 'OK';
2951
- _context54.next = 3;
3031
+ _context55.next = 3;
2952
3032
  return call['handleRoapEstablished']({}, dummyEvent);
2953
3033
  case 3:
2954
3034
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -2960,14 +3040,14 @@ describe('Supplementary Services tests', function () {
2960
3040
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2961
3041
  case 4:
2962
3042
  case "end":
2963
- return _context54.stop();
3043
+ return _context55.stop();
2964
3044
  }
2965
- }, _callee54);
3045
+ }, _callee55);
2966
3046
  })));
2967
- it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56() {
3047
+ it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
2968
3048
  var responsePayload, warnSpy, roapEvent;
2969
- return _regenerator.default.wrap(function (_context56) {
2970
- while (1) switch (_context56.prev = _context56.next) {
3049
+ return _regenerator.default.wrap(function (_context57) {
3050
+ while (1) switch (_context57.prev = _context57.next) {
2971
3051
  case 0:
2972
3052
  expect.assertions(7);
2973
3053
  responsePayload = {
@@ -2980,25 +3060,25 @@ describe('Supplementary Services tests', function () {
2980
3060
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2981
3061
  call['held'] = true;
2982
3062
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
2983
- var _ref56 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55(correlationId) {
2984
- return _regenerator.default.wrap(function (_context55) {
2985
- while (1) switch (_context55.prev = _context55.next) {
3063
+ var _ref57 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56(correlationId) {
3064
+ return _regenerator.default.wrap(function (_context56) {
3065
+ while (1) switch (_context56.prev = _context56.next) {
2986
3066
  case 0:
2987
3067
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2988
3068
  case 1:
2989
3069
  case "end":
2990
- return _context55.stop();
3070
+ return _context56.stop();
2991
3071
  }
2992
- }, _callee55);
3072
+ }, _callee56);
2993
3073
  }));
2994
3074
  return function (_x6) {
2995
- return _ref56.apply(this, arguments);
3075
+ return _ref57.apply(this, arguments);
2996
3076
  };
2997
3077
  }());
2998
- _context56.next = 1;
3078
+ _context57.next = 1;
2999
3079
  return call.doHoldResume();
3000
3080
  case 1:
3001
- _context56.next = 2;
3081
+ _context57.next = 2;
3002
3082
  return (0, _testUtil.flushPromises)(2);
3003
3083
  case 2:
3004
3084
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -3014,11 +3094,11 @@ describe('Supplementary Services tests', function () {
3014
3094
  call['handleIncomingRoapOffer']({}, dummyEvent);
3015
3095
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3016
3096
  roapEvent.data.type = 'ANSWER';
3017
- _context56.next = 3;
3097
+ _context57.next = 3;
3018
3098
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3019
3099
  case 3:
3020
3100
  roapEvent.data.type = 'OK';
3021
- _context56.next = 4;
3101
+ _context57.next = 4;
3022
3102
  return call['handleRoapEstablished']({}, dummyEvent);
3023
3103
  case 4:
3024
3104
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -3033,14 +3113,14 @@ describe('Supplementary Services tests', function () {
3033
3113
  });
3034
3114
  case 5:
3035
3115
  case "end":
3036
- return _context56.stop();
3116
+ return _context57.stop();
3037
3117
  }
3038
- }, _callee56);
3118
+ }, _callee57);
3039
3119
  })));
3040
- it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58() {
3120
+ it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59() {
3041
3121
  var responsePayload, warnSpy, roapEvent;
3042
- return _regenerator.default.wrap(function (_context58) {
3043
- while (1) switch (_context58.prev = _context58.next) {
3122
+ return _regenerator.default.wrap(function (_context59) {
3123
+ while (1) switch (_context59.prev = _context59.next) {
3044
3124
  case 0:
3045
3125
  expect.assertions(7);
3046
3126
  responsePayload = {
@@ -3053,26 +3133,26 @@ describe('Supplementary Services tests', function () {
3053
3133
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3054
3134
  call['held'] = true;
3055
3135
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
3056
- var _ref58 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57(correlationId) {
3057
- return _regenerator.default.wrap(function (_context57) {
3058
- while (1) switch (_context57.prev = _context57.next) {
3136
+ var _ref59 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58(correlationId) {
3137
+ return _regenerator.default.wrap(function (_context58) {
3138
+ while (1) switch (_context58.prev = _context58.next) {
3059
3139
  case 0:
3060
3140
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3061
3141
  case 1:
3062
3142
  case "end":
3063
- return _context57.stop();
3143
+ return _context58.stop();
3064
3144
  }
3065
- }, _callee57);
3145
+ }, _callee58);
3066
3146
  }));
3067
3147
  return function (_x7) {
3068
- return _ref58.apply(this, arguments);
3148
+ return _ref59.apply(this, arguments);
3069
3149
  };
3070
3150
  }());
3071
3151
  call.doHoldResume();
3072
- _context58.next = 1;
3152
+ _context59.next = 1;
3073
3153
  return _promise.default.resolve();
3074
3154
  case 1:
3075
- _context58.next = 2;
3155
+ _context59.next = 2;
3076
3156
  return _promise.default.resolve();
3077
3157
  case 2:
3078
3158
  expect(setTimeout).not.toHaveBeenCalled();
@@ -3088,11 +3168,11 @@ describe('Supplementary Services tests', function () {
3088
3168
  call['handleIncomingRoapOffer']({}, dummyEvent);
3089
3169
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3090
3170
  roapEvent.data.type = 'ANSWER';
3091
- _context58.next = 3;
3171
+ _context59.next = 3;
3092
3172
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3093
3173
  case 3:
3094
3174
  roapEvent.data.type = 'OK';
3095
- _context58.next = 4;
3175
+ _context59.next = 4;
3096
3176
  return call['handleRoapEstablished']({}, dummyEvent);
3097
3177
  case 4:
3098
3178
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -3107,14 +3187,14 @@ describe('Supplementary Services tests', function () {
3107
3187
  });
3108
3188
  case 5:
3109
3189
  case "end":
3110
- return _context58.stop();
3190
+ return _context59.stop();
3111
3191
  }
3112
- }, _callee58);
3192
+ }, _callee59);
3113
3193
  })));
3114
- it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60() {
3194
+ it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61() {
3115
3195
  var responsePayload;
3116
- return _regenerator.default.wrap(function (_context60) {
3117
- while (1) switch (_context60.prev = _context60.next) {
3196
+ return _regenerator.default.wrap(function (_context61) {
3197
+ while (1) switch (_context61.prev = _context61.next) {
3118
3198
  case 0:
3119
3199
  expect.assertions(4);
3120
3200
  responsePayload = {
@@ -3124,26 +3204,26 @@ describe('Supplementary Services tests', function () {
3124
3204
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3125
3205
  call['held'] = true;
3126
3206
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3127
- var _ref60 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59(errObj) {
3128
- return _regenerator.default.wrap(function (_context59) {
3129
- while (1) switch (_context59.prev = _context59.next) {
3207
+ var _ref61 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60(errObj) {
3208
+ return _regenerator.default.wrap(function (_context60) {
3209
+ while (1) switch (_context60.prev = _context60.next) {
3130
3210
  case 0:
3131
3211
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3132
3212
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3133
3213
  case 1:
3134
3214
  case "end":
3135
- return _context59.stop();
3215
+ return _context60.stop();
3136
3216
  }
3137
- }, _callee59);
3217
+ }, _callee60);
3138
3218
  }));
3139
3219
  return function (_x8) {
3140
- return _ref60.apply(this, arguments);
3220
+ return _ref61.apply(this, arguments);
3141
3221
  };
3142
3222
  }());
3143
- _context60.next = 1;
3223
+ _context61.next = 1;
3144
3224
  return call.doHoldResume();
3145
3225
  case 1:
3146
- _context60.next = 2;
3226
+ _context61.next = 2;
3147
3227
  return (0, _testUtil.flushPromises)(2);
3148
3228
  case 2:
3149
3229
  expect(call.isHeld()).toStrictEqual(true);
@@ -3154,14 +3234,14 @@ describe('Supplementary Services tests', function () {
3154
3234
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3155
3235
  case 3:
3156
3236
  case "end":
3157
- return _context60.stop();
3237
+ return _context61.stop();
3158
3238
  }
3159
- }, _callee60);
3239
+ }, _callee61);
3160
3240
  })));
3161
- it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62() {
3241
+ it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
3162
3242
  var responsePayload, rejectPayload, roapEvent;
3163
- return _regenerator.default.wrap(function (_context62) {
3164
- while (1) switch (_context62.prev = _context62.next) {
3243
+ return _regenerator.default.wrap(function (_context63) {
3244
+ while (1) switch (_context63.prev = _context63.next) {
3165
3245
  case 0:
3166
3246
  expect.assertions(5);
3167
3247
  responsePayload = {
@@ -3175,24 +3255,24 @@ describe('Supplementary Services tests', function () {
3175
3255
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
3176
3256
  call['held'] = true;
3177
3257
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3178
- var _ref62 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61(errObj) {
3179
- return _regenerator.default.wrap(function (_context61) {
3180
- while (1) switch (_context61.prev = _context61.next) {
3258
+ var _ref63 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62(errObj) {
3259
+ return _regenerator.default.wrap(function (_context62) {
3260
+ while (1) switch (_context62.prev = _context62.next) {
3181
3261
  case 0:
3182
3262
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3183
3263
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3184
3264
  case 1:
3185
3265
  case "end":
3186
- return _context61.stop();
3266
+ return _context62.stop();
3187
3267
  }
3188
- }, _callee61);
3268
+ }, _callee62);
3189
3269
  }));
3190
3270
  return function (_x9) {
3191
- return _ref62.apply(this, arguments);
3271
+ return _ref63.apply(this, arguments);
3192
3272
  };
3193
3273
  }());
3194
3274
  call.doHoldResume();
3195
- _context62.next = 1;
3275
+ _context63.next = 1;
3196
3276
  return (0, _testUtil.flushPromises)(2);
3197
3277
  case 1:
3198
3278
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
@@ -3203,7 +3283,7 @@ describe('Supplementary Services tests', function () {
3203
3283
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3204
3284
  /* We are intentionally failing the ROAP ANSWER */
3205
3285
  roapEvent.data.type = 'ANSWER';
3206
- _context62.next = 2;
3286
+ _context63.next = 2;
3207
3287
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3208
3288
  case 2:
3209
3289
  expect(call.isHeld()).toStrictEqual(true);
@@ -3211,14 +3291,14 @@ describe('Supplementary Services tests', function () {
3211
3291
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3212
3292
  case 3:
3213
3293
  case "end":
3214
- return _context62.stop();
3294
+ return _context63.stop();
3215
3295
  }
3216
- }, _callee62);
3296
+ }, _callee63);
3217
3297
  })));
3218
- it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64() {
3298
+ it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65() {
3219
3299
  var responsePayload, roapEvent;
3220
- return _regenerator.default.wrap(function (_context64) {
3221
- while (1) switch (_context64.prev = _context64.next) {
3300
+ return _regenerator.default.wrap(function (_context65) {
3301
+ while (1) switch (_context65.prev = _context65.next) {
3222
3302
  case 0:
3223
3303
  expect.assertions(5);
3224
3304
  responsePayload = {
@@ -3228,24 +3308,24 @@ describe('Supplementary Services tests', function () {
3228
3308
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
3229
3309
  call['held'] = true;
3230
3310
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3231
- var _ref64 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63(errObj) {
3232
- return _regenerator.default.wrap(function (_context63) {
3233
- while (1) switch (_context63.prev = _context63.next) {
3311
+ var _ref65 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64(errObj) {
3312
+ return _regenerator.default.wrap(function (_context64) {
3313
+ while (1) switch (_context64.prev = _context64.next) {
3234
3314
  case 0:
3235
3315
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
3236
3316
  expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
3237
3317
  case 1:
3238
3318
  case "end":
3239
- return _context63.stop();
3319
+ return _context64.stop();
3240
3320
  }
3241
- }, _callee63);
3321
+ }, _callee64);
3242
3322
  }));
3243
3323
  return function (_x0) {
3244
- return _ref64.apply(this, arguments);
3324
+ return _ref65.apply(this, arguments);
3245
3325
  };
3246
3326
  }());
3247
3327
  call.doHoldResume();
3248
- _context64.next = 1;
3328
+ _context65.next = 1;
3249
3329
  return (0, _testUtil.flushPromises)(2);
3250
3330
  case 1:
3251
3331
  /* At this point ,the Call State should be S_CALL_RESUME
@@ -3258,11 +3338,11 @@ describe('Supplementary Services tests', function () {
3258
3338
  call['handleIncomingRoapOffer']({}, dummyEvent);
3259
3339
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3260
3340
  roapEvent.data.type = 'ANSWER';
3261
- _context64.next = 2;
3341
+ _context65.next = 2;
3262
3342
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3263
3343
  case 2:
3264
3344
  roapEvent.data.type = 'OK';
3265
- _context64.next = 3;
3345
+ _context65.next = 3;
3266
3346
  return call['handleRoapEstablished']({}, dummyEvent);
3267
3347
  case 3:
3268
3348
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -3272,9 +3352,9 @@ describe('Supplementary Services tests', function () {
3272
3352
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3273
3353
  case 4:
3274
3354
  case "end":
3275
- return _context64.stop();
3355
+ return _context65.stop();
3276
3356
  }
3277
- }, _callee64);
3357
+ }, _callee65);
3278
3358
  })));
3279
3359
  });
3280
3360
  describe('Call transfer tests', function () {
@@ -3307,10 +3387,10 @@ describe('Supplementary Services tests', function () {
3307
3387
  secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
3308
3388
  secondCall['held'] = false;
3309
3389
  });
3310
- it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67() {
3390
+ it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68() {
3311
3391
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3312
- return _regenerator.default.wrap(function (_context67) {
3313
- while (1) switch (_context67.prev = _context67.next) {
3392
+ return _regenerator.default.wrap(function (_context68) {
3393
+ while (1) switch (_context68.prev = _context68.next) {
3314
3394
  case 0:
3315
3395
  expect.assertions(12); // Updated to match actual assertion count
3316
3396
  responsePayload = {
@@ -3322,41 +3402,41 @@ describe('Supplementary Services tests', function () {
3322
3402
  infoSpy = jest.spyOn(_Logger.default, 'info');
3323
3403
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3324
3404
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3325
- var _ref66 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65(correlationId) {
3326
- return _regenerator.default.wrap(function (_context65) {
3327
- while (1) switch (_context65.prev = _context65.next) {
3405
+ var _ref67 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66(correlationId) {
3406
+ return _regenerator.default.wrap(function (_context66) {
3407
+ while (1) switch (_context66.prev = _context66.next) {
3328
3408
  case 0:
3329
3409
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3330
3410
  case 1:
3331
3411
  case "end":
3332
- return _context65.stop();
3412
+ return _context66.stop();
3333
3413
  }
3334
- }, _callee65);
3414
+ }, _callee66);
3335
3415
  }));
3336
3416
  return function (_x1) {
3337
- return _ref66.apply(this, arguments);
3417
+ return _ref67.apply(this, arguments);
3338
3418
  };
3339
3419
  }());
3340
3420
  secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3341
- var _ref67 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66(correlationId) {
3342
- return _regenerator.default.wrap(function (_context66) {
3343
- while (1) switch (_context66.prev = _context66.next) {
3421
+ var _ref68 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67(correlationId) {
3422
+ return _regenerator.default.wrap(function (_context67) {
3423
+ while (1) switch (_context67.prev = _context67.next) {
3344
3424
  case 0:
3345
3425
  expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
3346
3426
  case 1:
3347
3427
  case "end":
3348
- return _context66.stop();
3428
+ return _context67.stop();
3349
3429
  }
3350
- }, _callee66);
3430
+ }, _callee67);
3351
3431
  }));
3352
3432
  return function (_x10) {
3353
- return _ref67.apply(this, arguments);
3433
+ return _ref68.apply(this, arguments);
3354
3434
  };
3355
3435
  }());
3356
- _context67.next = 1;
3436
+ _context68.next = 1;
3357
3437
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3358
3438
  case 1:
3359
- _context67.next = 2;
3439
+ _context68.next = 2;
3360
3440
  return (0, _testUtil.flushPromises)(2);
3361
3441
  case 2:
3362
3442
  expect(requestSpy).toBeCalled();
@@ -3379,14 +3459,14 @@ describe('Supplementary Services tests', function () {
3379
3459
  expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3380
3460
  case 3:
3381
3461
  case "end":
3382
- return _context67.stop();
3462
+ return _context68.stop();
3383
3463
  }
3384
- }, _callee67);
3464
+ }, _callee68);
3385
3465
  })));
3386
- it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69() {
3466
+ it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
3387
3467
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3388
- return _regenerator.default.wrap(function (_context69) {
3389
- while (1) switch (_context69.prev = _context69.next) {
3468
+ return _regenerator.default.wrap(function (_context70) {
3469
+ while (1) switch (_context70.prev = _context70.next) {
3390
3470
  case 0:
3391
3471
  expect.assertions(10); // Updated to match actual assertion count
3392
3472
  responsePayload = {
@@ -3398,25 +3478,25 @@ describe('Supplementary Services tests', function () {
3398
3478
  infoSpy = jest.spyOn(_Logger.default, 'info');
3399
3479
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3400
3480
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3401
- var _ref69 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68(correlationId) {
3402
- return _regenerator.default.wrap(function (_context68) {
3403
- while (1) switch (_context68.prev = _context68.next) {
3481
+ var _ref70 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69(correlationId) {
3482
+ return _regenerator.default.wrap(function (_context69) {
3483
+ while (1) switch (_context69.prev = _context69.next) {
3404
3484
  case 0:
3405
3485
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3406
3486
  case 1:
3407
3487
  case "end":
3408
- return _context68.stop();
3488
+ return _context69.stop();
3409
3489
  }
3410
- }, _callee68);
3490
+ }, _callee69);
3411
3491
  }));
3412
3492
  return function (_x11) {
3413
- return _ref69.apply(this, arguments);
3493
+ return _ref70.apply(this, arguments);
3414
3494
  };
3415
3495
  }());
3416
- _context69.next = 1;
3496
+ _context70.next = 1;
3417
3497
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3418
3498
  case 1:
3419
- _context69.next = 2;
3499
+ _context70.next = 2;
3420
3500
  return (0, _testUtil.flushPromises)(2);
3421
3501
  case 2:
3422
3502
  expect(requestSpy).toBeCalled();
@@ -3435,14 +3515,14 @@ describe('Supplementary Services tests', function () {
3435
3515
  expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3436
3516
  case 3:
3437
3517
  case "end":
3438
- return _context69.stop();
3518
+ return _context70.stop();
3439
3519
  }
3440
- }, _callee69);
3520
+ }, _callee70);
3441
3521
  })));
3442
- it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
3522
+ it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
3443
3523
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3444
- return _regenerator.default.wrap(function (_context70) {
3445
- while (1) switch (_context70.prev = _context70.next) {
3524
+ return _regenerator.default.wrap(function (_context71) {
3525
+ while (1) switch (_context71.prev = _context71.next) {
3446
3526
  case 0:
3447
3527
  responsePayload = {
3448
3528
  statusCode: 403,
@@ -3453,10 +3533,10 @@ describe('Supplementary Services tests', function () {
3453
3533
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3454
3534
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3455
3535
  call['broadworksCorrelationInfo'] = 'dummy-broadworks-correlation-info';
3456
- _context70.next = 1;
3536
+ _context71.next = 1;
3457
3537
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3458
3538
  case 1:
3459
- _context70.next = 2;
3539
+ _context71.next = 2;
3460
3540
  return (0, _testUtil.flushPromises)(1);
3461
3541
  case 2:
3462
3542
  expect(requestSpy).toBeCalled();
@@ -3477,14 +3557,14 @@ describe('Supplementary Services tests', function () {
3477
3557
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
3478
3558
  case 3:
3479
3559
  case "end":
3480
- return _context70.stop();
3560
+ return _context71.stop();
3481
3561
  }
3482
- }, _callee70);
3562
+ }, _callee71);
3483
3563
  })));
3484
- it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
3564
+ it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3485
3565
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3486
- return _regenerator.default.wrap(function (_context71) {
3487
- while (1) switch (_context71.prev = _context71.next) {
3566
+ return _regenerator.default.wrap(function (_context72) {
3567
+ while (1) switch (_context72.prev = _context72.next) {
3488
3568
  case 0:
3489
3569
  responsePayload = {
3490
3570
  statusCode: 403,
@@ -3494,10 +3574,10 @@ describe('Supplementary Services tests', function () {
3494
3574
  requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3495
3575
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3496
3576
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3497
- _context71.next = 1;
3577
+ _context72.next = 1;
3498
3578
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3499
3579
  case 1:
3500
- _context71.next = 2;
3580
+ _context72.next = 2;
3501
3581
  return (0, _testUtil.flushPromises)(2);
3502
3582
  case 2:
3503
3583
  expect(requestSpy).toBeCalled();
@@ -3518,18 +3598,18 @@ describe('Supplementary Services tests', function () {
3518
3598
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
3519
3599
  case 3:
3520
3600
  case "end":
3521
- return _context71.stop();
3601
+ return _context72.stop();
3522
3602
  }
3523
- }, _callee71);
3603
+ }, _callee72);
3524
3604
  })));
3525
- it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3605
+ it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
3526
3606
  var requestSpy, warnSpy;
3527
- return _regenerator.default.wrap(function (_context72) {
3528
- while (1) switch (_context72.prev = _context72.next) {
3607
+ return _regenerator.default.wrap(function (_context73) {
3608
+ while (1) switch (_context73.prev = _context73.next) {
3529
3609
  case 0:
3530
3610
  requestSpy = jest.spyOn(webex, 'request');
3531
3611
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3532
- _context72.next = 1;
3612
+ _context73.next = 1;
3533
3613
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
3534
3614
  case 1:
3535
3615
  /* We should be in CALL_ESTABLISHED state */
@@ -3541,18 +3621,18 @@ describe('Supplementary Services tests', function () {
3541
3621
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3542
3622
  case 2:
3543
3623
  case "end":
3544
- return _context72.stop();
3624
+ return _context73.stop();
3545
3625
  }
3546
- }, _callee72);
3626
+ }, _callee73);
3547
3627
  })));
3548
- it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
3628
+ it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee74() {
3549
3629
  var requestSpy, warnSpy;
3550
- return _regenerator.default.wrap(function (_context73) {
3551
- while (1) switch (_context73.prev = _context73.next) {
3630
+ return _regenerator.default.wrap(function (_context74) {
3631
+ while (1) switch (_context74.prev = _context74.next) {
3552
3632
  case 0:
3553
3633
  requestSpy = jest.spyOn(webex, 'request');
3554
3634
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3555
- _context73.next = 1;
3635
+ _context74.next = 1;
3556
3636
  return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
3557
3637
  case 1:
3558
3638
  /* We should be in CALL_ESTABLISHED state */
@@ -3564,9 +3644,9 @@ describe('Supplementary Services tests', function () {
3564
3644
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3565
3645
  case 2:
3566
3646
  case "end":
3567
- return _context73.stop();
3647
+ return _context74.stop();
3568
3648
  }
3569
- }, _callee73);
3649
+ }, _callee74);
3570
3650
  })));
3571
3651
  });
3572
3652
  });