@webex/calling 3.11.0-webex-services-ready.1 → 3.12.0-llmrefactor.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 (260) hide show
  1. package/dist/CallHistory/CallHistory.js +68 -51
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallRecording/CallRecording.js +160 -0
  4. package/dist/CallRecording/CallRecording.js.map +1 -0
  5. package/dist/CallRecording/CallRecording.test.js +257 -0
  6. package/dist/CallRecording/CallRecording.test.js.map +1 -0
  7. package/dist/CallRecording/WxcCallRecordingConnector.js +577 -0
  8. package/dist/CallRecording/WxcCallRecordingConnector.js.map +1 -0
  9. package/dist/CallRecording/WxcCallRecordingConnector.test.js +652 -0
  10. package/dist/CallRecording/WxcCallRecordingConnector.test.js.map +1 -0
  11. package/dist/CallRecording/callRecordingFixtures.js +235 -0
  12. package/dist/CallRecording/callRecordingFixtures.js.map +1 -0
  13. package/dist/CallRecording/constants.js +50 -0
  14. package/dist/CallRecording/constants.js.map +1 -0
  15. package/dist/CallRecording/types.js +137 -0
  16. package/dist/CallRecording/types.js.map +1 -0
  17. package/dist/CallRecording/utils.js +42 -0
  18. package/dist/CallRecording/utils.js.map +1 -0
  19. package/dist/CallRecording/utils.test.js +97 -0
  20. package/dist/CallRecording/utils.test.js.map +1 -0
  21. package/dist/CallingClient/CallingClient.js +522 -195
  22. package/dist/CallingClient/CallingClient.js.map +1 -1
  23. package/dist/CallingClient/CallingClient.test.js +607 -133
  24. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  25. package/dist/CallingClient/calling/call.js +643 -462
  26. package/dist/CallingClient/calling/call.js.map +1 -1
  27. package/dist/CallingClient/calling/call.test.js +850 -453
  28. package/dist/CallingClient/calling/call.test.js.map +1 -1
  29. package/dist/CallingClient/calling/callManager.js +106 -35
  30. package/dist/CallingClient/calling/callManager.js.map +1 -1
  31. package/dist/CallingClient/calling/callManager.test.js +140 -0
  32. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  33. package/dist/CallingClient/calling/types.js +5 -0
  34. package/dist/CallingClient/calling/types.js.map +1 -1
  35. package/dist/CallingClient/constants.js +32 -3
  36. package/dist/CallingClient/constants.js.map +1 -1
  37. package/dist/CallingClient/line/index.js +4 -1
  38. package/dist/CallingClient/line/index.js.map +1 -1
  39. package/dist/CallingClient/line/line.test.js +16 -1
  40. package/dist/CallingClient/line/line.test.js.map +1 -1
  41. package/dist/CallingClient/registration/register.js +740 -407
  42. package/dist/CallingClient/registration/register.js.map +1 -1
  43. package/dist/CallingClient/registration/register.test.js +380 -58
  44. package/dist/CallingClient/registration/register.test.js.map +1 -1
  45. package/dist/CallingClient/registration/types.js.map +1 -1
  46. package/dist/CallingClient/registration/webWorker.js +41 -104
  47. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  48. package/dist/CallingClient/registration/webWorker.test.js +39 -153
  49. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  50. package/dist/CallingClient/registration/webWorkerStr.js +1 -1
  51. package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
  52. package/dist/CallingClient/types.js +7 -0
  53. package/dist/CallingClient/types.js.map +1 -1
  54. package/dist/CallingClient/utils/constants.js +58 -0
  55. package/dist/CallingClient/utils/constants.js.map +1 -0
  56. package/dist/CallingClient/utils/index.js +63 -0
  57. package/dist/CallingClient/utils/index.js.map +1 -0
  58. package/dist/CallingClient/utils/mobiusSocketMapper.js +122 -0
  59. package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -0
  60. package/dist/CallingClient/utils/mobiusSocketMapper.test.js +221 -0
  61. package/dist/CallingClient/utils/mobiusSocketMapper.test.js.map +1 -0
  62. package/dist/CallingClient/utils/request.js +435 -0
  63. package/dist/CallingClient/utils/request.js.map +1 -0
  64. package/dist/CallingClient/utils/request.test.js +999 -0
  65. package/dist/CallingClient/utils/request.test.js.map +1 -0
  66. package/dist/CallingClient/utils/types.js +7 -0
  67. package/dist/CallingClient/utils/types.js.map +1 -0
  68. package/dist/CallingClient/utils/wsFeatureFlag.js +70 -0
  69. package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -0
  70. package/dist/CallingClient/utils/wsFeatureFlag.test.js +139 -0
  71. package/dist/CallingClient/utils/wsFeatureFlag.test.js.map +1 -0
  72. package/dist/Contacts/ContactsClient.js +13 -11
  73. package/dist/Contacts/ContactsClient.js.map +1 -1
  74. package/dist/Contacts/ContactsClient.test.js +3 -8
  75. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  76. package/dist/Events/types.js +38 -11
  77. package/dist/Events/types.js.map +1 -1
  78. package/dist/Metrics/index.js +63 -2
  79. package/dist/Metrics/index.js.map +1 -1
  80. package/dist/Metrics/index.test.js +357 -1
  81. package/dist/Metrics/index.test.js.map +1 -1
  82. package/dist/Metrics/types.js +19 -1
  83. package/dist/Metrics/types.js.map +1 -1
  84. package/dist/SDKConnector/types.js.map +1 -1
  85. package/dist/api.js +56 -0
  86. package/dist/api.js.map +1 -1
  87. package/dist/common/Utils.js +159 -53
  88. package/dist/common/Utils.js.map +1 -1
  89. package/dist/common/Utils.test.js +205 -44
  90. package/dist/common/Utils.test.js.map +1 -1
  91. package/dist/common/testUtil.js +10 -5
  92. package/dist/common/testUtil.js.map +1 -1
  93. package/dist/common/types.js +3 -0
  94. package/dist/common/types.js.map +1 -1
  95. package/dist/index.js +171 -40
  96. package/dist/index.js.map +1 -1
  97. package/dist/mobius-socket/config.js +24 -0
  98. package/dist/mobius-socket/config.js.map +1 -0
  99. package/dist/mobius-socket/errors.js +143 -0
  100. package/dist/mobius-socket/errors.js.map +1 -0
  101. package/dist/mobius-socket/errors.test.js +20 -0
  102. package/dist/mobius-socket/errors.test.js.map +1 -0
  103. package/dist/mobius-socket/index.js +57 -0
  104. package/dist/mobius-socket/index.js.map +1 -0
  105. package/dist/mobius-socket/mobius-socket-events.test.js +492 -0
  106. package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -0
  107. package/dist/mobius-socket/mobius-socket.js +849 -0
  108. package/dist/mobius-socket/mobius-socket.js.map +1 -0
  109. package/dist/mobius-socket/mobius-socket.test.js +1898 -0
  110. package/dist/mobius-socket/mobius-socket.test.js.map +1 -0
  111. package/dist/mobius-socket/socket/constants.js +55 -0
  112. package/dist/mobius-socket/socket/constants.js.map +1 -0
  113. package/dist/mobius-socket/socket/index.js +15 -0
  114. package/dist/mobius-socket/socket/index.js.map +1 -0
  115. package/dist/mobius-socket/socket/socket-base.js +604 -0
  116. package/dist/mobius-socket/socket/socket-base.js.map +1 -0
  117. package/dist/mobius-socket/socket/socket.js +19 -0
  118. package/dist/mobius-socket/socket/socket.js.map +1 -0
  119. package/dist/mobius-socket/socket/socket.shim.js +26 -0
  120. package/dist/mobius-socket/socket/socket.shim.js.map +1 -0
  121. package/dist/mobius-socket/socket/types.js +7 -0
  122. package/dist/mobius-socket/socket/types.js.map +1 -0
  123. package/dist/mobius-socket/socket.test.js +727 -0
  124. package/dist/mobius-socket/socket.test.js.map +1 -0
  125. package/dist/mobius-socket/test/mocha-helpers.js +23 -0
  126. package/dist/mobius-socket/test/mocha-helpers.js.map +1 -0
  127. package/dist/mobius-socket/test/promise-tick.js +28 -0
  128. package/dist/mobius-socket/test/promise-tick.js.map +1 -0
  129. package/dist/mobius-socket/types.js +7 -0
  130. package/dist/mobius-socket/types.js.map +1 -0
  131. package/dist/module/CallHistory/CallHistory.js +28 -17
  132. package/dist/module/CallRecording/CallRecording.js +56 -0
  133. package/dist/module/CallRecording/WxcCallRecordingConnector.js +257 -0
  134. package/dist/module/CallRecording/callRecordingFixtures.js +201 -0
  135. package/dist/module/CallRecording/constants.js +28 -0
  136. package/dist/module/CallRecording/types.js +19 -0
  137. package/dist/module/CallRecording/utils.js +14 -0
  138. package/dist/module/CallingClient/CallingClient.js +166 -8
  139. package/dist/module/CallingClient/calling/call.js +201 -68
  140. package/dist/module/CallingClient/calling/callManager.js +51 -11
  141. package/dist/module/CallingClient/calling/types.js +2 -0
  142. package/dist/module/CallingClient/constants.js +27 -0
  143. package/dist/module/CallingClient/line/index.js +2 -2
  144. package/dist/module/CallingClient/registration/register.js +247 -63
  145. package/dist/module/CallingClient/registration/webWorker.js +42 -61
  146. package/dist/module/CallingClient/registration/webWorkerStr.js +47 -82
  147. package/dist/module/CallingClient/utils/constants.js +36 -0
  148. package/dist/module/CallingClient/utils/index.js +5 -0
  149. package/dist/module/CallingClient/utils/mobiusSocketMapper.js +72 -0
  150. package/dist/module/CallingClient/utils/request.js +211 -0
  151. package/dist/module/CallingClient/utils/types.js +1 -0
  152. package/dist/module/CallingClient/utils/wsFeatureFlag.js +41 -0
  153. package/dist/module/Contacts/ContactsClient.js +1 -1
  154. package/dist/module/Events/types.js +23 -10
  155. package/dist/module/Metrics/index.js +48 -1
  156. package/dist/module/Metrics/types.js +18 -0
  157. package/dist/module/api.js +3 -2
  158. package/dist/module/common/Utils.js +63 -18
  159. package/dist/module/common/testUtil.js +6 -1
  160. package/dist/module/common/types.js +3 -0
  161. package/dist/module/index.js +7 -3
  162. package/dist/module/mobius-socket/config.js +15 -0
  163. package/dist/module/mobius-socket/errors.js +58 -0
  164. package/dist/module/mobius-socket/index.js +24 -0
  165. package/dist/module/mobius-socket/mobius-socket.js +593 -0
  166. package/dist/module/mobius-socket/socket/constants.js +26 -0
  167. package/dist/module/mobius-socket/socket/index.js +4 -0
  168. package/dist/module/mobius-socket/socket/socket-base.js +368 -0
  169. package/dist/module/mobius-socket/socket/socket.js +9 -0
  170. package/dist/module/mobius-socket/socket/socket.shim.js +12 -0
  171. package/dist/module/mobius-socket/socket/types.js +1 -0
  172. package/dist/module/mobius-socket/types.js +1 -0
  173. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  174. package/dist/types/CallRecording/CallRecording.d.ts +18 -0
  175. package/dist/types/CallRecording/CallRecording.d.ts.map +1 -0
  176. package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts +23 -0
  177. package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts.map +1 -0
  178. package/dist/types/CallRecording/callRecordingFixtures.d.ts +61 -0
  179. package/dist/types/CallRecording/callRecordingFixtures.d.ts.map +1 -0
  180. package/dist/types/CallRecording/constants.d.ts +29 -0
  181. package/dist/types/CallRecording/constants.d.ts.map +1 -0
  182. package/dist/types/CallRecording/types.d.ts +176 -0
  183. package/dist/types/CallRecording/types.d.ts.map +1 -0
  184. package/dist/types/CallRecording/utils.d.ts +3 -0
  185. package/dist/types/CallRecording/utils.d.ts.map +1 -0
  186. package/dist/types/CallingClient/CallingClient.d.ts +10 -1
  187. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  188. package/dist/types/CallingClient/calling/call.d.ts +17 -3
  189. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  190. package/dist/types/CallingClient/calling/callManager.d.ts +8 -4
  191. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  192. package/dist/types/CallingClient/calling/types.d.ts +38 -9
  193. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  194. package/dist/types/CallingClient/constants.d.ts +27 -0
  195. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  196. package/dist/types/CallingClient/line/index.d.ts +1 -1
  197. package/dist/types/CallingClient/line/index.d.ts.map +1 -1
  198. package/dist/types/CallingClient/registration/register.d.ts +9 -2
  199. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  200. package/dist/types/CallingClient/registration/types.d.ts +6 -3
  201. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  202. package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
  203. package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
  204. package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
  205. package/dist/types/CallingClient/types.d.ts +6 -3
  206. package/dist/types/CallingClient/types.d.ts.map +1 -1
  207. package/dist/types/CallingClient/utils/constants.d.ts +35 -0
  208. package/dist/types/CallingClient/utils/constants.d.ts.map +1 -0
  209. package/dist/types/CallingClient/utils/index.d.ts +6 -0
  210. package/dist/types/CallingClient/utils/index.d.ts.map +1 -0
  211. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts +5 -0
  212. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -0
  213. package/dist/types/CallingClient/utils/request.d.ts +28 -0
  214. package/dist/types/CallingClient/utils/request.d.ts.map +1 -0
  215. package/dist/types/CallingClient/utils/types.d.ts +34 -0
  216. package/dist/types/CallingClient/utils/types.d.ts.map +1 -0
  217. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts +4 -0
  218. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -0
  219. package/dist/types/Events/types.d.ts +79 -15
  220. package/dist/types/Events/types.d.ts.map +1 -1
  221. package/dist/types/Metrics/index.d.ts.map +1 -1
  222. package/dist/types/Metrics/types.d.ts +19 -2
  223. package/dist/types/Metrics/types.d.ts.map +1 -1
  224. package/dist/types/SDKConnector/types.d.ts +39 -12
  225. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  226. package/dist/types/api.d.ts +6 -4
  227. package/dist/types/api.d.ts.map +1 -1
  228. package/dist/types/common/Utils.d.ts +11 -3
  229. package/dist/types/common/Utils.d.ts.map +1 -1
  230. package/dist/types/common/testUtil.d.ts +5 -1
  231. package/dist/types/common/testUtil.d.ts.map +1 -1
  232. package/dist/types/common/types.d.ts +9 -1
  233. package/dist/types/common/types.d.ts.map +1 -1
  234. package/dist/types/index.d.ts +9 -4
  235. package/dist/types/index.d.ts.map +1 -1
  236. package/dist/types/mobius-socket/config.d.ts +17 -0
  237. package/dist/types/mobius-socket/config.d.ts.map +1 -0
  238. package/dist/types/mobius-socket/errors.d.ts +32 -0
  239. package/dist/types/mobius-socket/errors.d.ts.map +1 -0
  240. package/dist/types/mobius-socket/index.d.ts +14 -0
  241. package/dist/types/mobius-socket/index.d.ts.map +1 -0
  242. package/dist/types/mobius-socket/mobius-socket.d.ts +48 -0
  243. package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -0
  244. package/dist/types/mobius-socket/socket/constants.d.ts +27 -0
  245. package/dist/types/mobius-socket/socket/constants.d.ts.map +1 -0
  246. package/dist/types/mobius-socket/socket/index.d.ts +5 -0
  247. package/dist/types/mobius-socket/socket/index.d.ts.map +1 -0
  248. package/dist/types/mobius-socket/socket/socket-base.d.ts +43 -0
  249. package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -0
  250. package/dist/types/mobius-socket/socket/socket.d.ts +6 -0
  251. package/dist/types/mobius-socket/socket/socket.d.ts.map +1 -0
  252. package/dist/types/mobius-socket/socket/socket.shim.d.ts +6 -0
  253. package/dist/types/mobius-socket/socket/socket.shim.d.ts.map +1 -0
  254. package/dist/types/mobius-socket/socket/types.d.ts +61 -0
  255. package/dist/types/mobius-socket/socket/types.d.ts.map +1 -0
  256. package/dist/types/mobius-socket/types.d.ts +21 -0
  257. package/dist/types/mobius-socket/types.d.ts.map +1 -0
  258. package/package.json +21 -5
  259. package/src/mobius-socket/socket/socket.shim.ts +22 -0
  260. package/src/mobius-socket/socket/socket.ts +14 -0
@@ -1,18 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
4
- var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
5
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+ var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
5
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
6
6
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
7
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
8
+ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
9
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
10
+ var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
7
11
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
8
12
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
9
13
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
10
14
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
11
15
  var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
12
16
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
17
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
18
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
13
19
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
14
20
  var InternalMediaCoreModule = _interopRequireWildcard(require("@webex/internal-media-core"));
15
- var _webMediaEffects = require("@webex/web-media-effects");
21
+ var _mediaHelpers = require("@webex/media-helpers");
16
22
  var _types = require("../../Errors/types");
17
23
  var _Utils = _interopRequireWildcard(require("../../common/Utils"));
18
24
  var Utils = _Utils;
@@ -27,11 +33,17 @@ var _callManager = require("./callManager");
27
33
  var _Logger = _interopRequireDefault(require("../../Logger"));
28
34
  var _Errors = require("../../Errors");
29
35
  var _constants2 = require("../../common/constants");
36
+ var _request = require("../utils/request");
30
37
  function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
31
- /* eslint-disable @typescript-eslint/no-explicit-any */
32
- /* eslint-disable dot-notation */
33
- /* eslint-disable @typescript-eslint/no-shadow */
34
-
38
+ function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
39
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable dot-notation */ /* eslint-disable @typescript-eslint/no-shadow */
40
+ jest.mock('../../mobius-socket', function () {
41
+ return {
42
+ getMobiusSocketInstance: jest.fn().mockReturnValue({
43
+ sendWssRequest: jest.fn()
44
+ })
45
+ };
46
+ });
35
47
  jest.mock('@webex/internal-media-core');
36
48
  var uploadLogsSpy = jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
37
49
  var webex = (0, _testUtil.getTestUtilsWebex)();
@@ -116,6 +128,11 @@ describe('Call Tests', function () {
116
128
  webex.request = jest.fn();
117
129
  });
118
130
  beforeEach(function () {
131
+ _request.APIRequest.resetInstance();
132
+ _request.APIRequest.getInstance({
133
+ webex: webex,
134
+ isMobiusSocketEnabled: false
135
+ });
119
136
  callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
120
137
  });
121
138
  it('create call object', function () {
@@ -428,10 +445,305 @@ describe('Call Tests', function () {
428
445
  }
429
446
  }, _callee8);
430
447
  })));
431
- it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
432
- var mockStream, localAudioStream, onStreamSpy, onEffectSpy, offStreamSpy, offEffectSpy, call, updateLocalTracksSpy, bnrMetricSpy;
448
+ it('registers and unregisters media connection listeners with stable handlers', function () {
449
+ var mockStream = {
450
+ outputStream: {
451
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
452
+ },
453
+ on: jest.fn(),
454
+ getEffectByKind: jest.fn().mockReturnValue(undefined)
455
+ };
456
+ var localAudioStream = mockStream;
457
+ var call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
458
+ call.dial(localAudioStream);
459
+ var mediaOnMock = call['mediaConnection'].on;
460
+ var mediaOffSpy = jest.spyOn(call['mediaConnection'], 'off');
461
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, expect.any(Function));
462
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_FAILURE, expect.any(Function));
463
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.REMOTE_TRACK_ADDED, expect.any(Function));
464
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, expect.any(Function));
465
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, expect.any(Function));
466
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, expect.any(Function));
467
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CANDIDATE_ERROR, expect.any(Function));
468
+ call['unregisterMediaConnectionListeners']();
469
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, expect.any(Function));
470
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_FAILURE, expect.any(Function));
471
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.REMOTE_TRACK_ADDED, expect.any(Function));
472
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, expect.any(Function));
473
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, expect.any(Function));
474
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, expect.any(Function));
475
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CANDIDATE_ERROR, expect.any(Function));
476
+ });
477
+ it('handles ICE listener payloads and submits metrics with event names', function () {
478
+ var mockStream = {
479
+ outputStream: {
480
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
481
+ },
482
+ on: jest.fn(),
483
+ getEffectByKind: jest.fn().mockReturnValue(undefined)
484
+ };
485
+ var localAudioStream = mockStream;
486
+ var call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
487
+ call.dial(localAudioStream);
488
+ var metricSpy = jest.spyOn(call['metricManager'], 'submitMediaMetric');
489
+ var warnSpy = jest.spyOn(_Logger.default, 'warn');
490
+ var getHandlerForEvent = function getHandlerForEvent(eventName) {
491
+ var _mock$calls$find;
492
+ return (_mock$calls$find = call['mediaConnection'].on.mock.calls.find(function (_ref9) {
493
+ var _ref0 = (0, _slicedToArray2.default)(_ref9, 1),
494
+ name = _ref0[0];
495
+ return name === eventName;
496
+ })) === null || _mock$calls$find === void 0 ? void 0 : _mock$calls$find[1];
497
+ };
498
+ var iceGatheringHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED);
499
+ var peerConnectionHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED);
500
+ var iceConnectionHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED);
501
+ var iceCandidateErrorHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CANDIDATE_ERROR);
502
+ iceGatheringHandler({
503
+ iceGatheringState: 'gathering'
504
+ });
505
+ peerConnectionHandler({
506
+ connectionState: 'connected'
507
+ });
508
+ iceConnectionHandler({
509
+ iceConnectionState: 'completed'
510
+ });
511
+ iceCandidateErrorHandler({
512
+ errorCode: 701,
513
+ errorText: 'STUN host lookup failed',
514
+ url: 'stun:example.org:3478'
515
+ });
516
+ expect(metricSpy).toHaveBeenNthCalledWith(1, _types4.METRIC_EVENT.MEDIA, _types4.MEDIA_CONNECTION_ACTION.ICE_GATHERING_STATE_CHANGED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined, undefined, 'gathering');
517
+ expect(metricSpy).toHaveBeenNthCalledWith(2, _types4.METRIC_EVENT.MEDIA, _types4.MEDIA_CONNECTION_ACTION.PEER_CONNECTION_STATE_CHANGED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined, undefined, 'connected');
518
+ expect(metricSpy).toHaveBeenNthCalledWith(3, _types4.METRIC_EVENT.MEDIA, _types4.MEDIA_CONNECTION_ACTION.ICE_CONNECTION_STATE_CHANGED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined, undefined, 'completed');
519
+ expect(metricSpy).toHaveBeenNthCalledWith(4, _types4.METRIC_EVENT.MEDIA_ERROR, _types4.MEDIA_CONNECTION_ACTION.ICE_CANDIDATE_ERROR, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined, undefined, undefined, expect.any(_Errors.CallError));
520
+ var mediaErrorCall = metricSpy.mock.calls[3];
521
+ expect(mediaErrorCall[mediaErrorCall.length - 1].getCallError().message).toBe('ICE candidate error occurred: {"address":null,"errorCode":701,"errorText":"STUN host lookup failed","port":null,"url":"stun:example.org:3478"}');
522
+ expect(warnSpy).toHaveBeenCalledWith('ICE candidate error occurred: {"address":null,"errorCode":701,"errorText":"STUN host lookup failed","port":null,"url":"stun:example.org:3478"}', {
523
+ file: 'call',
524
+ method: 'mediaIceEventsListener'
525
+ });
526
+ });
527
+ it('handles ROAP failure listener and submits media error metric', function () {
528
+ var _mock$calls$find2;
529
+ var mockStream = {
530
+ outputStream: {
531
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
532
+ },
533
+ on: jest.fn(),
534
+ getEffectByKind: jest.fn().mockReturnValue(undefined)
535
+ };
536
+ var localAudioStream = mockStream;
537
+ var call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
538
+ call.dial(localAudioStream);
539
+ var metricSpy = jest.spyOn(call['metricManager'], 'submitMediaMetric');
540
+ var warnSpy = jest.spyOn(_Logger.default, 'warn');
541
+ var roapFailureHandler = (_mock$calls$find2 = call['mediaConnection'].on.mock.calls.find(function (_ref1) {
542
+ var _ref10 = (0, _slicedToArray2.default)(_ref1, 1),
543
+ name = _ref10[0];
544
+ return name === InternalMediaCoreModule.MediaConnectionEventNames.ROAP_FAILURE;
545
+ })) === null || _mock$calls$find2 === void 0 ? void 0 : _mock$calls$find2[1];
546
+ var roapFailure = new Error('Failed to process remote SDP');
547
+ roapFailureHandler(roapFailure);
548
+ expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.MEDIA_ERROR, _types4.MEDIA_CONNECTION_ACTION.ROAP_FAILURE, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined, undefined, undefined, expect.any(_Errors.CallError));
549
+ var roapFailureMetricCall = metricSpy.mock.calls.find(function (_ref11) {
550
+ var _ref12 = (0, _slicedToArray2.default)(_ref11, 2),
551
+ name = _ref12[0],
552
+ metricAction = _ref12[1];
553
+ return name === _types4.METRIC_EVENT.MEDIA_ERROR && metricAction === _types4.MEDIA_CONNECTION_ACTION.ROAP_FAILURE;
554
+ });
555
+ expect(roapFailureMetricCall).toBeDefined();
556
+ expect((roapFailureMetricCall === null || roapFailureMetricCall === void 0 ? void 0 : roapFailureMetricCall[roapFailureMetricCall.length - 1]).getCallError().message).toBe('ROAP failure occurred: Failed to process remote SDP');
557
+ expect(warnSpy).toHaveBeenCalledWith('ROAP failure occurred: Failed to process remote SDP', {
558
+ file: 'call',
559
+ method: 'mediaRoapEventsListener'
560
+ });
561
+ });
562
+ it('sends connect before ROAP answer when inbound offer is delayed', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
563
+ var _mock$calls$find3;
564
+ var mockStream, localAudioStream, call, handleOutgoingCallConnectSpy, delayedOffer, sendCallStateMachineEvtSpy, sendMediaStateMachineEvtSpy, roapListener;
433
565
  return _regenerator.default.wrap(function (_context9) {
434
566
  while (1) switch (_context9.prev = _context9.next) {
567
+ case 0:
568
+ mockStream = {
569
+ outputStream: {
570
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
571
+ },
572
+ on: jest.fn(),
573
+ getEffectByKind: jest.fn().mockImplementation(function () {
574
+ return mockEffect;
575
+ })
576
+ };
577
+ localAudioStream = mockStream;
578
+ call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.INBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
579
+ webex.request.mockReturnValue({
580
+ statusCode: 200,
581
+ body: {
582
+ callId: 'mock-call-id'
583
+ }
584
+ });
585
+ call.sendCallStateMachineEvt({
586
+ type: 'E_RECV_CALL_SETUP',
587
+ data: {
588
+ seq: 1,
589
+ messageType: 'OFFER'
590
+ }
591
+ });
592
+ expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
593
+ _context9.next = 1;
594
+ return call.answer(localAudioStream);
595
+ case 1:
596
+ expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
597
+
598
+ // Connect is attempted by answer(), but is deferred because offer is not buffered yet.
599
+ handleOutgoingCallConnectSpy = jest.spyOn(call, 'handleOutgoingCallConnect');
600
+ expect(call['connectPending']).toBe(true);
601
+ expect(call['mediaConnection'].roapMessageReceived).not.toHaveBeenCalled();
602
+ delayedOffer = {
603
+ seq: 1,
604
+ messageType: 'OFFER',
605
+ sdp: 'v=0',
606
+ version: 1
607
+ };
608
+ call.sendMediaStateMachineEvt({
609
+ type: 'E_RECV_ROAP_OFFER',
610
+ data: delayedOffer
611
+ });
612
+ _context9.next = 2;
613
+ return (0, _testUtil.flushPromises)(2);
614
+ case 2:
615
+ expect(call['mediaConnection'].roapMessageReceived).toHaveBeenCalledWith(delayedOffer);
616
+ sendCallStateMachineEvtSpy = jest.spyOn(call, 'sendCallStateMachineEvt');
617
+ sendMediaStateMachineEvtSpy = jest.spyOn(call, 'sendMediaStateMachineEvt');
618
+ roapListener = (_mock$calls$find3 = call['mediaConnection'].on.mock.calls.find(function (_ref14) {
619
+ var _ref15 = (0, _slicedToArray2.default)(_ref14, 1),
620
+ eventName = _ref15[0];
621
+ return eventName === InternalMediaCoreModule.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND;
622
+ })) === null || _mock$calls$find3 === void 0 ? void 0 : _mock$calls$find3[1];
623
+ expect(roapListener).toBeDefined();
624
+ _context9.next = 3;
625
+ return roapListener({
626
+ roapMessage: {
627
+ messageType: 'ANSWER',
628
+ sdp: 'v=0',
629
+ seq: 1,
630
+ version: 2
631
+ }
632
+ });
633
+ case 3:
634
+ _context9.next = 4;
635
+ return (0, _testUtil.flushPromises)(2);
636
+ case 4:
637
+ // On ANSWER from media layer, connect is retried first, then ROAP answer is posted.
638
+ expect(sendCallStateMachineEvtSpy).toHaveBeenNthCalledWith(1, {
639
+ type: 'E_SEND_CALL_CONNECT'
640
+ });
641
+ expect(sendMediaStateMachineEvtSpy).toHaveBeenNthCalledWith(1, {
642
+ type: 'E_SEND_ROAP_ANSWER',
643
+ data: expect.objectContaining({
644
+ messageType: 'ANSWER'
645
+ })
646
+ });
647
+ expect(handleOutgoingCallConnectSpy).toHaveBeenCalled();
648
+ expect(call['mediaConnection'].roapMessageReceived).toHaveBeenLastCalledWith(delayedOffer);
649
+ expect(call['connectPending']).toBe(false);
650
+ case 5:
651
+ case "end":
652
+ return _context9.stop();
653
+ }
654
+ }, _callee9);
655
+ })));
656
+ var iceLiteOfferSdp = 'v=0\r\no=- 0 0 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n' + 'a=ice-lite\r\nm=audio 19564 UDP/TLS/RTP/SAVPF 0\r\na=sendrecv\r\n';
657
+ var fullIceOfferSdp = 'v=0\r\no=- 0 0 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n' + 'm=audio 19564 UDP/TLS/RTP/SAVPF 0\r\na=sendrecv\r\na=ice-ufrag:mLbW\r\n';
658
+ describe.each([{
659
+ name: 'reduced timeout when the offer is ice-lite and reduceTimeoutForIceLite is enabled',
660
+ sdp: iceLiteOfferSdp,
661
+ iceGatheringConfig: {
662
+ reduceTimeoutForIceLite: true
663
+ },
664
+ expectedTimeout: _constants.ICE_LITE_CANDIDATES_TIMEOUT
665
+ }, {
666
+ name: 'custom reduced timeout when the offer is ice-lite and iceLiteTimeout is overridden',
667
+ sdp: iceLiteOfferSdp,
668
+ iceGatheringConfig: {
669
+ reduceTimeoutForIceLite: true,
670
+ iceLiteTimeout: 750
671
+ },
672
+ expectedTimeout: 750
673
+ }, {
674
+ name: 'default timeout when the offer is ice-lite but reduceTimeoutForIceLite is disabled',
675
+ sdp: iceLiteOfferSdp,
676
+ iceGatheringConfig: {
677
+ reduceTimeoutForIceLite: false
678
+ },
679
+ expectedTimeout: _constants.ICE_CANDIDATES_TIMEOUT
680
+ }, {
681
+ name: 'default timeout when the offer is ice-lite but no iceGathering config is provided',
682
+ sdp: iceLiteOfferSdp,
683
+ iceGatheringConfig: undefined,
684
+ expectedTimeout: _constants.ICE_CANDIDATES_TIMEOUT
685
+ }, {
686
+ name: 'default timeout when reduceTimeoutForIceLite is enabled but the offer is not ice-lite',
687
+ sdp: fullIceOfferSdp,
688
+ iceGatheringConfig: {
689
+ reduceTimeoutForIceLite: true
690
+ },
691
+ expectedTimeout: _constants.ICE_CANDIDATES_TIMEOUT
692
+ }])('ICE candidates timeout selection', function (_ref16) {
693
+ var name = _ref16.name,
694
+ sdp = _ref16.sdp,
695
+ iceGatheringConfig = _ref16.iceGatheringConfig,
696
+ expectedTimeout = _ref16.expectedTimeout;
697
+ it("uses ".concat(name), /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
698
+ var mockStream, localAudioStream, call;
699
+ return _regenerator.default.wrap(function (_context0) {
700
+ while (1) switch (_context0.prev = _context0.next) {
701
+ case 0:
702
+ mockStream = {
703
+ outputStream: {
704
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
705
+ },
706
+ on: jest.fn(),
707
+ getEffectByKind: jest.fn().mockImplementation(function () {
708
+ return mockEffect;
709
+ })
710
+ };
711
+ localAudioStream = mockStream;
712
+ call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.INBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest, iceGatheringConfig);
713
+ webex.request.mockReturnValue({
714
+ statusCode: 200,
715
+ body: {
716
+ callId: 'mock-call-id'
717
+ }
718
+ });
719
+
720
+ /* Buffer the remote offer before answering so it is available at media connection init. */
721
+ call.sendMediaStateMachineEvt({
722
+ type: 'E_RECV_ROAP_OFFER',
723
+ data: {
724
+ seq: 1,
725
+ messageType: 'OFFER',
726
+ version: 1,
727
+ sdp: sdp
728
+ }
729
+ });
730
+ _context0.next = 1;
731
+ return call.answer(localAudioStream);
732
+ case 1:
733
+ expect(mockInternalMediaCoreModule.RoapMediaConnection).toBeCalledOnceWith(_objectSpread(_objectSpread({}, roapMediaConnectionConfig), {}, {
734
+ iceCandidatesTimeout: expectedTimeout
735
+ }), roapMediaConnectionOptions, expect.any(String), expect.any(Function), expect.any(Function), expect.any(Function));
736
+ case 2:
737
+ case "end":
738
+ return _context0.stop();
739
+ }
740
+ }, _callee0);
741
+ })));
742
+ });
743
+ it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
744
+ var mockStream, localAudioStream, onStreamSpy, onEffectSpy, offStreamSpy, offEffectSpy, call, updateLocalTracksSpy, bnrMetricSpy;
745
+ return _regenerator.default.wrap(function (_context1) {
746
+ while (1) switch (_context1.prev = _context1.next) {
435
747
  case 0:
436
748
  mockStream = {
437
749
  outputStream: {
@@ -463,8 +775,8 @@ describe('Call Tests', function () {
463
775
  bnrMetricSpy.mockClear();
464
776
  /* Invoking the callback function to trigger EffectAdded event to simulate adding effect to the stream */
465
777
  onStreamSpy.mock.calls[1][1](mockEffect);
466
- expect(onEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Enabled, expect.any(Function));
467
- expect(onEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Disabled, expect.any(Function));
778
+ expect(onEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Enabled, expect.any(Function));
779
+ expect(onEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Disabled, expect.any(Function));
468
780
 
469
781
  /* Send Enabled event on the effect, update track and send metrics for BNR disabled */
470
782
  onStreamSpy.mock.calls[0][1](mockTrack);
@@ -487,25 +799,43 @@ describe('Call Tests', function () {
487
799
  });
488
800
  expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_DISABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
489
801
  call.end();
490
- _context9.next = 1;
802
+ _context1.next = 1;
491
803
  return (0, _Utils.waitForMsecs)(50);
492
804
  case 1:
493
805
  /* Checks for switching off the listeners on call disconnect */
494
806
  expect(offStreamSpy).toBeCalledTimes(2);
495
807
  expect(offStreamSpy).toBeCalledWith(InternalMediaCoreModule.LocalStreamEventNames.OutputTrackChange, expect.any(Function));
496
808
  expect(offStreamSpy).toBeCalledWith(InternalMediaCoreModule.LocalStreamEventNames.EffectAdded, expect.any(Function));
497
- expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Enabled, expect.any(Function));
498
- expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Disabled, expect.any(Function));
809
+ expect(offEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Enabled, expect.any(Function));
810
+ expect(offEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Disabled, expect.any(Function));
499
811
  case 2:
500
812
  case "end":
501
- return _context9.stop();
813
+ return _context1.stop();
502
814
  }
503
- }, _callee9);
815
+ }, _callee1);
504
816
  })));
505
- it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
817
+ it('does not register effect listeners when the added effect cannot be resolved', function () {
818
+ var mockStream = {
819
+ outputStream: {
820
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
821
+ },
822
+ on: jest.fn(),
823
+ getEffectByKind: jest.fn().mockReturnValue(undefined)
824
+ };
825
+ var localAudioStream = mockStream;
826
+ var onStreamSpy = jest.spyOn(localAudioStream, 'on');
827
+ var onEffectSpy = jest.spyOn(mockEffect, 'on');
828
+ var call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
829
+ call.dial(localAudioStream);
830
+ expect(function () {
831
+ return onStreamSpy.mock.calls[1][1](undefined);
832
+ }).not.toThrow();
833
+ expect(onEffectSpy).not.toHaveBeenCalled();
834
+ });
835
+ it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
506
836
  var mockStream, localAudioStream, warnSpy, call;
507
- return _regenerator.default.wrap(function (_context0) {
508
- while (1) switch (_context0.prev = _context0.next) {
837
+ return _regenerator.default.wrap(function (_context10) {
838
+ while (1) switch (_context10.prev = _context10.next) {
509
839
  case 0:
510
840
  mockStream = {
511
841
  outputStream: {
@@ -529,7 +859,7 @@ describe('Call Tests', function () {
529
859
  warnSpy = jest.spyOn(_Logger.default, 'warn');
530
860
  call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
531
861
  call.answer(localAudioStream);
532
- _context0.next = 1;
862
+ _context10.next = 1;
533
863
  return (0, _Utils.waitForMsecs)(50);
534
864
  case 1:
535
865
  expect(warnSpy).toBeCalledTimes(2);
@@ -544,14 +874,14 @@ describe('Call Tests', function () {
544
874
  expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
545
875
  case 2:
546
876
  case "end":
547
- return _context0.stop();
877
+ return _context10.stop();
548
878
  }
549
- }, _callee0);
879
+ }, _callee10);
550
880
  })));
551
- it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
881
+ it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
552
882
  var mockStream, localAudioStream, warnSpy, call;
553
- return _regenerator.default.wrap(function (_context1) {
554
- while (1) switch (_context1.prev = _context1.next) {
883
+ return _regenerator.default.wrap(function (_context11) {
884
+ while (1) switch (_context11.prev = _context11.next) {
555
885
  case 0:
556
886
  mockStream = {
557
887
  outputStream: {
@@ -563,7 +893,7 @@ describe('Call Tests', function () {
563
893
  warnSpy = jest.spyOn(_Logger.default, 'warn');
564
894
  call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
565
895
  call.dial(localAudioStream);
566
- _context1.next = 1;
896
+ _context11.next = 1;
567
897
  return (0, _Utils.waitForMsecs)(50);
568
898
  case 1:
569
899
  expect(warnSpy).toBeCalledTimes(1);
@@ -576,9 +906,9 @@ describe('Call Tests', function () {
576
906
  expect(webex.request).not.toBeCalledOnceWith();
577
907
  case 2:
578
908
  case "end":
579
- return _context1.stop();
909
+ return _context11.stop();
580
910
  }
581
- }, _callee1);
911
+ }, _callee11);
582
912
  })));
583
913
  it('update media after call creation with valid stream', function () {
584
914
  var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
@@ -652,10 +982,10 @@ describe('Call Tests', function () {
652
982
  method: 'dial'
653
983
  });
654
984
  });
655
- it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
985
+ it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
656
986
  var logSpy, callManager, mockStream, localAudioStream, call;
657
- return _regenerator.default.wrap(function (_context10) {
658
- while (1) switch (_context10.prev = _context10.next) {
987
+ return _regenerator.default.wrap(function (_context12) {
988
+ while (1) switch (_context12.prev = _context12.next) {
659
989
  case 0:
660
990
  logSpy = jest.spyOn(_Logger.default, 'info');
661
991
  webex.request.mockReturnValue({
@@ -731,9 +1061,9 @@ describe('Call Tests', function () {
731
1061
  expect(mockStream.setUserMuted).toBeCalledOnceWith(false);
732
1062
  case 1:
733
1063
  case "end":
734
- return _context10.stop();
1064
+ return _context12.stop();
735
1065
  }
736
- }, _callee10);
1066
+ }, _callee12);
737
1067
  })));
738
1068
  describe('Guest Calling Flow Tests', function () {
739
1069
  var dummyEvent = {
@@ -741,10 +1071,10 @@ describe('Call Tests', function () {
741
1071
  data: undefined
742
1072
  };
743
1073
  var call;
744
- it('outgoing call without guest calling must have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
1074
+ it('outgoing call without guest calling must have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
745
1075
  var requestSpy, requestArgs;
746
- return _regenerator.default.wrap(function (_context11) {
747
- while (1) switch (_context11.prev = _context11.next) {
1076
+ return _regenerator.default.wrap(function (_context13) {
1077
+ while (1) switch (_context13.prev = _context13.next) {
748
1078
  case 0:
749
1079
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
750
1080
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -757,14 +1087,14 @@ describe('Call Tests', function () {
757
1087
  expect('callee' in requestArgs.body).toBe(true);
758
1088
  case 1:
759
1089
  case "end":
760
- return _context11.stop();
1090
+ return _context13.stop();
761
1091
  }
762
- }, _callee11);
1092
+ }, _callee13);
763
1093
  })));
764
- it('outgoing call for guest calling must not have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
1094
+ it('outgoing call for guest calling must not have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
765
1095
  var requestSpy, requestArgs;
766
- return _regenerator.default.wrap(function (_context12) {
767
- while (1) switch (_context12.prev = _context12.next) {
1096
+ return _regenerator.default.wrap(function (_context14) {
1097
+ while (1) switch (_context14.prev = _context14.next) {
768
1098
  case 0:
769
1099
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
770
1100
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -777,9 +1107,9 @@ describe('Call Tests', function () {
777
1107
  expect('callee' in requestArgs.body).toBe(false);
778
1108
  case 1:
779
1109
  case "end":
780
- return _context12.stop();
1110
+ return _context14.stop();
781
1111
  }
782
- }, _callee12);
1112
+ }, _callee14);
783
1113
  })));
784
1114
  });
785
1115
  });
@@ -799,6 +1129,11 @@ describe('State Machine handler tests', function () {
799
1129
  var call;
800
1130
  var dtmfMock;
801
1131
  beforeEach(function () {
1132
+ _request.APIRequest.resetInstance();
1133
+ _request.APIRequest.getInstance({
1134
+ webex: webex,
1135
+ isMobiusSocketEnabled: false
1136
+ });
802
1137
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
803
1138
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
804
1139
  var dummy = 10;
@@ -812,10 +1147,10 @@ describe('State Machine handler tests', function () {
812
1147
 
813
1148
  // afterEach(() => call.removeAllListeners());
814
1149
 
815
- it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
1150
+ it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
816
1151
  var statusPayload, dummyEvent, funcSpy, logSpy;
817
- return _regenerator.default.wrap(function (_context13) {
818
- while (1) switch (_context13.prev = _context13.next) {
1152
+ return _regenerator.default.wrap(function (_context15) {
1153
+ while (1) switch (_context15.prev = _context15.next) {
819
1154
  case 0:
820
1155
  statusPayload = {
821
1156
  statusCode: 200,
@@ -835,7 +1170,7 @@ describe('State Machine handler tests', function () {
835
1170
  /* This is to flush all the promises from the Promise queue so that
836
1171
  * Jest.fakeTimers can advance time and also clear the promise Queue
837
1172
  */
838
- _context13.next = 1;
1173
+ _context15.next = 1;
839
1174
  return (0, _testUtil.flushPromises)(3);
840
1175
  case 1:
841
1176
  expect(setInterval).toHaveBeenCalledTimes(1);
@@ -851,14 +1186,14 @@ describe('State Machine handler tests', function () {
851
1186
  });
852
1187
  case 2:
853
1188
  case "end":
854
- return _context13.stop();
1189
+ return _context15.stop();
855
1190
  }
856
- }, _callee13);
1191
+ }, _callee15);
857
1192
  })));
858
- it('session refresh 401 emits token error and ends the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
1193
+ it('session refresh 401 emits token error and ends the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
859
1194
  var statusPayload, emitSpy, funcSpy;
860
- return _regenerator.default.wrap(function (_context14) {
861
- while (1) switch (_context14.prev = _context14.next) {
1195
+ return _regenerator.default.wrap(function (_context16) {
1196
+ while (1) switch (_context16.prev = _context16.next) {
862
1197
  case 0:
863
1198
  expect.assertions(4);
864
1199
  statusPayload = {
@@ -873,25 +1208,27 @@ describe('State Machine handler tests', function () {
873
1208
  funcSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(statusPayload);
874
1209
  call['handleCallEstablished']({});
875
1210
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
876
- _context14.next = 1;
1211
+ _context16.next = 1;
877
1212
  return _promise.default.resolve();
878
1213
  case 1:
879
- _context14.next = 2;
1214
+ _context16.next = 2;
880
1215
  return _promise.default.resolve();
881
1216
  case 2:
882
- expect(clearInterval).toHaveBeenCalledTimes(1);
1217
+ // clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
1218
+ // and once in handleCallKeepaliveError when clearing timer due to error
1219
+ expect(clearInterval).toHaveBeenCalledTimes(2);
883
1220
  expect(funcSpy).toBeCalledTimes(1);
884
1221
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
885
1222
  case 3:
886
1223
  case "end":
887
- return _context14.stop();
1224
+ return _context16.stop();
888
1225
  }
889
- }, _callee14);
1226
+ }, _callee16);
890
1227
  })));
891
- it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
1228
+ it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
892
1229
  var statusPayload, funcSpy;
893
- return _regenerator.default.wrap(function (_context15) {
894
- while (1) switch (_context15.prev = _context15.next) {
1230
+ return _regenerator.default.wrap(function (_context17) {
1231
+ while (1) switch (_context17.prev = _context17.next) {
895
1232
  case 0:
896
1233
  expect.assertions(4);
897
1234
  statusPayload = {
@@ -910,21 +1247,23 @@ describe('State Machine handler tests', function () {
910
1247
  /* This is to flush all the promises from the Promise queue so that
911
1248
  * Jest.fakeTimers can advance time and also clear the promise Queue
912
1249
  */
913
- _context15.next = 1;
1250
+ _context17.next = 1;
914
1251
  return (0, _testUtil.flushPromises)(2);
915
1252
  case 1:
916
- expect(clearInterval).toHaveBeenCalledTimes(1);
1253
+ // clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
1254
+ // and once in handleCallKeepaliveError when clearing timer due to error
1255
+ expect(clearInterval).toHaveBeenCalledTimes(2);
917
1256
  expect(funcSpy).toBeCalledTimes(1);
918
1257
  case 2:
919
1258
  case "end":
920
- return _context15.stop();
1259
+ return _context17.stop();
921
1260
  }
922
- }, _callee15);
1261
+ }, _callee17);
923
1262
  })));
924
- it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
1263
+ it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
925
1264
  var errorPayload, okPayload, scheduleKeepaliveSpy, postStatusSpy;
926
- return _regenerator.default.wrap(function (_context16) {
927
- while (1) switch (_context16.prev = _context16.next) {
1265
+ return _regenerator.default.wrap(function (_context18) {
1266
+ while (1) switch (_context18.prev = _context18.next) {
928
1267
  case 0:
929
1268
  errorPayload = {
930
1269
  statusCode: 500,
@@ -942,28 +1281,63 @@ describe('State Machine handler tests', function () {
942
1281
  call['handleCallEstablished']({});
943
1282
  }
944
1283
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
945
- _context16.next = 1;
1284
+ _context18.next = 1;
946
1285
  return (0, _testUtil.flushPromises)(2);
947
1286
  case 1:
948
1287
  expect(postStatusSpy).toHaveBeenCalledTimes(1);
949
1288
 
950
1289
  // Now advance by 1 second for the retry-after interval
951
1290
  jest.advanceTimersByTime(1000);
952
- _context16.next = 2;
1291
+ _context18.next = 2;
953
1292
  return (0, _testUtil.flushPromises)(2);
954
1293
  case 2:
955
1294
  expect(postStatusSpy).toHaveBeenCalledTimes(2);
956
1295
  expect(scheduleKeepaliveSpy).toHaveBeenCalledTimes(2);
957
1296
  case 3:
958
1297
  case "end":
959
- return _context16.stop();
1298
+ return _context18.stop();
960
1299
  }
961
- }, _callee16);
1300
+ }, _callee18);
1301
+ })));
1302
+ it('scheduleCallKeepaliveInterval clears existing interval before creating new one', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1303
+ var firstTimer, secondTimer;
1304
+ return _regenerator.default.wrap(function (_context19) {
1305
+ while (1) switch (_context19.prev = _context19.next) {
1306
+ case 0:
1307
+ jest.spyOn(global, 'setInterval');
1308
+ jest.spyOn(global, 'clearInterval');
1309
+
1310
+ // Setup the first keepalive interval
1311
+ call['handleCallEstablished']({});
1312
+
1313
+ // At this point, scheduleCallKeepaliveInterval was called once
1314
+ // It should have called clearInterval once (at the start) and setInterval once
1315
+ expect(clearInterval).toHaveBeenCalledTimes(1);
1316
+ expect(setInterval).toHaveBeenCalledTimes(1);
1317
+ firstTimer = call['sessionTimer'];
1318
+ expect(firstTimer).toBeDefined();
1319
+
1320
+ // Manually call scheduleCallKeepaliveInterval again to simulate a retry scenario
1321
+ call['scheduleCallKeepaliveInterval']();
1322
+
1323
+ // clearInterval should have been called again to clear the previous timer
1324
+ expect(clearInterval).toHaveBeenCalledTimes(2);
1325
+ // A new interval should have been created
1326
+ expect(setInterval).toHaveBeenCalledTimes(2);
1327
+
1328
+ // The sessionTimer should be different (new timer)
1329
+ secondTimer = call['sessionTimer'];
1330
+ expect(secondTimer).toBeDefined();
1331
+ case 1:
1332
+ case "end":
1333
+ return _context19.stop();
1334
+ }
1335
+ }, _callee19);
962
1336
  })));
963
- it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
1337
+ it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
964
1338
  var errorPayload, warnSpy, postStatusSpy;
965
- return _regenerator.default.wrap(function (_context17) {
966
- while (1) switch (_context17.prev = _context17.next) {
1339
+ return _regenerator.default.wrap(function (_context20) {
1340
+ while (1) switch (_context20.prev = _context20.next) {
967
1341
  case 0:
968
1342
  errorPayload = {
969
1343
  statusCode: 500,
@@ -982,25 +1356,25 @@ describe('State Machine handler tests', function () {
982
1356
 
983
1357
  // Advance timer to trigger the first failure (uses DEFAULT_SESSION_TIMER)
984
1358
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
985
- _context17.next = 1;
1359
+ _context20.next = 1;
986
1360
  return (0, _testUtil.flushPromises)(2);
987
1361
  case 1:
988
1362
  // Now advance by 1 second for each of the 4 retry attempts (retry-after: 1 second each)
989
1363
  // Need to do this separately to allow state machine to process and create new intervals
990
1364
  jest.advanceTimersByTime(1000);
991
- _context17.next = 2;
1365
+ _context20.next = 2;
992
1366
  return (0, _testUtil.flushPromises)(2);
993
1367
  case 2:
994
1368
  jest.advanceTimersByTime(1000);
995
- _context17.next = 3;
1369
+ _context20.next = 3;
996
1370
  return (0, _testUtil.flushPromises)(2);
997
1371
  case 3:
998
1372
  jest.advanceTimersByTime(1000);
999
- _context17.next = 4;
1373
+ _context20.next = 4;
1000
1374
  return (0, _testUtil.flushPromises)(2);
1001
1375
  case 4:
1002
1376
  jest.advanceTimersByTime(1000);
1003
- _context17.next = 5;
1377
+ _context20.next = 5;
1004
1378
  return (0, _testUtil.flushPromises)(2);
1005
1379
  case 5:
1006
1380
  // The error handler should detect we're at max retry count and stop
@@ -1012,14 +1386,14 @@ describe('State Machine handler tests', function () {
1012
1386
  expect(call['callKeepaliveRetryCount']).toBe(4);
1013
1387
  case 6:
1014
1388
  case "end":
1015
- return _context17.stop();
1389
+ return _context20.stop();
1016
1390
  }
1017
- }, _callee17);
1391
+ }, _callee20);
1018
1392
  })));
1019
- it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
1393
+ it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1020
1394
  var statusPayload, dummyEvent, postMediaSpy, deleteSpy, dummyOkEvent;
1021
- return _regenerator.default.wrap(function (_context18) {
1022
- while (1) switch (_context18.prev = _context18.next) {
1395
+ return _regenerator.default.wrap(function (_context21) {
1396
+ while (1) switch (_context21.prev = _context21.next) {
1023
1397
  case 0:
1024
1398
  statusPayload = {
1025
1399
  statusCode: 200,
@@ -1075,14 +1449,14 @@ describe('State Machine handler tests', function () {
1075
1449
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1076
1450
  case 1:
1077
1451
  case "end":
1078
- return _context18.stop();
1452
+ return _context21.stop();
1079
1453
  }
1080
- }, _callee18);
1454
+ }, _callee21);
1081
1455
  })));
1082
- it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1456
+ it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1083
1457
  var statusPayload, dummyEvent;
1084
- return _regenerator.default.wrap(function (_context19) {
1085
- while (1) switch (_context19.prev = _context19.next) {
1458
+ return _regenerator.default.wrap(function (_context22) {
1459
+ while (1) switch (_context22.prev = _context22.next) {
1086
1460
  case 0:
1087
1461
  call['direction'] = _types3.CallDirection.INBOUND;
1088
1462
  statusPayload = {
@@ -1100,7 +1474,7 @@ describe('State Machine handler tests', function () {
1100
1474
  webex.request.mockReturnValue(statusPayload);
1101
1475
  call.sendCallStateMachineEvt(dummyEvent);
1102
1476
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
1103
- _context19.next = 1;
1477
+ _context22.next = 1;
1104
1478
  return call['handleOutgoingCallConnect']({
1105
1479
  type: 'E_SEND_CALL_CONNECT'
1106
1480
  });
@@ -1114,14 +1488,14 @@ describe('State Machine handler tests', function () {
1114
1488
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1115
1489
  case 2:
1116
1490
  case "end":
1117
- return _context19.stop();
1491
+ return _context22.stop();
1118
1492
  }
1119
- }, _callee19);
1493
+ }, _callee22);
1120
1494
  })));
1121
- it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1495
+ it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1122
1496
  var callManager, statusPayload, call, dummyEvent, dummyOkEvent, emitSpy, startCallerIdSpy, mobiusProgressEvent;
1123
- return _regenerator.default.wrap(function (_context20) {
1124
- while (1) switch (_context20.prev = _context20.next) {
1497
+ return _regenerator.default.wrap(function (_context23) {
1498
+ while (1) switch (_context23.prev = _context23.next) {
1125
1499
  case 0:
1126
1500
  callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
1127
1501
  statusPayload = {
@@ -1215,14 +1589,14 @@ describe('State Machine handler tests', function () {
1215
1589
  expect(call.earlyMedia).not.toBe(true);
1216
1590
  case 1:
1217
1591
  case "end":
1218
- return _context20.stop();
1592
+ return _context23.stop();
1219
1593
  }
1220
- }, _callee20);
1594
+ }, _callee23);
1221
1595
  })));
1222
- it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1596
+ it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
1223
1597
  var warnSpy, errorSpy, stateMachineSpy, statusPayload, roapMessage;
1224
- return _regenerator.default.wrap(function (_context21) {
1225
- while (1) switch (_context21.prev = _context21.next) {
1598
+ return _regenerator.default.wrap(function (_context24) {
1599
+ while (1) switch (_context24.prev = _context24.next) {
1226
1600
  case 0:
1227
1601
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1228
1602
  errorSpy = jest.spyOn(_Logger.default, 'error');
@@ -1249,7 +1623,7 @@ describe('State Machine handler tests', function () {
1249
1623
  webex.request.mockRejectedValueOnce({
1250
1624
  statusCode: 403
1251
1625
  }).mockResolvedValue(statusPayload);
1252
- _context21.next = 1;
1626
+ _context24.next = 1;
1253
1627
  return call['handleOutgoingCallConnect']({
1254
1628
  type: 'E_SEND_CALL_CONNECT'
1255
1629
  });
@@ -1260,14 +1634,14 @@ describe('State Machine handler tests', function () {
1260
1634
  expect(errorSpy).toBeCalledTimes(1);
1261
1635
  case 2:
1262
1636
  case "end":
1263
- return _context21.stop();
1637
+ return _context24.stop();
1264
1638
  }
1265
- }, _callee21);
1639
+ }, _callee24);
1266
1640
  })));
1267
- it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1641
+ it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
1268
1642
  var statusPayload, dummyEvent, postMediaSpy, logSpy, dummyOkEvent;
1269
- return _regenerator.default.wrap(function (_context22) {
1270
- while (1) switch (_context22.prev = _context22.next) {
1643
+ return _regenerator.default.wrap(function (_context25) {
1644
+ while (1) switch (_context25.prev = _context25.next) {
1271
1645
  case 0:
1272
1646
  statusPayload = {
1273
1647
  statusCode: 200,
@@ -1343,14 +1717,14 @@ describe('State Machine handler tests', function () {
1343
1717
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1344
1718
  case 1:
1345
1719
  case "end":
1346
- return _context22.stop();
1720
+ return _context25.stop();
1347
1721
  }
1348
- }, _callee22);
1722
+ }, _callee25);
1349
1723
  })));
1350
- it('outgoing call where we receive connect directly after setup. Media established before connect. test call and media state changes', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1724
+ 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 _callee26() {
1351
1725
  var statusPayload, dummySetupEvent, dummyConnectEvent, dummyOfferEvent, dummyAnswerEvent, dummyOkEvent, postMediaSpy;
1352
- return _regenerator.default.wrap(function (_context23) {
1353
- while (1) switch (_context23.prev = _context23.next) {
1726
+ return _regenerator.default.wrap(function (_context26) {
1727
+ while (1) switch (_context26.prev = _context26.next) {
1354
1728
  case 0:
1355
1729
  statusPayload = {
1356
1730
  statusCode: 200,
@@ -1418,14 +1792,14 @@ describe('State Machine handler tests', function () {
1418
1792
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1419
1793
  case 1:
1420
1794
  case "end":
1421
- return _context23.stop();
1795
+ return _context26.stop();
1422
1796
  }
1423
- }, _callee23);
1797
+ }, _callee26);
1424
1798
  })));
1425
- it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
1799
+ it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1426
1800
  var statusPayload, dummyEvent;
1427
- return _regenerator.default.wrap(function (_context24) {
1428
- while (1) switch (_context24.prev = _context24.next) {
1801
+ return _regenerator.default.wrap(function (_context27) {
1802
+ while (1) switch (_context27.prev = _context27.next) {
1429
1803
  case 0:
1430
1804
  statusPayload = {
1431
1805
  statusCode: 200,
@@ -1464,14 +1838,14 @@ describe('State Machine handler tests', function () {
1464
1838
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1465
1839
  case 1:
1466
1840
  case "end":
1467
- return _context24.stop();
1841
+ return _context27.stop();
1468
1842
  }
1469
- }, _callee24);
1843
+ }, _callee27);
1470
1844
  })));
1471
- it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
1845
+ it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
1472
1846
  var statusPayload, dummyEvent, errorSpy;
1473
- return _regenerator.default.wrap(function (_context25) {
1474
- while (1) switch (_context25.prev = _context25.next) {
1847
+ return _regenerator.default.wrap(function (_context28) {
1848
+ while (1) switch (_context28.prev = _context28.next) {
1475
1849
  case 0:
1476
1850
  statusPayload = {
1477
1851
  statusCode: 403,
@@ -1488,25 +1862,31 @@ describe('State Machine handler tests', function () {
1488
1862
  webex.request.mockRejectedValueOnce(statusPayload);
1489
1863
  errorSpy = jest.spyOn(_Logger.default, 'error');
1490
1864
  call.sendCallStateMachineEvt(dummyEvent);
1491
- _context25.next = 1;
1865
+ _context28.next = 1;
1492
1866
  return (0, _testUtil.flushPromises)(3);
1493
1867
  case 1:
1868
+ _context28.next = 2;
1869
+ return _promise.default.resolve();
1870
+ case 2:
1871
+ _context28.next = 3;
1872
+ return _promise.default.resolve();
1873
+ case 3:
1494
1874
  expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
1495
1875
  expect(errorSpy).toHaveBeenCalled();
1496
1876
  expect(uploadLogsSpy).toHaveBeenCalledWith({
1497
1877
  correlationId: call.getCorrelationId(),
1498
1878
  callId: call.getCallId()
1499
1879
  });
1500
- case 2:
1880
+ case 4:
1501
1881
  case "end":
1502
- return _context25.stop();
1882
+ return _context28.stop();
1503
1883
  }
1504
- }, _callee25);
1884
+ }, _callee28);
1505
1885
  })));
1506
- it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1886
+ it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
1507
1887
  var statusPayload, dummyEvent, warnSpy;
1508
- return _regenerator.default.wrap(function (_context26) {
1509
- while (1) switch (_context26.prev = _context26.next) {
1888
+ return _regenerator.default.wrap(function (_context29) {
1889
+ while (1) switch (_context29.prev = _context29.next) {
1510
1890
  case 0:
1511
1891
  statusPayload = {
1512
1892
  statusCode: 403,
@@ -1525,12 +1905,18 @@ describe('State Machine handler tests', function () {
1525
1905
  webex.request.mockRejectedValue(statusPayload);
1526
1906
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1527
1907
  jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
1528
- _context26.next = 1;
1908
+ _context29.next = 1;
1529
1909
  return call['handleRoapEstablished']({}, dummyEvent);
1530
1910
  case 1:
1531
- _context26.next = 2;
1911
+ _context29.next = 2;
1532
1912
  return (0, _testUtil.flushPromises)(2);
1533
1913
  case 2:
1914
+ _context29.next = 3;
1915
+ return _promise.default.resolve();
1916
+ case 3:
1917
+ _context29.next = 4;
1918
+ return _promise.default.resolve();
1919
+ case 4:
1534
1920
  expect(call.isConnected()).toBe(false);
1535
1921
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1536
1922
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
@@ -1542,16 +1928,16 @@ describe('State Machine handler tests', function () {
1542
1928
  file: 'call',
1543
1929
  method: 'handleRoapError'
1544
1930
  });
1545
- case 3:
1931
+ case 5:
1546
1932
  case "end":
1547
- return _context26.stop();
1933
+ return _context29.stop();
1548
1934
  }
1549
- }, _callee26);
1935
+ }, _callee29);
1550
1936
  })));
1551
- it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1937
+ it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
1552
1938
  var statusPayload, dummyEvent;
1553
- return _regenerator.default.wrap(function (_context27) {
1554
- while (1) switch (_context27.prev = _context27.next) {
1939
+ return _regenerator.default.wrap(function (_context30) {
1940
+ while (1) switch (_context30.prev = _context30.next) {
1555
1941
  case 0:
1556
1942
  statusPayload = {
1557
1943
  statusCode: 403,
@@ -1574,14 +1960,14 @@ describe('State Machine handler tests', function () {
1574
1960
  expect(_testUtil.mediaConnection.initiateOffer).toBeCalledOnceWith();
1575
1961
  case 1:
1576
1962
  case "end":
1577
- return _context27.stop();
1963
+ return _context30.stop();
1578
1964
  }
1579
- }, _callee27);
1965
+ }, _callee30);
1580
1966
  })));
1581
- it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
1967
+ it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1582
1968
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1583
- return _regenerator.default.wrap(function (_context28) {
1584
- while (1) switch (_context28.prev = _context28.next) {
1969
+ return _regenerator.default.wrap(function (_context31) {
1970
+ while (1) switch (_context31.prev = _context31.next) {
1585
1971
  case 0:
1586
1972
  statusPayload = {
1587
1973
  statusCode: 503,
@@ -1603,7 +1989,7 @@ describe('State Machine handler tests', function () {
1603
1989
  }
1604
1990
  };
1605
1991
  call['connected'] = true;
1606
- _context28.next = 1;
1992
+ _context31.next = 1;
1607
1993
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1608
1994
  case 1:
1609
1995
  jest.advanceTimersByTime(1005);
@@ -1615,14 +2001,14 @@ describe('State Machine handler tests', function () {
1615
2001
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1616
2002
  case 2:
1617
2003
  case "end":
1618
- return _context28.stop();
2004
+ return _context31.stop();
1619
2005
  }
1620
- }, _callee28);
2006
+ }, _callee31);
1621
2007
  })));
1622
- it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
2008
+ it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1623
2009
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1624
- return _regenerator.default.wrap(function (_context29) {
1625
- while (1) switch (_context29.prev = _context29.next) {
2010
+ return _regenerator.default.wrap(function (_context32) {
2011
+ while (1) switch (_context32.prev = _context32.next) {
1626
2012
  case 0:
1627
2013
  statusPayload = {
1628
2014
  statusCode: 503,
@@ -1644,7 +2030,7 @@ describe('State Machine handler tests', function () {
1644
2030
  }
1645
2031
  };
1646
2032
  call['connected'] = false;
1647
- _context29.next = 1;
2033
+ _context32.next = 1;
1648
2034
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1649
2035
  case 1:
1650
2036
  jest.advanceTimersByTime(1005);
@@ -1655,14 +2041,14 @@ describe('State Machine handler tests', function () {
1655
2041
  expect(stateMachineSpy).not.toBeCalled();
1656
2042
  case 2:
1657
2043
  case "end":
1658
- return _context29.stop();
2044
+ return _context32.stop();
1659
2045
  }
1660
- }, _callee29);
2046
+ }, _callee32);
1661
2047
  })));
1662
- it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
2048
+ it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
1663
2049
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1664
- return _regenerator.default.wrap(function (_context30) {
1665
- while (1) switch (_context30.prev = _context30.next) {
2050
+ return _regenerator.default.wrap(function (_context33) {
2051
+ while (1) switch (_context33.prev = _context33.next) {
1666
2052
  case 0:
1667
2053
  statusPayload = {
1668
2054
  statusCode: 503,
@@ -1684,7 +2070,7 @@ describe('State Machine handler tests', function () {
1684
2070
  };
1685
2071
  call['connected'] = true;
1686
2072
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_OFFER';
1687
- _context30.next = 1;
2073
+ _context33.next = 1;
1688
2074
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1689
2075
  case 1:
1690
2076
  jest.advanceTimersByTime(1005);
@@ -1696,14 +2082,14 @@ describe('State Machine handler tests', function () {
1696
2082
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1697
2083
  case 2:
1698
2084
  case "end":
1699
- return _context30.stop();
2085
+ return _context33.stop();
1700
2086
  }
1701
- }, _callee30);
2087
+ }, _callee33);
1702
2088
  })));
1703
- it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
2089
+ it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
1704
2090
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1705
- return _regenerator.default.wrap(function (_context31) {
1706
- while (1) switch (_context31.prev = _context31.next) {
2091
+ return _regenerator.default.wrap(function (_context34) {
2092
+ while (1) switch (_context34.prev = _context34.next) {
1707
2093
  case 0:
1708
2094
  statusPayload = {
1709
2095
  statusCode: 503,
@@ -1724,7 +2110,7 @@ describe('State Machine handler tests', function () {
1724
2110
  }
1725
2111
  };
1726
2112
  call['connected'] = false;
1727
- _context31.next = 1;
2113
+ _context34.next = 1;
1728
2114
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1729
2115
  case 1:
1730
2116
  jest.advanceTimersByTime(1005);
@@ -1736,14 +2122,14 @@ describe('State Machine handler tests', function () {
1736
2122
  expect(stateMachineSpy).not.toBeCalled();
1737
2123
  case 2:
1738
2124
  case "end":
1739
- return _context31.stop();
2125
+ return _context34.stop();
1740
2126
  }
1741
- }, _callee31);
2127
+ }, _callee34);
1742
2128
  })));
1743
- it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
2129
+ it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
1744
2130
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1745
- return _regenerator.default.wrap(function (_context32) {
1746
- while (1) switch (_context32.prev = _context32.next) {
2131
+ return _regenerator.default.wrap(function (_context35) {
2132
+ while (1) switch (_context35.prev = _context35.next) {
1747
2133
  case 0:
1748
2134
  statusPayload = {
1749
2135
  statusCode: 200,
@@ -1768,14 +2154,14 @@ describe('State Machine handler tests', function () {
1768
2154
  expect(stateMachineSpy).not.toHaveBeenCalled();
1769
2155
  case 1:
1770
2156
  case "end":
1771
- return _context32.stop();
2157
+ return _context35.stop();
1772
2158
  }
1773
- }, _callee32);
2159
+ }, _callee35);
1774
2160
  })));
1775
- it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
2161
+ it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
1776
2162
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1777
- return _regenerator.default.wrap(function (_context33) {
1778
- while (1) switch (_context33.prev = _context33.next) {
2163
+ return _regenerator.default.wrap(function (_context36) {
2164
+ while (1) switch (_context36.prev = _context36.next) {
1779
2165
  case 0:
1780
2166
  statusPayload = {
1781
2167
  statusCode: 503,
@@ -1797,7 +2183,7 @@ describe('State Machine handler tests', function () {
1797
2183
  };
1798
2184
  call['connected'] = true;
1799
2185
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
1800
- _context33.next = 1;
2186
+ _context36.next = 1;
1801
2187
  return call['handleRoapEstablished']({}, dummyEvent);
1802
2188
  case 1:
1803
2189
  jest.advanceTimersByTime(1005);
@@ -1809,14 +2195,14 @@ describe('State Machine handler tests', function () {
1809
2195
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1810
2196
  case 2:
1811
2197
  case "end":
1812
- return _context33.stop();
2198
+ return _context36.stop();
1813
2199
  }
1814
- }, _callee33);
2200
+ }, _callee36);
1815
2201
  })));
1816
- it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
2202
+ it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
1817
2203
  var statusPayload, stateMachineSpy, funcSpy, errorEvent;
1818
- return _regenerator.default.wrap(function (_context34) {
1819
- while (1) switch (_context34.prev = _context34.next) {
2204
+ return _regenerator.default.wrap(function (_context37) {
2205
+ while (1) switch (_context37.prev = _context37.next) {
1820
2206
  case 0:
1821
2207
  statusPayload = {
1822
2208
  statusCode: 403,
@@ -1839,14 +2225,14 @@ describe('State Machine handler tests', function () {
1839
2225
  expect(stateMachineSpy).not.toHaveBeenCalled();
1840
2226
  case 1:
1841
2227
  case "end":
1842
- return _context34.stop();
2228
+ return _context37.stop();
1843
2229
  }
1844
- }, _callee34);
2230
+ }, _callee37);
1845
2231
  })));
1846
- it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
2232
+ it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
1847
2233
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1848
- return _regenerator.default.wrap(function (_context35) {
1849
- while (1) switch (_context35.prev = _context35.next) {
2234
+ return _regenerator.default.wrap(function (_context38) {
2235
+ while (1) switch (_context38.prev = _context38.next) {
1850
2236
  case 0:
1851
2237
  statusPayload = {
1852
2238
  statusCode: 200,
@@ -1864,7 +2250,7 @@ describe('State Machine handler tests', function () {
1864
2250
  }
1865
2251
  };
1866
2252
  call['connected'] = false;
1867
- _context35.next = 1;
2253
+ _context38.next = 1;
1868
2254
  return call['handleRoapError']({}, errorEvent);
1869
2255
  case 1:
1870
2256
  expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
@@ -1880,14 +2266,14 @@ describe('State Machine handler tests', function () {
1880
2266
  });
1881
2267
  case 2:
1882
2268
  case "end":
1883
- return _context35.stop();
2269
+ return _context38.stop();
1884
2270
  }
1885
- }, _callee35);
2271
+ }, _callee38);
1886
2272
  })));
1887
- it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
2273
+ it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
1888
2274
  var statusPayload, warnSpy, postMediaSpy, setupEvent, connectEvent, offerEvent, answerEvent;
1889
- return _regenerator.default.wrap(function (_context36) {
1890
- while (1) switch (_context36.prev = _context36.next) {
2275
+ return _regenerator.default.wrap(function (_context39) {
2276
+ while (1) switch (_context39.prev = _context39.next) {
1891
2277
  case 0:
1892
2278
  statusPayload = {
1893
2279
  statusCode: 403,
@@ -1925,12 +2311,18 @@ describe('State Machine handler tests', function () {
1925
2311
  messageType: 'ANSWER'
1926
2312
  }
1927
2313
  };
1928
- _context36.next = 1;
2314
+ _context39.next = 1;
1929
2315
  return call.sendMediaStateMachineEvt(answerEvent);
1930
2316
  case 1:
1931
- _context36.next = 2;
2317
+ _context39.next = 2;
1932
2318
  return (0, _testUtil.flushPromises)(2);
1933
2319
  case 2:
2320
+ _context39.next = 3;
2321
+ return _promise.default.resolve();
2322
+ case 3:
2323
+ _context39.next = 4;
2324
+ return _promise.default.resolve();
2325
+ case 4:
1934
2326
  expect(postMediaSpy).toBeCalledOnceWith(answerEvent.data);
1935
2327
  expect(warnSpy).toHaveBeenCalledWith('Failed to send MediaAnswer request', {
1936
2328
  file: 'call',
@@ -1944,16 +2336,16 @@ describe('State Machine handler tests', function () {
1944
2336
  // Final state should be torn down and cleared for unconnected call
1945
2337
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1946
2338
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
1947
- case 3:
2339
+ case 5:
1948
2340
  case "end":
1949
- return _context36.stop();
2341
+ return _context39.stop();
1950
2342
  }
1951
- }, _callee36);
2343
+ }, _callee39);
1952
2344
  })));
1953
- it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
2345
+ it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
1954
2346
  var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
1955
- return _regenerator.default.wrap(function (_context37) {
1956
- while (1) switch (_context37.prev = _context37.next) {
2347
+ return _regenerator.default.wrap(function (_context40) {
2348
+ while (1) switch (_context40.prev = _context40.next) {
1957
2349
  case 0:
1958
2350
  statusPayload = {
1959
2351
  statusCode: 200,
@@ -1986,7 +2378,7 @@ describe('State Machine handler tests', function () {
1986
2378
  seq: 1,
1987
2379
  messageType: 'ANSWER'
1988
2380
  };
1989
- _context37.next = 1;
2381
+ _context40.next = 1;
1990
2382
  return call.sendMediaStateMachineEvt(dummyEvent);
1991
2383
  case 1:
1992
2384
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -2008,7 +2400,7 @@ describe('State Machine handler tests', function () {
2008
2400
  seq: 2,
2009
2401
  messageType: 'OFFER_REQUEST'
2010
2402
  };
2011
- _context37.next = 2;
2403
+ _context40.next = 2;
2012
2404
  return call.sendMediaStateMachineEvt(dummyEvent);
2013
2405
  case 2:
2014
2406
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -2058,7 +2450,7 @@ describe('State Machine handler tests', function () {
2058
2450
  };
2059
2451
  call.sendCallStateMachineEvt(dummyEvent);
2060
2452
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2061
- _context37.next = 3;
2453
+ _context40.next = 3;
2062
2454
  return call.sendMediaStateMachineEvt(dummyEvent);
2063
2455
  case 3:
2064
2456
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2067,7 +2459,7 @@ describe('State Machine handler tests', function () {
2067
2459
  seq: 3,
2068
2460
  messageType: 'ANSWER'
2069
2461
  };
2070
- _context37.next = 4;
2462
+ _context40.next = 4;
2071
2463
  return call.sendMediaStateMachineEvt(dummyEvent);
2072
2464
  case 4:
2073
2465
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2086,7 +2478,7 @@ describe('State Machine handler tests', function () {
2086
2478
  messageType: 'OK'
2087
2479
  }
2088
2480
  };
2089
- _context37.next = 5;
2481
+ _context40.next = 5;
2090
2482
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2091
2483
  case 5:
2092
2484
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
@@ -2101,14 +2493,14 @@ describe('State Machine handler tests', function () {
2101
2493
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2102
2494
  case 6:
2103
2495
  case "end":
2104
- return _context37.stop();
2496
+ return _context40.stop();
2105
2497
  }
2106
- }, _callee37);
2498
+ }, _callee40);
2107
2499
  })));
2108
- it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
2500
+ it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2109
2501
  var mockStatusBody, statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
2110
- return _regenerator.default.wrap(function (_context38) {
2111
- while (1) switch (_context38.prev = _context38.next) {
2502
+ return _regenerator.default.wrap(function (_context41) {
2503
+ while (1) switch (_context41.prev = _context41.next) {
2112
2504
  case 0:
2113
2505
  mockStatusBody = {
2114
2506
  device: {
@@ -2148,7 +2540,7 @@ describe('State Machine handler tests', function () {
2148
2540
  seq: 1,
2149
2541
  messageType: 'ANSWER'
2150
2542
  };
2151
- _context38.next = 1;
2543
+ _context41.next = 1;
2152
2544
  return call.sendMediaStateMachineEvt(dummyEvent);
2153
2545
  case 1:
2154
2546
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -2170,7 +2562,7 @@ describe('State Machine handler tests', function () {
2170
2562
  seq: 2,
2171
2563
  messageType: 'OFFER_REQUEST'
2172
2564
  };
2173
- _context38.next = 2;
2565
+ _context41.next = 2;
2174
2566
  return call.sendMediaStateMachineEvt(dummyEvent);
2175
2567
  case 2:
2176
2568
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -2220,7 +2612,7 @@ describe('State Machine handler tests', function () {
2220
2612
  };
2221
2613
  call.sendCallStateMachineEvt(dummyEvent);
2222
2614
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2223
- _context38.next = 3;
2615
+ _context41.next = 3;
2224
2616
  return call.sendMediaStateMachineEvt(dummyEvent);
2225
2617
  case 3:
2226
2618
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2229,7 +2621,7 @@ describe('State Machine handler tests', function () {
2229
2621
  seq: 3,
2230
2622
  messageType: 'ANSWER'
2231
2623
  };
2232
- _context38.next = 4;
2624
+ _context41.next = 4;
2233
2625
  return call.sendMediaStateMachineEvt(dummyEvent);
2234
2626
  case 4:
2235
2627
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2246,7 +2638,7 @@ describe('State Machine handler tests', function () {
2246
2638
  }
2247
2639
  };
2248
2640
  call.sendMediaStateMachineEvt(dummyEvent);
2249
- _context38.next = 5;
2641
+ _context41.next = 5;
2250
2642
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2251
2643
  case 5:
2252
2644
  expect(call['receivedRoapOKSeq']).toBe(3);
@@ -2262,14 +2654,14 @@ describe('State Machine handler tests', function () {
2262
2654
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2263
2655
  case 6:
2264
2656
  case "end":
2265
- return _context38.stop();
2657
+ return _context41.stop();
2266
2658
  }
2267
- }, _callee38);
2659
+ }, _callee41);
2268
2660
  })));
2269
- it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
2661
+ it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
2270
2662
  var statusPayload, dummyEvent, postMediaSpy, infoSpy, dummyOkEvent;
2271
- return _regenerator.default.wrap(function (_context39) {
2272
- while (1) switch (_context39.prev = _context39.next) {
2663
+ return _regenerator.default.wrap(function (_context42) {
2664
+ while (1) switch (_context42.prev = _context42.next) {
2273
2665
  case 0:
2274
2666
  statusPayload = {
2275
2667
  statusCode: 200,
@@ -2330,20 +2722,20 @@ describe('State Machine handler tests', function () {
2330
2722
  dummyEvent.data = undefined;
2331
2723
  call.sendCallStateMachineEvt(dummyEvent);
2332
2724
  expect(call['callStateMachine'].state.value).toBe('S_CALL_HOLD');
2333
- expect(infoSpy).toHaveBeenLastCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
2725
+ expect(infoSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
2334
2726
  file: 'call',
2335
2727
  method: 'handleCallHold'
2336
2728
  });
2337
2729
  case 1:
2338
2730
  case "end":
2339
- return _context39.stop();
2731
+ return _context42.stop();
2340
2732
  }
2341
- }, _callee39);
2733
+ }, _callee42);
2342
2734
  })));
2343
- it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
2735
+ it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
2344
2736
  var emitSpy, deleteSpy;
2345
- return _regenerator.default.wrap(function (_context40) {
2346
- while (1) switch (_context40.prev = _context40.next) {
2737
+ return _regenerator.default.wrap(function (_context43) {
2738
+ while (1) switch (_context43.prev = _context43.next) {
2347
2739
  case 0:
2348
2740
  emitSpy = jest.spyOn(call, 'emit');
2349
2741
  deleteSpy = jest.spyOn(call, 'delete').mockResolvedValue({
@@ -2352,7 +2744,7 @@ describe('State Machine handler tests', function () {
2352
2744
  call.sendCallStateMachineEvt({
2353
2745
  type: 'E_RECV_CALL_DISCONNECT'
2354
2746
  });
2355
- _context40.next = 1;
2747
+ _context43.next = 1;
2356
2748
  return (0, _testUtil.flushPromises)(1);
2357
2749
  case 1:
2358
2750
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
@@ -2360,9 +2752,9 @@ describe('State Machine handler tests', function () {
2360
2752
  expect(emitSpy.mock.invocationCallOrder[0]).toBeLessThan(deleteSpy.mock.invocationCallOrder[0]);
2361
2753
  case 2:
2362
2754
  case "end":
2363
- return _context40.stop();
2755
+ return _context43.stop();
2364
2756
  }
2365
- }, _callee40);
2757
+ }, _callee43);
2366
2758
  })));
2367
2759
  describe('Call event timers tests', function () {
2368
2760
  var callManager;
@@ -2373,10 +2765,10 @@ describe('State Machine handler tests', function () {
2373
2765
  afterEach(function () {
2374
2766
  jest.clearAllTimers();
2375
2767
  });
2376
- it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2768
+ it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
2377
2769
  var statusPayload, dummyEvent, logSpy, emitSpy, deleteSpy, dummyOkEvent;
2378
- return _regenerator.default.wrap(function (_context41) {
2379
- while (1) switch (_context41.prev = _context41.next) {
2770
+ return _regenerator.default.wrap(function (_context44) {
2771
+ while (1) switch (_context44.prev = _context44.next) {
2380
2772
  case 0:
2381
2773
  statusPayload = {
2382
2774
  statusCode: 200,
@@ -2393,7 +2785,7 @@ describe('State Machine handler tests', function () {
2393
2785
  webex.request.mockReturnValue(statusPayload);
2394
2786
 
2395
2787
  // handleOutgoingCallSetup is asynchronous
2396
- _context41.next = 1;
2788
+ _context44.next = 1;
2397
2789
  return call.sendCallStateMachineEvt(dummyEvent);
2398
2790
  case 1:
2399
2791
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
@@ -2436,14 +2828,14 @@ describe('State Machine handler tests', function () {
2436
2828
  expect(callManager.callCollection).toStrictEqual({});
2437
2829
  case 2:
2438
2830
  case "end":
2439
- return _context41.stop();
2831
+ return _context44.stop();
2440
2832
  }
2441
- }, _callee41);
2833
+ }, _callee44);
2442
2834
  })));
2443
- it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
2835
+ it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
2444
2836
  var statusPayload, dummyEvent, call, emitSpy, deleteSpy, logSpy;
2445
- return _regenerator.default.wrap(function (_context42) {
2446
- while (1) switch (_context42.prev = _context42.next) {
2837
+ return _regenerator.default.wrap(function (_context45) {
2838
+ while (1) switch (_context45.prev = _context45.next) {
2447
2839
  case 0:
2448
2840
  statusPayload = {
2449
2841
  statusCode: 200,
@@ -2462,7 +2854,7 @@ describe('State Machine handler tests', function () {
2462
2854
  expect((0, _keys.default)(callManager.callCollection)[0]).toBe(call.getCorrelationId());
2463
2855
 
2464
2856
  // handleOutgoingCallSetup is asynchronous
2465
- _context42.next = 1;
2857
+ _context45.next = 1;
2466
2858
  return call.sendCallStateMachineEvt(dummyEvent);
2467
2859
  case 1:
2468
2860
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
@@ -2474,9 +2866,9 @@ describe('State Machine handler tests', function () {
2474
2866
  expect(callManager.callCollection).toStrictEqual({});
2475
2867
  case 2:
2476
2868
  case "end":
2477
- return _context42.stop();
2869
+ return _context45.stop();
2478
2870
  }
2479
- }, _callee42);
2871
+ }, _callee45);
2480
2872
  })));
2481
2873
  });
2482
2874
  });
@@ -2495,6 +2887,11 @@ describe('Supplementary Services tests', function () {
2495
2887
  };
2496
2888
  var call;
2497
2889
  beforeEach(function () {
2890
+ _request.APIRequest.resetInstance();
2891
+ _request.APIRequest.getInstance({
2892
+ webex: webex,
2893
+ isMobiusSocketEnabled: false
2894
+ });
2498
2895
  /* Since we are not actually testing from the start of a call , so it's good to set the below
2499
2896
  * parameters manually
2500
2897
  */
@@ -2536,10 +2933,10 @@ describe('Supplementary Services tests', function () {
2536
2933
  beforeEach(function () {
2537
2934
  call.removeAllListeners();
2538
2935
  });
2539
- it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
2936
+ it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
2540
2937
  var responsePayload, warnSpy, roapEvent;
2541
- return _regenerator.default.wrap(function (_context44) {
2542
- while (1) switch (_context44.prev = _context44.next) {
2938
+ return _regenerator.default.wrap(function (_context47) {
2939
+ while (1) switch (_context47.prev = _context47.next) {
2543
2940
  case 0:
2544
2941
  expect.assertions(7);
2545
2942
  responsePayload = {
@@ -2552,25 +2949,25 @@ describe('Supplementary Services tests', function () {
2552
2949
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2553
2950
  call['held'] = false;
2554
2951
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2555
- var _ref44 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43(correlationId) {
2556
- return _regenerator.default.wrap(function (_context43) {
2557
- while (1) switch (_context43.prev = _context43.next) {
2952
+ var _ref56 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46(correlationId) {
2953
+ return _regenerator.default.wrap(function (_context46) {
2954
+ while (1) switch (_context46.prev = _context46.next) {
2558
2955
  case 0:
2559
2956
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2560
2957
  case 1:
2561
2958
  case "end":
2562
- return _context43.stop();
2959
+ return _context46.stop();
2563
2960
  }
2564
- }, _callee43);
2961
+ }, _callee46);
2565
2962
  }));
2566
2963
  return function (_x) {
2567
- return _ref44.apply(this, arguments);
2964
+ return _ref56.apply(this, arguments);
2568
2965
  };
2569
2966
  }());
2570
- _context44.next = 1;
2967
+ _context47.next = 1;
2571
2968
  return call.doHoldResume();
2572
2969
  case 1:
2573
- _context44.next = 2;
2970
+ _context47.next = 2;
2574
2971
  return (0, _testUtil.flushPromises)(2);
2575
2972
  case 2:
2576
2973
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2586,11 +2983,11 @@ describe('Supplementary Services tests', function () {
2586
2983
  call['handleIncomingRoapOffer']({}, dummyEvent);
2587
2984
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2588
2985
  roapEvent.data.type = 'ANSWER';
2589
- _context44.next = 3;
2986
+ _context47.next = 3;
2590
2987
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2591
2988
  case 3:
2592
2989
  roapEvent.data.type = 'OK';
2593
- _context44.next = 4;
2990
+ _context47.next = 4;
2594
2991
  return call['handleRoapEstablished']({}, dummyEvent);
2595
2992
  case 4:
2596
2993
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -2605,14 +3002,14 @@ describe('Supplementary Services tests', function () {
2605
3002
  });
2606
3003
  case 5:
2607
3004
  case "end":
2608
- return _context44.stop();
3005
+ return _context47.stop();
2609
3006
  }
2610
- }, _callee44);
3007
+ }, _callee47);
2611
3008
  })));
2612
- it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
3009
+ it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
2613
3010
  var responsePayload, warnSpy, roapEvent;
2614
- return _regenerator.default.wrap(function (_context46) {
2615
- while (1) switch (_context46.prev = _context46.next) {
3011
+ return _regenerator.default.wrap(function (_context49) {
3012
+ while (1) switch (_context49.prev = _context49.next) {
2616
3013
  case 0:
2617
3014
  expect.assertions(8);
2618
3015
  responsePayload = {
@@ -2625,26 +3022,26 @@ describe('Supplementary Services tests', function () {
2625
3022
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2626
3023
  call['held'] = false;
2627
3024
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2628
- var _ref46 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45(correlationId) {
2629
- return _regenerator.default.wrap(function (_context45) {
2630
- while (1) switch (_context45.prev = _context45.next) {
3025
+ var _ref58 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48(correlationId) {
3026
+ return _regenerator.default.wrap(function (_context48) {
3027
+ while (1) switch (_context48.prev = _context48.next) {
2631
3028
  case 0:
2632
3029
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2633
3030
  case 1:
2634
3031
  case "end":
2635
- return _context45.stop();
3032
+ return _context48.stop();
2636
3033
  }
2637
- }, _callee45);
3034
+ }, _callee48);
2638
3035
  }));
2639
3036
  return function (_x2) {
2640
- return _ref46.apply(this, arguments);
3037
+ return _ref58.apply(this, arguments);
2641
3038
  };
2642
3039
  }());
2643
3040
  call.doHoldResume();
2644
- _context46.next = 1;
3041
+ _context49.next = 1;
2645
3042
  return _promise.default.resolve();
2646
3043
  case 1:
2647
- _context46.next = 2;
3044
+ _context49.next = 2;
2648
3045
  return _promise.default.resolve();
2649
3046
  case 2:
2650
3047
  expect(setTimeout).not.toHaveBeenCalled();
@@ -2660,11 +3057,11 @@ describe('Supplementary Services tests', function () {
2660
3057
  call['handleIncomingRoapOffer']({}, dummyEvent);
2661
3058
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2662
3059
  roapEvent.data.type = 'ANSWER';
2663
- _context46.next = 3;
3060
+ _context49.next = 3;
2664
3061
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2665
3062
  case 3:
2666
3063
  roapEvent.data.type = 'OK';
2667
- _context46.next = 4;
3064
+ _context49.next = 4;
2668
3065
  return call['handleRoapEstablished']({}, dummyEvent);
2669
3066
  case 4:
2670
3067
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -2679,14 +3076,14 @@ describe('Supplementary Services tests', function () {
2679
3076
  });
2680
3077
  case 5:
2681
3078
  case "end":
2682
- return _context46.stop();
3079
+ return _context49.stop();
2683
3080
  }
2684
- }, _callee46);
3081
+ }, _callee49);
2685
3082
  })));
2686
- it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48() {
3083
+ it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
2687
3084
  var responsePayload;
2688
- return _regenerator.default.wrap(function (_context48) {
2689
- while (1) switch (_context48.prev = _context48.next) {
3085
+ return _regenerator.default.wrap(function (_context51) {
3086
+ while (1) switch (_context51.prev = _context51.next) {
2690
3087
  case 0:
2691
3088
  expect.assertions(4);
2692
3089
  responsePayload = {
@@ -2696,26 +3093,26 @@ describe('Supplementary Services tests', function () {
2696
3093
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2697
3094
  call['held'] = false;
2698
3095
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2699
- var _ref48 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47(errObj) {
2700
- return _regenerator.default.wrap(function (_context47) {
2701
- while (1) switch (_context47.prev = _context47.next) {
3096
+ var _ref60 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50(errObj) {
3097
+ return _regenerator.default.wrap(function (_context50) {
3098
+ while (1) switch (_context50.prev = _context50.next) {
2702
3099
  case 0:
2703
3100
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2704
3101
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2705
3102
  case 1:
2706
3103
  case "end":
2707
- return _context47.stop();
3104
+ return _context50.stop();
2708
3105
  }
2709
- }, _callee47);
3106
+ }, _callee50);
2710
3107
  }));
2711
3108
  return function (_x3) {
2712
- return _ref48.apply(this, arguments);
3109
+ return _ref60.apply(this, arguments);
2713
3110
  };
2714
3111
  }());
2715
- _context48.next = 1;
3112
+ _context51.next = 1;
2716
3113
  return call.doHoldResume();
2717
3114
  case 1:
2718
- _context48.next = 2;
3115
+ _context51.next = 2;
2719
3116
  return (0, _testUtil.flushPromises)(2);
2720
3117
  case 2:
2721
3118
  expect(call.isHeld()).toStrictEqual(false);
@@ -2725,14 +3122,14 @@ describe('Supplementary Services tests', function () {
2725
3122
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2726
3123
  case 3:
2727
3124
  case "end":
2728
- return _context48.stop();
3125
+ return _context51.stop();
2729
3126
  }
2730
- }, _callee48);
3127
+ }, _callee51);
2731
3128
  })));
2732
- it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
3129
+ it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
2733
3130
  var responsePayload, rejectPayload, roapEvent;
2734
- return _regenerator.default.wrap(function (_context50) {
2735
- while (1) switch (_context50.prev = _context50.next) {
3131
+ return _regenerator.default.wrap(function (_context53) {
3132
+ while (1) switch (_context53.prev = _context53.next) {
2736
3133
  case 0:
2737
3134
  expect.assertions(5);
2738
3135
  responsePayload = {
@@ -2746,24 +3143,24 @@ describe('Supplementary Services tests', function () {
2746
3143
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2747
3144
  call['held'] = false;
2748
3145
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2749
- var _ref50 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49(errObj) {
2750
- return _regenerator.default.wrap(function (_context49) {
2751
- while (1) switch (_context49.prev = _context49.next) {
3146
+ var _ref62 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52(errObj) {
3147
+ return _regenerator.default.wrap(function (_context52) {
3148
+ while (1) switch (_context52.prev = _context52.next) {
2752
3149
  case 0:
2753
3150
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2754
3151
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2755
3152
  case 1:
2756
3153
  case "end":
2757
- return _context49.stop();
3154
+ return _context52.stop();
2758
3155
  }
2759
- }, _callee49);
3156
+ }, _callee52);
2760
3157
  }));
2761
3158
  return function (_x4) {
2762
- return _ref50.apply(this, arguments);
3159
+ return _ref62.apply(this, arguments);
2763
3160
  };
2764
3161
  }());
2765
3162
  call.doHoldResume();
2766
- _context50.next = 1;
3163
+ _context53.next = 1;
2767
3164
  return (0, _testUtil.flushPromises)(2);
2768
3165
  case 1:
2769
3166
  /* the Call State should transition to S_CALL_ESTABLISHED
@@ -2773,7 +3170,7 @@ describe('Supplementary Services tests', function () {
2773
3170
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2774
3171
  /* We are intentionally failing the ROAP ANSWER */
2775
3172
  roapEvent.data.type = 'ANSWER';
2776
- _context50.next = 2;
3173
+ _context53.next = 2;
2777
3174
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2778
3175
  case 2:
2779
3176
  expect(call.isHeld()).toStrictEqual(false);
@@ -2781,14 +3178,14 @@ describe('Supplementary Services tests', function () {
2781
3178
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2782
3179
  case 3:
2783
3180
  case "end":
2784
- return _context50.stop();
3181
+ return _context53.stop();
2785
3182
  }
2786
- }, _callee50);
3183
+ }, _callee53);
2787
3184
  })));
2788
- it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
3185
+ it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54() {
2789
3186
  var responsePayload, warnSpy, roapEvent;
2790
- return _regenerator.default.wrap(function (_context51) {
2791
- while (1) switch (_context51.prev = _context51.next) {
3187
+ return _regenerator.default.wrap(function (_context54) {
3188
+ while (1) switch (_context54.prev = _context54.next) {
2792
3189
  case 0:
2793
3190
  responsePayload = {
2794
3191
  statusCode: 200,
@@ -2799,10 +3196,10 @@ describe('Supplementary Services tests', function () {
2799
3196
  jest.spyOn(global, 'clearTimeout');
2800
3197
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2801
3198
  call['held'] = false;
2802
- _context51.next = 1;
3199
+ _context54.next = 1;
2803
3200
  return call.doHoldResume();
2804
3201
  case 1:
2805
- _context51.next = 2;
3202
+ _context54.next = 2;
2806
3203
  return (0, _testUtil.flushPromises)(2);
2807
3204
  case 2:
2808
3205
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2817,19 +3214,19 @@ describe('Supplementary Services tests', function () {
2817
3214
  call['handleIncomingRoapOffer']({}, dummyEvent);
2818
3215
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2819
3216
  roapEvent.data.type = 'ANSWER';
2820
- _context51.next = 3;
3217
+ _context54.next = 3;
2821
3218
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2822
3219
  case 3:
2823
3220
  jest.spyOn(webex, 'request').mockRejectedValue({
2824
3221
  statusCode: 403
2825
3222
  });
2826
3223
  roapEvent.data.type = 'OK';
2827
- _context51.next = 4;
3224
+ _context54.next = 4;
2828
3225
  return call['handleRoapEstablished']({}, dummyEvent);
2829
3226
  case 4:
2830
3227
  /* this is for coverage */
2831
3228
  call['callStateMachine'].state.value = 'S_CALL_HOLD';
2832
- _context51.next = 5;
3229
+ _context54.next = 5;
2833
3230
  return call['handleRoapEstablished']({}, dummyEvent);
2834
3231
  case 5:
2835
3232
  expect(call.isHeld()).toStrictEqual(false);
@@ -2841,14 +3238,14 @@ describe('Supplementary Services tests', function () {
2841
3238
  });
2842
3239
  case 6:
2843
3240
  case "end":
2844
- return _context51.stop();
3241
+ return _context54.stop();
2845
3242
  }
2846
- }, _callee51);
3243
+ }, _callee54);
2847
3244
  })));
2848
- it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
3245
+ it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
2849
3246
  var responsePayload, warnSpy, roapEvent;
2850
- return _regenerator.default.wrap(function (_context52) {
2851
- while (1) switch (_context52.prev = _context52.next) {
3247
+ return _regenerator.default.wrap(function (_context55) {
3248
+ while (1) switch (_context55.prev = _context55.next) {
2852
3249
  case 0:
2853
3250
  responsePayload = {
2854
3251
  statusCode: 200,
@@ -2859,10 +3256,10 @@ describe('Supplementary Services tests', function () {
2859
3256
  jest.spyOn(global, 'clearTimeout');
2860
3257
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2861
3258
  call['held'] = true;
2862
- _context52.next = 1;
3259
+ _context55.next = 1;
2863
3260
  return call.doHoldResume();
2864
3261
  case 1:
2865
- _context52.next = 2;
3262
+ _context55.next = 2;
2866
3263
  return (0, _testUtil.flushPromises)(2);
2867
3264
  case 2:
2868
3265
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2877,14 +3274,14 @@ describe('Supplementary Services tests', function () {
2877
3274
  call['handleIncomingRoapOffer']({}, dummyEvent);
2878
3275
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2879
3276
  roapEvent.data.type = 'ANSWER';
2880
- _context52.next = 3;
3277
+ _context55.next = 3;
2881
3278
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2882
3279
  case 3:
2883
3280
  jest.spyOn(webex, 'request').mockRejectedValue({
2884
3281
  statusCode: 403
2885
3282
  });
2886
3283
  roapEvent.data.type = 'OK';
2887
- _context52.next = 4;
3284
+ _context55.next = 4;
2888
3285
  return call['handleRoapEstablished']({}, dummyEvent);
2889
3286
  case 4:
2890
3287
  expect(call.isHeld()).toStrictEqual(true);
@@ -2896,14 +3293,14 @@ describe('Supplementary Services tests', function () {
2896
3293
  });
2897
3294
  case 5:
2898
3295
  case "end":
2899
- return _context52.stop();
3296
+ return _context55.stop();
2900
3297
  }
2901
- }, _callee52);
3298
+ }, _callee55);
2902
3299
  })));
2903
- it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54() {
3300
+ it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
2904
3301
  var responsePayload, roapEvent;
2905
- return _regenerator.default.wrap(function (_context54) {
2906
- while (1) switch (_context54.prev = _context54.next) {
3302
+ return _regenerator.default.wrap(function (_context57) {
3303
+ while (1) switch (_context57.prev = _context57.next) {
2907
3304
  case 0:
2908
3305
  expect.assertions(5);
2909
3306
  responsePayload = {
@@ -2913,25 +3310,25 @@ describe('Supplementary Services tests', function () {
2913
3310
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
2914
3311
  call['held'] = false;
2915
3312
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2916
- var _ref54 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53(errObj) {
2917
- return _regenerator.default.wrap(function (_context53) {
2918
- while (1) switch (_context53.prev = _context53.next) {
3313
+ var _ref66 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56(errObj) {
3314
+ return _regenerator.default.wrap(function (_context56) {
3315
+ while (1) switch (_context56.prev = _context56.next) {
2919
3316
  case 0:
2920
3317
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
2921
3318
  expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
2922
3319
  case 1:
2923
3320
  case "end":
2924
- return _context53.stop();
3321
+ return _context56.stop();
2925
3322
  }
2926
- }, _callee53);
3323
+ }, _callee56);
2927
3324
  }));
2928
3325
  return function (_x5) {
2929
- return _ref54.apply(this, arguments);
3326
+ return _ref66.apply(this, arguments);
2930
3327
  };
2931
3328
  }());
2932
3329
  jest.runAllTimers();
2933
3330
  call.doHoldResume();
2934
- _context54.next = 1;
3331
+ _context57.next = 1;
2935
3332
  return (0, _testUtil.flushPromises)(2);
2936
3333
  case 1:
2937
3334
  /* At this point, the Call State should be S_CALL_HOLD
@@ -2944,11 +3341,11 @@ describe('Supplementary Services tests', function () {
2944
3341
  call['handleIncomingRoapOffer']({}, dummyEvent);
2945
3342
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2946
3343
  roapEvent.data.type = 'ANSWER';
2947
- _context54.next = 2;
3344
+ _context57.next = 2;
2948
3345
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2949
3346
  case 2:
2950
3347
  roapEvent.data.type = 'OK';
2951
- _context54.next = 3;
3348
+ _context57.next = 3;
2952
3349
  return call['handleRoapEstablished']({}, dummyEvent);
2953
3350
  case 3:
2954
3351
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -2960,14 +3357,14 @@ describe('Supplementary Services tests', function () {
2960
3357
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2961
3358
  case 4:
2962
3359
  case "end":
2963
- return _context54.stop();
3360
+ return _context57.stop();
2964
3361
  }
2965
- }, _callee54);
3362
+ }, _callee57);
2966
3363
  })));
2967
- it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56() {
3364
+ it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59() {
2968
3365
  var responsePayload, warnSpy, roapEvent;
2969
- return _regenerator.default.wrap(function (_context56) {
2970
- while (1) switch (_context56.prev = _context56.next) {
3366
+ return _regenerator.default.wrap(function (_context59) {
3367
+ while (1) switch (_context59.prev = _context59.next) {
2971
3368
  case 0:
2972
3369
  expect.assertions(7);
2973
3370
  responsePayload = {
@@ -2980,25 +3377,25 @@ describe('Supplementary Services tests', function () {
2980
3377
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2981
3378
  call['held'] = true;
2982
3379
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
2983
- var _ref56 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55(correlationId) {
2984
- return _regenerator.default.wrap(function (_context55) {
2985
- while (1) switch (_context55.prev = _context55.next) {
3380
+ var _ref68 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58(correlationId) {
3381
+ return _regenerator.default.wrap(function (_context58) {
3382
+ while (1) switch (_context58.prev = _context58.next) {
2986
3383
  case 0:
2987
3384
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2988
3385
  case 1:
2989
3386
  case "end":
2990
- return _context55.stop();
3387
+ return _context58.stop();
2991
3388
  }
2992
- }, _callee55);
3389
+ }, _callee58);
2993
3390
  }));
2994
3391
  return function (_x6) {
2995
- return _ref56.apply(this, arguments);
3392
+ return _ref68.apply(this, arguments);
2996
3393
  };
2997
3394
  }());
2998
- _context56.next = 1;
3395
+ _context59.next = 1;
2999
3396
  return call.doHoldResume();
3000
3397
  case 1:
3001
- _context56.next = 2;
3398
+ _context59.next = 2;
3002
3399
  return (0, _testUtil.flushPromises)(2);
3003
3400
  case 2:
3004
3401
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -3014,11 +3411,11 @@ describe('Supplementary Services tests', function () {
3014
3411
  call['handleIncomingRoapOffer']({}, dummyEvent);
3015
3412
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3016
3413
  roapEvent.data.type = 'ANSWER';
3017
- _context56.next = 3;
3414
+ _context59.next = 3;
3018
3415
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3019
3416
  case 3:
3020
3417
  roapEvent.data.type = 'OK';
3021
- _context56.next = 4;
3418
+ _context59.next = 4;
3022
3419
  return call['handleRoapEstablished']({}, dummyEvent);
3023
3420
  case 4:
3024
3421
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -3033,14 +3430,14 @@ describe('Supplementary Services tests', function () {
3033
3430
  });
3034
3431
  case 5:
3035
3432
  case "end":
3036
- return _context56.stop();
3433
+ return _context59.stop();
3037
3434
  }
3038
- }, _callee56);
3435
+ }, _callee59);
3039
3436
  })));
3040
- it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58() {
3437
+ it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61() {
3041
3438
  var responsePayload, warnSpy, roapEvent;
3042
- return _regenerator.default.wrap(function (_context58) {
3043
- while (1) switch (_context58.prev = _context58.next) {
3439
+ return _regenerator.default.wrap(function (_context61) {
3440
+ while (1) switch (_context61.prev = _context61.next) {
3044
3441
  case 0:
3045
3442
  expect.assertions(7);
3046
3443
  responsePayload = {
@@ -3053,26 +3450,26 @@ describe('Supplementary Services tests', function () {
3053
3450
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3054
3451
  call['held'] = true;
3055
3452
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
3056
- var _ref58 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57(correlationId) {
3057
- return _regenerator.default.wrap(function (_context57) {
3058
- while (1) switch (_context57.prev = _context57.next) {
3453
+ var _ref70 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60(correlationId) {
3454
+ return _regenerator.default.wrap(function (_context60) {
3455
+ while (1) switch (_context60.prev = _context60.next) {
3059
3456
  case 0:
3060
3457
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3061
3458
  case 1:
3062
3459
  case "end":
3063
- return _context57.stop();
3460
+ return _context60.stop();
3064
3461
  }
3065
- }, _callee57);
3462
+ }, _callee60);
3066
3463
  }));
3067
3464
  return function (_x7) {
3068
- return _ref58.apply(this, arguments);
3465
+ return _ref70.apply(this, arguments);
3069
3466
  };
3070
3467
  }());
3071
3468
  call.doHoldResume();
3072
- _context58.next = 1;
3469
+ _context61.next = 1;
3073
3470
  return _promise.default.resolve();
3074
3471
  case 1:
3075
- _context58.next = 2;
3472
+ _context61.next = 2;
3076
3473
  return _promise.default.resolve();
3077
3474
  case 2:
3078
3475
  expect(setTimeout).not.toHaveBeenCalled();
@@ -3088,11 +3485,11 @@ describe('Supplementary Services tests', function () {
3088
3485
  call['handleIncomingRoapOffer']({}, dummyEvent);
3089
3486
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3090
3487
  roapEvent.data.type = 'ANSWER';
3091
- _context58.next = 3;
3488
+ _context61.next = 3;
3092
3489
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3093
3490
  case 3:
3094
3491
  roapEvent.data.type = 'OK';
3095
- _context58.next = 4;
3492
+ _context61.next = 4;
3096
3493
  return call['handleRoapEstablished']({}, dummyEvent);
3097
3494
  case 4:
3098
3495
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -3107,14 +3504,14 @@ describe('Supplementary Services tests', function () {
3107
3504
  });
3108
3505
  case 5:
3109
3506
  case "end":
3110
- return _context58.stop();
3507
+ return _context61.stop();
3111
3508
  }
3112
- }, _callee58);
3509
+ }, _callee61);
3113
3510
  })));
3114
- it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60() {
3511
+ it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
3115
3512
  var responsePayload;
3116
- return _regenerator.default.wrap(function (_context60) {
3117
- while (1) switch (_context60.prev = _context60.next) {
3513
+ return _regenerator.default.wrap(function (_context63) {
3514
+ while (1) switch (_context63.prev = _context63.next) {
3118
3515
  case 0:
3119
3516
  expect.assertions(4);
3120
3517
  responsePayload = {
@@ -3124,26 +3521,26 @@ describe('Supplementary Services tests', function () {
3124
3521
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3125
3522
  call['held'] = true;
3126
3523
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3127
- var _ref60 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59(errObj) {
3128
- return _regenerator.default.wrap(function (_context59) {
3129
- while (1) switch (_context59.prev = _context59.next) {
3524
+ var _ref72 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62(errObj) {
3525
+ return _regenerator.default.wrap(function (_context62) {
3526
+ while (1) switch (_context62.prev = _context62.next) {
3130
3527
  case 0:
3131
3528
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3132
3529
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3133
3530
  case 1:
3134
3531
  case "end":
3135
- return _context59.stop();
3532
+ return _context62.stop();
3136
3533
  }
3137
- }, _callee59);
3534
+ }, _callee62);
3138
3535
  }));
3139
3536
  return function (_x8) {
3140
- return _ref60.apply(this, arguments);
3537
+ return _ref72.apply(this, arguments);
3141
3538
  };
3142
3539
  }());
3143
- _context60.next = 1;
3540
+ _context63.next = 1;
3144
3541
  return call.doHoldResume();
3145
3542
  case 1:
3146
- _context60.next = 2;
3543
+ _context63.next = 2;
3147
3544
  return (0, _testUtil.flushPromises)(2);
3148
3545
  case 2:
3149
3546
  expect(call.isHeld()).toStrictEqual(true);
@@ -3154,14 +3551,14 @@ describe('Supplementary Services tests', function () {
3154
3551
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3155
3552
  case 3:
3156
3553
  case "end":
3157
- return _context60.stop();
3554
+ return _context63.stop();
3158
3555
  }
3159
- }, _callee60);
3556
+ }, _callee63);
3160
3557
  })));
3161
- it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62() {
3558
+ it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65() {
3162
3559
  var responsePayload, rejectPayload, roapEvent;
3163
- return _regenerator.default.wrap(function (_context62) {
3164
- while (1) switch (_context62.prev = _context62.next) {
3560
+ return _regenerator.default.wrap(function (_context65) {
3561
+ while (1) switch (_context65.prev = _context65.next) {
3165
3562
  case 0:
3166
3563
  expect.assertions(5);
3167
3564
  responsePayload = {
@@ -3175,24 +3572,24 @@ describe('Supplementary Services tests', function () {
3175
3572
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
3176
3573
  call['held'] = true;
3177
3574
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3178
- var _ref62 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61(errObj) {
3179
- return _regenerator.default.wrap(function (_context61) {
3180
- while (1) switch (_context61.prev = _context61.next) {
3575
+ var _ref74 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64(errObj) {
3576
+ return _regenerator.default.wrap(function (_context64) {
3577
+ while (1) switch (_context64.prev = _context64.next) {
3181
3578
  case 0:
3182
3579
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3183
3580
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3184
3581
  case 1:
3185
3582
  case "end":
3186
- return _context61.stop();
3583
+ return _context64.stop();
3187
3584
  }
3188
- }, _callee61);
3585
+ }, _callee64);
3189
3586
  }));
3190
3587
  return function (_x9) {
3191
- return _ref62.apply(this, arguments);
3588
+ return _ref74.apply(this, arguments);
3192
3589
  };
3193
3590
  }());
3194
3591
  call.doHoldResume();
3195
- _context62.next = 1;
3592
+ _context65.next = 1;
3196
3593
  return (0, _testUtil.flushPromises)(2);
3197
3594
  case 1:
3198
3595
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
@@ -3203,7 +3600,7 @@ describe('Supplementary Services tests', function () {
3203
3600
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3204
3601
  /* We are intentionally failing the ROAP ANSWER */
3205
3602
  roapEvent.data.type = 'ANSWER';
3206
- _context62.next = 2;
3603
+ _context65.next = 2;
3207
3604
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3208
3605
  case 2:
3209
3606
  expect(call.isHeld()).toStrictEqual(true);
@@ -3211,14 +3608,14 @@ describe('Supplementary Services tests', function () {
3211
3608
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3212
3609
  case 3:
3213
3610
  case "end":
3214
- return _context62.stop();
3611
+ return _context65.stop();
3215
3612
  }
3216
- }, _callee62);
3613
+ }, _callee65);
3217
3614
  })));
3218
- it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64() {
3615
+ it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67() {
3219
3616
  var responsePayload, roapEvent;
3220
- return _regenerator.default.wrap(function (_context64) {
3221
- while (1) switch (_context64.prev = _context64.next) {
3617
+ return _regenerator.default.wrap(function (_context67) {
3618
+ while (1) switch (_context67.prev = _context67.next) {
3222
3619
  case 0:
3223
3620
  expect.assertions(5);
3224
3621
  responsePayload = {
@@ -3228,24 +3625,24 @@ describe('Supplementary Services tests', function () {
3228
3625
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
3229
3626
  call['held'] = true;
3230
3627
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3231
- var _ref64 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63(errObj) {
3232
- return _regenerator.default.wrap(function (_context63) {
3233
- while (1) switch (_context63.prev = _context63.next) {
3628
+ var _ref76 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66(errObj) {
3629
+ return _regenerator.default.wrap(function (_context66) {
3630
+ while (1) switch (_context66.prev = _context66.next) {
3234
3631
  case 0:
3235
3632
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
3236
3633
  expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
3237
3634
  case 1:
3238
3635
  case "end":
3239
- return _context63.stop();
3636
+ return _context66.stop();
3240
3637
  }
3241
- }, _callee63);
3638
+ }, _callee66);
3242
3639
  }));
3243
3640
  return function (_x0) {
3244
- return _ref64.apply(this, arguments);
3641
+ return _ref76.apply(this, arguments);
3245
3642
  };
3246
3643
  }());
3247
3644
  call.doHoldResume();
3248
- _context64.next = 1;
3645
+ _context67.next = 1;
3249
3646
  return (0, _testUtil.flushPromises)(2);
3250
3647
  case 1:
3251
3648
  /* At this point ,the Call State should be S_CALL_RESUME
@@ -3258,11 +3655,11 @@ describe('Supplementary Services tests', function () {
3258
3655
  call['handleIncomingRoapOffer']({}, dummyEvent);
3259
3656
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3260
3657
  roapEvent.data.type = 'ANSWER';
3261
- _context64.next = 2;
3658
+ _context67.next = 2;
3262
3659
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3263
3660
  case 2:
3264
3661
  roapEvent.data.type = 'OK';
3265
- _context64.next = 3;
3662
+ _context67.next = 3;
3266
3663
  return call['handleRoapEstablished']({}, dummyEvent);
3267
3664
  case 3:
3268
3665
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -3272,9 +3669,9 @@ describe('Supplementary Services tests', function () {
3272
3669
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3273
3670
  case 4:
3274
3671
  case "end":
3275
- return _context64.stop();
3672
+ return _context67.stop();
3276
3673
  }
3277
- }, _callee64);
3674
+ }, _callee67);
3278
3675
  })));
3279
3676
  });
3280
3677
  describe('Call transfer tests', function () {
@@ -3307,10 +3704,10 @@ describe('Supplementary Services tests', function () {
3307
3704
  secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
3308
3705
  secondCall['held'] = false;
3309
3706
  });
3310
- it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67() {
3707
+ it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
3311
3708
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3312
- return _regenerator.default.wrap(function (_context67) {
3313
- while (1) switch (_context67.prev = _context67.next) {
3709
+ return _regenerator.default.wrap(function (_context70) {
3710
+ while (1) switch (_context70.prev = _context70.next) {
3314
3711
  case 0:
3315
3712
  expect.assertions(12); // Updated to match actual assertion count
3316
3713
  responsePayload = {
@@ -3322,41 +3719,41 @@ describe('Supplementary Services tests', function () {
3322
3719
  infoSpy = jest.spyOn(_Logger.default, 'info');
3323
3720
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3324
3721
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3325
- var _ref66 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65(correlationId) {
3326
- return _regenerator.default.wrap(function (_context65) {
3327
- while (1) switch (_context65.prev = _context65.next) {
3722
+ var _ref78 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68(correlationId) {
3723
+ return _regenerator.default.wrap(function (_context68) {
3724
+ while (1) switch (_context68.prev = _context68.next) {
3328
3725
  case 0:
3329
3726
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3330
3727
  case 1:
3331
3728
  case "end":
3332
- return _context65.stop();
3729
+ return _context68.stop();
3333
3730
  }
3334
- }, _callee65);
3731
+ }, _callee68);
3335
3732
  }));
3336
3733
  return function (_x1) {
3337
- return _ref66.apply(this, arguments);
3734
+ return _ref78.apply(this, arguments);
3338
3735
  };
3339
3736
  }());
3340
3737
  secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3341
- var _ref67 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66(correlationId) {
3342
- return _regenerator.default.wrap(function (_context66) {
3343
- while (1) switch (_context66.prev = _context66.next) {
3738
+ var _ref79 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69(correlationId) {
3739
+ return _regenerator.default.wrap(function (_context69) {
3740
+ while (1) switch (_context69.prev = _context69.next) {
3344
3741
  case 0:
3345
3742
  expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
3346
3743
  case 1:
3347
3744
  case "end":
3348
- return _context66.stop();
3745
+ return _context69.stop();
3349
3746
  }
3350
- }, _callee66);
3747
+ }, _callee69);
3351
3748
  }));
3352
3749
  return function (_x10) {
3353
- return _ref67.apply(this, arguments);
3750
+ return _ref79.apply(this, arguments);
3354
3751
  };
3355
3752
  }());
3356
- _context67.next = 1;
3753
+ _context70.next = 1;
3357
3754
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3358
3755
  case 1:
3359
- _context67.next = 2;
3756
+ _context70.next = 2;
3360
3757
  return (0, _testUtil.flushPromises)(2);
3361
3758
  case 2:
3362
3759
  expect(requestSpy).toBeCalled();
@@ -3379,14 +3776,14 @@ describe('Supplementary Services tests', function () {
3379
3776
  expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3380
3777
  case 3:
3381
3778
  case "end":
3382
- return _context67.stop();
3779
+ return _context70.stop();
3383
3780
  }
3384
- }, _callee67);
3781
+ }, _callee70);
3385
3782
  })));
3386
- it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69() {
3783
+ it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3387
3784
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3388
- return _regenerator.default.wrap(function (_context69) {
3389
- while (1) switch (_context69.prev = _context69.next) {
3785
+ return _regenerator.default.wrap(function (_context72) {
3786
+ while (1) switch (_context72.prev = _context72.next) {
3390
3787
  case 0:
3391
3788
  expect.assertions(10); // Updated to match actual assertion count
3392
3789
  responsePayload = {
@@ -3398,25 +3795,25 @@ describe('Supplementary Services tests', function () {
3398
3795
  infoSpy = jest.spyOn(_Logger.default, 'info');
3399
3796
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3400
3797
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3401
- var _ref69 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68(correlationId) {
3402
- return _regenerator.default.wrap(function (_context68) {
3403
- while (1) switch (_context68.prev = _context68.next) {
3798
+ var _ref81 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71(correlationId) {
3799
+ return _regenerator.default.wrap(function (_context71) {
3800
+ while (1) switch (_context71.prev = _context71.next) {
3404
3801
  case 0:
3405
3802
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3406
3803
  case 1:
3407
3804
  case "end":
3408
- return _context68.stop();
3805
+ return _context71.stop();
3409
3806
  }
3410
- }, _callee68);
3807
+ }, _callee71);
3411
3808
  }));
3412
3809
  return function (_x11) {
3413
- return _ref69.apply(this, arguments);
3810
+ return _ref81.apply(this, arguments);
3414
3811
  };
3415
3812
  }());
3416
- _context69.next = 1;
3813
+ _context72.next = 1;
3417
3814
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3418
3815
  case 1:
3419
- _context69.next = 2;
3816
+ _context72.next = 2;
3420
3817
  return (0, _testUtil.flushPromises)(2);
3421
3818
  case 2:
3422
3819
  expect(requestSpy).toBeCalled();
@@ -3435,14 +3832,14 @@ describe('Supplementary Services tests', function () {
3435
3832
  expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3436
3833
  case 3:
3437
3834
  case "end":
3438
- return _context69.stop();
3835
+ return _context72.stop();
3439
3836
  }
3440
- }, _callee69);
3837
+ }, _callee72);
3441
3838
  })));
3442
- it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
3839
+ it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
3443
3840
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3444
- return _regenerator.default.wrap(function (_context70) {
3445
- while (1) switch (_context70.prev = _context70.next) {
3841
+ return _regenerator.default.wrap(function (_context73) {
3842
+ while (1) switch (_context73.prev = _context73.next) {
3446
3843
  case 0:
3447
3844
  responsePayload = {
3448
3845
  statusCode: 403,
@@ -3453,10 +3850,10 @@ describe('Supplementary Services tests', function () {
3453
3850
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3454
3851
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3455
3852
  call['broadworksCorrelationInfo'] = 'dummy-broadworks-correlation-info';
3456
- _context70.next = 1;
3853
+ _context73.next = 1;
3457
3854
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3458
3855
  case 1:
3459
- _context70.next = 2;
3856
+ _context73.next = 2;
3460
3857
  return (0, _testUtil.flushPromises)(1);
3461
3858
  case 2:
3462
3859
  expect(requestSpy).toBeCalled();
@@ -3477,14 +3874,14 @@ describe('Supplementary Services tests', function () {
3477
3874
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
3478
3875
  case 3:
3479
3876
  case "end":
3480
- return _context70.stop();
3877
+ return _context73.stop();
3481
3878
  }
3482
- }, _callee70);
3879
+ }, _callee73);
3483
3880
  })));
3484
- it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
3881
+ it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee74() {
3485
3882
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3486
- return _regenerator.default.wrap(function (_context71) {
3487
- while (1) switch (_context71.prev = _context71.next) {
3883
+ return _regenerator.default.wrap(function (_context74) {
3884
+ while (1) switch (_context74.prev = _context74.next) {
3488
3885
  case 0:
3489
3886
  responsePayload = {
3490
3887
  statusCode: 403,
@@ -3494,10 +3891,10 @@ describe('Supplementary Services tests', function () {
3494
3891
  requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3495
3892
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3496
3893
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3497
- _context71.next = 1;
3894
+ _context74.next = 1;
3498
3895
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3499
3896
  case 1:
3500
- _context71.next = 2;
3897
+ _context74.next = 2;
3501
3898
  return (0, _testUtil.flushPromises)(2);
3502
3899
  case 2:
3503
3900
  expect(requestSpy).toBeCalled();
@@ -3518,18 +3915,18 @@ describe('Supplementary Services tests', function () {
3518
3915
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
3519
3916
  case 3:
3520
3917
  case "end":
3521
- return _context71.stop();
3918
+ return _context74.stop();
3522
3919
  }
3523
- }, _callee71);
3920
+ }, _callee74);
3524
3921
  })));
3525
- it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3922
+ it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee75() {
3526
3923
  var requestSpy, warnSpy;
3527
- return _regenerator.default.wrap(function (_context72) {
3528
- while (1) switch (_context72.prev = _context72.next) {
3924
+ return _regenerator.default.wrap(function (_context75) {
3925
+ while (1) switch (_context75.prev = _context75.next) {
3529
3926
  case 0:
3530
3927
  requestSpy = jest.spyOn(webex, 'request');
3531
3928
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3532
- _context72.next = 1;
3929
+ _context75.next = 1;
3533
3930
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
3534
3931
  case 1:
3535
3932
  /* We should be in CALL_ESTABLISHED state */
@@ -3541,18 +3938,18 @@ describe('Supplementary Services tests', function () {
3541
3938
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3542
3939
  case 2:
3543
3940
  case "end":
3544
- return _context72.stop();
3941
+ return _context75.stop();
3545
3942
  }
3546
- }, _callee72);
3943
+ }, _callee75);
3547
3944
  })));
3548
- it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
3945
+ it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee76() {
3549
3946
  var requestSpy, warnSpy;
3550
- return _regenerator.default.wrap(function (_context73) {
3551
- while (1) switch (_context73.prev = _context73.next) {
3947
+ return _regenerator.default.wrap(function (_context76) {
3948
+ while (1) switch (_context76.prev = _context76.next) {
3552
3949
  case 0:
3553
3950
  requestSpy = jest.spyOn(webex, 'request');
3554
3951
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3555
- _context73.next = 1;
3952
+ _context76.next = 1;
3556
3953
  return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
3557
3954
  case 1:
3558
3955
  /* We should be in CALL_ESTABLISHED state */
@@ -3564,9 +3961,9 @@ describe('Supplementary Services tests', function () {
3564
3961
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3565
3962
  case 2:
3566
3963
  case "end":
3567
- return _context73.stop();
3964
+ return _context76.stop();
3568
3965
  }
3569
- }, _callee73);
3966
+ }, _callee76);
3570
3967
  })));
3571
3968
  });
3572
3969
  });