@webex/calling 3.0.0-next.4 → 3.0.0-next.41

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 (316) hide show
  1. package/CHANGELOG.md +1403 -1403
  2. package/README.md +74 -74
  3. package/dist/CallHistory/CallHistory.js +201 -0
  4. package/dist/CallHistory/CallHistory.js.map +1 -0
  5. package/dist/CallHistory/CallHistory.test.js +142 -0
  6. package/dist/CallHistory/CallHistory.test.js.map +1 -0
  7. package/dist/CallHistory/callHistoryFixtures.js +366 -0
  8. package/dist/CallHistory/callHistoryFixtures.js.map +1 -0
  9. package/dist/CallHistory/constants.js +17 -0
  10. package/dist/CallHistory/constants.js.map +1 -0
  11. package/dist/CallHistory/types.js +7 -0
  12. package/dist/CallHistory/types.js.map +1 -0
  13. package/dist/CallSettings/CallSettings.js +279 -0
  14. package/dist/CallSettings/CallSettings.js.map +1 -0
  15. package/dist/CallSettings/CallSettings.test.js +122 -0
  16. package/dist/CallSettings/CallSettings.test.js.map +1 -0
  17. package/dist/CallSettings/UcmBackendConnector.js +216 -0
  18. package/dist/CallSettings/UcmBackendConnector.js.map +1 -0
  19. package/dist/CallSettings/UcmBackendConnector.test.js +259 -0
  20. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -0
  21. package/dist/CallSettings/WxCallBackendConnector.js +547 -0
  22. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -0
  23. package/dist/CallSettings/WxCallBackendConnector.test.js +802 -0
  24. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -0
  25. package/dist/CallSettings/constants.js +19 -0
  26. package/dist/CallSettings/constants.js.map +1 -0
  27. package/dist/CallSettings/testFixtures.js +68 -0
  28. package/dist/CallSettings/testFixtures.js.map +1 -0
  29. package/dist/CallSettings/types.js +7 -0
  30. package/dist/CallSettings/types.js.map +1 -0
  31. package/dist/CallingClient/CallingClient.js +631 -0
  32. package/dist/CallingClient/CallingClient.js.map +1 -0
  33. package/dist/CallingClient/CallingClient.test.js +992 -0
  34. package/dist/CallingClient/CallingClient.test.js.map +1 -0
  35. package/dist/CallingClient/callRecordFixtures.js +101 -0
  36. package/dist/CallingClient/callRecordFixtures.js.map +1 -0
  37. package/dist/CallingClient/calling/CallerId/index.js +267 -0
  38. package/dist/CallingClient/calling/CallerId/index.js.map +1 -0
  39. package/dist/CallingClient/calling/CallerId/index.test.js +274 -0
  40. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -0
  41. package/dist/CallingClient/calling/CallerId/types.js +7 -0
  42. package/dist/CallingClient/calling/CallerId/types.js.map +1 -0
  43. package/dist/CallingClient/calling/call.js +3055 -0
  44. package/dist/CallingClient/calling/call.js.map +1 -0
  45. package/dist/CallingClient/calling/call.test.js +2858 -0
  46. package/dist/CallingClient/calling/call.test.js.map +1 -0
  47. package/dist/CallingClient/calling/callManager.js +432 -0
  48. package/dist/CallingClient/calling/callManager.js.map +1 -0
  49. package/dist/CallingClient/calling/callManager.test.js +683 -0
  50. package/dist/CallingClient/calling/callManager.test.js.map +1 -0
  51. package/dist/CallingClient/calling/index.js +30 -0
  52. package/dist/CallingClient/calling/index.js.map +1 -0
  53. package/dist/CallingClient/calling/types.js +69 -0
  54. package/dist/CallingClient/calling/types.js.map +1 -0
  55. package/dist/CallingClient/callingClientFixtures.js +143 -0
  56. package/dist/CallingClient/callingClientFixtures.js.map +1 -0
  57. package/dist/CallingClient/constants.js +134 -0
  58. package/dist/CallingClient/constants.js.map +1 -0
  59. package/dist/CallingClient/line/index.js +314 -0
  60. package/dist/CallingClient/line/index.js.map +1 -0
  61. package/dist/CallingClient/line/line.test.js +270 -0
  62. package/dist/CallingClient/line/line.test.js.map +1 -0
  63. package/dist/CallingClient/line/types.js +21 -0
  64. package/dist/CallingClient/line/types.js.map +1 -0
  65. package/dist/CallingClient/registration/index.js +19 -0
  66. package/dist/CallingClient/registration/index.js.map +1 -0
  67. package/dist/CallingClient/registration/register.js +1286 -0
  68. package/dist/CallingClient/registration/register.js.map +1 -0
  69. package/dist/CallingClient/registration/register.test.js +839 -0
  70. package/dist/CallingClient/registration/register.test.js.map +1 -0
  71. package/dist/CallingClient/registration/registerFixtures.js +36 -0
  72. package/dist/CallingClient/registration/registerFixtures.js.map +1 -0
  73. package/dist/CallingClient/registration/types.js +7 -0
  74. package/dist/CallingClient/registration/types.js.map +1 -0
  75. package/dist/CallingClient/types.js +7 -0
  76. package/dist/CallingClient/types.js.map +1 -0
  77. package/dist/Contacts/ContactsClient.js +1156 -0
  78. package/dist/Contacts/ContactsClient.js.map +1 -0
  79. package/dist/Contacts/ContactsClient.test.js +725 -0
  80. package/dist/Contacts/ContactsClient.test.js.map +1 -0
  81. package/dist/Contacts/constants.js +28 -0
  82. package/dist/Contacts/constants.js.map +1 -0
  83. package/dist/Contacts/contactFixtures.js +314 -0
  84. package/dist/Contacts/contactFixtures.js.map +1 -0
  85. package/dist/Contacts/types.js +43 -0
  86. package/dist/Contacts/types.js.map +1 -0
  87. package/dist/Errors/catalog/CallError.js +92 -0
  88. package/dist/Errors/catalog/CallError.js.map +1 -0
  89. package/dist/Errors/catalog/CallingDeviceError.js +86 -0
  90. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -0
  91. package/dist/Errors/catalog/ExtendedError.js +44 -0
  92. package/dist/Errors/catalog/ExtendedError.js.map +1 -0
  93. package/dist/Errors/catalog/LineError.js +88 -0
  94. package/dist/Errors/catalog/LineError.js.map +1 -0
  95. package/dist/Errors/index.js +28 -0
  96. package/dist/Errors/index.js.map +1 -0
  97. package/dist/Errors/types.js +57 -0
  98. package/dist/Errors/types.js.map +1 -0
  99. package/dist/Events/impl/index.js +81 -0
  100. package/dist/Events/impl/index.js.map +1 -0
  101. package/dist/Events/types.js +103 -0
  102. package/dist/Events/types.js.map +1 -0
  103. package/dist/Logger/index.js +220 -0
  104. package/dist/Logger/index.js.map +1 -0
  105. package/dist/Logger/index.test.js +62 -0
  106. package/dist/Logger/index.test.js.map +1 -0
  107. package/dist/Logger/types.js +34 -0
  108. package/dist/Logger/types.js.map +1 -0
  109. package/dist/Metrics/index.js +327 -0
  110. package/dist/Metrics/index.js.map +1 -0
  111. package/dist/Metrics/index.test.js +291 -0
  112. package/dist/Metrics/index.test.js.map +1 -0
  113. package/dist/Metrics/types.js +45 -0
  114. package/dist/Metrics/types.js.map +1 -0
  115. package/dist/SDKConnector/index.js +104 -0
  116. package/dist/SDKConnector/index.js.map +1 -0
  117. package/dist/SDKConnector/index.test.js +9 -0
  118. package/dist/SDKConnector/index.test.js.map +1 -0
  119. package/dist/SDKConnector/types.js +7 -0
  120. package/dist/SDKConnector/types.js.map +1 -0
  121. package/dist/SDKConnector/utils.js +39 -0
  122. package/dist/SDKConnector/utils.js.map +1 -0
  123. package/dist/SDKConnector/utils.test.js +9 -0
  124. package/dist/SDKConnector/utils.test.js.map +1 -0
  125. package/dist/Voicemail/BroadworksBackendConnector.js +641 -0
  126. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -0
  127. package/dist/Voicemail/BroadworksBackendConnector.test.js +733 -0
  128. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -0
  129. package/dist/Voicemail/UcmBackendConnector.js +574 -0
  130. package/dist/Voicemail/UcmBackendConnector.js.map +1 -0
  131. package/dist/Voicemail/UcmBackendConnector.test.js +629 -0
  132. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -0
  133. package/dist/Voicemail/Voicemail.js +380 -0
  134. package/dist/Voicemail/Voicemail.js.map +1 -0
  135. package/dist/Voicemail/Voicemail.test.js +226 -0
  136. package/dist/Voicemail/Voicemail.test.js.map +1 -0
  137. package/dist/Voicemail/WxCallBackendConnector.js +547 -0
  138. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -0
  139. package/dist/Voicemail/WxCallBackendConnector.test.js +942 -0
  140. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -0
  141. package/dist/Voicemail/constants.js +37 -0
  142. package/dist/Voicemail/constants.js.map +1 -0
  143. package/dist/Voicemail/types.js +7 -0
  144. package/dist/Voicemail/types.js.map +1 -0
  145. package/dist/Voicemail/voicemailFixture.js +524 -0
  146. package/dist/Voicemail/voicemailFixture.js.map +1 -0
  147. package/dist/api.js +157 -0
  148. package/dist/api.js.map +1 -0
  149. package/dist/common/Utils.js +1257 -0
  150. package/dist/common/Utils.js.map +1 -0
  151. package/dist/common/Utils.test.js +1227 -0
  152. package/dist/common/Utils.test.js.map +1 -0
  153. package/dist/common/constants.js +49 -0
  154. package/dist/common/constants.js.map +1 -0
  155. package/dist/common/index.js +19 -0
  156. package/dist/common/index.js.map +1 -0
  157. package/dist/common/testUtil.js +959 -0
  158. package/dist/common/testUtil.js.map +1 -0
  159. package/dist/common/types.js +66 -0
  160. package/dist/common/types.js.map +1 -0
  161. package/dist/index.js +309 -0
  162. package/dist/index.js.map +1 -0
  163. package/dist/module/CallHistory/CallHistory.js +83 -81
  164. package/dist/module/CallHistory/callHistoryFixtures.js +366 -307
  165. package/dist/module/CallHistory/constants.js +9 -9
  166. package/dist/module/CallHistory/types.js +1 -1
  167. package/dist/module/CallSettings/CallSettings.js +65 -65
  168. package/dist/module/CallSettings/UcmBackendConnector.js +100 -100
  169. package/dist/module/CallSettings/WxCallBackendConnector.js +287 -287
  170. package/dist/module/CallSettings/constants.js +11 -11
  171. package/dist/module/CallSettings/testFixtures.js +62 -62
  172. package/dist/module/CallSettings/types.js +1 -1
  173. package/dist/module/CallingClient/CallingClient.js +265 -248
  174. package/dist/module/CallingClient/callRecordFixtures.js +93 -93
  175. package/dist/module/CallingClient/calling/CallerId/index.js +149 -169
  176. package/dist/module/CallingClient/calling/CallerId/types.js +1 -1
  177. package/dist/module/CallingClient/calling/call.js +1701 -1658
  178. package/dist/module/CallingClient/calling/callManager.js +278 -284
  179. package/dist/module/CallingClient/calling/index.js +2 -2
  180. package/dist/module/CallingClient/calling/types.js +53 -53
  181. package/dist/module/CallingClient/callingClientFixtures.js +156 -38
  182. package/dist/module/CallingClient/constants.js +126 -122
  183. package/dist/module/CallingClient/line/index.js +155 -158
  184. package/dist/module/CallingClient/line/types.js +10 -15
  185. package/dist/module/CallingClient/registration/index.js +1 -1
  186. package/dist/module/CallingClient/registration/register.js +515 -507
  187. package/dist/module/CallingClient/registration/registerFixtures.js +28 -28
  188. package/dist/module/CallingClient/registration/types.js +1 -1
  189. package/dist/module/CallingClient/types.js +1 -1
  190. package/dist/module/Contacts/ContactsClient.js +487 -484
  191. package/dist/module/Contacts/constants.js +20 -20
  192. package/dist/module/Contacts/contactFixtures.js +284 -284
  193. package/dist/module/Contacts/types.js +10 -10
  194. package/dist/module/Errors/catalog/CallError.js +26 -26
  195. package/dist/module/Errors/catalog/CallingDeviceError.js +18 -18
  196. package/dist/module/Errors/catalog/ExtendedError.js +10 -10
  197. package/dist/module/Errors/catalog/LineError.js +24 -24
  198. package/dist/module/Errors/index.js +3 -2
  199. package/dist/module/Errors/types.js +48 -48
  200. package/dist/module/Events/impl/index.js +19 -19
  201. package/dist/module/Events/types.js +85 -83
  202. package/dist/module/Logger/index.js +114 -114
  203. package/dist/module/Logger/types.js +25 -25
  204. package/dist/module/Metrics/index.js +232 -232
  205. package/dist/module/Metrics/types.js +37 -37
  206. package/dist/module/SDKConnector/index.js +39 -39
  207. package/dist/module/SDKConnector/types.js +1 -1
  208. package/dist/module/SDKConnector/utils.js +12 -12
  209. package/dist/module/Voicemail/BroadworksBackendConnector.js +291 -291
  210. package/dist/module/Voicemail/UcmBackendConnector.js +279 -279
  211. package/dist/module/Voicemail/Voicemail.js +110 -110
  212. package/dist/module/Voicemail/WxCallBackendConnector.js +279 -279
  213. package/dist/module/Voicemail/constants.js +29 -29
  214. package/dist/module/Voicemail/types.js +1 -1
  215. package/dist/module/Voicemail/voicemailFixture.js +510 -510
  216. package/dist/module/api.js +7 -6
  217. package/dist/module/common/Utils.js +797 -802
  218. package/dist/module/common/constants.js +41 -41
  219. package/dist/module/common/index.js +1 -1
  220. package/dist/module/common/testUtil.js +939 -938
  221. package/dist/module/common/types.js +58 -57
  222. package/dist/module/index.js +17 -8
  223. package/dist/types/CallHistory/CallHistory.d.ts +18 -17
  224. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  225. package/dist/types/CallHistory/callHistoryFixtures.d.ts +95 -94
  226. package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
  227. package/dist/types/CallHistory/constants.d.ts +9 -9
  228. package/dist/types/CallHistory/types.d.ts +18 -18
  229. package/dist/types/CallSettings/CallSettings.d.ts +19 -19
  230. package/dist/types/CallSettings/CallSettings.d.ts.map +1 -1
  231. package/dist/types/CallSettings/UcmBackendConnector.d.ts +19 -19
  232. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  233. package/dist/types/CallSettings/WxCallBackendConnector.d.ts +21 -21
  234. package/dist/types/CallSettings/constants.d.ts +11 -11
  235. package/dist/types/CallSettings/testFixtures.d.ts +15 -15
  236. package/dist/types/CallSettings/types.d.ts +108 -107
  237. package/dist/types/CallSettings/types.d.ts.map +1 -1
  238. package/dist/types/CallingClient/CallingClient.d.ts +37 -35
  239. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  240. package/dist/types/CallingClient/callRecordFixtures.d.ts +3 -3
  241. package/dist/types/CallingClient/calling/CallerId/index.d.ts +17 -17
  242. package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
  243. package/dist/types/CallingClient/calling/CallerId/types.d.ts +41 -41
  244. package/dist/types/CallingClient/calling/CallerId/types.d.ts.map +1 -1
  245. package/dist/types/CallingClient/calling/call.d.ts +98 -96
  246. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  247. package/dist/types/CallingClient/calling/callManager.d.ts +24 -25
  248. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  249. package/dist/types/CallingClient/calling/index.d.ts +2 -2
  250. package/dist/types/CallingClient/calling/types.d.ts +206 -206
  251. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  252. package/dist/types/CallingClient/callingClientFixtures.d.ts +86 -18
  253. package/dist/types/CallingClient/callingClientFixtures.d.ts.map +1 -1
  254. package/dist/types/CallingClient/constants.d.ts +126 -122
  255. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  256. package/dist/types/CallingClient/line/index.d.ts +43 -43
  257. package/dist/types/CallingClient/line/index.d.ts.map +1 -1
  258. package/dist/types/CallingClient/line/types.d.ts +43 -55
  259. package/dist/types/CallingClient/line/types.d.ts.map +1 -1
  260. package/dist/types/CallingClient/registration/index.d.ts +1 -1
  261. package/dist/types/CallingClient/registration/register.d.ts +64 -64
  262. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  263. package/dist/types/CallingClient/registration/registerFixtures.d.ts +28 -28
  264. package/dist/types/CallingClient/registration/types.d.ts +20 -20
  265. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  266. package/dist/types/CallingClient/types.d.ts +31 -29
  267. package/dist/types/CallingClient/types.d.ts.map +1 -1
  268. package/dist/types/Contacts/ContactsClient.d.ts +27 -26
  269. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  270. package/dist/types/Contacts/constants.d.ts +19 -19
  271. package/dist/types/Contacts/contactFixtures.d.ts +280 -280
  272. package/dist/types/Contacts/types.d.ts +74 -72
  273. package/dist/types/Contacts/types.d.ts.map +1 -1
  274. package/dist/types/Errors/catalog/CallError.d.ts +11 -11
  275. package/dist/types/Errors/catalog/CallingDeviceError.d.ts +10 -10
  276. package/dist/types/Errors/catalog/CallingDeviceError.d.ts.map +1 -1
  277. package/dist/types/Errors/catalog/ExtendedError.d.ts +6 -6
  278. package/dist/types/Errors/catalog/LineError.d.ts +10 -10
  279. package/dist/types/Errors/catalog/LineError.d.ts.map +1 -1
  280. package/dist/types/Errors/index.d.ts +3 -2
  281. package/dist/types/Errors/index.d.ts.map +1 -1
  282. package/dist/types/Errors/types.d.ts +59 -60
  283. package/dist/types/Errors/types.d.ts.map +1 -1
  284. package/dist/types/Events/impl/index.d.ts +8 -8
  285. package/dist/types/Events/types.d.ts +311 -288
  286. package/dist/types/Events/types.d.ts.map +1 -1
  287. package/dist/types/Logger/index.d.ts +12 -12
  288. package/dist/types/Logger/types.d.ts +25 -25
  289. package/dist/types/Metrics/index.d.ts +5 -5
  290. package/dist/types/Metrics/types.d.ts +42 -42
  291. package/dist/types/SDKConnector/index.d.ts +12 -12
  292. package/dist/types/SDKConnector/types.d.ts +129 -128
  293. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  294. package/dist/types/SDKConnector/utils.d.ts +5 -5
  295. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts +27 -27
  296. package/dist/types/Voicemail/UcmBackendConnector.d.ts +34 -34
  297. package/dist/types/Voicemail/Voicemail.d.ts +27 -27
  298. package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
  299. package/dist/types/Voicemail/WxCallBackendConnector.d.ts +23 -23
  300. package/dist/types/Voicemail/constants.d.ts +29 -29
  301. package/dist/types/Voicemail/types.d.ts +133 -133
  302. package/dist/types/Voicemail/types.d.ts.map +1 -1
  303. package/dist/types/Voicemail/voicemailFixture.d.ts +417 -417
  304. package/dist/types/api.d.ts +16 -16
  305. package/dist/types/api.d.ts.map +1 -1
  306. package/dist/types/common/Utils.d.ts +34 -34
  307. package/dist/types/common/Utils.d.ts.map +1 -1
  308. package/dist/types/common/constants.d.ts +41 -41
  309. package/dist/types/common/index.d.ts +1 -1
  310. package/dist/types/common/testUtil.d.ts +3612 -3611
  311. package/dist/types/common/testUtil.d.ts.map +1 -1
  312. package/dist/types/common/types.d.ts +192 -191
  313. package/dist/types/common/types.d.ts.map +1 -1
  314. package/dist/types/index.d.ts +21 -8
  315. package/dist/types/index.d.ts.map +1 -1
  316. package/package.json +5 -3
@@ -0,0 +1,631 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
4
+ var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
5
+ var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
6
+ var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
7
+ var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
8
+ var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
9
+ var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
10
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
11
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
12
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
13
+ _Object$defineProperty(exports, "__esModule", {
14
+ value: true
15
+ });
16
+ exports.createClient = exports.CallingClient = void 0;
17
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
18
+ var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
19
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
20
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
21
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
22
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
23
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
24
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
25
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
26
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
27
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
28
+ var Media = _interopRequireWildcard(require("@webex/internal-media-core"));
29
+ var _asyncMutex = require("async-mutex");
30
+ var _Utils = require("../common/Utils");
31
+ var _types = require("../Logger/types");
32
+ var _SDKConnector = _interopRequireDefault(require("../SDKConnector"));
33
+ var _impl = require("../Events/impl");
34
+ var _types2 = require("../Events/types");
35
+ var _types3 = require("../common/types");
36
+ var _Logger = _interopRequireDefault(require("../Logger"));
37
+ var _callManager = require("./calling/callManager");
38
+ var _constants = require("./constants");
39
+ var _line = _interopRequireDefault(require("./line"));
40
+ var _types4 = require("../Metrics/types");
41
+ var _Metrics = require("../Metrics");
42
+ function _getRequireWildcardCache(e) { if ("function" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
43
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
44
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
45
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
46
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
47
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
48
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* eslint-disable no-underscore-dangle */ /* eslint-disable valid-jsdoc */ /* eslint-disable @typescript-eslint/no-shadow */
49
+ /**
50
+ * The `CallingClient` module provides a set of APIs for line registration and calling functionalities within the SDK.
51
+ *
52
+ * The following code snippet demonstrates how to create an instance of `CallingClient` using a `webex` instance and `callingConfig`:
53
+ *
54
+ * @example
55
+ * ```javascript
56
+ * const callingClient = createClient(webex, callingConfig);
57
+ * ```
58
+ */
59
+ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
60
+ (0, _inherits2.default)(CallingClient, _Eventing);
61
+ var _super = _createSuper(CallingClient);
62
+ /**
63
+ * @ignore
64
+ */
65
+ function CallingClient(webex, config) {
66
+ var _this$sdkConfig, _this$sdkConfig$servi, _this$sdkConfig2, _this$sdkConfig2$logg;
67
+ var _this;
68
+ (0, _classCallCheck2.default)(this, CallingClient);
69
+ _this = _super.call(this);
70
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sdkConnector", void 0);
71
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webex", void 0);
72
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mutex", void 0);
73
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callManager", void 0);
74
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "metricManager", void 0);
75
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sdkConfig", void 0);
76
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "primaryMobiusUris", void 0);
77
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "backupMobiusUris", void 0);
78
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mobiusClusters", void 0);
79
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mobiusHost", void 0);
80
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaEngine", void 0);
81
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lineDict", {});
82
+ /**
83
+ * Handler registered for ALL_CALLS_CLEARED event emitted by callManager.
84
+ *
85
+ * If re-register attempt was deferred earlier due to active call(s), then it
86
+ * will be attempted here on receiving a notification from callManager that all
87
+ * calls are cleaned up.
88
+ */
89
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callsClearedHandler", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
90
+ var registration;
91
+ return _regenerator.default.wrap(function _callee2$(_context2) {
92
+ while (1) switch (_context2.prev = _context2.next) {
93
+ case 0:
94
+ // this is a temporary logic to get registration obj
95
+ // it will change once we have proper lineId and multiple lines as well
96
+ registration = (0, _values.default)(_this.lineDict)[0].registration;
97
+ if (registration.isDeviceRegistered()) {
98
+ _context2.next = 4;
99
+ break;
100
+ }
101
+ _context2.next = 4;
102
+ return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
103
+ return _regenerator.default.wrap(function _callee$(_context) {
104
+ while (1) switch (_context.prev = _context.next) {
105
+ case 0:
106
+ if (!registration.isReconnectPending()) {
107
+ _context.next = 4;
108
+ break;
109
+ }
110
+ _Logger.default.log('All calls cleared, reconnecting', {
111
+ file: _constants.CALLING_CLIENT_FILE,
112
+ method: _constants.CALLS_CLEARED_HANDLER_UTIL
113
+ });
114
+ _context.next = 4;
115
+ return registration.reconnectOnFailure(_constants.CALLS_CLEARED_HANDLER_UTIL);
116
+ case 4:
117
+ case "end":
118
+ return _context.stop();
119
+ }
120
+ }, _callee);
121
+ })));
122
+ case 4:
123
+ case "end":
124
+ return _context2.stop();
125
+ }
126
+ }, _callee2);
127
+ })));
128
+ _this.sdkConnector = _SDKConnector.default;
129
+ if (!_this.sdkConnector.getWebex()) {
130
+ _SDKConnector.default.setWebex(webex);
131
+ }
132
+ _this.mutex = new _asyncMutex.Mutex();
133
+ _this.webex = _this.sdkConnector.getWebex();
134
+ _this.sdkConfig = config;
135
+ var serviceData = (_this$sdkConfig = _this.sdkConfig) !== null && _this$sdkConfig !== void 0 && (_this$sdkConfig$servi = _this$sdkConfig.serviceData) !== null && _this$sdkConfig$servi !== void 0 && _this$sdkConfig$servi.indicator ? _this.sdkConfig.serviceData : {
136
+ indicator: _types3.ServiceIndicator.CALLING,
137
+ domain: ''
138
+ };
139
+ var logLevel = (_this$sdkConfig2 = _this.sdkConfig) !== null && _this$sdkConfig2 !== void 0 && (_this$sdkConfig2$logg = _this$sdkConfig2.logger) !== null && _this$sdkConfig2$logg !== void 0 && _this$sdkConfig2$logg.level ? _this.sdkConfig.logger.level : _types.LOGGER.ERROR;
140
+ (0, _Utils.validateServiceData)(serviceData);
141
+ _this.callManager = (0, _callManager.getCallManager)(_this.webex, serviceData.indicator);
142
+ _this.metricManager = (0, _Metrics.getMetricManager)(_this.webex, serviceData.indicator);
143
+ _this.mediaEngine = Media;
144
+ _this.primaryMobiusUris = [];
145
+ _this.backupMobiusUris = [];
146
+ _this.mobiusClusters = _this.webex.internal.services._hostCatalog[_constants.MOBIUS_US_PROD] || _this.webex.internal.services._hostCatalog[_constants.MOBIUS_EU_PROD] || _this.webex.internal.services._hostCatalog[_constants.MOBIUS_US_INT] || _this.webex.internal.services._hostCatalog[_constants.MOBIUS_EU_INT];
147
+ _this.mobiusHost = '';
148
+ _this.registerSessionsListener();
149
+ _Logger.default.setLogger(logLevel, _constants.CALLING_CLIENT_FILE);
150
+ _this.registerCallsClearedListener();
151
+ return _this;
152
+ }
153
+
154
+ // async calls required to run after constructor
155
+
156
+ /**
157
+ * Initializes the `CallingClient` by performing the following steps:
158
+ *
159
+ * 1. Retrieves list of servers.
160
+ * 2. Creates a line.
161
+ * 3. Sets up network change detection.
162
+ *
163
+ * This method should be called once to initialize the `callingClient`.
164
+ *
165
+ * @returns A promise that resolves when the initialization is complete.
166
+ * @ignore
167
+ */
168
+ (0, _createClass2.default)(CallingClient, [{
169
+ key: "init",
170
+ value: function () {
171
+ var _init = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
172
+ return _regenerator.default.wrap(function _callee3$(_context3) {
173
+ while (1) switch (_context3.prev = _context3.next) {
174
+ case 0:
175
+ _context3.next = 2;
176
+ return this.getMobiusServers();
177
+ case 2:
178
+ _context3.next = 4;
179
+ return this.createLine();
180
+ case 4:
181
+ /* Better to run the timer once rather than after every registration */
182
+ this.detectNetworkChange();
183
+ case 5:
184
+ case "end":
185
+ return _context3.stop();
186
+ }
187
+ }, _callee3, this);
188
+ }));
189
+ function init() {
190
+ return _init.apply(this, arguments);
191
+ }
192
+ return init;
193
+ }()
194
+ /**
195
+ * Register callbacks for network changes.
196
+ */
197
+ }, {
198
+ key: "detectNetworkChange",
199
+ value: (function () {
200
+ var _detectNetworkChange = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
201
+ var _this2 = this;
202
+ var retry, line;
203
+ return _regenerator.default.wrap(function _callee5$(_context5) {
204
+ while (1) switch (_context5.prev = _context5.next) {
205
+ case 0:
206
+ retry = false; // this is a temporary logic to get registration obj
207
+ // it will change once we have proper lineId and multiple lines as well
208
+ line = (0, _values.default)(this.lineDict)[0];
209
+ setInterval( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
210
+ return _regenerator.default.wrap(function _callee4$(_context4) {
211
+ while (1) switch (_context4.prev = _context4.next) {
212
+ case 0:
213
+ if (!_this2.webex.internal.mercury.connected && !retry && !(0, _keys.default)(_this2.callManager.getActiveCalls()).length) {
214
+ _Logger.default.warn("Network has flapped, waiting for mercury connection to be up", {
215
+ file: _constants.CALLING_CLIENT_FILE,
216
+ method: _this2.detectNetworkChange.name
217
+ });
218
+ line.registration.clearKeepaliveTimer();
219
+ retry = true;
220
+ }
221
+ if (!(retry && _this2.webex.internal.mercury.connected)) {
222
+ _context4.next = 9;
223
+ break;
224
+ }
225
+ if (!(line.getStatus() !== _types3.RegistrationStatus.IDLE)) {
226
+ _context4.next = 8;
227
+ break;
228
+ }
229
+ _context4.next = 5;
230
+ return line.registration.handleConnectionRestoration(retry);
231
+ case 5:
232
+ retry = _context4.sent;
233
+ _context4.next = 9;
234
+ break;
235
+ case 8:
236
+ retry = false;
237
+ case 9:
238
+ case "end":
239
+ return _context4.stop();
240
+ }
241
+ }, _callee4);
242
+ })), _constants.NETWORK_FLAP_TIMEOUT);
243
+ case 3:
244
+ case "end":
245
+ return _context5.stop();
246
+ }
247
+ }, _callee5, this);
248
+ }));
249
+ function detectNetworkChange() {
250
+ return _detectNetworkChange.apply(this, arguments);
251
+ }
252
+ return detectNetworkChange;
253
+ }()
254
+ /**
255
+ * Fetches countryCode and region of the client.
256
+ */
257
+ )
258
+ }, {
259
+ key: "getClientRegionInfo",
260
+ value: (function () {
261
+ var _getClientRegionInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
262
+ var _this3 = this;
263
+ var regionInfo, _iterator, _step, mobius, temp, myIP, response, clientRegionInfo;
264
+ return _regenerator.default.wrap(function _callee6$(_context6) {
265
+ while (1) switch (_context6.prev = _context6.next) {
266
+ case 0:
267
+ regionInfo = {};
268
+ _iterator = _createForOfIteratorHelper(this.mobiusClusters);
269
+ _context6.prev = 2;
270
+ _iterator.s();
271
+ case 4:
272
+ if ((_step = _iterator.n()).done) {
273
+ _context6.next = 28;
274
+ break;
275
+ }
276
+ mobius = _step.value;
277
+ this.mobiusHost = "https://".concat(mobius.host).concat(_constants.API_V1);
278
+ _context6.prev = 7;
279
+ _context6.next = 10;
280
+ return this.webex.request({
281
+ uri: "".concat(this.mobiusHost).concat(_constants.URL_ENDPOINT).concat(_constants.IP_ENDPOINT),
282
+ method: _types3.HTTP_METHODS.GET,
283
+ headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.CISCO_DEVICE_URL, this.webex.internal.device.url), _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT),
284
+ service: _types3.ALLOWED_SERVICES.MOBIUS
285
+ });
286
+ case 10:
287
+ temp = _context6.sent;
288
+ myIP = temp.body.ipv4; // eslint-disable-next-line no-await-in-loop
289
+ _context6.next = 14;
290
+ return this.webex.request({
291
+ uri: "".concat(_constants.DISCOVERY_URL, "/").concat(myIP),
292
+ method: _types3.HTTP_METHODS.GET,
293
+ addAuthHeader: false,
294
+ headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
295
+ });
296
+ case 14:
297
+ response = _context6.sent;
298
+ clientRegionInfo = response.body;
299
+ regionInfo.clientRegion = clientRegionInfo !== null && clientRegionInfo !== void 0 && clientRegionInfo.clientRegion ? clientRegionInfo.clientRegion : '';
300
+ regionInfo.countryCode = clientRegionInfo !== null && clientRegionInfo !== void 0 && clientRegionInfo.countryCode ? clientRegionInfo.countryCode : '';
301
+ return _context6.abrupt("break", 28);
302
+ case 21:
303
+ _context6.prev = 21;
304
+ _context6.t0 = _context6["catch"](7);
305
+ (0, _Utils.handleCallingClientErrors)(_context6.t0, function (clientError) {
306
+ _this3.metricManager.submitRegistrationMetric(_types4.METRIC_EVENT.REGISTRATION_ERROR, _types4.REG_ACTION.REGISTER, _types4.METRIC_TYPE.BEHAVIORAL, clientError);
307
+ _this3.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
308
+ }, {
309
+ method: _constants.GET_MOBIUS_SERVERS_UTIL,
310
+ file: _constants.CALLING_CLIENT_FILE
311
+ });
312
+ regionInfo.clientRegion = '';
313
+ regionInfo.countryCode = '';
314
+ case 26:
315
+ _context6.next = 4;
316
+ break;
317
+ case 28:
318
+ _context6.next = 33;
319
+ break;
320
+ case 30:
321
+ _context6.prev = 30;
322
+ _context6.t1 = _context6["catch"](2);
323
+ _iterator.e(_context6.t1);
324
+ case 33:
325
+ _context6.prev = 33;
326
+ _iterator.f();
327
+ return _context6.finish(33);
328
+ case 36:
329
+ return _context6.abrupt("return", regionInfo);
330
+ case 37:
331
+ case "end":
332
+ return _context6.stop();
333
+ }
334
+ }, _callee6, this, [[2, 30, 33, 36], [7, 21]]);
335
+ }));
336
+ function getClientRegionInfo() {
337
+ return _getClientRegionInfo.apply(this, arguments);
338
+ }
339
+ return getClientRegionInfo;
340
+ }()
341
+ /**
342
+ * Local method for finding the mobius servers.
343
+ */
344
+ )
345
+ }, {
346
+ key: "getMobiusServers",
347
+ value: (function () {
348
+ var _getMobiusServers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
349
+ var _this$sdkConfig3,
350
+ _this$sdkConfig3$disc,
351
+ _this$sdkConfig4,
352
+ _this$sdkConfig4$disc,
353
+ _this4 = this;
354
+ var useDefault, clientRegion, countryCode, _this$sdkConfig5, _this$sdkConfig5$disc, _this$sdkConfig6, _this$sdkConfig6$disc, regionInfo, temp, mobiusServers, mobiusUris;
355
+ return _regenerator.default.wrap(function _callee7$(_context7) {
356
+ while (1) switch (_context7.prev = _context7.next) {
357
+ case 0:
358
+ /* Following operations are performed in a synchronous way ->
359
+ 1. Get RegionInfo
360
+ 2. Get Mobius Server with that RegionInfo
361
+ 3. Check whether Mobius server was found without any error
362
+ 4. If there is error , we don't need to send registration
363
+ 5. Otherwise send registration
364
+ */
365
+ useDefault = false;
366
+ if (!((_this$sdkConfig3 = this.sdkConfig) !== null && _this$sdkConfig3 !== void 0 && (_this$sdkConfig3$disc = _this$sdkConfig3.discovery) !== null && _this$sdkConfig3$disc !== void 0 && _this$sdkConfig3$disc.country && (_this$sdkConfig4 = this.sdkConfig) !== null && _this$sdkConfig4 !== void 0 && (_this$sdkConfig4$disc = _this$sdkConfig4.discovery) !== null && _this$sdkConfig4$disc !== void 0 && _this$sdkConfig4$disc.region)) {
367
+ _context7.next = 8;
368
+ break;
369
+ }
370
+ _Logger.default.info('Updating region and country from the SDK config', {
371
+ file: _constants.CALLING_CLIENT_FILE,
372
+ method: _constants.GET_MOBIUS_SERVERS_UTIL
373
+ });
374
+ clientRegion = (_this$sdkConfig5 = this.sdkConfig) === null || _this$sdkConfig5 === void 0 ? void 0 : (_this$sdkConfig5$disc = _this$sdkConfig5.discovery) === null || _this$sdkConfig5$disc === void 0 ? void 0 : _this$sdkConfig5$disc.region;
375
+ countryCode = (_this$sdkConfig6 = this.sdkConfig) === null || _this$sdkConfig6 === void 0 ? void 0 : (_this$sdkConfig6$disc = _this$sdkConfig6.discovery) === null || _this$sdkConfig6$disc === void 0 ? void 0 : _this$sdkConfig6$disc.country;
376
+ this.mobiusHost = this.webex.internal.services._serviceUrls.mobius;
377
+ _context7.next = 14;
378
+ break;
379
+ case 8:
380
+ _Logger.default.info('Updating region and country through Region discovery', {
381
+ file: _constants.CALLING_CLIENT_FILE,
382
+ method: _constants.GET_MOBIUS_SERVERS_UTIL
383
+ });
384
+ _context7.next = 11;
385
+ return this.getClientRegionInfo();
386
+ case 11:
387
+ regionInfo = _context7.sent;
388
+ clientRegion = regionInfo.clientRegion;
389
+ countryCode = regionInfo.countryCode;
390
+ case 14:
391
+ if (!(clientRegion && countryCode)) {
392
+ _context7.next = 34;
393
+ break;
394
+ }
395
+ _Logger.default.log("Found Region: ".concat(clientRegion, " and country: ").concat(countryCode, ", going to fetch Mobius server"), '');
396
+ _context7.prev = 16;
397
+ _context7.next = 19;
398
+ return this.webex.request({
399
+ uri: "".concat(this.mobiusHost).concat(_constants.URL_ENDPOINT, "?regionCode=").concat(clientRegion, "&countryCode=").concat(countryCode),
400
+ method: _types3.HTTP_METHODS.GET,
401
+ headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.CISCO_DEVICE_URL, this.webex.internal.device.url), _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT),
402
+ service: _types3.ALLOWED_SERVICES.MOBIUS
403
+ });
404
+ case 19:
405
+ temp = _context7.sent;
406
+ _Logger.default.log('Mobius Server found for the region', '');
407
+ mobiusServers = temp.body;
408
+ /* update arrays of Mobius Uris. */
409
+ mobiusUris = (0, _Utils.filterMobiusUris)(mobiusServers, this.mobiusHost);
410
+ this.primaryMobiusUris = mobiusUris.primary;
411
+ this.backupMobiusUris = mobiusUris.backup;
412
+ _Logger.default.info("Final list of Mobius Servers, primary: ".concat(mobiusUris.primary, " and backup: ").concat(mobiusUris.backup), '');
413
+ _context7.next = 32;
414
+ break;
415
+ case 28:
416
+ _context7.prev = 28;
417
+ _context7.t0 = _context7["catch"](16);
418
+ (0, _Utils.handleCallingClientErrors)(_context7.t0, function (clientError) {
419
+ _this4.metricManager.submitRegistrationMetric(_types4.METRIC_EVENT.REGISTRATION_ERROR, _types4.REG_ACTION.REGISTER, _types4.METRIC_TYPE.BEHAVIORAL, clientError);
420
+ _this4.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
421
+ }, {
422
+ method: _constants.GET_MOBIUS_SERVERS_UTIL,
423
+ file: _constants.CALLING_CLIENT_FILE
424
+ });
425
+ useDefault = true;
426
+ case 32:
427
+ _context7.next = 35;
428
+ break;
429
+ case 34:
430
+ /* Setting this to true because region info is possibly undefined */
431
+ useDefault = true;
432
+ case 35:
433
+ /* Use a default URL if Mobius discovery fails either because of region info failure
434
+ * or because the discovered Mobius couldn't be reached
435
+ */
436
+
437
+ if (useDefault) {
438
+ _Logger.default.warn("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", '');
439
+ this.mobiusHost = "https://".concat(this.mobiusClusters[0].host).concat(_constants.API_V1);
440
+ this.primaryMobiusUris = ["".concat(this.mobiusHost).concat(_constants.URL_ENDPOINT)];
441
+ }
442
+ case 36:
443
+ case "end":
444
+ return _context7.stop();
445
+ }
446
+ }, _callee7, this, [[16, 28]]);
447
+ }));
448
+ function getMobiusServers() {
449
+ return _getMobiusServers.apply(this, arguments);
450
+ }
451
+ return getMobiusServers;
452
+ }()
453
+ /**
454
+ * Registers a listener/handler for ALL_CALLS_CLEARED
455
+ * event emitted by callManager when all the calls
456
+ * present on sdk are cleaned up.
457
+ */
458
+ )
459
+ }, {
460
+ key: "registerCallsClearedListener",
461
+ value: function registerCallsClearedListener() {
462
+ var logContext = {
463
+ file: _constants.CALLING_CLIENT_FILE,
464
+ method: this.registerCallsClearedListener.name
465
+ };
466
+ _Logger.default.log('Registering listener for all calls cleared event', logContext);
467
+ this.callManager.on(_types2.CALLING_CLIENT_EVENT_KEYS.ALL_CALLS_CLEARED, this.callsClearedHandler);
468
+ }
469
+ }, {
470
+ key: "getLoggingLevel",
471
+ value:
472
+ /**
473
+ * To get the current log Level.
474
+ * @ignore
475
+ */
476
+ function getLoggingLevel() {
477
+ return _Logger.default.getLogLevel();
478
+ }
479
+
480
+ /**
481
+ * To return the `sdkConnector` instance that was used during sdk initialisation.
482
+ * @ignore
483
+ */
484
+ }, {
485
+ key: "getSDKConnector",
486
+ value: function getSDKConnector() {
487
+ return this.sdkConnector;
488
+ }
489
+ }, {
490
+ key: "registerSessionsListener",
491
+ value: function registerSessionsListener() {
492
+ var _this5 = this;
493
+ this.sdkConnector.registerListener(_types2.MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_INCLUSIVE, /*#__PURE__*/function () {
494
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(event) {
495
+ var sessionArr, i;
496
+ return _regenerator.default.wrap(function _callee8$(_context8) {
497
+ while (1) switch (_context8.prev = _context8.next) {
498
+ case 0:
499
+ if (!(event && event.data.userSessions.userSessions)) {
500
+ _context8.next = 7;
501
+ break;
502
+ }
503
+ sessionArr = event === null || event === void 0 ? void 0 : event.data.userSessions.userSessions;
504
+ if (!(sessionArr.length === 1)) {
505
+ _context8.next = 5;
506
+ break;
507
+ }
508
+ if (!(sessionArr[0].sessionType !== _types2.SessionType.WEBEX_CALLING)) {
509
+ _context8.next = 5;
510
+ break;
511
+ }
512
+ return _context8.abrupt("return");
513
+ case 5:
514
+ for (i = 0; i < sessionArr.length; i += 1) {
515
+ if (sessionArr[i].sessionType !== _types2.SessionType.WEBEX_CALLING) {
516
+ sessionArr.splice(i, 1);
517
+ }
518
+ }
519
+ _this5.emit(_types2.CALLING_CLIENT_EVENT_KEYS.USER_SESSION_INFO, event);
520
+ case 7:
521
+ case "end":
522
+ return _context8.stop();
523
+ }
524
+ }, _callee8);
525
+ }));
526
+ return function (_x) {
527
+ return _ref4.apply(this, arguments);
528
+ };
529
+ }());
530
+ }
531
+
532
+ /**
533
+ * Creates line object inside calling client per user
534
+ * NOTE: currently multiple lines are not supported
535
+ */
536
+ }, {
537
+ key: "createLine",
538
+ value: (function () {
539
+ var _createLine = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
540
+ var _this$sdkConfig7;
541
+ var line;
542
+ return _regenerator.default.wrap(function _callee9$(_context9) {
543
+ while (1) switch (_context9.prev = _context9.next) {
544
+ case 0:
545
+ line = new _line.default(this.webex.internal.device.userId, this.webex.internal.device.url, this.mutex, this.primaryMobiusUris, this.backupMobiusUris, this.getLoggingLevel(), (_this$sdkConfig7 = this.sdkConfig) === null || _this$sdkConfig7 === void 0 ? void 0 : _this$sdkConfig7.serviceData);
546
+ this.lineDict[line.lineId] = line;
547
+ case 2:
548
+ case "end":
549
+ return _context9.stop();
550
+ }
551
+ }, _callee9, this);
552
+ }));
553
+ function createLine() {
554
+ return _createLine.apply(this, arguments);
555
+ }
556
+ return createLine;
557
+ }()
558
+ /**
559
+ * Retrieves details of all the Line objects belonging to a User
560
+ * NOTE: currently multiple lines are not supported
561
+ */
562
+ )
563
+ }, {
564
+ key: "getLines",
565
+ value: function getLines() {
566
+ return this.lineDict;
567
+ }
568
+
569
+ /**
570
+ * Retrieves call objects for all the active calls present in the client
571
+ */
572
+ }, {
573
+ key: "getActiveCalls",
574
+ value: function getActiveCalls() {
575
+ var activeCalls = {};
576
+ var calls = this.callManager.getActiveCalls();
577
+ (0, _keys.default)(calls).forEach(function (correlationId) {
578
+ var call = calls[correlationId];
579
+ if (!activeCalls[call.lineId]) {
580
+ activeCalls[call.lineId] = [];
581
+ }
582
+ activeCalls[call.lineId].push(call);
583
+ });
584
+ return activeCalls;
585
+ }
586
+
587
+ /**
588
+ * Retrieves call object for the connected call in the client
589
+ */
590
+ }, {
591
+ key: "getConnectedCall",
592
+ value: function getConnectedCall() {
593
+ var connectCall;
594
+ var calls = this.callManager.getActiveCalls();
595
+ (0, _keys.default)(calls).forEach(function (correlationId) {
596
+ if (calls[correlationId].isConnected() && !calls[correlationId].isHeld()) {
597
+ connectCall = calls[correlationId];
598
+ }
599
+ });
600
+ return connectCall;
601
+ }
602
+ }]);
603
+ return CallingClient;
604
+ }(_impl.Eventing);
605
+ /**
606
+ * Create the `CallingClient` instance using the `webex` object and callingSdk `config`
607
+ * @param webex - A webex instance.
608
+ * @param config - Config to start the CallingClient with.
609
+ */
610
+ var createClient = exports.createClient = /*#__PURE__*/function () {
611
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(webex, config) {
612
+ var callingClientInstance;
613
+ return _regenerator.default.wrap(function _callee10$(_context10) {
614
+ while (1) switch (_context10.prev = _context10.next) {
615
+ case 0:
616
+ callingClientInstance = new CallingClient(webex, config);
617
+ _context10.next = 3;
618
+ return callingClientInstance.init();
619
+ case 3:
620
+ return _context10.abrupt("return", callingClientInstance);
621
+ case 4:
622
+ case "end":
623
+ return _context10.stop();
624
+ }
625
+ }, _callee10);
626
+ }));
627
+ return function createClient(_x2, _x3) {
628
+ return _ref5.apply(this, arguments);
629
+ };
630
+ }();
631
+ //# sourceMappingURL=CallingClient.js.map