@webex/calling 3.12.0 → 3.13.0-next.10

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 (326) hide show
  1. package/README.md +1 -1
  2. package/dist/CallHistory/CallHistory.js +1 -1
  3. package/dist/CallHistory/CallHistory.js.map +1 -1
  4. package/dist/CallHistory/CallHistory.test.js +2 -1
  5. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  6. package/dist/CallQueue/CallQueue.js +1322 -0
  7. package/dist/CallQueue/CallQueue.js.map +1 -0
  8. package/dist/CallQueue/CallQueue.test.js +3321 -0
  9. package/dist/CallQueue/CallQueue.test.js.map +1 -0
  10. package/dist/CallQueue/constants.js +65 -0
  11. package/dist/CallQueue/constants.js.map +1 -0
  12. package/dist/CallQueue/types.js +4 -0
  13. package/dist/CallQueue/types.js.map +1 -0
  14. package/dist/CallQueue/utils.js +370 -0
  15. package/dist/CallQueue/utils.js.map +1 -0
  16. package/dist/CallQueue/utils.test.js +548 -0
  17. package/dist/CallQueue/utils.test.js.map +1 -0
  18. package/dist/CallRecording/CallRecording.js +160 -0
  19. package/dist/CallRecording/CallRecording.js.map +1 -0
  20. package/dist/CallRecording/CallRecording.test.js +257 -0
  21. package/dist/CallRecording/CallRecording.test.js.map +1 -0
  22. package/dist/CallRecording/WxcCallRecordingConnector.js +748 -0
  23. package/dist/CallRecording/WxcCallRecordingConnector.js.map +1 -0
  24. package/dist/CallRecording/WxcCallRecordingConnector.test.js +824 -0
  25. package/dist/CallRecording/WxcCallRecordingConnector.test.js.map +1 -0
  26. package/dist/CallRecording/callRecordingFixtures.js +266 -0
  27. package/dist/CallRecording/callRecordingFixtures.js.map +1 -0
  28. package/dist/CallRecording/constants.js +35 -0
  29. package/dist/CallRecording/constants.js.map +1 -0
  30. package/dist/CallRecording/types.js +142 -0
  31. package/dist/CallRecording/types.js.map +1 -0
  32. package/dist/CallRecording/userhub.js +117 -0
  33. package/dist/CallRecording/userhub.js.map +1 -0
  34. package/dist/CallRecording/utils.js +42 -0
  35. package/dist/CallRecording/utils.js.map +1 -0
  36. package/dist/CallRecording/utils.test.js +97 -0
  37. package/dist/CallRecording/utils.test.js.map +1 -0
  38. package/dist/CallingClient/CallingClient.js +469 -233
  39. package/dist/CallingClient/CallingClient.js.map +1 -1
  40. package/dist/CallingClient/CallingClient.test.js +736 -179
  41. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  42. package/dist/CallingClient/calling/CallerId/index.js +3 -1
  43. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  44. package/dist/CallingClient/calling/CallerId/index.test.js +12 -2
  45. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  46. package/dist/CallingClient/calling/call.js +645 -458
  47. package/dist/CallingClient/calling/call.js.map +1 -1
  48. package/dist/CallingClient/calling/call.test.js +928 -498
  49. package/dist/CallingClient/calling/call.test.js.map +1 -1
  50. package/dist/CallingClient/calling/callManager.js +106 -35
  51. package/dist/CallingClient/calling/callManager.js.map +1 -1
  52. package/dist/CallingClient/calling/callManager.test.js +140 -0
  53. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  54. package/dist/CallingClient/calling/types.js +5 -0
  55. package/dist/CallingClient/calling/types.js.map +1 -1
  56. package/dist/CallingClient/constants.js +34 -4
  57. package/dist/CallingClient/constants.js.map +1 -1
  58. package/dist/CallingClient/line/index.js +27 -3
  59. package/dist/CallingClient/line/index.js.map +1 -1
  60. package/dist/CallingClient/line/line.test.js +102 -17
  61. package/dist/CallingClient/line/line.test.js.map +1 -1
  62. package/dist/CallingClient/registration/register.js +971 -506
  63. package/dist/CallingClient/registration/register.js.map +1 -1
  64. package/dist/CallingClient/registration/register.test.js +1037 -116
  65. package/dist/CallingClient/registration/register.test.js.map +1 -1
  66. package/dist/CallingClient/registration/types.js +26 -0
  67. package/dist/CallingClient/registration/types.js.map +1 -1
  68. package/dist/CallingClient/registration/webWorker.js +41 -104
  69. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  70. package/dist/CallingClient/registration/webWorker.test.js +39 -153
  71. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  72. package/dist/CallingClient/registration/webWorkerStr.js +1 -1
  73. package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
  74. package/dist/CallingClient/types.js +7 -0
  75. package/dist/CallingClient/types.js.map +1 -1
  76. package/dist/CallingClient/utils/constants.js +58 -0
  77. package/dist/CallingClient/utils/constants.js.map +1 -0
  78. package/dist/CallingClient/utils/index.js +63 -0
  79. package/dist/CallingClient/utils/index.js.map +1 -0
  80. package/dist/CallingClient/utils/mobiusSocketMapper.js +122 -0
  81. package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -0
  82. package/dist/CallingClient/utils/mobiusSocketMapper.test.js +221 -0
  83. package/dist/CallingClient/utils/mobiusSocketMapper.test.js.map +1 -0
  84. package/dist/CallingClient/utils/request.js +435 -0
  85. package/dist/CallingClient/utils/request.js.map +1 -0
  86. package/dist/CallingClient/utils/request.test.js +999 -0
  87. package/dist/CallingClient/utils/request.test.js.map +1 -0
  88. package/dist/CallingClient/utils/types.js +7 -0
  89. package/dist/CallingClient/utils/types.js.map +1 -0
  90. package/dist/CallingClient/utils/wsFeatureFlag.js +70 -0
  91. package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -0
  92. package/dist/CallingClient/utils/wsFeatureFlag.test.js +139 -0
  93. package/dist/CallingClient/utils/wsFeatureFlag.test.js.map +1 -0
  94. package/dist/Contacts/ContactsClient.js +13 -11
  95. package/dist/Contacts/ContactsClient.js.map +1 -1
  96. package/dist/Contacts/ContactsClient.test.js +3 -8
  97. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  98. package/dist/Errors/types.js +2 -0
  99. package/dist/Errors/types.js.map +1 -1
  100. package/dist/Events/types.js +39 -11
  101. package/dist/Events/types.js.map +1 -1
  102. package/dist/Metrics/index.js +63 -2
  103. package/dist/Metrics/index.js.map +1 -1
  104. package/dist/Metrics/index.test.js +357 -1
  105. package/dist/Metrics/index.test.js.map +1 -1
  106. package/dist/Metrics/types.js +19 -1
  107. package/dist/Metrics/types.js.map +1 -1
  108. package/dist/SDKConnector/types.js.map +1 -1
  109. package/dist/Voicemail/Voicemail.js +10 -10
  110. package/dist/Voicemail/Voicemail.js.map +1 -1
  111. package/dist/Voicemail/Voicemail.test.js +40 -20
  112. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  113. package/dist/api.js +95 -0
  114. package/dist/api.js.map +1 -1
  115. package/dist/common/Utils.js +259 -133
  116. package/dist/common/Utils.js.map +1 -1
  117. package/dist/common/Utils.test.js +643 -298
  118. package/dist/common/Utils.test.js.map +1 -1
  119. package/dist/common/callUtils.js +187 -0
  120. package/dist/common/callUtils.js.map +1 -0
  121. package/dist/common/callUtils.test.js +313 -0
  122. package/dist/common/callUtils.test.js.map +1 -0
  123. package/dist/common/constants.js +27 -1
  124. package/dist/common/constants.js.map +1 -1
  125. package/dist/common/index.js +11 -0
  126. package/dist/common/index.js.map +1 -1
  127. package/dist/common/testUtil.js +11 -5
  128. package/dist/common/testUtil.js.map +1 -1
  129. package/dist/common/types.js +3 -0
  130. package/dist/common/types.js.map +1 -1
  131. package/dist/index.js +228 -40
  132. package/dist/index.js.map +1 -1
  133. package/dist/mobius-socket/config.js +24 -0
  134. package/dist/mobius-socket/config.js.map +1 -0
  135. package/dist/mobius-socket/errors.js +143 -0
  136. package/dist/mobius-socket/errors.js.map +1 -0
  137. package/dist/mobius-socket/errors.test.js +20 -0
  138. package/dist/mobius-socket/errors.test.js.map +1 -0
  139. package/dist/mobius-socket/index.js +57 -0
  140. package/dist/mobius-socket/index.js.map +1 -0
  141. package/dist/mobius-socket/mobius-socket-events.test.js +493 -0
  142. package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -0
  143. package/dist/mobius-socket/mobius-socket.js +849 -0
  144. package/dist/mobius-socket/mobius-socket.js.map +1 -0
  145. package/dist/mobius-socket/mobius-socket.test.js +1898 -0
  146. package/dist/mobius-socket/mobius-socket.test.js.map +1 -0
  147. package/dist/mobius-socket/socket/constants.js +55 -0
  148. package/dist/mobius-socket/socket/constants.js.map +1 -0
  149. package/dist/mobius-socket/socket/index.js +15 -0
  150. package/dist/mobius-socket/socket/index.js.map +1 -0
  151. package/dist/mobius-socket/socket/socket-base.js +614 -0
  152. package/dist/mobius-socket/socket/socket-base.js.map +1 -0
  153. package/dist/mobius-socket/socket/socket.js +19 -0
  154. package/dist/mobius-socket/socket/socket.js.map +1 -0
  155. package/dist/mobius-socket/socket/socket.shim.js +26 -0
  156. package/dist/mobius-socket/socket/socket.shim.js.map +1 -0
  157. package/dist/mobius-socket/socket/types.js +7 -0
  158. package/dist/mobius-socket/socket/types.js.map +1 -0
  159. package/dist/mobius-socket/socket.test.js +747 -0
  160. package/dist/mobius-socket/socket.test.js.map +1 -0
  161. package/dist/mobius-socket/test/mocha-helpers.js +23 -0
  162. package/dist/mobius-socket/test/mocha-helpers.js.map +1 -0
  163. package/dist/mobius-socket/test/promise-tick.js +28 -0
  164. package/dist/mobius-socket/test/promise-tick.js.map +1 -0
  165. package/dist/mobius-socket/types.js +7 -0
  166. package/dist/mobius-socket/types.js.map +1 -0
  167. package/dist/module/CallHistory/CallHistory.js +1 -1
  168. package/dist/module/CallQueue/CallQueue.js +718 -0
  169. package/dist/module/CallQueue/constants.js +41 -0
  170. package/dist/module/CallQueue/types.js +1 -0
  171. package/dist/module/CallQueue/utils.js +253 -0
  172. package/dist/module/CallRecording/CallRecording.js +56 -0
  173. package/dist/module/CallRecording/WxcCallRecordingConnector.js +349 -0
  174. package/dist/module/CallRecording/callRecordingFixtures.js +231 -0
  175. package/dist/module/CallRecording/constants.js +27 -0
  176. package/dist/module/CallRecording/types.js +19 -0
  177. package/dist/module/CallRecording/userhub.js +100 -0
  178. package/dist/module/CallRecording/utils.js +14 -0
  179. package/dist/module/CallingClient/CallingClient.js +137 -20
  180. package/dist/module/CallingClient/calling/CallerId/index.js +2 -2
  181. package/dist/module/CallingClient/calling/call.js +207 -68
  182. package/dist/module/CallingClient/calling/callManager.js +51 -11
  183. package/dist/module/CallingClient/calling/types.js +2 -0
  184. package/dist/module/CallingClient/constants.js +29 -1
  185. package/dist/module/CallingClient/line/index.js +11 -3
  186. package/dist/module/CallingClient/registration/register.js +297 -68
  187. package/dist/module/CallingClient/registration/types.js +5 -1
  188. package/dist/module/CallingClient/registration/webWorker.js +42 -61
  189. package/dist/module/CallingClient/registration/webWorkerStr.js +47 -82
  190. package/dist/module/CallingClient/utils/constants.js +36 -0
  191. package/dist/module/CallingClient/utils/index.js +5 -0
  192. package/dist/module/CallingClient/utils/mobiusSocketMapper.js +72 -0
  193. package/dist/module/CallingClient/utils/request.js +211 -0
  194. package/dist/module/CallingClient/utils/types.js +1 -0
  195. package/dist/module/CallingClient/utils/wsFeatureFlag.js +41 -0
  196. package/dist/module/Contacts/ContactsClient.js +1 -1
  197. package/dist/module/Errors/types.js +2 -0
  198. package/dist/module/Events/types.js +24 -10
  199. package/dist/module/Metrics/index.js +48 -1
  200. package/dist/module/Metrics/types.js +18 -0
  201. package/dist/module/Voicemail/Voicemail.js +10 -10
  202. package/dist/module/api.js +6 -2
  203. package/dist/module/common/Utils.js +110 -63
  204. package/dist/module/common/callUtils.js +90 -0
  205. package/dist/module/common/constants.js +11 -0
  206. package/dist/module/common/index.js +1 -0
  207. package/dist/module/common/testUtil.js +7 -1
  208. package/dist/module/common/types.js +3 -0
  209. package/dist/module/index.js +10 -3
  210. package/dist/module/mobius-socket/config.js +15 -0
  211. package/dist/module/mobius-socket/errors.js +58 -0
  212. package/dist/module/mobius-socket/index.js +24 -0
  213. package/dist/module/mobius-socket/mobius-socket.js +593 -0
  214. package/dist/module/mobius-socket/socket/constants.js +26 -0
  215. package/dist/module/mobius-socket/socket/index.js +4 -0
  216. package/dist/module/mobius-socket/socket/socket-base.js +376 -0
  217. package/dist/module/mobius-socket/socket/socket.js +9 -0
  218. package/dist/module/mobius-socket/socket/socket.shim.js +12 -0
  219. package/dist/module/mobius-socket/socket/types.js +1 -0
  220. package/dist/module/mobius-socket/types.js +1 -0
  221. package/dist/types/CallQueue/CallQueue.d.ts +45 -0
  222. package/dist/types/CallQueue/CallQueue.d.ts.map +1 -0
  223. package/dist/types/CallQueue/constants.d.ts +37 -0
  224. package/dist/types/CallQueue/constants.d.ts.map +1 -0
  225. package/dist/types/CallQueue/types.d.ts +97 -0
  226. package/dist/types/CallQueue/types.d.ts.map +1 -0
  227. package/dist/types/CallQueue/utils.d.ts +19 -0
  228. package/dist/types/CallQueue/utils.d.ts.map +1 -0
  229. package/dist/types/CallRecording/CallRecording.d.ts +18 -0
  230. package/dist/types/CallRecording/CallRecording.d.ts.map +1 -0
  231. package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts +27 -0
  232. package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts.map +1 -0
  233. package/dist/types/CallRecording/callRecordingFixtures.d.ts +152 -0
  234. package/dist/types/CallRecording/callRecordingFixtures.d.ts.map +1 -0
  235. package/dist/types/CallRecording/constants.d.ts +28 -0
  236. package/dist/types/CallRecording/constants.d.ts.map +1 -0
  237. package/dist/types/CallRecording/types.d.ts +184 -0
  238. package/dist/types/CallRecording/types.d.ts.map +1 -0
  239. package/dist/types/CallRecording/userhub.d.ts +44 -0
  240. package/dist/types/CallRecording/userhub.d.ts.map +1 -0
  241. package/dist/types/CallRecording/utils.d.ts +3 -0
  242. package/dist/types/CallRecording/utils.d.ts.map +1 -0
  243. package/dist/types/CallingClient/CallingClient.d.ts +8 -0
  244. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  245. package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
  246. package/dist/types/CallingClient/calling/call.d.ts +17 -3
  247. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  248. package/dist/types/CallingClient/calling/callManager.d.ts +8 -4
  249. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  250. package/dist/types/CallingClient/calling/types.d.ts +38 -9
  251. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  252. package/dist/types/CallingClient/constants.d.ts +29 -1
  253. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  254. package/dist/types/CallingClient/line/index.d.ts +3 -2
  255. package/dist/types/CallingClient/line/index.d.ts.map +1 -1
  256. package/dist/types/CallingClient/registration/register.d.ts +9 -1
  257. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  258. package/dist/types/CallingClient/registration/types.d.ts +26 -2
  259. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  260. package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
  261. package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
  262. package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
  263. package/dist/types/CallingClient/types.d.ts +6 -2
  264. package/dist/types/CallingClient/types.d.ts.map +1 -1
  265. package/dist/types/CallingClient/utils/constants.d.ts +35 -0
  266. package/dist/types/CallingClient/utils/constants.d.ts.map +1 -0
  267. package/dist/types/CallingClient/utils/index.d.ts +6 -0
  268. package/dist/types/CallingClient/utils/index.d.ts.map +1 -0
  269. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts +5 -0
  270. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -0
  271. package/dist/types/CallingClient/utils/request.d.ts +28 -0
  272. package/dist/types/CallingClient/utils/request.d.ts.map +1 -0
  273. package/dist/types/CallingClient/utils/types.d.ts +34 -0
  274. package/dist/types/CallingClient/utils/types.d.ts.map +1 -0
  275. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts +4 -0
  276. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -0
  277. package/dist/types/Errors/types.d.ts +2 -0
  278. package/dist/types/Errors/types.d.ts.map +1 -1
  279. package/dist/types/Events/types.d.ts +81 -16
  280. package/dist/types/Events/types.d.ts.map +1 -1
  281. package/dist/types/Metrics/index.d.ts.map +1 -1
  282. package/dist/types/Metrics/types.d.ts +19 -2
  283. package/dist/types/Metrics/types.d.ts.map +1 -1
  284. package/dist/types/SDKConnector/types.d.ts +41 -13
  285. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  286. package/dist/types/api.d.ts +10 -4
  287. package/dist/types/api.d.ts.map +1 -1
  288. package/dist/types/common/Utils.d.ts +11 -5
  289. package/dist/types/common/Utils.d.ts.map +1 -1
  290. package/dist/types/common/callUtils.d.ts +6 -0
  291. package/dist/types/common/callUtils.d.ts.map +1 -0
  292. package/dist/types/common/constants.d.ts +6 -0
  293. package/dist/types/common/constants.d.ts.map +1 -1
  294. package/dist/types/common/index.d.ts +1 -0
  295. package/dist/types/common/index.d.ts.map +1 -1
  296. package/dist/types/common/testUtil.d.ts +6 -1
  297. package/dist/types/common/testUtil.d.ts.map +1 -1
  298. package/dist/types/common/types.d.ts +5 -1
  299. package/dist/types/common/types.d.ts.map +1 -1
  300. package/dist/types/index.d.ts +13 -4
  301. package/dist/types/index.d.ts.map +1 -1
  302. package/dist/types/mobius-socket/config.d.ts +17 -0
  303. package/dist/types/mobius-socket/config.d.ts.map +1 -0
  304. package/dist/types/mobius-socket/errors.d.ts +32 -0
  305. package/dist/types/mobius-socket/errors.d.ts.map +1 -0
  306. package/dist/types/mobius-socket/index.d.ts +14 -0
  307. package/dist/types/mobius-socket/index.d.ts.map +1 -0
  308. package/dist/types/mobius-socket/mobius-socket.d.ts +48 -0
  309. package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -0
  310. package/dist/types/mobius-socket/socket/constants.d.ts +27 -0
  311. package/dist/types/mobius-socket/socket/constants.d.ts.map +1 -0
  312. package/dist/types/mobius-socket/socket/index.d.ts +5 -0
  313. package/dist/types/mobius-socket/socket/index.d.ts.map +1 -0
  314. package/dist/types/mobius-socket/socket/socket-base.d.ts +43 -0
  315. package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -0
  316. package/dist/types/mobius-socket/socket/socket.d.ts +6 -0
  317. package/dist/types/mobius-socket/socket/socket.d.ts.map +1 -0
  318. package/dist/types/mobius-socket/socket/socket.shim.d.ts +6 -0
  319. package/dist/types/mobius-socket/socket/socket.shim.d.ts.map +1 -0
  320. package/dist/types/mobius-socket/socket/types.d.ts +61 -0
  321. package/dist/types/mobius-socket/socket/types.d.ts.map +1 -0
  322. package/dist/types/mobius-socket/types.d.ts +21 -0
  323. package/dist/types/mobius-socket/types.d.ts.map +1 -0
  324. package/package.json +21 -18
  325. package/src/mobius-socket/socket/socket.shim.ts +22 -0
  326. package/src/mobius-socket/socket/socket.ts +14 -0
@@ -1,15 +1,21 @@
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
21
  var _mediaHelpers = require("@webex/media-helpers");
@@ -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 () {
@@ -232,6 +249,9 @@ describe('Call Tests', function () {
232
249
  // Need to add a small delay for Promise and callback to finish.
233
250
  expect(parseMediaQualityStatisticsMock).toHaveBeenCalledTimes(1);
234
251
  expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
252
+ expect(webex.request.mock.calls[0][0].body.callId).toBe(call.getCallId().replace("".concat(_constants.DEFAULT_LOCAL_CALL_ID, "_"), ''));
253
+ expect(webex.request.mock.calls[0][0].body.callId).not.toContain(_constants.DEFAULT_LOCAL_CALL_ID);
254
+ expect(webex.request.mock.calls[0][0].body.callId).not.toMatch(/^_/);
235
255
  expect(call.getDisconnectReason().code).toBe(_types5.DisconnectCode.NORMAL);
236
256
  expect(call.getDisconnectReason().cause).toBe(_types5.DisconnectCause.NORMAL);
237
257
 
@@ -280,14 +300,83 @@ describe('Call Tests', function () {
280
300
  }
281
301
  }, _callee3);
282
302
  })));
283
- it('check whether callerId midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
303
+ describe('Host ips in the call payloads', function () {
304
+ var sdpWithHostCandidate = ['v=0', 'm=audio 9 UDP/TLS/RTP/SAVPF 111', 'a=candidate:1 1 UDP 2130706431 10.0.0.5 54321 typ host generation 0'].join('\r\n');
305
+ beforeEach(function () {
306
+ webex.request.mockReturnValue({
307
+ statusCode: 200,
308
+ body: {
309
+ device: {
310
+ deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010',
311
+ correlationId: '8a67806f-fc4d-446b-a131-31e71ea5b011'
312
+ },
313
+ callId: '8a67806f-fc4d-446b-a131-31e71ea5b020'
314
+ }
315
+ });
316
+ });
317
+ it.each([['post', 'the host candidates of the offer', {
318
+ sdp: sdpWithHostCandidate
319
+ }, ['10.0.0.5']], ['post', 'nothing when the roap message carries no sdp', {}, []], ['post', 'nothing when the state machine dispatches no roap message', undefined, []], ['postMedia', 'the host candidates of the offer', {
320
+ sdp: sdpWithHostCandidate
321
+ }, ['10.0.0.5']], ['postMedia', 'nothing when the roap message carries no sdp', {}, []], ['postMedia', 'nothing when the state machine dispatches no roap message', undefined, []]])('%s reports %s', /*#__PURE__*/function () {
322
+ var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(method, _name, roapMessage, expected) {
323
+ var call;
324
+ return _regenerator.default.wrap(function (_context4) {
325
+ while (1) switch (_context4.prev = _context4.next) {
326
+ case 0:
327
+ call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
328
+ _context4.next = 1;
329
+ return call[method](roapMessage);
330
+ case 1:
331
+ expect(webex.request.mock.calls[0][0].body.hostIps).toEqual(expected);
332
+ case 2:
333
+ case "end":
334
+ return _context4.stop();
335
+ }
336
+ }, _callee4);
337
+ }));
338
+ return function (_x, _x2, _x3, _x4) {
339
+ return _ref4.apply(this, arguments);
340
+ };
341
+ }());
342
+ });
343
+ it('delete sends the server-assigned callId unchanged', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
344
+ var serverCallId, call;
345
+ return _regenerator.default.wrap(function (_context5) {
346
+ while (1) switch (_context5.prev = _context5.next) {
347
+ case 0:
348
+ serverCallId = '8a67806f-fc4d-446b-a131-31e71ea5b020';
349
+ webex.request.mockReturnValue({
350
+ statusCode: 200,
351
+ body: {
352
+ device: {
353
+ deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010',
354
+ correlationId: '8a67806f-fc4d-446b-a131-31e71ea5b011'
355
+ },
356
+ callId: serverCallId
357
+ }
358
+ });
359
+ call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
360
+ call.setCallId(serverCallId);
361
+ call.end();
362
+ _context5.next = 1;
363
+ return (0, _Utils.waitForMsecs)(50);
364
+ case 1:
365
+ expect(webex.request.mock.calls[0][0].body.callId).toBe(serverCallId);
366
+ case 2:
367
+ case "end":
368
+ return _context5.stop();
369
+ }
370
+ }, _callee5);
371
+ })));
372
+ it('check whether callerId midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
284
373
  var call;
285
- return _regenerator.default.wrap(function (_context4) {
286
- while (1) switch (_context4.prev = _context4.next) {
374
+ return _regenerator.default.wrap(function (_context6) {
375
+ while (1) switch (_context6.prev = _context6.next) {
287
376
  case 0:
288
377
  call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
289
378
  call.handleMidCallEvent(dummyMidCallEvent);
290
- _context4.next = 1;
379
+ _context6.next = 1;
291
380
  return (0, _Utils.waitForMsecs)(50);
292
381
  case 1:
293
382
  expect(call.getCallerInfo().name).toStrictEqual('Bob Marley');
@@ -295,20 +384,20 @@ describe('Call Tests', function () {
295
384
  expect(call.getCallerInfo().avatarSrc).toBeFalsy();
296
385
  case 2:
297
386
  case "end":
298
- return _context4.stop();
387
+ return _context6.stop();
299
388
  }
300
- }, _callee4);
389
+ }, _callee6);
301
390
  })));
302
- it('check whether call midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
391
+ it('check whether call midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
303
392
  var call, logSpy, corelationId;
304
- return _regenerator.default.wrap(function (_context5) {
305
- while (1) switch (_context5.prev = _context5.next) {
393
+ return _regenerator.default.wrap(function (_context7) {
394
+ while (1) switch (_context7.prev = _context7.next) {
306
395
  case 0:
307
396
  call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
308
397
  dummyMidCallEvent.eventType = 'callState';
309
398
  logSpy = jest.spyOn(_Logger.default, 'log');
310
399
  call.handleMidCallEvent(dummyMidCallEvent);
311
- _context5.next = 1;
400
+ _context7.next = 1;
312
401
  return (0, _Utils.waitForMsecs)(50);
313
402
  case 1:
314
403
  corelationId = call.getCorrelationId();
@@ -318,39 +407,39 @@ describe('Call Tests', function () {
318
407
  });
319
408
  case 2:
320
409
  case "end":
321
- return _context5.stop();
410
+ return _context7.stop();
322
411
  }
323
- }, _callee5);
412
+ }, _callee7);
324
413
  })));
325
- it('check call stats for active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
414
+ it('check call stats for active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
326
415
  var call, callRtpStats, _t;
327
- return _regenerator.default.wrap(function (_context6) {
328
- while (1) switch (_context6.prev = _context6.next) {
416
+ return _regenerator.default.wrap(function (_context8) {
417
+ while (1) switch (_context8.prev = _context8.next) {
329
418
  case 0:
330
419
  call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
331
- _context6.prev = 1;
332
- _context6.next = 2;
420
+ _context8.prev = 1;
421
+ _context8.next = 2;
333
422
  return call.getCallRtpStats();
334
423
  case 2:
335
- callRtpStats = _context6.sent;
336
- _context6.next = 4;
424
+ callRtpStats = _context8.sent;
425
+ _context8.next = 4;
337
426
  break;
338
427
  case 3:
339
- _context6.prev = 3;
340
- _t = _context6["catch"](1);
428
+ _context8.prev = 3;
429
+ _t = _context8["catch"](1);
341
430
  console.error(_t);
342
431
  case 4:
343
432
  expect(callRtpStats).toStrictEqual(disconnectStats);
344
433
  case 5:
345
434
  case "end":
346
- return _context6.stop();
435
+ return _context8.stop();
347
436
  }
348
- }, _callee6, null, [[1, 3]]);
437
+ }, _callee8, null, [[1, 3]]);
349
438
  })));
350
- it('dial functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
439
+ it('dial functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
351
440
  var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy, logSpy;
352
- return _regenerator.default.wrap(function (_context7) {
353
- while (1) switch (_context7.prev = _context7.next) {
441
+ return _regenerator.default.wrap(function (_context9) {
442
+ while (1) switch (_context9.prev = _context9.next) {
354
443
  case 0:
355
444
  mockStream = {
356
445
  outputStream: {
@@ -383,14 +472,14 @@ describe('Call Tests', function () {
383
472
  });
384
473
  case 1:
385
474
  case "end":
386
- return _context7.stop();
475
+ return _context9.stop();
387
476
  }
388
- }, _callee7);
477
+ }, _callee9);
389
478
  })));
390
- it('answer functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
479
+ it('answer functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
391
480
  var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy, infoSpy;
392
- return _regenerator.default.wrap(function (_context8) {
393
- while (1) switch (_context8.prev = _context8.next) {
481
+ return _regenerator.default.wrap(function (_context0) {
482
+ while (1) switch (_context0.prev = _context0.next) {
394
483
  case 0:
395
484
  mockStream = {
396
485
  outputStream: {
@@ -424,14 +513,309 @@ describe('Call Tests', function () {
424
513
  expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
425
514
  case 1:
426
515
  case "end":
427
- return _context8.stop();
516
+ return _context0.stop();
517
+ }
518
+ }, _callee0);
519
+ })));
520
+ it('registers and unregisters media connection listeners with stable handlers', function () {
521
+ var mockStream = {
522
+ outputStream: {
523
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
524
+ },
525
+ on: jest.fn(),
526
+ getEffectByKind: jest.fn().mockReturnValue(undefined)
527
+ };
528
+ var localAudioStream = mockStream;
529
+ var call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
530
+ call.dial(localAudioStream);
531
+ var mediaOnMock = call['mediaConnection'].on;
532
+ var mediaOffSpy = jest.spyOn(call['mediaConnection'], 'off');
533
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, expect.any(Function));
534
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_FAILURE, expect.any(Function));
535
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.REMOTE_TRACK_ADDED, expect.any(Function));
536
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, expect.any(Function));
537
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, expect.any(Function));
538
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, expect.any(Function));
539
+ expect(mediaOnMock).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CANDIDATE_ERROR, expect.any(Function));
540
+ call['unregisterMediaConnectionListeners']();
541
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, expect.any(Function));
542
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ROAP_FAILURE, expect.any(Function));
543
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.REMOTE_TRACK_ADDED, expect.any(Function));
544
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, expect.any(Function));
545
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, expect.any(Function));
546
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, expect.any(Function));
547
+ expect(mediaOffSpy).toBeCalledWith(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CANDIDATE_ERROR, expect.any(Function));
548
+ });
549
+ it('handles ICE listener payloads and submits metrics with event names', function () {
550
+ var mockStream = {
551
+ outputStream: {
552
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
553
+ },
554
+ on: jest.fn(),
555
+ getEffectByKind: jest.fn().mockReturnValue(undefined)
556
+ };
557
+ var localAudioStream = mockStream;
558
+ var call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
559
+ call.dial(localAudioStream);
560
+ var metricSpy = jest.spyOn(call['metricManager'], 'submitMediaMetric');
561
+ var warnSpy = jest.spyOn(_Logger.default, 'warn');
562
+ var getHandlerForEvent = function getHandlerForEvent(eventName) {
563
+ var _mock$calls$find;
564
+ return (_mock$calls$find = call['mediaConnection'].on.mock.calls.find(function (_ref1) {
565
+ var _ref10 = (0, _slicedToArray2.default)(_ref1, 1),
566
+ name = _ref10[0];
567
+ return name === eventName;
568
+ })) === null || _mock$calls$find === void 0 ? void 0 : _mock$calls$find[1];
569
+ };
570
+ var iceGatheringHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED);
571
+ var peerConnectionHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED);
572
+ var iceConnectionHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED);
573
+ var iceCandidateErrorHandler = getHandlerForEvent(InternalMediaCoreModule.MediaConnectionEventNames.ICE_CANDIDATE_ERROR);
574
+ iceGatheringHandler({
575
+ iceGatheringState: 'gathering'
576
+ });
577
+ peerConnectionHandler({
578
+ connectionState: 'connected'
579
+ });
580
+ iceConnectionHandler({
581
+ iceConnectionState: 'completed'
582
+ });
583
+ iceCandidateErrorHandler({
584
+ errorCode: 701,
585
+ errorText: 'STUN host lookup failed',
586
+ url: 'stun:example.org:3478'
587
+ });
588
+ 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');
589
+ 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');
590
+ 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');
591
+ 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));
592
+ var mediaErrorCall = metricSpy.mock.calls[3];
593
+ 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"}');
594
+ expect(warnSpy).toHaveBeenCalledWith('ICE candidate error occurred: {"address":null,"errorCode":701,"errorText":"STUN host lookup failed","port":null,"url":"stun:example.org:3478"}', {
595
+ file: 'call',
596
+ method: 'mediaIceEventsListener'
597
+ });
598
+ });
599
+ it('handles ROAP failure listener and submits media error metric', function () {
600
+ var _mock$calls$find2;
601
+ var mockStream = {
602
+ outputStream: {
603
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
604
+ },
605
+ on: jest.fn(),
606
+ getEffectByKind: jest.fn().mockReturnValue(undefined)
607
+ };
608
+ var localAudioStream = mockStream;
609
+ var call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
610
+ call.dial(localAudioStream);
611
+ var metricSpy = jest.spyOn(call['metricManager'], 'submitMediaMetric');
612
+ var warnSpy = jest.spyOn(_Logger.default, 'warn');
613
+ var roapFailureHandler = (_mock$calls$find2 = call['mediaConnection'].on.mock.calls.find(function (_ref11) {
614
+ var _ref12 = (0, _slicedToArray2.default)(_ref11, 1),
615
+ name = _ref12[0];
616
+ return name === InternalMediaCoreModule.MediaConnectionEventNames.ROAP_FAILURE;
617
+ })) === null || _mock$calls$find2 === void 0 ? void 0 : _mock$calls$find2[1];
618
+ var roapFailure = new Error('Failed to process remote SDP');
619
+ roapFailureHandler(roapFailure);
620
+ 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));
621
+ var roapFailureMetricCall = metricSpy.mock.calls.find(function (_ref13) {
622
+ var _ref14 = (0, _slicedToArray2.default)(_ref13, 2),
623
+ name = _ref14[0],
624
+ metricAction = _ref14[1];
625
+ return name === _types4.METRIC_EVENT.MEDIA_ERROR && metricAction === _types4.MEDIA_CONNECTION_ACTION.ROAP_FAILURE;
626
+ });
627
+ expect(roapFailureMetricCall).toBeDefined();
628
+ expect((roapFailureMetricCall === null || roapFailureMetricCall === void 0 ? void 0 : roapFailureMetricCall[roapFailureMetricCall.length - 1]).getCallError().message).toBe('ROAP failure occurred: Failed to process remote SDP');
629
+ expect(warnSpy).toHaveBeenCalledWith('ROAP failure occurred: Failed to process remote SDP', {
630
+ file: 'call',
631
+ method: 'mediaRoapEventsListener'
632
+ });
633
+ });
634
+ it('sends connect before ROAP answer when inbound offer is delayed', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
635
+ var _mock$calls$find3;
636
+ var mockStream, localAudioStream, call, handleOutgoingCallConnectSpy, delayedOffer, sendCallStateMachineEvtSpy, sendMediaStateMachineEvtSpy, roapListener;
637
+ return _regenerator.default.wrap(function (_context1) {
638
+ while (1) switch (_context1.prev = _context1.next) {
639
+ case 0:
640
+ mockStream = {
641
+ outputStream: {
642
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
643
+ },
644
+ on: jest.fn(),
645
+ getEffectByKind: jest.fn().mockImplementation(function () {
646
+ return mockEffect;
647
+ })
648
+ };
649
+ localAudioStream = mockStream;
650
+ call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.INBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
651
+ webex.request.mockReturnValue({
652
+ statusCode: 200,
653
+ body: {
654
+ callId: 'mock-call-id'
655
+ }
656
+ });
657
+ call.sendCallStateMachineEvt({
658
+ type: 'E_RECV_CALL_SETUP',
659
+ data: {
660
+ seq: 1,
661
+ messageType: 'OFFER'
662
+ }
663
+ });
664
+ expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
665
+ _context1.next = 1;
666
+ return call.answer(localAudioStream);
667
+ case 1:
668
+ expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
669
+
670
+ // Connect is attempted by answer(), but is deferred because offer is not buffered yet.
671
+ handleOutgoingCallConnectSpy = jest.spyOn(call, 'handleOutgoingCallConnect');
672
+ expect(call['connectPending']).toBe(true);
673
+ expect(call['mediaConnection'].roapMessageReceived).not.toHaveBeenCalled();
674
+ delayedOffer = {
675
+ seq: 1,
676
+ messageType: 'OFFER',
677
+ sdp: 'v=0',
678
+ version: 1
679
+ };
680
+ call.sendMediaStateMachineEvt({
681
+ type: 'E_RECV_ROAP_OFFER',
682
+ data: delayedOffer
683
+ });
684
+ _context1.next = 2;
685
+ return (0, _testUtil.flushPromises)(2);
686
+ case 2:
687
+ expect(call['mediaConnection'].roapMessageReceived).toHaveBeenCalledWith(delayedOffer);
688
+ sendCallStateMachineEvtSpy = jest.spyOn(call, 'sendCallStateMachineEvt');
689
+ sendMediaStateMachineEvtSpy = jest.spyOn(call, 'sendMediaStateMachineEvt');
690
+ roapListener = (_mock$calls$find3 = call['mediaConnection'].on.mock.calls.find(function (_ref16) {
691
+ var _ref17 = (0, _slicedToArray2.default)(_ref16, 1),
692
+ eventName = _ref17[0];
693
+ return eventName === InternalMediaCoreModule.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND;
694
+ })) === null || _mock$calls$find3 === void 0 ? void 0 : _mock$calls$find3[1];
695
+ expect(roapListener).toBeDefined();
696
+ _context1.next = 3;
697
+ return roapListener({
698
+ roapMessage: {
699
+ messageType: 'ANSWER',
700
+ sdp: 'v=0',
701
+ seq: 1,
702
+ version: 2
703
+ }
704
+ });
705
+ case 3:
706
+ _context1.next = 4;
707
+ return (0, _testUtil.flushPromises)(2);
708
+ case 4:
709
+ // On ANSWER from media layer, connect is retried first, then ROAP answer is posted.
710
+ expect(sendCallStateMachineEvtSpy).toHaveBeenNthCalledWith(1, {
711
+ type: 'E_SEND_CALL_CONNECT'
712
+ });
713
+ expect(sendMediaStateMachineEvtSpy).toHaveBeenNthCalledWith(1, {
714
+ type: 'E_SEND_ROAP_ANSWER',
715
+ data: expect.objectContaining({
716
+ messageType: 'ANSWER'
717
+ })
718
+ });
719
+ expect(handleOutgoingCallConnectSpy).toHaveBeenCalled();
720
+ expect(call['mediaConnection'].roapMessageReceived).toHaveBeenLastCalledWith(delayedOffer);
721
+ expect(call['connectPending']).toBe(false);
722
+ case 5:
723
+ case "end":
724
+ return _context1.stop();
428
725
  }
429
- }, _callee8);
726
+ }, _callee1);
430
727
  })));
431
- it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
728
+ 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';
729
+ 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';
730
+ describe.each([{
731
+ name: 'reduced timeout when the offer is ice-lite and reduceTimeoutForIceLite is enabled',
732
+ sdp: iceLiteOfferSdp,
733
+ iceGatheringConfig: {
734
+ reduceTimeoutForIceLite: true
735
+ },
736
+ expectedTimeout: _constants.ICE_LITE_CANDIDATES_TIMEOUT
737
+ }, {
738
+ name: 'custom reduced timeout when the offer is ice-lite and iceLiteTimeout is overridden',
739
+ sdp: iceLiteOfferSdp,
740
+ iceGatheringConfig: {
741
+ reduceTimeoutForIceLite: true,
742
+ iceLiteTimeout: 750
743
+ },
744
+ expectedTimeout: 750
745
+ }, {
746
+ name: 'default timeout when the offer is ice-lite but reduceTimeoutForIceLite is disabled',
747
+ sdp: iceLiteOfferSdp,
748
+ iceGatheringConfig: {
749
+ reduceTimeoutForIceLite: false
750
+ },
751
+ expectedTimeout: _constants.ICE_CANDIDATES_TIMEOUT
752
+ }, {
753
+ name: 'default timeout when the offer is ice-lite but no iceGathering config is provided',
754
+ sdp: iceLiteOfferSdp,
755
+ iceGatheringConfig: undefined,
756
+ expectedTimeout: _constants.ICE_CANDIDATES_TIMEOUT
757
+ }, {
758
+ name: 'default timeout when reduceTimeoutForIceLite is enabled but the offer is not ice-lite',
759
+ sdp: fullIceOfferSdp,
760
+ iceGatheringConfig: {
761
+ reduceTimeoutForIceLite: true
762
+ },
763
+ expectedTimeout: _constants.ICE_CANDIDATES_TIMEOUT
764
+ }])('ICE candidates timeout selection', function (_ref18) {
765
+ var name = _ref18.name,
766
+ sdp = _ref18.sdp,
767
+ iceGatheringConfig = _ref18.iceGatheringConfig,
768
+ expectedTimeout = _ref18.expectedTimeout;
769
+ it("uses ".concat(name), /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
770
+ var mockStream, localAudioStream, call;
771
+ return _regenerator.default.wrap(function (_context10) {
772
+ while (1) switch (_context10.prev = _context10.next) {
773
+ case 0:
774
+ mockStream = {
775
+ outputStream: {
776
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
777
+ },
778
+ on: jest.fn(),
779
+ getEffectByKind: jest.fn().mockImplementation(function () {
780
+ return mockEffect;
781
+ })
782
+ };
783
+ localAudioStream = mockStream;
784
+ call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.INBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest, iceGatheringConfig);
785
+ webex.request.mockReturnValue({
786
+ statusCode: 200,
787
+ body: {
788
+ callId: 'mock-call-id'
789
+ }
790
+ });
791
+
792
+ /* Buffer the remote offer before answering so it is available at media connection init. */
793
+ call.sendMediaStateMachineEvt({
794
+ type: 'E_RECV_ROAP_OFFER',
795
+ data: {
796
+ seq: 1,
797
+ messageType: 'OFFER',
798
+ version: 1,
799
+ sdp: sdp
800
+ }
801
+ });
802
+ _context10.next = 1;
803
+ return call.answer(localAudioStream);
804
+ case 1:
805
+ expect(mockInternalMediaCoreModule.RoapMediaConnection).toBeCalledOnceWith(_objectSpread(_objectSpread({}, roapMediaConnectionConfig), {}, {
806
+ iceCandidatesTimeout: expectedTimeout
807
+ }), roapMediaConnectionOptions, expect.any(String), expect.any(Function), expect.any(Function), expect.any(Function));
808
+ case 2:
809
+ case "end":
810
+ return _context10.stop();
811
+ }
812
+ }, _callee10);
813
+ })));
814
+ });
815
+ it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
432
816
  var mockStream, localAudioStream, onStreamSpy, onEffectSpy, offStreamSpy, offEffectSpy, call, updateLocalTracksSpy, bnrMetricSpy;
433
- return _regenerator.default.wrap(function (_context9) {
434
- while (1) switch (_context9.prev = _context9.next) {
817
+ return _regenerator.default.wrap(function (_context11) {
818
+ while (1) switch (_context11.prev = _context11.next) {
435
819
  case 0:
436
820
  mockStream = {
437
821
  outputStream: {
@@ -487,7 +871,7 @@ describe('Call Tests', function () {
487
871
  });
488
872
  expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_DISABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
489
873
  call.end();
490
- _context9.next = 1;
874
+ _context11.next = 1;
491
875
  return (0, _Utils.waitForMsecs)(50);
492
876
  case 1:
493
877
  /* Checks for switching off the listeners on call disconnect */
@@ -498,14 +882,32 @@ describe('Call Tests', function () {
498
882
  expect(offEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Disabled, expect.any(Function));
499
883
  case 2:
500
884
  case "end":
501
- return _context9.stop();
885
+ return _context11.stop();
502
886
  }
503
- }, _callee9);
887
+ }, _callee11);
504
888
  })));
505
- it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
889
+ it('does not register effect listeners when the added effect cannot be resolved', function () {
890
+ var mockStream = {
891
+ outputStream: {
892
+ getAudioTracks: jest.fn().mockReturnValue([mockTrack])
893
+ },
894
+ on: jest.fn(),
895
+ getEffectByKind: jest.fn().mockReturnValue(undefined)
896
+ };
897
+ var localAudioStream = mockStream;
898
+ var onStreamSpy = jest.spyOn(localAudioStream, 'on');
899
+ var onEffectSpy = jest.spyOn(mockEffect, 'on');
900
+ var call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
901
+ call.dial(localAudioStream);
902
+ expect(function () {
903
+ return onStreamSpy.mock.calls[1][1](undefined);
904
+ }).not.toThrow();
905
+ expect(onEffectSpy).not.toHaveBeenCalled();
906
+ });
907
+ it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
506
908
  var mockStream, localAudioStream, warnSpy, call;
507
- return _regenerator.default.wrap(function (_context0) {
508
- while (1) switch (_context0.prev = _context0.next) {
909
+ return _regenerator.default.wrap(function (_context12) {
910
+ while (1) switch (_context12.prev = _context12.next) {
509
911
  case 0:
510
912
  mockStream = {
511
913
  outputStream: {
@@ -529,7 +931,7 @@ describe('Call Tests', function () {
529
931
  warnSpy = jest.spyOn(_Logger.default, 'warn');
530
932
  call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
531
933
  call.answer(localAudioStream);
532
- _context0.next = 1;
934
+ _context12.next = 1;
533
935
  return (0, _Utils.waitForMsecs)(50);
534
936
  case 1:
535
937
  expect(warnSpy).toBeCalledTimes(2);
@@ -544,14 +946,14 @@ describe('Call Tests', function () {
544
946
  expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
545
947
  case 2:
546
948
  case "end":
547
- return _context0.stop();
949
+ return _context12.stop();
548
950
  }
549
- }, _callee0);
951
+ }, _callee12);
550
952
  })));
551
- it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
953
+ it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
552
954
  var mockStream, localAudioStream, warnSpy, call;
553
- return _regenerator.default.wrap(function (_context1) {
554
- while (1) switch (_context1.prev = _context1.next) {
955
+ return _regenerator.default.wrap(function (_context13) {
956
+ while (1) switch (_context13.prev = _context13.next) {
555
957
  case 0:
556
958
  mockStream = {
557
959
  outputStream: {
@@ -563,7 +965,7 @@ describe('Call Tests', function () {
563
965
  warnSpy = jest.spyOn(_Logger.default, 'warn');
564
966
  call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
565
967
  call.dial(localAudioStream);
566
- _context1.next = 1;
968
+ _context13.next = 1;
567
969
  return (0, _Utils.waitForMsecs)(50);
568
970
  case 1:
569
971
  expect(warnSpy).toBeCalledTimes(1);
@@ -576,9 +978,9 @@ describe('Call Tests', function () {
576
978
  expect(webex.request).not.toBeCalledOnceWith();
577
979
  case 2:
578
980
  case "end":
579
- return _context1.stop();
981
+ return _context13.stop();
580
982
  }
581
- }, _callee1);
983
+ }, _callee13);
582
984
  })));
583
985
  it('update media after call creation with valid stream', function () {
584
986
  var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
@@ -652,10 +1054,10 @@ describe('Call Tests', function () {
652
1054
  method: 'dial'
653
1055
  });
654
1056
  });
655
- it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
1057
+ it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
656
1058
  var logSpy, callManager, mockStream, localAudioStream, call;
657
- return _regenerator.default.wrap(function (_context10) {
658
- while (1) switch (_context10.prev = _context10.next) {
1059
+ return _regenerator.default.wrap(function (_context14) {
1060
+ while (1) switch (_context14.prev = _context14.next) {
659
1061
  case 0:
660
1062
  logSpy = jest.spyOn(_Logger.default, 'info');
661
1063
  webex.request.mockReturnValue({
@@ -731,9 +1133,9 @@ describe('Call Tests', function () {
731
1133
  expect(mockStream.setUserMuted).toBeCalledOnceWith(false);
732
1134
  case 1:
733
1135
  case "end":
734
- return _context10.stop();
1136
+ return _context14.stop();
735
1137
  }
736
- }, _callee10);
1138
+ }, _callee14);
737
1139
  })));
738
1140
  describe('Guest Calling Flow Tests', function () {
739
1141
  var dummyEvent = {
@@ -741,10 +1143,10 @@ describe('Call Tests', function () {
741
1143
  data: undefined
742
1144
  };
743
1145
  var call;
744
- it('outgoing call without guest calling must have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
1146
+ it('outgoing call without guest calling must have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
745
1147
  var requestSpy, requestArgs;
746
- return _regenerator.default.wrap(function (_context11) {
747
- while (1) switch (_context11.prev = _context11.next) {
1148
+ return _regenerator.default.wrap(function (_context15) {
1149
+ while (1) switch (_context15.prev = _context15.next) {
748
1150
  case 0:
749
1151
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
750
1152
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -757,14 +1159,14 @@ describe('Call Tests', function () {
757
1159
  expect('callee' in requestArgs.body).toBe(true);
758
1160
  case 1:
759
1161
  case "end":
760
- return _context11.stop();
1162
+ return _context15.stop();
761
1163
  }
762
- }, _callee11);
1164
+ }, _callee15);
763
1165
  })));
764
- it('outgoing call for guest calling must not have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
1166
+ it('outgoing call for guest calling must not have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
765
1167
  var requestSpy, requestArgs;
766
- return _regenerator.default.wrap(function (_context12) {
767
- while (1) switch (_context12.prev = _context12.next) {
1168
+ return _regenerator.default.wrap(function (_context16) {
1169
+ while (1) switch (_context16.prev = _context16.next) {
768
1170
  case 0:
769
1171
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
770
1172
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -777,9 +1179,9 @@ describe('Call Tests', function () {
777
1179
  expect('callee' in requestArgs.body).toBe(false);
778
1180
  case 1:
779
1181
  case "end":
780
- return _context12.stop();
1182
+ return _context16.stop();
781
1183
  }
782
- }, _callee12);
1184
+ }, _callee16);
783
1185
  })));
784
1186
  });
785
1187
  });
@@ -799,6 +1201,11 @@ describe('State Machine handler tests', function () {
799
1201
  var call;
800
1202
  var dtmfMock;
801
1203
  beforeEach(function () {
1204
+ _request.APIRequest.resetInstance();
1205
+ _request.APIRequest.getInstance({
1206
+ webex: webex,
1207
+ isMobiusSocketEnabled: false
1208
+ });
802
1209
  call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
803
1210
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
804
1211
  var dummy = 10;
@@ -812,10 +1219,10 @@ describe('State Machine handler tests', function () {
812
1219
 
813
1220
  // afterEach(() => call.removeAllListeners());
814
1221
 
815
- it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
1222
+ it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
816
1223
  var statusPayload, dummyEvent, funcSpy, logSpy;
817
- return _regenerator.default.wrap(function (_context13) {
818
- while (1) switch (_context13.prev = _context13.next) {
1224
+ return _regenerator.default.wrap(function (_context17) {
1225
+ while (1) switch (_context17.prev = _context17.next) {
819
1226
  case 0:
820
1227
  statusPayload = {
821
1228
  statusCode: 200,
@@ -835,7 +1242,7 @@ describe('State Machine handler tests', function () {
835
1242
  /* This is to flush all the promises from the Promise queue so that
836
1243
  * Jest.fakeTimers can advance time and also clear the promise Queue
837
1244
  */
838
- _context13.next = 1;
1245
+ _context17.next = 1;
839
1246
  return (0, _testUtil.flushPromises)(3);
840
1247
  case 1:
841
1248
  expect(setInterval).toHaveBeenCalledTimes(1);
@@ -851,14 +1258,14 @@ describe('State Machine handler tests', function () {
851
1258
  });
852
1259
  case 2:
853
1260
  case "end":
854
- return _context13.stop();
1261
+ return _context17.stop();
855
1262
  }
856
- }, _callee13);
1263
+ }, _callee17);
857
1264
  })));
858
- it('session refresh 401 emits token error and ends the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
1265
+ it('session refresh 401 emits token error and ends the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
859
1266
  var statusPayload, emitSpy, funcSpy;
860
- return _regenerator.default.wrap(function (_context14) {
861
- while (1) switch (_context14.prev = _context14.next) {
1267
+ return _regenerator.default.wrap(function (_context18) {
1268
+ while (1) switch (_context18.prev = _context18.next) {
862
1269
  case 0:
863
1270
  expect.assertions(4);
864
1271
  statusPayload = {
@@ -873,10 +1280,10 @@ describe('State Machine handler tests', function () {
873
1280
  funcSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(statusPayload);
874
1281
  call['handleCallEstablished']({});
875
1282
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
876
- _context14.next = 1;
1283
+ _context18.next = 1;
877
1284
  return _promise.default.resolve();
878
1285
  case 1:
879
- _context14.next = 2;
1286
+ _context18.next = 2;
880
1287
  return _promise.default.resolve();
881
1288
  case 2:
882
1289
  // clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
@@ -886,14 +1293,14 @@ describe('State Machine handler tests', function () {
886
1293
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
887
1294
  case 3:
888
1295
  case "end":
889
- return _context14.stop();
1296
+ return _context18.stop();
890
1297
  }
891
- }, _callee14);
1298
+ }, _callee18);
892
1299
  })));
893
- it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
1300
+ it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
894
1301
  var statusPayload, funcSpy;
895
- return _regenerator.default.wrap(function (_context15) {
896
- while (1) switch (_context15.prev = _context15.next) {
1302
+ return _regenerator.default.wrap(function (_context19) {
1303
+ while (1) switch (_context19.prev = _context19.next) {
897
1304
  case 0:
898
1305
  expect.assertions(4);
899
1306
  statusPayload = {
@@ -912,7 +1319,7 @@ describe('State Machine handler tests', function () {
912
1319
  /* This is to flush all the promises from the Promise queue so that
913
1320
  * Jest.fakeTimers can advance time and also clear the promise Queue
914
1321
  */
915
- _context15.next = 1;
1322
+ _context19.next = 1;
916
1323
  return (0, _testUtil.flushPromises)(2);
917
1324
  case 1:
918
1325
  // clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
@@ -921,14 +1328,14 @@ describe('State Machine handler tests', function () {
921
1328
  expect(funcSpy).toBeCalledTimes(1);
922
1329
  case 2:
923
1330
  case "end":
924
- return _context15.stop();
1331
+ return _context19.stop();
925
1332
  }
926
- }, _callee15);
1333
+ }, _callee19);
927
1334
  })));
928
- it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
1335
+ it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
929
1336
  var errorPayload, okPayload, scheduleKeepaliveSpy, postStatusSpy;
930
- return _regenerator.default.wrap(function (_context16) {
931
- while (1) switch (_context16.prev = _context16.next) {
1337
+ return _regenerator.default.wrap(function (_context20) {
1338
+ while (1) switch (_context20.prev = _context20.next) {
932
1339
  case 0:
933
1340
  errorPayload = {
934
1341
  statusCode: 500,
@@ -946,28 +1353,28 @@ describe('State Machine handler tests', function () {
946
1353
  call['handleCallEstablished']({});
947
1354
  }
948
1355
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
949
- _context16.next = 1;
1356
+ _context20.next = 1;
950
1357
  return (0, _testUtil.flushPromises)(2);
951
1358
  case 1:
952
1359
  expect(postStatusSpy).toHaveBeenCalledTimes(1);
953
1360
 
954
1361
  // Now advance by 1 second for the retry-after interval
955
1362
  jest.advanceTimersByTime(1000);
956
- _context16.next = 2;
1363
+ _context20.next = 2;
957
1364
  return (0, _testUtil.flushPromises)(2);
958
1365
  case 2:
959
1366
  expect(postStatusSpy).toHaveBeenCalledTimes(2);
960
1367
  expect(scheduleKeepaliveSpy).toHaveBeenCalledTimes(2);
961
1368
  case 3:
962
1369
  case "end":
963
- return _context16.stop();
1370
+ return _context20.stop();
964
1371
  }
965
- }, _callee16);
1372
+ }, _callee20);
966
1373
  })));
967
- it('scheduleCallKeepaliveInterval clears existing interval before creating new one', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
1374
+ it('scheduleCallKeepaliveInterval clears existing interval before creating new one', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
968
1375
  var firstTimer, secondTimer;
969
- return _regenerator.default.wrap(function (_context17) {
970
- while (1) switch (_context17.prev = _context17.next) {
1376
+ return _regenerator.default.wrap(function (_context21) {
1377
+ while (1) switch (_context21.prev = _context21.next) {
971
1378
  case 0:
972
1379
  jest.spyOn(global, 'setInterval');
973
1380
  jest.spyOn(global, 'clearInterval');
@@ -995,14 +1402,14 @@ describe('State Machine handler tests', function () {
995
1402
  expect(secondTimer).toBeDefined();
996
1403
  case 1:
997
1404
  case "end":
998
- return _context17.stop();
1405
+ return _context21.stop();
999
1406
  }
1000
- }, _callee17);
1407
+ }, _callee21);
1001
1408
  })));
1002
- it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
1409
+ it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1003
1410
  var errorPayload, warnSpy, postStatusSpy;
1004
- return _regenerator.default.wrap(function (_context18) {
1005
- while (1) switch (_context18.prev = _context18.next) {
1411
+ return _regenerator.default.wrap(function (_context22) {
1412
+ while (1) switch (_context22.prev = _context22.next) {
1006
1413
  case 0:
1007
1414
  errorPayload = {
1008
1415
  statusCode: 500,
@@ -1021,25 +1428,25 @@ describe('State Machine handler tests', function () {
1021
1428
 
1022
1429
  // Advance timer to trigger the first failure (uses DEFAULT_SESSION_TIMER)
1023
1430
  jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
1024
- _context18.next = 1;
1431
+ _context22.next = 1;
1025
1432
  return (0, _testUtil.flushPromises)(2);
1026
1433
  case 1:
1027
1434
  // Now advance by 1 second for each of the 4 retry attempts (retry-after: 1 second each)
1028
1435
  // Need to do this separately to allow state machine to process and create new intervals
1029
1436
  jest.advanceTimersByTime(1000);
1030
- _context18.next = 2;
1437
+ _context22.next = 2;
1031
1438
  return (0, _testUtil.flushPromises)(2);
1032
1439
  case 2:
1033
1440
  jest.advanceTimersByTime(1000);
1034
- _context18.next = 3;
1441
+ _context22.next = 3;
1035
1442
  return (0, _testUtil.flushPromises)(2);
1036
1443
  case 3:
1037
1444
  jest.advanceTimersByTime(1000);
1038
- _context18.next = 4;
1445
+ _context22.next = 4;
1039
1446
  return (0, _testUtil.flushPromises)(2);
1040
1447
  case 4:
1041
1448
  jest.advanceTimersByTime(1000);
1042
- _context18.next = 5;
1449
+ _context22.next = 5;
1043
1450
  return (0, _testUtil.flushPromises)(2);
1044
1451
  case 5:
1045
1452
  // The error handler should detect we're at max retry count and stop
@@ -1051,14 +1458,14 @@ describe('State Machine handler tests', function () {
1051
1458
  expect(call['callKeepaliveRetryCount']).toBe(4);
1052
1459
  case 6:
1053
1460
  case "end":
1054
- return _context18.stop();
1461
+ return _context22.stop();
1055
1462
  }
1056
- }, _callee18);
1463
+ }, _callee22);
1057
1464
  })));
1058
- it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1465
+ it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1059
1466
  var statusPayload, dummyEvent, postMediaSpy, deleteSpy, dummyOkEvent;
1060
- return _regenerator.default.wrap(function (_context19) {
1061
- while (1) switch (_context19.prev = _context19.next) {
1467
+ return _regenerator.default.wrap(function (_context23) {
1468
+ while (1) switch (_context23.prev = _context23.next) {
1062
1469
  case 0:
1063
1470
  statusPayload = {
1064
1471
  statusCode: 200,
@@ -1114,14 +1521,14 @@ describe('State Machine handler tests', function () {
1114
1521
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1115
1522
  case 1:
1116
1523
  case "end":
1117
- return _context19.stop();
1524
+ return _context23.stop();
1118
1525
  }
1119
- }, _callee19);
1526
+ }, _callee23);
1120
1527
  })));
1121
- it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1528
+ it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
1122
1529
  var statusPayload, dummyEvent;
1123
- return _regenerator.default.wrap(function (_context20) {
1124
- while (1) switch (_context20.prev = _context20.next) {
1530
+ return _regenerator.default.wrap(function (_context24) {
1531
+ while (1) switch (_context24.prev = _context24.next) {
1125
1532
  case 0:
1126
1533
  call['direction'] = _types3.CallDirection.INBOUND;
1127
1534
  statusPayload = {
@@ -1139,7 +1546,7 @@ describe('State Machine handler tests', function () {
1139
1546
  webex.request.mockReturnValue(statusPayload);
1140
1547
  call.sendCallStateMachineEvt(dummyEvent);
1141
1548
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
1142
- _context20.next = 1;
1549
+ _context24.next = 1;
1143
1550
  return call['handleOutgoingCallConnect']({
1144
1551
  type: 'E_SEND_CALL_CONNECT'
1145
1552
  });
@@ -1153,14 +1560,14 @@ describe('State Machine handler tests', function () {
1153
1560
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1154
1561
  case 2:
1155
1562
  case "end":
1156
- return _context20.stop();
1563
+ return _context24.stop();
1157
1564
  }
1158
- }, _callee20);
1565
+ }, _callee24);
1159
1566
  })));
1160
- it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1567
+ it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
1161
1568
  var callManager, statusPayload, call, dummyEvent, dummyOkEvent, emitSpy, startCallerIdSpy, mobiusProgressEvent;
1162
- return _regenerator.default.wrap(function (_context21) {
1163
- while (1) switch (_context21.prev = _context21.next) {
1569
+ return _regenerator.default.wrap(function (_context25) {
1570
+ while (1) switch (_context25.prev = _context25.next) {
1164
1571
  case 0:
1165
1572
  callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
1166
1573
  statusPayload = {
@@ -1254,14 +1661,14 @@ describe('State Machine handler tests', function () {
1254
1661
  expect(call.earlyMedia).not.toBe(true);
1255
1662
  case 1:
1256
1663
  case "end":
1257
- return _context21.stop();
1664
+ return _context25.stop();
1258
1665
  }
1259
- }, _callee21);
1666
+ }, _callee25);
1260
1667
  })));
1261
- it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1668
+ it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1262
1669
  var warnSpy, errorSpy, stateMachineSpy, statusPayload, roapMessage;
1263
- return _regenerator.default.wrap(function (_context22) {
1264
- while (1) switch (_context22.prev = _context22.next) {
1670
+ return _regenerator.default.wrap(function (_context26) {
1671
+ while (1) switch (_context26.prev = _context26.next) {
1265
1672
  case 0:
1266
1673
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1267
1674
  errorSpy = jest.spyOn(_Logger.default, 'error');
@@ -1288,7 +1695,7 @@ describe('State Machine handler tests', function () {
1288
1695
  webex.request.mockRejectedValueOnce({
1289
1696
  statusCode: 403
1290
1697
  }).mockResolvedValue(statusPayload);
1291
- _context22.next = 1;
1698
+ _context26.next = 1;
1292
1699
  return call['handleOutgoingCallConnect']({
1293
1700
  type: 'E_SEND_CALL_CONNECT'
1294
1701
  });
@@ -1299,14 +1706,14 @@ describe('State Machine handler tests', function () {
1299
1706
  expect(errorSpy).toBeCalledTimes(1);
1300
1707
  case 2:
1301
1708
  case "end":
1302
- return _context22.stop();
1709
+ return _context26.stop();
1303
1710
  }
1304
- }, _callee22);
1711
+ }, _callee26);
1305
1712
  })));
1306
- it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1713
+ it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1307
1714
  var statusPayload, dummyEvent, postMediaSpy, logSpy, dummyOkEvent;
1308
- return _regenerator.default.wrap(function (_context23) {
1309
- while (1) switch (_context23.prev = _context23.next) {
1715
+ return _regenerator.default.wrap(function (_context27) {
1716
+ while (1) switch (_context27.prev = _context27.next) {
1310
1717
  case 0:
1311
1718
  statusPayload = {
1312
1719
  statusCode: 200,
@@ -1382,14 +1789,14 @@ describe('State Machine handler tests', function () {
1382
1789
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1383
1790
  case 1:
1384
1791
  case "end":
1385
- return _context23.stop();
1792
+ return _context27.stop();
1386
1793
  }
1387
- }, _callee23);
1794
+ }, _callee27);
1388
1795
  })));
1389
- 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 _callee24() {
1796
+ 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 _callee28() {
1390
1797
  var statusPayload, dummySetupEvent, dummyConnectEvent, dummyOfferEvent, dummyAnswerEvent, dummyOkEvent, postMediaSpy;
1391
- return _regenerator.default.wrap(function (_context24) {
1392
- while (1) switch (_context24.prev = _context24.next) {
1798
+ return _regenerator.default.wrap(function (_context28) {
1799
+ while (1) switch (_context28.prev = _context28.next) {
1393
1800
  case 0:
1394
1801
  statusPayload = {
1395
1802
  statusCode: 200,
@@ -1457,14 +1864,14 @@ describe('State Machine handler tests', function () {
1457
1864
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
1458
1865
  case 1:
1459
1866
  case "end":
1460
- return _context24.stop();
1867
+ return _context28.stop();
1461
1868
  }
1462
- }, _callee24);
1869
+ }, _callee28);
1463
1870
  })));
1464
- it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
1871
+ it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
1465
1872
  var statusPayload, dummyEvent;
1466
- return _regenerator.default.wrap(function (_context25) {
1467
- while (1) switch (_context25.prev = _context25.next) {
1873
+ return _regenerator.default.wrap(function (_context29) {
1874
+ while (1) switch (_context29.prev = _context29.next) {
1468
1875
  case 0:
1469
1876
  statusPayload = {
1470
1877
  statusCode: 200,
@@ -1503,14 +1910,14 @@ describe('State Machine handler tests', function () {
1503
1910
  expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
1504
1911
  case 1:
1505
1912
  case "end":
1506
- return _context25.stop();
1913
+ return _context29.stop();
1507
1914
  }
1508
- }, _callee25);
1915
+ }, _callee29);
1509
1916
  })));
1510
- it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1917
+ it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
1511
1918
  var statusPayload, dummyEvent, errorSpy;
1512
- return _regenerator.default.wrap(function (_context26) {
1513
- while (1) switch (_context26.prev = _context26.next) {
1919
+ return _regenerator.default.wrap(function (_context30) {
1920
+ while (1) switch (_context30.prev = _context30.next) {
1514
1921
  case 0:
1515
1922
  statusPayload = {
1516
1923
  statusCode: 403,
@@ -1527,25 +1934,31 @@ describe('State Machine handler tests', function () {
1527
1934
  webex.request.mockRejectedValueOnce(statusPayload);
1528
1935
  errorSpy = jest.spyOn(_Logger.default, 'error');
1529
1936
  call.sendCallStateMachineEvt(dummyEvent);
1530
- _context26.next = 1;
1937
+ _context30.next = 1;
1531
1938
  return (0, _testUtil.flushPromises)(3);
1532
1939
  case 1:
1940
+ _context30.next = 2;
1941
+ return _promise.default.resolve();
1942
+ case 2:
1943
+ _context30.next = 3;
1944
+ return _promise.default.resolve();
1945
+ case 3:
1533
1946
  expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
1534
1947
  expect(errorSpy).toHaveBeenCalled();
1535
1948
  expect(uploadLogsSpy).toHaveBeenCalledWith({
1536
1949
  correlationId: call.getCorrelationId(),
1537
1950
  callId: call.getCallId()
1538
1951
  });
1539
- case 2:
1952
+ case 4:
1540
1953
  case "end":
1541
- return _context26.stop();
1954
+ return _context30.stop();
1542
1955
  }
1543
- }, _callee26);
1956
+ }, _callee30);
1544
1957
  })));
1545
- it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1958
+ it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1546
1959
  var statusPayload, dummyEvent, warnSpy;
1547
- return _regenerator.default.wrap(function (_context27) {
1548
- while (1) switch (_context27.prev = _context27.next) {
1960
+ return _regenerator.default.wrap(function (_context31) {
1961
+ while (1) switch (_context31.prev = _context31.next) {
1549
1962
  case 0:
1550
1963
  statusPayload = {
1551
1964
  statusCode: 403,
@@ -1564,12 +1977,18 @@ describe('State Machine handler tests', function () {
1564
1977
  webex.request.mockRejectedValue(statusPayload);
1565
1978
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1566
1979
  jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
1567
- _context27.next = 1;
1980
+ _context31.next = 1;
1568
1981
  return call['handleRoapEstablished']({}, dummyEvent);
1569
1982
  case 1:
1570
- _context27.next = 2;
1983
+ _context31.next = 2;
1571
1984
  return (0, _testUtil.flushPromises)(2);
1572
1985
  case 2:
1986
+ _context31.next = 3;
1987
+ return _promise.default.resolve();
1988
+ case 3:
1989
+ _context31.next = 4;
1990
+ return _promise.default.resolve();
1991
+ case 4:
1573
1992
  expect(call.isConnected()).toBe(false);
1574
1993
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1575
1994
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
@@ -1581,16 +2000,16 @@ describe('State Machine handler tests', function () {
1581
2000
  file: 'call',
1582
2001
  method: 'handleRoapError'
1583
2002
  });
1584
- case 3:
2003
+ case 5:
1585
2004
  case "end":
1586
- return _context27.stop();
2005
+ return _context31.stop();
1587
2006
  }
1588
- }, _callee27);
2007
+ }, _callee31);
1589
2008
  })));
1590
- it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
2009
+ it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1591
2010
  var statusPayload, dummyEvent;
1592
- return _regenerator.default.wrap(function (_context28) {
1593
- while (1) switch (_context28.prev = _context28.next) {
2011
+ return _regenerator.default.wrap(function (_context32) {
2012
+ while (1) switch (_context32.prev = _context32.next) {
1594
2013
  case 0:
1595
2014
  statusPayload = {
1596
2015
  statusCode: 403,
@@ -1613,14 +2032,14 @@ describe('State Machine handler tests', function () {
1613
2032
  expect(_testUtil.mediaConnection.initiateOffer).toBeCalledOnceWith();
1614
2033
  case 1:
1615
2034
  case "end":
1616
- return _context28.stop();
2035
+ return _context32.stop();
1617
2036
  }
1618
- }, _callee28);
2037
+ }, _callee32);
1619
2038
  })));
1620
- it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
2039
+ it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
1621
2040
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1622
- return _regenerator.default.wrap(function (_context29) {
1623
- while (1) switch (_context29.prev = _context29.next) {
2041
+ return _regenerator.default.wrap(function (_context33) {
2042
+ while (1) switch (_context33.prev = _context33.next) {
1624
2043
  case 0:
1625
2044
  statusPayload = {
1626
2045
  statusCode: 503,
@@ -1642,7 +2061,7 @@ describe('State Machine handler tests', function () {
1642
2061
  }
1643
2062
  };
1644
2063
  call['connected'] = true;
1645
- _context29.next = 1;
2064
+ _context33.next = 1;
1646
2065
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1647
2066
  case 1:
1648
2067
  jest.advanceTimersByTime(1005);
@@ -1654,14 +2073,14 @@ describe('State Machine handler tests', function () {
1654
2073
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1655
2074
  case 2:
1656
2075
  case "end":
1657
- return _context29.stop();
2076
+ return _context33.stop();
1658
2077
  }
1659
- }, _callee29);
2078
+ }, _callee33);
1660
2079
  })));
1661
- it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
2080
+ it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
1662
2081
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1663
- return _regenerator.default.wrap(function (_context30) {
1664
- while (1) switch (_context30.prev = _context30.next) {
2082
+ return _regenerator.default.wrap(function (_context34) {
2083
+ while (1) switch (_context34.prev = _context34.next) {
1665
2084
  case 0:
1666
2085
  statusPayload = {
1667
2086
  statusCode: 503,
@@ -1683,7 +2102,7 @@ describe('State Machine handler tests', function () {
1683
2102
  }
1684
2103
  };
1685
2104
  call['connected'] = false;
1686
- _context30.next = 1;
2105
+ _context34.next = 1;
1687
2106
  return call['handleOutgoingRoapOffer']({}, dummyEvent);
1688
2107
  case 1:
1689
2108
  jest.advanceTimersByTime(1005);
@@ -1694,14 +2113,14 @@ describe('State Machine handler tests', function () {
1694
2113
  expect(stateMachineSpy).not.toBeCalled();
1695
2114
  case 2:
1696
2115
  case "end":
1697
- return _context30.stop();
2116
+ return _context34.stop();
1698
2117
  }
1699
- }, _callee30);
2118
+ }, _callee34);
1700
2119
  })));
1701
- it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
2120
+ it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
1702
2121
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1703
- return _regenerator.default.wrap(function (_context31) {
1704
- while (1) switch (_context31.prev = _context31.next) {
2122
+ return _regenerator.default.wrap(function (_context35) {
2123
+ while (1) switch (_context35.prev = _context35.next) {
1705
2124
  case 0:
1706
2125
  statusPayload = {
1707
2126
  statusCode: 503,
@@ -1723,7 +2142,7 @@ describe('State Machine handler tests', function () {
1723
2142
  };
1724
2143
  call['connected'] = true;
1725
2144
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_OFFER';
1726
- _context31.next = 1;
2145
+ _context35.next = 1;
1727
2146
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1728
2147
  case 1:
1729
2148
  jest.advanceTimersByTime(1005);
@@ -1735,14 +2154,14 @@ describe('State Machine handler tests', function () {
1735
2154
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1736
2155
  case 2:
1737
2156
  case "end":
1738
- return _context31.stop();
2157
+ return _context35.stop();
1739
2158
  }
1740
- }, _callee31);
2159
+ }, _callee35);
1741
2160
  })));
1742
- it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
2161
+ it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
1743
2162
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1744
- return _regenerator.default.wrap(function (_context32) {
1745
- while (1) switch (_context32.prev = _context32.next) {
2163
+ return _regenerator.default.wrap(function (_context36) {
2164
+ while (1) switch (_context36.prev = _context36.next) {
1746
2165
  case 0:
1747
2166
  statusPayload = {
1748
2167
  statusCode: 503,
@@ -1763,7 +2182,7 @@ describe('State Machine handler tests', function () {
1763
2182
  }
1764
2183
  };
1765
2184
  call['connected'] = false;
1766
- _context32.next = 1;
2185
+ _context36.next = 1;
1767
2186
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1768
2187
  case 1:
1769
2188
  jest.advanceTimersByTime(1005);
@@ -1775,14 +2194,14 @@ describe('State Machine handler tests', function () {
1775
2194
  expect(stateMachineSpy).not.toBeCalled();
1776
2195
  case 2:
1777
2196
  case "end":
1778
- return _context32.stop();
2197
+ return _context36.stop();
1779
2198
  }
1780
- }, _callee32);
2199
+ }, _callee36);
1781
2200
  })));
1782
- it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
2201
+ it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
1783
2202
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1784
- return _regenerator.default.wrap(function (_context33) {
1785
- while (1) switch (_context33.prev = _context33.next) {
2203
+ return _regenerator.default.wrap(function (_context37) {
2204
+ while (1) switch (_context37.prev = _context37.next) {
1786
2205
  case 0:
1787
2206
  statusPayload = {
1788
2207
  statusCode: 200,
@@ -1807,14 +2226,14 @@ describe('State Machine handler tests', function () {
1807
2226
  expect(stateMachineSpy).not.toHaveBeenCalled();
1808
2227
  case 1:
1809
2228
  case "end":
1810
- return _context33.stop();
2229
+ return _context37.stop();
1811
2230
  }
1812
- }, _callee33);
2231
+ }, _callee37);
1813
2232
  })));
1814
- it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
2233
+ it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
1815
2234
  var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
1816
- return _regenerator.default.wrap(function (_context34) {
1817
- while (1) switch (_context34.prev = _context34.next) {
2235
+ return _regenerator.default.wrap(function (_context38) {
2236
+ while (1) switch (_context38.prev = _context38.next) {
1818
2237
  case 0:
1819
2238
  statusPayload = {
1820
2239
  statusCode: 503,
@@ -1836,7 +2255,7 @@ describe('State Machine handler tests', function () {
1836
2255
  };
1837
2256
  call['connected'] = true;
1838
2257
  call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
1839
- _context34.next = 1;
2258
+ _context38.next = 1;
1840
2259
  return call['handleRoapEstablished']({}, dummyEvent);
1841
2260
  case 1:
1842
2261
  jest.advanceTimersByTime(1005);
@@ -1848,14 +2267,14 @@ describe('State Machine handler tests', function () {
1848
2267
  expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
1849
2268
  case 2:
1850
2269
  case "end":
1851
- return _context34.stop();
2270
+ return _context38.stop();
1852
2271
  }
1853
- }, _callee34);
2272
+ }, _callee38);
1854
2273
  })));
1855
- it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
2274
+ it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
1856
2275
  var statusPayload, stateMachineSpy, funcSpy, errorEvent;
1857
- return _regenerator.default.wrap(function (_context35) {
1858
- while (1) switch (_context35.prev = _context35.next) {
2276
+ return _regenerator.default.wrap(function (_context39) {
2277
+ while (1) switch (_context39.prev = _context39.next) {
1859
2278
  case 0:
1860
2279
  statusPayload = {
1861
2280
  statusCode: 403,
@@ -1878,14 +2297,14 @@ describe('State Machine handler tests', function () {
1878
2297
  expect(stateMachineSpy).not.toHaveBeenCalled();
1879
2298
  case 1:
1880
2299
  case "end":
1881
- return _context35.stop();
2300
+ return _context39.stop();
1882
2301
  }
1883
- }, _callee35);
2302
+ }, _callee39);
1884
2303
  })));
1885
- it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
2304
+ it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
1886
2305
  var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
1887
- return _regenerator.default.wrap(function (_context36) {
1888
- while (1) switch (_context36.prev = _context36.next) {
2306
+ return _regenerator.default.wrap(function (_context40) {
2307
+ while (1) switch (_context40.prev = _context40.next) {
1889
2308
  case 0:
1890
2309
  statusPayload = {
1891
2310
  statusCode: 200,
@@ -1903,7 +2322,7 @@ describe('State Machine handler tests', function () {
1903
2322
  }
1904
2323
  };
1905
2324
  call['connected'] = false;
1906
- _context36.next = 1;
2325
+ _context40.next = 1;
1907
2326
  return call['handleRoapError']({}, errorEvent);
1908
2327
  case 1:
1909
2328
  expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
@@ -1919,14 +2338,14 @@ describe('State Machine handler tests', function () {
1919
2338
  });
1920
2339
  case 2:
1921
2340
  case "end":
1922
- return _context36.stop();
2341
+ return _context40.stop();
1923
2342
  }
1924
- }, _callee36);
2343
+ }, _callee40);
1925
2344
  })));
1926
- it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
2345
+ it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
1927
2346
  var statusPayload, warnSpy, postMediaSpy, setupEvent, connectEvent, offerEvent, answerEvent;
1928
- return _regenerator.default.wrap(function (_context37) {
1929
- while (1) switch (_context37.prev = _context37.next) {
2347
+ return _regenerator.default.wrap(function (_context41) {
2348
+ while (1) switch (_context41.prev = _context41.next) {
1930
2349
  case 0:
1931
2350
  statusPayload = {
1932
2351
  statusCode: 403,
@@ -1964,12 +2383,18 @@ describe('State Machine handler tests', function () {
1964
2383
  messageType: 'ANSWER'
1965
2384
  }
1966
2385
  };
1967
- _context37.next = 1;
2386
+ _context41.next = 1;
1968
2387
  return call.sendMediaStateMachineEvt(answerEvent);
1969
2388
  case 1:
1970
- _context37.next = 2;
2389
+ _context41.next = 2;
1971
2390
  return (0, _testUtil.flushPromises)(2);
1972
2391
  case 2:
2392
+ _context41.next = 3;
2393
+ return _promise.default.resolve();
2394
+ case 3:
2395
+ _context41.next = 4;
2396
+ return _promise.default.resolve();
2397
+ case 4:
1973
2398
  expect(postMediaSpy).toBeCalledOnceWith(answerEvent.data);
1974
2399
  expect(warnSpy).toHaveBeenCalledWith('Failed to send MediaAnswer request', {
1975
2400
  file: 'call',
@@ -1983,16 +2408,16 @@ describe('State Machine handler tests', function () {
1983
2408
  // Final state should be torn down and cleared for unconnected call
1984
2409
  expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
1985
2410
  expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
1986
- case 3:
2411
+ case 5:
1987
2412
  case "end":
1988
- return _context37.stop();
2413
+ return _context41.stop();
1989
2414
  }
1990
- }, _callee37);
2415
+ }, _callee41);
1991
2416
  })));
1992
- it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
2417
+ it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
1993
2418
  var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
1994
- return _regenerator.default.wrap(function (_context38) {
1995
- while (1) switch (_context38.prev = _context38.next) {
2419
+ return _regenerator.default.wrap(function (_context42) {
2420
+ while (1) switch (_context42.prev = _context42.next) {
1996
2421
  case 0:
1997
2422
  statusPayload = {
1998
2423
  statusCode: 200,
@@ -2025,7 +2450,7 @@ describe('State Machine handler tests', function () {
2025
2450
  seq: 1,
2026
2451
  messageType: 'ANSWER'
2027
2452
  };
2028
- _context38.next = 1;
2453
+ _context42.next = 1;
2029
2454
  return call.sendMediaStateMachineEvt(dummyEvent);
2030
2455
  case 1:
2031
2456
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -2047,7 +2472,7 @@ describe('State Machine handler tests', function () {
2047
2472
  seq: 2,
2048
2473
  messageType: 'OFFER_REQUEST'
2049
2474
  };
2050
- _context38.next = 2;
2475
+ _context42.next = 2;
2051
2476
  return call.sendMediaStateMachineEvt(dummyEvent);
2052
2477
  case 2:
2053
2478
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -2097,7 +2522,7 @@ describe('State Machine handler tests', function () {
2097
2522
  };
2098
2523
  call.sendCallStateMachineEvt(dummyEvent);
2099
2524
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2100
- _context38.next = 3;
2525
+ _context42.next = 3;
2101
2526
  return call.sendMediaStateMachineEvt(dummyEvent);
2102
2527
  case 3:
2103
2528
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2106,7 +2531,7 @@ describe('State Machine handler tests', function () {
2106
2531
  seq: 3,
2107
2532
  messageType: 'ANSWER'
2108
2533
  };
2109
- _context38.next = 4;
2534
+ _context42.next = 4;
2110
2535
  return call.sendMediaStateMachineEvt(dummyEvent);
2111
2536
  case 4:
2112
2537
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2125,7 +2550,7 @@ describe('State Machine handler tests', function () {
2125
2550
  messageType: 'OK'
2126
2551
  }
2127
2552
  };
2128
- _context38.next = 5;
2553
+ _context42.next = 5;
2129
2554
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2130
2555
  case 5:
2131
2556
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
@@ -2140,14 +2565,14 @@ describe('State Machine handler tests', function () {
2140
2565
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2141
2566
  case 6:
2142
2567
  case "end":
2143
- return _context38.stop();
2568
+ return _context42.stop();
2144
2569
  }
2145
- }, _callee38);
2570
+ }, _callee42);
2146
2571
  })));
2147
- it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
2572
+ it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
2148
2573
  var mockStatusBody, statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
2149
- return _regenerator.default.wrap(function (_context39) {
2150
- while (1) switch (_context39.prev = _context39.next) {
2574
+ return _regenerator.default.wrap(function (_context43) {
2575
+ while (1) switch (_context43.prev = _context43.next) {
2151
2576
  case 0:
2152
2577
  mockStatusBody = {
2153
2578
  device: {
@@ -2187,7 +2612,7 @@ describe('State Machine handler tests', function () {
2187
2612
  seq: 1,
2188
2613
  messageType: 'ANSWER'
2189
2614
  };
2190
- _context39.next = 1;
2615
+ _context43.next = 1;
2191
2616
  return call.sendMediaStateMachineEvt(dummyEvent);
2192
2617
  case 1:
2193
2618
  expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
@@ -2209,7 +2634,7 @@ describe('State Machine handler tests', function () {
2209
2634
  seq: 2,
2210
2635
  messageType: 'OFFER_REQUEST'
2211
2636
  };
2212
- _context39.next = 2;
2637
+ _context43.next = 2;
2213
2638
  return call.sendMediaStateMachineEvt(dummyEvent);
2214
2639
  case 2:
2215
2640
  expect(call['receivedRoapOKSeq']).toBe(0);
@@ -2259,7 +2684,7 @@ describe('State Machine handler tests', function () {
2259
2684
  };
2260
2685
  call.sendCallStateMachineEvt(dummyEvent);
2261
2686
  dummyEvent.type = 'E_RECV_ROAP_OFFER';
2262
- _context39.next = 3;
2687
+ _context43.next = 3;
2263
2688
  return call.sendMediaStateMachineEvt(dummyEvent);
2264
2689
  case 3:
2265
2690
  expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2268,7 +2693,7 @@ describe('State Machine handler tests', function () {
2268
2693
  seq: 3,
2269
2694
  messageType: 'ANSWER'
2270
2695
  };
2271
- _context39.next = 4;
2696
+ _context43.next = 4;
2272
2697
  return call.sendMediaStateMachineEvt(dummyEvent);
2273
2698
  case 4:
2274
2699
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
@@ -2285,7 +2710,7 @@ describe('State Machine handler tests', function () {
2285
2710
  }
2286
2711
  };
2287
2712
  call.sendMediaStateMachineEvt(dummyEvent);
2288
- _context39.next = 5;
2713
+ _context43.next = 5;
2289
2714
  return call.sendMediaStateMachineEvt(dummyOkEvent);
2290
2715
  case 5:
2291
2716
  expect(call['receivedRoapOKSeq']).toBe(3);
@@ -2301,14 +2726,14 @@ describe('State Machine handler tests', function () {
2301
2726
  expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
2302
2727
  case 6:
2303
2728
  case "end":
2304
- return _context39.stop();
2729
+ return _context43.stop();
2305
2730
  }
2306
- }, _callee39);
2731
+ }, _callee43);
2307
2732
  })));
2308
- it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
2733
+ it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
2309
2734
  var statusPayload, dummyEvent, postMediaSpy, infoSpy, dummyOkEvent;
2310
- return _regenerator.default.wrap(function (_context40) {
2311
- while (1) switch (_context40.prev = _context40.next) {
2735
+ return _regenerator.default.wrap(function (_context44) {
2736
+ while (1) switch (_context44.prev = _context44.next) {
2312
2737
  case 0:
2313
2738
  statusPayload = {
2314
2739
  statusCode: 200,
@@ -2369,20 +2794,20 @@ describe('State Machine handler tests', function () {
2369
2794
  dummyEvent.data = undefined;
2370
2795
  call.sendCallStateMachineEvt(dummyEvent);
2371
2796
  expect(call['callStateMachine'].state.value).toBe('S_CALL_HOLD');
2372
- expect(infoSpy).toHaveBeenLastCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
2797
+ expect(infoSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
2373
2798
  file: 'call',
2374
2799
  method: 'handleCallHold'
2375
2800
  });
2376
2801
  case 1:
2377
2802
  case "end":
2378
- return _context40.stop();
2803
+ return _context44.stop();
2379
2804
  }
2380
- }, _callee40);
2805
+ }, _callee44);
2381
2806
  })));
2382
- it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
2807
+ it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
2383
2808
  var emitSpy, deleteSpy;
2384
- return _regenerator.default.wrap(function (_context41) {
2385
- while (1) switch (_context41.prev = _context41.next) {
2809
+ return _regenerator.default.wrap(function (_context45) {
2810
+ while (1) switch (_context45.prev = _context45.next) {
2386
2811
  case 0:
2387
2812
  emitSpy = jest.spyOn(call, 'emit');
2388
2813
  deleteSpy = jest.spyOn(call, 'delete').mockResolvedValue({
@@ -2391,7 +2816,7 @@ describe('State Machine handler tests', function () {
2391
2816
  call.sendCallStateMachineEvt({
2392
2817
  type: 'E_RECV_CALL_DISCONNECT'
2393
2818
  });
2394
- _context41.next = 1;
2819
+ _context45.next = 1;
2395
2820
  return (0, _testUtil.flushPromises)(1);
2396
2821
  case 1:
2397
2822
  expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
@@ -2399,9 +2824,9 @@ describe('State Machine handler tests', function () {
2399
2824
  expect(emitSpy.mock.invocationCallOrder[0]).toBeLessThan(deleteSpy.mock.invocationCallOrder[0]);
2400
2825
  case 2:
2401
2826
  case "end":
2402
- return _context41.stop();
2827
+ return _context45.stop();
2403
2828
  }
2404
- }, _callee41);
2829
+ }, _callee45);
2405
2830
  })));
2406
2831
  describe('Call event timers tests', function () {
2407
2832
  var callManager;
@@ -2412,10 +2837,10 @@ describe('State Machine handler tests', function () {
2412
2837
  afterEach(function () {
2413
2838
  jest.clearAllTimers();
2414
2839
  });
2415
- it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
2840
+ it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
2416
2841
  var statusPayload, dummyEvent, logSpy, emitSpy, deleteSpy, dummyOkEvent;
2417
- return _regenerator.default.wrap(function (_context42) {
2418
- while (1) switch (_context42.prev = _context42.next) {
2842
+ return _regenerator.default.wrap(function (_context46) {
2843
+ while (1) switch (_context46.prev = _context46.next) {
2419
2844
  case 0:
2420
2845
  statusPayload = {
2421
2846
  statusCode: 200,
@@ -2432,7 +2857,7 @@ describe('State Machine handler tests', function () {
2432
2857
  webex.request.mockReturnValue(statusPayload);
2433
2858
 
2434
2859
  // handleOutgoingCallSetup is asynchronous
2435
- _context42.next = 1;
2860
+ _context46.next = 1;
2436
2861
  return call.sendCallStateMachineEvt(dummyEvent);
2437
2862
  case 1:
2438
2863
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
@@ -2475,14 +2900,14 @@ describe('State Machine handler tests', function () {
2475
2900
  expect(callManager.callCollection).toStrictEqual({});
2476
2901
  case 2:
2477
2902
  case "end":
2478
- return _context42.stop();
2903
+ return _context46.stop();
2479
2904
  }
2480
- }, _callee42);
2905
+ }, _callee46);
2481
2906
  })));
2482
- it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
2907
+ it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
2483
2908
  var statusPayload, dummyEvent, call, emitSpy, deleteSpy, logSpy;
2484
- return _regenerator.default.wrap(function (_context43) {
2485
- while (1) switch (_context43.prev = _context43.next) {
2909
+ return _regenerator.default.wrap(function (_context47) {
2910
+ while (1) switch (_context47.prev = _context47.next) {
2486
2911
  case 0:
2487
2912
  statusPayload = {
2488
2913
  statusCode: 200,
@@ -2501,7 +2926,7 @@ describe('State Machine handler tests', function () {
2501
2926
  expect((0, _keys.default)(callManager.callCollection)[0]).toBe(call.getCorrelationId());
2502
2927
 
2503
2928
  // handleOutgoingCallSetup is asynchronous
2504
- _context43.next = 1;
2929
+ _context47.next = 1;
2505
2930
  return call.sendCallStateMachineEvt(dummyEvent);
2506
2931
  case 1:
2507
2932
  expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
@@ -2513,9 +2938,9 @@ describe('State Machine handler tests', function () {
2513
2938
  expect(callManager.callCollection).toStrictEqual({});
2514
2939
  case 2:
2515
2940
  case "end":
2516
- return _context43.stop();
2941
+ return _context47.stop();
2517
2942
  }
2518
- }, _callee43);
2943
+ }, _callee47);
2519
2944
  })));
2520
2945
  });
2521
2946
  });
@@ -2534,6 +2959,11 @@ describe('Supplementary Services tests', function () {
2534
2959
  };
2535
2960
  var call;
2536
2961
  beforeEach(function () {
2962
+ _request.APIRequest.resetInstance();
2963
+ _request.APIRequest.getInstance({
2964
+ webex: webex,
2965
+ isMobiusSocketEnabled: false
2966
+ });
2537
2967
  /* Since we are not actually testing from the start of a call , so it's good to set the below
2538
2968
  * parameters manually
2539
2969
  */
@@ -2575,10 +3005,10 @@ describe('Supplementary Services tests', function () {
2575
3005
  beforeEach(function () {
2576
3006
  call.removeAllListeners();
2577
3007
  });
2578
- it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
3008
+ it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
2579
3009
  var responsePayload, warnSpy, roapEvent;
2580
- return _regenerator.default.wrap(function (_context45) {
2581
- while (1) switch (_context45.prev = _context45.next) {
3010
+ return _regenerator.default.wrap(function (_context49) {
3011
+ while (1) switch (_context49.prev = _context49.next) {
2582
3012
  case 0:
2583
3013
  expect.assertions(7);
2584
3014
  responsePayload = {
@@ -2591,25 +3021,25 @@ describe('Supplementary Services tests', function () {
2591
3021
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2592
3022
  call['held'] = false;
2593
3023
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2594
- var _ref45 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44(correlationId) {
2595
- return _regenerator.default.wrap(function (_context44) {
2596
- while (1) switch (_context44.prev = _context44.next) {
3024
+ var _ref58 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48(correlationId) {
3025
+ return _regenerator.default.wrap(function (_context48) {
3026
+ while (1) switch (_context48.prev = _context48.next) {
2597
3027
  case 0:
2598
3028
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2599
3029
  case 1:
2600
3030
  case "end":
2601
- return _context44.stop();
3031
+ return _context48.stop();
2602
3032
  }
2603
- }, _callee44);
3033
+ }, _callee48);
2604
3034
  }));
2605
- return function (_x) {
2606
- return _ref45.apply(this, arguments);
3035
+ return function (_x5) {
3036
+ return _ref58.apply(this, arguments);
2607
3037
  };
2608
3038
  }());
2609
- _context45.next = 1;
3039
+ _context49.next = 1;
2610
3040
  return call.doHoldResume();
2611
3041
  case 1:
2612
- _context45.next = 2;
3042
+ _context49.next = 2;
2613
3043
  return (0, _testUtil.flushPromises)(2);
2614
3044
  case 2:
2615
3045
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2625,11 +3055,11 @@ describe('Supplementary Services tests', function () {
2625
3055
  call['handleIncomingRoapOffer']({}, dummyEvent);
2626
3056
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2627
3057
  roapEvent.data.type = 'ANSWER';
2628
- _context45.next = 3;
3058
+ _context49.next = 3;
2629
3059
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2630
3060
  case 3:
2631
3061
  roapEvent.data.type = 'OK';
2632
- _context45.next = 4;
3062
+ _context49.next = 4;
2633
3063
  return call['handleRoapEstablished']({}, dummyEvent);
2634
3064
  case 4:
2635
3065
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -2644,14 +3074,14 @@ describe('Supplementary Services tests', function () {
2644
3074
  });
2645
3075
  case 5:
2646
3076
  case "end":
2647
- return _context45.stop();
3077
+ return _context49.stop();
2648
3078
  }
2649
- }, _callee45);
3079
+ }, _callee49);
2650
3080
  })));
2651
- it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
3081
+ it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
2652
3082
  var responsePayload, warnSpy, roapEvent;
2653
- return _regenerator.default.wrap(function (_context47) {
2654
- while (1) switch (_context47.prev = _context47.next) {
3083
+ return _regenerator.default.wrap(function (_context51) {
3084
+ while (1) switch (_context51.prev = _context51.next) {
2655
3085
  case 0:
2656
3086
  expect.assertions(8);
2657
3087
  responsePayload = {
@@ -2664,26 +3094,26 @@ describe('Supplementary Services tests', function () {
2664
3094
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2665
3095
  call['held'] = false;
2666
3096
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2667
- var _ref47 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46(correlationId) {
2668
- return _regenerator.default.wrap(function (_context46) {
2669
- while (1) switch (_context46.prev = _context46.next) {
3097
+ var _ref60 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50(correlationId) {
3098
+ return _regenerator.default.wrap(function (_context50) {
3099
+ while (1) switch (_context50.prev = _context50.next) {
2670
3100
  case 0:
2671
3101
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2672
3102
  case 1:
2673
3103
  case "end":
2674
- return _context46.stop();
3104
+ return _context50.stop();
2675
3105
  }
2676
- }, _callee46);
3106
+ }, _callee50);
2677
3107
  }));
2678
- return function (_x2) {
2679
- return _ref47.apply(this, arguments);
3108
+ return function (_x6) {
3109
+ return _ref60.apply(this, arguments);
2680
3110
  };
2681
3111
  }());
2682
3112
  call.doHoldResume();
2683
- _context47.next = 1;
3113
+ _context51.next = 1;
2684
3114
  return _promise.default.resolve();
2685
3115
  case 1:
2686
- _context47.next = 2;
3116
+ _context51.next = 2;
2687
3117
  return _promise.default.resolve();
2688
3118
  case 2:
2689
3119
  expect(setTimeout).not.toHaveBeenCalled();
@@ -2699,11 +3129,11 @@ describe('Supplementary Services tests', function () {
2699
3129
  call['handleIncomingRoapOffer']({}, dummyEvent);
2700
3130
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2701
3131
  roapEvent.data.type = 'ANSWER';
2702
- _context47.next = 3;
3132
+ _context51.next = 3;
2703
3133
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2704
3134
  case 3:
2705
3135
  roapEvent.data.type = 'OK';
2706
- _context47.next = 4;
3136
+ _context51.next = 4;
2707
3137
  return call['handleRoapEstablished']({}, dummyEvent);
2708
3138
  case 4:
2709
3139
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -2718,14 +3148,14 @@ describe('Supplementary Services tests', function () {
2718
3148
  });
2719
3149
  case 5:
2720
3150
  case "end":
2721
- return _context47.stop();
3151
+ return _context51.stop();
2722
3152
  }
2723
- }, _callee47);
3153
+ }, _callee51);
2724
3154
  })));
2725
- it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
3155
+ it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
2726
3156
  var responsePayload;
2727
- return _regenerator.default.wrap(function (_context49) {
2728
- while (1) switch (_context49.prev = _context49.next) {
3157
+ return _regenerator.default.wrap(function (_context53) {
3158
+ while (1) switch (_context53.prev = _context53.next) {
2729
3159
  case 0:
2730
3160
  expect.assertions(4);
2731
3161
  responsePayload = {
@@ -2735,26 +3165,26 @@ describe('Supplementary Services tests', function () {
2735
3165
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2736
3166
  call['held'] = false;
2737
3167
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2738
- var _ref49 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48(errObj) {
2739
- return _regenerator.default.wrap(function (_context48) {
2740
- while (1) switch (_context48.prev = _context48.next) {
3168
+ var _ref62 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52(errObj) {
3169
+ return _regenerator.default.wrap(function (_context52) {
3170
+ while (1) switch (_context52.prev = _context52.next) {
2741
3171
  case 0:
2742
3172
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2743
3173
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2744
3174
  case 1:
2745
3175
  case "end":
2746
- return _context48.stop();
3176
+ return _context52.stop();
2747
3177
  }
2748
- }, _callee48);
3178
+ }, _callee52);
2749
3179
  }));
2750
- return function (_x3) {
2751
- return _ref49.apply(this, arguments);
3180
+ return function (_x7) {
3181
+ return _ref62.apply(this, arguments);
2752
3182
  };
2753
3183
  }());
2754
- _context49.next = 1;
3184
+ _context53.next = 1;
2755
3185
  return call.doHoldResume();
2756
3186
  case 1:
2757
- _context49.next = 2;
3187
+ _context53.next = 2;
2758
3188
  return (0, _testUtil.flushPromises)(2);
2759
3189
  case 2:
2760
3190
  expect(call.isHeld()).toStrictEqual(false);
@@ -2764,14 +3194,14 @@ describe('Supplementary Services tests', function () {
2764
3194
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2765
3195
  case 3:
2766
3196
  case "end":
2767
- return _context49.stop();
3197
+ return _context53.stop();
2768
3198
  }
2769
- }, _callee49);
3199
+ }, _callee53);
2770
3200
  })));
2771
- it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
3201
+ it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
2772
3202
  var responsePayload, rejectPayload, roapEvent;
2773
- return _regenerator.default.wrap(function (_context51) {
2774
- while (1) switch (_context51.prev = _context51.next) {
3203
+ return _regenerator.default.wrap(function (_context55) {
3204
+ while (1) switch (_context55.prev = _context55.next) {
2775
3205
  case 0:
2776
3206
  expect.assertions(5);
2777
3207
  responsePayload = {
@@ -2785,24 +3215,24 @@ describe('Supplementary Services tests', function () {
2785
3215
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2786
3216
  call['held'] = false;
2787
3217
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2788
- var _ref51 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50(errObj) {
2789
- return _regenerator.default.wrap(function (_context50) {
2790
- while (1) switch (_context50.prev = _context50.next) {
3218
+ var _ref64 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54(errObj) {
3219
+ return _regenerator.default.wrap(function (_context54) {
3220
+ while (1) switch (_context54.prev = _context54.next) {
2791
3221
  case 0:
2792
3222
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2793
3223
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2794
3224
  case 1:
2795
3225
  case "end":
2796
- return _context50.stop();
3226
+ return _context54.stop();
2797
3227
  }
2798
- }, _callee50);
3228
+ }, _callee54);
2799
3229
  }));
2800
- return function (_x4) {
2801
- return _ref51.apply(this, arguments);
3230
+ return function (_x8) {
3231
+ return _ref64.apply(this, arguments);
2802
3232
  };
2803
3233
  }());
2804
3234
  call.doHoldResume();
2805
- _context51.next = 1;
3235
+ _context55.next = 1;
2806
3236
  return (0, _testUtil.flushPromises)(2);
2807
3237
  case 1:
2808
3238
  /* the Call State should transition to S_CALL_ESTABLISHED
@@ -2812,7 +3242,7 @@ describe('Supplementary Services tests', function () {
2812
3242
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2813
3243
  /* We are intentionally failing the ROAP ANSWER */
2814
3244
  roapEvent.data.type = 'ANSWER';
2815
- _context51.next = 2;
3245
+ _context55.next = 2;
2816
3246
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2817
3247
  case 2:
2818
3248
  expect(call.isHeld()).toStrictEqual(false);
@@ -2820,14 +3250,14 @@ describe('Supplementary Services tests', function () {
2820
3250
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2821
3251
  case 3:
2822
3252
  case "end":
2823
- return _context51.stop();
3253
+ return _context55.stop();
2824
3254
  }
2825
- }, _callee51);
3255
+ }, _callee55);
2826
3256
  })));
2827
- it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
3257
+ it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56() {
2828
3258
  var responsePayload, warnSpy, roapEvent;
2829
- return _regenerator.default.wrap(function (_context52) {
2830
- while (1) switch (_context52.prev = _context52.next) {
3259
+ return _regenerator.default.wrap(function (_context56) {
3260
+ while (1) switch (_context56.prev = _context56.next) {
2831
3261
  case 0:
2832
3262
  responsePayload = {
2833
3263
  statusCode: 200,
@@ -2838,10 +3268,10 @@ describe('Supplementary Services tests', function () {
2838
3268
  jest.spyOn(global, 'clearTimeout');
2839
3269
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2840
3270
  call['held'] = false;
2841
- _context52.next = 1;
3271
+ _context56.next = 1;
2842
3272
  return call.doHoldResume();
2843
3273
  case 1:
2844
- _context52.next = 2;
3274
+ _context56.next = 2;
2845
3275
  return (0, _testUtil.flushPromises)(2);
2846
3276
  case 2:
2847
3277
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2856,19 +3286,19 @@ describe('Supplementary Services tests', function () {
2856
3286
  call['handleIncomingRoapOffer']({}, dummyEvent);
2857
3287
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2858
3288
  roapEvent.data.type = 'ANSWER';
2859
- _context52.next = 3;
3289
+ _context56.next = 3;
2860
3290
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2861
3291
  case 3:
2862
3292
  jest.spyOn(webex, 'request').mockRejectedValue({
2863
3293
  statusCode: 403
2864
3294
  });
2865
3295
  roapEvent.data.type = 'OK';
2866
- _context52.next = 4;
3296
+ _context56.next = 4;
2867
3297
  return call['handleRoapEstablished']({}, dummyEvent);
2868
3298
  case 4:
2869
3299
  /* this is for coverage */
2870
3300
  call['callStateMachine'].state.value = 'S_CALL_HOLD';
2871
- _context52.next = 5;
3301
+ _context56.next = 5;
2872
3302
  return call['handleRoapEstablished']({}, dummyEvent);
2873
3303
  case 5:
2874
3304
  expect(call.isHeld()).toStrictEqual(false);
@@ -2880,14 +3310,14 @@ describe('Supplementary Services tests', function () {
2880
3310
  });
2881
3311
  case 6:
2882
3312
  case "end":
2883
- return _context52.stop();
3313
+ return _context56.stop();
2884
3314
  }
2885
- }, _callee52);
3315
+ }, _callee56);
2886
3316
  })));
2887
- it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
3317
+ it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
2888
3318
  var responsePayload, warnSpy, roapEvent;
2889
- return _regenerator.default.wrap(function (_context53) {
2890
- while (1) switch (_context53.prev = _context53.next) {
3319
+ return _regenerator.default.wrap(function (_context57) {
3320
+ while (1) switch (_context57.prev = _context57.next) {
2891
3321
  case 0:
2892
3322
  responsePayload = {
2893
3323
  statusCode: 200,
@@ -2898,10 +3328,10 @@ describe('Supplementary Services tests', function () {
2898
3328
  jest.spyOn(global, 'clearTimeout');
2899
3329
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2900
3330
  call['held'] = true;
2901
- _context53.next = 1;
3331
+ _context57.next = 1;
2902
3332
  return call.doHoldResume();
2903
3333
  case 1:
2904
- _context53.next = 2;
3334
+ _context57.next = 2;
2905
3335
  return (0, _testUtil.flushPromises)(2);
2906
3336
  case 2:
2907
3337
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2916,14 +3346,14 @@ describe('Supplementary Services tests', function () {
2916
3346
  call['handleIncomingRoapOffer']({}, dummyEvent);
2917
3347
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2918
3348
  roapEvent.data.type = 'ANSWER';
2919
- _context53.next = 3;
3349
+ _context57.next = 3;
2920
3350
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2921
3351
  case 3:
2922
3352
  jest.spyOn(webex, 'request').mockRejectedValue({
2923
3353
  statusCode: 403
2924
3354
  });
2925
3355
  roapEvent.data.type = 'OK';
2926
- _context53.next = 4;
3356
+ _context57.next = 4;
2927
3357
  return call['handleRoapEstablished']({}, dummyEvent);
2928
3358
  case 4:
2929
3359
  expect(call.isHeld()).toStrictEqual(true);
@@ -2935,14 +3365,14 @@ describe('Supplementary Services tests', function () {
2935
3365
  });
2936
3366
  case 5:
2937
3367
  case "end":
2938
- return _context53.stop();
3368
+ return _context57.stop();
2939
3369
  }
2940
- }, _callee53);
3370
+ }, _callee57);
2941
3371
  })));
2942
- it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
3372
+ it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59() {
2943
3373
  var responsePayload, roapEvent;
2944
- return _regenerator.default.wrap(function (_context55) {
2945
- while (1) switch (_context55.prev = _context55.next) {
3374
+ return _regenerator.default.wrap(function (_context59) {
3375
+ while (1) switch (_context59.prev = _context59.next) {
2946
3376
  case 0:
2947
3377
  expect.assertions(5);
2948
3378
  responsePayload = {
@@ -2952,25 +3382,25 @@ describe('Supplementary Services tests', function () {
2952
3382
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
2953
3383
  call['held'] = false;
2954
3384
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2955
- var _ref55 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54(errObj) {
2956
- return _regenerator.default.wrap(function (_context54) {
2957
- while (1) switch (_context54.prev = _context54.next) {
3385
+ var _ref68 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58(errObj) {
3386
+ return _regenerator.default.wrap(function (_context58) {
3387
+ while (1) switch (_context58.prev = _context58.next) {
2958
3388
  case 0:
2959
3389
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
2960
3390
  expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
2961
3391
  case 1:
2962
3392
  case "end":
2963
- return _context54.stop();
3393
+ return _context58.stop();
2964
3394
  }
2965
- }, _callee54);
3395
+ }, _callee58);
2966
3396
  }));
2967
- return function (_x5) {
2968
- return _ref55.apply(this, arguments);
3397
+ return function (_x9) {
3398
+ return _ref68.apply(this, arguments);
2969
3399
  };
2970
3400
  }());
2971
3401
  jest.runAllTimers();
2972
3402
  call.doHoldResume();
2973
- _context55.next = 1;
3403
+ _context59.next = 1;
2974
3404
  return (0, _testUtil.flushPromises)(2);
2975
3405
  case 1:
2976
3406
  /* At this point, the Call State should be S_CALL_HOLD
@@ -2983,11 +3413,11 @@ describe('Supplementary Services tests', function () {
2983
3413
  call['handleIncomingRoapOffer']({}, dummyEvent);
2984
3414
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2985
3415
  roapEvent.data.type = 'ANSWER';
2986
- _context55.next = 2;
3416
+ _context59.next = 2;
2987
3417
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2988
3418
  case 2:
2989
3419
  roapEvent.data.type = 'OK';
2990
- _context55.next = 3;
3420
+ _context59.next = 3;
2991
3421
  return call['handleRoapEstablished']({}, dummyEvent);
2992
3422
  case 3:
2993
3423
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -2999,14 +3429,14 @@ describe('Supplementary Services tests', function () {
2999
3429
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3000
3430
  case 4:
3001
3431
  case "end":
3002
- return _context55.stop();
3432
+ return _context59.stop();
3003
3433
  }
3004
- }, _callee55);
3434
+ }, _callee59);
3005
3435
  })));
3006
- it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
3436
+ it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61() {
3007
3437
  var responsePayload, warnSpy, roapEvent;
3008
- return _regenerator.default.wrap(function (_context57) {
3009
- while (1) switch (_context57.prev = _context57.next) {
3438
+ return _regenerator.default.wrap(function (_context61) {
3439
+ while (1) switch (_context61.prev = _context61.next) {
3010
3440
  case 0:
3011
3441
  expect.assertions(7);
3012
3442
  responsePayload = {
@@ -3019,25 +3449,25 @@ describe('Supplementary Services tests', function () {
3019
3449
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3020
3450
  call['held'] = true;
3021
3451
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
3022
- var _ref57 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56(correlationId) {
3023
- return _regenerator.default.wrap(function (_context56) {
3024
- while (1) switch (_context56.prev = _context56.next) {
3452
+ var _ref70 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60(correlationId) {
3453
+ return _regenerator.default.wrap(function (_context60) {
3454
+ while (1) switch (_context60.prev = _context60.next) {
3025
3455
  case 0:
3026
3456
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3027
3457
  case 1:
3028
3458
  case "end":
3029
- return _context56.stop();
3459
+ return _context60.stop();
3030
3460
  }
3031
- }, _callee56);
3461
+ }, _callee60);
3032
3462
  }));
3033
- return function (_x6) {
3034
- return _ref57.apply(this, arguments);
3463
+ return function (_x0) {
3464
+ return _ref70.apply(this, arguments);
3035
3465
  };
3036
3466
  }());
3037
- _context57.next = 1;
3467
+ _context61.next = 1;
3038
3468
  return call.doHoldResume();
3039
3469
  case 1:
3040
- _context57.next = 2;
3470
+ _context61.next = 2;
3041
3471
  return (0, _testUtil.flushPromises)(2);
3042
3472
  case 2:
3043
3473
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -3053,11 +3483,11 @@ describe('Supplementary Services tests', function () {
3053
3483
  call['handleIncomingRoapOffer']({}, dummyEvent);
3054
3484
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3055
3485
  roapEvent.data.type = 'ANSWER';
3056
- _context57.next = 3;
3486
+ _context61.next = 3;
3057
3487
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3058
3488
  case 3:
3059
3489
  roapEvent.data.type = 'OK';
3060
- _context57.next = 4;
3490
+ _context61.next = 4;
3061
3491
  return call['handleRoapEstablished']({}, dummyEvent);
3062
3492
  case 4:
3063
3493
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -3072,14 +3502,14 @@ describe('Supplementary Services tests', function () {
3072
3502
  });
3073
3503
  case 5:
3074
3504
  case "end":
3075
- return _context57.stop();
3505
+ return _context61.stop();
3076
3506
  }
3077
- }, _callee57);
3507
+ }, _callee61);
3078
3508
  })));
3079
- it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59() {
3509
+ it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
3080
3510
  var responsePayload, warnSpy, roapEvent;
3081
- return _regenerator.default.wrap(function (_context59) {
3082
- while (1) switch (_context59.prev = _context59.next) {
3511
+ return _regenerator.default.wrap(function (_context63) {
3512
+ while (1) switch (_context63.prev = _context63.next) {
3083
3513
  case 0:
3084
3514
  expect.assertions(7);
3085
3515
  responsePayload = {
@@ -3092,26 +3522,26 @@ describe('Supplementary Services tests', function () {
3092
3522
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3093
3523
  call['held'] = true;
3094
3524
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
3095
- var _ref59 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58(correlationId) {
3096
- return _regenerator.default.wrap(function (_context58) {
3097
- while (1) switch (_context58.prev = _context58.next) {
3525
+ var _ref72 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62(correlationId) {
3526
+ return _regenerator.default.wrap(function (_context62) {
3527
+ while (1) switch (_context62.prev = _context62.next) {
3098
3528
  case 0:
3099
3529
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3100
3530
  case 1:
3101
3531
  case "end":
3102
- return _context58.stop();
3532
+ return _context62.stop();
3103
3533
  }
3104
- }, _callee58);
3534
+ }, _callee62);
3105
3535
  }));
3106
- return function (_x7) {
3107
- return _ref59.apply(this, arguments);
3536
+ return function (_x1) {
3537
+ return _ref72.apply(this, arguments);
3108
3538
  };
3109
3539
  }());
3110
3540
  call.doHoldResume();
3111
- _context59.next = 1;
3541
+ _context63.next = 1;
3112
3542
  return _promise.default.resolve();
3113
3543
  case 1:
3114
- _context59.next = 2;
3544
+ _context63.next = 2;
3115
3545
  return _promise.default.resolve();
3116
3546
  case 2:
3117
3547
  expect(setTimeout).not.toHaveBeenCalled();
@@ -3127,11 +3557,11 @@ describe('Supplementary Services tests', function () {
3127
3557
  call['handleIncomingRoapOffer']({}, dummyEvent);
3128
3558
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3129
3559
  roapEvent.data.type = 'ANSWER';
3130
- _context59.next = 3;
3560
+ _context63.next = 3;
3131
3561
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3132
3562
  case 3:
3133
3563
  roapEvent.data.type = 'OK';
3134
- _context59.next = 4;
3564
+ _context63.next = 4;
3135
3565
  return call['handleRoapEstablished']({}, dummyEvent);
3136
3566
  case 4:
3137
3567
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -3146,14 +3576,14 @@ describe('Supplementary Services tests', function () {
3146
3576
  });
3147
3577
  case 5:
3148
3578
  case "end":
3149
- return _context59.stop();
3579
+ return _context63.stop();
3150
3580
  }
3151
- }, _callee59);
3581
+ }, _callee63);
3152
3582
  })));
3153
- it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61() {
3583
+ it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65() {
3154
3584
  var responsePayload;
3155
- return _regenerator.default.wrap(function (_context61) {
3156
- while (1) switch (_context61.prev = _context61.next) {
3585
+ return _regenerator.default.wrap(function (_context65) {
3586
+ while (1) switch (_context65.prev = _context65.next) {
3157
3587
  case 0:
3158
3588
  expect.assertions(4);
3159
3589
  responsePayload = {
@@ -3163,26 +3593,26 @@ describe('Supplementary Services tests', function () {
3163
3593
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3164
3594
  call['held'] = true;
3165
3595
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3166
- var _ref61 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60(errObj) {
3167
- return _regenerator.default.wrap(function (_context60) {
3168
- while (1) switch (_context60.prev = _context60.next) {
3596
+ var _ref74 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64(errObj) {
3597
+ return _regenerator.default.wrap(function (_context64) {
3598
+ while (1) switch (_context64.prev = _context64.next) {
3169
3599
  case 0:
3170
3600
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3171
3601
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3172
3602
  case 1:
3173
3603
  case "end":
3174
- return _context60.stop();
3604
+ return _context64.stop();
3175
3605
  }
3176
- }, _callee60);
3606
+ }, _callee64);
3177
3607
  }));
3178
- return function (_x8) {
3179
- return _ref61.apply(this, arguments);
3608
+ return function (_x10) {
3609
+ return _ref74.apply(this, arguments);
3180
3610
  };
3181
3611
  }());
3182
- _context61.next = 1;
3612
+ _context65.next = 1;
3183
3613
  return call.doHoldResume();
3184
3614
  case 1:
3185
- _context61.next = 2;
3615
+ _context65.next = 2;
3186
3616
  return (0, _testUtil.flushPromises)(2);
3187
3617
  case 2:
3188
3618
  expect(call.isHeld()).toStrictEqual(true);
@@ -3193,14 +3623,14 @@ describe('Supplementary Services tests', function () {
3193
3623
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3194
3624
  case 3:
3195
3625
  case "end":
3196
- return _context61.stop();
3626
+ return _context65.stop();
3197
3627
  }
3198
- }, _callee61);
3628
+ }, _callee65);
3199
3629
  })));
3200
- it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
3630
+ it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67() {
3201
3631
  var responsePayload, rejectPayload, roapEvent;
3202
- return _regenerator.default.wrap(function (_context63) {
3203
- while (1) switch (_context63.prev = _context63.next) {
3632
+ return _regenerator.default.wrap(function (_context67) {
3633
+ while (1) switch (_context67.prev = _context67.next) {
3204
3634
  case 0:
3205
3635
  expect.assertions(5);
3206
3636
  responsePayload = {
@@ -3214,24 +3644,24 @@ describe('Supplementary Services tests', function () {
3214
3644
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
3215
3645
  call['held'] = true;
3216
3646
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3217
- var _ref63 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62(errObj) {
3218
- return _regenerator.default.wrap(function (_context62) {
3219
- while (1) switch (_context62.prev = _context62.next) {
3647
+ var _ref76 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66(errObj) {
3648
+ return _regenerator.default.wrap(function (_context66) {
3649
+ while (1) switch (_context66.prev = _context66.next) {
3220
3650
  case 0:
3221
3651
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
3222
3652
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
3223
3653
  case 1:
3224
3654
  case "end":
3225
- return _context62.stop();
3655
+ return _context66.stop();
3226
3656
  }
3227
- }, _callee62);
3657
+ }, _callee66);
3228
3658
  }));
3229
- return function (_x9) {
3230
- return _ref63.apply(this, arguments);
3659
+ return function (_x11) {
3660
+ return _ref76.apply(this, arguments);
3231
3661
  };
3232
3662
  }());
3233
3663
  call.doHoldResume();
3234
- _context63.next = 1;
3664
+ _context67.next = 1;
3235
3665
  return (0, _testUtil.flushPromises)(2);
3236
3666
  case 1:
3237
3667
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
@@ -3242,7 +3672,7 @@ describe('Supplementary Services tests', function () {
3242
3672
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3243
3673
  /* We are intentionally failing the ROAP ANSWER */
3244
3674
  roapEvent.data.type = 'ANSWER';
3245
- _context63.next = 2;
3675
+ _context67.next = 2;
3246
3676
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3247
3677
  case 2:
3248
3678
  expect(call.isHeld()).toStrictEqual(true);
@@ -3250,14 +3680,14 @@ describe('Supplementary Services tests', function () {
3250
3680
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3251
3681
  case 3:
3252
3682
  case "end":
3253
- return _context63.stop();
3683
+ return _context67.stop();
3254
3684
  }
3255
- }, _callee63);
3685
+ }, _callee67);
3256
3686
  })));
3257
- it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65() {
3687
+ it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69() {
3258
3688
  var responsePayload, roapEvent;
3259
- return _regenerator.default.wrap(function (_context65) {
3260
- while (1) switch (_context65.prev = _context65.next) {
3689
+ return _regenerator.default.wrap(function (_context69) {
3690
+ while (1) switch (_context69.prev = _context69.next) {
3261
3691
  case 0:
3262
3692
  expect.assertions(5);
3263
3693
  responsePayload = {
@@ -3267,24 +3697,24 @@ describe('Supplementary Services tests', function () {
3267
3697
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
3268
3698
  call['held'] = true;
3269
3699
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
3270
- var _ref65 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64(errObj) {
3271
- return _regenerator.default.wrap(function (_context64) {
3272
- while (1) switch (_context64.prev = _context64.next) {
3700
+ var _ref78 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68(errObj) {
3701
+ return _regenerator.default.wrap(function (_context68) {
3702
+ while (1) switch (_context68.prev = _context68.next) {
3273
3703
  case 0:
3274
3704
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
3275
3705
  expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
3276
3706
  case 1:
3277
3707
  case "end":
3278
- return _context64.stop();
3708
+ return _context68.stop();
3279
3709
  }
3280
- }, _callee64);
3710
+ }, _callee68);
3281
3711
  }));
3282
- return function (_x0) {
3283
- return _ref65.apply(this, arguments);
3712
+ return function (_x12) {
3713
+ return _ref78.apply(this, arguments);
3284
3714
  };
3285
3715
  }());
3286
3716
  call.doHoldResume();
3287
- _context65.next = 1;
3717
+ _context69.next = 1;
3288
3718
  return (0, _testUtil.flushPromises)(2);
3289
3719
  case 1:
3290
3720
  /* At this point ,the Call State should be S_CALL_RESUME
@@ -3297,11 +3727,11 @@ describe('Supplementary Services tests', function () {
3297
3727
  call['handleIncomingRoapOffer']({}, dummyEvent);
3298
3728
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
3299
3729
  roapEvent.data.type = 'ANSWER';
3300
- _context65.next = 2;
3730
+ _context69.next = 2;
3301
3731
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
3302
3732
  case 2:
3303
3733
  roapEvent.data.type = 'OK';
3304
- _context65.next = 3;
3734
+ _context69.next = 3;
3305
3735
  return call['handleRoapEstablished']({}, dummyEvent);
3306
3736
  case 3:
3307
3737
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -3311,9 +3741,9 @@ describe('Supplementary Services tests', function () {
3311
3741
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
3312
3742
  case 4:
3313
3743
  case "end":
3314
- return _context65.stop();
3744
+ return _context69.stop();
3315
3745
  }
3316
- }, _callee65);
3746
+ }, _callee69);
3317
3747
  })));
3318
3748
  });
3319
3749
  describe('Call transfer tests', function () {
@@ -3346,10 +3776,10 @@ describe('Supplementary Services tests', function () {
3346
3776
  secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
3347
3777
  secondCall['held'] = false;
3348
3778
  });
3349
- it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68() {
3779
+ it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3350
3780
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3351
- return _regenerator.default.wrap(function (_context68) {
3352
- while (1) switch (_context68.prev = _context68.next) {
3781
+ return _regenerator.default.wrap(function (_context72) {
3782
+ while (1) switch (_context72.prev = _context72.next) {
3353
3783
  case 0:
3354
3784
  expect.assertions(12); // Updated to match actual assertion count
3355
3785
  responsePayload = {
@@ -3361,41 +3791,41 @@ describe('Supplementary Services tests', function () {
3361
3791
  infoSpy = jest.spyOn(_Logger.default, 'info');
3362
3792
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3363
3793
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3364
- var _ref67 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66(correlationId) {
3365
- return _regenerator.default.wrap(function (_context66) {
3366
- while (1) switch (_context66.prev = _context66.next) {
3794
+ var _ref80 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70(correlationId) {
3795
+ return _regenerator.default.wrap(function (_context70) {
3796
+ while (1) switch (_context70.prev = _context70.next) {
3367
3797
  case 0:
3368
3798
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3369
3799
  case 1:
3370
3800
  case "end":
3371
- return _context66.stop();
3801
+ return _context70.stop();
3372
3802
  }
3373
- }, _callee66);
3803
+ }, _callee70);
3374
3804
  }));
3375
- return function (_x1) {
3376
- return _ref67.apply(this, arguments);
3805
+ return function (_x13) {
3806
+ return _ref80.apply(this, arguments);
3377
3807
  };
3378
3808
  }());
3379
3809
  secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3380
- var _ref68 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67(correlationId) {
3381
- return _regenerator.default.wrap(function (_context67) {
3382
- while (1) switch (_context67.prev = _context67.next) {
3810
+ var _ref81 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71(correlationId) {
3811
+ return _regenerator.default.wrap(function (_context71) {
3812
+ while (1) switch (_context71.prev = _context71.next) {
3383
3813
  case 0:
3384
3814
  expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
3385
3815
  case 1:
3386
3816
  case "end":
3387
- return _context67.stop();
3817
+ return _context71.stop();
3388
3818
  }
3389
- }, _callee67);
3819
+ }, _callee71);
3390
3820
  }));
3391
- return function (_x10) {
3392
- return _ref68.apply(this, arguments);
3821
+ return function (_x14) {
3822
+ return _ref81.apply(this, arguments);
3393
3823
  };
3394
3824
  }());
3395
- _context68.next = 1;
3825
+ _context72.next = 1;
3396
3826
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3397
3827
  case 1:
3398
- _context68.next = 2;
3828
+ _context72.next = 2;
3399
3829
  return (0, _testUtil.flushPromises)(2);
3400
3830
  case 2:
3401
3831
  expect(requestSpy).toBeCalled();
@@ -3418,14 +3848,14 @@ describe('Supplementary Services tests', function () {
3418
3848
  expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3419
3849
  case 3:
3420
3850
  case "end":
3421
- return _context68.stop();
3851
+ return _context72.stop();
3422
3852
  }
3423
- }, _callee68);
3853
+ }, _callee72);
3424
3854
  })));
3425
- it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
3855
+ it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee74() {
3426
3856
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
3427
- return _regenerator.default.wrap(function (_context70) {
3428
- while (1) switch (_context70.prev = _context70.next) {
3857
+ return _regenerator.default.wrap(function (_context74) {
3858
+ while (1) switch (_context74.prev = _context74.next) {
3429
3859
  case 0:
3430
3860
  expect.assertions(10); // Updated to match actual assertion count
3431
3861
  responsePayload = {
@@ -3437,25 +3867,25 @@ describe('Supplementary Services tests', function () {
3437
3867
  infoSpy = jest.spyOn(_Logger.default, 'info');
3438
3868
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3439
3869
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
3440
- var _ref70 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69(correlationId) {
3441
- return _regenerator.default.wrap(function (_context69) {
3442
- while (1) switch (_context69.prev = _context69.next) {
3870
+ var _ref83 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73(correlationId) {
3871
+ return _regenerator.default.wrap(function (_context73) {
3872
+ while (1) switch (_context73.prev = _context73.next) {
3443
3873
  case 0:
3444
3874
  expect(correlationId).toStrictEqual(call.getCorrelationId());
3445
3875
  case 1:
3446
3876
  case "end":
3447
- return _context69.stop();
3877
+ return _context73.stop();
3448
3878
  }
3449
- }, _callee69);
3879
+ }, _callee73);
3450
3880
  }));
3451
- return function (_x11) {
3452
- return _ref70.apply(this, arguments);
3881
+ return function (_x15) {
3882
+ return _ref83.apply(this, arguments);
3453
3883
  };
3454
3884
  }());
3455
- _context70.next = 1;
3885
+ _context74.next = 1;
3456
3886
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3457
3887
  case 1:
3458
- _context70.next = 2;
3888
+ _context74.next = 2;
3459
3889
  return (0, _testUtil.flushPromises)(2);
3460
3890
  case 2:
3461
3891
  expect(requestSpy).toBeCalled();
@@ -3474,14 +3904,14 @@ describe('Supplementary Services tests', function () {
3474
3904
  expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
3475
3905
  case 3:
3476
3906
  case "end":
3477
- return _context70.stop();
3907
+ return _context74.stop();
3478
3908
  }
3479
- }, _callee70);
3909
+ }, _callee74);
3480
3910
  })));
3481
- it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
3911
+ it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee75() {
3482
3912
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3483
- return _regenerator.default.wrap(function (_context71) {
3484
- while (1) switch (_context71.prev = _context71.next) {
3913
+ return _regenerator.default.wrap(function (_context75) {
3914
+ while (1) switch (_context75.prev = _context75.next) {
3485
3915
  case 0:
3486
3916
  responsePayload = {
3487
3917
  statusCode: 403,
@@ -3492,10 +3922,10 @@ describe('Supplementary Services tests', function () {
3492
3922
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3493
3923
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3494
3924
  call['broadworksCorrelationInfo'] = 'dummy-broadworks-correlation-info';
3495
- _context71.next = 1;
3925
+ _context75.next = 1;
3496
3926
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
3497
3927
  case 1:
3498
- _context71.next = 2;
3928
+ _context75.next = 2;
3499
3929
  return (0, _testUtil.flushPromises)(1);
3500
3930
  case 2:
3501
3931
  expect(requestSpy).toBeCalled();
@@ -3516,14 +3946,14 @@ describe('Supplementary Services tests', function () {
3516
3946
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
3517
3947
  case 3:
3518
3948
  case "end":
3519
- return _context71.stop();
3949
+ return _context75.stop();
3520
3950
  }
3521
- }, _callee71);
3951
+ }, _callee75);
3522
3952
  })));
3523
- it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
3953
+ it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee76() {
3524
3954
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
3525
- return _regenerator.default.wrap(function (_context72) {
3526
- while (1) switch (_context72.prev = _context72.next) {
3955
+ return _regenerator.default.wrap(function (_context76) {
3956
+ while (1) switch (_context76.prev = _context76.next) {
3527
3957
  case 0:
3528
3958
  responsePayload = {
3529
3959
  statusCode: 403,
@@ -3533,10 +3963,10 @@ describe('Supplementary Services tests', function () {
3533
3963
  requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
3534
3964
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3535
3965
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
3536
- _context72.next = 1;
3966
+ _context76.next = 1;
3537
3967
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
3538
3968
  case 1:
3539
- _context72.next = 2;
3969
+ _context76.next = 2;
3540
3970
  return (0, _testUtil.flushPromises)(2);
3541
3971
  case 2:
3542
3972
  expect(requestSpy).toBeCalled();
@@ -3557,18 +3987,18 @@ describe('Supplementary Services tests', function () {
3557
3987
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
3558
3988
  case 3:
3559
3989
  case "end":
3560
- return _context72.stop();
3990
+ return _context76.stop();
3561
3991
  }
3562
- }, _callee72);
3992
+ }, _callee76);
3563
3993
  })));
3564
- it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
3994
+ it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee77() {
3565
3995
  var requestSpy, warnSpy;
3566
- return _regenerator.default.wrap(function (_context73) {
3567
- while (1) switch (_context73.prev = _context73.next) {
3996
+ return _regenerator.default.wrap(function (_context77) {
3997
+ while (1) switch (_context77.prev = _context77.next) {
3568
3998
  case 0:
3569
3999
  requestSpy = jest.spyOn(webex, 'request');
3570
4000
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3571
- _context73.next = 1;
4001
+ _context77.next = 1;
3572
4002
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
3573
4003
  case 1:
3574
4004
  /* We should be in CALL_ESTABLISHED state */
@@ -3580,18 +4010,18 @@ describe('Supplementary Services tests', function () {
3580
4010
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3581
4011
  case 2:
3582
4012
  case "end":
3583
- return _context73.stop();
4013
+ return _context77.stop();
3584
4014
  }
3585
- }, _callee73);
4015
+ }, _callee77);
3586
4016
  })));
3587
- it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee74() {
4017
+ it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee78() {
3588
4018
  var requestSpy, warnSpy;
3589
- return _regenerator.default.wrap(function (_context74) {
3590
- while (1) switch (_context74.prev = _context74.next) {
4019
+ return _regenerator.default.wrap(function (_context78) {
4020
+ while (1) switch (_context78.prev = _context78.next) {
3591
4021
  case 0:
3592
4022
  requestSpy = jest.spyOn(webex, 'request');
3593
4023
  warnSpy = jest.spyOn(_Logger.default, 'warn');
3594
- _context74.next = 1;
4024
+ _context78.next = 1;
3595
4025
  return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
3596
4026
  case 1:
3597
4027
  /* We should be in CALL_ESTABLISHED state */
@@ -3603,9 +4033,9 @@ describe('Supplementary Services tests', function () {
3603
4033
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
3604
4034
  case 2:
3605
4035
  case "end":
3606
- return _context74.stop();
4036
+ return _context78.stop();
3607
4037
  }
3608
- }, _callee74);
4038
+ }, _callee78);
3609
4039
  })));
3610
4040
  });
3611
4041
  });