@webex/calling 3.12.0-next.3 → 3.12.0-next.31

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 (194) hide show
  1. package/dist/CallingClient/CallingClient.js +463 -205
  2. package/dist/CallingClient/CallingClient.js.map +1 -1
  3. package/dist/CallingClient/CallingClient.test.js +170 -77
  4. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  5. package/dist/CallingClient/calling/call.js +32 -8
  6. package/dist/CallingClient/calling/call.js.map +1 -1
  7. package/dist/CallingClient/calling/call.test.js +581 -445
  8. package/dist/CallingClient/calling/call.test.js.map +1 -1
  9. package/dist/CallingClient/calling/callManager.js +53 -30
  10. package/dist/CallingClient/calling/callManager.js.map +1 -1
  11. package/dist/CallingClient/calling/callManager.test.js +35 -0
  12. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  13. package/dist/CallingClient/calling/types.js +2 -0
  14. package/dist/CallingClient/calling/types.js.map +1 -1
  15. package/dist/CallingClient/constants.js +24 -3
  16. package/dist/CallingClient/constants.js.map +1 -1
  17. package/dist/CallingClient/line/line.test.js +16 -1
  18. package/dist/CallingClient/line/line.test.js.map +1 -1
  19. package/dist/CallingClient/registration/register.js +694 -406
  20. package/dist/CallingClient/registration/register.js.map +1 -1
  21. package/dist/CallingClient/registration/register.test.js +202 -21
  22. package/dist/CallingClient/registration/register.test.js.map +1 -1
  23. package/dist/CallingClient/registration/types.js.map +1 -1
  24. package/dist/CallingClient/registration/webWorker.js +41 -104
  25. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  26. package/dist/CallingClient/registration/webWorker.test.js +39 -153
  27. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  28. package/dist/CallingClient/registration/webWorkerStr.js +1 -1
  29. package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
  30. package/dist/CallingClient/utils/constants.js +46 -0
  31. package/dist/CallingClient/utils/constants.js.map +1 -0
  32. package/dist/CallingClient/utils/index.js +63 -0
  33. package/dist/CallingClient/utils/index.js.map +1 -0
  34. package/dist/CallingClient/utils/mobiusSocketMapper.js +122 -0
  35. package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -0
  36. package/dist/CallingClient/utils/mobiusSocketMapper.test.js +211 -0
  37. package/dist/CallingClient/utils/mobiusSocketMapper.test.js.map +1 -0
  38. package/dist/CallingClient/utils/request.js +349 -0
  39. package/dist/CallingClient/utils/request.js.map +1 -0
  40. package/dist/CallingClient/utils/request.test.js +881 -0
  41. package/dist/CallingClient/utils/request.test.js.map +1 -0
  42. package/dist/CallingClient/utils/types.js +7 -0
  43. package/dist/CallingClient/utils/types.js.map +1 -0
  44. package/dist/CallingClient/utils/wsFeatureFlag.js +70 -0
  45. package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -0
  46. package/dist/CallingClient/utils/wsFeatureFlag.test.js +139 -0
  47. package/dist/CallingClient/utils/wsFeatureFlag.test.js.map +1 -0
  48. package/dist/Contacts/ContactsClient.test.js +3 -8
  49. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  50. package/dist/Events/types.js +1 -11
  51. package/dist/Events/types.js.map +1 -1
  52. package/dist/Metrics/index.js +60 -0
  53. package/dist/Metrics/index.js.map +1 -1
  54. package/dist/Metrics/index.test.js +356 -0
  55. package/dist/Metrics/index.test.js.map +1 -1
  56. package/dist/Metrics/types.js +11 -1
  57. package/dist/Metrics/types.js.map +1 -1
  58. package/dist/SDKConnector/types.js.map +1 -1
  59. package/dist/common/Utils.js +138 -44
  60. package/dist/common/Utils.js.map +1 -1
  61. package/dist/common/testUtil.js +8 -4
  62. package/dist/common/testUtil.js.map +1 -1
  63. package/dist/common/types.js +2 -0
  64. package/dist/common/types.js.map +1 -1
  65. package/dist/mobius-socket/config.js +24 -0
  66. package/dist/mobius-socket/config.js.map +1 -0
  67. package/dist/mobius-socket/errors.js +150 -0
  68. package/dist/mobius-socket/errors.js.map +1 -0
  69. package/dist/mobius-socket/index.js +57 -0
  70. package/dist/mobius-socket/index.js.map +1 -0
  71. package/dist/mobius-socket/mobius-socket-events.test.js +485 -0
  72. package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -0
  73. package/dist/mobius-socket/mobius-socket.js +804 -0
  74. package/dist/mobius-socket/mobius-socket.js.map +1 -0
  75. package/dist/mobius-socket/mobius-socket.test.js +1833 -0
  76. package/dist/mobius-socket/mobius-socket.test.js.map +1 -0
  77. package/dist/mobius-socket/socket/constants.js +34 -0
  78. package/dist/mobius-socket/socket/constants.js.map +1 -0
  79. package/dist/mobius-socket/socket/index.js +15 -0
  80. package/dist/mobius-socket/socket/index.js.map +1 -0
  81. package/dist/mobius-socket/socket/socket-base.js +604 -0
  82. package/dist/mobius-socket/socket/socket-base.js.map +1 -0
  83. package/dist/mobius-socket/socket/socket.js +19 -0
  84. package/dist/mobius-socket/socket/socket.js.map +1 -0
  85. package/dist/mobius-socket/socket/socket.shim.js +26 -0
  86. package/dist/mobius-socket/socket/socket.shim.js.map +1 -0
  87. package/dist/mobius-socket/socket/types.js +7 -0
  88. package/dist/mobius-socket/socket/types.js.map +1 -0
  89. package/dist/mobius-socket/socket.test.js +727 -0
  90. package/dist/mobius-socket/socket.test.js.map +1 -0
  91. package/dist/mobius-socket/test/mocha-helpers.js +23 -0
  92. package/dist/mobius-socket/test/mocha-helpers.js.map +1 -0
  93. package/dist/mobius-socket/test/promise-tick.js +28 -0
  94. package/dist/mobius-socket/test/promise-tick.js.map +1 -0
  95. package/dist/mobius-socket/types.js +7 -0
  96. package/dist/mobius-socket/types.js.map +1 -0
  97. package/dist/module/CallingClient/CallingClient.js +141 -10
  98. package/dist/module/CallingClient/calling/call.js +24 -6
  99. package/dist/module/CallingClient/calling/callManager.js +27 -7
  100. package/dist/module/CallingClient/calling/types.js +2 -0
  101. package/dist/module/CallingClient/constants.js +20 -0
  102. package/dist/module/CallingClient/registration/register.js +226 -62
  103. package/dist/module/CallingClient/registration/webWorker.js +42 -61
  104. package/dist/module/CallingClient/registration/webWorkerStr.js +47 -82
  105. package/dist/module/CallingClient/utils/constants.js +30 -0
  106. package/dist/module/CallingClient/utils/index.js +5 -0
  107. package/dist/module/CallingClient/utils/mobiusSocketMapper.js +72 -0
  108. package/dist/module/CallingClient/utils/request.js +162 -0
  109. package/dist/module/CallingClient/utils/types.js +1 -0
  110. package/dist/module/CallingClient/utils/wsFeatureFlag.js +41 -0
  111. package/dist/module/Events/types.js +0 -10
  112. package/dist/module/Metrics/index.js +46 -0
  113. package/dist/module/Metrics/types.js +10 -0
  114. package/dist/module/common/Utils.js +52 -12
  115. package/dist/module/common/testUtil.js +5 -1
  116. package/dist/module/common/types.js +2 -0
  117. package/dist/module/mobius-socket/config.js +15 -0
  118. package/dist/module/mobius-socket/errors.js +64 -0
  119. package/dist/module/mobius-socket/index.js +24 -0
  120. package/dist/module/mobius-socket/mobius-socket.js +571 -0
  121. package/dist/module/mobius-socket/socket/constants.js +10 -0
  122. package/dist/module/mobius-socket/socket/index.js +4 -0
  123. package/dist/module/mobius-socket/socket/socket-base.js +368 -0
  124. package/dist/module/mobius-socket/socket/socket.js +9 -0
  125. package/dist/module/mobius-socket/socket/socket.shim.js +12 -0
  126. package/dist/module/mobius-socket/socket/types.js +1 -0
  127. package/dist/module/mobius-socket/types.js +1 -0
  128. package/dist/types/CallingClient/CallingClient.d.ts +7 -0
  129. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  130. package/dist/types/CallingClient/calling/call.d.ts +2 -0
  131. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  132. package/dist/types/CallingClient/calling/callManager.d.ts +3 -2
  133. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  134. package/dist/types/CallingClient/calling/types.d.ts +21 -9
  135. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  136. package/dist/types/CallingClient/constants.d.ts +20 -0
  137. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  138. package/dist/types/CallingClient/registration/register.d.ts +6 -0
  139. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  140. package/dist/types/CallingClient/registration/types.d.ts +3 -1
  141. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  142. package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
  143. package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
  144. package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
  145. package/dist/types/CallingClient/utils/constants.d.ts +30 -0
  146. package/dist/types/CallingClient/utils/constants.d.ts.map +1 -0
  147. package/dist/types/CallingClient/utils/index.d.ts +6 -0
  148. package/dist/types/CallingClient/utils/index.d.ts.map +1 -0
  149. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts +5 -0
  150. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -0
  151. package/dist/types/CallingClient/utils/request.d.ts +23 -0
  152. package/dist/types/CallingClient/utils/request.d.ts.map +1 -0
  153. package/dist/types/CallingClient/utils/types.d.ts +29 -0
  154. package/dist/types/CallingClient/utils/types.d.ts.map +1 -0
  155. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts +4 -0
  156. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -0
  157. package/dist/types/Events/types.d.ts +0 -10
  158. package/dist/types/Events/types.d.ts.map +1 -1
  159. package/dist/types/Metrics/index.d.ts.map +1 -1
  160. package/dist/types/Metrics/types.d.ts +11 -1
  161. package/dist/types/Metrics/types.d.ts.map +1 -1
  162. package/dist/types/SDKConnector/types.d.ts +24 -0
  163. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  164. package/dist/types/common/Utils.d.ts +9 -2
  165. package/dist/types/common/Utils.d.ts.map +1 -1
  166. package/dist/types/common/testUtil.d.ts +4 -1
  167. package/dist/types/common/testUtil.d.ts.map +1 -1
  168. package/dist/types/common/types.d.ts +3 -0
  169. package/dist/types/common/types.d.ts.map +1 -1
  170. package/dist/types/mobius-socket/config.d.ts +17 -0
  171. package/dist/types/mobius-socket/config.d.ts.map +1 -0
  172. package/dist/types/mobius-socket/errors.d.ts +32 -0
  173. package/dist/types/mobius-socket/errors.d.ts.map +1 -0
  174. package/dist/types/mobius-socket/index.d.ts +14 -0
  175. package/dist/types/mobius-socket/index.d.ts.map +1 -0
  176. package/dist/types/mobius-socket/mobius-socket.d.ts +48 -0
  177. package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -0
  178. package/dist/types/mobius-socket/socket/constants.d.ts +11 -0
  179. package/dist/types/mobius-socket/socket/constants.d.ts.map +1 -0
  180. package/dist/types/mobius-socket/socket/index.d.ts +5 -0
  181. package/dist/types/mobius-socket/socket/index.d.ts.map +1 -0
  182. package/dist/types/mobius-socket/socket/socket-base.d.ts +43 -0
  183. package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -0
  184. package/dist/types/mobius-socket/socket/socket.d.ts +6 -0
  185. package/dist/types/mobius-socket/socket/socket.d.ts.map +1 -0
  186. package/dist/types/mobius-socket/socket/socket.shim.d.ts +6 -0
  187. package/dist/types/mobius-socket/socket/socket.shim.d.ts.map +1 -0
  188. package/dist/types/mobius-socket/socket/types.d.ts +61 -0
  189. package/dist/types/mobius-socket/socket/types.d.ts.map +1 -0
  190. package/dist/types/mobius-socket/types.d.ts +21 -0
  191. package/dist/types/mobius-socket/types.d.ts.map +1 -0
  192. package/package.json +20 -5
  193. package/src/mobius-socket/socket/socket.shim.ts +22 -0
  194. package/src/mobius-socket/socket/socket.ts +14 -0
@@ -10,6 +10,7 @@ var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/objec
10
10
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
11
11
  var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
12
12
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
13
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
13
14
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
14
15
  var InternalMediaCoreModule = _interopRequireWildcard(require("@webex/internal-media-core"));
15
16
  var _mediaHelpers = require("@webex/media-helpers");
@@ -27,11 +28,19 @@ var _callManager = require("./callManager");
27
28
  var _Logger = _interopRequireDefault(require("../../Logger"));
28
29
  var _Errors = require("../../Errors");
29
30
  var _constants2 = require("../../common/constants");
31
+ var _request = require("../utils/request");
30
32
  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
33
  /* eslint-disable @typescript-eslint/no-explicit-any */
32
34
  /* eslint-disable dot-notation */
33
35
  /* eslint-disable @typescript-eslint/no-shadow */
34
36
 
37
+ jest.mock('../../mobius-socket', function () {
38
+ return {
39
+ getMobiusSocketInstance: jest.fn().mockReturnValue({
40
+ sendWssRequest: jest.fn()
41
+ })
42
+ };
43
+ });
35
44
  jest.mock('@webex/internal-media-core');
36
45
  var uploadLogsSpy = jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
37
46
  var webex = (0, _testUtil.getTestUtilsWebex)();
@@ -116,6 +125,11 @@ describe('Call Tests', function () {
116
125
  webex.request = jest.fn();
117
126
  });
118
127
  beforeEach(function () {
128
+ _request.APIRequest.resetInstance();
129
+ _request.APIRequest.getInstance({
130
+ webex: webex,
131
+ isMobiusSocketEnabled: false
132
+ });
119
133
  callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
120
134
  });
121
135
  it('create call object', function () {
@@ -428,10 +442,104 @@ describe('Call Tests', function () {
428
442
  }
429
443
  }, _callee8);
430
444
  })));
431
- it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
432
- var mockStream, localAudioStream, onStreamSpy, onEffectSpy, offStreamSpy, offEffectSpy, call, updateLocalTracksSpy, bnrMetricSpy;
445
+ it('sends connect before ROAP answer when inbound offer is delayed', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
446
+ var _mock$calls$find;
447
+ var mockStream, localAudioStream, call, handleOutgoingCallConnectSpy, delayedOffer, sendCallStateMachineEvtSpy, sendMediaStateMachineEvtSpy, roapListener;
433
448
  return _regenerator.default.wrap(function (_context9) {
434
449
  while (1) switch (_context9.prev = _context9.next) {
450
+ case 0:
451
+ mockStream = {
452
+ outputStream: {
453
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
454
+ },
455
+ on: jest.fn(),
456
+ getEffectByKind: jest.fn().mockImplementation(function () {
457
+ return mockEffect;
458
+ })
459
+ };
460
+ localAudioStream = mockStream;
461
+ call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.INBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
462
+ webex.request.mockReturnValue({
463
+ statusCode: 200,
464
+ body: {
465
+ callId: 'mock-call-id'
466
+ }
467
+ });
468
+ call.sendCallStateMachineEvt({
469
+ type: 'E_RECV_CALL_SETUP',
470
+ data: {
471
+ seq: 1,
472
+ messageType: 'OFFER'
473
+ }
474
+ });
475
+ expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
476
+ _context9.next = 1;
477
+ return call.answer(localAudioStream);
478
+ case 1:
479
+ expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
480
+
481
+ // Connect is attempted by answer(), but is deferred because offer is not buffered yet.
482
+ handleOutgoingCallConnectSpy = jest.spyOn(call, 'handleOutgoingCallConnect');
483
+ expect(call['connectPending']).toBe(true);
484
+ expect(call['mediaConnection'].roapMessageReceived).not.toHaveBeenCalled();
485
+ delayedOffer = {
486
+ seq: 1,
487
+ messageType: 'OFFER',
488
+ sdp: 'v=0',
489
+ version: 1
490
+ };
491
+ call.sendMediaStateMachineEvt({
492
+ type: 'E_RECV_ROAP_OFFER',
493
+ data: delayedOffer
494
+ });
495
+ _context9.next = 2;
496
+ return (0, _testUtil.flushPromises)(2);
497
+ case 2:
498
+ expect(call['mediaConnection'].roapMessageReceived).toHaveBeenCalledWith(delayedOffer);
499
+ sendCallStateMachineEvtSpy = jest.spyOn(call, 'sendCallStateMachineEvt');
500
+ sendMediaStateMachineEvtSpy = jest.spyOn(call, 'sendMediaStateMachineEvt');
501
+ roapListener = (_mock$calls$find = call['mediaConnection'].on.mock.calls.find(function (_ref0) {
502
+ var _ref1 = (0, _slicedToArray2.default)(_ref0, 1),
503
+ eventName = _ref1[0];
504
+ return eventName === InternalMediaCoreModule.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND;
505
+ })) === null || _mock$calls$find === void 0 ? void 0 : _mock$calls$find[1];
506
+ expect(roapListener).toBeDefined();
507
+ _context9.next = 3;
508
+ return roapListener({
509
+ roapMessage: {
510
+ messageType: 'ANSWER',
511
+ sdp: 'v=0',
512
+ seq: 1,
513
+ version: 2
514
+ }
515
+ });
516
+ case 3:
517
+ _context9.next = 4;
518
+ return (0, _testUtil.flushPromises)(2);
519
+ case 4:
520
+ // On ANSWER from media layer, connect is retried first, then ROAP answer is posted.
521
+ expect(sendCallStateMachineEvtSpy).toHaveBeenNthCalledWith(1, {
522
+ type: 'E_SEND_CALL_CONNECT'
523
+ });
524
+ expect(sendMediaStateMachineEvtSpy).toHaveBeenNthCalledWith(1, {
525
+ type: 'E_SEND_ROAP_ANSWER',
526
+ data: expect.objectContaining({
527
+ messageType: 'ANSWER'
528
+ })
529
+ });
530
+ expect(handleOutgoingCallConnectSpy).toHaveBeenCalled();
531
+ expect(call['mediaConnection'].roapMessageReceived).toHaveBeenLastCalledWith(delayedOffer);
532
+ expect(call['connectPending']).toBe(false);
533
+ case 5:
534
+ case "end":
535
+ return _context9.stop();
536
+ }
537
+ }, _callee9);
538
+ })));
539
+ it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
540
+ var mockStream, localAudioStream, onStreamSpy, onEffectSpy, offStreamSpy, offEffectSpy, call, updateLocalTracksSpy, bnrMetricSpy;
541
+ return _regenerator.default.wrap(function (_context0) {
542
+ while (1) switch (_context0.prev = _context0.next) {
435
543
  case 0:
436
544
  mockStream = {
437
545
  outputStream: {
@@ -487,7 +595,7 @@ describe('Call Tests', function () {
487
595
  });
488
596
  expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_DISABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
489
597
  call.end();
490
- _context9.next = 1;
598
+ _context0.next = 1;
491
599
  return (0, _Utils.waitForMsecs)(50);
492
600
  case 1:
493
601
  /* Checks for switching off the listeners on call disconnect */
@@ -498,14 +606,14 @@ describe('Call Tests', function () {
498
606
  expect(offEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Disabled, expect.any(Function));
499
607
  case 2:
500
608
  case "end":
501
- return _context9.stop();
609
+ return _context0.stop();
502
610
  }
503
- }, _callee9);
611
+ }, _callee0);
504
612
  })));
505
- it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
613
+ it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
506
614
  var mockStream, localAudioStream, warnSpy, call;
507
- return _regenerator.default.wrap(function (_context0) {
508
- while (1) switch (_context0.prev = _context0.next) {
615
+ return _regenerator.default.wrap(function (_context1) {
616
+ while (1) switch (_context1.prev = _context1.next) {
509
617
  case 0:
510
618
  mockStream = {
511
619
  outputStream: {
@@ -529,7 +637,7 @@ describe('Call Tests', function () {
529
637
  warnSpy = jest.spyOn(_Logger.default, 'warn');
530
638
  call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
531
639
  call.answer(localAudioStream);
532
- _context0.next = 1;
640
+ _context1.next = 1;
533
641
  return (0, _Utils.waitForMsecs)(50);
534
642
  case 1:
535
643
  expect(warnSpy).toBeCalledTimes(2);
@@ -544,14 +652,14 @@ describe('Call Tests', function () {
544
652
  expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
545
653
  case 2:
546
654
  case "end":
547
- return _context0.stop();
655
+ return _context1.stop();
548
656
  }
549
- }, _callee0);
657
+ }, _callee1);
550
658
  })));
551
- it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
659
+ it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
552
660
  var mockStream, localAudioStream, warnSpy, call;
553
- return _regenerator.default.wrap(function (_context1) {
554
- while (1) switch (_context1.prev = _context1.next) {
661
+ return _regenerator.default.wrap(function (_context10) {
662
+ while (1) switch (_context10.prev = _context10.next) {
555
663
  case 0:
556
664
  mockStream = {
557
665
  outputStream: {
@@ -563,7 +671,7 @@ describe('Call Tests', function () {
563
671
  warnSpy = jest.spyOn(_Logger.default, 'warn');
564
672
  call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
565
673
  call.dial(localAudioStream);
566
- _context1.next = 1;
674
+ _context10.next = 1;
567
675
  return (0, _Utils.waitForMsecs)(50);
568
676
  case 1:
569
677
  expect(warnSpy).toBeCalledTimes(1);
@@ -576,9 +684,9 @@ describe('Call Tests', function () {
576
684
  expect(webex.request).not.toBeCalledOnceWith();
577
685
  case 2:
578
686
  case "end":
579
- return _context1.stop();
687
+ return _context10.stop();
580
688
  }
581
- }, _callee1);
689
+ }, _callee10);
582
690
  })));
583
691
  it('update media after call creation with valid stream', function () {
584
692
  var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
@@ -652,10 +760,10 @@ describe('Call Tests', function () {
652
760
  method: 'dial'
653
761
  });
654
762
  });
655
- it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
763
+ it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
656
764
  var logSpy, callManager, mockStream, localAudioStream, call;
657
- return _regenerator.default.wrap(function (_context10) {
658
- while (1) switch (_context10.prev = _context10.next) {
765
+ return _regenerator.default.wrap(function (_context11) {
766
+ while (1) switch (_context11.prev = _context11.next) {
659
767
  case 0:
660
768
  logSpy = jest.spyOn(_Logger.default, 'info');
661
769
  webex.request.mockReturnValue({
@@ -731,9 +839,9 @@ describe('Call Tests', function () {
731
839
  expect(mockStream.setUserMuted).toBeCalledOnceWith(false);
732
840
  case 1:
733
841
  case "end":
734
- return _context10.stop();
842
+ return _context11.stop();
735
843
  }
736
- }, _callee10);
844
+ }, _callee11);
737
845
  })));
738
846
  describe('Guest Calling Flow Tests', function () {
739
847
  var dummyEvent = {
@@ -741,10 +849,10 @@ describe('Call Tests', function () {
741
849
  data: undefined
742
850
  };
743
851
  var call;
744
- it('outgoing call without guest calling must have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
852
+ it('outgoing call without guest calling must have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
745
853
  var requestSpy, requestArgs;
746
- return _regenerator.default.wrap(function (_context11) {
747
- while (1) switch (_context11.prev = _context11.next) {
854
+ return _regenerator.default.wrap(function (_context12) {
855
+ while (1) switch (_context12.prev = _context12.next) {
748
856
  case 0:
749
857
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
750
858
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -757,14 +865,14 @@ describe('Call Tests', function () {
757
865
  expect('callee' in requestArgs.body).toBe(true);
758
866
  case 1:
759
867
  case "end":
760
- return _context11.stop();
868
+ return _context12.stop();
761
869
  }
762
- }, _callee11);
870
+ }, _callee12);
763
871
  })));
764
- it('outgoing call for guest calling must not have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
872
+ it('outgoing call for guest calling must not have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
765
873
  var requestSpy, requestArgs;
766
- return _regenerator.default.wrap(function (_context12) {
767
- while (1) switch (_context12.prev = _context12.next) {
874
+ return _regenerator.default.wrap(function (_context13) {
875
+ while (1) switch (_context13.prev = _context13.next) {
768
876
  case 0:
769
877
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
770
878
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -777,9 +885,9 @@ describe('Call Tests', function () {
777
885
  expect('callee' in requestArgs.body).toBe(false);
778
886
  case 1:
779
887
  case "end":
780
- return _context12.stop();
888
+ return _context13.stop();
781
889
  }
782
- }, _callee12);
890
+ }, _callee13);
783
891
  })));
784
892
  });
785
893
  });
@@ -799,6 +907,11 @@ describe('State Machine handler tests', function () {
799
907
  var call;
800
908
  var dtmfMock;
801
909
  beforeEach(function () {
910
+ _request.APIRequest.resetInstance();
911
+ _request.APIRequest.getInstance({
912
+ webex: webex,
913
+ isMobiusSocketEnabled: false
914
+ });
802
915
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
803
916
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
804
917
  var dummy = 10;
@@ -812,10 +925,10 @@ describe('State Machine handler tests', function () {
812
925
 
813
926
  // afterEach(() => call.removeAllListeners());
814
927
 
815
- it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
928
+ it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
816
929
  var statusPayload, dummyEvent, funcSpy, logSpy;
817
- return _regenerator.default.wrap(function (_context13) {
818
- while (1) switch (_context13.prev = _context13.next) {
930
+ return _regenerator.default.wrap(function (_context14) {
931
+ while (1) switch (_context14.prev = _context14.next) {
819
932
  case 0:
820
933
  statusPayload = {
821
934
  statusCode: 200,
@@ -835,7 +948,7 @@ describe('State Machine handler tests', function () {
835
948
  /* This is to flush all the promises from the Promise queue so that
836
949
  * Jest.fakeTimers can advance time and also clear the promise Queue
837
950
  */
838
- _context13.next = 1;
951
+ _context14.next = 1;
839
952
  return (0, _testUtil.flushPromises)(3);
840
953
  case 1:
841
954
  expect(setInterval).toHaveBeenCalledTimes(1);
@@ -851,14 +964,14 @@ describe('State Machine handler tests', function () {
851
964
  });
852
965
  case 2:
853
966
  case "end":
854
- return _context13.stop();
967
+ return _context14.stop();
855
968
  }
856
- }, _callee13);
969
+ }, _callee14);
857
970
  })));
858
- it('session refresh 401 emits token error and ends the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
971
+ it('session refresh 401 emits token error and ends the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
859
972
  var statusPayload, emitSpy, funcSpy;
860
- return _regenerator.default.wrap(function (_context14) {
861
- while (1) switch (_context14.prev = _context14.next) {
973
+ return _regenerator.default.wrap(function (_context15) {
974
+ while (1) switch (_context15.prev = _context15.next) {
862
975
  case 0:
863
976
  expect.assertions(4);
864
977
  statusPayload = {
@@ -873,10 +986,10 @@ describe('State Machine handler tests', function () {
873
986
  funcSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(statusPayload);
874
987
  call['handleCallEstablished']({});
875
988
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
876
- _context14.next = 1;
989
+ _context15.next = 1;
877
990
  return _promise.default.resolve();
878
991
  case 1:
879
- _context14.next = 2;
992
+ _context15.next = 2;
880
993
  return _promise.default.resolve();
881
994
  case 2:
882
995
  // clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
@@ -886,14 +999,14 @@ describe('State Machine handler tests', function () {
886
999
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
887
1000
  case 3:
888
1001
  case "end":
889
- return _context14.stop();
1002
+ return _context15.stop();
890
1003
  }
891
- }, _callee14);
1004
+ }, _callee15);
892
1005
  })));
893
- it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
1006
+ it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
894
1007
  var statusPayload, funcSpy;
895
- return _regenerator.default.wrap(function (_context15) {
896
- while (1) switch (_context15.prev = _context15.next) {
1008
+ return _regenerator.default.wrap(function (_context16) {
1009
+ while (1) switch (_context16.prev = _context16.next) {
897
1010
  case 0:
898
1011
  expect.assertions(4);
899
1012
  statusPayload = {
@@ -912,7 +1025,7 @@ describe('State Machine handler tests', function () {
912
1025
  /* This is to flush all the promises from the Promise queue so that
913
1026
  * Jest.fakeTimers can advance time and also clear the promise Queue
914
1027
  */
915
- _context15.next = 1;
1028
+ _context16.next = 1;
916
1029
  return (0, _testUtil.flushPromises)(2);
917
1030
  case 1:
918
1031
  // clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
@@ -921,14 +1034,14 @@ describe('State Machine handler tests', function () {
921
1034
  expect(funcSpy).toBeCalledTimes(1);
922
1035
  case 2:
923
1036
  case "end":
924
- return _context15.stop();
1037
+ return _context16.stop();
925
1038
  }
926
- }, _callee15);
1039
+ }, _callee16);
927
1040
  })));
928
- it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
1041
+ it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
929
1042
  var errorPayload, okPayload, scheduleKeepaliveSpy, postStatusSpy;
930
- return _regenerator.default.wrap(function (_context16) {
931
- while (1) switch (_context16.prev = _context16.next) {
1043
+ return _regenerator.default.wrap(function (_context17) {
1044
+ while (1) switch (_context17.prev = _context17.next) {
932
1045
  case 0:
933
1046
  errorPayload = {
934
1047
  statusCode: 500,
@@ -946,28 +1059,28 @@ describe('State Machine handler tests', function () {
946
1059
  call['handleCallEstablished']({});
947
1060
  }
948
1061
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
949
- _context16.next = 1;
1062
+ _context17.next = 1;
950
1063
  return (0, _testUtil.flushPromises)(2);
951
1064
  case 1:
952
1065
  expect(postStatusSpy).toHaveBeenCalledTimes(1);
953
1066
 
954
1067
  // Now advance by 1 second for the retry-after interval
955
1068
  jest.advanceTimersByTime(1000);
956
- _context16.next = 2;
1069
+ _context17.next = 2;
957
1070
  return (0, _testUtil.flushPromises)(2);
958
1071
  case 2:
959
1072
  expect(postStatusSpy).toHaveBeenCalledTimes(2);
960
1073
  expect(scheduleKeepaliveSpy).toHaveBeenCalledTimes(2);
961
1074
  case 3:
962
1075
  case "end":
963
- return _context16.stop();
1076
+ return _context17.stop();
964
1077
  }
965
- }, _callee16);
1078
+ }, _callee17);
966
1079
  })));
967
- it('scheduleCallKeepaliveInterval clears existing interval before creating new one', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
1080
+ it('scheduleCallKeepaliveInterval clears existing interval before creating new one', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
968
1081
  var firstTimer, secondTimer;
969
- return _regenerator.default.wrap(function (_context17) {
970
- while (1) switch (_context17.prev = _context17.next) {
1082
+ return _regenerator.default.wrap(function (_context18) {
1083
+ while (1) switch (_context18.prev = _context18.next) {
971
1084
  case 0:
972
1085
  jest.spyOn(global, 'setInterval');
973
1086
  jest.spyOn(global, 'clearInterval');
@@ -995,14 +1108,14 @@ describe('State Machine handler tests', function () {
995
1108
  expect(secondTimer).toBeDefined();
996
1109
  case 1:
997
1110
  case "end":
998
- return _context17.stop();
1111
+ return _context18.stop();
999
1112
  }
1000
- }, _callee17);
1113
+ }, _callee18);
1001
1114
  })));
1002
- it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
1115
+ it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1003
1116
  var errorPayload, warnSpy, postStatusSpy;
1004
- return _regenerator.default.wrap(function (_context18) {
1005
- while (1) switch (_context18.prev = _context18.next) {
1117
+ return _regenerator.default.wrap(function (_context19) {
1118
+ while (1) switch (_context19.prev = _context19.next) {
1006
1119
  case 0:
1007
1120
  errorPayload = {
1008
1121
  statusCode: 500,
@@ -1021,25 +1134,25 @@ describe('State Machine handler tests', function () {
1021
1134
 
1022
1135
  // Advance timer to trigger the first failure (uses DEFAULT_SESSION_TIMER)
1023
1136
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
1024
- _context18.next = 1;
1137
+ _context19.next = 1;
1025
1138
  return (0, _testUtil.flushPromises)(2);
1026
1139
  case 1:
1027
1140
  // Now advance by 1 second for each of the 4 retry attempts (retry-after: 1 second each)
1028
1141
  // Need to do this separately to allow state machine to process and create new intervals
1029
1142
  jest.advanceTimersByTime(1000);
1030
- _context18.next = 2;
1143
+ _context19.next = 2;
1031
1144
  return (0, _testUtil.flushPromises)(2);
1032
1145
  case 2:
1033
1146
  jest.advanceTimersByTime(1000);
1034
- _context18.next = 3;
1147
+ _context19.next = 3;
1035
1148
  return (0, _testUtil.flushPromises)(2);
1036
1149
  case 3:
1037
1150
  jest.advanceTimersByTime(1000);
1038
- _context18.next = 4;
1151
+ _context19.next = 4;
1039
1152
  return (0, _testUtil.flushPromises)(2);
1040
1153
  case 4:
1041
1154
  jest.advanceTimersByTime(1000);
1042
- _context18.next = 5;
1155
+ _context19.next = 5;
1043
1156
  return (0, _testUtil.flushPromises)(2);
1044
1157
  case 5:
1045
1158
  // The error handler should detect we're at max retry count and stop
@@ -1051,14 +1164,14 @@ describe('State Machine handler tests', function () {
1051
1164
  expect(call['callKeepaliveRetryCount']).toBe(4);
1052
1165
  case 6:
1053
1166
  case "end":
1054
- return _context18.stop();
1167
+ return _context19.stop();
1055
1168
  }
1056
- }, _callee18);
1169
+ }, _callee19);
1057
1170
  })));
1058
- it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1171
+ it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1059
1172
  var statusPayload, dummyEvent, postMediaSpy, deleteSpy, dummyOkEvent;
1060
- return _regenerator.default.wrap(function (_context19) {
1061
- while (1) switch (_context19.prev = _context19.next) {
1173
+ return _regenerator.default.wrap(function (_context20) {
1174
+ while (1) switch (_context20.prev = _context20.next) {
1062
1175
  case 0:
1063
1176
  statusPayload = {
1064
1177
  statusCode: 200,
@@ -1114,14 +1227,14 @@ describe('State Machine handler tests', function () {
1114
1227
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1115
1228
  case 1:
1116
1229
  case "end":
1117
- return _context19.stop();
1230
+ return _context20.stop();
1118
1231
  }
1119
- }, _callee19);
1232
+ }, _callee20);
1120
1233
  })));
1121
- it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1234
+ it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1122
1235
  var statusPayload, dummyEvent;
1123
- return _regenerator.default.wrap(function (_context20) {
1124
- while (1) switch (_context20.prev = _context20.next) {
1236
+ return _regenerator.default.wrap(function (_context21) {
1237
+ while (1) switch (_context21.prev = _context21.next) {
1125
1238
  case 0:
1126
1239
  call['direction'] = _types3.CallDirection.INBOUND;
1127
1240
  statusPayload = {
@@ -1139,7 +1252,7 @@ describe('State Machine handler tests', function () {
1139
1252
  webex.request.mockReturnValue(statusPayload);
1140
1253
  call.sendCallStateMachineEvt(dummyEvent);
1141
1254
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
1142
- _context20.next = 1;
1255
+ _context21.next = 1;
1143
1256
  return call['handleOutgoingCallConnect']({
1144
1257
  type: 'E_SEND_CALL_CONNECT'
1145
1258
  });
@@ -1153,14 +1266,14 @@ describe('State Machine handler tests', function () {
1153
1266
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1154
1267
  case 2:
1155
1268
  case "end":
1156
- return _context20.stop();
1269
+ return _context21.stop();
1157
1270
  }
1158
- }, _callee20);
1271
+ }, _callee21);
1159
1272
  })));
1160
- it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1273
+ it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1161
1274
  var callManager, statusPayload, call, dummyEvent, dummyOkEvent, emitSpy, startCallerIdSpy, mobiusProgressEvent;
1162
- return _regenerator.default.wrap(function (_context21) {
1163
- while (1) switch (_context21.prev = _context21.next) {
1275
+ return _regenerator.default.wrap(function (_context22) {
1276
+ while (1) switch (_context22.prev = _context22.next) {
1164
1277
  case 0:
1165
1278
  callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
1166
1279
  statusPayload = {
@@ -1254,14 +1367,14 @@ describe('State Machine handler tests', function () {
1254
1367
  expect(call.earlyMedia).not.toBe(true);
1255
1368
  case 1:
1256
1369
  case "end":
1257
- return _context21.stop();
1370
+ return _context22.stop();
1258
1371
  }
1259
- }, _callee21);
1372
+ }, _callee22);
1260
1373
  })));
1261
- it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1374
+ it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1262
1375
  var warnSpy, errorSpy, stateMachineSpy, statusPayload, roapMessage;
1263
- return _regenerator.default.wrap(function (_context22) {
1264
- while (1) switch (_context22.prev = _context22.next) {
1376
+ return _regenerator.default.wrap(function (_context23) {
1377
+ while (1) switch (_context23.prev = _context23.next) {
1265
1378
  case 0:
1266
1379
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1267
1380
  errorSpy = jest.spyOn(_Logger.default, 'error');
@@ -1288,7 +1401,7 @@ describe('State Machine handler tests', function () {
1288
1401
  webex.request.mockRejectedValueOnce({
1289
1402
  statusCode: 403
1290
1403
  }).mockResolvedValue(statusPayload);
1291
- _context22.next = 1;
1404
+ _context23.next = 1;
1292
1405
  return call['handleOutgoingCallConnect']({
1293
1406
  type: 'E_SEND_CALL_CONNECT'
1294
1407
  });
@@ -1299,14 +1412,14 @@ describe('State Machine handler tests', function () {
1299
1412
  expect(errorSpy).toBeCalledTimes(1);
1300
1413
  case 2:
1301
1414
  case "end":
1302
- return _context22.stop();
1415
+ return _context23.stop();
1303
1416
  }
1304
- }, _callee22);
1417
+ }, _callee23);
1305
1418
  })));
1306
- it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1419
+ it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
1307
1420
  var statusPayload, dummyEvent, postMediaSpy, logSpy, dummyOkEvent;
1308
- return _regenerator.default.wrap(function (_context23) {
1309
- while (1) switch (_context23.prev = _context23.next) {
1421
+ return _regenerator.default.wrap(function (_context24) {
1422
+ while (1) switch (_context24.prev = _context24.next) {
1310
1423
  case 0:
1311
1424
  statusPayload = {
1312
1425
  statusCode: 200,
@@ -1382,14 +1495,14 @@ describe('State Machine handler tests', function () {
1382
1495
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1383
1496
  case 1:
1384
1497
  case "end":
1385
- return _context23.stop();
1498
+ return _context24.stop();
1386
1499
  }
1387
- }, _callee23);
1500
+ }, _callee24);
1388
1501
  })));
1389
- 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() {
1502
+ 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 _callee25() {
1390
1503
  var statusPayload, dummySetupEvent, dummyConnectEvent, dummyOfferEvent, dummyAnswerEvent, dummyOkEvent, postMediaSpy;
1391
- return _regenerator.default.wrap(function (_context24) {
1392
- while (1) switch (_context24.prev = _context24.next) {
1504
+ return _regenerator.default.wrap(function (_context25) {
1505
+ while (1) switch (_context25.prev = _context25.next) {
1393
1506
  case 0:
1394
1507
  statusPayload = {
1395
1508
  statusCode: 200,
@@ -1457,14 +1570,14 @@ describe('State Machine handler tests', function () {
1457
1570
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1458
1571
  case 1:
1459
1572
  case "end":
1460
- return _context24.stop();
1573
+ return _context25.stop();
1461
1574
  }
1462
- }, _callee24);
1575
+ }, _callee25);
1463
1576
  })));
1464
- it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
1577
+ it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1465
1578
  var statusPayload, dummyEvent;
1466
- return _regenerator.default.wrap(function (_context25) {
1467
- while (1) switch (_context25.prev = _context25.next) {
1579
+ return _regenerator.default.wrap(function (_context26) {
1580
+ while (1) switch (_context26.prev = _context26.next) {
1468
1581
  case 0:
1469
1582
  statusPayload = {
1470
1583
  statusCode: 200,
@@ -1503,14 +1616,14 @@ describe('State Machine handler tests', function () {
1503
1616
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1504
1617
  case 1:
1505
1618
  case "end":
1506
- return _context25.stop();
1619
+ return _context26.stop();
1507
1620
  }
1508
- }, _callee25);
1621
+ }, _callee26);
1509
1622
  })));
1510
- it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1623
+ it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1511
1624
  var statusPayload, dummyEvent, errorSpy;
1512
- return _regenerator.default.wrap(function (_context26) {
1513
- while (1) switch (_context26.prev = _context26.next) {
1625
+ return _regenerator.default.wrap(function (_context27) {
1626
+ while (1) switch (_context27.prev = _context27.next) {
1514
1627
  case 0:
1515
1628
  statusPayload = {
1516
1629
  statusCode: 403,
@@ -1527,25 +1640,31 @@ describe('State Machine handler tests', function () {
1527
1640
  webex.request.mockRejectedValueOnce(statusPayload);
1528
1641
  errorSpy = jest.spyOn(_Logger.default, 'error');
1529
1642
  call.sendCallStateMachineEvt(dummyEvent);
1530
- _context26.next = 1;
1643
+ _context27.next = 1;
1531
1644
  return (0, _testUtil.flushPromises)(3);
1532
1645
  case 1:
1646
+ _context27.next = 2;
1647
+ return _promise.default.resolve();
1648
+ case 2:
1649
+ _context27.next = 3;
1650
+ return _promise.default.resolve();
1651
+ case 3:
1533
1652
  expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
1534
1653
  expect(errorSpy).toHaveBeenCalled();
1535
1654
  expect(uploadLogsSpy).toHaveBeenCalledWith({
1536
1655
  correlationId: call.getCorrelationId(),
1537
1656
  callId: call.getCallId()
1538
1657
  });
1539
- case 2:
1658
+ case 4:
1540
1659
  case "end":
1541
- return _context26.stop();
1660
+ return _context27.stop();
1542
1661
  }
1543
- }, _callee26);
1662
+ }, _callee27);
1544
1663
  })));
1545
- it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1664
+ it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
1546
1665
  var statusPayload, dummyEvent, warnSpy;
1547
- return _regenerator.default.wrap(function (_context27) {
1548
- while (1) switch (_context27.prev = _context27.next) {
1666
+ return _regenerator.default.wrap(function (_context28) {
1667
+ while (1) switch (_context28.prev = _context28.next) {
1549
1668
  case 0:
1550
1669
  statusPayload = {
1551
1670
  statusCode: 403,
@@ -1564,12 +1683,18 @@ describe('State Machine handler tests', function () {
1564
1683
  webex.request.mockRejectedValue(statusPayload);
1565
1684
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1566
1685
  jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
1567
- _context27.next = 1;
1686
+ _context28.next = 1;
1568
1687
  return call['handleRoapEstablished']({}, dummyEvent);
1569
1688
  case 1:
1570
- _context27.next = 2;
1689
+ _context28.next = 2;
1571
1690
  return (0, _testUtil.flushPromises)(2);
1572
1691
  case 2:
1692
+ _context28.next = 3;
1693
+ return _promise.default.resolve();
1694
+ case 3:
1695
+ _context28.next = 4;
1696
+ return _promise.default.resolve();
1697
+ case 4:
1573
1698
  expect(call.isConnected()).toBe(false);
1574
1699
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1575
1700
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
@@ -1581,16 +1706,16 @@ describe('State Machine handler tests', function () {
1581
1706
  file: 'call',
1582
1707
  method: 'handleRoapError'
1583
1708
  });
1584
- case 3:
1709
+ case 5:
1585
1710
  case "end":
1586
- return _context27.stop();
1711
+ return _context28.stop();
1587
1712
  }
1588
- }, _callee27);
1713
+ }, _callee28);
1589
1714
  })));
1590
- it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
1715
+ it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
1591
1716
  var statusPayload, dummyEvent;
1592
- return _regenerator.default.wrap(function (_context28) {
1593
- while (1) switch (_context28.prev = _context28.next) {
1717
+ return _regenerator.default.wrap(function (_context29) {
1718
+ while (1) switch (_context29.prev = _context29.next) {
1594
1719
  case 0:
1595
1720
  statusPayload = {
1596
1721
  statusCode: 403,
@@ -1613,14 +1738,14 @@ describe('State Machine handler tests', function () {
1613
1738
  expect(_testUtil.mediaConnection.initiateOffer).toBeCalledOnceWith();
1614
1739
  case 1:
1615
1740
  case "end":
1616
- return _context28.stop();
1741
+ return _context29.stop();
1617
1742
  }
1618
- }, _callee28);
1743
+ }, _callee29);
1619
1744
  })));
1620
- it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
1745
+ it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
1621
1746
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1622
- return _regenerator.default.wrap(function (_context29) {
1623
- while (1) switch (_context29.prev = _context29.next) {
1747
+ return _regenerator.default.wrap(function (_context30) {
1748
+ while (1) switch (_context30.prev = _context30.next) {
1624
1749
  case 0:
1625
1750
  statusPayload = {
1626
1751
  statusCode: 503,
@@ -1642,7 +1767,7 @@ describe('State Machine handler tests', function () {
1642
1767
  }
1643
1768
  };
1644
1769
  call['connected'] = true;
1645
- _context29.next = 1;
1770
+ _context30.next = 1;
1646
1771
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1647
1772
  case 1:
1648
1773
  jest.advanceTimersByTime(1005);
@@ -1654,14 +1779,14 @@ describe('State Machine handler tests', function () {
1654
1779
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1655
1780
  case 2:
1656
1781
  case "end":
1657
- return _context29.stop();
1782
+ return _context30.stop();
1658
1783
  }
1659
- }, _callee29);
1784
+ }, _callee30);
1660
1785
  })));
1661
- it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
1786
+ it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1662
1787
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1663
- return _regenerator.default.wrap(function (_context30) {
1664
- while (1) switch (_context30.prev = _context30.next) {
1788
+ return _regenerator.default.wrap(function (_context31) {
1789
+ while (1) switch (_context31.prev = _context31.next) {
1665
1790
  case 0:
1666
1791
  statusPayload = {
1667
1792
  statusCode: 503,
@@ -1683,7 +1808,7 @@ describe('State Machine handler tests', function () {
1683
1808
  }
1684
1809
  };
1685
1810
  call['connected'] = false;
1686
- _context30.next = 1;
1811
+ _context31.next = 1;
1687
1812
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1688
1813
  case 1:
1689
1814
  jest.advanceTimersByTime(1005);
@@ -1694,14 +1819,14 @@ describe('State Machine handler tests', function () {
1694
1819
  expect(stateMachineSpy).not.toBeCalled();
1695
1820
  case 2:
1696
1821
  case "end":
1697
- return _context30.stop();
1822
+ return _context31.stop();
1698
1823
  }
1699
- }, _callee30);
1824
+ }, _callee31);
1700
1825
  })));
1701
- it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1826
+ it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1702
1827
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1703
- return _regenerator.default.wrap(function (_context31) {
1704
- while (1) switch (_context31.prev = _context31.next) {
1828
+ return _regenerator.default.wrap(function (_context32) {
1829
+ while (1) switch (_context32.prev = _context32.next) {
1705
1830
  case 0:
1706
1831
  statusPayload = {
1707
1832
  statusCode: 503,
@@ -1723,7 +1848,7 @@ describe('State Machine handler tests', function () {
1723
1848
  };
1724
1849
  call['connected'] = true;
1725
1850
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_OFFER';
1726
- _context31.next = 1;
1851
+ _context32.next = 1;
1727
1852
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1728
1853
  case 1:
1729
1854
  jest.advanceTimersByTime(1005);
@@ -1735,14 +1860,14 @@ describe('State Machine handler tests', function () {
1735
1860
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1736
1861
  case 2:
1737
1862
  case "end":
1738
- return _context31.stop();
1863
+ return _context32.stop();
1739
1864
  }
1740
- }, _callee31);
1865
+ }, _callee32);
1741
1866
  })));
1742
- it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1867
+ it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
1743
1868
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1744
- return _regenerator.default.wrap(function (_context32) {
1745
- while (1) switch (_context32.prev = _context32.next) {
1869
+ return _regenerator.default.wrap(function (_context33) {
1870
+ while (1) switch (_context33.prev = _context33.next) {
1746
1871
  case 0:
1747
1872
  statusPayload = {
1748
1873
  statusCode: 503,
@@ -1763,7 +1888,7 @@ describe('State Machine handler tests', function () {
1763
1888
  }
1764
1889
  };
1765
1890
  call['connected'] = false;
1766
- _context32.next = 1;
1891
+ _context33.next = 1;
1767
1892
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1768
1893
  case 1:
1769
1894
  jest.advanceTimersByTime(1005);
@@ -1775,14 +1900,14 @@ describe('State Machine handler tests', function () {
1775
1900
  expect(stateMachineSpy).not.toBeCalled();
1776
1901
  case 2:
1777
1902
  case "end":
1778
- return _context32.stop();
1903
+ return _context33.stop();
1779
1904
  }
1780
- }, _callee32);
1905
+ }, _callee33);
1781
1906
  })));
1782
- it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
1907
+ it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
1783
1908
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1784
- return _regenerator.default.wrap(function (_context33) {
1785
- while (1) switch (_context33.prev = _context33.next) {
1909
+ return _regenerator.default.wrap(function (_context34) {
1910
+ while (1) switch (_context34.prev = _context34.next) {
1786
1911
  case 0:
1787
1912
  statusPayload = {
1788
1913
  statusCode: 200,
@@ -1807,14 +1932,14 @@ describe('State Machine handler tests', function () {
1807
1932
  expect(stateMachineSpy).not.toHaveBeenCalled();
1808
1933
  case 1:
1809
1934
  case "end":
1810
- return _context33.stop();
1935
+ return _context34.stop();
1811
1936
  }
1812
- }, _callee33);
1937
+ }, _callee34);
1813
1938
  })));
1814
- it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
1939
+ it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
1815
1940
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1816
- return _regenerator.default.wrap(function (_context34) {
1817
- while (1) switch (_context34.prev = _context34.next) {
1941
+ return _regenerator.default.wrap(function (_context35) {
1942
+ while (1) switch (_context35.prev = _context35.next) {
1818
1943
  case 0:
1819
1944
  statusPayload = {
1820
1945
  statusCode: 503,
@@ -1836,7 +1961,7 @@ describe('State Machine handler tests', function () {
1836
1961
  };
1837
1962
  call['connected'] = true;
1838
1963
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
1839
- _context34.next = 1;
1964
+ _context35.next = 1;
1840
1965
  return call['handleRoapEstablished']({}, dummyEvent);
1841
1966
  case 1:
1842
1967
  jest.advanceTimersByTime(1005);
@@ -1848,14 +1973,14 @@ describe('State Machine handler tests', function () {
1848
1973
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1849
1974
  case 2:
1850
1975
  case "end":
1851
- return _context34.stop();
1976
+ return _context35.stop();
1852
1977
  }
1853
- }, _callee34);
1978
+ }, _callee35);
1854
1979
  })));
1855
- it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
1980
+ it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
1856
1981
  var statusPayload, stateMachineSpy, funcSpy, errorEvent;
1857
- return _regenerator.default.wrap(function (_context35) {
1858
- while (1) switch (_context35.prev = _context35.next) {
1982
+ return _regenerator.default.wrap(function (_context36) {
1983
+ while (1) switch (_context36.prev = _context36.next) {
1859
1984
  case 0:
1860
1985
  statusPayload = {
1861
1986
  statusCode: 403,
@@ -1878,14 +2003,14 @@ describe('State Machine handler tests', function () {
1878
2003
  expect(stateMachineSpy).not.toHaveBeenCalled();
1879
2004
  case 1:
1880
2005
  case "end":
1881
- return _context35.stop();
2006
+ return _context36.stop();
1882
2007
  }
1883
- }, _callee35);
2008
+ }, _callee36);
1884
2009
  })));
1885
- it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
2010
+ it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
1886
2011
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1887
- return _regenerator.default.wrap(function (_context36) {
1888
- while (1) switch (_context36.prev = _context36.next) {
2012
+ return _regenerator.default.wrap(function (_context37) {
2013
+ while (1) switch (_context37.prev = _context37.next) {
1889
2014
  case 0:
1890
2015
  statusPayload = {
1891
2016
  statusCode: 200,
@@ -1903,7 +2028,7 @@ describe('State Machine handler tests', function () {
1903
2028
  }
1904
2029
  };
1905
2030
  call['connected'] = false;
1906
- _context36.next = 1;
2031
+ _context37.next = 1;
1907
2032
  return call['handleRoapError']({}, errorEvent);
1908
2033
  case 1:
1909
2034
  expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
@@ -1919,14 +2044,14 @@ describe('State Machine handler tests', function () {
1919
2044
  });
1920
2045
  case 2:
1921
2046
  case "end":
1922
- return _context36.stop();
2047
+ return _context37.stop();
1923
2048
  }
1924
- }, _callee36);
2049
+ }, _callee37);
1925
2050
  })));
1926
- it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
2051
+ it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
1927
2052
  var statusPayload, warnSpy, postMediaSpy, setupEvent, connectEvent, offerEvent, answerEvent;
1928
- return _regenerator.default.wrap(function (_context37) {
1929
- while (1) switch (_context37.prev = _context37.next) {
2053
+ return _regenerator.default.wrap(function (_context38) {
2054
+ while (1) switch (_context38.prev = _context38.next) {
1930
2055
  case 0:
1931
2056
  statusPayload = {
1932
2057
  statusCode: 403,
@@ -1964,12 +2089,18 @@ describe('State Machine handler tests', function () {
1964
2089
  messageType: 'ANSWER'
1965
2090
  }
1966
2091
  };
1967
- _context37.next = 1;
2092
+ _context38.next = 1;
1968
2093
  return call.sendMediaStateMachineEvt(answerEvent);
1969
2094
  case 1:
1970
- _context37.next = 2;
2095
+ _context38.next = 2;
1971
2096
  return (0, _testUtil.flushPromises)(2);
1972
2097
  case 2:
2098
+ _context38.next = 3;
2099
+ return _promise.default.resolve();
2100
+ case 3:
2101
+ _context38.next = 4;
2102
+ return _promise.default.resolve();
2103
+ case 4:
1973
2104
  expect(postMediaSpy).toBeCalledOnceWith(answerEvent.data);
1974
2105
  expect(warnSpy).toHaveBeenCalledWith('Failed to send MediaAnswer request', {
1975
2106
  file: 'call',
@@ -1983,16 +2114,16 @@ describe('State Machine handler tests', function () {
1983
2114
  // Final state should be torn down and cleared for unconnected call
1984
2115
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1985
2116
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
1986
- case 3:
2117
+ case 5:
1987
2118
  case "end":
1988
- return _context37.stop();
2119
+ return _context38.stop();
1989
2120
  }
1990
- }, _callee37);
2121
+ }, _callee38);
1991
2122
  })));
1992
- it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
2123
+ it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
1993
2124
  var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
1994
- return _regenerator.default.wrap(function (_context38) {
1995
- while (1) switch (_context38.prev = _context38.next) {
2125
+ return _regenerator.default.wrap(function (_context39) {
2126
+ while (1) switch (_context39.prev = _context39.next) {
1996
2127
  case 0:
1997
2128
  statusPayload = {
1998
2129
  statusCode: 200,
@@ -2025,7 +2156,7 @@ describe('State Machine handler tests', function () {
2025
2156
  seq: 1,
2026
2157
  messageType: 'ANSWER'
2027
2158
  };
2028
- _context38.next = 1;
2159
+ _context39.next = 1;
2029
2160
  return call.sendMediaStateMachineEvt(dummyEvent);
2030
2161
  case 1:
2031
2162
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -2047,7 +2178,7 @@ describe('State Machine handler tests', function () {
2047
2178
  seq: 2,
2048
2179
  messageType: 'OFFER_REQUEST'
2049
2180
  };
2050
- _context38.next = 2;
2181
+ _context39.next = 2;
2051
2182
  return call.sendMediaStateMachineEvt(dummyEvent);
2052
2183
  case 2:
2053
2184
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -2097,7 +2228,7 @@ describe('State Machine handler tests', function () {
2097
2228
  };
2098
2229
  call.sendCallStateMachineEvt(dummyEvent);
2099
2230
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2100
- _context38.next = 3;
2231
+ _context39.next = 3;
2101
2232
  return call.sendMediaStateMachineEvt(dummyEvent);
2102
2233
  case 3:
2103
2234
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2106,7 +2237,7 @@ describe('State Machine handler tests', function () {
2106
2237
  seq: 3,
2107
2238
  messageType: 'ANSWER'
2108
2239
  };
2109
- _context38.next = 4;
2240
+ _context39.next = 4;
2110
2241
  return call.sendMediaStateMachineEvt(dummyEvent);
2111
2242
  case 4:
2112
2243
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2125,7 +2256,7 @@ describe('State Machine handler tests', function () {
2125
2256
  messageType: 'OK'
2126
2257
  }
2127
2258
  };
2128
- _context38.next = 5;
2259
+ _context39.next = 5;
2129
2260
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2130
2261
  case 5:
2131
2262
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
@@ -2140,14 +2271,14 @@ describe('State Machine handler tests', function () {
2140
2271
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2141
2272
  case 6:
2142
2273
  case "end":
2143
- return _context38.stop();
2274
+ return _context39.stop();
2144
2275
  }
2145
- }, _callee38);
2276
+ }, _callee39);
2146
2277
  })));
2147
- 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() {
2278
+ it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
2148
2279
  var mockStatusBody, statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
2149
- return _regenerator.default.wrap(function (_context39) {
2150
- while (1) switch (_context39.prev = _context39.next) {
2280
+ return _regenerator.default.wrap(function (_context40) {
2281
+ while (1) switch (_context40.prev = _context40.next) {
2151
2282
  case 0:
2152
2283
  mockStatusBody = {
2153
2284
  device: {
@@ -2187,7 +2318,7 @@ describe('State Machine handler tests', function () {
2187
2318
  seq: 1,
2188
2319
  messageType: 'ANSWER'
2189
2320
  };
2190
- _context39.next = 1;
2321
+ _context40.next = 1;
2191
2322
  return call.sendMediaStateMachineEvt(dummyEvent);
2192
2323
  case 1:
2193
2324
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -2209,7 +2340,7 @@ describe('State Machine handler tests', function () {
2209
2340
  seq: 2,
2210
2341
  messageType: 'OFFER_REQUEST'
2211
2342
  };
2212
- _context39.next = 2;
2343
+ _context40.next = 2;
2213
2344
  return call.sendMediaStateMachineEvt(dummyEvent);
2214
2345
  case 2:
2215
2346
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -2259,7 +2390,7 @@ describe('State Machine handler tests', function () {
2259
2390
  };
2260
2391
  call.sendCallStateMachineEvt(dummyEvent);
2261
2392
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2262
- _context39.next = 3;
2393
+ _context40.next = 3;
2263
2394
  return call.sendMediaStateMachineEvt(dummyEvent);
2264
2395
  case 3:
2265
2396
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2268,7 +2399,7 @@ describe('State Machine handler tests', function () {
2268
2399
  seq: 3,
2269
2400
  messageType: 'ANSWER'
2270
2401
  };
2271
- _context39.next = 4;
2402
+ _context40.next = 4;
2272
2403
  return call.sendMediaStateMachineEvt(dummyEvent);
2273
2404
  case 4:
2274
2405
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2285,7 +2416,7 @@ describe('State Machine handler tests', function () {
2285
2416
  }
2286
2417
  };
2287
2418
  call.sendMediaStateMachineEvt(dummyEvent);
2288
- _context39.next = 5;
2419
+ _context40.next = 5;
2289
2420
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2290
2421
  case 5:
2291
2422
  expect(call['receivedRoapOKSeq']).toBe(3);
@@ -2301,14 +2432,14 @@ describe('State Machine handler tests', function () {
2301
2432
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2302
2433
  case 6:
2303
2434
  case "end":
2304
- return _context39.stop();
2435
+ return _context40.stop();
2305
2436
  }
2306
- }, _callee39);
2437
+ }, _callee40);
2307
2438
  })));
2308
- it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
2439
+ it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2309
2440
  var statusPayload, dummyEvent, postMediaSpy, infoSpy, dummyOkEvent;
2310
- return _regenerator.default.wrap(function (_context40) {
2311
- while (1) switch (_context40.prev = _context40.next) {
2441
+ return _regenerator.default.wrap(function (_context41) {
2442
+ while (1) switch (_context41.prev = _context41.next) {
2312
2443
  case 0:
2313
2444
  statusPayload = {
2314
2445
  statusCode: 200,
@@ -2369,20 +2500,20 @@ describe('State Machine handler tests', function () {
2369
2500
  dummyEvent.data = undefined;
2370
2501
  call.sendCallStateMachineEvt(dummyEvent);
2371
2502
  expect(call['callStateMachine'].state.value).toBe('S_CALL_HOLD');
2372
- expect(infoSpy).toHaveBeenLastCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
2503
+ expect(infoSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
2373
2504
  file: 'call',
2374
2505
  method: 'handleCallHold'
2375
2506
  });
2376
2507
  case 1:
2377
2508
  case "end":
2378
- return _context40.stop();
2509
+ return _context41.stop();
2379
2510
  }
2380
- }, _callee40);
2511
+ }, _callee41);
2381
2512
  })));
2382
- it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2513
+ it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
2383
2514
  var emitSpy, deleteSpy;
2384
- return _regenerator.default.wrap(function (_context41) {
2385
- while (1) switch (_context41.prev = _context41.next) {
2515
+ return _regenerator.default.wrap(function (_context42) {
2516
+ while (1) switch (_context42.prev = _context42.next) {
2386
2517
  case 0:
2387
2518
  emitSpy = jest.spyOn(call, 'emit');
2388
2519
  deleteSpy = jest.spyOn(call, 'delete').mockResolvedValue({
@@ -2391,7 +2522,7 @@ describe('State Machine handler tests', function () {
2391
2522
  call.sendCallStateMachineEvt({
2392
2523
  type: 'E_RECV_CALL_DISCONNECT'
2393
2524
  });
2394
- _context41.next = 1;
2525
+ _context42.next = 1;
2395
2526
  return (0, _testUtil.flushPromises)(1);
2396
2527
  case 1:
2397
2528
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
@@ -2399,9 +2530,9 @@ describe('State Machine handler tests', function () {
2399
2530
  expect(emitSpy.mock.invocationCallOrder[0]).toBeLessThan(deleteSpy.mock.invocationCallOrder[0]);
2400
2531
  case 2:
2401
2532
  case "end":
2402
- return _context41.stop();
2533
+ return _context42.stop();
2403
2534
  }
2404
- }, _callee41);
2535
+ }, _callee42);
2405
2536
  })));
2406
2537
  describe('Call event timers tests', function () {
2407
2538
  var callManager;
@@ -2412,10 +2543,10 @@ describe('State Machine handler tests', function () {
2412
2543
  afterEach(function () {
2413
2544
  jest.clearAllTimers();
2414
2545
  });
2415
- it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
2546
+ it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
2416
2547
  var statusPayload, dummyEvent, logSpy, emitSpy, deleteSpy, dummyOkEvent;
2417
- return _regenerator.default.wrap(function (_context42) {
2418
- while (1) switch (_context42.prev = _context42.next) {
2548
+ return _regenerator.default.wrap(function (_context43) {
2549
+ while (1) switch (_context43.prev = _context43.next) {
2419
2550
  case 0:
2420
2551
  statusPayload = {
2421
2552
  statusCode: 200,
@@ -2432,7 +2563,7 @@ describe('State Machine handler tests', function () {
2432
2563
  webex.request.mockReturnValue(statusPayload);
2433
2564
 
2434
2565
  // handleOutgoingCallSetup is asynchronous
2435
- _context42.next = 1;
2566
+ _context43.next = 1;
2436
2567
  return call.sendCallStateMachineEvt(dummyEvent);
2437
2568
  case 1:
2438
2569
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
@@ -2475,14 +2606,14 @@ describe('State Machine handler tests', function () {
2475
2606
  expect(callManager.callCollection).toStrictEqual({});
2476
2607
  case 2:
2477
2608
  case "end":
2478
- return _context42.stop();
2609
+ return _context43.stop();
2479
2610
  }
2480
- }, _callee42);
2611
+ }, _callee43);
2481
2612
  })));
2482
- it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
2613
+ it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
2483
2614
  var statusPayload, dummyEvent, call, emitSpy, deleteSpy, logSpy;
2484
- return _regenerator.default.wrap(function (_context43) {
2485
- while (1) switch (_context43.prev = _context43.next) {
2615
+ return _regenerator.default.wrap(function (_context44) {
2616
+ while (1) switch (_context44.prev = _context44.next) {
2486
2617
  case 0:
2487
2618
  statusPayload = {
2488
2619
  statusCode: 200,
@@ -2501,7 +2632,7 @@ describe('State Machine handler tests', function () {
2501
2632
  expect((0, _keys.default)(callManager.callCollection)[0]).toBe(call.getCorrelationId());
2502
2633
 
2503
2634
  // handleOutgoingCallSetup is asynchronous
2504
- _context43.next = 1;
2635
+ _context44.next = 1;
2505
2636
  return call.sendCallStateMachineEvt(dummyEvent);
2506
2637
  case 1:
2507
2638
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
@@ -2513,9 +2644,9 @@ describe('State Machine handler tests', function () {
2513
2644
  expect(callManager.callCollection).toStrictEqual({});
2514
2645
  case 2:
2515
2646
  case "end":
2516
- return _context43.stop();
2647
+ return _context44.stop();
2517
2648
  }
2518
- }, _callee43);
2649
+ }, _callee44);
2519
2650
  })));
2520
2651
  });
2521
2652
  });
@@ -2534,6 +2665,11 @@ describe('Supplementary Services tests', function () {
2534
2665
  };
2535
2666
  var call;
2536
2667
  beforeEach(function () {
2668
+ _request.APIRequest.resetInstance();
2669
+ _request.APIRequest.getInstance({
2670
+ webex: webex,
2671
+ isMobiusSocketEnabled: false
2672
+ });
2537
2673
  /* Since we are not actually testing from the start of a call , so it's good to set the below
2538
2674
  * parameters manually
2539
2675
  */
@@ -2575,10 +2711,10 @@ describe('Supplementary Services tests', function () {
2575
2711
  beforeEach(function () {
2576
2712
  call.removeAllListeners();
2577
2713
  });
2578
- it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
2714
+ it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
2579
2715
  var responsePayload, warnSpy, roapEvent;
2580
- return _regenerator.default.wrap(function (_context45) {
2581
- while (1) switch (_context45.prev = _context45.next) {
2716
+ return _regenerator.default.wrap(function (_context46) {
2717
+ while (1) switch (_context46.prev = _context46.next) {
2582
2718
  case 0:
2583
2719
  expect.assertions(7);
2584
2720
  responsePayload = {
@@ -2591,25 +2727,25 @@ describe('Supplementary Services tests', function () {
2591
2727
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2592
2728
  call['held'] = false;
2593
2729
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2594
- var _ref45 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44(correlationId) {
2595
- return _regenerator.default.wrap(function (_context44) {
2596
- while (1) switch (_context44.prev = _context44.next) {
2730
+ var _ref48 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45(correlationId) {
2731
+ return _regenerator.default.wrap(function (_context45) {
2732
+ while (1) switch (_context45.prev = _context45.next) {
2597
2733
  case 0:
2598
2734
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2599
2735
  case 1:
2600
2736
  case "end":
2601
- return _context44.stop();
2737
+ return _context45.stop();
2602
2738
  }
2603
- }, _callee44);
2739
+ }, _callee45);
2604
2740
  }));
2605
2741
  return function (_x) {
2606
- return _ref45.apply(this, arguments);
2742
+ return _ref48.apply(this, arguments);
2607
2743
  };
2608
2744
  }());
2609
- _context45.next = 1;
2745
+ _context46.next = 1;
2610
2746
  return call.doHoldResume();
2611
2747
  case 1:
2612
- _context45.next = 2;
2748
+ _context46.next = 2;
2613
2749
  return (0, _testUtil.flushPromises)(2);
2614
2750
  case 2:
2615
2751
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2625,11 +2761,11 @@ describe('Supplementary Services tests', function () {
2625
2761
  call['handleIncomingRoapOffer']({}, dummyEvent);
2626
2762
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2627
2763
  roapEvent.data.type = 'ANSWER';
2628
- _context45.next = 3;
2764
+ _context46.next = 3;
2629
2765
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2630
2766
  case 3:
2631
2767
  roapEvent.data.type = 'OK';
2632
- _context45.next = 4;
2768
+ _context46.next = 4;
2633
2769
  return call['handleRoapEstablished']({}, dummyEvent);
2634
2770
  case 4:
2635
2771
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -2644,14 +2780,14 @@ describe('Supplementary Services tests', function () {
2644
2780
  });
2645
2781
  case 5:
2646
2782
  case "end":
2647
- return _context45.stop();
2783
+ return _context46.stop();
2648
2784
  }
2649
- }, _callee45);
2785
+ }, _callee46);
2650
2786
  })));
2651
- it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
2787
+ it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48() {
2652
2788
  var responsePayload, warnSpy, roapEvent;
2653
- return _regenerator.default.wrap(function (_context47) {
2654
- while (1) switch (_context47.prev = _context47.next) {
2789
+ return _regenerator.default.wrap(function (_context48) {
2790
+ while (1) switch (_context48.prev = _context48.next) {
2655
2791
  case 0:
2656
2792
  expect.assertions(8);
2657
2793
  responsePayload = {
@@ -2664,26 +2800,26 @@ describe('Supplementary Services tests', function () {
2664
2800
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2665
2801
  call['held'] = false;
2666
2802
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2667
- var _ref47 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46(correlationId) {
2668
- return _regenerator.default.wrap(function (_context46) {
2669
- while (1) switch (_context46.prev = _context46.next) {
2803
+ var _ref50 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47(correlationId) {
2804
+ return _regenerator.default.wrap(function (_context47) {
2805
+ while (1) switch (_context47.prev = _context47.next) {
2670
2806
  case 0:
2671
2807
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2672
2808
  case 1:
2673
2809
  case "end":
2674
- return _context46.stop();
2810
+ return _context47.stop();
2675
2811
  }
2676
- }, _callee46);
2812
+ }, _callee47);
2677
2813
  }));
2678
2814
  return function (_x2) {
2679
- return _ref47.apply(this, arguments);
2815
+ return _ref50.apply(this, arguments);
2680
2816
  };
2681
2817
  }());
2682
2818
  call.doHoldResume();
2683
- _context47.next = 1;
2819
+ _context48.next = 1;
2684
2820
  return _promise.default.resolve();
2685
2821
  case 1:
2686
- _context47.next = 2;
2822
+ _context48.next = 2;
2687
2823
  return _promise.default.resolve();
2688
2824
  case 2:
2689
2825
  expect(setTimeout).not.toHaveBeenCalled();
@@ -2699,11 +2835,11 @@ describe('Supplementary Services tests', function () {
2699
2835
  call['handleIncomingRoapOffer']({}, dummyEvent);
2700
2836
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2701
2837
  roapEvent.data.type = 'ANSWER';
2702
- _context47.next = 3;
2838
+ _context48.next = 3;
2703
2839
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2704
2840
  case 3:
2705
2841
  roapEvent.data.type = 'OK';
2706
- _context47.next = 4;
2842
+ _context48.next = 4;
2707
2843
  return call['handleRoapEstablished']({}, dummyEvent);
2708
2844
  case 4:
2709
2845
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -2718,14 +2854,14 @@ describe('Supplementary Services tests', function () {
2718
2854
  });
2719
2855
  case 5:
2720
2856
  case "end":
2721
- return _context47.stop();
2857
+ return _context48.stop();
2722
2858
  }
2723
- }, _callee47);
2859
+ }, _callee48);
2724
2860
  })));
2725
- it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
2861
+ it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
2726
2862
  var responsePayload;
2727
- return _regenerator.default.wrap(function (_context49) {
2728
- while (1) switch (_context49.prev = _context49.next) {
2863
+ return _regenerator.default.wrap(function (_context50) {
2864
+ while (1) switch (_context50.prev = _context50.next) {
2729
2865
  case 0:
2730
2866
  expect.assertions(4);
2731
2867
  responsePayload = {
@@ -2735,26 +2871,26 @@ describe('Supplementary Services tests', function () {
2735
2871
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2736
2872
  call['held'] = false;
2737
2873
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2738
- var _ref49 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48(errObj) {
2739
- return _regenerator.default.wrap(function (_context48) {
2740
- while (1) switch (_context48.prev = _context48.next) {
2874
+ var _ref52 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49(errObj) {
2875
+ return _regenerator.default.wrap(function (_context49) {
2876
+ while (1) switch (_context49.prev = _context49.next) {
2741
2877
  case 0:
2742
2878
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2743
2879
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2744
2880
  case 1:
2745
2881
  case "end":
2746
- return _context48.stop();
2882
+ return _context49.stop();
2747
2883
  }
2748
- }, _callee48);
2884
+ }, _callee49);
2749
2885
  }));
2750
2886
  return function (_x3) {
2751
- return _ref49.apply(this, arguments);
2887
+ return _ref52.apply(this, arguments);
2752
2888
  };
2753
2889
  }());
2754
- _context49.next = 1;
2890
+ _context50.next = 1;
2755
2891
  return call.doHoldResume();
2756
2892
  case 1:
2757
- _context49.next = 2;
2893
+ _context50.next = 2;
2758
2894
  return (0, _testUtil.flushPromises)(2);
2759
2895
  case 2:
2760
2896
  expect(call.isHeld()).toStrictEqual(false);
@@ -2764,14 +2900,14 @@ describe('Supplementary Services tests', function () {
2764
2900
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2765
2901
  case 3:
2766
2902
  case "end":
2767
- return _context49.stop();
2903
+ return _context50.stop();
2768
2904
  }
2769
- }, _callee49);
2905
+ }, _callee50);
2770
2906
  })));
2771
- it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
2907
+ it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
2772
2908
  var responsePayload, rejectPayload, roapEvent;
2773
- return _regenerator.default.wrap(function (_context51) {
2774
- while (1) switch (_context51.prev = _context51.next) {
2909
+ return _regenerator.default.wrap(function (_context52) {
2910
+ while (1) switch (_context52.prev = _context52.next) {
2775
2911
  case 0:
2776
2912
  expect.assertions(5);
2777
2913
  responsePayload = {
@@ -2785,24 +2921,24 @@ describe('Supplementary Services tests', function () {
2785
2921
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2786
2922
  call['held'] = false;
2787
2923
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2788
- var _ref51 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50(errObj) {
2789
- return _regenerator.default.wrap(function (_context50) {
2790
- while (1) switch (_context50.prev = _context50.next) {
2924
+ var _ref54 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51(errObj) {
2925
+ return _regenerator.default.wrap(function (_context51) {
2926
+ while (1) switch (_context51.prev = _context51.next) {
2791
2927
  case 0:
2792
2928
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2793
2929
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2794
2930
  case 1:
2795
2931
  case "end":
2796
- return _context50.stop();
2932
+ return _context51.stop();
2797
2933
  }
2798
- }, _callee50);
2934
+ }, _callee51);
2799
2935
  }));
2800
2936
  return function (_x4) {
2801
- return _ref51.apply(this, arguments);
2937
+ return _ref54.apply(this, arguments);
2802
2938
  };
2803
2939
  }());
2804
2940
  call.doHoldResume();
2805
- _context51.next = 1;
2941
+ _context52.next = 1;
2806
2942
  return (0, _testUtil.flushPromises)(2);
2807
2943
  case 1:
2808
2944
  /* the Call State should transition to S_CALL_ESTABLISHED
@@ -2812,7 +2948,7 @@ describe('Supplementary Services tests', function () {
2812
2948
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2813
2949
  /* We are intentionally failing the ROAP ANSWER */
2814
2950
  roapEvent.data.type = 'ANSWER';
2815
- _context51.next = 2;
2951
+ _context52.next = 2;
2816
2952
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2817
2953
  case 2:
2818
2954
  expect(call.isHeld()).toStrictEqual(false);
@@ -2820,14 +2956,14 @@ describe('Supplementary Services tests', function () {
2820
2956
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2821
2957
  case 3:
2822
2958
  case "end":
2823
- return _context51.stop();
2959
+ return _context52.stop();
2824
2960
  }
2825
- }, _callee51);
2961
+ }, _callee52);
2826
2962
  })));
2827
- it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
2963
+ it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
2828
2964
  var responsePayload, warnSpy, roapEvent;
2829
- return _regenerator.default.wrap(function (_context52) {
2830
- while (1) switch (_context52.prev = _context52.next) {
2965
+ return _regenerator.default.wrap(function (_context53) {
2966
+ while (1) switch (_context53.prev = _context53.next) {
2831
2967
  case 0:
2832
2968
  responsePayload = {
2833
2969
  statusCode: 200,
@@ -2838,10 +2974,10 @@ describe('Supplementary Services tests', function () {
2838
2974
  jest.spyOn(global, 'clearTimeout');
2839
2975
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2840
2976
  call['held'] = false;
2841
- _context52.next = 1;
2977
+ _context53.next = 1;
2842
2978
  return call.doHoldResume();
2843
2979
  case 1:
2844
- _context52.next = 2;
2980
+ _context53.next = 2;
2845
2981
  return (0, _testUtil.flushPromises)(2);
2846
2982
  case 2:
2847
2983
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2856,19 +2992,19 @@ describe('Supplementary Services tests', function () {
2856
2992
  call['handleIncomingRoapOffer']({}, dummyEvent);
2857
2993
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2858
2994
  roapEvent.data.type = 'ANSWER';
2859
- _context52.next = 3;
2995
+ _context53.next = 3;
2860
2996
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2861
2997
  case 3:
2862
2998
  jest.spyOn(webex, 'request').mockRejectedValue({
2863
2999
  statusCode: 403
2864
3000
  });
2865
3001
  roapEvent.data.type = 'OK';
2866
- _context52.next = 4;
3002
+ _context53.next = 4;
2867
3003
  return call['handleRoapEstablished']({}, dummyEvent);
2868
3004
  case 4:
2869
3005
  /* this is for coverage */
2870
3006
  call['callStateMachine'].state.value = 'S_CALL_HOLD';
2871
- _context52.next = 5;
3007
+ _context53.next = 5;
2872
3008
  return call['handleRoapEstablished']({}, dummyEvent);
2873
3009
  case 5:
2874
3010
  expect(call.isHeld()).toStrictEqual(false);
@@ -2880,14 +3016,14 @@ describe('Supplementary Services tests', function () {
2880
3016
  });
2881
3017
  case 6:
2882
3018
  case "end":
2883
- return _context52.stop();
3019
+ return _context53.stop();
2884
3020
  }
2885
- }, _callee52);
3021
+ }, _callee53);
2886
3022
  })));
2887
- it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
3023
+ it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54() {
2888
3024
  var responsePayload, warnSpy, roapEvent;
2889
- return _regenerator.default.wrap(function (_context53) {
2890
- while (1) switch (_context53.prev = _context53.next) {
3025
+ return _regenerator.default.wrap(function (_context54) {
3026
+ while (1) switch (_context54.prev = _context54.next) {
2891
3027
  case 0:
2892
3028
  responsePayload = {
2893
3029
  statusCode: 200,
@@ -2898,10 +3034,10 @@ describe('Supplementary Services tests', function () {
2898
3034
  jest.spyOn(global, 'clearTimeout');
2899
3035
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2900
3036
  call['held'] = true;
2901
- _context53.next = 1;
3037
+ _context54.next = 1;
2902
3038
  return call.doHoldResume();
2903
3039
  case 1:
2904
- _context53.next = 2;
3040
+ _context54.next = 2;
2905
3041
  return (0, _testUtil.flushPromises)(2);
2906
3042
  case 2:
2907
3043
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2916,14 +3052,14 @@ describe('Supplementary Services tests', function () {
2916
3052
  call['handleIncomingRoapOffer']({}, dummyEvent);
2917
3053
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2918
3054
  roapEvent.data.type = 'ANSWER';
2919
- _context53.next = 3;
3055
+ _context54.next = 3;
2920
3056
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2921
3057
  case 3:
2922
3058
  jest.spyOn(webex, 'request').mockRejectedValue({
2923
3059
  statusCode: 403
2924
3060
  });
2925
3061
  roapEvent.data.type = 'OK';
2926
- _context53.next = 4;
3062
+ _context54.next = 4;
2927
3063
  return call['handleRoapEstablished']({}, dummyEvent);
2928
3064
  case 4:
2929
3065
  expect(call.isHeld()).toStrictEqual(true);
@@ -2935,14 +3071,14 @@ describe('Supplementary Services tests', function () {
2935
3071
  });
2936
3072
  case 5:
2937
3073
  case "end":
2938
- return _context53.stop();
3074
+ return _context54.stop();
2939
3075
  }
2940
- }, _callee53);
3076
+ }, _callee54);
2941
3077
  })));
2942
- it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
3078
+ it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56() {
2943
3079
  var responsePayload, roapEvent;
2944
- return _regenerator.default.wrap(function (_context55) {
2945
- while (1) switch (_context55.prev = _context55.next) {
3080
+ return _regenerator.default.wrap(function (_context56) {
3081
+ while (1) switch (_context56.prev = _context56.next) {
2946
3082
  case 0:
2947
3083
  expect.assertions(5);
2948
3084
  responsePayload = {
@@ -2952,25 +3088,25 @@ describe('Supplementary Services tests', function () {
2952
3088
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
2953
3089
  call['held'] = false;
2954
3090
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2955
- var _ref55 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54(errObj) {
2956
- return _regenerator.default.wrap(function (_context54) {
2957
- while (1) switch (_context54.prev = _context54.next) {
3091
+ var _ref58 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55(errObj) {
3092
+ return _regenerator.default.wrap(function (_context55) {
3093
+ while (1) switch (_context55.prev = _context55.next) {
2958
3094
  case 0:
2959
3095
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
2960
3096
  expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
2961
3097
  case 1:
2962
3098
  case "end":
2963
- return _context54.stop();
3099
+ return _context55.stop();
2964
3100
  }
2965
- }, _callee54);
3101
+ }, _callee55);
2966
3102
  }));
2967
3103
  return function (_x5) {
2968
- return _ref55.apply(this, arguments);
3104
+ return _ref58.apply(this, arguments);
2969
3105
  };
2970
3106
  }());
2971
3107
  jest.runAllTimers();
2972
3108
  call.doHoldResume();
2973
- _context55.next = 1;
3109
+ _context56.next = 1;
2974
3110
  return (0, _testUtil.flushPromises)(2);
2975
3111
  case 1:
2976
3112
  /* At this point, the Call State should be S_CALL_HOLD
@@ -2983,11 +3119,11 @@ describe('Supplementary Services tests', function () {
2983
3119
  call['handleIncomingRoapOffer']({}, dummyEvent);
2984
3120
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2985
3121
  roapEvent.data.type = 'ANSWER';
2986
- _context55.next = 2;
3122
+ _context56.next = 2;
2987
3123
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2988
3124
  case 2:
2989
3125
  roapEvent.data.type = 'OK';
2990
- _context55.next = 3;
3126
+ _context56.next = 3;
2991
3127
  return call['handleRoapEstablished']({}, dummyEvent);
2992
3128
  case 3:
2993
3129
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -2999,14 +3135,14 @@ describe('Supplementary Services tests', function () {
2999
3135
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3000
3136
  case 4:
3001
3137
  case "end":
3002
- return _context55.stop();
3138
+ return _context56.stop();
3003
3139
  }
3004
- }, _callee55);
3140
+ }, _callee56);
3005
3141
  })));
3006
- it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
3142
+ it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58() {
3007
3143
  var responsePayload, warnSpy, roapEvent;
3008
- return _regenerator.default.wrap(function (_context57) {
3009
- while (1) switch (_context57.prev = _context57.next) {
3144
+ return _regenerator.default.wrap(function (_context58) {
3145
+ while (1) switch (_context58.prev = _context58.next) {
3010
3146
  case 0:
3011
3147
  expect.assertions(7);
3012
3148
  responsePayload = {
@@ -3019,25 +3155,25 @@ describe('Supplementary Services tests', function () {
3019
3155
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3020
3156
  call['held'] = true;
3021
3157
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
3022
- var _ref57 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56(correlationId) {
3023
- return _regenerator.default.wrap(function (_context56) {
3024
- while (1) switch (_context56.prev = _context56.next) {
3158
+ var _ref60 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57(correlationId) {
3159
+ return _regenerator.default.wrap(function (_context57) {
3160
+ while (1) switch (_context57.prev = _context57.next) {
3025
3161
  case 0:
3026
3162
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3027
3163
  case 1:
3028
3164
  case "end":
3029
- return _context56.stop();
3165
+ return _context57.stop();
3030
3166
  }
3031
- }, _callee56);
3167
+ }, _callee57);
3032
3168
  }));
3033
3169
  return function (_x6) {
3034
- return _ref57.apply(this, arguments);
3170
+ return _ref60.apply(this, arguments);
3035
3171
  };
3036
3172
  }());
3037
- _context57.next = 1;
3173
+ _context58.next = 1;
3038
3174
  return call.doHoldResume();
3039
3175
  case 1:
3040
- _context57.next = 2;
3176
+ _context58.next = 2;
3041
3177
  return (0, _testUtil.flushPromises)(2);
3042
3178
  case 2:
3043
3179
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -3053,11 +3189,11 @@ describe('Supplementary Services tests', function () {
3053
3189
  call['handleIncomingRoapOffer']({}, dummyEvent);
3054
3190
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3055
3191
  roapEvent.data.type = 'ANSWER';
3056
- _context57.next = 3;
3192
+ _context58.next = 3;
3057
3193
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3058
3194
  case 3:
3059
3195
  roapEvent.data.type = 'OK';
3060
- _context57.next = 4;
3196
+ _context58.next = 4;
3061
3197
  return call['handleRoapEstablished']({}, dummyEvent);
3062
3198
  case 4:
3063
3199
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -3072,14 +3208,14 @@ describe('Supplementary Services tests', function () {
3072
3208
  });
3073
3209
  case 5:
3074
3210
  case "end":
3075
- return _context57.stop();
3211
+ return _context58.stop();
3076
3212
  }
3077
- }, _callee57);
3213
+ }, _callee58);
3078
3214
  })));
3079
- it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59() {
3215
+ it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60() {
3080
3216
  var responsePayload, warnSpy, roapEvent;
3081
- return _regenerator.default.wrap(function (_context59) {
3082
- while (1) switch (_context59.prev = _context59.next) {
3217
+ return _regenerator.default.wrap(function (_context60) {
3218
+ while (1) switch (_context60.prev = _context60.next) {
3083
3219
  case 0:
3084
3220
  expect.assertions(7);
3085
3221
  responsePayload = {
@@ -3092,26 +3228,26 @@ describe('Supplementary Services tests', function () {
3092
3228
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3093
3229
  call['held'] = true;
3094
3230
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
3095
- var _ref59 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58(correlationId) {
3096
- return _regenerator.default.wrap(function (_context58) {
3097
- while (1) switch (_context58.prev = _context58.next) {
3231
+ var _ref62 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59(correlationId) {
3232
+ return _regenerator.default.wrap(function (_context59) {
3233
+ while (1) switch (_context59.prev = _context59.next) {
3098
3234
  case 0:
3099
3235
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3100
3236
  case 1:
3101
3237
  case "end":
3102
- return _context58.stop();
3238
+ return _context59.stop();
3103
3239
  }
3104
- }, _callee58);
3240
+ }, _callee59);
3105
3241
  }));
3106
3242
  return function (_x7) {
3107
- return _ref59.apply(this, arguments);
3243
+ return _ref62.apply(this, arguments);
3108
3244
  };
3109
3245
  }());
3110
3246
  call.doHoldResume();
3111
- _context59.next = 1;
3247
+ _context60.next = 1;
3112
3248
  return _promise.default.resolve();
3113
3249
  case 1:
3114
- _context59.next = 2;
3250
+ _context60.next = 2;
3115
3251
  return _promise.default.resolve();
3116
3252
  case 2:
3117
3253
  expect(setTimeout).not.toHaveBeenCalled();
@@ -3127,11 +3263,11 @@ describe('Supplementary Services tests', function () {
3127
3263
  call['handleIncomingRoapOffer']({}, dummyEvent);
3128
3264
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3129
3265
  roapEvent.data.type = 'ANSWER';
3130
- _context59.next = 3;
3266
+ _context60.next = 3;
3131
3267
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3132
3268
  case 3:
3133
3269
  roapEvent.data.type = 'OK';
3134
- _context59.next = 4;
3270
+ _context60.next = 4;
3135
3271
  return call['handleRoapEstablished']({}, dummyEvent);
3136
3272
  case 4:
3137
3273
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -3146,14 +3282,14 @@ describe('Supplementary Services tests', function () {
3146
3282
  });
3147
3283
  case 5:
3148
3284
  case "end":
3149
- return _context59.stop();
3285
+ return _context60.stop();
3150
3286
  }
3151
- }, _callee59);
3287
+ }, _callee60);
3152
3288
  })));
3153
- it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61() {
3289
+ it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62() {
3154
3290
  var responsePayload;
3155
- return _regenerator.default.wrap(function (_context61) {
3156
- while (1) switch (_context61.prev = _context61.next) {
3291
+ return _regenerator.default.wrap(function (_context62) {
3292
+ while (1) switch (_context62.prev = _context62.next) {
3157
3293
  case 0:
3158
3294
  expect.assertions(4);
3159
3295
  responsePayload = {
@@ -3163,26 +3299,26 @@ describe('Supplementary Services tests', function () {
3163
3299
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3164
3300
  call['held'] = true;
3165
3301
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3166
- var _ref61 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60(errObj) {
3167
- return _regenerator.default.wrap(function (_context60) {
3168
- while (1) switch (_context60.prev = _context60.next) {
3302
+ var _ref64 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61(errObj) {
3303
+ return _regenerator.default.wrap(function (_context61) {
3304
+ while (1) switch (_context61.prev = _context61.next) {
3169
3305
  case 0:
3170
3306
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3171
3307
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3172
3308
  case 1:
3173
3309
  case "end":
3174
- return _context60.stop();
3310
+ return _context61.stop();
3175
3311
  }
3176
- }, _callee60);
3312
+ }, _callee61);
3177
3313
  }));
3178
3314
  return function (_x8) {
3179
- return _ref61.apply(this, arguments);
3315
+ return _ref64.apply(this, arguments);
3180
3316
  };
3181
3317
  }());
3182
- _context61.next = 1;
3318
+ _context62.next = 1;
3183
3319
  return call.doHoldResume();
3184
3320
  case 1:
3185
- _context61.next = 2;
3321
+ _context62.next = 2;
3186
3322
  return (0, _testUtil.flushPromises)(2);
3187
3323
  case 2:
3188
3324
  expect(call.isHeld()).toStrictEqual(true);
@@ -3193,14 +3329,14 @@ describe('Supplementary Services tests', function () {
3193
3329
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3194
3330
  case 3:
3195
3331
  case "end":
3196
- return _context61.stop();
3332
+ return _context62.stop();
3197
3333
  }
3198
- }, _callee61);
3334
+ }, _callee62);
3199
3335
  })));
3200
- it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
3336
+ it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64() {
3201
3337
  var responsePayload, rejectPayload, roapEvent;
3202
- return _regenerator.default.wrap(function (_context63) {
3203
- while (1) switch (_context63.prev = _context63.next) {
3338
+ return _regenerator.default.wrap(function (_context64) {
3339
+ while (1) switch (_context64.prev = _context64.next) {
3204
3340
  case 0:
3205
3341
  expect.assertions(5);
3206
3342
  responsePayload = {
@@ -3214,24 +3350,24 @@ describe('Supplementary Services tests', function () {
3214
3350
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
3215
3351
  call['held'] = true;
3216
3352
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3217
- var _ref63 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62(errObj) {
3218
- return _regenerator.default.wrap(function (_context62) {
3219
- while (1) switch (_context62.prev = _context62.next) {
3353
+ var _ref66 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63(errObj) {
3354
+ return _regenerator.default.wrap(function (_context63) {
3355
+ while (1) switch (_context63.prev = _context63.next) {
3220
3356
  case 0:
3221
3357
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3222
3358
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3223
3359
  case 1:
3224
3360
  case "end":
3225
- return _context62.stop();
3361
+ return _context63.stop();
3226
3362
  }
3227
- }, _callee62);
3363
+ }, _callee63);
3228
3364
  }));
3229
3365
  return function (_x9) {
3230
- return _ref63.apply(this, arguments);
3366
+ return _ref66.apply(this, arguments);
3231
3367
  };
3232
3368
  }());
3233
3369
  call.doHoldResume();
3234
- _context63.next = 1;
3370
+ _context64.next = 1;
3235
3371
  return (0, _testUtil.flushPromises)(2);
3236
3372
  case 1:
3237
3373
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
@@ -3242,7 +3378,7 @@ describe('Supplementary Services tests', function () {
3242
3378
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3243
3379
  /* We are intentionally failing the ROAP ANSWER */
3244
3380
  roapEvent.data.type = 'ANSWER';
3245
- _context63.next = 2;
3381
+ _context64.next = 2;
3246
3382
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3247
3383
  case 2:
3248
3384
  expect(call.isHeld()).toStrictEqual(true);
@@ -3250,14 +3386,14 @@ describe('Supplementary Services tests', function () {
3250
3386
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3251
3387
  case 3:
3252
3388
  case "end":
3253
- return _context63.stop();
3389
+ return _context64.stop();
3254
3390
  }
3255
- }, _callee63);
3391
+ }, _callee64);
3256
3392
  })));
3257
- it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65() {
3393
+ it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66() {
3258
3394
  var responsePayload, roapEvent;
3259
- return _regenerator.default.wrap(function (_context65) {
3260
- while (1) switch (_context65.prev = _context65.next) {
3395
+ return _regenerator.default.wrap(function (_context66) {
3396
+ while (1) switch (_context66.prev = _context66.next) {
3261
3397
  case 0:
3262
3398
  expect.assertions(5);
3263
3399
  responsePayload = {
@@ -3267,24 +3403,24 @@ describe('Supplementary Services tests', function () {
3267
3403
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
3268
3404
  call['held'] = true;
3269
3405
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3270
- var _ref65 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64(errObj) {
3271
- return _regenerator.default.wrap(function (_context64) {
3272
- while (1) switch (_context64.prev = _context64.next) {
3406
+ var _ref68 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65(errObj) {
3407
+ return _regenerator.default.wrap(function (_context65) {
3408
+ while (1) switch (_context65.prev = _context65.next) {
3273
3409
  case 0:
3274
3410
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
3275
3411
  expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
3276
3412
  case 1:
3277
3413
  case "end":
3278
- return _context64.stop();
3414
+ return _context65.stop();
3279
3415
  }
3280
- }, _callee64);
3416
+ }, _callee65);
3281
3417
  }));
3282
3418
  return function (_x0) {
3283
- return _ref65.apply(this, arguments);
3419
+ return _ref68.apply(this, arguments);
3284
3420
  };
3285
3421
  }());
3286
3422
  call.doHoldResume();
3287
- _context65.next = 1;
3423
+ _context66.next = 1;
3288
3424
  return (0, _testUtil.flushPromises)(2);
3289
3425
  case 1:
3290
3426
  /* At this point ,the Call State should be S_CALL_RESUME
@@ -3297,11 +3433,11 @@ describe('Supplementary Services tests', function () {
3297
3433
  call['handleIncomingRoapOffer']({}, dummyEvent);
3298
3434
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3299
3435
  roapEvent.data.type = 'ANSWER';
3300
- _context65.next = 2;
3436
+ _context66.next = 2;
3301
3437
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3302
3438
  case 2:
3303
3439
  roapEvent.data.type = 'OK';
3304
- _context65.next = 3;
3440
+ _context66.next = 3;
3305
3441
  return call['handleRoapEstablished']({}, dummyEvent);
3306
3442
  case 3:
3307
3443
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -3311,9 +3447,9 @@ describe('Supplementary Services tests', function () {
3311
3447
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3312
3448
  case 4:
3313
3449
  case "end":
3314
- return _context65.stop();
3450
+ return _context66.stop();
3315
3451
  }
3316
- }, _callee65);
3452
+ }, _callee66);
3317
3453
  })));
3318
3454
  });
3319
3455
  describe('Call transfer tests', function () {
@@ -3346,10 +3482,10 @@ describe('Supplementary Services tests', function () {
3346
3482
  secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
3347
3483
  secondCall['held'] = false;
3348
3484
  });
3349
- it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68() {
3485
+ it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69() {
3350
3486
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3351
- return _regenerator.default.wrap(function (_context68) {
3352
- while (1) switch (_context68.prev = _context68.next) {
3487
+ return _regenerator.default.wrap(function (_context69) {
3488
+ while (1) switch (_context69.prev = _context69.next) {
3353
3489
  case 0:
3354
3490
  expect.assertions(12); // Updated to match actual assertion count
3355
3491
  responsePayload = {
@@ -3361,41 +3497,41 @@ describe('Supplementary Services tests', function () {
3361
3497
  infoSpy = jest.spyOn(_Logger.default, 'info');
3362
3498
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3363
3499
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3364
- var _ref67 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66(correlationId) {
3365
- return _regenerator.default.wrap(function (_context66) {
3366
- while (1) switch (_context66.prev = _context66.next) {
3500
+ var _ref70 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67(correlationId) {
3501
+ return _regenerator.default.wrap(function (_context67) {
3502
+ while (1) switch (_context67.prev = _context67.next) {
3367
3503
  case 0:
3368
3504
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3369
3505
  case 1:
3370
3506
  case "end":
3371
- return _context66.stop();
3507
+ return _context67.stop();
3372
3508
  }
3373
- }, _callee66);
3509
+ }, _callee67);
3374
3510
  }));
3375
3511
  return function (_x1) {
3376
- return _ref67.apply(this, arguments);
3512
+ return _ref70.apply(this, arguments);
3377
3513
  };
3378
3514
  }());
3379
3515
  secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3380
- var _ref68 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67(correlationId) {
3381
- return _regenerator.default.wrap(function (_context67) {
3382
- while (1) switch (_context67.prev = _context67.next) {
3516
+ var _ref71 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68(correlationId) {
3517
+ return _regenerator.default.wrap(function (_context68) {
3518
+ while (1) switch (_context68.prev = _context68.next) {
3383
3519
  case 0:
3384
3520
  expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
3385
3521
  case 1:
3386
3522
  case "end":
3387
- return _context67.stop();
3523
+ return _context68.stop();
3388
3524
  }
3389
- }, _callee67);
3525
+ }, _callee68);
3390
3526
  }));
3391
3527
  return function (_x10) {
3392
- return _ref68.apply(this, arguments);
3528
+ return _ref71.apply(this, arguments);
3393
3529
  };
3394
3530
  }());
3395
- _context68.next = 1;
3531
+ _context69.next = 1;
3396
3532
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3397
3533
  case 1:
3398
- _context68.next = 2;
3534
+ _context69.next = 2;
3399
3535
  return (0, _testUtil.flushPromises)(2);
3400
3536
  case 2:
3401
3537
  expect(requestSpy).toBeCalled();
@@ -3418,14 +3554,14 @@ describe('Supplementary Services tests', function () {
3418
3554
  expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3419
3555
  case 3:
3420
3556
  case "end":
3421
- return _context68.stop();
3557
+ return _context69.stop();
3422
3558
  }
3423
- }, _callee68);
3559
+ }, _callee69);
3424
3560
  })));
3425
- it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
3561
+ it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
3426
3562
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3427
- return _regenerator.default.wrap(function (_context70) {
3428
- while (1) switch (_context70.prev = _context70.next) {
3563
+ return _regenerator.default.wrap(function (_context71) {
3564
+ while (1) switch (_context71.prev = _context71.next) {
3429
3565
  case 0:
3430
3566
  expect.assertions(10); // Updated to match actual assertion count
3431
3567
  responsePayload = {
@@ -3437,25 +3573,25 @@ describe('Supplementary Services tests', function () {
3437
3573
  infoSpy = jest.spyOn(_Logger.default, 'info');
3438
3574
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3439
3575
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3440
- var _ref70 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69(correlationId) {
3441
- return _regenerator.default.wrap(function (_context69) {
3442
- while (1) switch (_context69.prev = _context69.next) {
3576
+ var _ref73 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70(correlationId) {
3577
+ return _regenerator.default.wrap(function (_context70) {
3578
+ while (1) switch (_context70.prev = _context70.next) {
3443
3579
  case 0:
3444
3580
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3445
3581
  case 1:
3446
3582
  case "end":
3447
- return _context69.stop();
3583
+ return _context70.stop();
3448
3584
  }
3449
- }, _callee69);
3585
+ }, _callee70);
3450
3586
  }));
3451
3587
  return function (_x11) {
3452
- return _ref70.apply(this, arguments);
3588
+ return _ref73.apply(this, arguments);
3453
3589
  };
3454
3590
  }());
3455
- _context70.next = 1;
3591
+ _context71.next = 1;
3456
3592
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3457
3593
  case 1:
3458
- _context70.next = 2;
3594
+ _context71.next = 2;
3459
3595
  return (0, _testUtil.flushPromises)(2);
3460
3596
  case 2:
3461
3597
  expect(requestSpy).toBeCalled();
@@ -3474,14 +3610,14 @@ describe('Supplementary Services tests', function () {
3474
3610
  expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3475
3611
  case 3:
3476
3612
  case "end":
3477
- return _context70.stop();
3613
+ return _context71.stop();
3478
3614
  }
3479
- }, _callee70);
3615
+ }, _callee71);
3480
3616
  })));
3481
- it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
3617
+ it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3482
3618
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3483
- return _regenerator.default.wrap(function (_context71) {
3484
- while (1) switch (_context71.prev = _context71.next) {
3619
+ return _regenerator.default.wrap(function (_context72) {
3620
+ while (1) switch (_context72.prev = _context72.next) {
3485
3621
  case 0:
3486
3622
  responsePayload = {
3487
3623
  statusCode: 403,
@@ -3492,10 +3628,10 @@ describe('Supplementary Services tests', function () {
3492
3628
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3493
3629
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3494
3630
  call['broadworksCorrelationInfo'] = 'dummy-broadworks-correlation-info';
3495
- _context71.next = 1;
3631
+ _context72.next = 1;
3496
3632
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3497
3633
  case 1:
3498
- _context71.next = 2;
3634
+ _context72.next = 2;
3499
3635
  return (0, _testUtil.flushPromises)(1);
3500
3636
  case 2:
3501
3637
  expect(requestSpy).toBeCalled();
@@ -3516,14 +3652,14 @@ describe('Supplementary Services tests', function () {
3516
3652
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
3517
3653
  case 3:
3518
3654
  case "end":
3519
- return _context71.stop();
3655
+ return _context72.stop();
3520
3656
  }
3521
- }, _callee71);
3657
+ }, _callee72);
3522
3658
  })));
3523
- it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3659
+ it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
3524
3660
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3525
- return _regenerator.default.wrap(function (_context72) {
3526
- while (1) switch (_context72.prev = _context72.next) {
3661
+ return _regenerator.default.wrap(function (_context73) {
3662
+ while (1) switch (_context73.prev = _context73.next) {
3527
3663
  case 0:
3528
3664
  responsePayload = {
3529
3665
  statusCode: 403,
@@ -3533,10 +3669,10 @@ describe('Supplementary Services tests', function () {
3533
3669
  requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3534
3670
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3535
3671
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3536
- _context72.next = 1;
3672
+ _context73.next = 1;
3537
3673
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3538
3674
  case 1:
3539
- _context72.next = 2;
3675
+ _context73.next = 2;
3540
3676
  return (0, _testUtil.flushPromises)(2);
3541
3677
  case 2:
3542
3678
  expect(requestSpy).toBeCalled();
@@ -3557,18 +3693,18 @@ describe('Supplementary Services tests', function () {
3557
3693
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
3558
3694
  case 3:
3559
3695
  case "end":
3560
- return _context72.stop();
3696
+ return _context73.stop();
3561
3697
  }
3562
- }, _callee72);
3698
+ }, _callee73);
3563
3699
  })));
3564
- it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
3700
+ it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee74() {
3565
3701
  var requestSpy, warnSpy;
3566
- return _regenerator.default.wrap(function (_context73) {
3567
- while (1) switch (_context73.prev = _context73.next) {
3702
+ return _regenerator.default.wrap(function (_context74) {
3703
+ while (1) switch (_context74.prev = _context74.next) {
3568
3704
  case 0:
3569
3705
  requestSpy = jest.spyOn(webex, 'request');
3570
3706
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3571
- _context73.next = 1;
3707
+ _context74.next = 1;
3572
3708
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
3573
3709
  case 1:
3574
3710
  /* We should be in CALL_ESTABLISHED state */
@@ -3580,18 +3716,18 @@ describe('Supplementary Services tests', function () {
3580
3716
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3581
3717
  case 2:
3582
3718
  case "end":
3583
- return _context73.stop();
3719
+ return _context74.stop();
3584
3720
  }
3585
- }, _callee73);
3721
+ }, _callee74);
3586
3722
  })));
3587
- it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee74() {
3723
+ it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee75() {
3588
3724
  var requestSpy, warnSpy;
3589
- return _regenerator.default.wrap(function (_context74) {
3590
- while (1) switch (_context74.prev = _context74.next) {
3725
+ return _regenerator.default.wrap(function (_context75) {
3726
+ while (1) switch (_context75.prev = _context75.next) {
3591
3727
  case 0:
3592
3728
  requestSpy = jest.spyOn(webex, 'request');
3593
3729
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3594
- _context74.next = 1;
3730
+ _context75.next = 1;
3595
3731
  return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
3596
3732
  case 1:
3597
3733
  /* We should be in CALL_ESTABLISHED state */
@@ -3603,9 +3739,9 @@ describe('Supplementary Services tests', function () {
3603
3739
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3604
3740
  case 2:
3605
3741
  case "end":
3606
- return _context74.stop();
3742
+ return _context75.stop();
3607
3743
  }
3608
- }, _callee74);
3744
+ }, _callee75);
3609
3745
  })));
3610
3746
  });
3611
3747
  });