@webex/calling 3.12.0-next.4 → 3.12.0-next.41

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 (204) 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 +589 -445
  6. package/dist/CallingClient/calling/call.js.map +1 -1
  7. package/dist/CallingClient/calling/call.test.js +695 -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 +25 -3
  16. package/dist/CallingClient/constants.js.map +1 -1
  17. package/dist/CallingClient/line/index.js +4 -1
  18. package/dist/CallingClient/line/index.js.map +1 -1
  19. package/dist/CallingClient/line/line.test.js +16 -1
  20. package/dist/CallingClient/line/line.test.js.map +1 -1
  21. package/dist/CallingClient/registration/register.js +712 -406
  22. package/dist/CallingClient/registration/register.js.map +1 -1
  23. package/dist/CallingClient/registration/register.test.js +202 -21
  24. package/dist/CallingClient/registration/register.test.js.map +1 -1
  25. package/dist/CallingClient/registration/types.js.map +1 -1
  26. package/dist/CallingClient/registration/webWorker.js +41 -104
  27. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  28. package/dist/CallingClient/registration/webWorker.test.js +39 -153
  29. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  30. package/dist/CallingClient/registration/webWorkerStr.js +1 -1
  31. package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
  32. package/dist/CallingClient/utils/constants.js +46 -0
  33. package/dist/CallingClient/utils/constants.js.map +1 -0
  34. package/dist/CallingClient/utils/index.js +63 -0
  35. package/dist/CallingClient/utils/index.js.map +1 -0
  36. package/dist/CallingClient/utils/mobiusSocketMapper.js +122 -0
  37. package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -0
  38. package/dist/CallingClient/utils/mobiusSocketMapper.test.js +211 -0
  39. package/dist/CallingClient/utils/mobiusSocketMapper.test.js.map +1 -0
  40. package/dist/CallingClient/utils/request.js +354 -0
  41. package/dist/CallingClient/utils/request.js.map +1 -0
  42. package/dist/CallingClient/utils/request.test.js +881 -0
  43. package/dist/CallingClient/utils/request.test.js.map +1 -0
  44. package/dist/CallingClient/utils/types.js +7 -0
  45. package/dist/CallingClient/utils/types.js.map +1 -0
  46. package/dist/CallingClient/utils/wsFeatureFlag.js +70 -0
  47. package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -0
  48. package/dist/CallingClient/utils/wsFeatureFlag.test.js +139 -0
  49. package/dist/CallingClient/utils/wsFeatureFlag.test.js.map +1 -0
  50. package/dist/Contacts/ContactsClient.js +13 -11
  51. package/dist/Contacts/ContactsClient.js.map +1 -1
  52. package/dist/Contacts/ContactsClient.test.js +3 -8
  53. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  54. package/dist/Events/types.js +1 -11
  55. package/dist/Events/types.js.map +1 -1
  56. package/dist/Metrics/index.js +63 -2
  57. package/dist/Metrics/index.js.map +1 -1
  58. package/dist/Metrics/index.test.js +357 -1
  59. package/dist/Metrics/index.test.js.map +1 -1
  60. package/dist/Metrics/types.js +19 -1
  61. package/dist/Metrics/types.js.map +1 -1
  62. package/dist/SDKConnector/types.js.map +1 -1
  63. package/dist/common/Utils.js +138 -44
  64. package/dist/common/Utils.js.map +1 -1
  65. package/dist/common/testUtil.js +8 -4
  66. package/dist/common/testUtil.js.map +1 -1
  67. package/dist/common/types.js +2 -0
  68. package/dist/common/types.js.map +1 -1
  69. package/dist/mobius-socket/config.js +24 -0
  70. package/dist/mobius-socket/config.js.map +1 -0
  71. package/dist/mobius-socket/errors.js +143 -0
  72. package/dist/mobius-socket/errors.js.map +1 -0
  73. package/dist/mobius-socket/errors.test.js +20 -0
  74. package/dist/mobius-socket/errors.test.js.map +1 -0
  75. package/dist/mobius-socket/index.js +57 -0
  76. package/dist/mobius-socket/index.js.map +1 -0
  77. package/dist/mobius-socket/mobius-socket-events.test.js +492 -0
  78. package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -0
  79. package/dist/mobius-socket/mobius-socket.js +841 -0
  80. package/dist/mobius-socket/mobius-socket.js.map +1 -0
  81. package/dist/mobius-socket/mobius-socket.test.js +1845 -0
  82. package/dist/mobius-socket/mobius-socket.test.js.map +1 -0
  83. package/dist/mobius-socket/socket/constants.js +55 -0
  84. package/dist/mobius-socket/socket/constants.js.map +1 -0
  85. package/dist/mobius-socket/socket/index.js +15 -0
  86. package/dist/mobius-socket/socket/index.js.map +1 -0
  87. package/dist/mobius-socket/socket/socket-base.js +604 -0
  88. package/dist/mobius-socket/socket/socket-base.js.map +1 -0
  89. package/dist/mobius-socket/socket/socket.js +19 -0
  90. package/dist/mobius-socket/socket/socket.js.map +1 -0
  91. package/dist/mobius-socket/socket/socket.shim.js +26 -0
  92. package/dist/mobius-socket/socket/socket.shim.js.map +1 -0
  93. package/dist/mobius-socket/socket/types.js +7 -0
  94. package/dist/mobius-socket/socket/types.js.map +1 -0
  95. package/dist/mobius-socket/socket.test.js +727 -0
  96. package/dist/mobius-socket/socket.test.js.map +1 -0
  97. package/dist/mobius-socket/test/mocha-helpers.js +23 -0
  98. package/dist/mobius-socket/test/mocha-helpers.js.map +1 -0
  99. package/dist/mobius-socket/test/promise-tick.js +28 -0
  100. package/dist/mobius-socket/test/promise-tick.js.map +1 -0
  101. package/dist/mobius-socket/types.js +7 -0
  102. package/dist/mobius-socket/types.js.map +1 -0
  103. package/dist/module/CallingClient/CallingClient.js +141 -10
  104. package/dist/module/CallingClient/calling/call.js +177 -61
  105. package/dist/module/CallingClient/calling/callManager.js +27 -7
  106. package/dist/module/CallingClient/calling/types.js +2 -0
  107. package/dist/module/CallingClient/constants.js +21 -0
  108. package/dist/module/CallingClient/line/index.js +2 -2
  109. package/dist/module/CallingClient/registration/register.js +234 -62
  110. package/dist/module/CallingClient/registration/webWorker.js +42 -61
  111. package/dist/module/CallingClient/registration/webWorkerStr.js +47 -82
  112. package/dist/module/CallingClient/utils/constants.js +30 -0
  113. package/dist/module/CallingClient/utils/index.js +5 -0
  114. package/dist/module/CallingClient/utils/mobiusSocketMapper.js +72 -0
  115. package/dist/module/CallingClient/utils/request.js +165 -0
  116. package/dist/module/CallingClient/utils/types.js +1 -0
  117. package/dist/module/CallingClient/utils/wsFeatureFlag.js +41 -0
  118. package/dist/module/Contacts/ContactsClient.js +1 -1
  119. package/dist/module/Events/types.js +0 -10
  120. package/dist/module/Metrics/index.js +48 -1
  121. package/dist/module/Metrics/types.js +18 -0
  122. package/dist/module/common/Utils.js +52 -12
  123. package/dist/module/common/testUtil.js +5 -1
  124. package/dist/module/common/types.js +2 -0
  125. package/dist/module/mobius-socket/config.js +15 -0
  126. package/dist/module/mobius-socket/errors.js +58 -0
  127. package/dist/module/mobius-socket/index.js +24 -0
  128. package/dist/module/mobius-socket/mobius-socket.js +589 -0
  129. package/dist/module/mobius-socket/socket/constants.js +26 -0
  130. package/dist/module/mobius-socket/socket/index.js +4 -0
  131. package/dist/module/mobius-socket/socket/socket-base.js +368 -0
  132. package/dist/module/mobius-socket/socket/socket.js +9 -0
  133. package/dist/module/mobius-socket/socket/socket.shim.js +12 -0
  134. package/dist/module/mobius-socket/socket/types.js +1 -0
  135. package/dist/module/mobius-socket/types.js +1 -0
  136. package/dist/types/CallingClient/CallingClient.d.ts +7 -0
  137. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  138. package/dist/types/CallingClient/calling/call.d.ts +12 -0
  139. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  140. package/dist/types/CallingClient/calling/callManager.d.ts +3 -2
  141. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  142. package/dist/types/CallingClient/calling/types.d.ts +34 -9
  143. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  144. package/dist/types/CallingClient/constants.d.ts +21 -0
  145. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  146. package/dist/types/CallingClient/line/index.d.ts +1 -1
  147. package/dist/types/CallingClient/line/index.d.ts.map +1 -1
  148. package/dist/types/CallingClient/registration/register.d.ts +7 -1
  149. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  150. package/dist/types/CallingClient/registration/types.d.ts +4 -2
  151. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  152. package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
  153. package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
  154. package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
  155. package/dist/types/CallingClient/utils/constants.d.ts +30 -0
  156. package/dist/types/CallingClient/utils/constants.d.ts.map +1 -0
  157. package/dist/types/CallingClient/utils/index.d.ts +6 -0
  158. package/dist/types/CallingClient/utils/index.d.ts.map +1 -0
  159. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts +5 -0
  160. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -0
  161. package/dist/types/CallingClient/utils/request.d.ts +24 -0
  162. package/dist/types/CallingClient/utils/request.d.ts.map +1 -0
  163. package/dist/types/CallingClient/utils/types.d.ts +29 -0
  164. package/dist/types/CallingClient/utils/types.d.ts.map +1 -0
  165. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts +4 -0
  166. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -0
  167. package/dist/types/Events/types.d.ts +4 -11
  168. package/dist/types/Events/types.d.ts.map +1 -1
  169. package/dist/types/Metrics/index.d.ts.map +1 -1
  170. package/dist/types/Metrics/types.d.ts +19 -2
  171. package/dist/types/Metrics/types.d.ts.map +1 -1
  172. package/dist/types/SDKConnector/types.d.ts +24 -0
  173. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  174. package/dist/types/common/Utils.d.ts +9 -2
  175. package/dist/types/common/Utils.d.ts.map +1 -1
  176. package/dist/types/common/testUtil.d.ts +4 -1
  177. package/dist/types/common/testUtil.d.ts.map +1 -1
  178. package/dist/types/common/types.d.ts +3 -0
  179. package/dist/types/common/types.d.ts.map +1 -1
  180. package/dist/types/mobius-socket/config.d.ts +17 -0
  181. package/dist/types/mobius-socket/config.d.ts.map +1 -0
  182. package/dist/types/mobius-socket/errors.d.ts +32 -0
  183. package/dist/types/mobius-socket/errors.d.ts.map +1 -0
  184. package/dist/types/mobius-socket/index.d.ts +14 -0
  185. package/dist/types/mobius-socket/index.d.ts.map +1 -0
  186. package/dist/types/mobius-socket/mobius-socket.d.ts +48 -0
  187. package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -0
  188. package/dist/types/mobius-socket/socket/constants.d.ts +27 -0
  189. package/dist/types/mobius-socket/socket/constants.d.ts.map +1 -0
  190. package/dist/types/mobius-socket/socket/index.d.ts +5 -0
  191. package/dist/types/mobius-socket/socket/index.d.ts.map +1 -0
  192. package/dist/types/mobius-socket/socket/socket-base.d.ts +43 -0
  193. package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -0
  194. package/dist/types/mobius-socket/socket/socket.d.ts +6 -0
  195. package/dist/types/mobius-socket/socket/socket.d.ts.map +1 -0
  196. package/dist/types/mobius-socket/socket/socket.shim.d.ts +6 -0
  197. package/dist/types/mobius-socket/socket/socket.shim.d.ts.map +1 -0
  198. package/dist/types/mobius-socket/socket/types.d.ts +61 -0
  199. package/dist/types/mobius-socket/socket/types.d.ts.map +1 -0
  200. package/dist/types/mobius-socket/types.d.ts +21 -0
  201. package/dist/types/mobius-socket/types.d.ts.map +1 -0
  202. package/package.json +20 -5
  203. package/src/mobius-socket/socket/socket.shim.ts +22 -0
  204. 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,218 @@ 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('registers and unregisters media connection listeners with stable handlers', function () {
446
+ var mockStream = {
447
+ outputStream: {
448
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
449
+ },
450
+ on: jest.fn(),
451
+ getEffectByKind: jest.fn().mockReturnValue(undefined)
452
+ };
453
+ var localAudioStream = mockStream;
454
+ var call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
455
+ call.dial(localAudioStream);
456
+ var mediaOnMock = call['mediaConnection'].on;
457
+ var mediaOffSpy = jest.spyOn(call['mediaConnection'], 'off');
458
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, expect.any(Function));
459
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_FAILURE, expect.any(Function));
460
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.REMOTE_TRACK_ADDED, expect.any(Function));
461
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, expect.any(Function));
462
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, expect.any(Function));
463
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, expect.any(Function));
464
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CANDIDATE_ERROR, expect.any(Function));
465
+ call['unregisterMediaConnectionListeners']();
466
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, expect.any(Function));
467
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_FAILURE, expect.any(Function));
468
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.REMOTE_TRACK_ADDED, expect.any(Function));
469
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, expect.any(Function));
470
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, expect.any(Function));
471
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, expect.any(Function));
472
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CANDIDATE_ERROR, expect.any(Function));
473
+ });
474
+ it('handles ICE listener payloads and submits metrics with event names', function () {
475
+ var mockStream = {
476
+ outputStream: {
477
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
478
+ },
479
+ on: jest.fn(),
480
+ getEffectByKind: jest.fn().mockReturnValue(undefined)
481
+ };
482
+ var localAudioStream = mockStream;
483
+ var call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
484
+ call.dial(localAudioStream);
485
+ var metricSpy = jest.spyOn(call['metricManager'], 'submitMediaMetric');
486
+ var warnSpy = jest.spyOn(_Logger.default, 'warn');
487
+ var getHandlerForEvent = function getHandlerForEvent(eventName) {
488
+ var _mock$calls$find;
489
+ return (_mock$calls$find = call['mediaConnection'].on.mock.calls.find(function (_ref9) {
490
+ var _ref0 = (0, _slicedToArray2.default)(_ref9, 1),
491
+ name = _ref0[0];
492
+ return name === eventName;
493
+ })) === null || _mock$calls$find === void 0 ? void 0 : _mock$calls$find[1];
494
+ };
495
+ var iceGatheringHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED);
496
+ var peerConnectionHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED);
497
+ var iceConnectionHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED);
498
+ var iceCandidateErrorHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CANDIDATE_ERROR);
499
+ iceGatheringHandler({
500
+ iceGatheringState: 'gathering'
501
+ });
502
+ peerConnectionHandler({
503
+ connectionState: 'connected'
504
+ });
505
+ iceConnectionHandler({
506
+ iceConnectionState: 'completed'
507
+ });
508
+ iceCandidateErrorHandler({
509
+ errorCode: 701,
510
+ errorText: 'STUN host lookup failed',
511
+ url: 'stun:example.org:3478'
512
+ });
513
+ expect(metricSpy).toHaveBeenNthCalledWith(1, _types4.METRIC_EVENT.MEDIA, _types4.MEDIA_CONNECTION_ACTION.ICE_GATHERING_STATE_CHANGED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined, undefined, 'gathering');
514
+ expect(metricSpy).toHaveBeenNthCalledWith(2, _types4.METRIC_EVENT.MEDIA, _types4.MEDIA_CONNECTION_ACTION.PEER_CONNECTION_STATE_CHANGED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined, undefined, 'connected');
515
+ expect(metricSpy).toHaveBeenNthCalledWith(3, _types4.METRIC_EVENT.MEDIA, _types4.MEDIA_CONNECTION_ACTION.ICE_CONNECTION_STATE_CHANGED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined, undefined, 'completed');
516
+ expect(metricSpy).toHaveBeenNthCalledWith(4, _types4.METRIC_EVENT.MEDIA_ERROR, _types4.MEDIA_CONNECTION_ACTION.ICE_CANDIDATE_ERROR, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined, undefined, undefined, expect.any(_Errors.CallError));
517
+ var mediaErrorCall = metricSpy.mock.calls[3];
518
+ expect(mediaErrorCall[mediaErrorCall.length - 1].getCallError().message).toBe('ICE candidate error occurred: {"address":null,"errorCode":701,"errorText":"STUN host lookup failed","port":null,"url":"stun:example.org:3478"}');
519
+ expect(warnSpy).toHaveBeenCalledWith('ICE candidate error occurred: {"address":null,"errorCode":701,"errorText":"STUN host lookup failed","port":null,"url":"stun:example.org:3478"}', {
520
+ file: 'call',
521
+ method: 'mediaIceEventsListener'
522
+ });
523
+ });
524
+ it('handles ROAP failure listener and submits media error metric', function () {
525
+ var _mock$calls$find2;
526
+ var mockStream = {
527
+ outputStream: {
528
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
529
+ },
530
+ on: jest.fn(),
531
+ getEffectByKind: jest.fn().mockReturnValue(undefined)
532
+ };
533
+ var localAudioStream = mockStream;
534
+ var call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
535
+ call.dial(localAudioStream);
536
+ var metricSpy = jest.spyOn(call['metricManager'], 'submitMediaMetric');
537
+ var warnSpy = jest.spyOn(_Logger.default, 'warn');
538
+ var roapFailureHandler = (_mock$calls$find2 = call['mediaConnection'].on.mock.calls.find(function (_ref1) {
539
+ var _ref10 = (0, _slicedToArray2.default)(_ref1, 1),
540
+ name = _ref10[0];
541
+ return name === InternalMediaCoreModule.MediaConnectionEventNames.ROAP_FAILURE;
542
+ })) === null || _mock$calls$find2 === void 0 ? void 0 : _mock$calls$find2[1];
543
+ var roapFailure = new Error('Failed to process remote SDP');
544
+ roapFailureHandler(roapFailure);
545
+ expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.MEDIA_ERROR, _types4.MEDIA_CONNECTION_ACTION.ROAP_FAILURE, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined, undefined, undefined, expect.any(_Errors.CallError));
546
+ var roapFailureMetricCall = metricSpy.mock.calls.find(function (_ref11) {
547
+ var _ref12 = (0, _slicedToArray2.default)(_ref11, 2),
548
+ name = _ref12[0],
549
+ metricAction = _ref12[1];
550
+ return name === _types4.METRIC_EVENT.MEDIA_ERROR && metricAction === _types4.MEDIA_CONNECTION_ACTION.ROAP_FAILURE;
551
+ });
552
+ expect(roapFailureMetricCall).toBeDefined();
553
+ expect((roapFailureMetricCall === null || roapFailureMetricCall === void 0 ? void 0 : roapFailureMetricCall[roapFailureMetricCall.length - 1]).getCallError().message).toBe('ROAP failure occurred: Failed to process remote SDP');
554
+ expect(warnSpy).toHaveBeenCalledWith('ROAP failure occurred: Failed to process remote SDP', {
555
+ file: 'call',
556
+ method: 'mediaRoapEventsListener'
557
+ });
558
+ });
559
+ it('sends connect before ROAP answer when inbound offer is delayed', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
560
+ var _mock$calls$find3;
561
+ var mockStream, localAudioStream, call, handleOutgoingCallConnectSpy, delayedOffer, sendCallStateMachineEvtSpy, sendMediaStateMachineEvtSpy, roapListener;
433
562
  return _regenerator.default.wrap(function (_context9) {
434
563
  while (1) switch (_context9.prev = _context9.next) {
564
+ case 0:
565
+ mockStream = {
566
+ outputStream: {
567
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
568
+ },
569
+ on: jest.fn(),
570
+ getEffectByKind: jest.fn().mockImplementation(function () {
571
+ return mockEffect;
572
+ })
573
+ };
574
+ localAudioStream = mockStream;
575
+ call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.INBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
576
+ webex.request.mockReturnValue({
577
+ statusCode: 200,
578
+ body: {
579
+ callId: 'mock-call-id'
580
+ }
581
+ });
582
+ call.sendCallStateMachineEvt({
583
+ type: 'E_RECV_CALL_SETUP',
584
+ data: {
585
+ seq: 1,
586
+ messageType: 'OFFER'
587
+ }
588
+ });
589
+ expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
590
+ _context9.next = 1;
591
+ return call.answer(localAudioStream);
592
+ case 1:
593
+ expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
594
+
595
+ // Connect is attempted by answer(), but is deferred because offer is not buffered yet.
596
+ handleOutgoingCallConnectSpy = jest.spyOn(call, 'handleOutgoingCallConnect');
597
+ expect(call['connectPending']).toBe(true);
598
+ expect(call['mediaConnection'].roapMessageReceived).not.toHaveBeenCalled();
599
+ delayedOffer = {
600
+ seq: 1,
601
+ messageType: 'OFFER',
602
+ sdp: 'v=0',
603
+ version: 1
604
+ };
605
+ call.sendMediaStateMachineEvt({
606
+ type: 'E_RECV_ROAP_OFFER',
607
+ data: delayedOffer
608
+ });
609
+ _context9.next = 2;
610
+ return (0, _testUtil.flushPromises)(2);
611
+ case 2:
612
+ expect(call['mediaConnection'].roapMessageReceived).toHaveBeenCalledWith(delayedOffer);
613
+ sendCallStateMachineEvtSpy = jest.spyOn(call, 'sendCallStateMachineEvt');
614
+ sendMediaStateMachineEvtSpy = jest.spyOn(call, 'sendMediaStateMachineEvt');
615
+ roapListener = (_mock$calls$find3 = call['mediaConnection'].on.mock.calls.find(function (_ref14) {
616
+ var _ref15 = (0, _slicedToArray2.default)(_ref14, 1),
617
+ eventName = _ref15[0];
618
+ return eventName === InternalMediaCoreModule.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND;
619
+ })) === null || _mock$calls$find3 === void 0 ? void 0 : _mock$calls$find3[1];
620
+ expect(roapListener).toBeDefined();
621
+ _context9.next = 3;
622
+ return roapListener({
623
+ roapMessage: {
624
+ messageType: 'ANSWER',
625
+ sdp: 'v=0',
626
+ seq: 1,
627
+ version: 2
628
+ }
629
+ });
630
+ case 3:
631
+ _context9.next = 4;
632
+ return (0, _testUtil.flushPromises)(2);
633
+ case 4:
634
+ // On ANSWER from media layer, connect is retried first, then ROAP answer is posted.
635
+ expect(sendCallStateMachineEvtSpy).toHaveBeenNthCalledWith(1, {
636
+ type: 'E_SEND_CALL_CONNECT'
637
+ });
638
+ expect(sendMediaStateMachineEvtSpy).toHaveBeenNthCalledWith(1, {
639
+ type: 'E_SEND_ROAP_ANSWER',
640
+ data: expect.objectContaining({
641
+ messageType: 'ANSWER'
642
+ })
643
+ });
644
+ expect(handleOutgoingCallConnectSpy).toHaveBeenCalled();
645
+ expect(call['mediaConnection'].roapMessageReceived).toHaveBeenLastCalledWith(delayedOffer);
646
+ expect(call['connectPending']).toBe(false);
647
+ case 5:
648
+ case "end":
649
+ return _context9.stop();
650
+ }
651
+ }, _callee9);
652
+ })));
653
+ it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
654
+ var mockStream, localAudioStream, onStreamSpy, onEffectSpy, offStreamSpy, offEffectSpy, call, updateLocalTracksSpy, bnrMetricSpy;
655
+ return _regenerator.default.wrap(function (_context0) {
656
+ while (1) switch (_context0.prev = _context0.next) {
435
657
  case 0:
436
658
  mockStream = {
437
659
  outputStream: {
@@ -487,7 +709,7 @@ describe('Call Tests', function () {
487
709
  });
488
710
  expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_DISABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
489
711
  call.end();
490
- _context9.next = 1;
712
+ _context0.next = 1;
491
713
  return (0, _Utils.waitForMsecs)(50);
492
714
  case 1:
493
715
  /* Checks for switching off the listeners on call disconnect */
@@ -498,14 +720,14 @@ describe('Call Tests', function () {
498
720
  expect(offEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Disabled, expect.any(Function));
499
721
  case 2:
500
722
  case "end":
501
- return _context9.stop();
723
+ return _context0.stop();
502
724
  }
503
- }, _callee9);
725
+ }, _callee0);
504
726
  })));
505
- it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
727
+ it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
506
728
  var mockStream, localAudioStream, warnSpy, call;
507
- return _regenerator.default.wrap(function (_context0) {
508
- while (1) switch (_context0.prev = _context0.next) {
729
+ return _regenerator.default.wrap(function (_context1) {
730
+ while (1) switch (_context1.prev = _context1.next) {
509
731
  case 0:
510
732
  mockStream = {
511
733
  outputStream: {
@@ -529,7 +751,7 @@ describe('Call Tests', function () {
529
751
  warnSpy = jest.spyOn(_Logger.default, 'warn');
530
752
  call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
531
753
  call.answer(localAudioStream);
532
- _context0.next = 1;
754
+ _context1.next = 1;
533
755
  return (0, _Utils.waitForMsecs)(50);
534
756
  case 1:
535
757
  expect(warnSpy).toBeCalledTimes(2);
@@ -544,14 +766,14 @@ describe('Call Tests', function () {
544
766
  expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
545
767
  case 2:
546
768
  case "end":
547
- return _context0.stop();
769
+ return _context1.stop();
548
770
  }
549
- }, _callee0);
771
+ }, _callee1);
550
772
  })));
551
- it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
773
+ it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
552
774
  var mockStream, localAudioStream, warnSpy, call;
553
- return _regenerator.default.wrap(function (_context1) {
554
- while (1) switch (_context1.prev = _context1.next) {
775
+ return _regenerator.default.wrap(function (_context10) {
776
+ while (1) switch (_context10.prev = _context10.next) {
555
777
  case 0:
556
778
  mockStream = {
557
779
  outputStream: {
@@ -563,7 +785,7 @@ describe('Call Tests', function () {
563
785
  warnSpy = jest.spyOn(_Logger.default, 'warn');
564
786
  call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
565
787
  call.dial(localAudioStream);
566
- _context1.next = 1;
788
+ _context10.next = 1;
567
789
  return (0, _Utils.waitForMsecs)(50);
568
790
  case 1:
569
791
  expect(warnSpy).toBeCalledTimes(1);
@@ -576,9 +798,9 @@ describe('Call Tests', function () {
576
798
  expect(webex.request).not.toBeCalledOnceWith();
577
799
  case 2:
578
800
  case "end":
579
- return _context1.stop();
801
+ return _context10.stop();
580
802
  }
581
- }, _callee1);
803
+ }, _callee10);
582
804
  })));
583
805
  it('update media after call creation with valid stream', function () {
584
806
  var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
@@ -652,10 +874,10 @@ describe('Call Tests', function () {
652
874
  method: 'dial'
653
875
  });
654
876
  });
655
- it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
877
+ it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
656
878
  var logSpy, callManager, mockStream, localAudioStream, call;
657
- return _regenerator.default.wrap(function (_context10) {
658
- while (1) switch (_context10.prev = _context10.next) {
879
+ return _regenerator.default.wrap(function (_context11) {
880
+ while (1) switch (_context11.prev = _context11.next) {
659
881
  case 0:
660
882
  logSpy = jest.spyOn(_Logger.default, 'info');
661
883
  webex.request.mockReturnValue({
@@ -731,9 +953,9 @@ describe('Call Tests', function () {
731
953
  expect(mockStream.setUserMuted).toBeCalledOnceWith(false);
732
954
  case 1:
733
955
  case "end":
734
- return _context10.stop();
956
+ return _context11.stop();
735
957
  }
736
- }, _callee10);
958
+ }, _callee11);
737
959
  })));
738
960
  describe('Guest Calling Flow Tests', function () {
739
961
  var dummyEvent = {
@@ -741,10 +963,10 @@ describe('Call Tests', function () {
741
963
  data: undefined
742
964
  };
743
965
  var call;
744
- it('outgoing call without guest calling must have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
966
+ it('outgoing call without guest calling must have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
745
967
  var requestSpy, requestArgs;
746
- return _regenerator.default.wrap(function (_context11) {
747
- while (1) switch (_context11.prev = _context11.next) {
968
+ return _regenerator.default.wrap(function (_context12) {
969
+ while (1) switch (_context12.prev = _context12.next) {
748
970
  case 0:
749
971
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
750
972
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -757,14 +979,14 @@ describe('Call Tests', function () {
757
979
  expect('callee' in requestArgs.body).toBe(true);
758
980
  case 1:
759
981
  case "end":
760
- return _context11.stop();
982
+ return _context12.stop();
761
983
  }
762
- }, _callee11);
984
+ }, _callee12);
763
985
  })));
764
- it('outgoing call for guest calling must not have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
986
+ it('outgoing call for guest calling must not have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
765
987
  var requestSpy, requestArgs;
766
- return _regenerator.default.wrap(function (_context12) {
767
- while (1) switch (_context12.prev = _context12.next) {
988
+ return _regenerator.default.wrap(function (_context13) {
989
+ while (1) switch (_context13.prev = _context13.next) {
768
990
  case 0:
769
991
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
770
992
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -777,9 +999,9 @@ describe('Call Tests', function () {
777
999
  expect('callee' in requestArgs.body).toBe(false);
778
1000
  case 1:
779
1001
  case "end":
780
- return _context12.stop();
1002
+ return _context13.stop();
781
1003
  }
782
- }, _callee12);
1004
+ }, _callee13);
783
1005
  })));
784
1006
  });
785
1007
  });
@@ -799,6 +1021,11 @@ describe('State Machine handler tests', function () {
799
1021
  var call;
800
1022
  var dtmfMock;
801
1023
  beforeEach(function () {
1024
+ _request.APIRequest.resetInstance();
1025
+ _request.APIRequest.getInstance({
1026
+ webex: webex,
1027
+ isMobiusSocketEnabled: false
1028
+ });
802
1029
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
803
1030
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
804
1031
  var dummy = 10;
@@ -812,10 +1039,10 @@ describe('State Machine handler tests', function () {
812
1039
 
813
1040
  // afterEach(() => call.removeAllListeners());
814
1041
 
815
- it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
1042
+ it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
816
1043
  var statusPayload, dummyEvent, funcSpy, logSpy;
817
- return _regenerator.default.wrap(function (_context13) {
818
- while (1) switch (_context13.prev = _context13.next) {
1044
+ return _regenerator.default.wrap(function (_context14) {
1045
+ while (1) switch (_context14.prev = _context14.next) {
819
1046
  case 0:
820
1047
  statusPayload = {
821
1048
  statusCode: 200,
@@ -835,7 +1062,7 @@ describe('State Machine handler tests', function () {
835
1062
  /* This is to flush all the promises from the Promise queue so that
836
1063
  * Jest.fakeTimers can advance time and also clear the promise Queue
837
1064
  */
838
- _context13.next = 1;
1065
+ _context14.next = 1;
839
1066
  return (0, _testUtil.flushPromises)(3);
840
1067
  case 1:
841
1068
  expect(setInterval).toHaveBeenCalledTimes(1);
@@ -851,14 +1078,14 @@ describe('State Machine handler tests', function () {
851
1078
  });
852
1079
  case 2:
853
1080
  case "end":
854
- return _context13.stop();
1081
+ return _context14.stop();
855
1082
  }
856
- }, _callee13);
1083
+ }, _callee14);
857
1084
  })));
858
- it('session refresh 401 emits token error and ends the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
1085
+ it('session refresh 401 emits token error and ends the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
859
1086
  var statusPayload, emitSpy, funcSpy;
860
- return _regenerator.default.wrap(function (_context14) {
861
- while (1) switch (_context14.prev = _context14.next) {
1087
+ return _regenerator.default.wrap(function (_context15) {
1088
+ while (1) switch (_context15.prev = _context15.next) {
862
1089
  case 0:
863
1090
  expect.assertions(4);
864
1091
  statusPayload = {
@@ -873,10 +1100,10 @@ describe('State Machine handler tests', function () {
873
1100
  funcSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(statusPayload);
874
1101
  call['handleCallEstablished']({});
875
1102
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
876
- _context14.next = 1;
1103
+ _context15.next = 1;
877
1104
  return _promise.default.resolve();
878
1105
  case 1:
879
- _context14.next = 2;
1106
+ _context15.next = 2;
880
1107
  return _promise.default.resolve();
881
1108
  case 2:
882
1109
  // clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
@@ -886,14 +1113,14 @@ describe('State Machine handler tests', function () {
886
1113
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
887
1114
  case 3:
888
1115
  case "end":
889
- return _context14.stop();
1116
+ return _context15.stop();
890
1117
  }
891
- }, _callee14);
1118
+ }, _callee15);
892
1119
  })));
893
- it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
1120
+ it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
894
1121
  var statusPayload, funcSpy;
895
- return _regenerator.default.wrap(function (_context15) {
896
- while (1) switch (_context15.prev = _context15.next) {
1122
+ return _regenerator.default.wrap(function (_context16) {
1123
+ while (1) switch (_context16.prev = _context16.next) {
897
1124
  case 0:
898
1125
  expect.assertions(4);
899
1126
  statusPayload = {
@@ -912,7 +1139,7 @@ describe('State Machine handler tests', function () {
912
1139
  /* This is to flush all the promises from the Promise queue so that
913
1140
  * Jest.fakeTimers can advance time and also clear the promise Queue
914
1141
  */
915
- _context15.next = 1;
1142
+ _context16.next = 1;
916
1143
  return (0, _testUtil.flushPromises)(2);
917
1144
  case 1:
918
1145
  // clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
@@ -921,14 +1148,14 @@ describe('State Machine handler tests', function () {
921
1148
  expect(funcSpy).toBeCalledTimes(1);
922
1149
  case 2:
923
1150
  case "end":
924
- return _context15.stop();
1151
+ return _context16.stop();
925
1152
  }
926
- }, _callee15);
1153
+ }, _callee16);
927
1154
  })));
928
- it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
1155
+ it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
929
1156
  var errorPayload, okPayload, scheduleKeepaliveSpy, postStatusSpy;
930
- return _regenerator.default.wrap(function (_context16) {
931
- while (1) switch (_context16.prev = _context16.next) {
1157
+ return _regenerator.default.wrap(function (_context17) {
1158
+ while (1) switch (_context17.prev = _context17.next) {
932
1159
  case 0:
933
1160
  errorPayload = {
934
1161
  statusCode: 500,
@@ -946,28 +1173,28 @@ describe('State Machine handler tests', function () {
946
1173
  call['handleCallEstablished']({});
947
1174
  }
948
1175
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
949
- _context16.next = 1;
1176
+ _context17.next = 1;
950
1177
  return (0, _testUtil.flushPromises)(2);
951
1178
  case 1:
952
1179
  expect(postStatusSpy).toHaveBeenCalledTimes(1);
953
1180
 
954
1181
  // Now advance by 1 second for the retry-after interval
955
1182
  jest.advanceTimersByTime(1000);
956
- _context16.next = 2;
1183
+ _context17.next = 2;
957
1184
  return (0, _testUtil.flushPromises)(2);
958
1185
  case 2:
959
1186
  expect(postStatusSpy).toHaveBeenCalledTimes(2);
960
1187
  expect(scheduleKeepaliveSpy).toHaveBeenCalledTimes(2);
961
1188
  case 3:
962
1189
  case "end":
963
- return _context16.stop();
1190
+ return _context17.stop();
964
1191
  }
965
- }, _callee16);
1192
+ }, _callee17);
966
1193
  })));
967
- it('scheduleCallKeepaliveInterval clears existing interval before creating new one', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
1194
+ it('scheduleCallKeepaliveInterval clears existing interval before creating new one', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
968
1195
  var firstTimer, secondTimer;
969
- return _regenerator.default.wrap(function (_context17) {
970
- while (1) switch (_context17.prev = _context17.next) {
1196
+ return _regenerator.default.wrap(function (_context18) {
1197
+ while (1) switch (_context18.prev = _context18.next) {
971
1198
  case 0:
972
1199
  jest.spyOn(global, 'setInterval');
973
1200
  jest.spyOn(global, 'clearInterval');
@@ -995,14 +1222,14 @@ describe('State Machine handler tests', function () {
995
1222
  expect(secondTimer).toBeDefined();
996
1223
  case 1:
997
1224
  case "end":
998
- return _context17.stop();
1225
+ return _context18.stop();
999
1226
  }
1000
- }, _callee17);
1227
+ }, _callee18);
1001
1228
  })));
1002
- it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
1229
+ it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1003
1230
  var errorPayload, warnSpy, postStatusSpy;
1004
- return _regenerator.default.wrap(function (_context18) {
1005
- while (1) switch (_context18.prev = _context18.next) {
1231
+ return _regenerator.default.wrap(function (_context19) {
1232
+ while (1) switch (_context19.prev = _context19.next) {
1006
1233
  case 0:
1007
1234
  errorPayload = {
1008
1235
  statusCode: 500,
@@ -1021,25 +1248,25 @@ describe('State Machine handler tests', function () {
1021
1248
 
1022
1249
  // Advance timer to trigger the first failure (uses DEFAULT_SESSION_TIMER)
1023
1250
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
1024
- _context18.next = 1;
1251
+ _context19.next = 1;
1025
1252
  return (0, _testUtil.flushPromises)(2);
1026
1253
  case 1:
1027
1254
  // Now advance by 1 second for each of the 4 retry attempts (retry-after: 1 second each)
1028
1255
  // Need to do this separately to allow state machine to process and create new intervals
1029
1256
  jest.advanceTimersByTime(1000);
1030
- _context18.next = 2;
1257
+ _context19.next = 2;
1031
1258
  return (0, _testUtil.flushPromises)(2);
1032
1259
  case 2:
1033
1260
  jest.advanceTimersByTime(1000);
1034
- _context18.next = 3;
1261
+ _context19.next = 3;
1035
1262
  return (0, _testUtil.flushPromises)(2);
1036
1263
  case 3:
1037
1264
  jest.advanceTimersByTime(1000);
1038
- _context18.next = 4;
1265
+ _context19.next = 4;
1039
1266
  return (0, _testUtil.flushPromises)(2);
1040
1267
  case 4:
1041
1268
  jest.advanceTimersByTime(1000);
1042
- _context18.next = 5;
1269
+ _context19.next = 5;
1043
1270
  return (0, _testUtil.flushPromises)(2);
1044
1271
  case 5:
1045
1272
  // The error handler should detect we're at max retry count and stop
@@ -1051,14 +1278,14 @@ describe('State Machine handler tests', function () {
1051
1278
  expect(call['callKeepaliveRetryCount']).toBe(4);
1052
1279
  case 6:
1053
1280
  case "end":
1054
- return _context18.stop();
1281
+ return _context19.stop();
1055
1282
  }
1056
- }, _callee18);
1283
+ }, _callee19);
1057
1284
  })));
1058
- it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1285
+ it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1059
1286
  var statusPayload, dummyEvent, postMediaSpy, deleteSpy, dummyOkEvent;
1060
- return _regenerator.default.wrap(function (_context19) {
1061
- while (1) switch (_context19.prev = _context19.next) {
1287
+ return _regenerator.default.wrap(function (_context20) {
1288
+ while (1) switch (_context20.prev = _context20.next) {
1062
1289
  case 0:
1063
1290
  statusPayload = {
1064
1291
  statusCode: 200,
@@ -1114,14 +1341,14 @@ describe('State Machine handler tests', function () {
1114
1341
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1115
1342
  case 1:
1116
1343
  case "end":
1117
- return _context19.stop();
1344
+ return _context20.stop();
1118
1345
  }
1119
- }, _callee19);
1346
+ }, _callee20);
1120
1347
  })));
1121
- it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1348
+ it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1122
1349
  var statusPayload, dummyEvent;
1123
- return _regenerator.default.wrap(function (_context20) {
1124
- while (1) switch (_context20.prev = _context20.next) {
1350
+ return _regenerator.default.wrap(function (_context21) {
1351
+ while (1) switch (_context21.prev = _context21.next) {
1125
1352
  case 0:
1126
1353
  call['direction'] = _types3.CallDirection.INBOUND;
1127
1354
  statusPayload = {
@@ -1139,7 +1366,7 @@ describe('State Machine handler tests', function () {
1139
1366
  webex.request.mockReturnValue(statusPayload);
1140
1367
  call.sendCallStateMachineEvt(dummyEvent);
1141
1368
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
1142
- _context20.next = 1;
1369
+ _context21.next = 1;
1143
1370
  return call['handleOutgoingCallConnect']({
1144
1371
  type: 'E_SEND_CALL_CONNECT'
1145
1372
  });
@@ -1153,14 +1380,14 @@ describe('State Machine handler tests', function () {
1153
1380
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1154
1381
  case 2:
1155
1382
  case "end":
1156
- return _context20.stop();
1383
+ return _context21.stop();
1157
1384
  }
1158
- }, _callee20);
1385
+ }, _callee21);
1159
1386
  })));
1160
- it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1387
+ it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1161
1388
  var callManager, statusPayload, call, dummyEvent, dummyOkEvent, emitSpy, startCallerIdSpy, mobiusProgressEvent;
1162
- return _regenerator.default.wrap(function (_context21) {
1163
- while (1) switch (_context21.prev = _context21.next) {
1389
+ return _regenerator.default.wrap(function (_context22) {
1390
+ while (1) switch (_context22.prev = _context22.next) {
1164
1391
  case 0:
1165
1392
  callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
1166
1393
  statusPayload = {
@@ -1254,14 +1481,14 @@ describe('State Machine handler tests', function () {
1254
1481
  expect(call.earlyMedia).not.toBe(true);
1255
1482
  case 1:
1256
1483
  case "end":
1257
- return _context21.stop();
1484
+ return _context22.stop();
1258
1485
  }
1259
- }, _callee21);
1486
+ }, _callee22);
1260
1487
  })));
1261
- it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1488
+ it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1262
1489
  var warnSpy, errorSpy, stateMachineSpy, statusPayload, roapMessage;
1263
- return _regenerator.default.wrap(function (_context22) {
1264
- while (1) switch (_context22.prev = _context22.next) {
1490
+ return _regenerator.default.wrap(function (_context23) {
1491
+ while (1) switch (_context23.prev = _context23.next) {
1265
1492
  case 0:
1266
1493
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1267
1494
  errorSpy = jest.spyOn(_Logger.default, 'error');
@@ -1288,7 +1515,7 @@ describe('State Machine handler tests', function () {
1288
1515
  webex.request.mockRejectedValueOnce({
1289
1516
  statusCode: 403
1290
1517
  }).mockResolvedValue(statusPayload);
1291
- _context22.next = 1;
1518
+ _context23.next = 1;
1292
1519
  return call['handleOutgoingCallConnect']({
1293
1520
  type: 'E_SEND_CALL_CONNECT'
1294
1521
  });
@@ -1299,14 +1526,14 @@ describe('State Machine handler tests', function () {
1299
1526
  expect(errorSpy).toBeCalledTimes(1);
1300
1527
  case 2:
1301
1528
  case "end":
1302
- return _context22.stop();
1529
+ return _context23.stop();
1303
1530
  }
1304
- }, _callee22);
1531
+ }, _callee23);
1305
1532
  })));
1306
- it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1533
+ it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
1307
1534
  var statusPayload, dummyEvent, postMediaSpy, logSpy, dummyOkEvent;
1308
- return _regenerator.default.wrap(function (_context23) {
1309
- while (1) switch (_context23.prev = _context23.next) {
1535
+ return _regenerator.default.wrap(function (_context24) {
1536
+ while (1) switch (_context24.prev = _context24.next) {
1310
1537
  case 0:
1311
1538
  statusPayload = {
1312
1539
  statusCode: 200,
@@ -1382,14 +1609,14 @@ describe('State Machine handler tests', function () {
1382
1609
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1383
1610
  case 1:
1384
1611
  case "end":
1385
- return _context23.stop();
1612
+ return _context24.stop();
1386
1613
  }
1387
- }, _callee23);
1614
+ }, _callee24);
1388
1615
  })));
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() {
1616
+ 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
1617
  var statusPayload, dummySetupEvent, dummyConnectEvent, dummyOfferEvent, dummyAnswerEvent, dummyOkEvent, postMediaSpy;
1391
- return _regenerator.default.wrap(function (_context24) {
1392
- while (1) switch (_context24.prev = _context24.next) {
1618
+ return _regenerator.default.wrap(function (_context25) {
1619
+ while (1) switch (_context25.prev = _context25.next) {
1393
1620
  case 0:
1394
1621
  statusPayload = {
1395
1622
  statusCode: 200,
@@ -1457,14 +1684,14 @@ describe('State Machine handler tests', function () {
1457
1684
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1458
1685
  case 1:
1459
1686
  case "end":
1460
- return _context24.stop();
1687
+ return _context25.stop();
1461
1688
  }
1462
- }, _callee24);
1689
+ }, _callee25);
1463
1690
  })));
1464
- it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
1691
+ it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1465
1692
  var statusPayload, dummyEvent;
1466
- return _regenerator.default.wrap(function (_context25) {
1467
- while (1) switch (_context25.prev = _context25.next) {
1693
+ return _regenerator.default.wrap(function (_context26) {
1694
+ while (1) switch (_context26.prev = _context26.next) {
1468
1695
  case 0:
1469
1696
  statusPayload = {
1470
1697
  statusCode: 200,
@@ -1503,14 +1730,14 @@ describe('State Machine handler tests', function () {
1503
1730
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1504
1731
  case 1:
1505
1732
  case "end":
1506
- return _context25.stop();
1733
+ return _context26.stop();
1507
1734
  }
1508
- }, _callee25);
1735
+ }, _callee26);
1509
1736
  })));
1510
- it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1737
+ it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1511
1738
  var statusPayload, dummyEvent, errorSpy;
1512
- return _regenerator.default.wrap(function (_context26) {
1513
- while (1) switch (_context26.prev = _context26.next) {
1739
+ return _regenerator.default.wrap(function (_context27) {
1740
+ while (1) switch (_context27.prev = _context27.next) {
1514
1741
  case 0:
1515
1742
  statusPayload = {
1516
1743
  statusCode: 403,
@@ -1527,25 +1754,31 @@ describe('State Machine handler tests', function () {
1527
1754
  webex.request.mockRejectedValueOnce(statusPayload);
1528
1755
  errorSpy = jest.spyOn(_Logger.default, 'error');
1529
1756
  call.sendCallStateMachineEvt(dummyEvent);
1530
- _context26.next = 1;
1757
+ _context27.next = 1;
1531
1758
  return (0, _testUtil.flushPromises)(3);
1532
1759
  case 1:
1760
+ _context27.next = 2;
1761
+ return _promise.default.resolve();
1762
+ case 2:
1763
+ _context27.next = 3;
1764
+ return _promise.default.resolve();
1765
+ case 3:
1533
1766
  expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
1534
1767
  expect(errorSpy).toHaveBeenCalled();
1535
1768
  expect(uploadLogsSpy).toHaveBeenCalledWith({
1536
1769
  correlationId: call.getCorrelationId(),
1537
1770
  callId: call.getCallId()
1538
1771
  });
1539
- case 2:
1772
+ case 4:
1540
1773
  case "end":
1541
- return _context26.stop();
1774
+ return _context27.stop();
1542
1775
  }
1543
- }, _callee26);
1776
+ }, _callee27);
1544
1777
  })));
1545
- it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1778
+ it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
1546
1779
  var statusPayload, dummyEvent, warnSpy;
1547
- return _regenerator.default.wrap(function (_context27) {
1548
- while (1) switch (_context27.prev = _context27.next) {
1780
+ return _regenerator.default.wrap(function (_context28) {
1781
+ while (1) switch (_context28.prev = _context28.next) {
1549
1782
  case 0:
1550
1783
  statusPayload = {
1551
1784
  statusCode: 403,
@@ -1564,12 +1797,18 @@ describe('State Machine handler tests', function () {
1564
1797
  webex.request.mockRejectedValue(statusPayload);
1565
1798
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1566
1799
  jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
1567
- _context27.next = 1;
1800
+ _context28.next = 1;
1568
1801
  return call['handleRoapEstablished']({}, dummyEvent);
1569
1802
  case 1:
1570
- _context27.next = 2;
1803
+ _context28.next = 2;
1571
1804
  return (0, _testUtil.flushPromises)(2);
1572
1805
  case 2:
1806
+ _context28.next = 3;
1807
+ return _promise.default.resolve();
1808
+ case 3:
1809
+ _context28.next = 4;
1810
+ return _promise.default.resolve();
1811
+ case 4:
1573
1812
  expect(call.isConnected()).toBe(false);
1574
1813
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1575
1814
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
@@ -1581,16 +1820,16 @@ describe('State Machine handler tests', function () {
1581
1820
  file: 'call',
1582
1821
  method: 'handleRoapError'
1583
1822
  });
1584
- case 3:
1823
+ case 5:
1585
1824
  case "end":
1586
- return _context27.stop();
1825
+ return _context28.stop();
1587
1826
  }
1588
- }, _callee27);
1827
+ }, _callee28);
1589
1828
  })));
1590
- it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
1829
+ it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
1591
1830
  var statusPayload, dummyEvent;
1592
- return _regenerator.default.wrap(function (_context28) {
1593
- while (1) switch (_context28.prev = _context28.next) {
1831
+ return _regenerator.default.wrap(function (_context29) {
1832
+ while (1) switch (_context29.prev = _context29.next) {
1594
1833
  case 0:
1595
1834
  statusPayload = {
1596
1835
  statusCode: 403,
@@ -1613,14 +1852,14 @@ describe('State Machine handler tests', function () {
1613
1852
  expect(_testUtil.mediaConnection.initiateOffer).toBeCalledOnceWith();
1614
1853
  case 1:
1615
1854
  case "end":
1616
- return _context28.stop();
1855
+ return _context29.stop();
1617
1856
  }
1618
- }, _callee28);
1857
+ }, _callee29);
1619
1858
  })));
1620
- it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
1859
+ it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
1621
1860
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1622
- return _regenerator.default.wrap(function (_context29) {
1623
- while (1) switch (_context29.prev = _context29.next) {
1861
+ return _regenerator.default.wrap(function (_context30) {
1862
+ while (1) switch (_context30.prev = _context30.next) {
1624
1863
  case 0:
1625
1864
  statusPayload = {
1626
1865
  statusCode: 503,
@@ -1642,7 +1881,7 @@ describe('State Machine handler tests', function () {
1642
1881
  }
1643
1882
  };
1644
1883
  call['connected'] = true;
1645
- _context29.next = 1;
1884
+ _context30.next = 1;
1646
1885
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1647
1886
  case 1:
1648
1887
  jest.advanceTimersByTime(1005);
@@ -1654,14 +1893,14 @@ describe('State Machine handler tests', function () {
1654
1893
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1655
1894
  case 2:
1656
1895
  case "end":
1657
- return _context29.stop();
1896
+ return _context30.stop();
1658
1897
  }
1659
- }, _callee29);
1898
+ }, _callee30);
1660
1899
  })));
1661
- it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
1900
+ it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1662
1901
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1663
- return _regenerator.default.wrap(function (_context30) {
1664
- while (1) switch (_context30.prev = _context30.next) {
1902
+ return _regenerator.default.wrap(function (_context31) {
1903
+ while (1) switch (_context31.prev = _context31.next) {
1665
1904
  case 0:
1666
1905
  statusPayload = {
1667
1906
  statusCode: 503,
@@ -1683,7 +1922,7 @@ describe('State Machine handler tests', function () {
1683
1922
  }
1684
1923
  };
1685
1924
  call['connected'] = false;
1686
- _context30.next = 1;
1925
+ _context31.next = 1;
1687
1926
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1688
1927
  case 1:
1689
1928
  jest.advanceTimersByTime(1005);
@@ -1694,14 +1933,14 @@ describe('State Machine handler tests', function () {
1694
1933
  expect(stateMachineSpy).not.toBeCalled();
1695
1934
  case 2:
1696
1935
  case "end":
1697
- return _context30.stop();
1936
+ return _context31.stop();
1698
1937
  }
1699
- }, _callee30);
1938
+ }, _callee31);
1700
1939
  })));
1701
- it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1940
+ it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1702
1941
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1703
- return _regenerator.default.wrap(function (_context31) {
1704
- while (1) switch (_context31.prev = _context31.next) {
1942
+ return _regenerator.default.wrap(function (_context32) {
1943
+ while (1) switch (_context32.prev = _context32.next) {
1705
1944
  case 0:
1706
1945
  statusPayload = {
1707
1946
  statusCode: 503,
@@ -1723,7 +1962,7 @@ describe('State Machine handler tests', function () {
1723
1962
  };
1724
1963
  call['connected'] = true;
1725
1964
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_OFFER';
1726
- _context31.next = 1;
1965
+ _context32.next = 1;
1727
1966
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1728
1967
  case 1:
1729
1968
  jest.advanceTimersByTime(1005);
@@ -1735,14 +1974,14 @@ describe('State Machine handler tests', function () {
1735
1974
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1736
1975
  case 2:
1737
1976
  case "end":
1738
- return _context31.stop();
1977
+ return _context32.stop();
1739
1978
  }
1740
- }, _callee31);
1979
+ }, _callee32);
1741
1980
  })));
1742
- it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1981
+ it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
1743
1982
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1744
- return _regenerator.default.wrap(function (_context32) {
1745
- while (1) switch (_context32.prev = _context32.next) {
1983
+ return _regenerator.default.wrap(function (_context33) {
1984
+ while (1) switch (_context33.prev = _context33.next) {
1746
1985
  case 0:
1747
1986
  statusPayload = {
1748
1987
  statusCode: 503,
@@ -1763,7 +2002,7 @@ describe('State Machine handler tests', function () {
1763
2002
  }
1764
2003
  };
1765
2004
  call['connected'] = false;
1766
- _context32.next = 1;
2005
+ _context33.next = 1;
1767
2006
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1768
2007
  case 1:
1769
2008
  jest.advanceTimersByTime(1005);
@@ -1775,14 +2014,14 @@ describe('State Machine handler tests', function () {
1775
2014
  expect(stateMachineSpy).not.toBeCalled();
1776
2015
  case 2:
1777
2016
  case "end":
1778
- return _context32.stop();
2017
+ return _context33.stop();
1779
2018
  }
1780
- }, _callee32);
2019
+ }, _callee33);
1781
2020
  })));
1782
- it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
2021
+ it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
1783
2022
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1784
- return _regenerator.default.wrap(function (_context33) {
1785
- while (1) switch (_context33.prev = _context33.next) {
2023
+ return _regenerator.default.wrap(function (_context34) {
2024
+ while (1) switch (_context34.prev = _context34.next) {
1786
2025
  case 0:
1787
2026
  statusPayload = {
1788
2027
  statusCode: 200,
@@ -1807,14 +2046,14 @@ describe('State Machine handler tests', function () {
1807
2046
  expect(stateMachineSpy).not.toHaveBeenCalled();
1808
2047
  case 1:
1809
2048
  case "end":
1810
- return _context33.stop();
2049
+ return _context34.stop();
1811
2050
  }
1812
- }, _callee33);
2051
+ }, _callee34);
1813
2052
  })));
1814
- it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
2053
+ it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
1815
2054
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1816
- return _regenerator.default.wrap(function (_context34) {
1817
- while (1) switch (_context34.prev = _context34.next) {
2055
+ return _regenerator.default.wrap(function (_context35) {
2056
+ while (1) switch (_context35.prev = _context35.next) {
1818
2057
  case 0:
1819
2058
  statusPayload = {
1820
2059
  statusCode: 503,
@@ -1836,7 +2075,7 @@ describe('State Machine handler tests', function () {
1836
2075
  };
1837
2076
  call['connected'] = true;
1838
2077
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
1839
- _context34.next = 1;
2078
+ _context35.next = 1;
1840
2079
  return call['handleRoapEstablished']({}, dummyEvent);
1841
2080
  case 1:
1842
2081
  jest.advanceTimersByTime(1005);
@@ -1848,14 +2087,14 @@ describe('State Machine handler tests', function () {
1848
2087
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1849
2088
  case 2:
1850
2089
  case "end":
1851
- return _context34.stop();
2090
+ return _context35.stop();
1852
2091
  }
1853
- }, _callee34);
2092
+ }, _callee35);
1854
2093
  })));
1855
- it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
2094
+ it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
1856
2095
  var statusPayload, stateMachineSpy, funcSpy, errorEvent;
1857
- return _regenerator.default.wrap(function (_context35) {
1858
- while (1) switch (_context35.prev = _context35.next) {
2096
+ return _regenerator.default.wrap(function (_context36) {
2097
+ while (1) switch (_context36.prev = _context36.next) {
1859
2098
  case 0:
1860
2099
  statusPayload = {
1861
2100
  statusCode: 403,
@@ -1878,14 +2117,14 @@ describe('State Machine handler tests', function () {
1878
2117
  expect(stateMachineSpy).not.toHaveBeenCalled();
1879
2118
  case 1:
1880
2119
  case "end":
1881
- return _context35.stop();
2120
+ return _context36.stop();
1882
2121
  }
1883
- }, _callee35);
2122
+ }, _callee36);
1884
2123
  })));
1885
- it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
2124
+ it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
1886
2125
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1887
- return _regenerator.default.wrap(function (_context36) {
1888
- while (1) switch (_context36.prev = _context36.next) {
2126
+ return _regenerator.default.wrap(function (_context37) {
2127
+ while (1) switch (_context37.prev = _context37.next) {
1889
2128
  case 0:
1890
2129
  statusPayload = {
1891
2130
  statusCode: 200,
@@ -1903,7 +2142,7 @@ describe('State Machine handler tests', function () {
1903
2142
  }
1904
2143
  };
1905
2144
  call['connected'] = false;
1906
- _context36.next = 1;
2145
+ _context37.next = 1;
1907
2146
  return call['handleRoapError']({}, errorEvent);
1908
2147
  case 1:
1909
2148
  expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
@@ -1919,14 +2158,14 @@ describe('State Machine handler tests', function () {
1919
2158
  });
1920
2159
  case 2:
1921
2160
  case "end":
1922
- return _context36.stop();
2161
+ return _context37.stop();
1923
2162
  }
1924
- }, _callee36);
2163
+ }, _callee37);
1925
2164
  })));
1926
- it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
2165
+ it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
1927
2166
  var statusPayload, warnSpy, postMediaSpy, setupEvent, connectEvent, offerEvent, answerEvent;
1928
- return _regenerator.default.wrap(function (_context37) {
1929
- while (1) switch (_context37.prev = _context37.next) {
2167
+ return _regenerator.default.wrap(function (_context38) {
2168
+ while (1) switch (_context38.prev = _context38.next) {
1930
2169
  case 0:
1931
2170
  statusPayload = {
1932
2171
  statusCode: 403,
@@ -1964,12 +2203,18 @@ describe('State Machine handler tests', function () {
1964
2203
  messageType: 'ANSWER'
1965
2204
  }
1966
2205
  };
1967
- _context37.next = 1;
2206
+ _context38.next = 1;
1968
2207
  return call.sendMediaStateMachineEvt(answerEvent);
1969
2208
  case 1:
1970
- _context37.next = 2;
2209
+ _context38.next = 2;
1971
2210
  return (0, _testUtil.flushPromises)(2);
1972
2211
  case 2:
2212
+ _context38.next = 3;
2213
+ return _promise.default.resolve();
2214
+ case 3:
2215
+ _context38.next = 4;
2216
+ return _promise.default.resolve();
2217
+ case 4:
1973
2218
  expect(postMediaSpy).toBeCalledOnceWith(answerEvent.data);
1974
2219
  expect(warnSpy).toHaveBeenCalledWith('Failed to send MediaAnswer request', {
1975
2220
  file: 'call',
@@ -1983,16 +2228,16 @@ describe('State Machine handler tests', function () {
1983
2228
  // Final state should be torn down and cleared for unconnected call
1984
2229
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1985
2230
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
1986
- case 3:
2231
+ case 5:
1987
2232
  case "end":
1988
- return _context37.stop();
2233
+ return _context38.stop();
1989
2234
  }
1990
- }, _callee37);
2235
+ }, _callee38);
1991
2236
  })));
1992
- it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
2237
+ it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
1993
2238
  var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
1994
- return _regenerator.default.wrap(function (_context38) {
1995
- while (1) switch (_context38.prev = _context38.next) {
2239
+ return _regenerator.default.wrap(function (_context39) {
2240
+ while (1) switch (_context39.prev = _context39.next) {
1996
2241
  case 0:
1997
2242
  statusPayload = {
1998
2243
  statusCode: 200,
@@ -2025,7 +2270,7 @@ describe('State Machine handler tests', function () {
2025
2270
  seq: 1,
2026
2271
  messageType: 'ANSWER'
2027
2272
  };
2028
- _context38.next = 1;
2273
+ _context39.next = 1;
2029
2274
  return call.sendMediaStateMachineEvt(dummyEvent);
2030
2275
  case 1:
2031
2276
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -2047,7 +2292,7 @@ describe('State Machine handler tests', function () {
2047
2292
  seq: 2,
2048
2293
  messageType: 'OFFER_REQUEST'
2049
2294
  };
2050
- _context38.next = 2;
2295
+ _context39.next = 2;
2051
2296
  return call.sendMediaStateMachineEvt(dummyEvent);
2052
2297
  case 2:
2053
2298
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -2097,7 +2342,7 @@ describe('State Machine handler tests', function () {
2097
2342
  };
2098
2343
  call.sendCallStateMachineEvt(dummyEvent);
2099
2344
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2100
- _context38.next = 3;
2345
+ _context39.next = 3;
2101
2346
  return call.sendMediaStateMachineEvt(dummyEvent);
2102
2347
  case 3:
2103
2348
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2106,7 +2351,7 @@ describe('State Machine handler tests', function () {
2106
2351
  seq: 3,
2107
2352
  messageType: 'ANSWER'
2108
2353
  };
2109
- _context38.next = 4;
2354
+ _context39.next = 4;
2110
2355
  return call.sendMediaStateMachineEvt(dummyEvent);
2111
2356
  case 4:
2112
2357
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2125,7 +2370,7 @@ describe('State Machine handler tests', function () {
2125
2370
  messageType: 'OK'
2126
2371
  }
2127
2372
  };
2128
- _context38.next = 5;
2373
+ _context39.next = 5;
2129
2374
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2130
2375
  case 5:
2131
2376
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
@@ -2140,14 +2385,14 @@ describe('State Machine handler tests', function () {
2140
2385
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2141
2386
  case 6:
2142
2387
  case "end":
2143
- return _context38.stop();
2388
+ return _context39.stop();
2144
2389
  }
2145
- }, _callee38);
2390
+ }, _callee39);
2146
2391
  })));
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() {
2392
+ 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
2393
  var mockStatusBody, statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
2149
- return _regenerator.default.wrap(function (_context39) {
2150
- while (1) switch (_context39.prev = _context39.next) {
2394
+ return _regenerator.default.wrap(function (_context40) {
2395
+ while (1) switch (_context40.prev = _context40.next) {
2151
2396
  case 0:
2152
2397
  mockStatusBody = {
2153
2398
  device: {
@@ -2187,7 +2432,7 @@ describe('State Machine handler tests', function () {
2187
2432
  seq: 1,
2188
2433
  messageType: 'ANSWER'
2189
2434
  };
2190
- _context39.next = 1;
2435
+ _context40.next = 1;
2191
2436
  return call.sendMediaStateMachineEvt(dummyEvent);
2192
2437
  case 1:
2193
2438
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -2209,7 +2454,7 @@ describe('State Machine handler tests', function () {
2209
2454
  seq: 2,
2210
2455
  messageType: 'OFFER_REQUEST'
2211
2456
  };
2212
- _context39.next = 2;
2457
+ _context40.next = 2;
2213
2458
  return call.sendMediaStateMachineEvt(dummyEvent);
2214
2459
  case 2:
2215
2460
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -2259,7 +2504,7 @@ describe('State Machine handler tests', function () {
2259
2504
  };
2260
2505
  call.sendCallStateMachineEvt(dummyEvent);
2261
2506
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2262
- _context39.next = 3;
2507
+ _context40.next = 3;
2263
2508
  return call.sendMediaStateMachineEvt(dummyEvent);
2264
2509
  case 3:
2265
2510
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2268,7 +2513,7 @@ describe('State Machine handler tests', function () {
2268
2513
  seq: 3,
2269
2514
  messageType: 'ANSWER'
2270
2515
  };
2271
- _context39.next = 4;
2516
+ _context40.next = 4;
2272
2517
  return call.sendMediaStateMachineEvt(dummyEvent);
2273
2518
  case 4:
2274
2519
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2285,7 +2530,7 @@ describe('State Machine handler tests', function () {
2285
2530
  }
2286
2531
  };
2287
2532
  call.sendMediaStateMachineEvt(dummyEvent);
2288
- _context39.next = 5;
2533
+ _context40.next = 5;
2289
2534
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2290
2535
  case 5:
2291
2536
  expect(call['receivedRoapOKSeq']).toBe(3);
@@ -2301,14 +2546,14 @@ describe('State Machine handler tests', function () {
2301
2546
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2302
2547
  case 6:
2303
2548
  case "end":
2304
- return _context39.stop();
2549
+ return _context40.stop();
2305
2550
  }
2306
- }, _callee39);
2551
+ }, _callee40);
2307
2552
  })));
2308
- it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
2553
+ it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2309
2554
  var statusPayload, dummyEvent, postMediaSpy, infoSpy, dummyOkEvent;
2310
- return _regenerator.default.wrap(function (_context40) {
2311
- while (1) switch (_context40.prev = _context40.next) {
2555
+ return _regenerator.default.wrap(function (_context41) {
2556
+ while (1) switch (_context41.prev = _context41.next) {
2312
2557
  case 0:
2313
2558
  statusPayload = {
2314
2559
  statusCode: 200,
@@ -2369,20 +2614,20 @@ describe('State Machine handler tests', function () {
2369
2614
  dummyEvent.data = undefined;
2370
2615
  call.sendCallStateMachineEvt(dummyEvent);
2371
2616
  expect(call['callStateMachine'].state.value).toBe('S_CALL_HOLD');
2372
- expect(infoSpy).toHaveBeenLastCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
2617
+ expect(infoSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
2373
2618
  file: 'call',
2374
2619
  method: 'handleCallHold'
2375
2620
  });
2376
2621
  case 1:
2377
2622
  case "end":
2378
- return _context40.stop();
2623
+ return _context41.stop();
2379
2624
  }
2380
- }, _callee40);
2625
+ }, _callee41);
2381
2626
  })));
2382
- it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2627
+ it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
2383
2628
  var emitSpy, deleteSpy;
2384
- return _regenerator.default.wrap(function (_context41) {
2385
- while (1) switch (_context41.prev = _context41.next) {
2629
+ return _regenerator.default.wrap(function (_context42) {
2630
+ while (1) switch (_context42.prev = _context42.next) {
2386
2631
  case 0:
2387
2632
  emitSpy = jest.spyOn(call, 'emit');
2388
2633
  deleteSpy = jest.spyOn(call, 'delete').mockResolvedValue({
@@ -2391,7 +2636,7 @@ describe('State Machine handler tests', function () {
2391
2636
  call.sendCallStateMachineEvt({
2392
2637
  type: 'E_RECV_CALL_DISCONNECT'
2393
2638
  });
2394
- _context41.next = 1;
2639
+ _context42.next = 1;
2395
2640
  return (0, _testUtil.flushPromises)(1);
2396
2641
  case 1:
2397
2642
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
@@ -2399,9 +2644,9 @@ describe('State Machine handler tests', function () {
2399
2644
  expect(emitSpy.mock.invocationCallOrder[0]).toBeLessThan(deleteSpy.mock.invocationCallOrder[0]);
2400
2645
  case 2:
2401
2646
  case "end":
2402
- return _context41.stop();
2647
+ return _context42.stop();
2403
2648
  }
2404
- }, _callee41);
2649
+ }, _callee42);
2405
2650
  })));
2406
2651
  describe('Call event timers tests', function () {
2407
2652
  var callManager;
@@ -2412,10 +2657,10 @@ describe('State Machine handler tests', function () {
2412
2657
  afterEach(function () {
2413
2658
  jest.clearAllTimers();
2414
2659
  });
2415
- it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
2660
+ it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
2416
2661
  var statusPayload, dummyEvent, logSpy, emitSpy, deleteSpy, dummyOkEvent;
2417
- return _regenerator.default.wrap(function (_context42) {
2418
- while (1) switch (_context42.prev = _context42.next) {
2662
+ return _regenerator.default.wrap(function (_context43) {
2663
+ while (1) switch (_context43.prev = _context43.next) {
2419
2664
  case 0:
2420
2665
  statusPayload = {
2421
2666
  statusCode: 200,
@@ -2432,7 +2677,7 @@ describe('State Machine handler tests', function () {
2432
2677
  webex.request.mockReturnValue(statusPayload);
2433
2678
 
2434
2679
  // handleOutgoingCallSetup is asynchronous
2435
- _context42.next = 1;
2680
+ _context43.next = 1;
2436
2681
  return call.sendCallStateMachineEvt(dummyEvent);
2437
2682
  case 1:
2438
2683
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
@@ -2475,14 +2720,14 @@ describe('State Machine handler tests', function () {
2475
2720
  expect(callManager.callCollection).toStrictEqual({});
2476
2721
  case 2:
2477
2722
  case "end":
2478
- return _context42.stop();
2723
+ return _context43.stop();
2479
2724
  }
2480
- }, _callee42);
2725
+ }, _callee43);
2481
2726
  })));
2482
- it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
2727
+ it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
2483
2728
  var statusPayload, dummyEvent, call, emitSpy, deleteSpy, logSpy;
2484
- return _regenerator.default.wrap(function (_context43) {
2485
- while (1) switch (_context43.prev = _context43.next) {
2729
+ return _regenerator.default.wrap(function (_context44) {
2730
+ while (1) switch (_context44.prev = _context44.next) {
2486
2731
  case 0:
2487
2732
  statusPayload = {
2488
2733
  statusCode: 200,
@@ -2501,7 +2746,7 @@ describe('State Machine handler tests', function () {
2501
2746
  expect((0, _keys.default)(callManager.callCollection)[0]).toBe(call.getCorrelationId());
2502
2747
 
2503
2748
  // handleOutgoingCallSetup is asynchronous
2504
- _context43.next = 1;
2749
+ _context44.next = 1;
2505
2750
  return call.sendCallStateMachineEvt(dummyEvent);
2506
2751
  case 1:
2507
2752
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
@@ -2513,9 +2758,9 @@ describe('State Machine handler tests', function () {
2513
2758
  expect(callManager.callCollection).toStrictEqual({});
2514
2759
  case 2:
2515
2760
  case "end":
2516
- return _context43.stop();
2761
+ return _context44.stop();
2517
2762
  }
2518
- }, _callee43);
2763
+ }, _callee44);
2519
2764
  })));
2520
2765
  });
2521
2766
  });
@@ -2534,6 +2779,11 @@ describe('Supplementary Services tests', function () {
2534
2779
  };
2535
2780
  var call;
2536
2781
  beforeEach(function () {
2782
+ _request.APIRequest.resetInstance();
2783
+ _request.APIRequest.getInstance({
2784
+ webex: webex,
2785
+ isMobiusSocketEnabled: false
2786
+ });
2537
2787
  /* Since we are not actually testing from the start of a call , so it's good to set the below
2538
2788
  * parameters manually
2539
2789
  */
@@ -2575,10 +2825,10 @@ describe('Supplementary Services tests', function () {
2575
2825
  beforeEach(function () {
2576
2826
  call.removeAllListeners();
2577
2827
  });
2578
- it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
2828
+ it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
2579
2829
  var responsePayload, warnSpy, roapEvent;
2580
- return _regenerator.default.wrap(function (_context45) {
2581
- while (1) switch (_context45.prev = _context45.next) {
2830
+ return _regenerator.default.wrap(function (_context46) {
2831
+ while (1) switch (_context46.prev = _context46.next) {
2582
2832
  case 0:
2583
2833
  expect.assertions(7);
2584
2834
  responsePayload = {
@@ -2591,25 +2841,25 @@ describe('Supplementary Services tests', function () {
2591
2841
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2592
2842
  call['held'] = false;
2593
2843
  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) {
2844
+ var _ref54 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45(correlationId) {
2845
+ return _regenerator.default.wrap(function (_context45) {
2846
+ while (1) switch (_context45.prev = _context45.next) {
2597
2847
  case 0:
2598
2848
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2599
2849
  case 1:
2600
2850
  case "end":
2601
- return _context44.stop();
2851
+ return _context45.stop();
2602
2852
  }
2603
- }, _callee44);
2853
+ }, _callee45);
2604
2854
  }));
2605
2855
  return function (_x) {
2606
- return _ref45.apply(this, arguments);
2856
+ return _ref54.apply(this, arguments);
2607
2857
  };
2608
2858
  }());
2609
- _context45.next = 1;
2859
+ _context46.next = 1;
2610
2860
  return call.doHoldResume();
2611
2861
  case 1:
2612
- _context45.next = 2;
2862
+ _context46.next = 2;
2613
2863
  return (0, _testUtil.flushPromises)(2);
2614
2864
  case 2:
2615
2865
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2625,11 +2875,11 @@ describe('Supplementary Services tests', function () {
2625
2875
  call['handleIncomingRoapOffer']({}, dummyEvent);
2626
2876
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2627
2877
  roapEvent.data.type = 'ANSWER';
2628
- _context45.next = 3;
2878
+ _context46.next = 3;
2629
2879
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2630
2880
  case 3:
2631
2881
  roapEvent.data.type = 'OK';
2632
- _context45.next = 4;
2882
+ _context46.next = 4;
2633
2883
  return call['handleRoapEstablished']({}, dummyEvent);
2634
2884
  case 4:
2635
2885
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -2644,14 +2894,14 @@ describe('Supplementary Services tests', function () {
2644
2894
  });
2645
2895
  case 5:
2646
2896
  case "end":
2647
- return _context45.stop();
2897
+ return _context46.stop();
2648
2898
  }
2649
- }, _callee45);
2899
+ }, _callee46);
2650
2900
  })));
2651
- it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
2901
+ it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48() {
2652
2902
  var responsePayload, warnSpy, roapEvent;
2653
- return _regenerator.default.wrap(function (_context47) {
2654
- while (1) switch (_context47.prev = _context47.next) {
2903
+ return _regenerator.default.wrap(function (_context48) {
2904
+ while (1) switch (_context48.prev = _context48.next) {
2655
2905
  case 0:
2656
2906
  expect.assertions(8);
2657
2907
  responsePayload = {
@@ -2664,26 +2914,26 @@ describe('Supplementary Services tests', function () {
2664
2914
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2665
2915
  call['held'] = false;
2666
2916
  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) {
2917
+ var _ref56 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47(correlationId) {
2918
+ return _regenerator.default.wrap(function (_context47) {
2919
+ while (1) switch (_context47.prev = _context47.next) {
2670
2920
  case 0:
2671
2921
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2672
2922
  case 1:
2673
2923
  case "end":
2674
- return _context46.stop();
2924
+ return _context47.stop();
2675
2925
  }
2676
- }, _callee46);
2926
+ }, _callee47);
2677
2927
  }));
2678
2928
  return function (_x2) {
2679
- return _ref47.apply(this, arguments);
2929
+ return _ref56.apply(this, arguments);
2680
2930
  };
2681
2931
  }());
2682
2932
  call.doHoldResume();
2683
- _context47.next = 1;
2933
+ _context48.next = 1;
2684
2934
  return _promise.default.resolve();
2685
2935
  case 1:
2686
- _context47.next = 2;
2936
+ _context48.next = 2;
2687
2937
  return _promise.default.resolve();
2688
2938
  case 2:
2689
2939
  expect(setTimeout).not.toHaveBeenCalled();
@@ -2699,11 +2949,11 @@ describe('Supplementary Services tests', function () {
2699
2949
  call['handleIncomingRoapOffer']({}, dummyEvent);
2700
2950
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2701
2951
  roapEvent.data.type = 'ANSWER';
2702
- _context47.next = 3;
2952
+ _context48.next = 3;
2703
2953
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2704
2954
  case 3:
2705
2955
  roapEvent.data.type = 'OK';
2706
- _context47.next = 4;
2956
+ _context48.next = 4;
2707
2957
  return call['handleRoapEstablished']({}, dummyEvent);
2708
2958
  case 4:
2709
2959
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -2718,14 +2968,14 @@ describe('Supplementary Services tests', function () {
2718
2968
  });
2719
2969
  case 5:
2720
2970
  case "end":
2721
- return _context47.stop();
2971
+ return _context48.stop();
2722
2972
  }
2723
- }, _callee47);
2973
+ }, _callee48);
2724
2974
  })));
2725
- it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
2975
+ it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
2726
2976
  var responsePayload;
2727
- return _regenerator.default.wrap(function (_context49) {
2728
- while (1) switch (_context49.prev = _context49.next) {
2977
+ return _regenerator.default.wrap(function (_context50) {
2978
+ while (1) switch (_context50.prev = _context50.next) {
2729
2979
  case 0:
2730
2980
  expect.assertions(4);
2731
2981
  responsePayload = {
@@ -2735,26 +2985,26 @@ describe('Supplementary Services tests', function () {
2735
2985
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2736
2986
  call['held'] = false;
2737
2987
  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) {
2988
+ var _ref58 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49(errObj) {
2989
+ return _regenerator.default.wrap(function (_context49) {
2990
+ while (1) switch (_context49.prev = _context49.next) {
2741
2991
  case 0:
2742
2992
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2743
2993
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2744
2994
  case 1:
2745
2995
  case "end":
2746
- return _context48.stop();
2996
+ return _context49.stop();
2747
2997
  }
2748
- }, _callee48);
2998
+ }, _callee49);
2749
2999
  }));
2750
3000
  return function (_x3) {
2751
- return _ref49.apply(this, arguments);
3001
+ return _ref58.apply(this, arguments);
2752
3002
  };
2753
3003
  }());
2754
- _context49.next = 1;
3004
+ _context50.next = 1;
2755
3005
  return call.doHoldResume();
2756
3006
  case 1:
2757
- _context49.next = 2;
3007
+ _context50.next = 2;
2758
3008
  return (0, _testUtil.flushPromises)(2);
2759
3009
  case 2:
2760
3010
  expect(call.isHeld()).toStrictEqual(false);
@@ -2764,14 +3014,14 @@ describe('Supplementary Services tests', function () {
2764
3014
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2765
3015
  case 3:
2766
3016
  case "end":
2767
- return _context49.stop();
3017
+ return _context50.stop();
2768
3018
  }
2769
- }, _callee49);
3019
+ }, _callee50);
2770
3020
  })));
2771
- it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
3021
+ it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
2772
3022
  var responsePayload, rejectPayload, roapEvent;
2773
- return _regenerator.default.wrap(function (_context51) {
2774
- while (1) switch (_context51.prev = _context51.next) {
3023
+ return _regenerator.default.wrap(function (_context52) {
3024
+ while (1) switch (_context52.prev = _context52.next) {
2775
3025
  case 0:
2776
3026
  expect.assertions(5);
2777
3027
  responsePayload = {
@@ -2785,24 +3035,24 @@ describe('Supplementary Services tests', function () {
2785
3035
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2786
3036
  call['held'] = false;
2787
3037
  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) {
3038
+ var _ref60 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51(errObj) {
3039
+ return _regenerator.default.wrap(function (_context51) {
3040
+ while (1) switch (_context51.prev = _context51.next) {
2791
3041
  case 0:
2792
3042
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2793
3043
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2794
3044
  case 1:
2795
3045
  case "end":
2796
- return _context50.stop();
3046
+ return _context51.stop();
2797
3047
  }
2798
- }, _callee50);
3048
+ }, _callee51);
2799
3049
  }));
2800
3050
  return function (_x4) {
2801
- return _ref51.apply(this, arguments);
3051
+ return _ref60.apply(this, arguments);
2802
3052
  };
2803
3053
  }());
2804
3054
  call.doHoldResume();
2805
- _context51.next = 1;
3055
+ _context52.next = 1;
2806
3056
  return (0, _testUtil.flushPromises)(2);
2807
3057
  case 1:
2808
3058
  /* the Call State should transition to S_CALL_ESTABLISHED
@@ -2812,7 +3062,7 @@ describe('Supplementary Services tests', function () {
2812
3062
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2813
3063
  /* We are intentionally failing the ROAP ANSWER */
2814
3064
  roapEvent.data.type = 'ANSWER';
2815
- _context51.next = 2;
3065
+ _context52.next = 2;
2816
3066
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2817
3067
  case 2:
2818
3068
  expect(call.isHeld()).toStrictEqual(false);
@@ -2820,14 +3070,14 @@ describe('Supplementary Services tests', function () {
2820
3070
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2821
3071
  case 3:
2822
3072
  case "end":
2823
- return _context51.stop();
3073
+ return _context52.stop();
2824
3074
  }
2825
- }, _callee51);
3075
+ }, _callee52);
2826
3076
  })));
2827
- it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
3077
+ it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
2828
3078
  var responsePayload, warnSpy, roapEvent;
2829
- return _regenerator.default.wrap(function (_context52) {
2830
- while (1) switch (_context52.prev = _context52.next) {
3079
+ return _regenerator.default.wrap(function (_context53) {
3080
+ while (1) switch (_context53.prev = _context53.next) {
2831
3081
  case 0:
2832
3082
  responsePayload = {
2833
3083
  statusCode: 200,
@@ -2838,10 +3088,10 @@ describe('Supplementary Services tests', function () {
2838
3088
  jest.spyOn(global, 'clearTimeout');
2839
3089
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2840
3090
  call['held'] = false;
2841
- _context52.next = 1;
3091
+ _context53.next = 1;
2842
3092
  return call.doHoldResume();
2843
3093
  case 1:
2844
- _context52.next = 2;
3094
+ _context53.next = 2;
2845
3095
  return (0, _testUtil.flushPromises)(2);
2846
3096
  case 2:
2847
3097
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2856,19 +3106,19 @@ describe('Supplementary Services tests', function () {
2856
3106
  call['handleIncomingRoapOffer']({}, dummyEvent);
2857
3107
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2858
3108
  roapEvent.data.type = 'ANSWER';
2859
- _context52.next = 3;
3109
+ _context53.next = 3;
2860
3110
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2861
3111
  case 3:
2862
3112
  jest.spyOn(webex, 'request').mockRejectedValue({
2863
3113
  statusCode: 403
2864
3114
  });
2865
3115
  roapEvent.data.type = 'OK';
2866
- _context52.next = 4;
3116
+ _context53.next = 4;
2867
3117
  return call['handleRoapEstablished']({}, dummyEvent);
2868
3118
  case 4:
2869
3119
  /* this is for coverage */
2870
3120
  call['callStateMachine'].state.value = 'S_CALL_HOLD';
2871
- _context52.next = 5;
3121
+ _context53.next = 5;
2872
3122
  return call['handleRoapEstablished']({}, dummyEvent);
2873
3123
  case 5:
2874
3124
  expect(call.isHeld()).toStrictEqual(false);
@@ -2880,14 +3130,14 @@ describe('Supplementary Services tests', function () {
2880
3130
  });
2881
3131
  case 6:
2882
3132
  case "end":
2883
- return _context52.stop();
3133
+ return _context53.stop();
2884
3134
  }
2885
- }, _callee52);
3135
+ }, _callee53);
2886
3136
  })));
2887
- it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
3137
+ it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54() {
2888
3138
  var responsePayload, warnSpy, roapEvent;
2889
- return _regenerator.default.wrap(function (_context53) {
2890
- while (1) switch (_context53.prev = _context53.next) {
3139
+ return _regenerator.default.wrap(function (_context54) {
3140
+ while (1) switch (_context54.prev = _context54.next) {
2891
3141
  case 0:
2892
3142
  responsePayload = {
2893
3143
  statusCode: 200,
@@ -2898,10 +3148,10 @@ describe('Supplementary Services tests', function () {
2898
3148
  jest.spyOn(global, 'clearTimeout');
2899
3149
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2900
3150
  call['held'] = true;
2901
- _context53.next = 1;
3151
+ _context54.next = 1;
2902
3152
  return call.doHoldResume();
2903
3153
  case 1:
2904
- _context53.next = 2;
3154
+ _context54.next = 2;
2905
3155
  return (0, _testUtil.flushPromises)(2);
2906
3156
  case 2:
2907
3157
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2916,14 +3166,14 @@ describe('Supplementary Services tests', function () {
2916
3166
  call['handleIncomingRoapOffer']({}, dummyEvent);
2917
3167
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2918
3168
  roapEvent.data.type = 'ANSWER';
2919
- _context53.next = 3;
3169
+ _context54.next = 3;
2920
3170
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2921
3171
  case 3:
2922
3172
  jest.spyOn(webex, 'request').mockRejectedValue({
2923
3173
  statusCode: 403
2924
3174
  });
2925
3175
  roapEvent.data.type = 'OK';
2926
- _context53.next = 4;
3176
+ _context54.next = 4;
2927
3177
  return call['handleRoapEstablished']({}, dummyEvent);
2928
3178
  case 4:
2929
3179
  expect(call.isHeld()).toStrictEqual(true);
@@ -2935,14 +3185,14 @@ describe('Supplementary Services tests', function () {
2935
3185
  });
2936
3186
  case 5:
2937
3187
  case "end":
2938
- return _context53.stop();
3188
+ return _context54.stop();
2939
3189
  }
2940
- }, _callee53);
3190
+ }, _callee54);
2941
3191
  })));
2942
- it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
3192
+ it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56() {
2943
3193
  var responsePayload, roapEvent;
2944
- return _regenerator.default.wrap(function (_context55) {
2945
- while (1) switch (_context55.prev = _context55.next) {
3194
+ return _regenerator.default.wrap(function (_context56) {
3195
+ while (1) switch (_context56.prev = _context56.next) {
2946
3196
  case 0:
2947
3197
  expect.assertions(5);
2948
3198
  responsePayload = {
@@ -2952,25 +3202,25 @@ describe('Supplementary Services tests', function () {
2952
3202
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
2953
3203
  call['held'] = false;
2954
3204
  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) {
3205
+ var _ref64 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55(errObj) {
3206
+ return _regenerator.default.wrap(function (_context55) {
3207
+ while (1) switch (_context55.prev = _context55.next) {
2958
3208
  case 0:
2959
3209
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
2960
3210
  expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
2961
3211
  case 1:
2962
3212
  case "end":
2963
- return _context54.stop();
3213
+ return _context55.stop();
2964
3214
  }
2965
- }, _callee54);
3215
+ }, _callee55);
2966
3216
  }));
2967
3217
  return function (_x5) {
2968
- return _ref55.apply(this, arguments);
3218
+ return _ref64.apply(this, arguments);
2969
3219
  };
2970
3220
  }());
2971
3221
  jest.runAllTimers();
2972
3222
  call.doHoldResume();
2973
- _context55.next = 1;
3223
+ _context56.next = 1;
2974
3224
  return (0, _testUtil.flushPromises)(2);
2975
3225
  case 1:
2976
3226
  /* At this point, the Call State should be S_CALL_HOLD
@@ -2983,11 +3233,11 @@ describe('Supplementary Services tests', function () {
2983
3233
  call['handleIncomingRoapOffer']({}, dummyEvent);
2984
3234
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2985
3235
  roapEvent.data.type = 'ANSWER';
2986
- _context55.next = 2;
3236
+ _context56.next = 2;
2987
3237
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2988
3238
  case 2:
2989
3239
  roapEvent.data.type = 'OK';
2990
- _context55.next = 3;
3240
+ _context56.next = 3;
2991
3241
  return call['handleRoapEstablished']({}, dummyEvent);
2992
3242
  case 3:
2993
3243
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -2999,14 +3249,14 @@ describe('Supplementary Services tests', function () {
2999
3249
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3000
3250
  case 4:
3001
3251
  case "end":
3002
- return _context55.stop();
3252
+ return _context56.stop();
3003
3253
  }
3004
- }, _callee55);
3254
+ }, _callee56);
3005
3255
  })));
3006
- it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
3256
+ it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58() {
3007
3257
  var responsePayload, warnSpy, roapEvent;
3008
- return _regenerator.default.wrap(function (_context57) {
3009
- while (1) switch (_context57.prev = _context57.next) {
3258
+ return _regenerator.default.wrap(function (_context58) {
3259
+ while (1) switch (_context58.prev = _context58.next) {
3010
3260
  case 0:
3011
3261
  expect.assertions(7);
3012
3262
  responsePayload = {
@@ -3019,25 +3269,25 @@ describe('Supplementary Services tests', function () {
3019
3269
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3020
3270
  call['held'] = true;
3021
3271
  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) {
3272
+ var _ref66 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57(correlationId) {
3273
+ return _regenerator.default.wrap(function (_context57) {
3274
+ while (1) switch (_context57.prev = _context57.next) {
3025
3275
  case 0:
3026
3276
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3027
3277
  case 1:
3028
3278
  case "end":
3029
- return _context56.stop();
3279
+ return _context57.stop();
3030
3280
  }
3031
- }, _callee56);
3281
+ }, _callee57);
3032
3282
  }));
3033
3283
  return function (_x6) {
3034
- return _ref57.apply(this, arguments);
3284
+ return _ref66.apply(this, arguments);
3035
3285
  };
3036
3286
  }());
3037
- _context57.next = 1;
3287
+ _context58.next = 1;
3038
3288
  return call.doHoldResume();
3039
3289
  case 1:
3040
- _context57.next = 2;
3290
+ _context58.next = 2;
3041
3291
  return (0, _testUtil.flushPromises)(2);
3042
3292
  case 2:
3043
3293
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -3053,11 +3303,11 @@ describe('Supplementary Services tests', function () {
3053
3303
  call['handleIncomingRoapOffer']({}, dummyEvent);
3054
3304
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3055
3305
  roapEvent.data.type = 'ANSWER';
3056
- _context57.next = 3;
3306
+ _context58.next = 3;
3057
3307
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3058
3308
  case 3:
3059
3309
  roapEvent.data.type = 'OK';
3060
- _context57.next = 4;
3310
+ _context58.next = 4;
3061
3311
  return call['handleRoapEstablished']({}, dummyEvent);
3062
3312
  case 4:
3063
3313
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -3072,14 +3322,14 @@ describe('Supplementary Services tests', function () {
3072
3322
  });
3073
3323
  case 5:
3074
3324
  case "end":
3075
- return _context57.stop();
3325
+ return _context58.stop();
3076
3326
  }
3077
- }, _callee57);
3327
+ }, _callee58);
3078
3328
  })));
3079
- it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59() {
3329
+ it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60() {
3080
3330
  var responsePayload, warnSpy, roapEvent;
3081
- return _regenerator.default.wrap(function (_context59) {
3082
- while (1) switch (_context59.prev = _context59.next) {
3331
+ return _regenerator.default.wrap(function (_context60) {
3332
+ while (1) switch (_context60.prev = _context60.next) {
3083
3333
  case 0:
3084
3334
  expect.assertions(7);
3085
3335
  responsePayload = {
@@ -3092,26 +3342,26 @@ describe('Supplementary Services tests', function () {
3092
3342
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3093
3343
  call['held'] = true;
3094
3344
  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) {
3345
+ var _ref68 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59(correlationId) {
3346
+ return _regenerator.default.wrap(function (_context59) {
3347
+ while (1) switch (_context59.prev = _context59.next) {
3098
3348
  case 0:
3099
3349
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3100
3350
  case 1:
3101
3351
  case "end":
3102
- return _context58.stop();
3352
+ return _context59.stop();
3103
3353
  }
3104
- }, _callee58);
3354
+ }, _callee59);
3105
3355
  }));
3106
3356
  return function (_x7) {
3107
- return _ref59.apply(this, arguments);
3357
+ return _ref68.apply(this, arguments);
3108
3358
  };
3109
3359
  }());
3110
3360
  call.doHoldResume();
3111
- _context59.next = 1;
3361
+ _context60.next = 1;
3112
3362
  return _promise.default.resolve();
3113
3363
  case 1:
3114
- _context59.next = 2;
3364
+ _context60.next = 2;
3115
3365
  return _promise.default.resolve();
3116
3366
  case 2:
3117
3367
  expect(setTimeout).not.toHaveBeenCalled();
@@ -3127,11 +3377,11 @@ describe('Supplementary Services tests', function () {
3127
3377
  call['handleIncomingRoapOffer']({}, dummyEvent);
3128
3378
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3129
3379
  roapEvent.data.type = 'ANSWER';
3130
- _context59.next = 3;
3380
+ _context60.next = 3;
3131
3381
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3132
3382
  case 3:
3133
3383
  roapEvent.data.type = 'OK';
3134
- _context59.next = 4;
3384
+ _context60.next = 4;
3135
3385
  return call['handleRoapEstablished']({}, dummyEvent);
3136
3386
  case 4:
3137
3387
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -3146,14 +3396,14 @@ describe('Supplementary Services tests', function () {
3146
3396
  });
3147
3397
  case 5:
3148
3398
  case "end":
3149
- return _context59.stop();
3399
+ return _context60.stop();
3150
3400
  }
3151
- }, _callee59);
3401
+ }, _callee60);
3152
3402
  })));
3153
- it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61() {
3403
+ it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62() {
3154
3404
  var responsePayload;
3155
- return _regenerator.default.wrap(function (_context61) {
3156
- while (1) switch (_context61.prev = _context61.next) {
3405
+ return _regenerator.default.wrap(function (_context62) {
3406
+ while (1) switch (_context62.prev = _context62.next) {
3157
3407
  case 0:
3158
3408
  expect.assertions(4);
3159
3409
  responsePayload = {
@@ -3163,26 +3413,26 @@ describe('Supplementary Services tests', function () {
3163
3413
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3164
3414
  call['held'] = true;
3165
3415
  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) {
3416
+ var _ref70 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61(errObj) {
3417
+ return _regenerator.default.wrap(function (_context61) {
3418
+ while (1) switch (_context61.prev = _context61.next) {
3169
3419
  case 0:
3170
3420
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3171
3421
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3172
3422
  case 1:
3173
3423
  case "end":
3174
- return _context60.stop();
3424
+ return _context61.stop();
3175
3425
  }
3176
- }, _callee60);
3426
+ }, _callee61);
3177
3427
  }));
3178
3428
  return function (_x8) {
3179
- return _ref61.apply(this, arguments);
3429
+ return _ref70.apply(this, arguments);
3180
3430
  };
3181
3431
  }());
3182
- _context61.next = 1;
3432
+ _context62.next = 1;
3183
3433
  return call.doHoldResume();
3184
3434
  case 1:
3185
- _context61.next = 2;
3435
+ _context62.next = 2;
3186
3436
  return (0, _testUtil.flushPromises)(2);
3187
3437
  case 2:
3188
3438
  expect(call.isHeld()).toStrictEqual(true);
@@ -3193,14 +3443,14 @@ describe('Supplementary Services tests', function () {
3193
3443
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3194
3444
  case 3:
3195
3445
  case "end":
3196
- return _context61.stop();
3446
+ return _context62.stop();
3197
3447
  }
3198
- }, _callee61);
3448
+ }, _callee62);
3199
3449
  })));
3200
- it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
3450
+ it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64() {
3201
3451
  var responsePayload, rejectPayload, roapEvent;
3202
- return _regenerator.default.wrap(function (_context63) {
3203
- while (1) switch (_context63.prev = _context63.next) {
3452
+ return _regenerator.default.wrap(function (_context64) {
3453
+ while (1) switch (_context64.prev = _context64.next) {
3204
3454
  case 0:
3205
3455
  expect.assertions(5);
3206
3456
  responsePayload = {
@@ -3214,24 +3464,24 @@ describe('Supplementary Services tests', function () {
3214
3464
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
3215
3465
  call['held'] = true;
3216
3466
  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) {
3467
+ var _ref72 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63(errObj) {
3468
+ return _regenerator.default.wrap(function (_context63) {
3469
+ while (1) switch (_context63.prev = _context63.next) {
3220
3470
  case 0:
3221
3471
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3222
3472
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3223
3473
  case 1:
3224
3474
  case "end":
3225
- return _context62.stop();
3475
+ return _context63.stop();
3226
3476
  }
3227
- }, _callee62);
3477
+ }, _callee63);
3228
3478
  }));
3229
3479
  return function (_x9) {
3230
- return _ref63.apply(this, arguments);
3480
+ return _ref72.apply(this, arguments);
3231
3481
  };
3232
3482
  }());
3233
3483
  call.doHoldResume();
3234
- _context63.next = 1;
3484
+ _context64.next = 1;
3235
3485
  return (0, _testUtil.flushPromises)(2);
3236
3486
  case 1:
3237
3487
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
@@ -3242,7 +3492,7 @@ describe('Supplementary Services tests', function () {
3242
3492
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3243
3493
  /* We are intentionally failing the ROAP ANSWER */
3244
3494
  roapEvent.data.type = 'ANSWER';
3245
- _context63.next = 2;
3495
+ _context64.next = 2;
3246
3496
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3247
3497
  case 2:
3248
3498
  expect(call.isHeld()).toStrictEqual(true);
@@ -3250,14 +3500,14 @@ describe('Supplementary Services tests', function () {
3250
3500
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3251
3501
  case 3:
3252
3502
  case "end":
3253
- return _context63.stop();
3503
+ return _context64.stop();
3254
3504
  }
3255
- }, _callee63);
3505
+ }, _callee64);
3256
3506
  })));
3257
- it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65() {
3507
+ it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66() {
3258
3508
  var responsePayload, roapEvent;
3259
- return _regenerator.default.wrap(function (_context65) {
3260
- while (1) switch (_context65.prev = _context65.next) {
3509
+ return _regenerator.default.wrap(function (_context66) {
3510
+ while (1) switch (_context66.prev = _context66.next) {
3261
3511
  case 0:
3262
3512
  expect.assertions(5);
3263
3513
  responsePayload = {
@@ -3267,24 +3517,24 @@ describe('Supplementary Services tests', function () {
3267
3517
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
3268
3518
  call['held'] = true;
3269
3519
  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) {
3520
+ var _ref74 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65(errObj) {
3521
+ return _regenerator.default.wrap(function (_context65) {
3522
+ while (1) switch (_context65.prev = _context65.next) {
3273
3523
  case 0:
3274
3524
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
3275
3525
  expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
3276
3526
  case 1:
3277
3527
  case "end":
3278
- return _context64.stop();
3528
+ return _context65.stop();
3279
3529
  }
3280
- }, _callee64);
3530
+ }, _callee65);
3281
3531
  }));
3282
3532
  return function (_x0) {
3283
- return _ref65.apply(this, arguments);
3533
+ return _ref74.apply(this, arguments);
3284
3534
  };
3285
3535
  }());
3286
3536
  call.doHoldResume();
3287
- _context65.next = 1;
3537
+ _context66.next = 1;
3288
3538
  return (0, _testUtil.flushPromises)(2);
3289
3539
  case 1:
3290
3540
  /* At this point ,the Call State should be S_CALL_RESUME
@@ -3297,11 +3547,11 @@ describe('Supplementary Services tests', function () {
3297
3547
  call['handleIncomingRoapOffer']({}, dummyEvent);
3298
3548
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3299
3549
  roapEvent.data.type = 'ANSWER';
3300
- _context65.next = 2;
3550
+ _context66.next = 2;
3301
3551
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3302
3552
  case 2:
3303
3553
  roapEvent.data.type = 'OK';
3304
- _context65.next = 3;
3554
+ _context66.next = 3;
3305
3555
  return call['handleRoapEstablished']({}, dummyEvent);
3306
3556
  case 3:
3307
3557
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -3311,9 +3561,9 @@ describe('Supplementary Services tests', function () {
3311
3561
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3312
3562
  case 4:
3313
3563
  case "end":
3314
- return _context65.stop();
3564
+ return _context66.stop();
3315
3565
  }
3316
- }, _callee65);
3566
+ }, _callee66);
3317
3567
  })));
3318
3568
  });
3319
3569
  describe('Call transfer tests', function () {
@@ -3346,10 +3596,10 @@ describe('Supplementary Services tests', function () {
3346
3596
  secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
3347
3597
  secondCall['held'] = false;
3348
3598
  });
3349
- it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68() {
3599
+ it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69() {
3350
3600
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3351
- return _regenerator.default.wrap(function (_context68) {
3352
- while (1) switch (_context68.prev = _context68.next) {
3601
+ return _regenerator.default.wrap(function (_context69) {
3602
+ while (1) switch (_context69.prev = _context69.next) {
3353
3603
  case 0:
3354
3604
  expect.assertions(12); // Updated to match actual assertion count
3355
3605
  responsePayload = {
@@ -3361,41 +3611,41 @@ describe('Supplementary Services tests', function () {
3361
3611
  infoSpy = jest.spyOn(_Logger.default, 'info');
3362
3612
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3363
3613
  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) {
3614
+ var _ref76 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67(correlationId) {
3615
+ return _regenerator.default.wrap(function (_context67) {
3616
+ while (1) switch (_context67.prev = _context67.next) {
3367
3617
  case 0:
3368
3618
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3369
3619
  case 1:
3370
3620
  case "end":
3371
- return _context66.stop();
3621
+ return _context67.stop();
3372
3622
  }
3373
- }, _callee66);
3623
+ }, _callee67);
3374
3624
  }));
3375
3625
  return function (_x1) {
3376
- return _ref67.apply(this, arguments);
3626
+ return _ref76.apply(this, arguments);
3377
3627
  };
3378
3628
  }());
3379
3629
  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) {
3630
+ var _ref77 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68(correlationId) {
3631
+ return _regenerator.default.wrap(function (_context68) {
3632
+ while (1) switch (_context68.prev = _context68.next) {
3383
3633
  case 0:
3384
3634
  expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
3385
3635
  case 1:
3386
3636
  case "end":
3387
- return _context67.stop();
3637
+ return _context68.stop();
3388
3638
  }
3389
- }, _callee67);
3639
+ }, _callee68);
3390
3640
  }));
3391
3641
  return function (_x10) {
3392
- return _ref68.apply(this, arguments);
3642
+ return _ref77.apply(this, arguments);
3393
3643
  };
3394
3644
  }());
3395
- _context68.next = 1;
3645
+ _context69.next = 1;
3396
3646
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3397
3647
  case 1:
3398
- _context68.next = 2;
3648
+ _context69.next = 2;
3399
3649
  return (0, _testUtil.flushPromises)(2);
3400
3650
  case 2:
3401
3651
  expect(requestSpy).toBeCalled();
@@ -3418,14 +3668,14 @@ describe('Supplementary Services tests', function () {
3418
3668
  expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3419
3669
  case 3:
3420
3670
  case "end":
3421
- return _context68.stop();
3671
+ return _context69.stop();
3422
3672
  }
3423
- }, _callee68);
3673
+ }, _callee69);
3424
3674
  })));
3425
- it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
3675
+ it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
3426
3676
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3427
- return _regenerator.default.wrap(function (_context70) {
3428
- while (1) switch (_context70.prev = _context70.next) {
3677
+ return _regenerator.default.wrap(function (_context71) {
3678
+ while (1) switch (_context71.prev = _context71.next) {
3429
3679
  case 0:
3430
3680
  expect.assertions(10); // Updated to match actual assertion count
3431
3681
  responsePayload = {
@@ -3437,25 +3687,25 @@ describe('Supplementary Services tests', function () {
3437
3687
  infoSpy = jest.spyOn(_Logger.default, 'info');
3438
3688
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3439
3689
  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) {
3690
+ var _ref79 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70(correlationId) {
3691
+ return _regenerator.default.wrap(function (_context70) {
3692
+ while (1) switch (_context70.prev = _context70.next) {
3443
3693
  case 0:
3444
3694
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3445
3695
  case 1:
3446
3696
  case "end":
3447
- return _context69.stop();
3697
+ return _context70.stop();
3448
3698
  }
3449
- }, _callee69);
3699
+ }, _callee70);
3450
3700
  }));
3451
3701
  return function (_x11) {
3452
- return _ref70.apply(this, arguments);
3702
+ return _ref79.apply(this, arguments);
3453
3703
  };
3454
3704
  }());
3455
- _context70.next = 1;
3705
+ _context71.next = 1;
3456
3706
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3457
3707
  case 1:
3458
- _context70.next = 2;
3708
+ _context71.next = 2;
3459
3709
  return (0, _testUtil.flushPromises)(2);
3460
3710
  case 2:
3461
3711
  expect(requestSpy).toBeCalled();
@@ -3474,14 +3724,14 @@ describe('Supplementary Services tests', function () {
3474
3724
  expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3475
3725
  case 3:
3476
3726
  case "end":
3477
- return _context70.stop();
3727
+ return _context71.stop();
3478
3728
  }
3479
- }, _callee70);
3729
+ }, _callee71);
3480
3730
  })));
3481
- it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
3731
+ it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3482
3732
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3483
- return _regenerator.default.wrap(function (_context71) {
3484
- while (1) switch (_context71.prev = _context71.next) {
3733
+ return _regenerator.default.wrap(function (_context72) {
3734
+ while (1) switch (_context72.prev = _context72.next) {
3485
3735
  case 0:
3486
3736
  responsePayload = {
3487
3737
  statusCode: 403,
@@ -3492,10 +3742,10 @@ describe('Supplementary Services tests', function () {
3492
3742
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3493
3743
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3494
3744
  call['broadworksCorrelationInfo'] = 'dummy-broadworks-correlation-info';
3495
- _context71.next = 1;
3745
+ _context72.next = 1;
3496
3746
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3497
3747
  case 1:
3498
- _context71.next = 2;
3748
+ _context72.next = 2;
3499
3749
  return (0, _testUtil.flushPromises)(1);
3500
3750
  case 2:
3501
3751
  expect(requestSpy).toBeCalled();
@@ -3516,14 +3766,14 @@ describe('Supplementary Services tests', function () {
3516
3766
  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
3767
  case 3:
3518
3768
  case "end":
3519
- return _context71.stop();
3769
+ return _context72.stop();
3520
3770
  }
3521
- }, _callee71);
3771
+ }, _callee72);
3522
3772
  })));
3523
- it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3773
+ it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
3524
3774
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3525
- return _regenerator.default.wrap(function (_context72) {
3526
- while (1) switch (_context72.prev = _context72.next) {
3775
+ return _regenerator.default.wrap(function (_context73) {
3776
+ while (1) switch (_context73.prev = _context73.next) {
3527
3777
  case 0:
3528
3778
  responsePayload = {
3529
3779
  statusCode: 403,
@@ -3533,10 +3783,10 @@ describe('Supplementary Services tests', function () {
3533
3783
  requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3534
3784
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3535
3785
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3536
- _context72.next = 1;
3786
+ _context73.next = 1;
3537
3787
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3538
3788
  case 1:
3539
- _context72.next = 2;
3789
+ _context73.next = 2;
3540
3790
  return (0, _testUtil.flushPromises)(2);
3541
3791
  case 2:
3542
3792
  expect(requestSpy).toBeCalled();
@@ -3557,18 +3807,18 @@ describe('Supplementary Services tests', function () {
3557
3807
  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
3808
  case 3:
3559
3809
  case "end":
3560
- return _context72.stop();
3810
+ return _context73.stop();
3561
3811
  }
3562
- }, _callee72);
3812
+ }, _callee73);
3563
3813
  })));
3564
- it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
3814
+ it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee74() {
3565
3815
  var requestSpy, warnSpy;
3566
- return _regenerator.default.wrap(function (_context73) {
3567
- while (1) switch (_context73.prev = _context73.next) {
3816
+ return _regenerator.default.wrap(function (_context74) {
3817
+ while (1) switch (_context74.prev = _context74.next) {
3568
3818
  case 0:
3569
3819
  requestSpy = jest.spyOn(webex, 'request');
3570
3820
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3571
- _context73.next = 1;
3821
+ _context74.next = 1;
3572
3822
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
3573
3823
  case 1:
3574
3824
  /* We should be in CALL_ESTABLISHED state */
@@ -3580,18 +3830,18 @@ describe('Supplementary Services tests', function () {
3580
3830
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3581
3831
  case 2:
3582
3832
  case "end":
3583
- return _context73.stop();
3833
+ return _context74.stop();
3584
3834
  }
3585
- }, _callee73);
3835
+ }, _callee74);
3586
3836
  })));
3587
- it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee74() {
3837
+ it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee75() {
3588
3838
  var requestSpy, warnSpy;
3589
- return _regenerator.default.wrap(function (_context74) {
3590
- while (1) switch (_context74.prev = _context74.next) {
3839
+ return _regenerator.default.wrap(function (_context75) {
3840
+ while (1) switch (_context75.prev = _context75.next) {
3591
3841
  case 0:
3592
3842
  requestSpy = jest.spyOn(webex, 'request');
3593
3843
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3594
- _context74.next = 1;
3844
+ _context75.next = 1;
3595
3845
  return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
3596
3846
  case 1:
3597
3847
  /* We should be in CALL_ESTABLISHED state */
@@ -3603,9 +3853,9 @@ describe('Supplementary Services tests', function () {
3603
3853
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3604
3854
  case 2:
3605
3855
  case "end":
3606
- return _context74.stop();
3856
+ return _context75.stop();
3607
3857
  }
3608
- }, _callee74);
3858
+ }, _callee75);
3609
3859
  })));
3610
3860
  });
3611
3861
  });