@webex/calling 3.0.1 → 3.1.0-next.2

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 (55) hide show
  1. package/dist/CallHistory/CallHistory.js +132 -18
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +214 -4
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallHistory/callHistoryFixtures.js +38 -1
  6. package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
  7. package/dist/CallHistory/constants.js +5 -1
  8. package/dist/CallHistory/constants.js.map +1 -1
  9. package/dist/CallHistory/types.js.map +1 -1
  10. package/dist/CallingClient/calling/call.js +80 -23
  11. package/dist/CallingClient/calling/call.js.map +1 -1
  12. package/dist/CallingClient/calling/call.test.js +482 -378
  13. package/dist/CallingClient/calling/call.test.js.map +1 -1
  14. package/dist/CallingClient/constants.js +3 -1
  15. package/dist/CallingClient/constants.js.map +1 -1
  16. package/dist/Events/types.js +2 -0
  17. package/dist/Events/types.js.map +1 -1
  18. package/dist/Metrics/index.js +30 -0
  19. package/dist/Metrics/index.js.map +1 -1
  20. package/dist/Metrics/index.test.js +52 -2
  21. package/dist/Metrics/index.test.js.map +1 -1
  22. package/dist/Metrics/types.js +2 -0
  23. package/dist/Metrics/types.js.map +1 -1
  24. package/dist/common/Utils.js.map +1 -1
  25. package/dist/module/CallHistory/CallHistory.js +51 -1
  26. package/dist/module/CallHistory/callHistoryFixtures.js +38 -1
  27. package/dist/module/CallHistory/constants.js +4 -0
  28. package/dist/module/CallingClient/calling/call.js +67 -15
  29. package/dist/module/CallingClient/constants.js +1 -0
  30. package/dist/module/Events/types.js +2 -0
  31. package/dist/module/Metrics/index.js +28 -0
  32. package/dist/module/Metrics/types.js +2 -0
  33. package/dist/types/CallHistory/CallHistory.d.ts +4 -2
  34. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  35. package/dist/types/CallHistory/callHistoryFixtures.d.ts +19 -1
  36. package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
  37. package/dist/types/CallHistory/constants.d.ts +4 -0
  38. package/dist/types/CallHistory/constants.d.ts.map +1 -1
  39. package/dist/types/CallHistory/types.d.ts +10 -1
  40. package/dist/types/CallHistory/types.d.ts.map +1 -1
  41. package/dist/types/CallingClient/calling/call.d.ts +6 -1
  42. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  43. package/dist/types/CallingClient/constants.d.ts +1 -0
  44. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  45. package/dist/types/Contacts/ContactsClient.d.ts +1 -1
  46. package/dist/types/Events/types.d.ts +29 -2
  47. package/dist/types/Events/types.d.ts.map +1 -1
  48. package/dist/types/Metrics/index.d.ts.map +1 -1
  49. package/dist/types/Metrics/types.d.ts +3 -0
  50. package/dist/types/Metrics/types.d.ts.map +1 -1
  51. package/dist/types/Voicemail/UcmBackendConnector.d.ts +1 -1
  52. package/dist/types/Voicemail/WxCallBackendConnector.d.ts +1 -1
  53. package/dist/types/common/Utils.d.ts +2 -2
  54. package/dist/types/common/Utils.d.ts.map +1 -1
  55. package/package.json +3 -3
@@ -11,6 +11,7 @@ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/pr
11
11
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
12
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
13
13
  var MediaSDK = _interopRequireWildcard(require("@webex/internal-media-core"));
14
+ var _webMediaEffects = require("@webex/web-media-effects");
14
15
  var _types = require("../../Errors/types");
15
16
  var _Utils = _interopRequireWildcard(require("../../common/Utils"));
16
17
  var Utils = _Utils;
@@ -103,6 +104,12 @@ describe('Call Tests', function () {
103
104
  var mockTrack = {
104
105
  enabled: false
105
106
  };
107
+ var mockEffect = {
108
+ isEnabled: true,
109
+ effectTrack: mockTrack,
110
+ on: jest.fn(),
111
+ off: jest.fn()
112
+ };
106
113
  var roapMediaConnectionConfig = {
107
114
  skipInactiveTransceivers: true,
108
115
  iceServers: [],
@@ -204,10 +211,8 @@ describe('Call Tests', function () {
204
211
  });
205
212
  callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
206
213
  mockStream = {
207
- outputStream: {
208
- getAudioTracks: jest.fn().mockReturnValue([mockTrack])
209
- },
210
- on: jest.fn()
214
+ on: jest.fn(),
215
+ setUserMuted: jest.fn()
211
216
  };
212
217
  localAudioStream = mockStream;
213
218
  call = callManager.createCall(dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId);
@@ -216,9 +221,9 @@ describe('Call Tests', function () {
216
221
  expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(1);
217
222
  call.mute(localAudioStream);
218
223
  expect(call.isMuted()).toEqual(true);
219
- expect(mockTrack.enabled).toEqual(false);
224
+ expect(mockStream.setUserMuted).toBeCalledOnceWith(true);
220
225
  call.mute(localAudioStream);
221
- expect(mockTrack.enabled).toEqual(true);
226
+ expect(mockStream.setUserMuted).toBeCalledWith(false);
222
227
  expect(call.isMuted()).toEqual(false);
223
228
  call.end();
224
229
  _context2.next = 16;
@@ -343,7 +348,7 @@ describe('Call Tests', function () {
343
348
  }, _callee6, null, [[1, 7]]);
344
349
  })));
345
350
  it('dial functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
346
- var mockStream, localAudioStream, warnSpy, call;
351
+ var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy;
347
352
  return _regenerator.default.wrap(function _callee7$(_context7) {
348
353
  while (1) switch (_context7.prev = _context7.next) {
349
354
  case 0:
@@ -351,15 +356,21 @@ describe('Call Tests', function () {
351
356
  outputStream: {
352
357
  getAudioTracks: jest.fn().mockReturnValue([mockTrack])
353
358
  },
354
- on: jest.fn()
359
+ on: jest.fn(),
360
+ getEffectByKind: jest.fn().mockImplementation(function () {
361
+ return mockEffect;
362
+ })
355
363
  };
356
364
  localAudioStream = mockStream;
357
365
  warnSpy = jest.spyOn(_Logger.default, 'warn');
358
366
  call = (0, _call.createCall)(activeUrl, webex, dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator);
367
+ bnrMetricSpy = jest.spyOn(call['metricManager'], 'submitBNRMetric');
359
368
  call.dial(localAudioStream);
360
369
  expect(mockTrack.enabled).toEqual(true);
361
370
  expect(mockMediaSDK.RoapMediaConnection).toBeCalledOnceWith(roapMediaConnectionConfig, roapMediaConnectionOptions, expect.any(String));
362
371
  expect(call['mediaStateMachine'].state.value).toBe('S_SEND_ROAP_OFFER');
372
+ expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
373
+
363
374
  /* Now change the state and recall to check for error */
364
375
  call['mediaStateMachine'].state.value = 'S_SEND_ROAP_OFFER';
365
376
  call.dial(localAudioStream);
@@ -368,14 +379,14 @@ describe('Call Tests', function () {
368
379
  file: 'call',
369
380
  method: 'dial'
370
381
  });
371
- case 12:
382
+ case 14:
372
383
  case "end":
373
384
  return _context7.stop();
374
385
  }
375
386
  }, _callee7);
376
387
  })));
377
388
  it('answer functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
378
- var mockStream, localAudioStream, warnSpy, call;
389
+ var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy;
379
390
  return _regenerator.default.wrap(function _callee8$(_context8) {
380
391
  while (1) switch (_context8.prev = _context8.next) {
381
392
  case 0:
@@ -383,12 +394,16 @@ describe('Call Tests', function () {
383
394
  outputStream: {
384
395
  getAudioTracks: jest.fn().mockReturnValue([mockTrack])
385
396
  },
386
- on: jest.fn()
397
+ on: jest.fn(),
398
+ getEffectByKind: jest.fn().mockImplementation(function () {
399
+ return mockEffect;
400
+ })
387
401
  };
388
402
  localAudioStream = mockStream;
389
403
  warnSpy = jest.spyOn(_Logger.default, 'warn');
390
404
  call = (0, _call.createCall)(activeUrl, webex, dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator);
391
405
  /** Cannot answer in idle state */
406
+ bnrMetricSpy = jest.spyOn(call['metricManager'], 'submitBNRMetric');
392
407
  call.answer(localAudioStream);
393
408
  expect(mockTrack.enabled).toEqual(true);
394
409
  expect(mockMediaSDK.RoapMediaConnection).toBeCalledOnceWith(roapMediaConnectionConfig, roapMediaConnectionOptions, expect.any(String));
@@ -402,22 +417,97 @@ describe('Call Tests', function () {
402
417
  call['callStateMachine'].state.value = 'S_SEND_CALL_PROGRESS';
403
418
  call.answer(localAudioStream);
404
419
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
405
- case 12:
420
+ expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
421
+ case 14:
406
422
  case "end":
407
423
  return _context8.stop();
408
424
  }
409
425
  }, _callee8);
410
426
  })));
411
- it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
412
- var mockStream, localAudioStream, warnSpy, call;
427
+ it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
428
+ var mockStream, localAudioStream, onStreamSpy, onEffectSpy, offStreamSpy, offEffectSpy, call, updateLocalTracksSpy, bnrMetricSpy;
413
429
  return _regenerator.default.wrap(function _callee9$(_context9) {
414
430
  while (1) switch (_context9.prev = _context9.next) {
431
+ case 0:
432
+ mockStream = {
433
+ outputStream: {
434
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
435
+ },
436
+ on: jest.fn(),
437
+ off: jest.fn(),
438
+ getEffectByKind: jest.fn()
439
+ };
440
+ localAudioStream = mockStream;
441
+ onStreamSpy = jest.spyOn(localAudioStream, 'on');
442
+ onEffectSpy = jest.spyOn(mockEffect, 'on');
443
+ offStreamSpy = jest.spyOn(localAudioStream, 'off');
444
+ offEffectSpy = jest.spyOn(mockEffect, 'off');
445
+ call = (0, _call.createCall)(activeUrl, webex, dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator);
446
+ call.dial(localAudioStream);
447
+ expect(mockTrack.enabled).toEqual(true);
448
+ expect(mockMediaSDK.RoapMediaConnection).toBeCalledOnceWith(roapMediaConnectionConfig, roapMediaConnectionOptions, expect.any(String));
449
+ expect(call['mediaStateMachine'].state.value).toBe('S_SEND_ROAP_OFFER');
450
+ updateLocalTracksSpy = jest.spyOn(call['mediaConnection'], 'updateLocalTracks');
451
+ bnrMetricSpy = jest.spyOn(call['metricManager'], 'submitBNRMetric');
452
+ /* Update the stream with the effect */
453
+ jest.spyOn(localAudioStream, 'getEffectByKind').mockReturnValue(mockEffect);
454
+
455
+ /* Checking if listeners on the localAudioStream have been registered */
456
+ expect(onStreamSpy).toBeCalledTimes(2);
457
+ expect(onStreamSpy).toBeCalledWith(MediaSDK.LocalStreamEventNames.OutputTrackChange, expect.any(Function));
458
+ expect(onStreamSpy).toBeCalledWith(MediaSDK.LocalStreamEventNames.EffectAdded, expect.any(Function));
459
+ bnrMetricSpy.mockClear();
460
+ /* Invoking the callback function to trigger EffectAdded event to simulate adding effect to the stream */
461
+ onStreamSpy.mock.calls[1][1](mockEffect);
462
+ expect(onEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Enabled, expect.any(Function));
463
+ expect(onEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Disabled, expect.any(Function));
464
+
465
+ /* Send Enabled event on the effect, update track and send metrics for BNR disabled */
466
+ onStreamSpy.mock.calls[0][1](mockTrack);
467
+ onEffectSpy.mock.calls[0][1]();
468
+ expect(updateLocalTracksSpy).toBeCalledOnceWith({
469
+ audio: mockTrack
470
+ });
471
+ expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
472
+
473
+ /* Clear the mocks */
474
+ updateLocalTracksSpy.mockClear();
475
+ bnrMetricSpy.mockClear();
476
+
477
+ /* Send Disabled event on the effect, update track and send metrics for BNR disabled */
478
+ mockEffect.isEnabled = false;
479
+ onStreamSpy.mock.calls[0][1](mockTrack);
480
+ onEffectSpy.mock.calls[1][1]();
481
+ expect(updateLocalTracksSpy).toBeCalledOnceWith({
482
+ audio: mockTrack
483
+ });
484
+ expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_DISABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
485
+ call.end();
486
+ _context9.next = 35;
487
+ return (0, _Utils.waitForMsecs)(50);
488
+ case 35:
489
+ /* Checks for switching off the listeners on call disconnect */
490
+ expect(offStreamSpy).toBeCalledWith(MediaSDK.LocalStreamEventNames.EffectAdded, expect.any(Function));
491
+ expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Enabled, expect.any(Function));
492
+ expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Disabled, expect.any(Function));
493
+ case 38:
494
+ case "end":
495
+ return _context9.stop();
496
+ }
497
+ }, _callee9);
498
+ })));
499
+ it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
500
+ var mockStream, localAudioStream, warnSpy, call;
501
+ return _regenerator.default.wrap(function _callee10$(_context10) {
502
+ while (1) switch (_context10.prev = _context10.next) {
415
503
  case 0:
416
504
  mockStream = {
417
505
  outputStream: {
418
506
  getAudioTracks: jest.fn().mockReturnValue([])
419
507
  },
420
- on: jest.fn()
508
+ on: jest.fn(),
509
+ off: jest.fn(),
510
+ getEffectByKind: jest.fn()
421
511
  };
422
512
  localAudioStream = mockStream;
423
513
  webex.request.mockReturnValue({
@@ -433,7 +523,7 @@ describe('Call Tests', function () {
433
523
  warnSpy = jest.spyOn(_Logger.default, 'warn');
434
524
  call = (0, _call.createCall)(activeUrl, webex, dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator);
435
525
  call.answer(localAudioStream);
436
- _context9.next = 8;
526
+ _context10.next = 8;
437
527
  return (0, _Utils.waitForMsecs)(50);
438
528
  case 8:
439
529
  expect(warnSpy).toBeCalledTimes(2);
@@ -448,14 +538,14 @@ describe('Call Tests', function () {
448
538
  expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
449
539
  case 15:
450
540
  case "end":
451
- return _context9.stop();
541
+ return _context10.stop();
452
542
  }
453
- }, _callee9);
543
+ }, _callee10);
454
544
  })));
455
- it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
545
+ it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
456
546
  var mockStream, localAudioStream, warnSpy, call;
457
- return _regenerator.default.wrap(function _callee10$(_context10) {
458
- while (1) switch (_context10.prev = _context10.next) {
547
+ return _regenerator.default.wrap(function _callee11$(_context11) {
548
+ while (1) switch (_context11.prev = _context11.next) {
459
549
  case 0:
460
550
  mockStream = {
461
551
  outputStream: {
@@ -467,7 +557,7 @@ describe('Call Tests', function () {
467
557
  warnSpy = jest.spyOn(_Logger.default, 'warn');
468
558
  call = (0, _call.createCall)(activeUrl, webex, dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator);
469
559
  call.dial(localAudioStream);
470
- _context10.next = 7;
560
+ _context11.next = 7;
471
561
  return (0, _Utils.waitForMsecs)(50);
472
562
  case 7:
473
563
  expect(warnSpy).toBeCalledTimes(1);
@@ -480,9 +570,9 @@ describe('Call Tests', function () {
480
570
  expect(webex.request).not.toBeCalledOnceWith();
481
571
  case 12:
482
572
  case "end":
483
- return _context10.stop();
573
+ return _context11.stop();
484
574
  }
485
- }, _callee10);
575
+ }, _callee11);
486
576
  })));
487
577
  it('update media after call creation with valid stream', function () {
488
578
  var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
@@ -490,12 +580,19 @@ describe('Call Tests', function () {
490
580
  outputStream: {
491
581
  getAudioTracks: jest.fn().mockReturnValue([mockTrack])
492
582
  },
493
- on: jest.fn()
583
+ on: jest.fn(),
584
+ off: jest.fn(),
585
+ getEffectByKind: jest.fn()
494
586
  };
495
587
  var localAudioStream = mockStream;
588
+ var onStream1Spy = jest.spyOn(localAudioStream, 'on');
589
+ var offStream1Spy = jest.spyOn(localAudioStream, 'off');
496
590
  var call = callManager.createCall(dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId);
497
591
  call.dial(localAudioStream);
498
592
  expect(mockTrack.enabled).toEqual(true);
593
+ expect(onStream1Spy).toBeCalledTimes(2);
594
+ expect(onStream1Spy).toBeCalledWith(MediaSDK.LocalStreamEventNames.OutputTrackChange, expect.any(Function));
595
+ expect(onStream1Spy).toBeCalledWith(MediaSDK.LocalStreamEventNames.EffectAdded, expect.any(Function));
499
596
  var mockTrack2 = {
500
597
  enabled: true
501
598
  };
@@ -503,13 +600,19 @@ describe('Call Tests', function () {
503
600
  outputStream: {
504
601
  getAudioTracks: jest.fn().mockReturnValue([mockTrack2])
505
602
  },
506
- on: jest.fn()
603
+ on: jest.fn(),
604
+ getEffectByKind: jest.fn()
507
605
  };
508
606
  var localAudioStream2 = mockStream2;
607
+ var onStream2Spy = jest.spyOn(localAudioStream2, 'on');
509
608
  call.updateMedia(localAudioStream2);
510
609
  expect(call['mediaConnection'].updateLocalTracks).toBeCalledOnceWith({
511
610
  audio: mockTrack2
512
611
  });
612
+ expect(call['localAudioStream']).toEqual(localAudioStream2);
613
+ expect(offStream1Spy).toBeCalledWith(MediaSDK.LocalStreamEventNames.EffectAdded, expect.any(Function));
614
+ expect(onStream2Spy).toBeCalledWith(MediaSDK.LocalStreamEventNames.OutputTrackChange, expect.any(Function));
615
+ expect(onStream2Spy).toBeCalledWith(MediaSDK.LocalStreamEventNames.EffectAdded, expect.any(Function));
513
616
  });
514
617
  it('update media with invalid stream', function () {
515
618
  var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
@@ -518,7 +621,8 @@ describe('Call Tests', function () {
518
621
  outputStream: {
519
622
  getAudioTracks: jest.fn().mockReturnValue([mockTrack])
520
623
  },
521
- on: jest.fn()
624
+ on: jest.fn(),
625
+ getEffectByKind: jest.fn()
522
626
  };
523
627
  var localAudioStream = mockStream;
524
628
  var call = callManager.createCall(dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId);
@@ -567,10 +671,10 @@ describe('State Machine handler tests', function () {
567
671
 
568
672
  // afterEach(() => call.removeAllListeners());
569
673
 
570
- it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
674
+ it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
571
675
  var statusPayload, dummyEvent, funcSpy, logSpy;
572
- return _regenerator.default.wrap(function _callee11$(_context11) {
573
- while (1) switch (_context11.prev = _context11.next) {
676
+ return _regenerator.default.wrap(function _callee12$(_context12) {
677
+ while (1) switch (_context12.prev = _context12.next) {
574
678
  case 0:
575
679
  statusPayload = {
576
680
  statusCode: 200,
@@ -590,7 +694,7 @@ describe('State Machine handler tests', function () {
590
694
  /* This is to flush all the promises from the Promise queue so that
591
695
  * Jest.fakeTimers can advance time and also clear the promise Queue
592
696
  */
593
- _context11.next = 11;
697
+ _context12.next = 11;
594
698
  return (0, _testUtil.flushPromises)(3);
595
699
  case 11:
596
700
  expect(setInterval).toHaveBeenCalledTimes(1);
@@ -601,14 +705,14 @@ describe('State Machine handler tests', function () {
601
705
  });
602
706
  case 14:
603
707
  case "end":
604
- return _context11.stop();
708
+ return _context12.stop();
605
709
  }
606
- }, _callee11);
710
+ }, _callee12);
607
711
  })));
608
- it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
712
+ it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
609
713
  var statusPayload, funcSpy;
610
- return _regenerator.default.wrap(function _callee12$(_context12) {
611
- while (1) switch (_context12.prev = _context12.next) {
714
+ return _regenerator.default.wrap(function _callee13$(_context13) {
715
+ while (1) switch (_context13.prev = _context13.next) {
612
716
  case 0:
613
717
  expect.assertions(4);
614
718
  statusPayload = {
@@ -632,24 +736,24 @@ describe('State Machine handler tests', function () {
632
736
  /* This is to flush all the promises from the Promise queue so that
633
737
  * Jest.fakeTimers can advance time and also clear the promise Queue
634
738
  */
635
- _context12.next = 11;
739
+ _context13.next = 11;
636
740
  return _promise.default.resolve();
637
741
  case 11:
638
- _context12.next = 13;
742
+ _context13.next = 13;
639
743
  return _promise.default.resolve();
640
744
  case 13:
641
745
  expect(clearInterval).toHaveBeenCalledTimes(1);
642
746
  expect(funcSpy).toBeCalledTimes(1);
643
747
  case 15:
644
748
  case "end":
645
- return _context12.stop();
749
+ return _context13.stop();
646
750
  }
647
- }, _callee12);
751
+ }, _callee13);
648
752
  })));
649
- it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
753
+ it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
650
754
  var statusPayload, dummyEvent, postMediaSpy, deleteSpy, dummyOkEvent;
651
- return _regenerator.default.wrap(function _callee13$(_context13) {
652
- while (1) switch (_context13.prev = _context13.next) {
755
+ return _regenerator.default.wrap(function _callee14$(_context14) {
756
+ while (1) switch (_context14.prev = _context14.next) {
653
757
  case 0:
654
758
  statusPayload = {
655
759
  statusCode: 200,
@@ -705,14 +809,14 @@ describe('State Machine handler tests', function () {
705
809
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
706
810
  case 27:
707
811
  case "end":
708
- return _context13.stop();
812
+ return _context14.stop();
709
813
  }
710
- }, _callee13);
814
+ }, _callee14);
711
815
  })));
712
- it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
816
+ it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
713
817
  var statusPayload, dummyEvent;
714
- return _regenerator.default.wrap(function _callee14$(_context14) {
715
- while (1) switch (_context14.prev = _context14.next) {
818
+ return _regenerator.default.wrap(function _callee15$(_context15) {
819
+ while (1) switch (_context15.prev = _context15.next) {
716
820
  case 0:
717
821
  call['direction'] = _types3.CallDirection.INBOUND;
718
822
  statusPayload = {
@@ -730,7 +834,7 @@ describe('State Machine handler tests', function () {
730
834
  webex.request.mockReturnValue(statusPayload);
731
835
  call.sendCallStateMachineEvt(dummyEvent);
732
836
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
733
- _context14.next = 8;
837
+ _context15.next = 8;
734
838
  return call['handleOutgoingCallConnect']({
735
839
  type: 'E_SEND_CALL_CONNECT'
736
840
  });
@@ -744,14 +848,14 @@ describe('State Machine handler tests', function () {
744
848
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
745
849
  case 12:
746
850
  case "end":
747
- return _context14.stop();
851
+ return _context15.stop();
748
852
  }
749
- }, _callee14);
853
+ }, _callee15);
750
854
  })));
751
- it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
855
+ it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
752
856
  var warnSpy, stateMachineSpy, statusPayload, roapMessage;
753
- return _regenerator.default.wrap(function _callee15$(_context15) {
754
- while (1) switch (_context15.prev = _context15.next) {
857
+ return _regenerator.default.wrap(function _callee16$(_context16) {
858
+ while (1) switch (_context16.prev = _context16.next) {
755
859
  case 0:
756
860
  warnSpy = jest.spyOn(_Logger.default, 'warn');
757
861
  stateMachineSpy = jest.spyOn(call, 'sendCallStateMachineEvt');
@@ -777,7 +881,7 @@ describe('State Machine handler tests', function () {
777
881
  webex.request.mockRejectedValueOnce({
778
882
  statusCode: 403
779
883
  }).mockResolvedValue(statusPayload);
780
- _context15.next = 12;
884
+ _context16.next = 12;
781
885
  return call['handleOutgoingCallConnect']({
782
886
  type: 'E_SEND_CALL_CONNECT'
783
887
  });
@@ -787,14 +891,14 @@ describe('State Machine handler tests', function () {
787
891
  expect(warnSpy).toBeCalledTimes(4);
788
892
  case 15:
789
893
  case "end":
790
- return _context15.stop();
894
+ return _context16.stop();
791
895
  }
792
- }, _callee15);
896
+ }, _callee16);
793
897
  })));
794
- it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
898
+ it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
795
899
  var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent;
796
- return _regenerator.default.wrap(function _callee16$(_context16) {
797
- while (1) switch (_context16.prev = _context16.next) {
900
+ return _regenerator.default.wrap(function _callee17$(_context17) {
901
+ while (1) switch (_context17.prev = _context17.next) {
798
902
  case 0:
799
903
  statusPayload = {
800
904
  statusCode: 200,
@@ -868,14 +972,14 @@ describe('State Machine handler tests', function () {
868
972
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
869
973
  case 40:
870
974
  case "end":
871
- return _context16.stop();
975
+ return _context17.stop();
872
976
  }
873
- }, _callee16);
977
+ }, _callee17);
874
978
  })));
875
- 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 _callee17() {
979
+ 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 _callee18() {
876
980
  var statusPayload, dummySetupEvent, dummyConnectEvent, dummyOfferEvent, dummyAnswerEvent, dummyOkEvent, postMediaSpy;
877
- return _regenerator.default.wrap(function _callee17$(_context17) {
878
- while (1) switch (_context17.prev = _context17.next) {
981
+ return _regenerator.default.wrap(function _callee18$(_context18) {
982
+ while (1) switch (_context18.prev = _context18.next) {
879
983
  case 0:
880
984
  statusPayload = {
881
985
  statusCode: 200,
@@ -943,14 +1047,14 @@ describe('State Machine handler tests', function () {
943
1047
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
944
1048
  case 25:
945
1049
  case "end":
946
- return _context17.stop();
1050
+ return _context18.stop();
947
1051
  }
948
- }, _callee17);
1052
+ }, _callee18);
949
1053
  })));
950
- it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
1054
+ it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
951
1055
  var statusPayload, dummyEvent;
952
- return _regenerator.default.wrap(function _callee18$(_context18) {
953
- while (1) switch (_context18.prev = _context18.next) {
1056
+ return _regenerator.default.wrap(function _callee19$(_context19) {
1057
+ while (1) switch (_context19.prev = _context19.next) {
954
1058
  case 0:
955
1059
  statusPayload = {
956
1060
  statusCode: 200,
@@ -989,14 +1093,14 @@ describe('State Machine handler tests', function () {
989
1093
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
990
1094
  case 17:
991
1095
  case "end":
992
- return _context18.stop();
1096
+ return _context19.stop();
993
1097
  }
994
- }, _callee18);
1098
+ }, _callee19);
995
1099
  })));
996
- it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
1100
+ it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
997
1101
  var statusPayload, dummyEvent;
998
- return _regenerator.default.wrap(function _callee19$(_context19) {
999
- while (1) switch (_context19.prev = _context19.next) {
1102
+ return _regenerator.default.wrap(function _callee20$(_context20) {
1103
+ while (1) switch (_context20.prev = _context20.next) {
1000
1104
  case 0:
1001
1105
  statusPayload = {
1002
1106
  statusCode: 403,
@@ -1012,20 +1116,20 @@ describe('State Machine handler tests', function () {
1012
1116
  };
1013
1117
  webex.request.mockRejectedValueOnce(statusPayload);
1014
1118
  call.sendCallStateMachineEvt(dummyEvent);
1015
- _context19.next = 6;
1119
+ _context20.next = 6;
1016
1120
  return (0, _testUtil.flushPromises)(3);
1017
1121
  case 6:
1018
1122
  expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
1019
1123
  case 7:
1020
1124
  case "end":
1021
- return _context19.stop();
1125
+ return _context20.stop();
1022
1126
  }
1023
- }, _callee19);
1127
+ }, _callee20);
1024
1128
  })));
1025
- it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
1129
+ it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
1026
1130
  var statusPayload, dummyEvent;
1027
- return _regenerator.default.wrap(function _callee20$(_context20) {
1028
- while (1) switch (_context20.prev = _context20.next) {
1131
+ return _regenerator.default.wrap(function _callee21$(_context21) {
1132
+ while (1) switch (_context21.prev = _context21.next) {
1029
1133
  case 0:
1030
1134
  statusPayload = {
1031
1135
  statusCode: 403,
@@ -1042,10 +1146,10 @@ describe('State Machine handler tests', function () {
1042
1146
  call['earlyMedia'] = true;
1043
1147
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
1044
1148
  webex.request.mockRejectedValue(statusPayload);
1045
- _context20.next = 8;
1149
+ _context21.next = 8;
1046
1150
  return call['handleRoapEstablished']({}, dummyEvent);
1047
1151
  case 8:
1048
- _context20.next = 10;
1152
+ _context21.next = 10;
1049
1153
  return (0, _testUtil.flushPromises)(2);
1050
1154
  case 10:
1051
1155
  expect(call.isConnected()).toBe(false);
@@ -1053,14 +1157,14 @@ describe('State Machine handler tests', function () {
1053
1157
  expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
1054
1158
  case 13:
1055
1159
  case "end":
1056
- return _context20.stop();
1160
+ return _context21.stop();
1057
1161
  }
1058
- }, _callee20);
1162
+ }, _callee21);
1059
1163
  })));
1060
- it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
1164
+ it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
1061
1165
  var statusPayload, dummyEvent;
1062
- return _regenerator.default.wrap(function _callee21$(_context21) {
1063
- while (1) switch (_context21.prev = _context21.next) {
1166
+ return _regenerator.default.wrap(function _callee22$(_context22) {
1167
+ while (1) switch (_context22.prev = _context22.next) {
1064
1168
  case 0:
1065
1169
  statusPayload = {
1066
1170
  statusCode: 403,
@@ -1083,14 +1187,14 @@ describe('State Machine handler tests', function () {
1083
1187
  expect(_testUtil.mediaConnection.initiateOffer).toBeCalledOnceWith();
1084
1188
  case 8:
1085
1189
  case "end":
1086
- return _context21.stop();
1190
+ return _context22.stop();
1087
1191
  }
1088
- }, _callee21);
1192
+ }, _callee22);
1089
1193
  })));
1090
- it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
1194
+ it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
1091
1195
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1092
- return _regenerator.default.wrap(function _callee22$(_context22) {
1093
- while (1) switch (_context22.prev = _context22.next) {
1196
+ return _regenerator.default.wrap(function _callee23$(_context23) {
1197
+ while (1) switch (_context23.prev = _context23.next) {
1094
1198
  case 0:
1095
1199
  statusPayload = {
1096
1200
  statusCode: 503,
@@ -1112,7 +1216,7 @@ describe('State Machine handler tests', function () {
1112
1216
  }
1113
1217
  };
1114
1218
  call['connected'] = true;
1115
- _context22.next = 8;
1219
+ _context23.next = 8;
1116
1220
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1117
1221
  case 8:
1118
1222
  jest.advanceTimersByTime(1005);
@@ -1124,14 +1228,14 @@ describe('State Machine handler tests', function () {
1124
1228
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1125
1229
  case 13:
1126
1230
  case "end":
1127
- return _context22.stop();
1231
+ return _context23.stop();
1128
1232
  }
1129
- }, _callee22);
1233
+ }, _callee23);
1130
1234
  })));
1131
- it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
1235
+ it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
1132
1236
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1133
- return _regenerator.default.wrap(function _callee23$(_context23) {
1134
- while (1) switch (_context23.prev = _context23.next) {
1237
+ return _regenerator.default.wrap(function _callee24$(_context24) {
1238
+ while (1) switch (_context24.prev = _context24.next) {
1135
1239
  case 0:
1136
1240
  statusPayload = {
1137
1241
  statusCode: 503,
@@ -1153,7 +1257,7 @@ describe('State Machine handler tests', function () {
1153
1257
  }
1154
1258
  };
1155
1259
  call['connected'] = false;
1156
- _context23.next = 8;
1260
+ _context24.next = 8;
1157
1261
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1158
1262
  case 8:
1159
1263
  jest.advanceTimersByTime(1005);
@@ -1164,14 +1268,14 @@ describe('State Machine handler tests', function () {
1164
1268
  expect(stateMachineSpy).not.toBeCalled();
1165
1269
  case 12:
1166
1270
  case "end":
1167
- return _context23.stop();
1271
+ return _context24.stop();
1168
1272
  }
1169
- }, _callee23);
1273
+ }, _callee24);
1170
1274
  })));
1171
- it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
1275
+ it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
1172
1276
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1173
- return _regenerator.default.wrap(function _callee24$(_context24) {
1174
- while (1) switch (_context24.prev = _context24.next) {
1277
+ return _regenerator.default.wrap(function _callee25$(_context25) {
1278
+ while (1) switch (_context25.prev = _context25.next) {
1175
1279
  case 0:
1176
1280
  statusPayload = {
1177
1281
  statusCode: 503,
@@ -1193,7 +1297,7 @@ describe('State Machine handler tests', function () {
1193
1297
  };
1194
1298
  call['connected'] = true;
1195
1299
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_OFFER';
1196
- _context24.next = 9;
1300
+ _context25.next = 9;
1197
1301
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1198
1302
  case 9:
1199
1303
  jest.advanceTimersByTime(1005);
@@ -1205,14 +1309,14 @@ describe('State Machine handler tests', function () {
1205
1309
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1206
1310
  case 14:
1207
1311
  case "end":
1208
- return _context24.stop();
1312
+ return _context25.stop();
1209
1313
  }
1210
- }, _callee24);
1314
+ }, _callee25);
1211
1315
  })));
1212
- it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
1316
+ it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
1213
1317
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1214
- return _regenerator.default.wrap(function _callee25$(_context25) {
1215
- while (1) switch (_context25.prev = _context25.next) {
1318
+ return _regenerator.default.wrap(function _callee26$(_context26) {
1319
+ while (1) switch (_context26.prev = _context26.next) {
1216
1320
  case 0:
1217
1321
  statusPayload = {
1218
1322
  statusCode: 503,
@@ -1233,7 +1337,7 @@ describe('State Machine handler tests', function () {
1233
1337
  }
1234
1338
  };
1235
1339
  call['connected'] = false;
1236
- _context25.next = 8;
1340
+ _context26.next = 8;
1237
1341
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1238
1342
  case 8:
1239
1343
  jest.advanceTimersByTime(1005);
@@ -1245,14 +1349,14 @@ describe('State Machine handler tests', function () {
1245
1349
  expect(stateMachineSpy).not.toBeCalled();
1246
1350
  case 13:
1247
1351
  case "end":
1248
- return _context25.stop();
1352
+ return _context26.stop();
1249
1353
  }
1250
- }, _callee25);
1354
+ }, _callee26);
1251
1355
  })));
1252
- it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
1356
+ it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27() {
1253
1357
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1254
- return _regenerator.default.wrap(function _callee26$(_context26) {
1255
- while (1) switch (_context26.prev = _context26.next) {
1358
+ return _regenerator.default.wrap(function _callee27$(_context27) {
1359
+ while (1) switch (_context27.prev = _context27.next) {
1256
1360
  case 0:
1257
1361
  statusPayload = {
1258
1362
  statusCode: 200,
@@ -1277,14 +1381,14 @@ describe('State Machine handler tests', function () {
1277
1381
  expect(stateMachineSpy).not.toHaveBeenCalled();
1278
1382
  case 11:
1279
1383
  case "end":
1280
- return _context26.stop();
1384
+ return _context27.stop();
1281
1385
  }
1282
- }, _callee26);
1386
+ }, _callee27);
1283
1387
  })));
1284
- it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27() {
1388
+ it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28() {
1285
1389
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1286
- return _regenerator.default.wrap(function _callee27$(_context27) {
1287
- while (1) switch (_context27.prev = _context27.next) {
1390
+ return _regenerator.default.wrap(function _callee28$(_context28) {
1391
+ while (1) switch (_context28.prev = _context28.next) {
1288
1392
  case 0:
1289
1393
  statusPayload = {
1290
1394
  statusCode: 503,
@@ -1306,7 +1410,7 @@ describe('State Machine handler tests', function () {
1306
1410
  };
1307
1411
  call['connected'] = true;
1308
1412
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
1309
- _context27.next = 9;
1413
+ _context28.next = 9;
1310
1414
  return call['handleRoapEstablished']({}, dummyEvent);
1311
1415
  case 9:
1312
1416
  jest.advanceTimersByTime(1005);
@@ -1318,14 +1422,14 @@ describe('State Machine handler tests', function () {
1318
1422
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1319
1423
  case 14:
1320
1424
  case "end":
1321
- return _context27.stop();
1425
+ return _context28.stop();
1322
1426
  }
1323
- }, _callee27);
1427
+ }, _callee28);
1324
1428
  })));
1325
- it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28() {
1429
+ it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29() {
1326
1430
  var statusPayload, stateMachineSpy, funcSpy, errorEvent;
1327
- return _regenerator.default.wrap(function _callee28$(_context28) {
1328
- while (1) switch (_context28.prev = _context28.next) {
1431
+ return _regenerator.default.wrap(function _callee29$(_context29) {
1432
+ while (1) switch (_context29.prev = _context29.next) {
1329
1433
  case 0:
1330
1434
  statusPayload = {
1331
1435
  statusCode: 403,
@@ -1348,14 +1452,14 @@ describe('State Machine handler tests', function () {
1348
1452
  expect(stateMachineSpy).not.toHaveBeenCalled();
1349
1453
  case 9:
1350
1454
  case "end":
1351
- return _context28.stop();
1455
+ return _context29.stop();
1352
1456
  }
1353
- }, _callee28);
1457
+ }, _callee29);
1354
1458
  })));
1355
- it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29() {
1459
+ it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
1356
1460
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1357
- return _regenerator.default.wrap(function _callee29$(_context29) {
1358
- while (1) switch (_context29.prev = _context29.next) {
1461
+ return _regenerator.default.wrap(function _callee30$(_context30) {
1462
+ while (1) switch (_context30.prev = _context30.next) {
1359
1463
  case 0:
1360
1464
  statusPayload = {
1361
1465
  statusCode: 200,
@@ -1373,7 +1477,7 @@ describe('State Machine handler tests', function () {
1373
1477
  }
1374
1478
  };
1375
1479
  call['connected'] = false;
1376
- _context29.next = 8;
1480
+ _context30.next = 8;
1377
1481
  return call['handleRoapError']({}, errorEvent);
1378
1482
  case 8:
1379
1483
  expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
@@ -1389,14 +1493,14 @@ describe('State Machine handler tests', function () {
1389
1493
  });
1390
1494
  case 11:
1391
1495
  case "end":
1392
- return _context29.stop();
1496
+ return _context30.stop();
1393
1497
  }
1394
- }, _callee29);
1498
+ }, _callee30);
1395
1499
  })));
1396
- it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
1500
+ it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31() {
1397
1501
  var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
1398
- return _regenerator.default.wrap(function _callee30$(_context30) {
1399
- while (1) switch (_context30.prev = _context30.next) {
1502
+ return _regenerator.default.wrap(function _callee31$(_context31) {
1503
+ while (1) switch (_context31.prev = _context31.next) {
1400
1504
  case 0:
1401
1505
  statusPayload = {
1402
1506
  statusCode: 200,
@@ -1429,7 +1533,7 @@ describe('State Machine handler tests', function () {
1429
1533
  seq: 1,
1430
1534
  messageType: 'ANSWER'
1431
1535
  };
1432
- _context30.next = 17;
1536
+ _context31.next = 17;
1433
1537
  return call.sendMediaStateMachineEvt(dummyEvent);
1434
1538
  case 17:
1435
1539
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -1451,7 +1555,7 @@ describe('State Machine handler tests', function () {
1451
1555
  seq: 2,
1452
1556
  messageType: 'OFFER_REQUEST'
1453
1557
  };
1454
- _context30.next = 23;
1558
+ _context31.next = 23;
1455
1559
  return call.sendMediaStateMachineEvt(dummyEvent);
1456
1560
  case 23:
1457
1561
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -1501,7 +1605,7 @@ describe('State Machine handler tests', function () {
1501
1605
  };
1502
1606
  call.sendCallStateMachineEvt(dummyEvent);
1503
1607
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
1504
- _context30.next = 49;
1608
+ _context31.next = 49;
1505
1609
  return call.sendMediaStateMachineEvt(dummyEvent);
1506
1610
  case 49:
1507
1611
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -1510,7 +1614,7 @@ describe('State Machine handler tests', function () {
1510
1614
  seq: 3,
1511
1615
  messageType: 'ANSWER'
1512
1616
  };
1513
- _context30.next = 54;
1617
+ _context31.next = 54;
1514
1618
  return call.sendMediaStateMachineEvt(dummyEvent);
1515
1619
  case 54:
1516
1620
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -1529,7 +1633,7 @@ describe('State Machine handler tests', function () {
1529
1633
  messageType: 'OK'
1530
1634
  }
1531
1635
  };
1532
- _context30.next = 63;
1636
+ _context31.next = 63;
1533
1637
  return call.sendMediaStateMachineEvt(dummyOkEvent);
1534
1638
  case 63:
1535
1639
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
@@ -1544,14 +1648,14 @@ describe('State Machine handler tests', function () {
1544
1648
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
1545
1649
  case 70:
1546
1650
  case "end":
1547
- return _context30.stop();
1651
+ return _context31.stop();
1548
1652
  }
1549
- }, _callee30);
1653
+ }, _callee31);
1550
1654
  })));
1551
- it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31() {
1655
+ it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
1552
1656
  var mockStatusBody, statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
1553
- return _regenerator.default.wrap(function _callee31$(_context31) {
1554
- while (1) switch (_context31.prev = _context31.next) {
1657
+ return _regenerator.default.wrap(function _callee32$(_context32) {
1658
+ while (1) switch (_context32.prev = _context32.next) {
1555
1659
  case 0:
1556
1660
  mockStatusBody = {
1557
1661
  device: {
@@ -1591,7 +1695,7 @@ describe('State Machine handler tests', function () {
1591
1695
  seq: 1,
1592
1696
  messageType: 'ANSWER'
1593
1697
  };
1594
- _context31.next = 18;
1698
+ _context32.next = 18;
1595
1699
  return call.sendMediaStateMachineEvt(dummyEvent);
1596
1700
  case 18:
1597
1701
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -1613,7 +1717,7 @@ describe('State Machine handler tests', function () {
1613
1717
  seq: 2,
1614
1718
  messageType: 'OFFER_REQUEST'
1615
1719
  };
1616
- _context31.next = 24;
1720
+ _context32.next = 24;
1617
1721
  return call.sendMediaStateMachineEvt(dummyEvent);
1618
1722
  case 24:
1619
1723
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -1663,7 +1767,7 @@ describe('State Machine handler tests', function () {
1663
1767
  };
1664
1768
  call.sendCallStateMachineEvt(dummyEvent);
1665
1769
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
1666
- _context31.next = 50;
1770
+ _context32.next = 50;
1667
1771
  return call.sendMediaStateMachineEvt(dummyEvent);
1668
1772
  case 50:
1669
1773
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -1672,7 +1776,7 @@ describe('State Machine handler tests', function () {
1672
1776
  seq: 3,
1673
1777
  messageType: 'ANSWER'
1674
1778
  };
1675
- _context31.next = 55;
1779
+ _context32.next = 55;
1676
1780
  return call.sendMediaStateMachineEvt(dummyEvent);
1677
1781
  case 55:
1678
1782
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -1689,7 +1793,7 @@ describe('State Machine handler tests', function () {
1689
1793
  }
1690
1794
  };
1691
1795
  call.sendMediaStateMachineEvt(dummyEvent);
1692
- _context31.next = 62;
1796
+ _context32.next = 62;
1693
1797
  return call.sendMediaStateMachineEvt(dummyOkEvent);
1694
1798
  case 62:
1695
1799
  expect(call['receivedRoapOKSeq']).toBe(3);
@@ -1705,14 +1809,14 @@ describe('State Machine handler tests', function () {
1705
1809
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
1706
1810
  case 70:
1707
1811
  case "end":
1708
- return _context31.stop();
1812
+ return _context32.stop();
1709
1813
  }
1710
- }, _callee31);
1814
+ }, _callee32);
1711
1815
  })));
1712
- it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
1816
+ it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33() {
1713
1817
  var statusPayload, dummyEvent, postMediaSpy, infoSpy, dummyOkEvent;
1714
- return _regenerator.default.wrap(function _callee32$(_context32) {
1715
- while (1) switch (_context32.prev = _context32.next) {
1818
+ return _regenerator.default.wrap(function _callee33$(_context33) {
1819
+ while (1) switch (_context33.prev = _context33.next) {
1716
1820
  case 0:
1717
1821
  statusPayload = {
1718
1822
  statusCode: 200,
@@ -1779,9 +1883,9 @@ describe('State Machine handler tests', function () {
1779
1883
  });
1780
1884
  case 33:
1781
1885
  case "end":
1782
- return _context32.stop();
1886
+ return _context33.stop();
1783
1887
  }
1784
- }, _callee32);
1888
+ }, _callee33);
1785
1889
  })));
1786
1890
  });
1787
1891
  describe('Supplementary Services tests', function () {
@@ -1840,10 +1944,10 @@ describe('Supplementary Services tests', function () {
1840
1944
  beforeEach(function () {
1841
1945
  call.removeAllListeners();
1842
1946
  });
1843
- it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34() {
1947
+ it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35() {
1844
1948
  var responsePayload, warnSpy, roapEvent;
1845
- return _regenerator.default.wrap(function _callee34$(_context34) {
1846
- while (1) switch (_context34.prev = _context34.next) {
1949
+ return _regenerator.default.wrap(function _callee35$(_context35) {
1950
+ while (1) switch (_context35.prev = _context35.next) {
1847
1951
  case 0:
1848
1952
  expect.assertions(7);
1849
1953
  responsePayload = {
@@ -1856,25 +1960,25 @@ describe('Supplementary Services tests', function () {
1856
1960
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1857
1961
  call['held'] = false;
1858
1962
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
1859
- var _ref34 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33(correlationId) {
1860
- return _regenerator.default.wrap(function _callee33$(_context33) {
1861
- while (1) switch (_context33.prev = _context33.next) {
1963
+ var _ref35 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(correlationId) {
1964
+ return _regenerator.default.wrap(function _callee34$(_context34) {
1965
+ while (1) switch (_context34.prev = _context34.next) {
1862
1966
  case 0:
1863
1967
  expect(correlationId).toStrictEqual(call.getCorrelationId());
1864
1968
  case 1:
1865
1969
  case "end":
1866
- return _context33.stop();
1970
+ return _context34.stop();
1867
1971
  }
1868
- }, _callee33);
1972
+ }, _callee34);
1869
1973
  }));
1870
1974
  return function (_x) {
1871
- return _ref34.apply(this, arguments);
1975
+ return _ref35.apply(this, arguments);
1872
1976
  };
1873
1977
  }());
1874
- _context34.next = 10;
1978
+ _context35.next = 10;
1875
1979
  return call.doHoldResume();
1876
1980
  case 10:
1877
- _context34.next = 12;
1981
+ _context35.next = 12;
1878
1982
  return (0, _testUtil.flushPromises)(2);
1879
1983
  case 12:
1880
1984
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -1890,11 +1994,11 @@ describe('Supplementary Services tests', function () {
1890
1994
  call['handleIncomingRoapOffer']({}, dummyEvent);
1891
1995
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
1892
1996
  roapEvent.data.type = 'ANSWER';
1893
- _context34.next = 20;
1997
+ _context35.next = 20;
1894
1998
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1895
1999
  case 20:
1896
2000
  roapEvent.data.type = 'OK';
1897
- _context34.next = 23;
2001
+ _context35.next = 23;
1898
2002
  return call['handleRoapEstablished']({}, dummyEvent);
1899
2003
  case 23:
1900
2004
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -1909,14 +2013,14 @@ describe('Supplementary Services tests', function () {
1909
2013
  });
1910
2014
  case 28:
1911
2015
  case "end":
1912
- return _context34.stop();
2016
+ return _context35.stop();
1913
2017
  }
1914
- }, _callee34);
2018
+ }, _callee35);
1915
2019
  })));
1916
- it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36() {
2020
+ it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37() {
1917
2021
  var responsePayload, warnSpy, roapEvent;
1918
- return _regenerator.default.wrap(function _callee36$(_context36) {
1919
- while (1) switch (_context36.prev = _context36.next) {
2022
+ return _regenerator.default.wrap(function _callee37$(_context37) {
2023
+ while (1) switch (_context37.prev = _context37.next) {
1920
2024
  case 0:
1921
2025
  expect.assertions(8);
1922
2026
  responsePayload = {
@@ -1929,26 +2033,26 @@ describe('Supplementary Services tests', function () {
1929
2033
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1930
2034
  call['held'] = false;
1931
2035
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
1932
- var _ref36 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35(correlationId) {
1933
- return _regenerator.default.wrap(function _callee35$(_context35) {
1934
- while (1) switch (_context35.prev = _context35.next) {
2036
+ var _ref37 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36(correlationId) {
2037
+ return _regenerator.default.wrap(function _callee36$(_context36) {
2038
+ while (1) switch (_context36.prev = _context36.next) {
1935
2039
  case 0:
1936
2040
  expect(correlationId).toStrictEqual(call.getCorrelationId());
1937
2041
  case 1:
1938
2042
  case "end":
1939
- return _context35.stop();
2043
+ return _context36.stop();
1940
2044
  }
1941
- }, _callee35);
2045
+ }, _callee36);
1942
2046
  }));
1943
2047
  return function (_x2) {
1944
- return _ref36.apply(this, arguments);
2048
+ return _ref37.apply(this, arguments);
1945
2049
  };
1946
2050
  }());
1947
2051
  call.doHoldResume();
1948
- _context36.next = 11;
2052
+ _context37.next = 11;
1949
2053
  return _promise.default.resolve();
1950
2054
  case 11:
1951
- _context36.next = 13;
2055
+ _context37.next = 13;
1952
2056
  return _promise.default.resolve();
1953
2057
  case 13:
1954
2058
  expect(setTimeout).not.toHaveBeenCalled();
@@ -1964,11 +2068,11 @@ describe('Supplementary Services tests', function () {
1964
2068
  call['handleIncomingRoapOffer']({}, dummyEvent);
1965
2069
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
1966
2070
  roapEvent.data.type = 'ANSWER';
1967
- _context36.next = 22;
2071
+ _context37.next = 22;
1968
2072
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1969
2073
  case 22:
1970
2074
  roapEvent.data.type = 'OK';
1971
- _context36.next = 25;
2075
+ _context37.next = 25;
1972
2076
  return call['handleRoapEstablished']({}, dummyEvent);
1973
2077
  case 25:
1974
2078
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -1983,14 +2087,14 @@ describe('Supplementary Services tests', function () {
1983
2087
  });
1984
2088
  case 30:
1985
2089
  case "end":
1986
- return _context36.stop();
2090
+ return _context37.stop();
1987
2091
  }
1988
- }, _callee36);
2092
+ }, _callee37);
1989
2093
  })));
1990
- it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38() {
2094
+ it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39() {
1991
2095
  var responsePayload;
1992
- return _regenerator.default.wrap(function _callee38$(_context38) {
1993
- while (1) switch (_context38.prev = _context38.next) {
2096
+ return _regenerator.default.wrap(function _callee39$(_context39) {
2097
+ while (1) switch (_context39.prev = _context39.next) {
1994
2098
  case 0:
1995
2099
  expect.assertions(4);
1996
2100
  responsePayload = {
@@ -2000,26 +2104,26 @@ describe('Supplementary Services tests', function () {
2000
2104
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2001
2105
  call['held'] = false;
2002
2106
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2003
- var _ref38 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37(errObj) {
2004
- return _regenerator.default.wrap(function _callee37$(_context37) {
2005
- while (1) switch (_context37.prev = _context37.next) {
2107
+ var _ref39 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38(errObj) {
2108
+ return _regenerator.default.wrap(function _callee38$(_context38) {
2109
+ while (1) switch (_context38.prev = _context38.next) {
2006
2110
  case 0:
2007
2111
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2008
2112
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2009
2113
  case 2:
2010
2114
  case "end":
2011
- return _context37.stop();
2115
+ return _context38.stop();
2012
2116
  }
2013
- }, _callee37);
2117
+ }, _callee38);
2014
2118
  }));
2015
2119
  return function (_x3) {
2016
- return _ref38.apply(this, arguments);
2120
+ return _ref39.apply(this, arguments);
2017
2121
  };
2018
2122
  }());
2019
- _context38.next = 7;
2123
+ _context39.next = 7;
2020
2124
  return call.doHoldResume();
2021
2125
  case 7:
2022
- _context38.next = 9;
2126
+ _context39.next = 9;
2023
2127
  return (0, _testUtil.flushPromises)(2);
2024
2128
  case 9:
2025
2129
  expect(call.isHeld()).toStrictEqual(false);
@@ -2029,14 +2133,14 @@ describe('Supplementary Services tests', function () {
2029
2133
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2030
2134
  case 11:
2031
2135
  case "end":
2032
- return _context38.stop();
2136
+ return _context39.stop();
2033
2137
  }
2034
- }, _callee38);
2138
+ }, _callee39);
2035
2139
  })));
2036
- it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40() {
2140
+ it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41() {
2037
2141
  var responsePayload, rejectPayload, roapEvent;
2038
- return _regenerator.default.wrap(function _callee40$(_context40) {
2039
- while (1) switch (_context40.prev = _context40.next) {
2142
+ return _regenerator.default.wrap(function _callee41$(_context41) {
2143
+ while (1) switch (_context41.prev = _context41.next) {
2040
2144
  case 0:
2041
2145
  expect.assertions(5);
2042
2146
  responsePayload = {
@@ -2050,24 +2154,24 @@ describe('Supplementary Services tests', function () {
2050
2154
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2051
2155
  call['held'] = false;
2052
2156
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2053
- var _ref40 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39(errObj) {
2054
- return _regenerator.default.wrap(function _callee39$(_context39) {
2055
- while (1) switch (_context39.prev = _context39.next) {
2157
+ var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40(errObj) {
2158
+ return _regenerator.default.wrap(function _callee40$(_context40) {
2159
+ while (1) switch (_context40.prev = _context40.next) {
2056
2160
  case 0:
2057
2161
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2058
2162
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2059
2163
  case 2:
2060
2164
  case "end":
2061
- return _context39.stop();
2165
+ return _context40.stop();
2062
2166
  }
2063
- }, _callee39);
2167
+ }, _callee40);
2064
2168
  }));
2065
2169
  return function (_x4) {
2066
- return _ref40.apply(this, arguments);
2170
+ return _ref41.apply(this, arguments);
2067
2171
  };
2068
2172
  }());
2069
2173
  call.doHoldResume();
2070
- _context40.next = 9;
2174
+ _context41.next = 9;
2071
2175
  return (0, _testUtil.flushPromises)(2);
2072
2176
  case 9:
2073
2177
  /* the Call State should transition to S_CALL_ESTABLISHED
@@ -2077,7 +2181,7 @@ describe('Supplementary Services tests', function () {
2077
2181
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2078
2182
  /* We are intentionally failing the ROAP ANSWER */
2079
2183
  roapEvent.data.type = 'ANSWER';
2080
- _context40.next = 15;
2184
+ _context41.next = 15;
2081
2185
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2082
2186
  case 15:
2083
2187
  expect(call.isHeld()).toStrictEqual(false);
@@ -2085,14 +2189,14 @@ describe('Supplementary Services tests', function () {
2085
2189
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2086
2190
  case 17:
2087
2191
  case "end":
2088
- return _context40.stop();
2192
+ return _context41.stop();
2089
2193
  }
2090
- }, _callee40);
2194
+ }, _callee41);
2091
2195
  })));
2092
- it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41() {
2196
+ it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42() {
2093
2197
  var responsePayload, warnSpy, roapEvent;
2094
- return _regenerator.default.wrap(function _callee41$(_context41) {
2095
- while (1) switch (_context41.prev = _context41.next) {
2198
+ return _regenerator.default.wrap(function _callee42$(_context42) {
2199
+ while (1) switch (_context42.prev = _context42.next) {
2096
2200
  case 0:
2097
2201
  responsePayload = {
2098
2202
  statusCode: 200,
@@ -2103,10 +2207,10 @@ describe('Supplementary Services tests', function () {
2103
2207
  jest.spyOn(global, 'clearTimeout');
2104
2208
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2105
2209
  call['held'] = false;
2106
- _context41.next = 8;
2210
+ _context42.next = 8;
2107
2211
  return call.doHoldResume();
2108
2212
  case 8:
2109
- _context41.next = 10;
2213
+ _context42.next = 10;
2110
2214
  return (0, _testUtil.flushPromises)(2);
2111
2215
  case 10:
2112
2216
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2121,19 +2225,19 @@ describe('Supplementary Services tests', function () {
2121
2225
  call['handleIncomingRoapOffer']({}, dummyEvent);
2122
2226
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2123
2227
  roapEvent.data.type = 'ANSWER';
2124
- _context41.next = 17;
2228
+ _context42.next = 17;
2125
2229
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2126
2230
  case 17:
2127
2231
  jest.spyOn(webex, 'request').mockRejectedValue({
2128
2232
  statusCode: 403
2129
2233
  });
2130
2234
  roapEvent.data.type = 'OK';
2131
- _context41.next = 21;
2235
+ _context42.next = 21;
2132
2236
  return call['handleRoapEstablished']({}, dummyEvent);
2133
2237
  case 21:
2134
2238
  /* this is for coverage */
2135
2239
  call['callStateMachine'].state.value = 'S_CALL_HOLD';
2136
- _context41.next = 24;
2240
+ _context42.next = 24;
2137
2241
  return call['handleRoapEstablished']({}, dummyEvent);
2138
2242
  case 24:
2139
2243
  expect(call.isHeld()).toStrictEqual(false);
@@ -2145,14 +2249,14 @@ describe('Supplementary Services tests', function () {
2145
2249
  });
2146
2250
  case 27:
2147
2251
  case "end":
2148
- return _context41.stop();
2252
+ return _context42.stop();
2149
2253
  }
2150
- }, _callee41);
2254
+ }, _callee42);
2151
2255
  })));
2152
- it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42() {
2256
+ it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43() {
2153
2257
  var responsePayload, warnSpy, roapEvent;
2154
- return _regenerator.default.wrap(function _callee42$(_context42) {
2155
- while (1) switch (_context42.prev = _context42.next) {
2258
+ return _regenerator.default.wrap(function _callee43$(_context43) {
2259
+ while (1) switch (_context43.prev = _context43.next) {
2156
2260
  case 0:
2157
2261
  responsePayload = {
2158
2262
  statusCode: 200,
@@ -2163,10 +2267,10 @@ describe('Supplementary Services tests', function () {
2163
2267
  jest.spyOn(global, 'clearTimeout');
2164
2268
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2165
2269
  call['held'] = true;
2166
- _context42.next = 8;
2270
+ _context43.next = 8;
2167
2271
  return call.doHoldResume();
2168
2272
  case 8:
2169
- _context42.next = 10;
2273
+ _context43.next = 10;
2170
2274
  return (0, _testUtil.flushPromises)(2);
2171
2275
  case 10:
2172
2276
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2181,14 +2285,14 @@ describe('Supplementary Services tests', function () {
2181
2285
  call['handleIncomingRoapOffer']({}, dummyEvent);
2182
2286
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2183
2287
  roapEvent.data.type = 'ANSWER';
2184
- _context42.next = 17;
2288
+ _context43.next = 17;
2185
2289
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2186
2290
  case 17:
2187
2291
  jest.spyOn(webex, 'request').mockRejectedValue({
2188
2292
  statusCode: 403
2189
2293
  });
2190
2294
  roapEvent.data.type = 'OK';
2191
- _context42.next = 21;
2295
+ _context43.next = 21;
2192
2296
  return call['handleRoapEstablished']({}, dummyEvent);
2193
2297
  case 21:
2194
2298
  expect(call.isHeld()).toStrictEqual(true);
@@ -2200,14 +2304,14 @@ describe('Supplementary Services tests', function () {
2200
2304
  });
2201
2305
  case 24:
2202
2306
  case "end":
2203
- return _context42.stop();
2307
+ return _context43.stop();
2204
2308
  }
2205
- }, _callee42);
2309
+ }, _callee43);
2206
2310
  })));
2207
- it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44() {
2311
+ it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45() {
2208
2312
  var responsePayload, roapEvent;
2209
- return _regenerator.default.wrap(function _callee44$(_context44) {
2210
- while (1) switch (_context44.prev = _context44.next) {
2313
+ return _regenerator.default.wrap(function _callee45$(_context45) {
2314
+ while (1) switch (_context45.prev = _context45.next) {
2211
2315
  case 0:
2212
2316
  expect.assertions(5);
2213
2317
  responsePayload = {
@@ -2217,25 +2321,25 @@ describe('Supplementary Services tests', function () {
2217
2321
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
2218
2322
  call['held'] = false;
2219
2323
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2220
- var _ref44 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43(errObj) {
2221
- return _regenerator.default.wrap(function _callee43$(_context43) {
2222
- while (1) switch (_context43.prev = _context43.next) {
2324
+ var _ref45 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44(errObj) {
2325
+ return _regenerator.default.wrap(function _callee44$(_context44) {
2326
+ while (1) switch (_context44.prev = _context44.next) {
2223
2327
  case 0:
2224
2328
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
2225
2329
  expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
2226
2330
  case 2:
2227
2331
  case "end":
2228
- return _context43.stop();
2332
+ return _context44.stop();
2229
2333
  }
2230
- }, _callee43);
2334
+ }, _callee44);
2231
2335
  }));
2232
2336
  return function (_x5) {
2233
- return _ref44.apply(this, arguments);
2337
+ return _ref45.apply(this, arguments);
2234
2338
  };
2235
2339
  }());
2236
2340
  jest.runAllTimers();
2237
2341
  call.doHoldResume();
2238
- _context44.next = 9;
2342
+ _context45.next = 9;
2239
2343
  return (0, _testUtil.flushPromises)(2);
2240
2344
  case 9:
2241
2345
  /* At this point, the Call State should be S_CALL_HOLD
@@ -2248,11 +2352,11 @@ describe('Supplementary Services tests', function () {
2248
2352
  call['handleIncomingRoapOffer']({}, dummyEvent);
2249
2353
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2250
2354
  roapEvent.data.type = 'ANSWER';
2251
- _context44.next = 15;
2355
+ _context45.next = 15;
2252
2356
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2253
2357
  case 15:
2254
2358
  roapEvent.data.type = 'OK';
2255
- _context44.next = 18;
2359
+ _context45.next = 18;
2256
2360
  return call['handleRoapEstablished']({}, dummyEvent);
2257
2361
  case 18:
2258
2362
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -2264,14 +2368,14 @@ describe('Supplementary Services tests', function () {
2264
2368
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2265
2369
  case 21:
2266
2370
  case "end":
2267
- return _context44.stop();
2371
+ return _context45.stop();
2268
2372
  }
2269
- }, _callee44);
2373
+ }, _callee45);
2270
2374
  })));
2271
- it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46() {
2375
+ it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47() {
2272
2376
  var responsePayload, warnSpy, roapEvent;
2273
- return _regenerator.default.wrap(function _callee46$(_context46) {
2274
- while (1) switch (_context46.prev = _context46.next) {
2377
+ return _regenerator.default.wrap(function _callee47$(_context47) {
2378
+ while (1) switch (_context47.prev = _context47.next) {
2275
2379
  case 0:
2276
2380
  expect.assertions(7);
2277
2381
  responsePayload = {
@@ -2284,25 +2388,25 @@ describe('Supplementary Services tests', function () {
2284
2388
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2285
2389
  call['held'] = true;
2286
2390
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
2287
- var _ref46 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45(correlationId) {
2288
- return _regenerator.default.wrap(function _callee45$(_context45) {
2289
- while (1) switch (_context45.prev = _context45.next) {
2391
+ var _ref47 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46(correlationId) {
2392
+ return _regenerator.default.wrap(function _callee46$(_context46) {
2393
+ while (1) switch (_context46.prev = _context46.next) {
2290
2394
  case 0:
2291
2395
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2292
2396
  case 1:
2293
2397
  case "end":
2294
- return _context45.stop();
2398
+ return _context46.stop();
2295
2399
  }
2296
- }, _callee45);
2400
+ }, _callee46);
2297
2401
  }));
2298
2402
  return function (_x6) {
2299
- return _ref46.apply(this, arguments);
2403
+ return _ref47.apply(this, arguments);
2300
2404
  };
2301
2405
  }());
2302
- _context46.next = 10;
2406
+ _context47.next = 10;
2303
2407
  return call.doHoldResume();
2304
2408
  case 10:
2305
- _context46.next = 12;
2409
+ _context47.next = 12;
2306
2410
  return (0, _testUtil.flushPromises)(2);
2307
2411
  case 12:
2308
2412
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2318,11 +2422,11 @@ describe('Supplementary Services tests', function () {
2318
2422
  call['handleIncomingRoapOffer']({}, dummyEvent);
2319
2423
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2320
2424
  roapEvent.data.type = 'ANSWER';
2321
- _context46.next = 20;
2425
+ _context47.next = 20;
2322
2426
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2323
2427
  case 20:
2324
2428
  roapEvent.data.type = 'OK';
2325
- _context46.next = 23;
2429
+ _context47.next = 23;
2326
2430
  return call['handleRoapEstablished']({}, dummyEvent);
2327
2431
  case 23:
2328
2432
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -2337,14 +2441,14 @@ describe('Supplementary Services tests', function () {
2337
2441
  });
2338
2442
  case 28:
2339
2443
  case "end":
2340
- return _context46.stop();
2444
+ return _context47.stop();
2341
2445
  }
2342
- }, _callee46);
2446
+ }, _callee47);
2343
2447
  })));
2344
- it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48() {
2448
+ it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49() {
2345
2449
  var responsePayload, warnSpy, roapEvent;
2346
- return _regenerator.default.wrap(function _callee48$(_context48) {
2347
- while (1) switch (_context48.prev = _context48.next) {
2450
+ return _regenerator.default.wrap(function _callee49$(_context49) {
2451
+ while (1) switch (_context49.prev = _context49.next) {
2348
2452
  case 0:
2349
2453
  expect.assertions(7);
2350
2454
  responsePayload = {
@@ -2357,26 +2461,26 @@ describe('Supplementary Services tests', function () {
2357
2461
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2358
2462
  call['held'] = true;
2359
2463
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
2360
- var _ref48 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47(correlationId) {
2361
- return _regenerator.default.wrap(function _callee47$(_context47) {
2362
- while (1) switch (_context47.prev = _context47.next) {
2464
+ var _ref49 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(correlationId) {
2465
+ return _regenerator.default.wrap(function _callee48$(_context48) {
2466
+ while (1) switch (_context48.prev = _context48.next) {
2363
2467
  case 0:
2364
2468
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2365
2469
  case 1:
2366
2470
  case "end":
2367
- return _context47.stop();
2471
+ return _context48.stop();
2368
2472
  }
2369
- }, _callee47);
2473
+ }, _callee48);
2370
2474
  }));
2371
2475
  return function (_x7) {
2372
- return _ref48.apply(this, arguments);
2476
+ return _ref49.apply(this, arguments);
2373
2477
  };
2374
2478
  }());
2375
2479
  call.doHoldResume();
2376
- _context48.next = 11;
2480
+ _context49.next = 11;
2377
2481
  return _promise.default.resolve();
2378
2482
  case 11:
2379
- _context48.next = 13;
2483
+ _context49.next = 13;
2380
2484
  return _promise.default.resolve();
2381
2485
  case 13:
2382
2486
  expect(setTimeout).not.toHaveBeenCalled();
@@ -2392,11 +2496,11 @@ describe('Supplementary Services tests', function () {
2392
2496
  call['handleIncomingRoapOffer']({}, dummyEvent);
2393
2497
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2394
2498
  roapEvent.data.type = 'ANSWER';
2395
- _context48.next = 21;
2499
+ _context49.next = 21;
2396
2500
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2397
2501
  case 21:
2398
2502
  roapEvent.data.type = 'OK';
2399
- _context48.next = 24;
2503
+ _context49.next = 24;
2400
2504
  return call['handleRoapEstablished']({}, dummyEvent);
2401
2505
  case 24:
2402
2506
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -2411,14 +2515,14 @@ describe('Supplementary Services tests', function () {
2411
2515
  });
2412
2516
  case 29:
2413
2517
  case "end":
2414
- return _context48.stop();
2518
+ return _context49.stop();
2415
2519
  }
2416
- }, _callee48);
2520
+ }, _callee49);
2417
2521
  })));
2418
- it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50() {
2522
+ it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51() {
2419
2523
  var responsePayload;
2420
- return _regenerator.default.wrap(function _callee50$(_context50) {
2421
- while (1) switch (_context50.prev = _context50.next) {
2524
+ return _regenerator.default.wrap(function _callee51$(_context51) {
2525
+ while (1) switch (_context51.prev = _context51.next) {
2422
2526
  case 0:
2423
2527
  expect.assertions(4);
2424
2528
  responsePayload = {
@@ -2428,26 +2532,26 @@ describe('Supplementary Services tests', function () {
2428
2532
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2429
2533
  call['held'] = true;
2430
2534
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
2431
- var _ref50 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49(errObj) {
2432
- return _regenerator.default.wrap(function _callee49$(_context49) {
2433
- while (1) switch (_context49.prev = _context49.next) {
2535
+ var _ref51 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50(errObj) {
2536
+ return _regenerator.default.wrap(function _callee50$(_context50) {
2537
+ while (1) switch (_context50.prev = _context50.next) {
2434
2538
  case 0:
2435
2539
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2436
2540
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2437
2541
  case 2:
2438
2542
  case "end":
2439
- return _context49.stop();
2543
+ return _context50.stop();
2440
2544
  }
2441
- }, _callee49);
2545
+ }, _callee50);
2442
2546
  }));
2443
2547
  return function (_x8) {
2444
- return _ref50.apply(this, arguments);
2548
+ return _ref51.apply(this, arguments);
2445
2549
  };
2446
2550
  }());
2447
- _context50.next = 7;
2551
+ _context51.next = 7;
2448
2552
  return call.doHoldResume();
2449
2553
  case 7:
2450
- _context50.next = 9;
2554
+ _context51.next = 9;
2451
2555
  return (0, _testUtil.flushPromises)(2);
2452
2556
  case 9:
2453
2557
  expect(call.isHeld()).toStrictEqual(true);
@@ -2458,14 +2562,14 @@ describe('Supplementary Services tests', function () {
2458
2562
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2459
2563
  case 11:
2460
2564
  case "end":
2461
- return _context50.stop();
2565
+ return _context51.stop();
2462
2566
  }
2463
- }, _callee50);
2567
+ }, _callee51);
2464
2568
  })));
2465
- it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52() {
2569
+ it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53() {
2466
2570
  var responsePayload, rejectPayload, roapEvent;
2467
- return _regenerator.default.wrap(function _callee52$(_context52) {
2468
- while (1) switch (_context52.prev = _context52.next) {
2571
+ return _regenerator.default.wrap(function _callee53$(_context53) {
2572
+ while (1) switch (_context53.prev = _context53.next) {
2469
2573
  case 0:
2470
2574
  expect.assertions(5);
2471
2575
  responsePayload = {
@@ -2479,24 +2583,24 @@ describe('Supplementary Services tests', function () {
2479
2583
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2480
2584
  call['held'] = true;
2481
2585
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
2482
- var _ref52 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51(errObj) {
2483
- return _regenerator.default.wrap(function _callee51$(_context51) {
2484
- while (1) switch (_context51.prev = _context51.next) {
2586
+ var _ref53 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52(errObj) {
2587
+ return _regenerator.default.wrap(function _callee52$(_context52) {
2588
+ while (1) switch (_context52.prev = _context52.next) {
2485
2589
  case 0:
2486
2590
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2487
2591
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2488
2592
  case 2:
2489
2593
  case "end":
2490
- return _context51.stop();
2594
+ return _context52.stop();
2491
2595
  }
2492
- }, _callee51);
2596
+ }, _callee52);
2493
2597
  }));
2494
2598
  return function (_x9) {
2495
- return _ref52.apply(this, arguments);
2599
+ return _ref53.apply(this, arguments);
2496
2600
  };
2497
2601
  }());
2498
2602
  call.doHoldResume();
2499
- _context52.next = 9;
2603
+ _context53.next = 9;
2500
2604
  return (0, _testUtil.flushPromises)(2);
2501
2605
  case 9:
2502
2606
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
@@ -2507,7 +2611,7 @@ describe('Supplementary Services tests', function () {
2507
2611
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2508
2612
  /* We are intentionally failing the ROAP ANSWER */
2509
2613
  roapEvent.data.type = 'ANSWER';
2510
- _context52.next = 15;
2614
+ _context53.next = 15;
2511
2615
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2512
2616
  case 15:
2513
2617
  expect(call.isHeld()).toStrictEqual(true);
@@ -2515,14 +2619,14 @@ describe('Supplementary Services tests', function () {
2515
2619
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2516
2620
  case 17:
2517
2621
  case "end":
2518
- return _context52.stop();
2622
+ return _context53.stop();
2519
2623
  }
2520
- }, _callee52);
2624
+ }, _callee53);
2521
2625
  })));
2522
- it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54() {
2626
+ it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55() {
2523
2627
  var responsePayload, roapEvent;
2524
- return _regenerator.default.wrap(function _callee54$(_context54) {
2525
- while (1) switch (_context54.prev = _context54.next) {
2628
+ return _regenerator.default.wrap(function _callee55$(_context55) {
2629
+ while (1) switch (_context55.prev = _context55.next) {
2526
2630
  case 0:
2527
2631
  expect.assertions(5);
2528
2632
  responsePayload = {
@@ -2532,24 +2636,24 @@ describe('Supplementary Services tests', function () {
2532
2636
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
2533
2637
  call['held'] = true;
2534
2638
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
2535
- var _ref54 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53(errObj) {
2536
- return _regenerator.default.wrap(function _callee53$(_context53) {
2537
- while (1) switch (_context53.prev = _context53.next) {
2639
+ var _ref55 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54(errObj) {
2640
+ return _regenerator.default.wrap(function _callee54$(_context54) {
2641
+ while (1) switch (_context54.prev = _context54.next) {
2538
2642
  case 0:
2539
2643
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
2540
2644
  expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
2541
2645
  case 2:
2542
2646
  case "end":
2543
- return _context53.stop();
2647
+ return _context54.stop();
2544
2648
  }
2545
- }, _callee53);
2649
+ }, _callee54);
2546
2650
  }));
2547
2651
  return function (_x10) {
2548
- return _ref54.apply(this, arguments);
2652
+ return _ref55.apply(this, arguments);
2549
2653
  };
2550
2654
  }());
2551
2655
  call.doHoldResume();
2552
- _context54.next = 8;
2656
+ _context55.next = 8;
2553
2657
  return (0, _testUtil.flushPromises)(2);
2554
2658
  case 8:
2555
2659
  /* At this point ,the Call State should be S_CALL_RESUME
@@ -2562,11 +2666,11 @@ describe('Supplementary Services tests', function () {
2562
2666
  call['handleIncomingRoapOffer']({}, dummyEvent);
2563
2667
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2564
2668
  roapEvent.data.type = 'ANSWER';
2565
- _context54.next = 14;
2669
+ _context55.next = 14;
2566
2670
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2567
2671
  case 14:
2568
2672
  roapEvent.data.type = 'OK';
2569
- _context54.next = 17;
2673
+ _context55.next = 17;
2570
2674
  return call['handleRoapEstablished']({}, dummyEvent);
2571
2675
  case 17:
2572
2676
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -2576,9 +2680,9 @@ describe('Supplementary Services tests', function () {
2576
2680
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2577
2681
  case 20:
2578
2682
  case "end":
2579
- return _context54.stop();
2683
+ return _context55.stop();
2580
2684
  }
2581
- }, _callee54);
2685
+ }, _callee55);
2582
2686
  })));
2583
2687
  });
2584
2688
  describe('Call transfer tests', function () {
@@ -2610,10 +2714,10 @@ describe('Supplementary Services tests', function () {
2610
2714
  secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
2611
2715
  secondCall['held'] = false;
2612
2716
  });
2613
- it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57() {
2717
+ it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58() {
2614
2718
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
2615
- return _regenerator.default.wrap(function _callee57$(_context57) {
2616
- while (1) switch (_context57.prev = _context57.next) {
2719
+ return _regenerator.default.wrap(function _callee58$(_context58) {
2720
+ while (1) switch (_context58.prev = _context58.next) {
2617
2721
  case 0:
2618
2722
  expect.assertions(9);
2619
2723
  responsePayload = {
@@ -2625,41 +2729,41 @@ describe('Supplementary Services tests', function () {
2625
2729
  infoSpy = jest.spyOn(_Logger.default, 'info');
2626
2730
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
2627
2731
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
2628
- var _ref56 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55(correlationId) {
2629
- return _regenerator.default.wrap(function _callee55$(_context55) {
2630
- while (1) switch (_context55.prev = _context55.next) {
2732
+ var _ref57 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(correlationId) {
2733
+ return _regenerator.default.wrap(function _callee56$(_context56) {
2734
+ while (1) switch (_context56.prev = _context56.next) {
2631
2735
  case 0:
2632
2736
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2633
2737
  case 1:
2634
2738
  case "end":
2635
- return _context55.stop();
2739
+ return _context56.stop();
2636
2740
  }
2637
- }, _callee55);
2741
+ }, _callee56);
2638
2742
  }));
2639
2743
  return function (_x11) {
2640
- return _ref56.apply(this, arguments);
2744
+ return _ref57.apply(this, arguments);
2641
2745
  };
2642
2746
  }());
2643
2747
  secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
2644
- var _ref57 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(correlationId) {
2645
- return _regenerator.default.wrap(function _callee56$(_context56) {
2646
- while (1) switch (_context56.prev = _context56.next) {
2748
+ var _ref58 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57(correlationId) {
2749
+ return _regenerator.default.wrap(function _callee57$(_context57) {
2750
+ while (1) switch (_context57.prev = _context57.next) {
2647
2751
  case 0:
2648
2752
  expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
2649
2753
  case 1:
2650
2754
  case "end":
2651
- return _context56.stop();
2755
+ return _context57.stop();
2652
2756
  }
2653
- }, _callee56);
2757
+ }, _callee57);
2654
2758
  }));
2655
2759
  return function (_x12) {
2656
- return _ref57.apply(this, arguments);
2760
+ return _ref58.apply(this, arguments);
2657
2761
  };
2658
2762
  }());
2659
- _context57.next = 10;
2763
+ _context58.next = 10;
2660
2764
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
2661
2765
  case 10:
2662
- _context57.next = 12;
2766
+ _context58.next = 12;
2663
2767
  return (0, _testUtil.flushPromises)(2);
2664
2768
  case 12:
2665
2769
  expect(requestSpy).toBeCalled();
@@ -2679,14 +2783,14 @@ describe('Supplementary Services tests', function () {
2679
2783
  expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
2680
2784
  case 21:
2681
2785
  case "end":
2682
- return _context57.stop();
2786
+ return _context58.stop();
2683
2787
  }
2684
- }, _callee57);
2788
+ }, _callee58);
2685
2789
  })));
2686
- it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59() {
2790
+ it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60() {
2687
2791
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
2688
- return _regenerator.default.wrap(function _callee59$(_context59) {
2689
- while (1) switch (_context59.prev = _context59.next) {
2792
+ return _regenerator.default.wrap(function _callee60$(_context60) {
2793
+ while (1) switch (_context60.prev = _context60.next) {
2690
2794
  case 0:
2691
2795
  expect.assertions(7);
2692
2796
  responsePayload = {
@@ -2698,25 +2802,25 @@ describe('Supplementary Services tests', function () {
2698
2802
  infoSpy = jest.spyOn(_Logger.default, 'info');
2699
2803
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
2700
2804
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
2701
- var _ref59 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58(correlationId) {
2702
- return _regenerator.default.wrap(function _callee58$(_context58) {
2703
- while (1) switch (_context58.prev = _context58.next) {
2805
+ var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(correlationId) {
2806
+ return _regenerator.default.wrap(function _callee59$(_context59) {
2807
+ while (1) switch (_context59.prev = _context59.next) {
2704
2808
  case 0:
2705
2809
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2706
2810
  case 1:
2707
2811
  case "end":
2708
- return _context58.stop();
2812
+ return _context59.stop();
2709
2813
  }
2710
- }, _callee58);
2814
+ }, _callee59);
2711
2815
  }));
2712
2816
  return function (_x13) {
2713
- return _ref59.apply(this, arguments);
2817
+ return _ref60.apply(this, arguments);
2714
2818
  };
2715
2819
  }());
2716
- _context59.next = 9;
2820
+ _context60.next = 9;
2717
2821
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
2718
2822
  case 9:
2719
- _context59.next = 11;
2823
+ _context60.next = 11;
2720
2824
  return (0, _testUtil.flushPromises)(2);
2721
2825
  case 11:
2722
2826
  expect(requestSpy).toBeCalled();
@@ -2732,14 +2836,14 @@ describe('Supplementary Services tests', function () {
2732
2836
  expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
2733
2837
  case 18:
2734
2838
  case "end":
2735
- return _context59.stop();
2839
+ return _context60.stop();
2736
2840
  }
2737
- }, _callee59);
2841
+ }, _callee60);
2738
2842
  })));
2739
- it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60() {
2843
+ it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61() {
2740
2844
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
2741
- return _regenerator.default.wrap(function _callee60$(_context60) {
2742
- while (1) switch (_context60.prev = _context60.next) {
2845
+ return _regenerator.default.wrap(function _callee61$(_context61) {
2846
+ while (1) switch (_context61.prev = _context61.next) {
2743
2847
  case 0:
2744
2848
  responsePayload = {
2745
2849
  statusCode: 403,
@@ -2749,10 +2853,10 @@ describe('Supplementary Services tests', function () {
2749
2853
  requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2750
2854
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2751
2855
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
2752
- _context60.next = 7;
2856
+ _context61.next = 7;
2753
2857
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
2754
2858
  case 7:
2755
- _context60.next = 9;
2859
+ _context61.next = 9;
2756
2860
  return (0, _testUtil.flushPromises)(1);
2757
2861
  case 9:
2758
2862
  expect(requestSpy).toBeCalled();
@@ -2768,14 +2872,14 @@ describe('Supplementary Services tests', function () {
2768
2872
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
2769
2873
  case 16:
2770
2874
  case "end":
2771
- return _context60.stop();
2875
+ return _context61.stop();
2772
2876
  }
2773
- }, _callee60);
2877
+ }, _callee61);
2774
2878
  })));
2775
- it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61() {
2879
+ it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62() {
2776
2880
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
2777
- return _regenerator.default.wrap(function _callee61$(_context61) {
2778
- while (1) switch (_context61.prev = _context61.next) {
2881
+ return _regenerator.default.wrap(function _callee62$(_context62) {
2882
+ while (1) switch (_context62.prev = _context62.next) {
2779
2883
  case 0:
2780
2884
  responsePayload = {
2781
2885
  statusCode: 403,
@@ -2785,10 +2889,10 @@ describe('Supplementary Services tests', function () {
2785
2889
  requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2786
2890
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2787
2891
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
2788
- _context61.next = 7;
2892
+ _context62.next = 7;
2789
2893
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
2790
2894
  case 7:
2791
- _context61.next = 9;
2895
+ _context62.next = 9;
2792
2896
  return (0, _testUtil.flushPromises)(2);
2793
2897
  case 9:
2794
2898
  expect(requestSpy).toBeCalled();
@@ -2805,18 +2909,18 @@ describe('Supplementary Services tests', function () {
2805
2909
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
2806
2910
  case 17:
2807
2911
  case "end":
2808
- return _context61.stop();
2912
+ return _context62.stop();
2809
2913
  }
2810
- }, _callee61);
2914
+ }, _callee62);
2811
2915
  })));
2812
- it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62() {
2916
+ it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63() {
2813
2917
  var requestSpy, warnSpy;
2814
- return _regenerator.default.wrap(function _callee62$(_context62) {
2815
- while (1) switch (_context62.prev = _context62.next) {
2918
+ return _regenerator.default.wrap(function _callee63$(_context63) {
2919
+ while (1) switch (_context63.prev = _context63.next) {
2816
2920
  case 0:
2817
2921
  requestSpy = jest.spyOn(webex, 'request');
2818
2922
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2819
- _context62.next = 4;
2923
+ _context63.next = 4;
2820
2924
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
2821
2925
  case 4:
2822
2926
  /* We should be in CALL_ESTABLISHED state */
@@ -2827,18 +2931,18 @@ describe('Supplementary Services tests', function () {
2827
2931
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
2828
2932
  case 9:
2829
2933
  case "end":
2830
- return _context62.stop();
2934
+ return _context63.stop();
2831
2935
  }
2832
- }, _callee62);
2936
+ }, _callee63);
2833
2937
  })));
2834
- it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63() {
2938
+ it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64() {
2835
2939
  var requestSpy, warnSpy;
2836
- return _regenerator.default.wrap(function _callee63$(_context63) {
2837
- while (1) switch (_context63.prev = _context63.next) {
2940
+ return _regenerator.default.wrap(function _callee64$(_context64) {
2941
+ while (1) switch (_context64.prev = _context64.next) {
2838
2942
  case 0:
2839
2943
  requestSpy = jest.spyOn(webex, 'request');
2840
2944
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2841
- _context63.next = 4;
2945
+ _context64.next = 4;
2842
2946
  return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
2843
2947
  case 4:
2844
2948
  /* We should be in CALL_ESTABLISHED state */
@@ -2849,9 +2953,9 @@ describe('Supplementary Services tests', function () {
2849
2953
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
2850
2954
  case 9:
2851
2955
  case "end":
2852
- return _context63.stop();
2956
+ return _context64.stop();
2853
2957
  }
2854
- }, _callee63);
2958
+ }, _callee64);
2855
2959
  })));
2856
2960
  });
2857
2961
  });