@webex/calling 3.10.0-next.8 → 3.10.0-webex-services-ready.1

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