@webex/calling 3.10.0-next.12 → 3.10.0-next.14

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 (90) hide show
  1. package/dist/CallHistory/CallHistory.js +118 -124
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +189 -201
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallSettings/CallSettings.js +17 -18
  6. package/dist/CallSettings/CallSettings.js.map +1 -1
  7. package/dist/CallSettings/CallSettings.test.js +14 -14
  8. package/dist/CallSettings/CallSettings.test.js.map +1 -1
  9. package/dist/CallSettings/UcmBackendConnector.js +19 -20
  10. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  11. package/dist/CallSettings/UcmBackendConnector.test.js +32 -32
  12. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  13. package/dist/CallSettings/WxCallBackendConnector.js +135 -137
  14. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  15. package/dist/CallSettings/WxCallBackendConnector.test.js +145 -149
  16. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  17. package/dist/CallingClient/CallingClient.js +198 -201
  18. package/dist/CallingClient/CallingClient.js.map +1 -1
  19. package/dist/CallingClient/CallingClient.test.js +168 -168
  20. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  21. package/dist/CallingClient/calling/CallerId/index.js +7 -8
  22. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  23. package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
  24. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  25. package/dist/CallingClient/calling/call.js +647 -621
  26. package/dist/CallingClient/calling/call.js.map +1 -1
  27. package/dist/CallingClient/calling/call.test.js +602 -624
  28. package/dist/CallingClient/calling/call.test.js.map +1 -1
  29. package/dist/CallingClient/calling/callManager.js +15 -18
  30. package/dist/CallingClient/calling/callManager.js.map +1 -1
  31. package/dist/CallingClient/calling/callManager.test.js +113 -113
  32. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  33. package/dist/CallingClient/line/index.js +57 -74
  34. package/dist/CallingClient/line/index.js.map +1 -1
  35. package/dist/CallingClient/line/line.test.js +22 -22
  36. package/dist/CallingClient/line/line.test.js.map +1 -1
  37. package/dist/CallingClient/registration/register.js +293 -300
  38. package/dist/CallingClient/registration/register.js.map +1 -1
  39. package/dist/CallingClient/registration/register.test.js +246 -246
  40. package/dist/CallingClient/registration/register.test.js.map +1 -1
  41. package/dist/CallingClient/registration/webWorker.js +24 -24
  42. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  43. package/dist/CallingClient/registration/webWorker.test.js +20 -20
  44. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  45. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
  46. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
  47. package/dist/Contacts/ContactsClient.js +250 -253
  48. package/dist/Contacts/ContactsClient.js.map +1 -1
  49. package/dist/Contacts/ContactsClient.test.js +60 -60
  50. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  51. package/dist/Errors/catalog/CallError.js +7 -10
  52. package/dist/Errors/catalog/CallError.js.map +1 -1
  53. package/dist/Errors/catalog/CallingDeviceError.js +6 -9
  54. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
  55. package/dist/Errors/catalog/ExtendedError.js +6 -8
  56. package/dist/Errors/catalog/ExtendedError.js.map +1 -1
  57. package/dist/Errors/catalog/LineError.js +6 -9
  58. package/dist/Errors/catalog/LineError.js.map +1 -1
  59. package/dist/Events/impl/index.js +11 -13
  60. package/dist/Events/impl/index.js.map +1 -1
  61. package/dist/Metrics/index.js +1 -2
  62. package/dist/Metrics/index.js.map +1 -1
  63. package/dist/SDKConnector/index.js +1 -2
  64. package/dist/SDKConnector/index.js.map +1 -1
  65. package/dist/Voicemail/BroadworksBackendConnector.js +126 -127
  66. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  67. package/dist/Voicemail/BroadworksBackendConnector.test.js +98 -98
  68. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  69. package/dist/Voicemail/UcmBackendConnector.js +84 -85
  70. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  71. package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
  72. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
  73. package/dist/Voicemail/Voicemail.js +58 -61
  74. package/dist/Voicemail/Voicemail.js.map +1 -1
  75. package/dist/Voicemail/Voicemail.test.js +20 -20
  76. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  77. package/dist/Voicemail/WxCallBackendConnector.js +116 -117
  78. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  79. package/dist/Voicemail/WxCallBackendConnector.test.js +140 -140
  80. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  81. package/dist/common/Utils.js +168 -167
  82. package/dist/common/Utils.js.map +1 -1
  83. package/dist/common/Utils.test.js +120 -120
  84. package/dist/common/Utils.test.js.map +1 -1
  85. package/dist/common/testUtil.js +3 -3
  86. package/dist/common/testUtil.js.map +1 -1
  87. package/dist/module/CallingClient/calling/call.js +54 -45
  88. package/dist/types/CallingClient/calling/call.d.ts +3 -1
  89. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  90. package/package.json +2 -2
@@ -26,7 +26,7 @@ var _callManager = require("./callManager");
26
26
  var _Logger = _interopRequireDefault(require("../../Logger"));
27
27
  var _Errors = require("../../Errors");
28
28
  var _constants2 = require("../../common/constants");
29
- 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 _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
29
+ 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); }
30
30
  /* eslint-disable @typescript-eslint/no-explicit-any */
31
31
  /* eslint-disable dot-notation */
32
32
  /* eslint-disable @typescript-eslint/no-shadow */
@@ -136,7 +136,7 @@ describe('Call Tests', function () {
136
136
  });
137
137
  it('should log a warning when sending a digit fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
138
138
  var tone, errorMessage, mockMediaConnection, callManager, call, realMediaConnection, warnSpy, infoSpy;
139
- return _regenerator.default.wrap(function _callee$(_context) {
139
+ return _regenerator.default.wrap(function (_context) {
140
140
  while (1) switch (_context.prev = _context.next) {
141
141
  case 0:
142
142
  tone = '1';
@@ -171,14 +171,14 @@ describe('Call Tests', function () {
171
171
  // Restore the real mediaConnection object
172
172
  call.mediaConnection = realMediaConnection;
173
173
  call.end();
174
- _context.next = 16;
174
+ _context.next = 1;
175
175
  return (0, _Utils.waitForMsecs)(50);
176
- case 16:
176
+ case 1:
177
177
  // Need to add a small delay for Promise and callback to finish.
178
178
 
179
179
  /* After call ends, call manager should have 0 record */
180
180
  expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(0);
181
- case 17:
181
+ case 2:
182
182
  case "end":
183
183
  return _context.stop();
184
184
  }
@@ -186,7 +186,7 @@ describe('Call Tests', function () {
186
186
  })));
187
187
  it('delete call object when ending the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
188
188
  var callManager, mockStream, localAudioStream, call, infoSpy;
189
- return _regenerator.default.wrap(function _callee2$(_context2) {
189
+ return _regenerator.default.wrap(function (_context2) {
190
190
  while (1) switch (_context2.prev = _context2.next) {
191
191
  case 0:
192
192
  webex.request.mockReturnValue({
@@ -225,9 +225,9 @@ describe('Call Tests', function () {
225
225
  file: 'call',
226
226
  method: 'end'
227
227
  });
228
- _context2.next = 19;
228
+ _context2.next = 1;
229
229
  return (0, _Utils.waitForMsecs)(50);
230
- case 19:
230
+ case 1:
231
231
  // Need to add a small delay for Promise and callback to finish.
232
232
  expect(parseMediaQualityStatisticsMock).toHaveBeenCalledTimes(1);
233
233
  expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
@@ -236,7 +236,7 @@ describe('Call Tests', function () {
236
236
 
237
237
  /* After call ends, call manager should have 0 record */
238
238
  expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(0);
239
- case 24:
239
+ case 2:
240
240
  case "end":
241
241
  return _context2.stop();
242
242
  }
@@ -244,7 +244,7 @@ describe('Call Tests', function () {
244
244
  })));
245
245
  it('Check whether media requests succeed or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
246
246
  var mediaResponse, call, response;
247
- return _regenerator.default.wrap(function _callee3$(_context3) {
247
+ return _regenerator.default.wrap(function (_context3) {
248
248
  while (1) switch (_context3.prev = _context3.next) {
249
249
  case 0:
250
250
  webex.request.mockReturnValue({
@@ -268,12 +268,12 @@ describe('Call Tests', function () {
268
268
  }
269
269
  };
270
270
  call = callManager.createCall(_types3.CallDirection.INBOUND, deviceId, mockLineId, dest);
271
- _context3.next = 5;
271
+ _context3.next = 1;
272
272
  return call['postMedia']({});
273
- case 5:
273
+ case 1:
274
274
  response = _context3.sent;
275
275
  expect(response.body).toStrictEqual(mediaResponse.body);
276
- case 7:
276
+ case 2:
277
277
  case "end":
278
278
  return _context3.stop();
279
279
  }
@@ -281,18 +281,18 @@ describe('Call Tests', function () {
281
281
  })));
282
282
  it('check whether callerId midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
283
283
  var call;
284
- return _regenerator.default.wrap(function _callee4$(_context4) {
284
+ return _regenerator.default.wrap(function (_context4) {
285
285
  while (1) switch (_context4.prev = _context4.next) {
286
286
  case 0:
287
287
  call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
288
288
  call.handleMidCallEvent(dummyMidCallEvent);
289
- _context4.next = 4;
289
+ _context4.next = 1;
290
290
  return (0, _Utils.waitForMsecs)(50);
291
- case 4:
291
+ case 1:
292
292
  expect(call.getCallerInfo().name).toStrictEqual('Bob Marley');
293
293
  expect(call.getCallerInfo().num).toStrictEqual('5010');
294
294
  expect(call.getCallerInfo().avatarSrc).toBeFalsy();
295
- case 7:
295
+ case 2:
296
296
  case "end":
297
297
  return _context4.stop();
298
298
  }
@@ -300,55 +300,55 @@ describe('Call Tests', function () {
300
300
  })));
301
301
  it('check whether call midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
302
302
  var call, logSpy, corelationId;
303
- return _regenerator.default.wrap(function _callee5$(_context5) {
303
+ return _regenerator.default.wrap(function (_context5) {
304
304
  while (1) switch (_context5.prev = _context5.next) {
305
305
  case 0:
306
306
  call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
307
307
  dummyMidCallEvent.eventType = 'callState';
308
308
  logSpy = jest.spyOn(_Logger.default, 'log');
309
309
  call.handleMidCallEvent(dummyMidCallEvent);
310
- _context5.next = 6;
310
+ _context5.next = 1;
311
311
  return (0, _Utils.waitForMsecs)(50);
312
- case 6:
312
+ case 1:
313
313
  corelationId = call.getCorrelationId();
314
314
  expect(logSpy).toHaveBeenLastCalledWith("Received Midcall call event for correlationId : ".concat(corelationId), {
315
315
  file: 'call',
316
316
  method: 'handleMidCallEvent'
317
317
  });
318
- case 8:
318
+ case 2:
319
319
  case "end":
320
320
  return _context5.stop();
321
321
  }
322
322
  }, _callee5);
323
323
  })));
324
324
  it('check call stats for active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
325
- var call, callRtpStats;
326
- return _regenerator.default.wrap(function _callee6$(_context6) {
325
+ var call, callRtpStats, _t;
326
+ return _regenerator.default.wrap(function (_context6) {
327
327
  while (1) switch (_context6.prev = _context6.next) {
328
328
  case 0:
329
329
  call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
330
330
  _context6.prev = 1;
331
- _context6.next = 4;
331
+ _context6.next = 2;
332
332
  return call.getCallRtpStats();
333
- case 4:
333
+ case 2:
334
334
  callRtpStats = _context6.sent;
335
- _context6.next = 10;
335
+ _context6.next = 4;
336
336
  break;
337
- case 7:
338
- _context6.prev = 7;
339
- _context6.t0 = _context6["catch"](1);
340
- console.error(_context6.t0);
341
- case 10:
337
+ case 3:
338
+ _context6.prev = 3;
339
+ _t = _context6["catch"](1);
340
+ console.error(_t);
341
+ case 4:
342
342
  expect(callRtpStats).toStrictEqual(disconnectStats);
343
- case 11:
343
+ case 5:
344
344
  case "end":
345
345
  return _context6.stop();
346
346
  }
347
- }, _callee6, null, [[1, 7]]);
347
+ }, _callee6, null, [[1, 3]]);
348
348
  })));
349
349
  it('dial functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
350
350
  var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy, logSpy;
351
- return _regenerator.default.wrap(function _callee7$(_context7) {
351
+ return _regenerator.default.wrap(function (_context7) {
352
352
  while (1) switch (_context7.prev = _context7.next) {
353
353
  case 0:
354
354
  mockStream = {
@@ -380,7 +380,7 @@ describe('Call Tests', function () {
380
380
  file: 'call',
381
381
  method: 'dial'
382
382
  });
383
- case 16:
383
+ case 1:
384
384
  case "end":
385
385
  return _context7.stop();
386
386
  }
@@ -388,7 +388,7 @@ describe('Call Tests', function () {
388
388
  })));
389
389
  it('answer functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
390
390
  var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy, infoSpy;
391
- return _regenerator.default.wrap(function _callee8$(_context8) {
391
+ return _regenerator.default.wrap(function (_context8) {
392
392
  while (1) switch (_context8.prev = _context8.next) {
393
393
  case 0:
394
394
  mockStream = {
@@ -421,7 +421,7 @@ describe('Call Tests', function () {
421
421
  call.answer(localAudioStream);
422
422
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
423
423
  expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
424
- case 16:
424
+ case 1:
425
425
  case "end":
426
426
  return _context8.stop();
427
427
  }
@@ -429,7 +429,7 @@ describe('Call Tests', function () {
429
429
  })));
430
430
  it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
431
431
  var mockStream, localAudioStream, onStreamSpy, onEffectSpy, offStreamSpy, offEffectSpy, call, updateLocalTracksSpy, bnrMetricSpy;
432
- return _regenerator.default.wrap(function _callee9$(_context9) {
432
+ return _regenerator.default.wrap(function (_context9) {
433
433
  while (1) switch (_context9.prev = _context9.next) {
434
434
  case 0:
435
435
  mockStream = {
@@ -486,16 +486,16 @@ describe('Call Tests', function () {
486
486
  });
487
487
  expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_DISABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
488
488
  call.end();
489
- _context9.next = 35;
489
+ _context9.next = 1;
490
490
  return (0, _Utils.waitForMsecs)(50);
491
- case 35:
491
+ case 1:
492
492
  /* Checks for switching off the listeners on call disconnect */
493
493
  expect(offStreamSpy).toBeCalledTimes(2);
494
494
  expect(offStreamSpy).toBeCalledWith(InternalMediaCoreModule.LocalStreamEventNames.OutputTrackChange, expect.any(Function));
495
495
  expect(offStreamSpy).toBeCalledWith(InternalMediaCoreModule.LocalStreamEventNames.EffectAdded, expect.any(Function));
496
496
  expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Enabled, expect.any(Function));
497
497
  expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Disabled, expect.any(Function));
498
- case 40:
498
+ case 2:
499
499
  case "end":
500
500
  return _context9.stop();
501
501
  }
@@ -503,7 +503,7 @@ describe('Call Tests', function () {
503
503
  })));
504
504
  it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
505
505
  var mockStream, localAudioStream, warnSpy, call;
506
- return _regenerator.default.wrap(function _callee0$(_context0) {
506
+ return _regenerator.default.wrap(function (_context0) {
507
507
  while (1) switch (_context0.prev = _context0.next) {
508
508
  case 0:
509
509
  mockStream = {
@@ -528,9 +528,9 @@ describe('Call Tests', function () {
528
528
  warnSpy = jest.spyOn(_Logger.default, 'warn');
529
529
  call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
530
530
  call.answer(localAudioStream);
531
- _context0.next = 8;
531
+ _context0.next = 1;
532
532
  return (0, _Utils.waitForMsecs)(50);
533
- case 8:
533
+ case 1:
534
534
  expect(warnSpy).toBeCalledTimes(2);
535
535
  expect(warnSpy).toBeCalledWith("Did not find a local track while answering the call ".concat(call.getCorrelationId()), {
536
536
  file: 'call',
@@ -541,7 +541,7 @@ describe('Call Tests', function () {
541
541
  expect(call.getDisconnectReason().code).toBe(_types5.DisconnectCode.MEDIA_INACTIVITY);
542
542
  expect(call.getDisconnectReason().cause).toBe(_types5.DisconnectCause.MEDIA_INACTIVITY);
543
543
  expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
544
- case 15:
544
+ case 2:
545
545
  case "end":
546
546
  return _context0.stop();
547
547
  }
@@ -549,7 +549,7 @@ describe('Call Tests', function () {
549
549
  })));
550
550
  it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
551
551
  var mockStream, localAudioStream, warnSpy, call;
552
- return _regenerator.default.wrap(function _callee1$(_context1) {
552
+ return _regenerator.default.wrap(function (_context1) {
553
553
  while (1) switch (_context1.prev = _context1.next) {
554
554
  case 0:
555
555
  mockStream = {
@@ -562,9 +562,9 @@ describe('Call Tests', function () {
562
562
  warnSpy = jest.spyOn(_Logger.default, 'warn');
563
563
  call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
564
564
  call.dial(localAudioStream);
565
- _context1.next = 7;
565
+ _context1.next = 1;
566
566
  return (0, _Utils.waitForMsecs)(50);
567
- case 7:
567
+ case 1:
568
568
  expect(warnSpy).toBeCalledTimes(1);
569
569
  expect(warnSpy).toBeCalledWith("Did not find a local track while dialing the call ".concat(call.getCorrelationId()), {
570
570
  file: 'call',
@@ -573,7 +573,7 @@ describe('Call Tests', function () {
573
573
  expect(call['callStateMachine'].state.value).toBe('S_IDLE');
574
574
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_IDLE');
575
575
  expect(webex.request).not.toBeCalledOnceWith();
576
- case 12:
576
+ case 2:
577
577
  case "end":
578
578
  return _context1.stop();
579
579
  }
@@ -653,7 +653,7 @@ describe('Call Tests', function () {
653
653
  });
654
654
  it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
655
655
  var logSpy, callManager, mockStream, localAudioStream, call;
656
- return _regenerator.default.wrap(function _callee10$(_context10) {
656
+ return _regenerator.default.wrap(function (_context10) {
657
657
  while (1) switch (_context10.prev = _context10.next) {
658
658
  case 0:
659
659
  logSpy = jest.spyOn(_Logger.default, 'info');
@@ -728,7 +728,7 @@ describe('Call Tests', function () {
728
728
  call.mute(localAudioStream, _types5.MUTE_TYPE.USER);
729
729
  expect(call.isMuted()).toEqual(false);
730
730
  expect(mockStream.setUserMuted).toBeCalledOnceWith(false);
731
- case 37:
731
+ case 1:
732
732
  case "end":
733
733
  return _context10.stop();
734
734
  }
@@ -742,7 +742,7 @@ describe('Call Tests', function () {
742
742
  var call;
743
743
  it('outgoing call without guest calling must have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
744
744
  var requestSpy, requestArgs;
745
- return _regenerator.default.wrap(function _callee11$(_context11) {
745
+ return _regenerator.default.wrap(function (_context11) {
746
746
  while (1) switch (_context11.prev = _context11.next) {
747
747
  case 0:
748
748
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
@@ -754,7 +754,7 @@ describe('Call Tests', function () {
754
754
  call.sendCallStateMachineEvt(dummyEvent);
755
755
  requestArgs = requestSpy.mock.calls[0][0];
756
756
  expect('callee' in requestArgs.body).toBe(true);
757
- case 6:
757
+ case 1:
758
758
  case "end":
759
759
  return _context11.stop();
760
760
  }
@@ -762,7 +762,7 @@ describe('Call Tests', function () {
762
762
  })));
763
763
  it('outgoing call for guest calling must not have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
764
764
  var requestSpy, requestArgs;
765
- return _regenerator.default.wrap(function _callee12$(_context12) {
765
+ return _regenerator.default.wrap(function (_context12) {
766
766
  while (1) switch (_context12.prev = _context12.next) {
767
767
  case 0:
768
768
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
@@ -774,7 +774,7 @@ describe('Call Tests', function () {
774
774
  call.sendCallStateMachineEvt(dummyEvent);
775
775
  requestArgs = requestSpy.mock.calls[0][0];
776
776
  expect('callee' in requestArgs.body).toBe(false);
777
- case 6:
777
+ case 1:
778
778
  case "end":
779
779
  return _context12.stop();
780
780
  }
@@ -813,7 +813,7 @@ describe('State Machine handler tests', function () {
813
813
 
814
814
  it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
815
815
  var statusPayload, dummyEvent, funcSpy, logSpy;
816
- return _regenerator.default.wrap(function _callee13$(_context13) {
816
+ return _regenerator.default.wrap(function (_context13) {
817
817
  while (1) switch (_context13.prev = _context13.next) {
818
818
  case 0:
819
819
  statusPayload = {
@@ -834,20 +834,21 @@ describe('State Machine handler tests', function () {
834
834
  /* This is to flush all the promises from the Promise queue so that
835
835
  * Jest.fakeTimers can advance time and also clear the promise Queue
836
836
  */
837
- _context13.next = 11;
837
+ _context13.next = 1;
838
838
  return (0, _testUtil.flushPromises)(3);
839
- case 11:
839
+ case 1:
840
840
  expect(setInterval).toHaveBeenCalledTimes(1);
841
+ expect(setInterval).toHaveBeenCalledWith(expect.any(Function), _constants.DEFAULT_SESSION_TIMER);
841
842
  expect(funcSpy).toBeCalledTimes(1);
842
843
  expect(logSpy).toBeCalledWith('Session refresh successful', {
843
844
  file: 'call',
844
- method: 'handleCallEstablished'
845
+ method: 'scheduleCallKeepaliveInterval'
845
846
  });
846
847
  expect(logSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
847
848
  file: 'call',
848
849
  method: 'handleCallEstablished'
849
850
  });
850
- case 15:
851
+ case 2:
851
852
  case "end":
852
853
  return _context13.stop();
853
854
  }
@@ -855,7 +856,7 @@ describe('State Machine handler tests', function () {
855
856
  })));
856
857
  it('session refresh 401 emits token error and ends the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
857
858
  var statusPayload, emitSpy, funcSpy;
858
- return _regenerator.default.wrap(function _callee14$(_context14) {
859
+ return _regenerator.default.wrap(function (_context14) {
859
860
  while (1) switch (_context14.prev = _context14.next) {
860
861
  case 0:
861
862
  expect.assertions(4);
@@ -871,16 +872,16 @@ describe('State Machine handler tests', function () {
871
872
  funcSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(statusPayload);
872
873
  call['handleCallEstablished']({});
873
874
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
874
- _context14.next = 11;
875
+ _context14.next = 1;
875
876
  return _promise.default.resolve();
876
- case 11:
877
- _context14.next = 13;
877
+ case 1:
878
+ _context14.next = 2;
878
879
  return _promise.default.resolve();
879
- case 13:
880
+ case 2:
880
881
  expect(clearInterval).toHaveBeenCalledTimes(1);
881
882
  expect(funcSpy).toBeCalledTimes(1);
882
883
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
883
- case 16:
884
+ case 3:
884
885
  case "end":
885
886
  return _context14.stop();
886
887
  }
@@ -888,7 +889,7 @@ describe('State Machine handler tests', function () {
888
889
  })));
889
890
  it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
890
891
  var statusPayload, funcSpy;
891
- return _regenerator.default.wrap(function _callee15$(_context15) {
892
+ return _regenerator.default.wrap(function (_context15) {
892
893
  while (1) switch (_context15.prev = _context15.next) {
893
894
  case 0:
894
895
  expect.assertions(4);
@@ -902,34 +903,26 @@ describe('State Machine handler tests', function () {
902
903
  expect(errObj.message).toStrictEqual('An unauthorized action has been received. This action has been blocked. Please contact the administrator if this persists.');
903
904
  });
904
905
  funcSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(statusPayload);
905
- if (call['sessionTimer'] === undefined) {
906
- /* In cases where this test is run independently/alone, there is no sessionTimer initiated
907
- Thus we will check and initialize the timer when not present by calling handleCallEstablish() */
908
- call['handleCallEstablished']({});
909
- }
910
906
  call['handleCallEstablished']({});
911
907
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
912
908
 
913
909
  /* This is to flush all the promises from the Promise queue so that
914
910
  * Jest.fakeTimers can advance time and also clear the promise Queue
915
911
  */
916
- _context15.next = 11;
917
- return _promise.default.resolve();
918
- case 11:
919
- _context15.next = 13;
920
- return _promise.default.resolve();
921
- case 13:
922
- expect(clearInterval).toHaveBeenCalledTimes(2); // check this
912
+ _context15.next = 1;
913
+ return (0, _testUtil.flushPromises)(2);
914
+ case 1:
915
+ expect(clearInterval).toHaveBeenCalledTimes(1);
923
916
  expect(funcSpy).toBeCalledTimes(1);
924
- case 15:
917
+ case 2:
925
918
  case "end":
926
919
  return _context15.stop();
927
920
  }
928
921
  }, _callee15);
929
922
  })));
930
923
  it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
931
- var errorPayload, okPayload, sendEvtSpy, postStatusSpy;
932
- return _regenerator.default.wrap(function _callee16$(_context16) {
924
+ var errorPayload, okPayload, scheduleKeepaliveSpy, postStatusSpy;
925
+ return _regenerator.default.wrap(function (_context16) {
933
926
  while (1) switch (_context16.prev = _context16.next) {
934
927
  case 0:
935
928
  errorPayload = {
@@ -942,53 +935,35 @@ describe('State Machine handler tests', function () {
942
935
  statusCode: 200,
943
936
  body: {}
944
937
  };
945
- sendEvtSpy = jest.spyOn(call, 'sendCallStateMachineEvt');
938
+ scheduleKeepaliveSpy = jest.spyOn(call, 'scheduleCallKeepaliveInterval');
946
939
  postStatusSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(errorPayload).mockResolvedValueOnce(okPayload);
947
940
  if (call['sessionTimer'] === undefined) {
948
941
  call['handleCallEstablished']({});
949
942
  }
950
943
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
951
- _context16.next = 8;
952
- return _promise.default.resolve();
953
- case 8:
954
- _context16.next = 10;
955
- return _promise.default.resolve();
956
- case 10:
944
+ _context16.next = 1;
945
+ return (0, _testUtil.flushPromises)(2);
946
+ case 1:
957
947
  expect(postStatusSpy).toHaveBeenCalledTimes(1);
958
- expect(sendEvtSpy).toHaveBeenCalledWith({
959
- type: 'E_CALL_ESTABLISHED'
960
- });
961
- case 12:
948
+
949
+ // Now advance by 1 second for the retry-after interval
950
+ jest.advanceTimersByTime(1000);
951
+ _context16.next = 2;
952
+ return (0, _testUtil.flushPromises)(2);
953
+ case 2:
954
+ expect(postStatusSpy).toHaveBeenCalledTimes(2);
955
+ expect(scheduleKeepaliveSpy).toHaveBeenCalledTimes(2);
956
+ case 3:
962
957
  case "end":
963
958
  return _context16.stop();
964
959
  }
965
960
  }, _callee16);
966
961
  })));
967
- it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
968
- var resolvePromise, errorPayload, warnSpy, postStatusSpy;
969
- return _regenerator.default.wrap(function _callee18$(_context18) {
970
- while (1) switch (_context18.prev = _context18.next) {
962
+ it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
963
+ var errorPayload, warnSpy, postStatusSpy;
964
+ return _regenerator.default.wrap(function (_context17) {
965
+ while (1) switch (_context17.prev = _context17.next) {
971
966
  case 0:
972
- resolvePromise = /*#__PURE__*/function () {
973
- var _ref18 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
974
- return _regenerator.default.wrap(function _callee17$(_context17) {
975
- while (1) switch (_context17.prev = _context17.next) {
976
- case 0:
977
- _context17.next = 2;
978
- return _promise.default.resolve();
979
- case 2:
980
- _context17.next = 4;
981
- return _promise.default.resolve();
982
- case 4:
983
- case "end":
984
- return _context17.stop();
985
- }
986
- }, _callee17);
987
- }));
988
- return function resolvePromise() {
989
- return _ref18.apply(this, arguments);
990
- };
991
- }();
992
967
  errorPayload = {
993
968
  statusCode: 500,
994
969
  headers: {
@@ -1006,41 +981,44 @@ describe('State Machine handler tests', function () {
1006
981
 
1007
982
  // Advance timer to trigger the first failure (uses DEFAULT_SESSION_TIMER)
1008
983
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
1009
- _context18.next = 11;
1010
- return resolvePromise();
1011
- case 11:
1012
- // Now advance by 1 second for each of the 3 more retry attempts (retry-after: 1 second each)
984
+ _context17.next = 1;
985
+ return (0, _testUtil.flushPromises)(2);
986
+ case 1:
987
+ // Now advance by 1 second for each of the 4 retry attempts (retry-after: 1 second each)
1013
988
  // Need to do this separately to allow state machine to process and create new intervals
1014
989
  jest.advanceTimersByTime(1000);
1015
- _context18.next = 14;
1016
- return resolvePromise();
1017
- case 14:
990
+ _context17.next = 2;
991
+ return (0, _testUtil.flushPromises)(2);
992
+ case 2:
993
+ jest.advanceTimersByTime(1000);
994
+ _context17.next = 3;
995
+ return (0, _testUtil.flushPromises)(2);
996
+ case 3:
1018
997
  jest.advanceTimersByTime(1000);
1019
- _context18.next = 17;
1020
- return resolvePromise();
1021
- case 17:
998
+ _context17.next = 4;
999
+ return (0, _testUtil.flushPromises)(2);
1000
+ case 4:
1022
1001
  jest.advanceTimersByTime(1000);
1023
- _context18.next = 20;
1024
- return resolvePromise();
1025
- case 20:
1002
+ _context17.next = 5;
1003
+ return (0, _testUtil.flushPromises)(2);
1004
+ case 5:
1026
1005
  // The error handler should detect we're at max retry count and stop
1027
- expect(warnSpy).toHaveBeenCalledWith("Max call keepalive retry attempts reached for call: ".concat(call.getCorrelationId()), {
1006
+ expect(warnSpy).toHaveBeenCalledWith("Max keepalive retry attempts reached. Aborting call keepalive for callId: ".concat(call.getCallId()), {
1028
1007
  file: 'call',
1029
- method: 'handleCallEstablished'
1008
+ method: 'keepaliveRetryCallback'
1030
1009
  });
1031
- expect(postStatusSpy).toHaveBeenCalledTimes(4);
1032
- expect(call['callKeepaliveRetryCount']).toBe(0);
1033
- expect(call['sessionTimer']).toBeUndefined();
1034
- case 24:
1010
+ expect(postStatusSpy).toHaveBeenCalledTimes(5);
1011
+ expect(call['callKeepaliveRetryCount']).toBe(4);
1012
+ case 6:
1035
1013
  case "end":
1036
- return _context18.stop();
1014
+ return _context17.stop();
1037
1015
  }
1038
- }, _callee18);
1016
+ }, _callee17);
1039
1017
  })));
1040
- it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1018
+ it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
1041
1019
  var statusPayload, dummyEvent, postMediaSpy, deleteSpy, dummyOkEvent;
1042
- return _regenerator.default.wrap(function _callee19$(_context19) {
1043
- while (1) switch (_context19.prev = _context19.next) {
1020
+ return _regenerator.default.wrap(function (_context18) {
1021
+ while (1) switch (_context18.prev = _context18.next) {
1044
1022
  case 0:
1045
1023
  statusPayload = {
1046
1024
  statusCode: 200,
@@ -1094,16 +1072,16 @@ describe('State Machine handler tests', function () {
1094
1072
  });
1095
1073
  expect(deleteSpy).toBeCalledOnceWith();
1096
1074
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1097
- case 27:
1075
+ case 1:
1098
1076
  case "end":
1099
- return _context19.stop();
1077
+ return _context18.stop();
1100
1078
  }
1101
- }, _callee19);
1079
+ }, _callee18);
1102
1080
  })));
1103
- it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1081
+ it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1104
1082
  var statusPayload, dummyEvent;
1105
- return _regenerator.default.wrap(function _callee20$(_context20) {
1106
- while (1) switch (_context20.prev = _context20.next) {
1083
+ return _regenerator.default.wrap(function (_context19) {
1084
+ while (1) switch (_context19.prev = _context19.next) {
1107
1085
  case 0:
1108
1086
  call['direction'] = _types3.CallDirection.INBOUND;
1109
1087
  statusPayload = {
@@ -1121,11 +1099,11 @@ describe('State Machine handler tests', function () {
1121
1099
  webex.request.mockReturnValue(statusPayload);
1122
1100
  call.sendCallStateMachineEvt(dummyEvent);
1123
1101
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
1124
- _context20.next = 8;
1102
+ _context19.next = 1;
1125
1103
  return call['handleOutgoingCallConnect']({
1126
1104
  type: 'E_SEND_CALL_CONNECT'
1127
1105
  });
1128
- case 8:
1106
+ case 1:
1129
1107
  /* state should not change since there is no offer received. */
1130
1108
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
1131
1109
  expect(call.isConnected()).toBeFalsy();
@@ -1133,16 +1111,16 @@ describe('State Machine handler tests', function () {
1133
1111
  type: 'E_RECV_CALL_DISCONNECT'
1134
1112
  });
1135
1113
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1136
- case 12:
1114
+ case 2:
1137
1115
  case "end":
1138
- return _context20.stop();
1116
+ return _context19.stop();
1139
1117
  }
1140
- }, _callee20);
1118
+ }, _callee19);
1141
1119
  })));
1142
- it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1120
+ it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1143
1121
  var warnSpy, errorSpy, stateMachineSpy, statusPayload, roapMessage;
1144
- return _regenerator.default.wrap(function _callee21$(_context21) {
1145
- while (1) switch (_context21.prev = _context21.next) {
1122
+ return _regenerator.default.wrap(function (_context20) {
1123
+ while (1) switch (_context20.prev = _context20.next) {
1146
1124
  case 0:
1147
1125
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1148
1126
  errorSpy = jest.spyOn(_Logger.default, 'error');
@@ -1169,25 +1147,25 @@ describe('State Machine handler tests', function () {
1169
1147
  webex.request.mockRejectedValueOnce({
1170
1148
  statusCode: 403
1171
1149
  }).mockResolvedValue(statusPayload);
1172
- _context21.next = 13;
1150
+ _context20.next = 1;
1173
1151
  return call['handleOutgoingCallConnect']({
1174
1152
  type: 'E_SEND_CALL_CONNECT'
1175
1153
  });
1176
- case 13:
1154
+ case 1:
1177
1155
  expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
1178
1156
  expect(stateMachineSpy).toBeCalledTimes(3);
1179
1157
  expect(warnSpy).toBeCalledTimes(3);
1180
1158
  expect(errorSpy).toBeCalledTimes(1);
1181
- case 17:
1159
+ case 2:
1182
1160
  case "end":
1183
- return _context21.stop();
1161
+ return _context20.stop();
1184
1162
  }
1185
- }, _callee21);
1163
+ }, _callee20);
1186
1164
  })));
1187
- it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1165
+ it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1188
1166
  var statusPayload, dummyEvent, postMediaSpy, logSpy, dummyOkEvent;
1189
- return _regenerator.default.wrap(function _callee22$(_context22) {
1190
- while (1) switch (_context22.prev = _context22.next) {
1167
+ return _regenerator.default.wrap(function (_context21) {
1168
+ while (1) switch (_context21.prev = _context21.next) {
1191
1169
  case 0:
1192
1170
  statusPayload = {
1193
1171
  statusCode: 200,
@@ -1261,16 +1239,16 @@ describe('State Machine handler tests', function () {
1261
1239
  type: 'E_SEND_CALL_DISCONNECT'
1262
1240
  });
1263
1241
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1264
- case 42:
1242
+ case 1:
1265
1243
  case "end":
1266
- return _context22.stop();
1244
+ return _context21.stop();
1267
1245
  }
1268
- }, _callee22);
1246
+ }, _callee21);
1269
1247
  })));
1270
- it('outgoing call where we receive connect directly after setup. Media established before connect. test call and media state changes', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1248
+ 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 _callee22() {
1271
1249
  var statusPayload, dummySetupEvent, dummyConnectEvent, dummyOfferEvent, dummyAnswerEvent, dummyOkEvent, postMediaSpy;
1272
- return _regenerator.default.wrap(function _callee23$(_context23) {
1273
- while (1) switch (_context23.prev = _context23.next) {
1250
+ return _regenerator.default.wrap(function (_context22) {
1251
+ while (1) switch (_context22.prev = _context22.next) {
1274
1252
  case 0:
1275
1253
  statusPayload = {
1276
1254
  statusCode: 200,
@@ -1336,16 +1314,16 @@ describe('State Machine handler tests', function () {
1336
1314
  type: 'E_SEND_CALL_DISCONNECT'
1337
1315
  });
1338
1316
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1339
- case 25:
1317
+ case 1:
1340
1318
  case "end":
1341
- return _context23.stop();
1319
+ return _context22.stop();
1342
1320
  }
1343
- }, _callee23);
1321
+ }, _callee22);
1344
1322
  })));
1345
- it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
1323
+ it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1346
1324
  var statusPayload, dummyEvent;
1347
- return _regenerator.default.wrap(function _callee24$(_context24) {
1348
- while (1) switch (_context24.prev = _context24.next) {
1325
+ return _regenerator.default.wrap(function (_context23) {
1326
+ while (1) switch (_context23.prev = _context23.next) {
1349
1327
  case 0:
1350
1328
  statusPayload = {
1351
1329
  statusCode: 200,
@@ -1382,16 +1360,16 @@ describe('State Machine handler tests', function () {
1382
1360
  type: 'E_RECV_CALL_DISCONNECT'
1383
1361
  });
1384
1362
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1385
- case 17:
1363
+ case 1:
1386
1364
  case "end":
1387
- return _context24.stop();
1365
+ return _context23.stop();
1388
1366
  }
1389
- }, _callee24);
1367
+ }, _callee23);
1390
1368
  })));
1391
- it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
1369
+ it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
1392
1370
  var statusPayload, dummyEvent, errorSpy;
1393
- return _regenerator.default.wrap(function _callee25$(_context25) {
1394
- while (1) switch (_context25.prev = _context25.next) {
1371
+ return _regenerator.default.wrap(function (_context24) {
1372
+ while (1) switch (_context24.prev = _context24.next) {
1395
1373
  case 0:
1396
1374
  statusPayload = {
1397
1375
  statusCode: 403,
@@ -1408,25 +1386,25 @@ describe('State Machine handler tests', function () {
1408
1386
  webex.request.mockRejectedValueOnce(statusPayload);
1409
1387
  errorSpy = jest.spyOn(_Logger.default, 'error');
1410
1388
  call.sendCallStateMachineEvt(dummyEvent);
1411
- _context25.next = 7;
1389
+ _context24.next = 1;
1412
1390
  return (0, _testUtil.flushPromises)(3);
1413
- case 7:
1391
+ case 1:
1414
1392
  expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
1415
1393
  expect(errorSpy).toHaveBeenCalled();
1416
1394
  expect(uploadLogsSpy).toHaveBeenCalledWith({
1417
1395
  correlationId: call.getCorrelationId(),
1418
1396
  callId: call.getCallId()
1419
1397
  });
1420
- case 10:
1398
+ case 2:
1421
1399
  case "end":
1422
- return _context25.stop();
1400
+ return _context24.stop();
1423
1401
  }
1424
- }, _callee25);
1402
+ }, _callee24);
1425
1403
  })));
1426
- it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1404
+ it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
1427
1405
  var statusPayload, dummyEvent, warnSpy;
1428
- return _regenerator.default.wrap(function _callee26$(_context26) {
1429
- while (1) switch (_context26.prev = _context26.next) {
1406
+ return _regenerator.default.wrap(function (_context25) {
1407
+ while (1) switch (_context25.prev = _context25.next) {
1430
1408
  case 0:
1431
1409
  statusPayload = {
1432
1410
  statusCode: 403,
@@ -1445,12 +1423,12 @@ describe('State Machine handler tests', function () {
1445
1423
  webex.request.mockRejectedValue(statusPayload);
1446
1424
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1447
1425
  jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
1448
- _context26.next = 10;
1426
+ _context25.next = 1;
1449
1427
  return call['handleRoapEstablished']({}, dummyEvent);
1450
- case 10:
1451
- _context26.next = 12;
1428
+ case 1:
1429
+ _context25.next = 2;
1452
1430
  return (0, _testUtil.flushPromises)(2);
1453
- case 12:
1431
+ case 2:
1454
1432
  expect(call.isConnected()).toBe(false);
1455
1433
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1456
1434
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
@@ -1462,16 +1440,16 @@ describe('State Machine handler tests', function () {
1462
1440
  file: 'call',
1463
1441
  method: 'handleRoapError'
1464
1442
  });
1465
- case 17:
1443
+ case 3:
1466
1444
  case "end":
1467
- return _context26.stop();
1445
+ return _context25.stop();
1468
1446
  }
1469
- }, _callee26);
1447
+ }, _callee25);
1470
1448
  })));
1471
- it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1449
+ it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1472
1450
  var statusPayload, dummyEvent;
1473
- return _regenerator.default.wrap(function _callee27$(_context27) {
1474
- while (1) switch (_context27.prev = _context27.next) {
1451
+ return _regenerator.default.wrap(function (_context26) {
1452
+ while (1) switch (_context26.prev = _context26.next) {
1475
1453
  case 0:
1476
1454
  statusPayload = {
1477
1455
  statusCode: 403,
@@ -1492,16 +1470,16 @@ describe('State Machine handler tests', function () {
1492
1470
  and an initiateOffer request to be sent to SDK only once */
1493
1471
  expect(call['mediaStateMachine'].state.value).toBe('S_SEND_ROAP_OFFER');
1494
1472
  expect(_testUtil.mediaConnection.initiateOffer).toBeCalledOnceWith();
1495
- case 8:
1473
+ case 1:
1496
1474
  case "end":
1497
- return _context27.stop();
1475
+ return _context26.stop();
1498
1476
  }
1499
- }, _callee27);
1477
+ }, _callee26);
1500
1478
  })));
1501
- it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
1479
+ it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1502
1480
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1503
- return _regenerator.default.wrap(function _callee28$(_context28) {
1504
- while (1) switch (_context28.prev = _context28.next) {
1481
+ return _regenerator.default.wrap(function (_context27) {
1482
+ while (1) switch (_context27.prev = _context27.next) {
1505
1483
  case 0:
1506
1484
  statusPayload = {
1507
1485
  statusCode: 503,
@@ -1523,9 +1501,9 @@ describe('State Machine handler tests', function () {
1523
1501
  }
1524
1502
  };
1525
1503
  call['connected'] = true;
1526
- _context28.next = 8;
1504
+ _context27.next = 1;
1527
1505
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1528
- case 8:
1506
+ case 1:
1529
1507
  jest.advanceTimersByTime(1005);
1530
1508
  expect(setTimeout).toHaveBeenCalledTimes(1);
1531
1509
  expect(funcSpy).toHaveBeenCalledWith(dummyEvent.data);
@@ -1533,16 +1511,16 @@ describe('State Machine handler tests', function () {
1533
1511
  /* first failure , and second because of retry-after */
1534
1512
  expect(funcSpy).toHaveBeenCalledTimes(2);
1535
1513
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1536
- case 13:
1514
+ case 2:
1537
1515
  case "end":
1538
- return _context28.stop();
1516
+ return _context27.stop();
1539
1517
  }
1540
- }, _callee28);
1518
+ }, _callee27);
1541
1519
  })));
1542
- it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
1520
+ it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
1543
1521
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1544
- return _regenerator.default.wrap(function _callee29$(_context29) {
1545
- while (1) switch (_context29.prev = _context29.next) {
1522
+ return _regenerator.default.wrap(function (_context28) {
1523
+ while (1) switch (_context28.prev = _context28.next) {
1546
1524
  case 0:
1547
1525
  statusPayload = {
1548
1526
  statusCode: 503,
@@ -1564,25 +1542,25 @@ describe('State Machine handler tests', function () {
1564
1542
  }
1565
1543
  };
1566
1544
  call['connected'] = false;
1567
- _context29.next = 8;
1545
+ _context28.next = 1;
1568
1546
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1569
- case 8:
1547
+ case 1:
1570
1548
  jest.advanceTimersByTime(1005);
1571
1549
  expect(funcSpy).toBeCalledOnceWith(dummyEvent.data);
1572
1550
 
1573
1551
  /* These shouldn't be called as call is not connected yet */
1574
1552
  expect(setTimeout).not.toHaveBeenCalled();
1575
1553
  expect(stateMachineSpy).not.toBeCalled();
1576
- case 12:
1554
+ case 2:
1577
1555
  case "end":
1578
- return _context29.stop();
1556
+ return _context28.stop();
1579
1557
  }
1580
- }, _callee29);
1558
+ }, _callee28);
1581
1559
  })));
1582
- it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
1560
+ it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
1583
1561
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1584
- return _regenerator.default.wrap(function _callee30$(_context30) {
1585
- while (1) switch (_context30.prev = _context30.next) {
1562
+ return _regenerator.default.wrap(function (_context29) {
1563
+ while (1) switch (_context29.prev = _context29.next) {
1586
1564
  case 0:
1587
1565
  statusPayload = {
1588
1566
  statusCode: 503,
@@ -1604,9 +1582,9 @@ describe('State Machine handler tests', function () {
1604
1582
  };
1605
1583
  call['connected'] = true;
1606
1584
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_OFFER';
1607
- _context30.next = 9;
1585
+ _context29.next = 1;
1608
1586
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1609
- case 9:
1587
+ case 1:
1610
1588
  jest.advanceTimersByTime(1005);
1611
1589
  expect(setTimeout).toHaveBeenCalledTimes(1);
1612
1590
  expect(funcSpy).toHaveBeenCalledWith(dummyEvent.data);
@@ -1614,16 +1592,16 @@ describe('State Machine handler tests', function () {
1614
1592
  /* first failure , and second because of retry-after */
1615
1593
  expect(funcSpy).toHaveBeenCalledTimes(2);
1616
1594
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1617
- case 14:
1595
+ case 2:
1618
1596
  case "end":
1619
- return _context30.stop();
1597
+ return _context29.stop();
1620
1598
  }
1621
- }, _callee30);
1599
+ }, _callee29);
1622
1600
  })));
1623
- it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1601
+ it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
1624
1602
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1625
- return _regenerator.default.wrap(function _callee31$(_context31) {
1626
- while (1) switch (_context31.prev = _context31.next) {
1603
+ return _regenerator.default.wrap(function (_context30) {
1604
+ while (1) switch (_context30.prev = _context30.next) {
1627
1605
  case 0:
1628
1606
  statusPayload = {
1629
1607
  statusCode: 503,
@@ -1644,9 +1622,9 @@ describe('State Machine handler tests', function () {
1644
1622
  }
1645
1623
  };
1646
1624
  call['connected'] = false;
1647
- _context31.next = 8;
1625
+ _context30.next = 1;
1648
1626
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1649
- case 8:
1627
+ case 1:
1650
1628
  jest.advanceTimersByTime(1005);
1651
1629
  expect(funcSpy).toBeCalledOnceWith(dummyEvent.data);
1652
1630
  expect(funcSpy).toHaveBeenCalledTimes(1);
@@ -1654,16 +1632,16 @@ describe('State Machine handler tests', function () {
1654
1632
  /* These shouldn't be called as call is not connected yet */
1655
1633
  expect(setTimeout).not.toHaveBeenCalled();
1656
1634
  expect(stateMachineSpy).not.toBeCalled();
1657
- case 13:
1635
+ case 2:
1658
1636
  case "end":
1659
- return _context31.stop();
1637
+ return _context30.stop();
1660
1638
  }
1661
- }, _callee31);
1639
+ }, _callee30);
1662
1640
  })));
1663
- it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1641
+ it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1664
1642
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1665
- return _regenerator.default.wrap(function _callee32$(_context32) {
1666
- while (1) switch (_context32.prev = _context32.next) {
1643
+ return _regenerator.default.wrap(function (_context31) {
1644
+ while (1) switch (_context31.prev = _context31.next) {
1667
1645
  case 0:
1668
1646
  statusPayload = {
1669
1647
  statusCode: 200,
@@ -1686,16 +1664,16 @@ describe('State Machine handler tests', function () {
1686
1664
  expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
1687
1665
  expect(warnSpy).not.toHaveBeenCalled();
1688
1666
  expect(stateMachineSpy).not.toHaveBeenCalled();
1689
- case 11:
1667
+ case 1:
1690
1668
  case "end":
1691
- return _context32.stop();
1669
+ return _context31.stop();
1692
1670
  }
1693
- }, _callee32);
1671
+ }, _callee31);
1694
1672
  })));
1695
- it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
1673
+ it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1696
1674
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1697
- return _regenerator.default.wrap(function _callee33$(_context33) {
1698
- while (1) switch (_context33.prev = _context33.next) {
1675
+ return _regenerator.default.wrap(function (_context32) {
1676
+ while (1) switch (_context32.prev = _context32.next) {
1699
1677
  case 0:
1700
1678
  statusPayload = {
1701
1679
  statusCode: 503,
@@ -1717,9 +1695,9 @@ describe('State Machine handler tests', function () {
1717
1695
  };
1718
1696
  call['connected'] = true;
1719
1697
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
1720
- _context33.next = 9;
1698
+ _context32.next = 1;
1721
1699
  return call['handleRoapEstablished']({}, dummyEvent);
1722
- case 9:
1700
+ case 1:
1723
1701
  jest.advanceTimersByTime(1005);
1724
1702
  expect(setTimeout).toHaveBeenCalledTimes(1);
1725
1703
  expect(funcSpy).toHaveBeenCalled();
@@ -1727,16 +1705,16 @@ describe('State Machine handler tests', function () {
1727
1705
  /* first failure , and second because of retry-after */
1728
1706
  expect(funcSpy).toHaveBeenCalledTimes(2);
1729
1707
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1730
- case 14:
1708
+ case 2:
1731
1709
  case "end":
1732
- return _context33.stop();
1710
+ return _context32.stop();
1733
1711
  }
1734
- }, _callee33);
1712
+ }, _callee32);
1735
1713
  })));
1736
- it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
1714
+ it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
1737
1715
  var statusPayload, stateMachineSpy, funcSpy, errorEvent;
1738
- return _regenerator.default.wrap(function _callee34$(_context34) {
1739
- while (1) switch (_context34.prev = _context34.next) {
1716
+ return _regenerator.default.wrap(function (_context33) {
1717
+ while (1) switch (_context33.prev = _context33.next) {
1740
1718
  case 0:
1741
1719
  statusPayload = {
1742
1720
  statusCode: 403,
@@ -1757,16 +1735,16 @@ describe('State Machine handler tests', function () {
1757
1735
  call.sendMediaStateMachineEvt(errorEvent);
1758
1736
  expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
1759
1737
  expect(stateMachineSpy).not.toHaveBeenCalled();
1760
- case 9:
1738
+ case 1:
1761
1739
  case "end":
1762
- return _context34.stop();
1740
+ return _context33.stop();
1763
1741
  }
1764
- }, _callee34);
1742
+ }, _callee33);
1765
1743
  })));
1766
- it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
1744
+ it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
1767
1745
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1768
- return _regenerator.default.wrap(function _callee35$(_context35) {
1769
- while (1) switch (_context35.prev = _context35.next) {
1746
+ return _regenerator.default.wrap(function (_context34) {
1747
+ while (1) switch (_context34.prev = _context34.next) {
1770
1748
  case 0:
1771
1749
  statusPayload = {
1772
1750
  statusCode: 200,
@@ -1784,9 +1762,9 @@ describe('State Machine handler tests', function () {
1784
1762
  }
1785
1763
  };
1786
1764
  call['connected'] = false;
1787
- _context35.next = 8;
1765
+ _context34.next = 1;
1788
1766
  return call['handleRoapError']({}, errorEvent);
1789
- case 8:
1767
+ case 1:
1790
1768
  expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
1791
1769
  expect(warnSpy).toBeCalledOnceWith('Call failed due to media issue', {
1792
1770
  file: 'call',
@@ -1798,16 +1776,16 @@ describe('State Machine handler tests', function () {
1798
1776
  },
1799
1777
  type: 'E_UNKNOWN'
1800
1778
  });
1801
- case 11:
1779
+ case 2:
1802
1780
  case "end":
1803
- return _context35.stop();
1781
+ return _context34.stop();
1804
1782
  }
1805
- }, _callee35);
1783
+ }, _callee34);
1806
1784
  })));
1807
- it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
1785
+ it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
1808
1786
  var statusPayload, warnSpy, postMediaSpy, setupEvent, connectEvent, offerEvent, answerEvent;
1809
- return _regenerator.default.wrap(function _callee36$(_context36) {
1810
- while (1) switch (_context36.prev = _context36.next) {
1787
+ return _regenerator.default.wrap(function (_context35) {
1788
+ while (1) switch (_context35.prev = _context35.next) {
1811
1789
  case 0:
1812
1790
  statusPayload = {
1813
1791
  statusCode: 403,
@@ -1845,12 +1823,12 @@ describe('State Machine handler tests', function () {
1845
1823
  messageType: 'ANSWER'
1846
1824
  }
1847
1825
  };
1848
- _context36.next = 15;
1826
+ _context35.next = 1;
1849
1827
  return call.sendMediaStateMachineEvt(answerEvent);
1850
- case 15:
1851
- _context36.next = 17;
1828
+ case 1:
1829
+ _context35.next = 2;
1852
1830
  return (0, _testUtil.flushPromises)(2);
1853
- case 17:
1831
+ case 2:
1854
1832
  expect(postMediaSpy).toBeCalledOnceWith(answerEvent.data);
1855
1833
  expect(warnSpy).toHaveBeenCalledWith('Failed to send MediaAnswer request', {
1856
1834
  file: 'call',
@@ -1864,16 +1842,16 @@ describe('State Machine handler tests', function () {
1864
1842
  // Final state should be torn down and cleared for unconnected call
1865
1843
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1866
1844
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
1867
- case 22:
1845
+ case 3:
1868
1846
  case "end":
1869
- return _context36.stop();
1847
+ return _context35.stop();
1870
1848
  }
1871
- }, _callee36);
1849
+ }, _callee35);
1872
1850
  })));
1873
- it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
1851
+ it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
1874
1852
  var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
1875
- return _regenerator.default.wrap(function _callee37$(_context37) {
1876
- while (1) switch (_context37.prev = _context37.next) {
1853
+ return _regenerator.default.wrap(function (_context36) {
1854
+ while (1) switch (_context36.prev = _context36.next) {
1877
1855
  case 0:
1878
1856
  statusPayload = {
1879
1857
  statusCode: 200,
@@ -1906,9 +1884,9 @@ describe('State Machine handler tests', function () {
1906
1884
  seq: 1,
1907
1885
  messageType: 'ANSWER'
1908
1886
  };
1909
- _context37.next = 17;
1887
+ _context36.next = 1;
1910
1888
  return call.sendMediaStateMachineEvt(dummyEvent);
1911
- case 17:
1889
+ case 1:
1912
1890
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
1913
1891
 
1914
1892
  /* we receive roap Offer Request followed by roap Ok from mobius and handle
@@ -1928,9 +1906,9 @@ describe('State Machine handler tests', function () {
1928
1906
  seq: 2,
1929
1907
  messageType: 'OFFER_REQUEST'
1930
1908
  };
1931
- _context37.next = 23;
1909
+ _context36.next = 2;
1932
1910
  return call.sendMediaStateMachineEvt(dummyEvent);
1933
- case 23:
1911
+ case 2:
1934
1912
  expect(call['receivedRoapOKSeq']).toBe(0);
1935
1913
  expect(_testUtil.mediaConnection.roapMessageReceived).not.toHaveBeenLastCalledWith(dummyEvent.data);
1936
1914
  call.sendMediaStateMachineEvt(dummyOkEvent);
@@ -1978,18 +1956,18 @@ describe('State Machine handler tests', function () {
1978
1956
  };
1979
1957
  call.sendCallStateMachineEvt(dummyEvent);
1980
1958
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
1981
- _context37.next = 49;
1959
+ _context36.next = 3;
1982
1960
  return call.sendMediaStateMachineEvt(dummyEvent);
1983
- case 49:
1961
+ case 3:
1984
1962
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
1985
1963
  dummyEvent.type = 'E_SEND_ROAP_ANSWER';
1986
1964
  dummyEvent.data = {
1987
1965
  seq: 3,
1988
1966
  messageType: 'ANSWER'
1989
1967
  };
1990
- _context37.next = 54;
1968
+ _context36.next = 4;
1991
1969
  return call.sendMediaStateMachineEvt(dummyEvent);
1992
- case 54:
1970
+ case 4:
1993
1971
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
1994
1972
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
1995
1973
  dummyEvent.data = {
@@ -2006,9 +1984,9 @@ describe('State Machine handler tests', function () {
2006
1984
  messageType: 'OK'
2007
1985
  }
2008
1986
  };
2009
- _context37.next = 63;
1987
+ _context36.next = 5;
2010
1988
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2011
- case 63:
1989
+ case 5:
2012
1990
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
2013
1991
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
2014
1992
  dummyEvent.type = 'E_SEND_ROAP_ANSWER';
@@ -2019,16 +1997,16 @@ describe('State Machine handler tests', function () {
2019
1997
  expect(call['mediaStateMachine'].state.value).toBe('S_RECV_ROAP_OFFER');
2020
1998
  call.sendMediaStateMachineEvt(dummyEvent);
2021
1999
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2022
- case 70:
2000
+ case 6:
2023
2001
  case "end":
2024
- return _context37.stop();
2002
+ return _context36.stop();
2025
2003
  }
2026
- }, _callee37);
2004
+ }, _callee36);
2027
2005
  })));
2028
- it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
2006
+ it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
2029
2007
  var mockStatusBody, statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
2030
- return _regenerator.default.wrap(function _callee38$(_context38) {
2031
- while (1) switch (_context38.prev = _context38.next) {
2008
+ return _regenerator.default.wrap(function (_context37) {
2009
+ while (1) switch (_context37.prev = _context37.next) {
2032
2010
  case 0:
2033
2011
  mockStatusBody = {
2034
2012
  device: {
@@ -2068,9 +2046,9 @@ describe('State Machine handler tests', function () {
2068
2046
  seq: 1,
2069
2047
  messageType: 'ANSWER'
2070
2048
  };
2071
- _context38.next = 18;
2049
+ _context37.next = 1;
2072
2050
  return call.sendMediaStateMachineEvt(dummyEvent);
2073
- case 18:
2051
+ case 1:
2074
2052
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
2075
2053
 
2076
2054
  /* we receive roap Offer Request followed by roap Ok from mobius and handle
@@ -2090,9 +2068,9 @@ describe('State Machine handler tests', function () {
2090
2068
  seq: 2,
2091
2069
  messageType: 'OFFER_REQUEST'
2092
2070
  };
2093
- _context38.next = 24;
2071
+ _context37.next = 2;
2094
2072
  return call.sendMediaStateMachineEvt(dummyEvent);
2095
- case 24:
2073
+ case 2:
2096
2074
  expect(call['receivedRoapOKSeq']).toBe(0);
2097
2075
  expect(_testUtil.mediaConnection.roapMessageReceived).not.toHaveBeenLastCalledWith(dummyEvent.data);
2098
2076
  call.sendMediaStateMachineEvt(dummyOkEvent);
@@ -2140,18 +2118,18 @@ describe('State Machine handler tests', function () {
2140
2118
  };
2141
2119
  call.sendCallStateMachineEvt(dummyEvent);
2142
2120
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2143
- _context38.next = 50;
2121
+ _context37.next = 3;
2144
2122
  return call.sendMediaStateMachineEvt(dummyEvent);
2145
- case 50:
2123
+ case 3:
2146
2124
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
2147
2125
  dummyEvent.type = 'E_SEND_ROAP_ANSWER';
2148
2126
  dummyEvent.data = {
2149
2127
  seq: 3,
2150
2128
  messageType: 'ANSWER'
2151
2129
  };
2152
- _context38.next = 55;
2130
+ _context37.next = 4;
2153
2131
  return call.sendMediaStateMachineEvt(dummyEvent);
2154
- case 55:
2132
+ case 4:
2155
2133
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2156
2134
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2157
2135
  dummyEvent.data = {
@@ -2166,9 +2144,9 @@ describe('State Machine handler tests', function () {
2166
2144
  }
2167
2145
  };
2168
2146
  call.sendMediaStateMachineEvt(dummyEvent);
2169
- _context38.next = 62;
2147
+ _context37.next = 5;
2170
2148
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2171
- case 62:
2149
+ case 5:
2172
2150
  expect(call['receivedRoapOKSeq']).toBe(3);
2173
2151
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
2174
2152
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2180,16 +2158,16 @@ describe('State Machine handler tests', function () {
2180
2158
  expect(call['mediaStateMachine'].state.value).toBe('S_RECV_ROAP_OFFER');
2181
2159
  call.sendMediaStateMachineEvt(dummyEvent);
2182
2160
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2183
- case 70:
2161
+ case 6:
2184
2162
  case "end":
2185
- return _context38.stop();
2163
+ return _context37.stop();
2186
2164
  }
2187
- }, _callee38);
2165
+ }, _callee37);
2188
2166
  })));
2189
- it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
2167
+ it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
2190
2168
  var statusPayload, dummyEvent, postMediaSpy, infoSpy, dummyOkEvent;
2191
- return _regenerator.default.wrap(function _callee39$(_context39) {
2192
- while (1) switch (_context39.prev = _context39.next) {
2169
+ return _regenerator.default.wrap(function (_context38) {
2170
+ while (1) switch (_context38.prev = _context38.next) {
2193
2171
  case 0:
2194
2172
  statusPayload = {
2195
2173
  statusCode: 200,
@@ -2254,16 +2232,16 @@ describe('State Machine handler tests', function () {
2254
2232
  file: 'call',
2255
2233
  method: 'handleCallHold'
2256
2234
  });
2257
- case 33:
2235
+ case 1:
2258
2236
  case "end":
2259
- return _context39.stop();
2237
+ return _context38.stop();
2260
2238
  }
2261
- }, _callee39);
2239
+ }, _callee38);
2262
2240
  })));
2263
- it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
2241
+ it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
2264
2242
  var emitSpy, deleteSpy;
2265
- return _regenerator.default.wrap(function _callee40$(_context40) {
2266
- while (1) switch (_context40.prev = _context40.next) {
2243
+ return _regenerator.default.wrap(function (_context39) {
2244
+ while (1) switch (_context39.prev = _context39.next) {
2267
2245
  case 0:
2268
2246
  emitSpy = jest.spyOn(call, 'emit');
2269
2247
  deleteSpy = jest.spyOn(call, 'delete').mockResolvedValue({
@@ -2272,17 +2250,17 @@ describe('State Machine handler tests', function () {
2272
2250
  call.sendCallStateMachineEvt({
2273
2251
  type: 'E_RECV_CALL_DISCONNECT'
2274
2252
  });
2275
- _context40.next = 5;
2253
+ _context39.next = 1;
2276
2254
  return (0, _testUtil.flushPromises)(1);
2277
- case 5:
2255
+ case 1:
2278
2256
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
2279
2257
  expect(deleteSpy).toHaveBeenCalled();
2280
2258
  expect(emitSpy.mock.invocationCallOrder[0]).toBeLessThan(deleteSpy.mock.invocationCallOrder[0]);
2281
- case 8:
2259
+ case 2:
2282
2260
  case "end":
2283
- return _context40.stop();
2261
+ return _context39.stop();
2284
2262
  }
2285
- }, _callee40);
2263
+ }, _callee39);
2286
2264
  })));
2287
2265
  describe('Call event timers tests', function () {
2288
2266
  var callManager;
@@ -2293,10 +2271,10 @@ describe('State Machine handler tests', function () {
2293
2271
  afterEach(function () {
2294
2272
  jest.clearAllTimers();
2295
2273
  });
2296
- it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2274
+ it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
2297
2275
  var statusPayload, dummyEvent, logSpy, emitSpy, deleteSpy, dummyOkEvent;
2298
- return _regenerator.default.wrap(function _callee41$(_context41) {
2299
- while (1) switch (_context41.prev = _context41.next) {
2276
+ return _regenerator.default.wrap(function (_context40) {
2277
+ while (1) switch (_context40.prev = _context40.next) {
2300
2278
  case 0:
2301
2279
  statusPayload = {
2302
2280
  statusCode: 200,
@@ -2313,9 +2291,9 @@ describe('State Machine handler tests', function () {
2313
2291
  webex.request.mockReturnValue(statusPayload);
2314
2292
 
2315
2293
  // handleOutgoingCallSetup is asynchronous
2316
- _context41.next = 9;
2294
+ _context40.next = 1;
2317
2295
  return call.sendCallStateMachineEvt(dummyEvent);
2318
- case 9:
2296
+ case 1:
2319
2297
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
2320
2298
  dummyEvent.type = 'E_RECV_CALL_PROGRESS';
2321
2299
  call.sendCallStateMachineEvt(dummyEvent);
@@ -2354,16 +2332,16 @@ describe('State Machine handler tests', function () {
2354
2332
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
2355
2333
  expect(deleteSpy).toHaveBeenCalledTimes(1);
2356
2334
  expect(callManager.callCollection).toStrictEqual({});
2357
- case 32:
2335
+ case 2:
2358
2336
  case "end":
2359
- return _context41.stop();
2337
+ return _context40.stop();
2360
2338
  }
2361
- }, _callee41);
2339
+ }, _callee40);
2362
2340
  })));
2363
- it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
2341
+ it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2364
2342
  var statusPayload, dummyEvent, call, emitSpy, deleteSpy, logSpy;
2365
- return _regenerator.default.wrap(function _callee42$(_context42) {
2366
- while (1) switch (_context42.prev = _context42.next) {
2343
+ return _regenerator.default.wrap(function (_context41) {
2344
+ while (1) switch (_context41.prev = _context41.next) {
2367
2345
  case 0:
2368
2346
  statusPayload = {
2369
2347
  statusCode: 200,
@@ -2382,9 +2360,9 @@ describe('State Machine handler tests', function () {
2382
2360
  expect((0, _keys.default)(callManager.callCollection)[0]).toBe(call.getCorrelationId());
2383
2361
 
2384
2362
  // handleOutgoingCallSetup is asynchronous
2385
- _context42.next = 11;
2363
+ _context41.next = 1;
2386
2364
  return call.sendCallStateMachineEvt(dummyEvent);
2387
- case 11:
2365
+ case 1:
2388
2366
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
2389
2367
  logSpy.mockClear();
2390
2368
  jest.advanceTimersByTime(10000);
@@ -2392,11 +2370,11 @@ describe('State Machine handler tests', function () {
2392
2370
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
2393
2371
  expect(deleteSpy).toHaveBeenCalledTimes(1);
2394
2372
  expect(callManager.callCollection).toStrictEqual({});
2395
- case 18:
2373
+ case 2:
2396
2374
  case "end":
2397
- return _context42.stop();
2375
+ return _context41.stop();
2398
2376
  }
2399
- }, _callee42);
2377
+ }, _callee41);
2400
2378
  })));
2401
2379
  });
2402
2380
  });
@@ -2456,10 +2434,10 @@ describe('Supplementary Services tests', function () {
2456
2434
  beforeEach(function () {
2457
2435
  call.removeAllListeners();
2458
2436
  });
2459
- it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
2437
+ it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
2460
2438
  var responsePayload, warnSpy, roapEvent;
2461
- return _regenerator.default.wrap(function _callee44$(_context44) {
2462
- while (1) switch (_context44.prev = _context44.next) {
2439
+ return _regenerator.default.wrap(function (_context43) {
2440
+ while (1) switch (_context43.prev = _context43.next) {
2463
2441
  case 0:
2464
2442
  expect.assertions(7);
2465
2443
  responsePayload = {
@@ -2472,27 +2450,27 @@ describe('Supplementary Services tests', function () {
2472
2450
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2473
2451
  call['held'] = false;
2474
2452
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2475
- var _ref44 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43(correlationId) {
2476
- return _regenerator.default.wrap(function _callee43$(_context43) {
2477
- while (1) switch (_context43.prev = _context43.next) {
2453
+ var _ref43 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42(correlationId) {
2454
+ return _regenerator.default.wrap(function (_context42) {
2455
+ while (1) switch (_context42.prev = _context42.next) {
2478
2456
  case 0:
2479
2457
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2480
2458
  case 1:
2481
2459
  case "end":
2482
- return _context43.stop();
2460
+ return _context42.stop();
2483
2461
  }
2484
- }, _callee43);
2462
+ }, _callee42);
2485
2463
  }));
2486
2464
  return function (_x) {
2487
- return _ref44.apply(this, arguments);
2465
+ return _ref43.apply(this, arguments);
2488
2466
  };
2489
2467
  }());
2490
- _context44.next = 10;
2468
+ _context43.next = 1;
2491
2469
  return call.doHoldResume();
2492
- case 10:
2493
- _context44.next = 12;
2470
+ case 1:
2471
+ _context43.next = 2;
2494
2472
  return (0, _testUtil.flushPromises)(2);
2495
- case 12:
2473
+ case 2:
2496
2474
  expect(setTimeout).toHaveBeenCalledTimes(1);
2497
2475
  call.handleMidCallEvent(mockHeldEvent);
2498
2476
 
@@ -2506,13 +2484,13 @@ describe('Supplementary Services tests', function () {
2506
2484
  call['handleIncomingRoapOffer']({}, dummyEvent);
2507
2485
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2508
2486
  roapEvent.data.type = 'ANSWER';
2509
- _context44.next = 20;
2487
+ _context43.next = 3;
2510
2488
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2511
- case 20:
2489
+ case 3:
2512
2490
  roapEvent.data.type = 'OK';
2513
- _context44.next = 23;
2491
+ _context43.next = 4;
2514
2492
  return call['handleRoapEstablished']({}, dummyEvent);
2515
- case 23:
2493
+ case 4:
2516
2494
  expect(clearTimeout).toHaveBeenCalledTimes(1);
2517
2495
  /* isHeld flag should be set and an Hold event should be emitted */
2518
2496
  expect(call.isHeld()).toStrictEqual(true);
@@ -2523,16 +2501,16 @@ describe('Supplementary Services tests', function () {
2523
2501
  file: 'call',
2524
2502
  method: 'handleCallHold'
2525
2503
  });
2526
- case 28:
2504
+ case 5:
2527
2505
  case "end":
2528
- return _context44.stop();
2506
+ return _context43.stop();
2529
2507
  }
2530
- }, _callee44);
2508
+ }, _callee43);
2531
2509
  })));
2532
- it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
2510
+ it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
2533
2511
  var responsePayload, warnSpy, roapEvent;
2534
- return _regenerator.default.wrap(function _callee46$(_context46) {
2535
- while (1) switch (_context46.prev = _context46.next) {
2512
+ return _regenerator.default.wrap(function (_context45) {
2513
+ while (1) switch (_context45.prev = _context45.next) {
2536
2514
  case 0:
2537
2515
  expect.assertions(8);
2538
2516
  responsePayload = {
@@ -2545,28 +2523,28 @@ describe('Supplementary Services tests', function () {
2545
2523
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2546
2524
  call['held'] = false;
2547
2525
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2548
- var _ref46 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45(correlationId) {
2549
- return _regenerator.default.wrap(function _callee45$(_context45) {
2550
- while (1) switch (_context45.prev = _context45.next) {
2526
+ var _ref45 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44(correlationId) {
2527
+ return _regenerator.default.wrap(function (_context44) {
2528
+ while (1) switch (_context44.prev = _context44.next) {
2551
2529
  case 0:
2552
2530
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2553
2531
  case 1:
2554
2532
  case "end":
2555
- return _context45.stop();
2533
+ return _context44.stop();
2556
2534
  }
2557
- }, _callee45);
2535
+ }, _callee44);
2558
2536
  }));
2559
2537
  return function (_x2) {
2560
- return _ref46.apply(this, arguments);
2538
+ return _ref45.apply(this, arguments);
2561
2539
  };
2562
2540
  }());
2563
2541
  call.doHoldResume();
2564
- _context46.next = 11;
2542
+ _context45.next = 1;
2565
2543
  return _promise.default.resolve();
2566
- case 11:
2567
- _context46.next = 13;
2544
+ case 1:
2545
+ _context45.next = 2;
2568
2546
  return _promise.default.resolve();
2569
- case 13:
2547
+ case 2:
2570
2548
  expect(setTimeout).not.toHaveBeenCalled();
2571
2549
  call.handleMidCallEvent(mockHeldEvent);
2572
2550
 
@@ -2580,13 +2558,13 @@ describe('Supplementary Services tests', function () {
2580
2558
  call['handleIncomingRoapOffer']({}, dummyEvent);
2581
2559
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2582
2560
  roapEvent.data.type = 'ANSWER';
2583
- _context46.next = 22;
2561
+ _context45.next = 3;
2584
2562
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2585
- case 22:
2563
+ case 3:
2586
2564
  roapEvent.data.type = 'OK';
2587
- _context46.next = 25;
2565
+ _context45.next = 4;
2588
2566
  return call['handleRoapEstablished']({}, dummyEvent);
2589
- case 25:
2567
+ case 4:
2590
2568
  expect(clearTimeout).not.toHaveBeenCalled();
2591
2569
  /* isHeld flag should be set and an Hold event should be emitted */
2592
2570
  expect(call.isHeld()).toStrictEqual(true);
@@ -2597,16 +2575,16 @@ describe('Supplementary Services tests', function () {
2597
2575
  file: 'call',
2598
2576
  method: 'handleCallHold'
2599
2577
  });
2600
- case 30:
2578
+ case 5:
2601
2579
  case "end":
2602
- return _context46.stop();
2580
+ return _context45.stop();
2603
2581
  }
2604
- }, _callee46);
2582
+ }, _callee45);
2605
2583
  })));
2606
- it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48() {
2584
+ it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
2607
2585
  var responsePayload;
2608
- return _regenerator.default.wrap(function _callee48$(_context48) {
2609
- while (1) switch (_context48.prev = _context48.next) {
2586
+ return _regenerator.default.wrap(function (_context47) {
2587
+ while (1) switch (_context47.prev = _context47.next) {
2610
2588
  case 0:
2611
2589
  expect.assertions(4);
2612
2590
  responsePayload = {
@@ -2616,43 +2594,43 @@ describe('Supplementary Services tests', function () {
2616
2594
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2617
2595
  call['held'] = false;
2618
2596
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2619
- var _ref48 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47(errObj) {
2620
- return _regenerator.default.wrap(function _callee47$(_context47) {
2621
- while (1) switch (_context47.prev = _context47.next) {
2597
+ var _ref47 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46(errObj) {
2598
+ return _regenerator.default.wrap(function (_context46) {
2599
+ while (1) switch (_context46.prev = _context46.next) {
2622
2600
  case 0:
2623
2601
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2624
2602
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2625
- case 2:
2603
+ case 1:
2626
2604
  case "end":
2627
- return _context47.stop();
2605
+ return _context46.stop();
2628
2606
  }
2629
- }, _callee47);
2607
+ }, _callee46);
2630
2608
  }));
2631
2609
  return function (_x3) {
2632
- return _ref48.apply(this, arguments);
2610
+ return _ref47.apply(this, arguments);
2633
2611
  };
2634
2612
  }());
2635
- _context48.next = 7;
2613
+ _context47.next = 1;
2636
2614
  return call.doHoldResume();
2637
- case 7:
2638
- _context48.next = 9;
2615
+ case 1:
2616
+ _context47.next = 2;
2639
2617
  return (0, _testUtil.flushPromises)(2);
2640
- case 9:
2618
+ case 2:
2641
2619
  expect(call.isHeld()).toStrictEqual(false);
2642
2620
 
2643
2621
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
2644
2622
  */
2645
2623
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2646
- case 11:
2624
+ case 3:
2647
2625
  case "end":
2648
- return _context48.stop();
2626
+ return _context47.stop();
2649
2627
  }
2650
- }, _callee48);
2628
+ }, _callee47);
2651
2629
  })));
2652
- it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
2630
+ it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
2653
2631
  var responsePayload, rejectPayload, roapEvent;
2654
- return _regenerator.default.wrap(function _callee50$(_context50) {
2655
- while (1) switch (_context50.prev = _context50.next) {
2632
+ return _regenerator.default.wrap(function (_context49) {
2633
+ while (1) switch (_context49.prev = _context49.next) {
2656
2634
  case 0:
2657
2635
  expect.assertions(5);
2658
2636
  responsePayload = {
@@ -2666,26 +2644,26 @@ describe('Supplementary Services tests', function () {
2666
2644
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2667
2645
  call['held'] = false;
2668
2646
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2669
- var _ref50 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49(errObj) {
2670
- return _regenerator.default.wrap(function _callee49$(_context49) {
2671
- while (1) switch (_context49.prev = _context49.next) {
2647
+ var _ref49 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48(errObj) {
2648
+ return _regenerator.default.wrap(function (_context48) {
2649
+ while (1) switch (_context48.prev = _context48.next) {
2672
2650
  case 0:
2673
2651
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2674
2652
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2675
- case 2:
2653
+ case 1:
2676
2654
  case "end":
2677
- return _context49.stop();
2655
+ return _context48.stop();
2678
2656
  }
2679
- }, _callee49);
2657
+ }, _callee48);
2680
2658
  }));
2681
2659
  return function (_x4) {
2682
- return _ref50.apply(this, arguments);
2660
+ return _ref49.apply(this, arguments);
2683
2661
  };
2684
2662
  }());
2685
2663
  call.doHoldResume();
2686
- _context50.next = 9;
2664
+ _context49.next = 1;
2687
2665
  return (0, _testUtil.flushPromises)(2);
2688
- case 9:
2666
+ case 1:
2689
2667
  /* the Call State should transition to S_CALL_ESTABLISHED
2690
2668
  */
2691
2669
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_HOLD');
@@ -2693,22 +2671,22 @@ describe('Supplementary Services tests', function () {
2693
2671
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2694
2672
  /* We are intentionally failing the ROAP ANSWER */
2695
2673
  roapEvent.data.type = 'ANSWER';
2696
- _context50.next = 15;
2674
+ _context49.next = 2;
2697
2675
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2698
- case 15:
2676
+ case 2:
2699
2677
  expect(call.isHeld()).toStrictEqual(false);
2700
2678
  /* We should return back to call established state */
2701
2679
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2702
- case 17:
2680
+ case 3:
2703
2681
  case "end":
2704
- return _context50.stop();
2682
+ return _context49.stop();
2705
2683
  }
2706
- }, _callee50);
2684
+ }, _callee49);
2707
2685
  })));
2708
- it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
2686
+ it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
2709
2687
  var responsePayload, warnSpy, roapEvent;
2710
- return _regenerator.default.wrap(function _callee51$(_context51) {
2711
- while (1) switch (_context51.prev = _context51.next) {
2688
+ return _regenerator.default.wrap(function (_context50) {
2689
+ while (1) switch (_context50.prev = _context50.next) {
2712
2690
  case 0:
2713
2691
  responsePayload = {
2714
2692
  statusCode: 200,
@@ -2719,12 +2697,12 @@ describe('Supplementary Services tests', function () {
2719
2697
  jest.spyOn(global, 'clearTimeout');
2720
2698
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2721
2699
  call['held'] = false;
2722
- _context51.next = 8;
2700
+ _context50.next = 1;
2723
2701
  return call.doHoldResume();
2724
- case 8:
2725
- _context51.next = 10;
2702
+ case 1:
2703
+ _context50.next = 2;
2726
2704
  return (0, _testUtil.flushPromises)(2);
2727
- case 10:
2705
+ case 2:
2728
2706
  expect(setTimeout).toHaveBeenCalledTimes(1);
2729
2707
 
2730
2708
  /* At this point, the Call State should be S_CALL_HOLD
@@ -2737,21 +2715,21 @@ describe('Supplementary Services tests', function () {
2737
2715
  call['handleIncomingRoapOffer']({}, dummyEvent);
2738
2716
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2739
2717
  roapEvent.data.type = 'ANSWER';
2740
- _context51.next = 17;
2718
+ _context50.next = 3;
2741
2719
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2742
- case 17:
2720
+ case 3:
2743
2721
  jest.spyOn(webex, 'request').mockRejectedValue({
2744
2722
  statusCode: 403
2745
2723
  });
2746
2724
  roapEvent.data.type = 'OK';
2747
- _context51.next = 21;
2725
+ _context50.next = 4;
2748
2726
  return call['handleRoapEstablished']({}, dummyEvent);
2749
- case 21:
2727
+ case 4:
2750
2728
  /* this is for coverage */
2751
2729
  call['callStateMachine'].state.value = 'S_CALL_HOLD';
2752
- _context51.next = 24;
2730
+ _context50.next = 5;
2753
2731
  return call['handleRoapEstablished']({}, dummyEvent);
2754
- case 24:
2732
+ case 5:
2755
2733
  expect(call.isHeld()).toStrictEqual(false);
2756
2734
  /* We should return back to call established state */
2757
2735
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -2759,16 +2737,16 @@ describe('Supplementary Services tests', function () {
2759
2737
  file: 'call',
2760
2738
  method: 'handleRoapEstablished'
2761
2739
  });
2762
- case 27:
2740
+ case 6:
2763
2741
  case "end":
2764
- return _context51.stop();
2742
+ return _context50.stop();
2765
2743
  }
2766
- }, _callee51);
2744
+ }, _callee50);
2767
2745
  })));
2768
- it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
2746
+ it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
2769
2747
  var responsePayload, warnSpy, roapEvent;
2770
- return _regenerator.default.wrap(function _callee52$(_context52) {
2771
- while (1) switch (_context52.prev = _context52.next) {
2748
+ return _regenerator.default.wrap(function (_context51) {
2749
+ while (1) switch (_context51.prev = _context51.next) {
2772
2750
  case 0:
2773
2751
  responsePayload = {
2774
2752
  statusCode: 200,
@@ -2779,12 +2757,12 @@ describe('Supplementary Services tests', function () {
2779
2757
  jest.spyOn(global, 'clearTimeout');
2780
2758
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2781
2759
  call['held'] = true;
2782
- _context52.next = 8;
2760
+ _context51.next = 1;
2783
2761
  return call.doHoldResume();
2784
- case 8:
2785
- _context52.next = 10;
2762
+ case 1:
2763
+ _context51.next = 2;
2786
2764
  return (0, _testUtil.flushPromises)(2);
2787
- case 10:
2765
+ case 2:
2788
2766
  expect(setTimeout).toHaveBeenCalledTimes(1);
2789
2767
 
2790
2768
  /* At this point, the Call State should be S_CALL_RESUME
@@ -2797,16 +2775,16 @@ describe('Supplementary Services tests', function () {
2797
2775
  call['handleIncomingRoapOffer']({}, dummyEvent);
2798
2776
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2799
2777
  roapEvent.data.type = 'ANSWER';
2800
- _context52.next = 17;
2778
+ _context51.next = 3;
2801
2779
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2802
- case 17:
2780
+ case 3:
2803
2781
  jest.spyOn(webex, 'request').mockRejectedValue({
2804
2782
  statusCode: 403
2805
2783
  });
2806
2784
  roapEvent.data.type = 'OK';
2807
- _context52.next = 21;
2785
+ _context51.next = 4;
2808
2786
  return call['handleRoapEstablished']({}, dummyEvent);
2809
- case 21:
2787
+ case 4:
2810
2788
  expect(call.isHeld()).toStrictEqual(true);
2811
2789
  /* We should return back to call established state */
2812
2790
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -2814,16 +2792,16 @@ describe('Supplementary Services tests', function () {
2814
2792
  file: 'call',
2815
2793
  method: 'handleRoapEstablished'
2816
2794
  });
2817
- case 24:
2795
+ case 5:
2818
2796
  case "end":
2819
- return _context52.stop();
2797
+ return _context51.stop();
2820
2798
  }
2821
- }, _callee52);
2799
+ }, _callee51);
2822
2800
  })));
2823
- it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54() {
2801
+ it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
2824
2802
  var responsePayload, roapEvent;
2825
- return _regenerator.default.wrap(function _callee54$(_context54) {
2826
- while (1) switch (_context54.prev = _context54.next) {
2803
+ return _regenerator.default.wrap(function (_context53) {
2804
+ while (1) switch (_context53.prev = _context53.next) {
2827
2805
  case 0:
2828
2806
  expect.assertions(5);
2829
2807
  responsePayload = {
@@ -2833,27 +2811,27 @@ describe('Supplementary Services tests', function () {
2833
2811
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
2834
2812
  call['held'] = false;
2835
2813
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2836
- var _ref54 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53(errObj) {
2837
- return _regenerator.default.wrap(function _callee53$(_context53) {
2838
- while (1) switch (_context53.prev = _context53.next) {
2814
+ var _ref53 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52(errObj) {
2815
+ return _regenerator.default.wrap(function (_context52) {
2816
+ while (1) switch (_context52.prev = _context52.next) {
2839
2817
  case 0:
2840
2818
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
2841
2819
  expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
2842
- case 2:
2820
+ case 1:
2843
2821
  case "end":
2844
- return _context53.stop();
2822
+ return _context52.stop();
2845
2823
  }
2846
- }, _callee53);
2824
+ }, _callee52);
2847
2825
  }));
2848
2826
  return function (_x5) {
2849
- return _ref54.apply(this, arguments);
2827
+ return _ref53.apply(this, arguments);
2850
2828
  };
2851
2829
  }());
2852
2830
  jest.runAllTimers();
2853
2831
  call.doHoldResume();
2854
- _context54.next = 9;
2832
+ _context53.next = 1;
2855
2833
  return (0, _testUtil.flushPromises)(2);
2856
- case 9:
2834
+ case 1:
2857
2835
  /* At this point, the Call State should be S_CALL_HOLD
2858
2836
  */
2859
2837
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_HOLD');
@@ -2864,13 +2842,13 @@ describe('Supplementary Services tests', function () {
2864
2842
  call['handleIncomingRoapOffer']({}, dummyEvent);
2865
2843
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2866
2844
  roapEvent.data.type = 'ANSWER';
2867
- _context54.next = 15;
2845
+ _context53.next = 2;
2868
2846
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2869
- case 15:
2847
+ case 2:
2870
2848
  roapEvent.data.type = 'OK';
2871
- _context54.next = 18;
2849
+ _context53.next = 3;
2872
2850
  return call['handleRoapEstablished']({}, dummyEvent);
2873
- case 18:
2851
+ case 3:
2874
2852
  /* Advancing timer by 12 seconds so that it gets timed out */
2875
2853
  jest.advanceTimersByTime(12000);
2876
2854
 
@@ -2878,16 +2856,16 @@ describe('Supplementary Services tests', function () {
2878
2856
  expect(call.isHeld()).toStrictEqual(false);
2879
2857
  /* We should return back to call established state */
2880
2858
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2881
- case 21:
2859
+ case 4:
2882
2860
  case "end":
2883
- return _context54.stop();
2861
+ return _context53.stop();
2884
2862
  }
2885
- }, _callee54);
2863
+ }, _callee53);
2886
2864
  })));
2887
- it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56() {
2865
+ it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
2888
2866
  var responsePayload, warnSpy, roapEvent;
2889
- return _regenerator.default.wrap(function _callee56$(_context56) {
2890
- while (1) switch (_context56.prev = _context56.next) {
2867
+ return _regenerator.default.wrap(function (_context55) {
2868
+ while (1) switch (_context55.prev = _context55.next) {
2891
2869
  case 0:
2892
2870
  expect.assertions(7);
2893
2871
  responsePayload = {
@@ -2900,27 +2878,27 @@ describe('Supplementary Services tests', function () {
2900
2878
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2901
2879
  call['held'] = true;
2902
2880
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
2903
- var _ref56 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55(correlationId) {
2904
- return _regenerator.default.wrap(function _callee55$(_context55) {
2905
- while (1) switch (_context55.prev = _context55.next) {
2881
+ var _ref55 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54(correlationId) {
2882
+ return _regenerator.default.wrap(function (_context54) {
2883
+ while (1) switch (_context54.prev = _context54.next) {
2906
2884
  case 0:
2907
2885
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2908
2886
  case 1:
2909
2887
  case "end":
2910
- return _context55.stop();
2888
+ return _context54.stop();
2911
2889
  }
2912
- }, _callee55);
2890
+ }, _callee54);
2913
2891
  }));
2914
2892
  return function (_x6) {
2915
- return _ref56.apply(this, arguments);
2893
+ return _ref55.apply(this, arguments);
2916
2894
  };
2917
2895
  }());
2918
- _context56.next = 10;
2896
+ _context55.next = 1;
2919
2897
  return call.doHoldResume();
2920
- case 10:
2921
- _context56.next = 12;
2898
+ case 1:
2899
+ _context55.next = 2;
2922
2900
  return (0, _testUtil.flushPromises)(2);
2923
- case 12:
2901
+ case 2:
2924
2902
  expect(setTimeout).toHaveBeenCalledTimes(1);
2925
2903
  call.handleMidCallEvent(mockResumeEvent);
2926
2904
 
@@ -2934,13 +2912,13 @@ describe('Supplementary Services tests', function () {
2934
2912
  call['handleIncomingRoapOffer']({}, dummyEvent);
2935
2913
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2936
2914
  roapEvent.data.type = 'ANSWER';
2937
- _context56.next = 20;
2915
+ _context55.next = 3;
2938
2916
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2939
- case 20:
2917
+ case 3:
2940
2918
  roapEvent.data.type = 'OK';
2941
- _context56.next = 23;
2919
+ _context55.next = 4;
2942
2920
  return call['handleRoapEstablished']({}, dummyEvent);
2943
- case 23:
2921
+ case 4:
2944
2922
  expect(clearTimeout).toHaveBeenCalledTimes(1);
2945
2923
  /* isHeld flag should not be set and an Resume event should be emitted */
2946
2924
  expect(call.isHeld()).toStrictEqual(false);
@@ -2951,16 +2929,16 @@ describe('Supplementary Services tests', function () {
2951
2929
  file: 'call',
2952
2930
  method: 'handleCallResume'
2953
2931
  });
2954
- case 28:
2932
+ case 5:
2955
2933
  case "end":
2956
- return _context56.stop();
2934
+ return _context55.stop();
2957
2935
  }
2958
- }, _callee56);
2936
+ }, _callee55);
2959
2937
  })));
2960
- it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58() {
2938
+ it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
2961
2939
  var responsePayload, warnSpy, roapEvent;
2962
- return _regenerator.default.wrap(function _callee58$(_context58) {
2963
- while (1) switch (_context58.prev = _context58.next) {
2940
+ return _regenerator.default.wrap(function (_context57) {
2941
+ while (1) switch (_context57.prev = _context57.next) {
2964
2942
  case 0:
2965
2943
  expect.assertions(7);
2966
2944
  responsePayload = {
@@ -2973,28 +2951,28 @@ describe('Supplementary Services tests', function () {
2973
2951
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2974
2952
  call['held'] = true;
2975
2953
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
2976
- var _ref58 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57(correlationId) {
2977
- return _regenerator.default.wrap(function _callee57$(_context57) {
2978
- while (1) switch (_context57.prev = _context57.next) {
2954
+ var _ref57 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56(correlationId) {
2955
+ return _regenerator.default.wrap(function (_context56) {
2956
+ while (1) switch (_context56.prev = _context56.next) {
2979
2957
  case 0:
2980
2958
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2981
2959
  case 1:
2982
2960
  case "end":
2983
- return _context57.stop();
2961
+ return _context56.stop();
2984
2962
  }
2985
- }, _callee57);
2963
+ }, _callee56);
2986
2964
  }));
2987
2965
  return function (_x7) {
2988
- return _ref58.apply(this, arguments);
2966
+ return _ref57.apply(this, arguments);
2989
2967
  };
2990
2968
  }());
2991
2969
  call.doHoldResume();
2992
- _context58.next = 11;
2970
+ _context57.next = 1;
2993
2971
  return _promise.default.resolve();
2994
- case 11:
2995
- _context58.next = 13;
2972
+ case 1:
2973
+ _context57.next = 2;
2996
2974
  return _promise.default.resolve();
2997
- case 13:
2975
+ case 2:
2998
2976
  expect(setTimeout).not.toHaveBeenCalled();
2999
2977
  call.handleMidCallEvent(mockResumeEvent);
3000
2978
 
@@ -3008,13 +2986,13 @@ describe('Supplementary Services tests', function () {
3008
2986
  call['handleIncomingRoapOffer']({}, dummyEvent);
3009
2987
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3010
2988
  roapEvent.data.type = 'ANSWER';
3011
- _context58.next = 21;
2989
+ _context57.next = 3;
3012
2990
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3013
- case 21:
2991
+ case 3:
3014
2992
  roapEvent.data.type = 'OK';
3015
- _context58.next = 24;
2993
+ _context57.next = 4;
3016
2994
  return call['handleRoapEstablished']({}, dummyEvent);
3017
- case 24:
2995
+ case 4:
3018
2996
  expect(clearTimeout).not.toHaveBeenCalled();
3019
2997
  /* isHeld flag should not be set and an Resume event should be emitted */
3020
2998
  expect(call.isHeld()).toStrictEqual(false);
@@ -3025,16 +3003,16 @@ describe('Supplementary Services tests', function () {
3025
3003
  file: 'call',
3026
3004
  method: 'handleCallResume'
3027
3005
  });
3028
- case 29:
3006
+ case 5:
3029
3007
  case "end":
3030
- return _context58.stop();
3008
+ return _context57.stop();
3031
3009
  }
3032
- }, _callee58);
3010
+ }, _callee57);
3033
3011
  })));
3034
- it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60() {
3012
+ it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59() {
3035
3013
  var responsePayload;
3036
- return _regenerator.default.wrap(function _callee60$(_context60) {
3037
- while (1) switch (_context60.prev = _context60.next) {
3014
+ return _regenerator.default.wrap(function (_context59) {
3015
+ while (1) switch (_context59.prev = _context59.next) {
3038
3016
  case 0:
3039
3017
  expect.assertions(4);
3040
3018
  responsePayload = {
@@ -3044,44 +3022,44 @@ describe('Supplementary Services tests', function () {
3044
3022
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3045
3023
  call['held'] = true;
3046
3024
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3047
- var _ref60 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59(errObj) {
3048
- return _regenerator.default.wrap(function _callee59$(_context59) {
3049
- while (1) switch (_context59.prev = _context59.next) {
3025
+ var _ref59 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58(errObj) {
3026
+ return _regenerator.default.wrap(function (_context58) {
3027
+ while (1) switch (_context58.prev = _context58.next) {
3050
3028
  case 0:
3051
3029
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3052
3030
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3053
- case 2:
3031
+ case 1:
3054
3032
  case "end":
3055
- return _context59.stop();
3033
+ return _context58.stop();
3056
3034
  }
3057
- }, _callee59);
3035
+ }, _callee58);
3058
3036
  }));
3059
3037
  return function (_x8) {
3060
- return _ref60.apply(this, arguments);
3038
+ return _ref59.apply(this, arguments);
3061
3039
  };
3062
3040
  }());
3063
- _context60.next = 7;
3041
+ _context59.next = 1;
3064
3042
  return call.doHoldResume();
3065
- case 7:
3066
- _context60.next = 9;
3043
+ case 1:
3044
+ _context59.next = 2;
3067
3045
  return (0, _testUtil.flushPromises)(2);
3068
- case 9:
3046
+ case 2:
3069
3047
  expect(call.isHeld()).toStrictEqual(true);
3070
3048
 
3071
3049
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
3072
3050
  */
3073
3051
 
3074
3052
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3075
- case 11:
3053
+ case 3:
3076
3054
  case "end":
3077
- return _context60.stop();
3055
+ return _context59.stop();
3078
3056
  }
3079
- }, _callee60);
3057
+ }, _callee59);
3080
3058
  })));
3081
- it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62() {
3059
+ it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61() {
3082
3060
  var responsePayload, rejectPayload, roapEvent;
3083
- return _regenerator.default.wrap(function _callee62$(_context62) {
3084
- while (1) switch (_context62.prev = _context62.next) {
3061
+ return _regenerator.default.wrap(function (_context61) {
3062
+ while (1) switch (_context61.prev = _context61.next) {
3085
3063
  case 0:
3086
3064
  expect.assertions(5);
3087
3065
  responsePayload = {
@@ -3095,26 +3073,26 @@ describe('Supplementary Services tests', function () {
3095
3073
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
3096
3074
  call['held'] = true;
3097
3075
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3098
- var _ref62 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61(errObj) {
3099
- return _regenerator.default.wrap(function _callee61$(_context61) {
3100
- while (1) switch (_context61.prev = _context61.next) {
3076
+ var _ref61 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60(errObj) {
3077
+ return _regenerator.default.wrap(function (_context60) {
3078
+ while (1) switch (_context60.prev = _context60.next) {
3101
3079
  case 0:
3102
3080
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3103
3081
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3104
- case 2:
3082
+ case 1:
3105
3083
  case "end":
3106
- return _context61.stop();
3084
+ return _context60.stop();
3107
3085
  }
3108
- }, _callee61);
3086
+ }, _callee60);
3109
3087
  }));
3110
3088
  return function (_x9) {
3111
- return _ref62.apply(this, arguments);
3089
+ return _ref61.apply(this, arguments);
3112
3090
  };
3113
3091
  }());
3114
3092
  call.doHoldResume();
3115
- _context62.next = 9;
3093
+ _context61.next = 1;
3116
3094
  return (0, _testUtil.flushPromises)(2);
3117
- case 9:
3095
+ case 1:
3118
3096
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
3119
3097
  */
3120
3098
 
@@ -3123,22 +3101,22 @@ describe('Supplementary Services tests', function () {
3123
3101
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3124
3102
  /* We are intentionally failing the ROAP ANSWER */
3125
3103
  roapEvent.data.type = 'ANSWER';
3126
- _context62.next = 15;
3104
+ _context61.next = 2;
3127
3105
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3128
- case 15:
3106
+ case 2:
3129
3107
  expect(call.isHeld()).toStrictEqual(true);
3130
3108
  /* We should return back to call established state */
3131
3109
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3132
- case 17:
3110
+ case 3:
3133
3111
  case "end":
3134
- return _context62.stop();
3112
+ return _context61.stop();
3135
3113
  }
3136
- }, _callee62);
3114
+ }, _callee61);
3137
3115
  })));
3138
- it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64() {
3116
+ it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
3139
3117
  var responsePayload, roapEvent;
3140
- return _regenerator.default.wrap(function _callee64$(_context64) {
3141
- while (1) switch (_context64.prev = _context64.next) {
3118
+ return _regenerator.default.wrap(function (_context63) {
3119
+ while (1) switch (_context63.prev = _context63.next) {
3142
3120
  case 0:
3143
3121
  expect.assertions(5);
3144
3122
  responsePayload = {
@@ -3148,26 +3126,26 @@ describe('Supplementary Services tests', function () {
3148
3126
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
3149
3127
  call['held'] = true;
3150
3128
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3151
- var _ref64 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63(errObj) {
3152
- return _regenerator.default.wrap(function _callee63$(_context63) {
3153
- while (1) switch (_context63.prev = _context63.next) {
3129
+ var _ref63 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62(errObj) {
3130
+ return _regenerator.default.wrap(function (_context62) {
3131
+ while (1) switch (_context62.prev = _context62.next) {
3154
3132
  case 0:
3155
3133
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
3156
3134
  expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
3157
- case 2:
3135
+ case 1:
3158
3136
  case "end":
3159
- return _context63.stop();
3137
+ return _context62.stop();
3160
3138
  }
3161
- }, _callee63);
3139
+ }, _callee62);
3162
3140
  }));
3163
3141
  return function (_x0) {
3164
- return _ref64.apply(this, arguments);
3142
+ return _ref63.apply(this, arguments);
3165
3143
  };
3166
3144
  }());
3167
3145
  call.doHoldResume();
3168
- _context64.next = 8;
3146
+ _context63.next = 1;
3169
3147
  return (0, _testUtil.flushPromises)(2);
3170
- case 8:
3148
+ case 1:
3171
3149
  /* At this point ,the Call State should be S_CALL_RESUME
3172
3150
  */
3173
3151
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_RESUME');
@@ -3178,23 +3156,23 @@ describe('Supplementary Services tests', function () {
3178
3156
  call['handleIncomingRoapOffer']({}, dummyEvent);
3179
3157
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3180
3158
  roapEvent.data.type = 'ANSWER';
3181
- _context64.next = 14;
3159
+ _context63.next = 2;
3182
3160
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3183
- case 14:
3161
+ case 2:
3184
3162
  roapEvent.data.type = 'OK';
3185
- _context64.next = 17;
3163
+ _context63.next = 3;
3186
3164
  return call['handleRoapEstablished']({}, dummyEvent);
3187
- case 17:
3165
+ case 3:
3188
3166
  /* Advancing timer by 12 seconds so that it gets timed out */
3189
3167
  jest.advanceTimersByTime(12000);
3190
3168
  expect(call.isHeld()).toStrictEqual(true);
3191
3169
  /* We should return back to call established state */
3192
3170
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3193
- case 20:
3171
+ case 4:
3194
3172
  case "end":
3195
- return _context64.stop();
3173
+ return _context63.stop();
3196
3174
  }
3197
- }, _callee64);
3175
+ }, _callee63);
3198
3176
  })));
3199
3177
  });
3200
3178
  describe('Call transfer tests', function () {
@@ -3227,10 +3205,10 @@ describe('Supplementary Services tests', function () {
3227
3205
  secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
3228
3206
  secondCall['held'] = false;
3229
3207
  });
3230
- it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67() {
3208
+ it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66() {
3231
3209
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3232
- return _regenerator.default.wrap(function _callee67$(_context67) {
3233
- while (1) switch (_context67.prev = _context67.next) {
3210
+ return _regenerator.default.wrap(function (_context66) {
3211
+ while (1) switch (_context66.prev = _context66.next) {
3234
3212
  case 0:
3235
3213
  expect.assertions(12); // Updated to match actual assertion count
3236
3214
  responsePayload = {
@@ -3242,43 +3220,43 @@ describe('Supplementary Services tests', function () {
3242
3220
  infoSpy = jest.spyOn(_Logger.default, 'info');
3243
3221
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3244
3222
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3245
- var _ref66 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65(correlationId) {
3246
- return _regenerator.default.wrap(function _callee65$(_context65) {
3247
- while (1) switch (_context65.prev = _context65.next) {
3223
+ var _ref65 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64(correlationId) {
3224
+ return _regenerator.default.wrap(function (_context64) {
3225
+ while (1) switch (_context64.prev = _context64.next) {
3248
3226
  case 0:
3249
3227
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3250
3228
  case 1:
3251
3229
  case "end":
3252
- return _context65.stop();
3230
+ return _context64.stop();
3253
3231
  }
3254
- }, _callee65);
3232
+ }, _callee64);
3255
3233
  }));
3256
3234
  return function (_x1) {
3257
- return _ref66.apply(this, arguments);
3235
+ return _ref65.apply(this, arguments);
3258
3236
  };
3259
3237
  }());
3260
3238
  secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3261
- var _ref67 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66(correlationId) {
3262
- return _regenerator.default.wrap(function _callee66$(_context66) {
3263
- while (1) switch (_context66.prev = _context66.next) {
3239
+ var _ref66 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65(correlationId) {
3240
+ return _regenerator.default.wrap(function (_context65) {
3241
+ while (1) switch (_context65.prev = _context65.next) {
3264
3242
  case 0:
3265
3243
  expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
3266
3244
  case 1:
3267
3245
  case "end":
3268
- return _context66.stop();
3246
+ return _context65.stop();
3269
3247
  }
3270
- }, _callee66);
3248
+ }, _callee65);
3271
3249
  }));
3272
3250
  return function (_x10) {
3273
- return _ref67.apply(this, arguments);
3251
+ return _ref66.apply(this, arguments);
3274
3252
  };
3275
3253
  }());
3276
- _context67.next = 10;
3254
+ _context66.next = 1;
3277
3255
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3278
- case 10:
3279
- _context67.next = 12;
3256
+ case 1:
3257
+ _context66.next = 2;
3280
3258
  return (0, _testUtil.flushPromises)(2);
3281
- case 12:
3259
+ case 2:
3282
3260
  expect(requestSpy).toBeCalled();
3283
3261
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined);
3284
3262
  call.sendCallStateMachineEvt({
@@ -3297,16 +3275,16 @@ describe('Supplementary Services tests', function () {
3297
3275
  expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3298
3276
  expect(infoSpy).toHaveBeenCalledWith("Initiating Consult transfer between : ".concat(call.getCallId(), " and ").concat(secondCall.getCallId()), transferLoggingContext);
3299
3277
  expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3300
- case 24:
3278
+ case 3:
3301
3279
  case "end":
3302
- return _context67.stop();
3280
+ return _context66.stop();
3303
3281
  }
3304
- }, _callee67);
3282
+ }, _callee66);
3305
3283
  })));
3306
- it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69() {
3284
+ it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68() {
3307
3285
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3308
- return _regenerator.default.wrap(function _callee69$(_context69) {
3309
- while (1) switch (_context69.prev = _context69.next) {
3286
+ return _regenerator.default.wrap(function (_context68) {
3287
+ while (1) switch (_context68.prev = _context68.next) {
3310
3288
  case 0:
3311
3289
  expect.assertions(10); // Updated to match actual assertion count
3312
3290
  responsePayload = {
@@ -3318,27 +3296,27 @@ describe('Supplementary Services tests', function () {
3318
3296
  infoSpy = jest.spyOn(_Logger.default, 'info');
3319
3297
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3320
3298
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3321
- var _ref69 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68(correlationId) {
3322
- return _regenerator.default.wrap(function _callee68$(_context68) {
3323
- while (1) switch (_context68.prev = _context68.next) {
3299
+ var _ref68 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67(correlationId) {
3300
+ return _regenerator.default.wrap(function (_context67) {
3301
+ while (1) switch (_context67.prev = _context67.next) {
3324
3302
  case 0:
3325
3303
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3326
3304
  case 1:
3327
3305
  case "end":
3328
- return _context68.stop();
3306
+ return _context67.stop();
3329
3307
  }
3330
- }, _callee68);
3308
+ }, _callee67);
3331
3309
  }));
3332
3310
  return function (_x11) {
3333
- return _ref69.apply(this, arguments);
3311
+ return _ref68.apply(this, arguments);
3334
3312
  };
3335
3313
  }());
3336
- _context69.next = 9;
3314
+ _context68.next = 1;
3337
3315
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3338
- case 9:
3339
- _context69.next = 11;
3316
+ case 1:
3317
+ _context68.next = 2;
3340
3318
  return (0, _testUtil.flushPromises)(2);
3341
- case 11:
3319
+ case 2:
3342
3320
  expect(requestSpy).toBeCalled();
3343
3321
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined);
3344
3322
  call.sendCallStateMachineEvt({
@@ -3353,16 +3331,16 @@ describe('Supplementary Services tests', function () {
3353
3331
  expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3354
3332
  expect(infoSpy).toHaveBeenCalledWith("Initiating Blind transfer with : ".concat(transfereeNumber), transferLoggingContext);
3355
3333
  expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3356
- case 21:
3334
+ case 3:
3357
3335
  case "end":
3358
- return _context69.stop();
3336
+ return _context68.stop();
3359
3337
  }
3360
- }, _callee69);
3338
+ }, _callee68);
3361
3339
  })));
3362
- it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
3340
+ it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69() {
3363
3341
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3364
- return _regenerator.default.wrap(function _callee70$(_context70) {
3365
- while (1) switch (_context70.prev = _context70.next) {
3342
+ return _regenerator.default.wrap(function (_context69) {
3343
+ while (1) switch (_context69.prev = _context69.next) {
3366
3344
  case 0:
3367
3345
  responsePayload = {
3368
3346
  statusCode: 403,
@@ -3373,12 +3351,12 @@ describe('Supplementary Services tests', function () {
3373
3351
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3374
3352
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3375
3353
  call['broadworksCorrelationInfo'] = 'dummy-broadworks-correlation-info';
3376
- _context70.next = 8;
3354
+ _context69.next = 1;
3377
3355
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3378
- case 8:
3379
- _context70.next = 10;
3356
+ case 1:
3357
+ _context69.next = 2;
3380
3358
  return (0, _testUtil.flushPromises)(1);
3381
- case 10:
3359
+ case 2:
3382
3360
  expect(requestSpy).toBeCalled();
3383
3361
  /* We should be in CALL_ESTABLISHED state */
3384
3362
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -3395,16 +3373,16 @@ describe('Supplementary Services tests', function () {
3395
3373
  expect(emitSpy).toBeCalledOnceWith(_types2.CALL_EVENT_KEYS.TRANSFER_ERROR, expect.any(_Errors.CallError));
3396
3374
  expect(warnSpy).toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3397
3375
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
3398
- case 18:
3376
+ case 3:
3399
3377
  case "end":
3400
- return _context70.stop();
3378
+ return _context69.stop();
3401
3379
  }
3402
- }, _callee70);
3380
+ }, _callee69);
3403
3381
  })));
3404
- it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
3382
+ it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
3405
3383
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3406
- return _regenerator.default.wrap(function _callee71$(_context71) {
3407
- while (1) switch (_context71.prev = _context71.next) {
3384
+ return _regenerator.default.wrap(function (_context70) {
3385
+ while (1) switch (_context70.prev = _context70.next) {
3408
3386
  case 0:
3409
3387
  responsePayload = {
3410
3388
  statusCode: 403,
@@ -3414,12 +3392,12 @@ describe('Supplementary Services tests', function () {
3414
3392
  requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3415
3393
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3416
3394
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3417
- _context71.next = 7;
3395
+ _context70.next = 1;
3418
3396
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3419
- case 7:
3420
- _context71.next = 9;
3397
+ case 1:
3398
+ _context70.next = 2;
3421
3399
  return (0, _testUtil.flushPromises)(2);
3422
- case 9:
3400
+ case 2:
3423
3401
  expect(requestSpy).toBeCalled();
3424
3402
  /* We should be in CALL_ESTABLISHED state */
3425
3403
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -3436,22 +3414,22 @@ describe('Supplementary Services tests', function () {
3436
3414
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.TRANSFER_ERROR, expect.any(_Errors.CallError));
3437
3415
  expect(warnSpy).toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3438
3416
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
3439
- case 18:
3417
+ case 3:
3440
3418
  case "end":
3441
- return _context71.stop();
3419
+ return _context70.stop();
3442
3420
  }
3443
- }, _callee71);
3421
+ }, _callee70);
3444
3422
  })));
3445
- it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3423
+ it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
3446
3424
  var requestSpy, warnSpy;
3447
- return _regenerator.default.wrap(function _callee72$(_context72) {
3448
- while (1) switch (_context72.prev = _context72.next) {
3425
+ return _regenerator.default.wrap(function (_context71) {
3426
+ while (1) switch (_context71.prev = _context71.next) {
3449
3427
  case 0:
3450
3428
  requestSpy = jest.spyOn(webex, 'request');
3451
3429
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3452
- _context72.next = 4;
3430
+ _context71.next = 1;
3453
3431
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
3454
- case 4:
3432
+ case 1:
3455
3433
  /* We should be in CALL_ESTABLISHED state */
3456
3434
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3457
3435
  expect(secondCall['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -3459,22 +3437,22 @@ describe('Supplementary Services tests', function () {
3459
3437
  expect(uploadLogsSpy).not.toBeCalled();
3460
3438
  expect(requestSpy).not.toBeCalled();
3461
3439
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3462
- case 10:
3440
+ case 2:
3463
3441
  case "end":
3464
- return _context72.stop();
3442
+ return _context71.stop();
3465
3443
  }
3466
- }, _callee72);
3444
+ }, _callee71);
3467
3445
  })));
3468
- it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
3446
+ it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3469
3447
  var requestSpy, warnSpy;
3470
- return _regenerator.default.wrap(function _callee73$(_context73) {
3471
- while (1) switch (_context73.prev = _context73.next) {
3448
+ return _regenerator.default.wrap(function (_context72) {
3449
+ while (1) switch (_context72.prev = _context72.next) {
3472
3450
  case 0:
3473
3451
  requestSpy = jest.spyOn(webex, 'request');
3474
3452
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3475
- _context73.next = 4;
3453
+ _context72.next = 1;
3476
3454
  return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
3477
- case 4:
3455
+ case 1:
3478
3456
  /* We should be in CALL_ESTABLISHED state */
3479
3457
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3480
3458
  expect(secondCall['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -3482,11 +3460,11 @@ describe('Supplementary Services tests', function () {
3482
3460
  expect(uploadLogsSpy).not.toBeCalled();
3483
3461
  expect(requestSpy).not.toBeCalled();
3484
3462
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3485
- case 10:
3463
+ case 2:
3486
3464
  case "end":
3487
- return _context73.stop();
3465
+ return _context72.stop();
3488
3466
  }
3489
- }, _callee73);
3467
+ }, _callee72);
3490
3468
  })));
3491
3469
  });
3492
3470
  });