@webex/calling 3.10.0-next.9 → 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 +650 -606
  26. package/dist/CallingClient/calling/call.js.map +1 -1
  27. package/dist/CallingClient/calling/call.test.js +685 -564
  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 +55 -34
  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);
922
+ })));
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);
896
961
  })));
897
- it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
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,16 +2232,16 @@ 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);
2119
2240
  })));
2120
- it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
2241
+ it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
2121
2242
  var emitSpy, deleteSpy;
2122
- return _regenerator.default.wrap(function _callee36$(_context36) {
2123
- while (1) switch (_context36.prev = _context36.next) {
2243
+ return _regenerator.default.wrap(function (_context39) {
2244
+ while (1) switch (_context39.prev = _context39.next) {
2124
2245
  case 0:
2125
2246
  emitSpy = jest.spyOn(call, 'emit');
2126
2247
  deleteSpy = jest.spyOn(call, 'delete').mockResolvedValue({
@@ -2129,17 +2250,17 @@ describe('State Machine handler tests', function () {
2129
2250
  call.sendCallStateMachineEvt({
2130
2251
  type: 'E_RECV_CALL_DISCONNECT'
2131
2252
  });
2132
- _context36.next = 5;
2253
+ _context39.next = 1;
2133
2254
  return (0, _testUtil.flushPromises)(1);
2134
- case 5:
2255
+ case 1:
2135
2256
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
2136
2257
  expect(deleteSpy).toHaveBeenCalled();
2137
2258
  expect(emitSpy.mock.invocationCallOrder[0]).toBeLessThan(deleteSpy.mock.invocationCallOrder[0]);
2138
- case 8:
2259
+ case 2:
2139
2260
  case "end":
2140
- return _context36.stop();
2261
+ return _context39.stop();
2141
2262
  }
2142
- }, _callee36);
2263
+ }, _callee39);
2143
2264
  })));
2144
2265
  describe('Call event timers tests', function () {
2145
2266
  var callManager;
@@ -2150,10 +2271,10 @@ describe('State Machine handler tests', function () {
2150
2271
  afterEach(function () {
2151
2272
  jest.clearAllTimers();
2152
2273
  });
2153
- it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
2274
+ it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
2154
2275
  var statusPayload, dummyEvent, logSpy, emitSpy, deleteSpy, dummyOkEvent;
2155
- return _regenerator.default.wrap(function _callee37$(_context37) {
2156
- while (1) switch (_context37.prev = _context37.next) {
2276
+ return _regenerator.default.wrap(function (_context40) {
2277
+ while (1) switch (_context40.prev = _context40.next) {
2157
2278
  case 0:
2158
2279
  statusPayload = {
2159
2280
  statusCode: 200,
@@ -2170,9 +2291,9 @@ describe('State Machine handler tests', function () {
2170
2291
  webex.request.mockReturnValue(statusPayload);
2171
2292
 
2172
2293
  // handleOutgoingCallSetup is asynchronous
2173
- _context37.next = 9;
2294
+ _context40.next = 1;
2174
2295
  return call.sendCallStateMachineEvt(dummyEvent);
2175
- case 9:
2296
+ case 1:
2176
2297
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
2177
2298
  dummyEvent.type = 'E_RECV_CALL_PROGRESS';
2178
2299
  call.sendCallStateMachineEvt(dummyEvent);
@@ -2211,16 +2332,16 @@ describe('State Machine handler tests', function () {
2211
2332
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
2212
2333
  expect(deleteSpy).toHaveBeenCalledTimes(1);
2213
2334
  expect(callManager.callCollection).toStrictEqual({});
2214
- case 32:
2335
+ case 2:
2215
2336
  case "end":
2216
- return _context37.stop();
2337
+ return _context40.stop();
2217
2338
  }
2218
- }, _callee37);
2339
+ }, _callee40);
2219
2340
  })));
2220
- it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
2341
+ it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2221
2342
  var statusPayload, dummyEvent, call, emitSpy, deleteSpy, logSpy;
2222
- return _regenerator.default.wrap(function _callee38$(_context38) {
2223
- while (1) switch (_context38.prev = _context38.next) {
2343
+ return _regenerator.default.wrap(function (_context41) {
2344
+ while (1) switch (_context41.prev = _context41.next) {
2224
2345
  case 0:
2225
2346
  statusPayload = {
2226
2347
  statusCode: 200,
@@ -2239,9 +2360,9 @@ describe('State Machine handler tests', function () {
2239
2360
  expect((0, _keys.default)(callManager.callCollection)[0]).toBe(call.getCorrelationId());
2240
2361
 
2241
2362
  // handleOutgoingCallSetup is asynchronous
2242
- _context38.next = 11;
2363
+ _context41.next = 1;
2243
2364
  return call.sendCallStateMachineEvt(dummyEvent);
2244
- case 11:
2365
+ case 1:
2245
2366
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
2246
2367
  logSpy.mockClear();
2247
2368
  jest.advanceTimersByTime(10000);
@@ -2249,11 +2370,11 @@ describe('State Machine handler tests', function () {
2249
2370
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
2250
2371
  expect(deleteSpy).toHaveBeenCalledTimes(1);
2251
2372
  expect(callManager.callCollection).toStrictEqual({});
2252
- case 18:
2373
+ case 2:
2253
2374
  case "end":
2254
- return _context38.stop();
2375
+ return _context41.stop();
2255
2376
  }
2256
- }, _callee38);
2377
+ }, _callee41);
2257
2378
  })));
2258
2379
  });
2259
2380
  });
@@ -2313,10 +2434,10 @@ describe('Supplementary Services tests', function () {
2313
2434
  beforeEach(function () {
2314
2435
  call.removeAllListeners();
2315
2436
  });
2316
- it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
2437
+ it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
2317
2438
  var responsePayload, warnSpy, roapEvent;
2318
- return _regenerator.default.wrap(function _callee40$(_context40) {
2319
- while (1) switch (_context40.prev = _context40.next) {
2439
+ return _regenerator.default.wrap(function (_context43) {
2440
+ while (1) switch (_context43.prev = _context43.next) {
2320
2441
  case 0:
2321
2442
  expect.assertions(7);
2322
2443
  responsePayload = {
@@ -2329,27 +2450,27 @@ describe('Supplementary Services tests', function () {
2329
2450
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2330
2451
  call['held'] = false;
2331
2452
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2332
- var _ref40 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39(correlationId) {
2333
- return _regenerator.default.wrap(function _callee39$(_context39) {
2334
- while (1) switch (_context39.prev = _context39.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) {
2335
2456
  case 0:
2336
2457
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2337
2458
  case 1:
2338
2459
  case "end":
2339
- return _context39.stop();
2460
+ return _context42.stop();
2340
2461
  }
2341
- }, _callee39);
2462
+ }, _callee42);
2342
2463
  }));
2343
2464
  return function (_x) {
2344
- return _ref40.apply(this, arguments);
2465
+ return _ref43.apply(this, arguments);
2345
2466
  };
2346
2467
  }());
2347
- _context40.next = 10;
2468
+ _context43.next = 1;
2348
2469
  return call.doHoldResume();
2349
- case 10:
2350
- _context40.next = 12;
2470
+ case 1:
2471
+ _context43.next = 2;
2351
2472
  return (0, _testUtil.flushPromises)(2);
2352
- case 12:
2473
+ case 2:
2353
2474
  expect(setTimeout).toHaveBeenCalledTimes(1);
2354
2475
  call.handleMidCallEvent(mockHeldEvent);
2355
2476
 
@@ -2363,13 +2484,13 @@ describe('Supplementary Services tests', function () {
2363
2484
  call['handleIncomingRoapOffer']({}, dummyEvent);
2364
2485
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2365
2486
  roapEvent.data.type = 'ANSWER';
2366
- _context40.next = 20;
2487
+ _context43.next = 3;
2367
2488
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2368
- case 20:
2489
+ case 3:
2369
2490
  roapEvent.data.type = 'OK';
2370
- _context40.next = 23;
2491
+ _context43.next = 4;
2371
2492
  return call['handleRoapEstablished']({}, dummyEvent);
2372
- case 23:
2493
+ case 4:
2373
2494
  expect(clearTimeout).toHaveBeenCalledTimes(1);
2374
2495
  /* isHeld flag should be set and an Hold event should be emitted */
2375
2496
  expect(call.isHeld()).toStrictEqual(true);
@@ -2380,16 +2501,16 @@ describe('Supplementary Services tests', function () {
2380
2501
  file: 'call',
2381
2502
  method: 'handleCallHold'
2382
2503
  });
2383
- case 28:
2504
+ case 5:
2384
2505
  case "end":
2385
- return _context40.stop();
2506
+ return _context43.stop();
2386
2507
  }
2387
- }, _callee40);
2508
+ }, _callee43);
2388
2509
  })));
2389
- it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
2510
+ it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
2390
2511
  var responsePayload, warnSpy, roapEvent;
2391
- return _regenerator.default.wrap(function _callee42$(_context42) {
2392
- while (1) switch (_context42.prev = _context42.next) {
2512
+ return _regenerator.default.wrap(function (_context45) {
2513
+ while (1) switch (_context45.prev = _context45.next) {
2393
2514
  case 0:
2394
2515
  expect.assertions(8);
2395
2516
  responsePayload = {
@@ -2402,28 +2523,28 @@ describe('Supplementary Services tests', function () {
2402
2523
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2403
2524
  call['held'] = false;
2404
2525
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2405
- var _ref42 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41(correlationId) {
2406
- return _regenerator.default.wrap(function _callee41$(_context41) {
2407
- while (1) switch (_context41.prev = _context41.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) {
2408
2529
  case 0:
2409
2530
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2410
2531
  case 1:
2411
2532
  case "end":
2412
- return _context41.stop();
2533
+ return _context44.stop();
2413
2534
  }
2414
- }, _callee41);
2535
+ }, _callee44);
2415
2536
  }));
2416
2537
  return function (_x2) {
2417
- return _ref42.apply(this, arguments);
2538
+ return _ref45.apply(this, arguments);
2418
2539
  };
2419
2540
  }());
2420
2541
  call.doHoldResume();
2421
- _context42.next = 11;
2542
+ _context45.next = 1;
2422
2543
  return _promise.default.resolve();
2423
- case 11:
2424
- _context42.next = 13;
2544
+ case 1:
2545
+ _context45.next = 2;
2425
2546
  return _promise.default.resolve();
2426
- case 13:
2547
+ case 2:
2427
2548
  expect(setTimeout).not.toHaveBeenCalled();
2428
2549
  call.handleMidCallEvent(mockHeldEvent);
2429
2550
 
@@ -2437,13 +2558,13 @@ describe('Supplementary Services tests', function () {
2437
2558
  call['handleIncomingRoapOffer']({}, dummyEvent);
2438
2559
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2439
2560
  roapEvent.data.type = 'ANSWER';
2440
- _context42.next = 22;
2561
+ _context45.next = 3;
2441
2562
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2442
- case 22:
2563
+ case 3:
2443
2564
  roapEvent.data.type = 'OK';
2444
- _context42.next = 25;
2565
+ _context45.next = 4;
2445
2566
  return call['handleRoapEstablished']({}, dummyEvent);
2446
- case 25:
2567
+ case 4:
2447
2568
  expect(clearTimeout).not.toHaveBeenCalled();
2448
2569
  /* isHeld flag should be set and an Hold event should be emitted */
2449
2570
  expect(call.isHeld()).toStrictEqual(true);
@@ -2454,16 +2575,16 @@ describe('Supplementary Services tests', function () {
2454
2575
  file: 'call',
2455
2576
  method: 'handleCallHold'
2456
2577
  });
2457
- case 30:
2578
+ case 5:
2458
2579
  case "end":
2459
- return _context42.stop();
2580
+ return _context45.stop();
2460
2581
  }
2461
- }, _callee42);
2582
+ }, _callee45);
2462
2583
  })));
2463
- it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
2584
+ it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
2464
2585
  var responsePayload;
2465
- return _regenerator.default.wrap(function _callee44$(_context44) {
2466
- while (1) switch (_context44.prev = _context44.next) {
2586
+ return _regenerator.default.wrap(function (_context47) {
2587
+ while (1) switch (_context47.prev = _context47.next) {
2467
2588
  case 0:
2468
2589
  expect.assertions(4);
2469
2590
  responsePayload = {
@@ -2473,43 +2594,43 @@ describe('Supplementary Services tests', function () {
2473
2594
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2474
2595
  call['held'] = false;
2475
2596
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2476
- var _ref44 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43(errObj) {
2477
- return _regenerator.default.wrap(function _callee43$(_context43) {
2478
- while (1) switch (_context43.prev = _context43.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) {
2479
2600
  case 0:
2480
2601
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2481
2602
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2482
- case 2:
2603
+ case 1:
2483
2604
  case "end":
2484
- return _context43.stop();
2605
+ return _context46.stop();
2485
2606
  }
2486
- }, _callee43);
2607
+ }, _callee46);
2487
2608
  }));
2488
2609
  return function (_x3) {
2489
- return _ref44.apply(this, arguments);
2610
+ return _ref47.apply(this, arguments);
2490
2611
  };
2491
2612
  }());
2492
- _context44.next = 7;
2613
+ _context47.next = 1;
2493
2614
  return call.doHoldResume();
2494
- case 7:
2495
- _context44.next = 9;
2615
+ case 1:
2616
+ _context47.next = 2;
2496
2617
  return (0, _testUtil.flushPromises)(2);
2497
- case 9:
2618
+ case 2:
2498
2619
  expect(call.isHeld()).toStrictEqual(false);
2499
2620
 
2500
2621
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
2501
2622
  */
2502
2623
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2503
- case 11:
2624
+ case 3:
2504
2625
  case "end":
2505
- return _context44.stop();
2626
+ return _context47.stop();
2506
2627
  }
2507
- }, _callee44);
2628
+ }, _callee47);
2508
2629
  })));
2509
- it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
2630
+ it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
2510
2631
  var responsePayload, rejectPayload, roapEvent;
2511
- return _regenerator.default.wrap(function _callee46$(_context46) {
2512
- while (1) switch (_context46.prev = _context46.next) {
2632
+ return _regenerator.default.wrap(function (_context49) {
2633
+ while (1) switch (_context49.prev = _context49.next) {
2513
2634
  case 0:
2514
2635
  expect.assertions(5);
2515
2636
  responsePayload = {
@@ -2523,26 +2644,26 @@ describe('Supplementary Services tests', function () {
2523
2644
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2524
2645
  call['held'] = false;
2525
2646
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2526
- var _ref46 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45(errObj) {
2527
- return _regenerator.default.wrap(function _callee45$(_context45) {
2528
- while (1) switch (_context45.prev = _context45.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) {
2529
2650
  case 0:
2530
2651
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2531
2652
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2532
- case 2:
2653
+ case 1:
2533
2654
  case "end":
2534
- return _context45.stop();
2655
+ return _context48.stop();
2535
2656
  }
2536
- }, _callee45);
2657
+ }, _callee48);
2537
2658
  }));
2538
2659
  return function (_x4) {
2539
- return _ref46.apply(this, arguments);
2660
+ return _ref49.apply(this, arguments);
2540
2661
  };
2541
2662
  }());
2542
2663
  call.doHoldResume();
2543
- _context46.next = 9;
2664
+ _context49.next = 1;
2544
2665
  return (0, _testUtil.flushPromises)(2);
2545
- case 9:
2666
+ case 1:
2546
2667
  /* the Call State should transition to S_CALL_ESTABLISHED
2547
2668
  */
2548
2669
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_HOLD');
@@ -2550,22 +2671,22 @@ describe('Supplementary Services tests', function () {
2550
2671
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2551
2672
  /* We are intentionally failing the ROAP ANSWER */
2552
2673
  roapEvent.data.type = 'ANSWER';
2553
- _context46.next = 15;
2674
+ _context49.next = 2;
2554
2675
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2555
- case 15:
2676
+ case 2:
2556
2677
  expect(call.isHeld()).toStrictEqual(false);
2557
2678
  /* We should return back to call established state */
2558
2679
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2559
- case 17:
2680
+ case 3:
2560
2681
  case "end":
2561
- return _context46.stop();
2682
+ return _context49.stop();
2562
2683
  }
2563
- }, _callee46);
2684
+ }, _callee49);
2564
2685
  })));
2565
- it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
2686
+ it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
2566
2687
  var responsePayload, warnSpy, roapEvent;
2567
- return _regenerator.default.wrap(function _callee47$(_context47) {
2568
- while (1) switch (_context47.prev = _context47.next) {
2688
+ return _regenerator.default.wrap(function (_context50) {
2689
+ while (1) switch (_context50.prev = _context50.next) {
2569
2690
  case 0:
2570
2691
  responsePayload = {
2571
2692
  statusCode: 200,
@@ -2576,12 +2697,12 @@ describe('Supplementary Services tests', function () {
2576
2697
  jest.spyOn(global, 'clearTimeout');
2577
2698
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2578
2699
  call['held'] = false;
2579
- _context47.next = 8;
2700
+ _context50.next = 1;
2580
2701
  return call.doHoldResume();
2581
- case 8:
2582
- _context47.next = 10;
2702
+ case 1:
2703
+ _context50.next = 2;
2583
2704
  return (0, _testUtil.flushPromises)(2);
2584
- case 10:
2705
+ case 2:
2585
2706
  expect(setTimeout).toHaveBeenCalledTimes(1);
2586
2707
 
2587
2708
  /* At this point, the Call State should be S_CALL_HOLD
@@ -2594,21 +2715,21 @@ describe('Supplementary Services tests', function () {
2594
2715
  call['handleIncomingRoapOffer']({}, dummyEvent);
2595
2716
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2596
2717
  roapEvent.data.type = 'ANSWER';
2597
- _context47.next = 17;
2718
+ _context50.next = 3;
2598
2719
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2599
- case 17:
2720
+ case 3:
2600
2721
  jest.spyOn(webex, 'request').mockRejectedValue({
2601
2722
  statusCode: 403
2602
2723
  });
2603
2724
  roapEvent.data.type = 'OK';
2604
- _context47.next = 21;
2725
+ _context50.next = 4;
2605
2726
  return call['handleRoapEstablished']({}, dummyEvent);
2606
- case 21:
2727
+ case 4:
2607
2728
  /* this is for coverage */
2608
2729
  call['callStateMachine'].state.value = 'S_CALL_HOLD';
2609
- _context47.next = 24;
2730
+ _context50.next = 5;
2610
2731
  return call['handleRoapEstablished']({}, dummyEvent);
2611
- case 24:
2732
+ case 5:
2612
2733
  expect(call.isHeld()).toStrictEqual(false);
2613
2734
  /* We should return back to call established state */
2614
2735
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -2616,16 +2737,16 @@ describe('Supplementary Services tests', function () {
2616
2737
  file: 'call',
2617
2738
  method: 'handleRoapEstablished'
2618
2739
  });
2619
- case 27:
2740
+ case 6:
2620
2741
  case "end":
2621
- return _context47.stop();
2742
+ return _context50.stop();
2622
2743
  }
2623
- }, _callee47);
2744
+ }, _callee50);
2624
2745
  })));
2625
- it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48() {
2746
+ it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
2626
2747
  var responsePayload, warnSpy, roapEvent;
2627
- return _regenerator.default.wrap(function _callee48$(_context48) {
2628
- while (1) switch (_context48.prev = _context48.next) {
2748
+ return _regenerator.default.wrap(function (_context51) {
2749
+ while (1) switch (_context51.prev = _context51.next) {
2629
2750
  case 0:
2630
2751
  responsePayload = {
2631
2752
  statusCode: 200,
@@ -2636,12 +2757,12 @@ describe('Supplementary Services tests', function () {
2636
2757
  jest.spyOn(global, 'clearTimeout');
2637
2758
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2638
2759
  call['held'] = true;
2639
- _context48.next = 8;
2760
+ _context51.next = 1;
2640
2761
  return call.doHoldResume();
2641
- case 8:
2642
- _context48.next = 10;
2762
+ case 1:
2763
+ _context51.next = 2;
2643
2764
  return (0, _testUtil.flushPromises)(2);
2644
- case 10:
2765
+ case 2:
2645
2766
  expect(setTimeout).toHaveBeenCalledTimes(1);
2646
2767
 
2647
2768
  /* At this point, the Call State should be S_CALL_RESUME
@@ -2654,16 +2775,16 @@ describe('Supplementary Services tests', function () {
2654
2775
  call['handleIncomingRoapOffer']({}, dummyEvent);
2655
2776
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2656
2777
  roapEvent.data.type = 'ANSWER';
2657
- _context48.next = 17;
2778
+ _context51.next = 3;
2658
2779
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2659
- case 17:
2780
+ case 3:
2660
2781
  jest.spyOn(webex, 'request').mockRejectedValue({
2661
2782
  statusCode: 403
2662
2783
  });
2663
2784
  roapEvent.data.type = 'OK';
2664
- _context48.next = 21;
2785
+ _context51.next = 4;
2665
2786
  return call['handleRoapEstablished']({}, dummyEvent);
2666
- case 21:
2787
+ case 4:
2667
2788
  expect(call.isHeld()).toStrictEqual(true);
2668
2789
  /* We should return back to call established state */
2669
2790
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -2671,16 +2792,16 @@ describe('Supplementary Services tests', function () {
2671
2792
  file: 'call',
2672
2793
  method: 'handleRoapEstablished'
2673
2794
  });
2674
- case 24:
2795
+ case 5:
2675
2796
  case "end":
2676
- return _context48.stop();
2797
+ return _context51.stop();
2677
2798
  }
2678
- }, _callee48);
2799
+ }, _callee51);
2679
2800
  })));
2680
- it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
2801
+ it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
2681
2802
  var responsePayload, roapEvent;
2682
- return _regenerator.default.wrap(function _callee50$(_context50) {
2683
- while (1) switch (_context50.prev = _context50.next) {
2803
+ return _regenerator.default.wrap(function (_context53) {
2804
+ while (1) switch (_context53.prev = _context53.next) {
2684
2805
  case 0:
2685
2806
  expect.assertions(5);
2686
2807
  responsePayload = {
@@ -2690,27 +2811,27 @@ describe('Supplementary Services tests', function () {
2690
2811
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
2691
2812
  call['held'] = false;
2692
2813
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2693
- var _ref50 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49(errObj) {
2694
- return _regenerator.default.wrap(function _callee49$(_context49) {
2695
- while (1) switch (_context49.prev = _context49.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) {
2696
2817
  case 0:
2697
2818
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
2698
2819
  expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
2699
- case 2:
2820
+ case 1:
2700
2821
  case "end":
2701
- return _context49.stop();
2822
+ return _context52.stop();
2702
2823
  }
2703
- }, _callee49);
2824
+ }, _callee52);
2704
2825
  }));
2705
2826
  return function (_x5) {
2706
- return _ref50.apply(this, arguments);
2827
+ return _ref53.apply(this, arguments);
2707
2828
  };
2708
2829
  }());
2709
2830
  jest.runAllTimers();
2710
2831
  call.doHoldResume();
2711
- _context50.next = 9;
2832
+ _context53.next = 1;
2712
2833
  return (0, _testUtil.flushPromises)(2);
2713
- case 9:
2834
+ case 1:
2714
2835
  /* At this point, the Call State should be S_CALL_HOLD
2715
2836
  */
2716
2837
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_HOLD');
@@ -2721,13 +2842,13 @@ describe('Supplementary Services tests', function () {
2721
2842
  call['handleIncomingRoapOffer']({}, dummyEvent);
2722
2843
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2723
2844
  roapEvent.data.type = 'ANSWER';
2724
- _context50.next = 15;
2845
+ _context53.next = 2;
2725
2846
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2726
- case 15:
2847
+ case 2:
2727
2848
  roapEvent.data.type = 'OK';
2728
- _context50.next = 18;
2849
+ _context53.next = 3;
2729
2850
  return call['handleRoapEstablished']({}, dummyEvent);
2730
- case 18:
2851
+ case 3:
2731
2852
  /* Advancing timer by 12 seconds so that it gets timed out */
2732
2853
  jest.advanceTimersByTime(12000);
2733
2854
 
@@ -2735,16 +2856,16 @@ describe('Supplementary Services tests', function () {
2735
2856
  expect(call.isHeld()).toStrictEqual(false);
2736
2857
  /* We should return back to call established state */
2737
2858
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2738
- case 21:
2859
+ case 4:
2739
2860
  case "end":
2740
- return _context50.stop();
2861
+ return _context53.stop();
2741
2862
  }
2742
- }, _callee50);
2863
+ }, _callee53);
2743
2864
  })));
2744
- it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
2865
+ it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
2745
2866
  var responsePayload, warnSpy, roapEvent;
2746
- return _regenerator.default.wrap(function _callee52$(_context52) {
2747
- while (1) switch (_context52.prev = _context52.next) {
2867
+ return _regenerator.default.wrap(function (_context55) {
2868
+ while (1) switch (_context55.prev = _context55.next) {
2748
2869
  case 0:
2749
2870
  expect.assertions(7);
2750
2871
  responsePayload = {
@@ -2757,27 +2878,27 @@ describe('Supplementary Services tests', function () {
2757
2878
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2758
2879
  call['held'] = true;
2759
2880
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
2760
- var _ref52 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51(correlationId) {
2761
- return _regenerator.default.wrap(function _callee51$(_context51) {
2762
- while (1) switch (_context51.prev = _context51.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) {
2763
2884
  case 0:
2764
2885
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2765
2886
  case 1:
2766
2887
  case "end":
2767
- return _context51.stop();
2888
+ return _context54.stop();
2768
2889
  }
2769
- }, _callee51);
2890
+ }, _callee54);
2770
2891
  }));
2771
2892
  return function (_x6) {
2772
- return _ref52.apply(this, arguments);
2893
+ return _ref55.apply(this, arguments);
2773
2894
  };
2774
2895
  }());
2775
- _context52.next = 10;
2896
+ _context55.next = 1;
2776
2897
  return call.doHoldResume();
2777
- case 10:
2778
- _context52.next = 12;
2898
+ case 1:
2899
+ _context55.next = 2;
2779
2900
  return (0, _testUtil.flushPromises)(2);
2780
- case 12:
2901
+ case 2:
2781
2902
  expect(setTimeout).toHaveBeenCalledTimes(1);
2782
2903
  call.handleMidCallEvent(mockResumeEvent);
2783
2904
 
@@ -2791,13 +2912,13 @@ describe('Supplementary Services tests', function () {
2791
2912
  call['handleIncomingRoapOffer']({}, dummyEvent);
2792
2913
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2793
2914
  roapEvent.data.type = 'ANSWER';
2794
- _context52.next = 20;
2915
+ _context55.next = 3;
2795
2916
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2796
- case 20:
2917
+ case 3:
2797
2918
  roapEvent.data.type = 'OK';
2798
- _context52.next = 23;
2919
+ _context55.next = 4;
2799
2920
  return call['handleRoapEstablished']({}, dummyEvent);
2800
- case 23:
2921
+ case 4:
2801
2922
  expect(clearTimeout).toHaveBeenCalledTimes(1);
2802
2923
  /* isHeld flag should not be set and an Resume event should be emitted */
2803
2924
  expect(call.isHeld()).toStrictEqual(false);
@@ -2808,16 +2929,16 @@ describe('Supplementary Services tests', function () {
2808
2929
  file: 'call',
2809
2930
  method: 'handleCallResume'
2810
2931
  });
2811
- case 28:
2932
+ case 5:
2812
2933
  case "end":
2813
- return _context52.stop();
2934
+ return _context55.stop();
2814
2935
  }
2815
- }, _callee52);
2936
+ }, _callee55);
2816
2937
  })));
2817
- it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54() {
2938
+ it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
2818
2939
  var responsePayload, warnSpy, roapEvent;
2819
- return _regenerator.default.wrap(function _callee54$(_context54) {
2820
- while (1) switch (_context54.prev = _context54.next) {
2940
+ return _regenerator.default.wrap(function (_context57) {
2941
+ while (1) switch (_context57.prev = _context57.next) {
2821
2942
  case 0:
2822
2943
  expect.assertions(7);
2823
2944
  responsePayload = {
@@ -2830,28 +2951,28 @@ describe('Supplementary Services tests', function () {
2830
2951
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2831
2952
  call['held'] = true;
2832
2953
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
2833
- var _ref54 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53(correlationId) {
2834
- return _regenerator.default.wrap(function _callee53$(_context53) {
2835
- while (1) switch (_context53.prev = _context53.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) {
2836
2957
  case 0:
2837
2958
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2838
2959
  case 1:
2839
2960
  case "end":
2840
- return _context53.stop();
2961
+ return _context56.stop();
2841
2962
  }
2842
- }, _callee53);
2963
+ }, _callee56);
2843
2964
  }));
2844
2965
  return function (_x7) {
2845
- return _ref54.apply(this, arguments);
2966
+ return _ref57.apply(this, arguments);
2846
2967
  };
2847
2968
  }());
2848
2969
  call.doHoldResume();
2849
- _context54.next = 11;
2970
+ _context57.next = 1;
2850
2971
  return _promise.default.resolve();
2851
- case 11:
2852
- _context54.next = 13;
2972
+ case 1:
2973
+ _context57.next = 2;
2853
2974
  return _promise.default.resolve();
2854
- case 13:
2975
+ case 2:
2855
2976
  expect(setTimeout).not.toHaveBeenCalled();
2856
2977
  call.handleMidCallEvent(mockResumeEvent);
2857
2978
 
@@ -2865,13 +2986,13 @@ describe('Supplementary Services tests', function () {
2865
2986
  call['handleIncomingRoapOffer']({}, dummyEvent);
2866
2987
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2867
2988
  roapEvent.data.type = 'ANSWER';
2868
- _context54.next = 21;
2989
+ _context57.next = 3;
2869
2990
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2870
- case 21:
2991
+ case 3:
2871
2992
  roapEvent.data.type = 'OK';
2872
- _context54.next = 24;
2993
+ _context57.next = 4;
2873
2994
  return call['handleRoapEstablished']({}, dummyEvent);
2874
- case 24:
2995
+ case 4:
2875
2996
  expect(clearTimeout).not.toHaveBeenCalled();
2876
2997
  /* isHeld flag should not be set and an Resume event should be emitted */
2877
2998
  expect(call.isHeld()).toStrictEqual(false);
@@ -2882,16 +3003,16 @@ describe('Supplementary Services tests', function () {
2882
3003
  file: 'call',
2883
3004
  method: 'handleCallResume'
2884
3005
  });
2885
- case 29:
3006
+ case 5:
2886
3007
  case "end":
2887
- return _context54.stop();
3008
+ return _context57.stop();
2888
3009
  }
2889
- }, _callee54);
3010
+ }, _callee57);
2890
3011
  })));
2891
- it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56() {
3012
+ it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59() {
2892
3013
  var responsePayload;
2893
- return _regenerator.default.wrap(function _callee56$(_context56) {
2894
- while (1) switch (_context56.prev = _context56.next) {
3014
+ return _regenerator.default.wrap(function (_context59) {
3015
+ while (1) switch (_context59.prev = _context59.next) {
2895
3016
  case 0:
2896
3017
  expect.assertions(4);
2897
3018
  responsePayload = {
@@ -2901,44 +3022,44 @@ describe('Supplementary Services tests', function () {
2901
3022
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2902
3023
  call['held'] = true;
2903
3024
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
2904
- var _ref56 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55(errObj) {
2905
- return _regenerator.default.wrap(function _callee55$(_context55) {
2906
- while (1) switch (_context55.prev = _context55.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) {
2907
3028
  case 0:
2908
3029
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2909
3030
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2910
- case 2:
3031
+ case 1:
2911
3032
  case "end":
2912
- return _context55.stop();
3033
+ return _context58.stop();
2913
3034
  }
2914
- }, _callee55);
3035
+ }, _callee58);
2915
3036
  }));
2916
3037
  return function (_x8) {
2917
- return _ref56.apply(this, arguments);
3038
+ return _ref59.apply(this, arguments);
2918
3039
  };
2919
3040
  }());
2920
- _context56.next = 7;
3041
+ _context59.next = 1;
2921
3042
  return call.doHoldResume();
2922
- case 7:
2923
- _context56.next = 9;
3043
+ case 1:
3044
+ _context59.next = 2;
2924
3045
  return (0, _testUtil.flushPromises)(2);
2925
- case 9:
3046
+ case 2:
2926
3047
  expect(call.isHeld()).toStrictEqual(true);
2927
3048
 
2928
3049
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
2929
3050
  */
2930
3051
 
2931
3052
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2932
- case 11:
3053
+ case 3:
2933
3054
  case "end":
2934
- return _context56.stop();
3055
+ return _context59.stop();
2935
3056
  }
2936
- }, _callee56);
3057
+ }, _callee59);
2937
3058
  })));
2938
- it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58() {
3059
+ it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61() {
2939
3060
  var responsePayload, rejectPayload, roapEvent;
2940
- return _regenerator.default.wrap(function _callee58$(_context58) {
2941
- while (1) switch (_context58.prev = _context58.next) {
3061
+ return _regenerator.default.wrap(function (_context61) {
3062
+ while (1) switch (_context61.prev = _context61.next) {
2942
3063
  case 0:
2943
3064
  expect.assertions(5);
2944
3065
  responsePayload = {
@@ -2952,26 +3073,26 @@ describe('Supplementary Services tests', function () {
2952
3073
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2953
3074
  call['held'] = true;
2954
3075
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
2955
- var _ref58 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57(errObj) {
2956
- return _regenerator.default.wrap(function _callee57$(_context57) {
2957
- while (1) switch (_context57.prev = _context57.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) {
2958
3079
  case 0:
2959
3080
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2960
3081
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2961
- case 2:
3082
+ case 1:
2962
3083
  case "end":
2963
- return _context57.stop();
3084
+ return _context60.stop();
2964
3085
  }
2965
- }, _callee57);
3086
+ }, _callee60);
2966
3087
  }));
2967
3088
  return function (_x9) {
2968
- return _ref58.apply(this, arguments);
3089
+ return _ref61.apply(this, arguments);
2969
3090
  };
2970
3091
  }());
2971
3092
  call.doHoldResume();
2972
- _context58.next = 9;
3093
+ _context61.next = 1;
2973
3094
  return (0, _testUtil.flushPromises)(2);
2974
- case 9:
3095
+ case 1:
2975
3096
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
2976
3097
  */
2977
3098
 
@@ -2980,22 +3101,22 @@ describe('Supplementary Services tests', function () {
2980
3101
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2981
3102
  /* We are intentionally failing the ROAP ANSWER */
2982
3103
  roapEvent.data.type = 'ANSWER';
2983
- _context58.next = 15;
3104
+ _context61.next = 2;
2984
3105
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2985
- case 15:
3106
+ case 2:
2986
3107
  expect(call.isHeld()).toStrictEqual(true);
2987
3108
  /* We should return back to call established state */
2988
3109
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2989
- case 17:
3110
+ case 3:
2990
3111
  case "end":
2991
- return _context58.stop();
3112
+ return _context61.stop();
2992
3113
  }
2993
- }, _callee58);
3114
+ }, _callee61);
2994
3115
  })));
2995
- it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60() {
3116
+ it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
2996
3117
  var responsePayload, roapEvent;
2997
- return _regenerator.default.wrap(function _callee60$(_context60) {
2998
- while (1) switch (_context60.prev = _context60.next) {
3118
+ return _regenerator.default.wrap(function (_context63) {
3119
+ while (1) switch (_context63.prev = _context63.next) {
2999
3120
  case 0:
3000
3121
  expect.assertions(5);
3001
3122
  responsePayload = {
@@ -3005,26 +3126,26 @@ describe('Supplementary Services tests', function () {
3005
3126
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
3006
3127
  call['held'] = true;
3007
3128
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3008
- var _ref60 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59(errObj) {
3009
- return _regenerator.default.wrap(function _callee59$(_context59) {
3010
- while (1) switch (_context59.prev = _context59.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) {
3011
3132
  case 0:
3012
3133
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
3013
3134
  expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
3014
- case 2:
3135
+ case 1:
3015
3136
  case "end":
3016
- return _context59.stop();
3137
+ return _context62.stop();
3017
3138
  }
3018
- }, _callee59);
3139
+ }, _callee62);
3019
3140
  }));
3020
3141
  return function (_x0) {
3021
- return _ref60.apply(this, arguments);
3142
+ return _ref63.apply(this, arguments);
3022
3143
  };
3023
3144
  }());
3024
3145
  call.doHoldResume();
3025
- _context60.next = 8;
3146
+ _context63.next = 1;
3026
3147
  return (0, _testUtil.flushPromises)(2);
3027
- case 8:
3148
+ case 1:
3028
3149
  /* At this point ,the Call State should be S_CALL_RESUME
3029
3150
  */
3030
3151
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_RESUME');
@@ -3035,23 +3156,23 @@ describe('Supplementary Services tests', function () {
3035
3156
  call['handleIncomingRoapOffer']({}, dummyEvent);
3036
3157
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3037
3158
  roapEvent.data.type = 'ANSWER';
3038
- _context60.next = 14;
3159
+ _context63.next = 2;
3039
3160
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3040
- case 14:
3161
+ case 2:
3041
3162
  roapEvent.data.type = 'OK';
3042
- _context60.next = 17;
3163
+ _context63.next = 3;
3043
3164
  return call['handleRoapEstablished']({}, dummyEvent);
3044
- case 17:
3165
+ case 3:
3045
3166
  /* Advancing timer by 12 seconds so that it gets timed out */
3046
3167
  jest.advanceTimersByTime(12000);
3047
3168
  expect(call.isHeld()).toStrictEqual(true);
3048
3169
  /* We should return back to call established state */
3049
3170
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3050
- case 20:
3171
+ case 4:
3051
3172
  case "end":
3052
- return _context60.stop();
3173
+ return _context63.stop();
3053
3174
  }
3054
- }, _callee60);
3175
+ }, _callee63);
3055
3176
  })));
3056
3177
  });
3057
3178
  describe('Call transfer tests', function () {
@@ -3084,10 +3205,10 @@ describe('Supplementary Services tests', function () {
3084
3205
  secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
3085
3206
  secondCall['held'] = false;
3086
3207
  });
3087
- it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
3208
+ it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66() {
3088
3209
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3089
- return _regenerator.default.wrap(function _callee63$(_context63) {
3090
- while (1) switch (_context63.prev = _context63.next) {
3210
+ return _regenerator.default.wrap(function (_context66) {
3211
+ while (1) switch (_context66.prev = _context66.next) {
3091
3212
  case 0:
3092
3213
  expect.assertions(12); // Updated to match actual assertion count
3093
3214
  responsePayload = {
@@ -3099,43 +3220,43 @@ describe('Supplementary Services tests', function () {
3099
3220
  infoSpy = jest.spyOn(_Logger.default, 'info');
3100
3221
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3101
3222
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3102
- var _ref62 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61(correlationId) {
3103
- return _regenerator.default.wrap(function _callee61$(_context61) {
3104
- while (1) switch (_context61.prev = _context61.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) {
3105
3226
  case 0:
3106
3227
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3107
3228
  case 1:
3108
3229
  case "end":
3109
- return _context61.stop();
3230
+ return _context64.stop();
3110
3231
  }
3111
- }, _callee61);
3232
+ }, _callee64);
3112
3233
  }));
3113
3234
  return function (_x1) {
3114
- return _ref62.apply(this, arguments);
3235
+ return _ref65.apply(this, arguments);
3115
3236
  };
3116
3237
  }());
3117
3238
  secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3118
- var _ref63 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62(correlationId) {
3119
- return _regenerator.default.wrap(function _callee62$(_context62) {
3120
- while (1) switch (_context62.prev = _context62.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) {
3121
3242
  case 0:
3122
3243
  expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
3123
3244
  case 1:
3124
3245
  case "end":
3125
- return _context62.stop();
3246
+ return _context65.stop();
3126
3247
  }
3127
- }, _callee62);
3248
+ }, _callee65);
3128
3249
  }));
3129
3250
  return function (_x10) {
3130
- return _ref63.apply(this, arguments);
3251
+ return _ref66.apply(this, arguments);
3131
3252
  };
3132
3253
  }());
3133
- _context63.next = 10;
3254
+ _context66.next = 1;
3134
3255
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3135
- case 10:
3136
- _context63.next = 12;
3256
+ case 1:
3257
+ _context66.next = 2;
3137
3258
  return (0, _testUtil.flushPromises)(2);
3138
- case 12:
3259
+ case 2:
3139
3260
  expect(requestSpy).toBeCalled();
3140
3261
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined);
3141
3262
  call.sendCallStateMachineEvt({
@@ -3154,16 +3275,16 @@ describe('Supplementary Services tests', function () {
3154
3275
  expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3155
3276
  expect(infoSpy).toHaveBeenCalledWith("Initiating Consult transfer between : ".concat(call.getCallId(), " and ").concat(secondCall.getCallId()), transferLoggingContext);
3156
3277
  expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3157
- case 24:
3278
+ case 3:
3158
3279
  case "end":
3159
- return _context63.stop();
3280
+ return _context66.stop();
3160
3281
  }
3161
- }, _callee63);
3282
+ }, _callee66);
3162
3283
  })));
3163
- it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65() {
3284
+ it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68() {
3164
3285
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3165
- return _regenerator.default.wrap(function _callee65$(_context65) {
3166
- while (1) switch (_context65.prev = _context65.next) {
3286
+ return _regenerator.default.wrap(function (_context68) {
3287
+ while (1) switch (_context68.prev = _context68.next) {
3167
3288
  case 0:
3168
3289
  expect.assertions(10); // Updated to match actual assertion count
3169
3290
  responsePayload = {
@@ -3175,27 +3296,27 @@ describe('Supplementary Services tests', function () {
3175
3296
  infoSpy = jest.spyOn(_Logger.default, 'info');
3176
3297
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3177
3298
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3178
- var _ref65 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64(correlationId) {
3179
- return _regenerator.default.wrap(function _callee64$(_context64) {
3180
- while (1) switch (_context64.prev = _context64.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) {
3181
3302
  case 0:
3182
3303
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3183
3304
  case 1:
3184
3305
  case "end":
3185
- return _context64.stop();
3306
+ return _context67.stop();
3186
3307
  }
3187
- }, _callee64);
3308
+ }, _callee67);
3188
3309
  }));
3189
3310
  return function (_x11) {
3190
- return _ref65.apply(this, arguments);
3311
+ return _ref68.apply(this, arguments);
3191
3312
  };
3192
3313
  }());
3193
- _context65.next = 9;
3314
+ _context68.next = 1;
3194
3315
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3195
- case 9:
3196
- _context65.next = 11;
3316
+ case 1:
3317
+ _context68.next = 2;
3197
3318
  return (0, _testUtil.flushPromises)(2);
3198
- case 11:
3319
+ case 2:
3199
3320
  expect(requestSpy).toBeCalled();
3200
3321
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined);
3201
3322
  call.sendCallStateMachineEvt({
@@ -3210,16 +3331,16 @@ describe('Supplementary Services tests', function () {
3210
3331
  expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3211
3332
  expect(infoSpy).toHaveBeenCalledWith("Initiating Blind transfer with : ".concat(transfereeNumber), transferLoggingContext);
3212
3333
  expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3213
- case 21:
3334
+ case 3:
3214
3335
  case "end":
3215
- return _context65.stop();
3336
+ return _context68.stop();
3216
3337
  }
3217
- }, _callee65);
3338
+ }, _callee68);
3218
3339
  })));
3219
- it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66() {
3340
+ it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69() {
3220
3341
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3221
- return _regenerator.default.wrap(function _callee66$(_context66) {
3222
- while (1) switch (_context66.prev = _context66.next) {
3342
+ return _regenerator.default.wrap(function (_context69) {
3343
+ while (1) switch (_context69.prev = _context69.next) {
3223
3344
  case 0:
3224
3345
  responsePayload = {
3225
3346
  statusCode: 403,
@@ -3230,12 +3351,12 @@ describe('Supplementary Services tests', function () {
3230
3351
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3231
3352
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3232
3353
  call['broadworksCorrelationInfo'] = 'dummy-broadworks-correlation-info';
3233
- _context66.next = 8;
3354
+ _context69.next = 1;
3234
3355
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3235
- case 8:
3236
- _context66.next = 10;
3356
+ case 1:
3357
+ _context69.next = 2;
3237
3358
  return (0, _testUtil.flushPromises)(1);
3238
- case 10:
3359
+ case 2:
3239
3360
  expect(requestSpy).toBeCalled();
3240
3361
  /* We should be in CALL_ESTABLISHED state */
3241
3362
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -3252,16 +3373,16 @@ describe('Supplementary Services tests', function () {
3252
3373
  expect(emitSpy).toBeCalledOnceWith(_types2.CALL_EVENT_KEYS.TRANSFER_ERROR, expect.any(_Errors.CallError));
3253
3374
  expect(warnSpy).toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3254
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));
3255
- case 18:
3376
+ case 3:
3256
3377
  case "end":
3257
- return _context66.stop();
3378
+ return _context69.stop();
3258
3379
  }
3259
- }, _callee66);
3380
+ }, _callee69);
3260
3381
  })));
3261
- it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67() {
3382
+ it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
3262
3383
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3263
- return _regenerator.default.wrap(function _callee67$(_context67) {
3264
- while (1) switch (_context67.prev = _context67.next) {
3384
+ return _regenerator.default.wrap(function (_context70) {
3385
+ while (1) switch (_context70.prev = _context70.next) {
3265
3386
  case 0:
3266
3387
  responsePayload = {
3267
3388
  statusCode: 403,
@@ -3271,12 +3392,12 @@ describe('Supplementary Services tests', function () {
3271
3392
  requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3272
3393
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3273
3394
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3274
- _context67.next = 7;
3395
+ _context70.next = 1;
3275
3396
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3276
- case 7:
3277
- _context67.next = 9;
3397
+ case 1:
3398
+ _context70.next = 2;
3278
3399
  return (0, _testUtil.flushPromises)(2);
3279
- case 9:
3400
+ case 2:
3280
3401
  expect(requestSpy).toBeCalled();
3281
3402
  /* We should be in CALL_ESTABLISHED state */
3282
3403
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -3293,22 +3414,22 @@ describe('Supplementary Services tests', function () {
3293
3414
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.TRANSFER_ERROR, expect.any(_Errors.CallError));
3294
3415
  expect(warnSpy).toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3295
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));
3296
- case 18:
3417
+ case 3:
3297
3418
  case "end":
3298
- return _context67.stop();
3419
+ return _context70.stop();
3299
3420
  }
3300
- }, _callee67);
3421
+ }, _callee70);
3301
3422
  })));
3302
- it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68() {
3423
+ it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
3303
3424
  var requestSpy, warnSpy;
3304
- return _regenerator.default.wrap(function _callee68$(_context68) {
3305
- while (1) switch (_context68.prev = _context68.next) {
3425
+ return _regenerator.default.wrap(function (_context71) {
3426
+ while (1) switch (_context71.prev = _context71.next) {
3306
3427
  case 0:
3307
3428
  requestSpy = jest.spyOn(webex, 'request');
3308
3429
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3309
- _context68.next = 4;
3430
+ _context71.next = 1;
3310
3431
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
3311
- case 4:
3432
+ case 1:
3312
3433
  /* We should be in CALL_ESTABLISHED state */
3313
3434
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3314
3435
  expect(secondCall['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -3316,22 +3437,22 @@ describe('Supplementary Services tests', function () {
3316
3437
  expect(uploadLogsSpy).not.toBeCalled();
3317
3438
  expect(requestSpy).not.toBeCalled();
3318
3439
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3319
- case 10:
3440
+ case 2:
3320
3441
  case "end":
3321
- return _context68.stop();
3442
+ return _context71.stop();
3322
3443
  }
3323
- }, _callee68);
3444
+ }, _callee71);
3324
3445
  })));
3325
- it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69() {
3446
+ it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3326
3447
  var requestSpy, warnSpy;
3327
- return _regenerator.default.wrap(function _callee69$(_context69) {
3328
- while (1) switch (_context69.prev = _context69.next) {
3448
+ return _regenerator.default.wrap(function (_context72) {
3449
+ while (1) switch (_context72.prev = _context72.next) {
3329
3450
  case 0:
3330
3451
  requestSpy = jest.spyOn(webex, 'request');
3331
3452
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3332
- _context69.next = 4;
3453
+ _context72.next = 1;
3333
3454
  return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
3334
- case 4:
3455
+ case 1:
3335
3456
  /* We should be in CALL_ESTABLISHED state */
3336
3457
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3337
3458
  expect(secondCall['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
@@ -3339,11 +3460,11 @@ describe('Supplementary Services tests', function () {
3339
3460
  expect(uploadLogsSpy).not.toBeCalled();
3340
3461
  expect(requestSpy).not.toBeCalled();
3341
3462
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3342
- case 10:
3463
+ case 2:
3343
3464
  case "end":
3344
- return _context69.stop();
3465
+ return _context72.stop();
3345
3466
  }
3346
- }, _callee69);
3467
+ }, _callee72);
3347
3468
  })));
3348
3469
  });
3349
3470
  });