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

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 (283) hide show
  1. package/CHANGELOG.md +1403 -0
  2. package/README.md +74 -74
  3. package/dist/module/CallHistory/CallHistory.js +81 -81
  4. package/dist/module/CallHistory/callHistoryFixtures.js +307 -307
  5. package/dist/module/CallHistory/constants.js +9 -9
  6. package/dist/module/CallHistory/types.js +1 -1
  7. package/dist/module/CallSettings/CallSettings.js +65 -65
  8. package/dist/module/CallSettings/UcmBackendConnector.js +100 -100
  9. package/dist/module/CallSettings/WxCallBackendConnector.js +287 -287
  10. package/dist/module/CallSettings/constants.js +11 -11
  11. package/dist/module/CallSettings/testFixtures.js +62 -62
  12. package/dist/module/CallSettings/types.js +1 -1
  13. package/dist/module/CallingClient/CallingClient.js +248 -248
  14. package/dist/module/CallingClient/callRecordFixtures.js +93 -93
  15. package/dist/module/CallingClient/calling/CallerId/index.js +169 -169
  16. package/dist/module/CallingClient/calling/CallerId/types.js +1 -1
  17. package/dist/module/CallingClient/calling/call.js +1658 -1658
  18. package/dist/module/CallingClient/calling/callManager.js +284 -284
  19. package/dist/module/CallingClient/calling/index.js +2 -2
  20. package/dist/module/CallingClient/calling/types.js +53 -53
  21. package/dist/module/CallingClient/callingClientFixtures.js +38 -38
  22. package/dist/module/CallingClient/constants.js +122 -122
  23. package/dist/module/CallingClient/line/index.js +158 -158
  24. package/dist/module/CallingClient/line/types.js +15 -15
  25. package/dist/module/CallingClient/registration/index.js +1 -1
  26. package/dist/module/CallingClient/registration/register.js +507 -507
  27. package/dist/module/CallingClient/registration/registerFixtures.js +28 -28
  28. package/dist/module/CallingClient/registration/types.js +1 -1
  29. package/dist/module/CallingClient/types.js +1 -1
  30. package/dist/module/Contacts/ContactsClient.js +484 -484
  31. package/dist/module/Contacts/constants.js +20 -20
  32. package/dist/module/Contacts/contactFixtures.js +284 -284
  33. package/dist/module/Contacts/types.js +10 -10
  34. package/dist/module/Errors/catalog/CallError.js +26 -26
  35. package/dist/module/Errors/catalog/CallingDeviceError.js +18 -18
  36. package/dist/module/Errors/catalog/ExtendedError.js +10 -10
  37. package/dist/module/Errors/catalog/LineError.js +24 -24
  38. package/dist/module/Errors/index.js +2 -2
  39. package/dist/module/Errors/types.js +48 -48
  40. package/dist/module/Events/impl/index.js +19 -19
  41. package/dist/module/Events/types.js +83 -83
  42. package/dist/module/Logger/index.js +114 -114
  43. package/dist/module/Logger/types.js +25 -25
  44. package/dist/module/Metrics/index.js +232 -232
  45. package/dist/module/Metrics/types.js +37 -37
  46. package/dist/module/SDKConnector/index.js +39 -39
  47. package/dist/module/SDKConnector/types.js +1 -1
  48. package/dist/module/SDKConnector/utils.js +12 -12
  49. package/dist/module/Voicemail/BroadworksBackendConnector.js +291 -291
  50. package/dist/module/Voicemail/UcmBackendConnector.js +279 -279
  51. package/dist/module/Voicemail/Voicemail.js +110 -110
  52. package/dist/module/Voicemail/WxCallBackendConnector.js +279 -279
  53. package/dist/module/Voicemail/constants.js +29 -29
  54. package/dist/module/Voicemail/types.js +1 -1
  55. package/dist/module/Voicemail/voicemailFixture.js +510 -510
  56. package/dist/module/api.js +6 -6
  57. package/dist/module/common/Utils.js +802 -802
  58. package/dist/module/common/constants.js +41 -41
  59. package/dist/module/common/index.js +1 -1
  60. package/dist/module/common/testUtil.js +938 -938
  61. package/dist/module/common/types.js +57 -57
  62. package/dist/module/index.js +8 -8
  63. package/dist/types/CallHistory/CallHistory.d.ts +17 -17
  64. package/dist/types/CallHistory/callHistoryFixtures.d.ts +94 -94
  65. package/dist/types/CallHistory/constants.d.ts +9 -9
  66. package/dist/types/CallHistory/types.d.ts +18 -18
  67. package/dist/types/CallSettings/CallSettings.d.ts +19 -19
  68. package/dist/types/CallSettings/UcmBackendConnector.d.ts +19 -19
  69. package/dist/types/CallSettings/WxCallBackendConnector.d.ts +21 -21
  70. package/dist/types/CallSettings/constants.d.ts +11 -11
  71. package/dist/types/CallSettings/testFixtures.d.ts +15 -15
  72. package/dist/types/CallSettings/types.d.ts +107 -107
  73. package/dist/types/CallingClient/CallingClient.d.ts +35 -35
  74. package/dist/types/CallingClient/callRecordFixtures.d.ts +3 -3
  75. package/dist/types/CallingClient/calling/CallerId/index.d.ts +17 -17
  76. package/dist/types/CallingClient/calling/CallerId/types.d.ts +41 -41
  77. package/dist/types/CallingClient/calling/call.d.ts +96 -96
  78. package/dist/types/CallingClient/calling/callManager.d.ts +25 -25
  79. package/dist/types/CallingClient/calling/index.d.ts +2 -2
  80. package/dist/types/CallingClient/calling/types.d.ts +206 -206
  81. package/dist/types/CallingClient/callingClientFixtures.d.ts +18 -18
  82. package/dist/types/CallingClient/constants.d.ts +122 -122
  83. package/dist/types/CallingClient/line/index.d.ts +43 -43
  84. package/dist/types/CallingClient/line/types.d.ts +55 -55
  85. package/dist/types/CallingClient/registration/index.d.ts +1 -1
  86. package/dist/types/CallingClient/registration/register.d.ts +64 -64
  87. package/dist/types/CallingClient/registration/registerFixtures.d.ts +28 -28
  88. package/dist/types/CallingClient/registration/types.d.ts +20 -20
  89. package/dist/types/CallingClient/types.d.ts +29 -29
  90. package/dist/types/Contacts/ContactsClient.d.ts +26 -26
  91. package/dist/types/Contacts/constants.d.ts +19 -19
  92. package/dist/types/Contacts/contactFixtures.d.ts +280 -280
  93. package/dist/types/Contacts/types.d.ts +72 -72
  94. package/dist/types/Errors/catalog/CallError.d.ts +11 -11
  95. package/dist/types/Errors/catalog/CallingDeviceError.d.ts +10 -10
  96. package/dist/types/Errors/catalog/ExtendedError.d.ts +6 -6
  97. package/dist/types/Errors/catalog/LineError.d.ts +10 -10
  98. package/dist/types/Errors/index.d.ts +2 -2
  99. package/dist/types/Errors/types.d.ts +60 -60
  100. package/dist/types/Events/impl/index.d.ts +8 -8
  101. package/dist/types/Events/types.d.ts +288 -288
  102. package/dist/types/Logger/index.d.ts +12 -12
  103. package/dist/types/Logger/types.d.ts +25 -25
  104. package/dist/types/Metrics/index.d.ts +5 -5
  105. package/dist/types/Metrics/types.d.ts +42 -42
  106. package/dist/types/SDKConnector/index.d.ts +12 -12
  107. package/dist/types/SDKConnector/types.d.ts +128 -128
  108. package/dist/types/SDKConnector/utils.d.ts +5 -5
  109. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts +27 -27
  110. package/dist/types/Voicemail/UcmBackendConnector.d.ts +34 -34
  111. package/dist/types/Voicemail/Voicemail.d.ts +27 -27
  112. package/dist/types/Voicemail/WxCallBackendConnector.d.ts +23 -23
  113. package/dist/types/Voicemail/constants.d.ts +29 -29
  114. package/dist/types/Voicemail/types.d.ts +133 -133
  115. package/dist/types/Voicemail/voicemailFixture.d.ts +417 -417
  116. package/dist/types/api.d.ts +16 -16
  117. package/dist/types/common/Utils.d.ts +34 -34
  118. package/dist/types/common/constants.d.ts +41 -41
  119. package/dist/types/common/index.d.ts +1 -1
  120. package/dist/types/common/testUtil.d.ts +3611 -3611
  121. package/dist/types/common/types.d.ts +191 -191
  122. package/dist/types/index.d.ts +8 -8
  123. package/package.json +4 -4
  124. package/dist/CallHistory/CallHistory.js +0 -203
  125. package/dist/CallHistory/CallHistory.js.map +0 -1
  126. package/dist/CallHistory/CallHistory.test.js +0 -133
  127. package/dist/CallHistory/CallHistory.test.js.map +0 -1
  128. package/dist/CallHistory/callHistoryFixtures.js +0 -310
  129. package/dist/CallHistory/callHistoryFixtures.js.map +0 -1
  130. package/dist/CallHistory/constants.js +0 -26
  131. package/dist/CallHistory/constants.js.map +0 -1
  132. package/dist/CallHistory/types.js +0 -7
  133. package/dist/CallHistory/types.js.map +0 -1
  134. package/dist/CallSettings/CallSettings.js +0 -276
  135. package/dist/CallSettings/CallSettings.js.map +0 -1
  136. package/dist/CallSettings/CallSettings.test.js +0 -122
  137. package/dist/CallSettings/CallSettings.test.js.map +0 -1
  138. package/dist/CallSettings/UcmBackendConnector.js +0 -217
  139. package/dist/CallSettings/UcmBackendConnector.js.map +0 -1
  140. package/dist/CallSettings/UcmBackendConnector.test.js +0 -227
  141. package/dist/CallSettings/UcmBackendConnector.test.js.map +0 -1
  142. package/dist/CallSettings/WxCallBackendConnector.js +0 -541
  143. package/dist/CallSettings/WxCallBackendConnector.js.map +0 -1
  144. package/dist/CallSettings/WxCallBackendConnector.test.js +0 -802
  145. package/dist/CallSettings/WxCallBackendConnector.test.js.map +0 -1
  146. package/dist/CallSettings/constants.js +0 -30
  147. package/dist/CallSettings/constants.js.map +0 -1
  148. package/dist/CallSettings/testFixtures.js +0 -72
  149. package/dist/CallSettings/testFixtures.js.map +0 -1
  150. package/dist/CallSettings/types.js +0 -7
  151. package/dist/CallSettings/types.js.map +0 -1
  152. package/dist/CallingClient/CallingClient.js +0 -572
  153. package/dist/CallingClient/CallingClient.js.map +0 -1
  154. package/dist/CallingClient/CallingClient.test.js +0 -931
  155. package/dist/CallingClient/CallingClient.test.js.map +0 -1
  156. package/dist/CallingClient/callRecordFixtures.js +0 -103
  157. package/dist/CallingClient/callRecordFixtures.js.map +0 -1
  158. package/dist/CallingClient/calling/CallerId/index.js +0 -287
  159. package/dist/CallingClient/calling/CallerId/index.js.map +0 -1
  160. package/dist/CallingClient/calling/CallerId/index.test.js +0 -274
  161. package/dist/CallingClient/calling/CallerId/index.test.js.map +0 -1
  162. package/dist/CallingClient/calling/CallerId/types.js +0 -7
  163. package/dist/CallingClient/calling/CallerId/types.js.map +0 -1
  164. package/dist/CallingClient/calling/call.js +0 -2995
  165. package/dist/CallingClient/calling/call.js.map +0 -1
  166. package/dist/CallingClient/calling/call.test.js +0 -2614
  167. package/dist/CallingClient/calling/call.test.js.map +0 -1
  168. package/dist/CallingClient/calling/callManager.js +0 -443
  169. package/dist/CallingClient/calling/callManager.js.map +0 -1
  170. package/dist/CallingClient/calling/callManager.test.js +0 -683
  171. package/dist/CallingClient/calling/callManager.test.js.map +0 -1
  172. package/dist/CallingClient/calling/index.js +0 -30
  173. package/dist/CallingClient/calling/index.js.map +0 -1
  174. package/dist/CallingClient/calling/types.js +0 -71
  175. package/dist/CallingClient/calling/types.js.map +0 -1
  176. package/dist/CallingClient/callingClientFixtures.js +0 -53
  177. package/dist/CallingClient/callingClientFixtures.js.map +0 -1
  178. package/dist/CallingClient/constants.js +0 -226
  179. package/dist/CallingClient/constants.js.map +0 -1
  180. package/dist/CallingClient/line/index.js +0 -312
  181. package/dist/CallingClient/line/index.js.map +0 -1
  182. package/dist/CallingClient/line/line.test.js +0 -270
  183. package/dist/CallingClient/line/line.test.js.map +0 -1
  184. package/dist/CallingClient/line/types.js +0 -25
  185. package/dist/CallingClient/line/types.js.map +0 -1
  186. package/dist/CallingClient/registration/index.js +0 -19
  187. package/dist/CallingClient/registration/index.js.map +0 -1
  188. package/dist/CallingClient/registration/register.js +0 -1295
  189. package/dist/CallingClient/registration/register.js.map +0 -1
  190. package/dist/CallingClient/registration/register.test.js +0 -838
  191. package/dist/CallingClient/registration/register.test.js.map +0 -1
  192. package/dist/CallingClient/registration/registerFixtures.js +0 -41
  193. package/dist/CallingClient/registration/registerFixtures.js.map +0 -1
  194. package/dist/CallingClient/registration/types.js +0 -7
  195. package/dist/CallingClient/registration/types.js.map +0 -1
  196. package/dist/CallingClient/types.js +0 -7
  197. package/dist/CallingClient/types.js.map +0 -1
  198. package/dist/Contacts/ContactsClient.js +0 -1139
  199. package/dist/Contacts/ContactsClient.js.map +0 -1
  200. package/dist/Contacts/ContactsClient.test.js +0 -725
  201. package/dist/Contacts/ContactsClient.test.js.map +0 -1
  202. package/dist/Contacts/constants.js +0 -36
  203. package/dist/Contacts/constants.js.map +0 -1
  204. package/dist/Contacts/contactFixtures.js +0 -340
  205. package/dist/Contacts/contactFixtures.js.map +0 -1
  206. package/dist/Contacts/types.js +0 -20
  207. package/dist/Contacts/types.js.map +0 -1
  208. package/dist/Errors/catalog/CallError.js +0 -94
  209. package/dist/Errors/catalog/CallError.js.map +0 -1
  210. package/dist/Errors/catalog/CallingDeviceError.js +0 -88
  211. package/dist/Errors/catalog/CallingDeviceError.js.map +0 -1
  212. package/dist/Errors/catalog/ExtendedError.js +0 -45
  213. package/dist/Errors/catalog/ExtendedError.js.map +0 -1
  214. package/dist/Errors/catalog/LineError.js +0 -90
  215. package/dist/Errors/catalog/LineError.js.map +0 -1
  216. package/dist/Errors/index.js +0 -21
  217. package/dist/Errors/index.js.map +0 -1
  218. package/dist/Errors/types.js +0 -62
  219. package/dist/Errors/types.js.map +0 -1
  220. package/dist/Events/impl/index.js +0 -82
  221. package/dist/Events/impl/index.js.map +0 -1
  222. package/dist/Events/types.js +0 -111
  223. package/dist/Events/types.js.map +0 -1
  224. package/dist/Logger/index.js +0 -221
  225. package/dist/Logger/index.js.map +0 -1
  226. package/dist/Logger/index.test.js +0 -62
  227. package/dist/Logger/index.test.js.map +0 -1
  228. package/dist/Logger/types.js +0 -37
  229. package/dist/Logger/types.js.map +0 -1
  230. package/dist/Metrics/index.js +0 -329
  231. package/dist/Metrics/index.js.map +0 -1
  232. package/dist/Metrics/index.test.js +0 -291
  233. package/dist/Metrics/index.test.js.map +0 -1
  234. package/dist/Metrics/types.js +0 -50
  235. package/dist/Metrics/types.js.map +0 -1
  236. package/dist/SDKConnector/index.js +0 -105
  237. package/dist/SDKConnector/index.js.map +0 -1
  238. package/dist/SDKConnector/index.test.js +0 -9
  239. package/dist/SDKConnector/index.test.js.map +0 -1
  240. package/dist/SDKConnector/types.js +0 -7
  241. package/dist/SDKConnector/types.js.map +0 -1
  242. package/dist/SDKConnector/utils.js +0 -40
  243. package/dist/SDKConnector/utils.js.map +0 -1
  244. package/dist/SDKConnector/utils.test.js +0 -9
  245. package/dist/SDKConnector/utils.test.js.map +0 -1
  246. package/dist/Voicemail/BroadworksBackendConnector.js +0 -632
  247. package/dist/Voicemail/BroadworksBackendConnector.js.map +0 -1
  248. package/dist/Voicemail/BroadworksBackendConnector.test.js +0 -733
  249. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +0 -1
  250. package/dist/Voicemail/UcmBackendConnector.js +0 -566
  251. package/dist/Voicemail/UcmBackendConnector.js.map +0 -1
  252. package/dist/Voicemail/UcmBackendConnector.test.js +0 -628
  253. package/dist/Voicemail/UcmBackendConnector.test.js.map +0 -1
  254. package/dist/Voicemail/Voicemail.js +0 -378
  255. package/dist/Voicemail/Voicemail.js.map +0 -1
  256. package/dist/Voicemail/Voicemail.test.js +0 -226
  257. package/dist/Voicemail/Voicemail.test.js.map +0 -1
  258. package/dist/Voicemail/WxCallBackendConnector.js +0 -540
  259. package/dist/Voicemail/WxCallBackendConnector.js.map +0 -1
  260. package/dist/Voicemail/WxCallBackendConnector.test.js +0 -942
  261. package/dist/Voicemail/WxCallBackendConnector.test.js.map +0 -1
  262. package/dist/Voicemail/constants.js +0 -66
  263. package/dist/Voicemail/constants.js.map +0 -1
  264. package/dist/Voicemail/types.js +0 -7
  265. package/dist/Voicemail/types.js.map +0 -1
  266. package/dist/Voicemail/voicemailFixture.js +0 -559
  267. package/dist/Voicemail/voicemailFixture.js.map +0 -1
  268. package/dist/api.js +0 -134
  269. package/dist/api.js.map +0 -1
  270. package/dist/common/Utils.js +0 -1264
  271. package/dist/common/Utils.js.map +0 -1
  272. package/dist/common/Utils.test.js +0 -1227
  273. package/dist/common/Utils.test.js.map +0 -1
  274. package/dist/common/constants.js +0 -90
  275. package/dist/common/constants.js.map +0 -1
  276. package/dist/common/index.js +0 -19
  277. package/dist/common/index.js.map +0 -1
  278. package/dist/common/testUtil.js +0 -968
  279. package/dist/common/testUtil.js.map +0 -1
  280. package/dist/common/types.js +0 -75
  281. package/dist/common/types.js.map +0 -1
  282. package/dist/index.js +0 -63
  283. package/dist/index.js.map +0 -1
@@ -1,1295 +0,0 @@
1
- "use strict";
2
-
3
- var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
4
- var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
5
- var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
6
- var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
7
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
8
- var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
9
- _Object$defineProperty(exports, "__esModule", {
10
- value: true
11
- });
12
- exports.createRegistration = exports.Registration = void 0;
13
- var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
14
- var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
15
- var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
16
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
17
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
18
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
19
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
20
- var _uuid = require("uuid");
21
- var _types = require("../../Errors/types");
22
- var _common = require("../../common");
23
- var _types2 = require("../../Metrics/types");
24
- var _Metrics = require("../../Metrics");
25
- var _calling = require("../calling");
26
- var _Logger = _interopRequireDefault(require("../../Logger"));
27
- var _SDKConnector = _interopRequireDefault(require("../../SDKConnector"));
28
- var _types3 = require("../../common/types");
29
- var _constants = require("../constants");
30
- var _types4 = require("../line/types");
31
- 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; } } }; }
32
- 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); }
33
- 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; }
34
- /**
35
- *
36
- */
37
- var Registration = /*#__PURE__*/function () {
38
- /**
39
- * @param webex - A webex instance.
40
- * @param serviceData - indicates whether the backend service is calling or contactcentre
41
- * @param mutex - mutex which is used to run any registration scenario exclusively
42
- * @param lineEmitter - Line emitter for registration related events
43
- * @param logLevel - log level option for registration module
44
- */
45
- function Registration(webex, serviceData, mutex, lineEmitter, logLevel) {
46
- (0, _classCallCheck2.default)(this, Registration);
47
- (0, _defineProperty2.default)(this, "sdkConnector", void 0);
48
- (0, _defineProperty2.default)(this, "webex", void 0);
49
- (0, _defineProperty2.default)(this, "userId", '');
50
- (0, _defineProperty2.default)(this, "serviceData", void 0);
51
- (0, _defineProperty2.default)(this, "failback429RetryAttempts", void 0);
52
- (0, _defineProperty2.default)(this, "registrationStatus", void 0);
53
- (0, _defineProperty2.default)(this, "failbackTimer", void 0);
54
- (0, _defineProperty2.default)(this, "activeMobiusUrl", void 0);
55
- (0, _defineProperty2.default)(this, "keepaliveTimer", void 0);
56
- (0, _defineProperty2.default)(this, "rehomingIntervalMin", void 0);
57
- (0, _defineProperty2.default)(this, "rehomingIntervalMax", void 0);
58
- (0, _defineProperty2.default)(this, "mutex", void 0);
59
- (0, _defineProperty2.default)(this, "metricManager", void 0);
60
- (0, _defineProperty2.default)(this, "lineEmitter", void 0);
61
- (0, _defineProperty2.default)(this, "callManager", void 0);
62
- (0, _defineProperty2.default)(this, "deviceInfo", {});
63
- (0, _defineProperty2.default)(this, "primaryMobiusUris", void 0);
64
- (0, _defineProperty2.default)(this, "backupMobiusUris", void 0);
65
- (0, _defineProperty2.default)(this, "registerRetry", false);
66
- (0, _defineProperty2.default)(this, "reconnectPending", false);
67
- this.sdkConnector = _SDKConnector.default;
68
- this.serviceData = serviceData;
69
- if (!this.sdkConnector.getWebex()) {
70
- _SDKConnector.default.setWebex(webex);
71
- }
72
- this.webex = this.sdkConnector.getWebex();
73
- this.userId = this.webex.internal.device.userId;
74
- this.registrationStatus = _types3.MobiusStatus.DEFAULT;
75
- this.failback429RetryAttempts = 0;
76
- _Logger.default.setLogger(logLevel, _constants.REGISTRATION_FILE);
77
- this.rehomingIntervalMin = _constants.DEFAULT_REHOMING_INTERVAL_MIN;
78
- this.rehomingIntervalMax = _constants.DEFAULT_REHOMING_INTERVAL_MAX;
79
- this.mutex = mutex;
80
- this.callManager = (0, _calling.getCallManager)(this.webex, serviceData.indicator);
81
- this.metricManager = (0, _Metrics.getMetricManager)(this.webex, serviceData.indicator);
82
- this.lineEmitter = lineEmitter;
83
- this.primaryMobiusUris = [];
84
- this.backupMobiusUris = [];
85
- }
86
- (0, _createClass2.default)(Registration, [{
87
- key: "getActiveMobiusUrl",
88
- value: function getActiveMobiusUrl() {
89
- return this.activeMobiusUrl;
90
- }
91
- }, {
92
- key: "setActiveMobiusUrl",
93
- value: function setActiveMobiusUrl(url) {
94
- _Logger.default.info("ActiveMobiusUrl: ".concat(url), {
95
- method: 'setActiveMobiusUrl',
96
- file: _constants.REGISTRATION_FILE
97
- });
98
- this.activeMobiusUrl = url;
99
- this.callManager.updateActiveMobius(url);
100
- }
101
- }, {
102
- key: "setMobiusServers",
103
- value: function setMobiusServers(primaryMobiusUris, backupMobiusUris) {
104
- this.primaryMobiusUris = primaryMobiusUris;
105
- this.backupMobiusUris = backupMobiusUris;
106
- }
107
-
108
- /**
109
- * Implementation of sending keepalive.
110
- *
111
- * @param url - Entire device url.
112
- * @returns Promise<boolean>.
113
- */
114
- }, {
115
- key: "postKeepAlive",
116
- value: function () {
117
- var _postKeepAlive = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url) {
118
- var _headers;
119
- return _regenerator.default.wrap(function _callee$(_context) {
120
- while (1) switch (_context.prev = _context.next) {
121
- case 0:
122
- return _context.abrupt("return", this.webex.request({
123
- uri: "".concat(url, "/status"),
124
- method: _types3.HTTP_METHODS.POST,
125
- headers: (_headers = {}, (0, _defineProperty2.default)(_headers, _constants.CISCO_DEVICE_URL, this.webex.internal.device.url), (0, _defineProperty2.default)(_headers, _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT), _headers),
126
- service: _types3.ALLOWED_SERVICES.MOBIUS
127
- }));
128
- case 1:
129
- case "end":
130
- return _context.stop();
131
- }
132
- }, _callee, this);
133
- }));
134
- function postKeepAlive(_x) {
135
- return _postKeepAlive.apply(this, arguments);
136
- }
137
- return postKeepAlive;
138
- }()
139
- /**
140
- * Implementation of delete device.
141
- *
142
- * @param url -.
143
- * @param deviceId -.
144
- * @param deviceUrl -.
145
- */
146
- }, {
147
- key: "deleteRegistration",
148
- value: function () {
149
- var _deleteRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url, deviceId, deviceUrl) {
150
- var _headers2;
151
- var response;
152
- return _regenerator.default.wrap(function _callee2$(_context2) {
153
- while (1) switch (_context2.prev = _context2.next) {
154
- case 0:
155
- _context2.t0 = fetch;
156
- _context2.t1 = "".concat(url).concat(_constants.DEVICES_ENDPOINT_RESOURCE, "/").concat(deviceId);
157
- _context2.t2 = _types3.HTTP_METHODS.DELETE;
158
- _headers2 = {};
159
- (0, _defineProperty2.default)(_headers2, _constants.CISCO_DEVICE_URL, deviceUrl);
160
- _context2.t3 = _defineProperty2.default;
161
- _context2.t4 = _headers2;
162
- _context2.next = 9;
163
- return this.webex.credentials.getUserToken();
164
- case 9:
165
- _context2.t5 = _context2.sent;
166
- (0, _context2.t3)(_context2.t4, "Authorization", _context2.t5);
167
- (0, _defineProperty2.default)(_headers2, "trackingId", "".concat(_constants.WEBEX_WEB_CLIENT, "_").concat((0, _uuid.v4)()));
168
- (0, _defineProperty2.default)(_headers2, _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT);
169
- _context2.t6 = _headers2;
170
- _context2.t7 = {
171
- method: _context2.t2,
172
- headers: _context2.t6
173
- };
174
- _context2.next = 17;
175
- return (0, _context2.t0)(_context2.t1, _context2.t7);
176
- case 17:
177
- response = _context2.sent;
178
- this.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
179
- return _context2.abrupt("return", response.json());
180
- case 20:
181
- case "end":
182
- return _context2.stop();
183
- }
184
- }, _callee2, this);
185
- }));
186
- function deleteRegistration(_x2, _x3, _x4) {
187
- return _deleteRegistration.apply(this, arguments);
188
- }
189
- return deleteRegistration;
190
- }()
191
- /**
192
- * Implementation of POST request for device registration.
193
- *
194
- * @param url - backend service url for registration
195
- */
196
- }, {
197
- key: "postRegistration",
198
- value: function () {
199
- var _postRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(url) {
200
- var _headers3;
201
- var deviceInfo;
202
- return _regenerator.default.wrap(function _callee3$(_context3) {
203
- while (1) switch (_context3.prev = _context3.next) {
204
- case 0:
205
- deviceInfo = {
206
- userId: this.userId,
207
- clientDeviceUri: this.webex.internal.device.url,
208
- serviceData: this.serviceData
209
- };
210
- return _context3.abrupt("return", this.webex.request({
211
- uri: "".concat(url, "device"),
212
- method: _types3.HTTP_METHODS.POST,
213
- headers: (_headers3 = {}, (0, _defineProperty2.default)(_headers3, _constants.CISCO_DEVICE_URL, deviceInfo.clientDeviceUri), (0, _defineProperty2.default)(_headers3, _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT), _headers3),
214
- body: deviceInfo,
215
- service: _types3.ALLOWED_SERVICES.MOBIUS
216
- }));
217
- case 2:
218
- case "end":
219
- return _context3.stop();
220
- }
221
- }, _callee3, this);
222
- }));
223
- function postRegistration(_x5) {
224
- return _postRegistration.apply(this, arguments);
225
- }
226
- return postRegistration;
227
- }()
228
- /**
229
- * Re-attempts registration with the mobius url it was last registered
230
- * to, that mobius url is expected to be updated already in this.activeMobiusUrl.
231
- * @param caller - Caller of this method.
232
- */
233
- }, {
234
- key: "restorePreviousRegistration",
235
- value: function () {
236
- var _restorePreviousRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(caller) {
237
- var abort;
238
- return _regenerator.default.wrap(function _callee4$(_context4) {
239
- while (1) switch (_context4.prev = _context4.next) {
240
- case 0:
241
- abort = false;
242
- if (!this.activeMobiusUrl) {
243
- _context4.next = 5;
244
- break;
245
- }
246
- _context4.next = 4;
247
- return this.attemptRegistrationWithServers(caller, [this.activeMobiusUrl]);
248
- case 4:
249
- abort = _context4.sent;
250
- case 5:
251
- return _context4.abrupt("return", abort);
252
- case 6:
253
- case "end":
254
- return _context4.stop();
255
- }
256
- }, _callee4, this);
257
- }));
258
- function restorePreviousRegistration(_x6) {
259
- return _restorePreviousRegistration.apply(this, arguments);
260
- }
261
- return restorePreviousRegistration;
262
- }()
263
- /**
264
- * When a failback request is rejected with 429, it means the
265
- * request did not even land on primary mobius to know if it
266
- * can handle this device registration now, in such cases this
267
- * method is called to retry sooner than the rehoming timer value.
268
- */
269
- }, {
270
- key: "scheduleFailback429Retry",
271
- value: function () {
272
- var _scheduleFailback429Retry = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
273
- var interval, abort;
274
- return _regenerator.default.wrap(function _callee5$(_context5) {
275
- while (1) switch (_context5.prev = _context5.next) {
276
- case 0:
277
- if (!(this.failback429RetryAttempts >= _constants.REG_FAILBACK_429_MAX_RETRIES)) {
278
- _context5.next = 2;
279
- break;
280
- }
281
- return _context5.abrupt("return");
282
- case 2:
283
- this.clearFailbackTimer();
284
- this.failback429RetryAttempts += 1;
285
- _Logger.default.log("Received 429 while rehoming, 429 retry count : ".concat(this.failback429RetryAttempts), {
286
- file: _constants.REGISTRATION_FILE,
287
- method: _constants.FAILBACK_429_RETRY_UTIL
288
- });
289
- interval = this.getRegRetryInterval(this.failback429RetryAttempts);
290
- this.startFailbackTimer(interval);
291
- _context5.next = 9;
292
- return this.restorePreviousRegistration(_constants.FAILBACK_429_RETRY_UTIL);
293
- case 9:
294
- abort = _context5.sent;
295
- if (!(!abort && !this.isDeviceRegistered())) {
296
- _context5.next = 13;
297
- break;
298
- }
299
- _context5.next = 13;
300
- return this.restartRegistration(_constants.FAILBACK_429_RETRY_UTIL);
301
- case 13:
302
- case "end":
303
- return _context5.stop();
304
- }
305
- }, _callee5, this);
306
- }));
307
- function scheduleFailback429Retry() {
308
- return _scheduleFailback429Retry.apply(this, arguments);
309
- }
310
- return scheduleFailback429Retry;
311
- }()
312
- /**
313
- * Calculates and returns a random interval value using input argument
314
- * attempt as the variable factor.
315
- *
316
- * @param attempt - Number of times registration has been
317
- * attempted already.
318
- */
319
- }, {
320
- key: "getRegRetryInterval",
321
- value: function getRegRetryInterval() {
322
- var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
323
- return _constants.BASE_REG_RETRY_TIMER_VAL_IN_SEC + Math.pow(_constants.BASE_REG_TIMER_MFACTOR, attempt) + Math.floor((Math.random() * (_constants.REG_RANDOM_T_FACTOR_UPPER_LIMIT - _constants.SEC_TO_MSEC_MFACTOR + 1) + _constants.SEC_TO_MSEC_MFACTOR) / _constants.SEC_TO_MSEC_MFACTOR);
324
- }
325
-
326
- /**
327
- * Schedules registration retry with primary mobius servers at a random
328
- * interval calculated based on the number of times registration retry is already done
329
- * Once the time taken since the beginning of retry attempt exceeds the
330
- * retry threshold, it switches over to backup mobius servers.
331
- *
332
- * @param attempt - Number of times registration has been attempted already.
333
- * @param timeElapsed - Time elapsed since the first registration attempt.
334
- */
335
- }, {
336
- key: "startFailoverTimer",
337
- value: function () {
338
- var _startFailoverTimer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
339
- var _this = this;
340
- var attempt,
341
- timeElapsed,
342
- loggerContext,
343
- interval,
344
- excessVal,
345
- abort,
346
- scheduledTime,
347
- _args10 = arguments;
348
- return _regenerator.default.wrap(function _callee10$(_context10) {
349
- while (1) switch (_context10.prev = _context10.next) {
350
- case 0:
351
- attempt = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : 1;
352
- timeElapsed = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : 0;
353
- loggerContext = {
354
- file: _constants.REGISTRATION_FILE,
355
- method: this.startFailoverTimer.name
356
- };
357
- interval = this.getRegRetryInterval(attempt);
358
- if (timeElapsed + interval > _constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC) {
359
- excessVal = timeElapsed + interval - _constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC;
360
- interval -= excessVal;
361
- }
362
- if (!(interval > _constants.BASE_REG_RETRY_TIMER_VAL_IN_SEC)) {
363
- _context10.next = 11;
364
- break;
365
- }
366
- scheduledTime = Math.floor((0, _now.default)() / 1000);
367
- setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
368
- return _regenerator.default.wrap(function _callee7$(_context7) {
369
- while (1) switch (_context7.prev = _context7.next) {
370
- case 0:
371
- _context7.next = 2;
372
- return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
373
- var currentTime;
374
- return _regenerator.default.wrap(function _callee6$(_context6) {
375
- while (1) switch (_context6.prev = _context6.next) {
376
- case 0:
377
- _context6.next = 2;
378
- return _this.attemptRegistrationWithServers(_this.startFailoverTimer.name);
379
- case 2:
380
- abort = _context6.sent;
381
- currentTime = Math.floor((0, _now.default)() / 1000);
382
- if (!(!abort && !_this.isDeviceRegistered())) {
383
- _context6.next = 7;
384
- break;
385
- }
386
- _context6.next = 7;
387
- return _this.startFailoverTimer(attempt + 1, timeElapsed + (currentTime - scheduledTime));
388
- case 7:
389
- case "end":
390
- return _context6.stop();
391
- }
392
- }, _callee6);
393
- })));
394
- case 2:
395
- case "end":
396
- return _context7.stop();
397
- }
398
- }, _callee7);
399
- })), interval * _constants.SEC_TO_MSEC_MFACTOR);
400
- _Logger.default.log("Scheduled retry with primary in ".concat(interval, " seconds, number of attempts : ").concat(attempt), loggerContext);
401
- _context10.next = 20;
402
- break;
403
- case 11:
404
- if (!this.backupMobiusUris.length) {
405
- _context10.next = 19;
406
- break;
407
- }
408
- _Logger.default.log('Failing over to backup servers.', loggerContext);
409
- _context10.next = 15;
410
- return this.attemptRegistrationWithServers(this.startFailoverTimer.name, this.backupMobiusUris);
411
- case 15:
412
- abort = _context10.sent;
413
- if (!abort && !this.isDeviceRegistered()) {
414
- interval = this.getRegRetryInterval();
415
- setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
416
- return _regenerator.default.wrap(function _callee9$(_context9) {
417
- while (1) switch (_context9.prev = _context9.next) {
418
- case 0:
419
- _context9.next = 2;
420
- return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
421
- return _regenerator.default.wrap(function _callee8$(_context8) {
422
- while (1) switch (_context8.prev = _context8.next) {
423
- case 0:
424
- _context8.next = 2;
425
- return _this.attemptRegistrationWithServers(_this.startFailoverTimer.name, _this.backupMobiusUris);
426
- case 2:
427
- abort = _context8.sent;
428
- if (!abort && !_this.isDeviceRegistered()) {
429
- (0, _common.emitFinalFailure)(function (clientError) {
430
- _this.lineEmitter(_types4.LINE_EVENTS.ERROR, undefined, clientError);
431
- }, loggerContext);
432
- }
433
- case 4:
434
- case "end":
435
- return _context8.stop();
436
- }
437
- }, _callee8);
438
- })));
439
- case 2:
440
- case "end":
441
- return _context9.stop();
442
- }
443
- }, _callee9);
444
- })), interval * _constants.SEC_TO_MSEC_MFACTOR);
445
- _Logger.default.log("Scheduled retry with backup servers in ".concat(interval, " seconds."), loggerContext);
446
- }
447
- _context10.next = 20;
448
- break;
449
- case 19:
450
- (0, _common.emitFinalFailure)(function (clientError) {
451
- _this.lineEmitter(_types4.LINE_EVENTS.ERROR, undefined, clientError);
452
- }, loggerContext);
453
- case 20:
454
- case "end":
455
- return _context10.stop();
456
- }
457
- }, _callee10, this);
458
- }));
459
- function startFailoverTimer() {
460
- return _startFailoverTimer.apply(this, arguments);
461
- }
462
- return startFailoverTimer;
463
- }()
464
- /**
465
- * Clears the failback timer if running.
466
- */
467
- }, {
468
- key: "clearFailbackTimer",
469
- value: function clearFailbackTimer() {
470
- if (this.failbackTimer) {
471
- clearTimeout(this.failbackTimer);
472
- this.failbackTimer = undefined;
473
- }
474
- }
475
-
476
- /**
477
- * Returns true if device is registered with a backup mobius.
478
- */
479
- }, {
480
- key: "isFailbackRequired",
481
- value: function isFailbackRequired() {
482
- return this.isDeviceRegistered() && this.primaryMobiusUris.indexOf(this.activeMobiusUrl) === -1;
483
- }
484
-
485
- /**
486
- * Calculates and returns a random value between rehomingIntervalMin and
487
- * rehomingIntervalMax.
488
- */
489
- }, {
490
- key: "getFailbackInterval",
491
- value: function getFailbackInterval() {
492
- return Math.floor(Math.random() * (this.rehomingIntervalMax - this.rehomingIntervalMin + 1) + this.rehomingIntervalMin);
493
- }
494
-
495
- /**
496
- * Starts failback timer to move to primary mobius if device
497
- * is registered with a backup mobius.
498
- */
499
- }, {
500
- key: "initiateFailback",
501
- value: function initiateFailback() {
502
- if (this.isFailbackRequired()) {
503
- if (!this.failbackTimer) {
504
- this.failback429RetryAttempts = 0;
505
- var intervalInMinutes = this.getFailbackInterval();
506
- this.startFailbackTimer(intervalInMinutes * _constants.MINUTES_TO_SEC_MFACTOR);
507
- }
508
- } else {
509
- this.failback429RetryAttempts = 0;
510
- this.clearFailbackTimer();
511
- }
512
- }
513
-
514
- /**
515
- * Starts failback timer with the interval value received.
516
- *
517
- * @param intervalInSeconds - Failback timer interval value in seconds.
518
- */
519
- }, {
520
- key: "startFailbackTimer",
521
- value: function startFailbackTimer(intervalInSeconds) {
522
- var _this2 = this;
523
- this.failbackTimer = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
524
- return _regenerator.default.wrap(function _callee11$(_context11) {
525
- while (1) switch (_context11.prev = _context11.next) {
526
- case 0:
527
- return _context11.abrupt("return", _this2.executeFailback());
528
- case 1:
529
- case "end":
530
- return _context11.stop();
531
- }
532
- }, _callee11);
533
- })), intervalInSeconds * _constants.SEC_TO_MSEC_MFACTOR);
534
- _Logger.default.log("Failback scheduled after ".concat(intervalInSeconds, " seconds."), {
535
- file: _constants.REGISTRATION_FILE,
536
- method: this.startFailbackTimer.name
537
- });
538
- }
539
-
540
- /**
541
- * Core logic for the failback processing, scheduled and executed
542
- * at failback timer expiry.
543
- */
544
- }, {
545
- key: "executeFailback",
546
- value: function () {
547
- var _executeFailback = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
548
- var _this3 = this;
549
- return _regenerator.default.wrap(function _callee13$(_context13) {
550
- while (1) switch (_context13.prev = _context13.next) {
551
- case 0:
552
- _context13.next = 2;
553
- return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
554
- var abort, abortNew;
555
- return _regenerator.default.wrap(function _callee12$(_context12) {
556
- while (1) switch (_context12.prev = _context12.next) {
557
- case 0:
558
- if (!_this3.isFailbackRequired()) {
559
- _context12.next = 27;
560
- break;
561
- }
562
- if (!((0, _keys.default)(_this3.callManager.getActiveCalls()).length === 0)) {
563
- _context12.next = 24;
564
- break;
565
- }
566
- _Logger.default.info("Attempting failback to primary.", {
567
- file: _constants.REGISTRATION_FILE,
568
- method: _this3.executeFailback.name
569
- });
570
- _context12.next = 5;
571
- return _this3.deregister();
572
- case 5:
573
- _context12.next = 7;
574
- return _this3.attemptRegistrationWithServers(_constants.FAILBACK_UTIL);
575
- case 7:
576
- abort = _context12.sent;
577
- if (!(!abort && !_this3.isDeviceRegistered())) {
578
- _context12.next = 22;
579
- break;
580
- }
581
- _context12.next = 11;
582
- return _this3.restorePreviousRegistration(_constants.FAILBACK_UTIL);
583
- case 11:
584
- abortNew = _context12.sent;
585
- if (!abortNew) {
586
- _context12.next = 15;
587
- break;
588
- }
589
- _this3.clearFailbackTimer();
590
- return _context12.abrupt("return");
591
- case 15:
592
- if (_this3.isDeviceRegistered()) {
593
- _context12.next = 20;
594
- break;
595
- }
596
- _context12.next = 18;
597
- return _this3.restartRegistration(_this3.executeFailback.name);
598
- case 18:
599
- _context12.next = 22;
600
- break;
601
- case 20:
602
- _this3.failbackTimer = undefined;
603
- _this3.initiateFailback();
604
- case 22:
605
- _context12.next = 27;
606
- break;
607
- case 24:
608
- _Logger.default.info('Active calls present, deferring failback to next cycle.', {
609
- file: _constants.REGISTRATION_FILE,
610
- method: _this3.executeFailback.name
611
- });
612
- _this3.failbackTimer = undefined;
613
- _this3.initiateFailback();
614
- case 27:
615
- case "end":
616
- return _context12.stop();
617
- }
618
- }, _callee12);
619
- })));
620
- case 2:
621
- case "end":
622
- return _context13.stop();
623
- }
624
- }, _callee13, this);
625
- }));
626
- function executeFailback() {
627
- return _executeFailback.apply(this, arguments);
628
- }
629
- return executeFailback;
630
- }()
631
- /**
632
- * Updates rehomingIntervalMin and rehomingIntervalMax values
633
- * if received in registration response from a primary mobius
634
- * server.
635
- *
636
- * @param deviceInfo - Line info.
637
- */
638
- }, {
639
- key: "setIntervalValues",
640
- value: function setIntervalValues(deviceInfo) {
641
- if (this.primaryMobiusUris.indexOf(this.activeMobiusUrl) !== -1) {
642
- this.rehomingIntervalMin = deviceInfo !== null && deviceInfo !== void 0 && deviceInfo.rehomingIntervalMin ? deviceInfo.rehomingIntervalMin : _constants.DEFAULT_REHOMING_INTERVAL_MIN;
643
- this.rehomingIntervalMax = deviceInfo !== null && deviceInfo !== void 0 && deviceInfo.rehomingIntervalMax ? deviceInfo.rehomingIntervalMax : _constants.DEFAULT_REHOMING_INTERVAL_MAX;
644
- }
645
- }
646
- }, {
647
- key: "getDeviceInfo",
648
- value: function getDeviceInfo() {
649
- return this.deviceInfo;
650
- }
651
-
652
- /**
653
- * .
654
- *
655
- * @returns True if this device is in registered state
656
- * by checking if isRegistered state is set to
657
- * ACTIVE, else false.
658
- */
659
- }, {
660
- key: "isDeviceRegistered",
661
- value: function isDeviceRegistered() {
662
- return this.registrationStatus === _types3.MobiusStatus.ACTIVE;
663
- }
664
- }, {
665
- key: "getStatus",
666
- value: function getStatus() {
667
- return this.registrationStatus;
668
- }
669
- }, {
670
- key: "setStatus",
671
- value: function setStatus(value) {
672
- this.registrationStatus = value;
673
- }
674
-
675
- /**
676
- * Start fresh registration cycle with the mobius
677
- * server list already present.
678
- *
679
- * @param caller - Caller of this method.
680
- */
681
- }, {
682
- key: "restartRegistration",
683
- value: function () {
684
- var _restartRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(caller) {
685
- var abort;
686
- return _regenerator.default.wrap(function _callee14$(_context14) {
687
- while (1) switch (_context14.prev = _context14.next) {
688
- case 0:
689
- /*
690
- * Cancel any failback timer running
691
- * and start fresh registration attempt with retry as true.
692
- */
693
- this.clearFailbackTimer();
694
- this.failback429RetryAttempts = 0;
695
- _context14.next = 4;
696
- return this.attemptRegistrationWithServers(caller, this.primaryMobiusUris);
697
- case 4:
698
- abort = _context14.sent;
699
- if (!(!abort && !this.isDeviceRegistered())) {
700
- _context14.next = 8;
701
- break;
702
- }
703
- _context14.next = 8;
704
- return this.startFailoverTimer();
705
- case 8:
706
- case "end":
707
- return _context14.stop();
708
- }
709
- }, _callee14, this);
710
- }));
711
- function restartRegistration(_x7) {
712
- return _restartRegistration.apply(this, arguments);
713
- }
714
- return restartRegistration;
715
- }()
716
- }, {
717
- key: "handleConnectionRestoration",
718
- value: function () {
719
- var _handleConnectionRestoration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(retry) {
720
- var _this4 = this;
721
- return _regenerator.default.wrap(function _callee16$(_context16) {
722
- while (1) switch (_context16.prev = _context16.next) {
723
- case 0:
724
- _context16.next = 2;
725
- return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
726
- var abort;
727
- return _regenerator.default.wrap(function _callee15$(_context15) {
728
- while (1) switch (_context15.prev = _context15.next) {
729
- case 0:
730
- if (!retry) {
731
- _context15.next = 14;
732
- break;
733
- }
734
- _Logger.default.info('Mercury connection is up again, Re-registering with Mobius', {
735
- file: _constants.REGISTRATION_FILE,
736
- method: _this4.handleConnectionRestoration.name
737
- });
738
- _this4.clearKeepaliveTimer();
739
- if (!_this4.isDeviceRegistered()) {
740
- _context15.next = 6;
741
- break;
742
- }
743
- _context15.next = 6;
744
- return _this4.deregister();
745
- case 6:
746
- if (!_this4.activeMobiusUrl) {
747
- _context15.next = 13;
748
- break;
749
- }
750
- _context15.next = 9;
751
- return _this4.restorePreviousRegistration(_this4.handleConnectionRestoration.name);
752
- case 9:
753
- abort = _context15.sent;
754
- if (!(!abort && !_this4.isDeviceRegistered())) {
755
- _context15.next = 13;
756
- break;
757
- }
758
- _context15.next = 13;
759
- return _this4.restartRegistration(_this4.handleConnectionRestoration.name);
760
- case 13:
761
- retry = false;
762
- case 14:
763
- case "end":
764
- return _context15.stop();
765
- }
766
- }, _callee15);
767
- })));
768
- case 2:
769
- return _context16.abrupt("return", retry);
770
- case 3:
771
- case "end":
772
- return _context16.stop();
773
- }
774
- }, _callee16, this);
775
- }));
776
- function handleConnectionRestoration(_x8) {
777
- return _handleConnectionRestoration.apply(this, arguments);
778
- }
779
- return handleConnectionRestoration;
780
- }()
781
- /**
782
- * Callback function for restoring registration in case of failure during initial registration
783
- * due to device registration already exists.
784
- *
785
- */
786
- }, {
787
- key: "restoreRegistrationCallBack",
788
- value: function restoreRegistrationCallBack() {
789
- var _this5 = this;
790
- return /*#__PURE__*/function () {
791
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(restoreData, caller) {
792
- var logContext, restore, finalError;
793
- return _regenerator.default.wrap(function _callee17$(_context17) {
794
- while (1) switch (_context17.prev = _context17.next) {
795
- case 0:
796
- logContext = {
797
- file: _constants.REGISTRATION_FILE,
798
- method: caller
799
- };
800
- if (_this5.isRegRetry()) {
801
- _context17.next = 17;
802
- break;
803
- }
804
- _Logger.default.info('Registration restoration in progress.', logContext);
805
- restore = _this5.getExistingDevice(restoreData);
806
- if (!restore) {
807
- _context17.next = 14;
808
- break;
809
- }
810
- _this5.setRegRetry(true);
811
- _context17.next = 8;
812
- return _this5.deregister();
813
- case 8:
814
- _context17.next = 10;
815
- return _this5.restorePreviousRegistration(caller);
816
- case 10:
817
- finalError = _context17.sent;
818
- _this5.setRegRetry(false);
819
- if (_this5.isDeviceRegistered()) {
820
- _Logger.default.info('Registration restored successfully.', logContext);
821
- }
822
- return _context17.abrupt("return", finalError);
823
- case 14:
824
- _this5.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
825
- _context17.next = 18;
826
- break;
827
- case 17:
828
- _this5.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
829
- case 18:
830
- return _context17.abrupt("return", false);
831
- case 19:
832
- case "end":
833
- return _context17.stop();
834
- }
835
- }, _callee17);
836
- }));
837
- return function (_x9, _x10) {
838
- return _ref8.apply(this, arguments);
839
- };
840
- }();
841
- }
842
-
843
- /**
844
- * Triggers the registration with the given list of Mobius servers
845
- * Registration is attempted with primary and backup until it succeeds or the list is exhausted
846
- */
847
- }, {
848
- key: "triggerRegistration",
849
- value: function () {
850
- var _triggerRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
851
- var abort;
852
- return _regenerator.default.wrap(function _callee18$(_context18) {
853
- while (1) switch (_context18.prev = _context18.next) {
854
- case 0:
855
- if (!(this.primaryMobiusUris.length > 0)) {
856
- _context18.next = 7;
857
- break;
858
- }
859
- _context18.next = 3;
860
- return this.attemptRegistrationWithServers(this.triggerRegistration.name, this.primaryMobiusUris);
861
- case 3:
862
- abort = _context18.sent;
863
- if (!(!this.isDeviceRegistered() && !abort)) {
864
- _context18.next = 7;
865
- break;
866
- }
867
- _context18.next = 7;
868
- return this.startFailoverTimer();
869
- case 7:
870
- case "end":
871
- return _context18.stop();
872
- }
873
- }, _callee18, this);
874
- }));
875
- function triggerRegistration() {
876
- return _triggerRegistration.apply(this, arguments);
877
- }
878
- return triggerRegistration;
879
- }()
880
- /**
881
- * Attempts registration with the server list received in
882
- * argument one by one until registration either succeeds with
883
- * one or all of them are tried.
884
- *
885
- * @param caller - Caller of this method.
886
- * @param servers - List of mobius server urls to try.
887
- * @returns Promise resolving to a boolean carrying true if registration
888
- * attempt has hit a final error and a retry should not be scheduled
889
- * else false.
890
- */
891
- }, {
892
- key: "attemptRegistrationWithServers",
893
- value: function () {
894
- var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(caller) {
895
- var _this6 = this;
896
- var servers,
897
- abort,
898
- _iterator,
899
- _step,
900
- url,
901
- _this$deviceInfo$devi,
902
- resp,
903
- body,
904
- error,
905
- _args19 = arguments;
906
- return _regenerator.default.wrap(function _callee19$(_context19) {
907
- while (1) switch (_context19.prev = _context19.next) {
908
- case 0:
909
- servers = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : this.primaryMobiusUris;
910
- abort = false;
911
- if (!this.isDeviceRegistered()) {
912
- _context19.next = 5;
913
- break;
914
- }
915
- _Logger.default.log("[".concat(caller, "] : Device already registered with : ").concat(this.activeMobiusUrl), {
916
- file: _constants.REGISTRATION_FILE,
917
- method: this.attemptRegistrationWithServers.name
918
- });
919
- return _context19.abrupt("return", abort);
920
- case 5:
921
- _iterator = _createForOfIteratorHelper(servers);
922
- _context19.prev = 6;
923
- _iterator.s();
924
- case 8:
925
- if ((_step = _iterator.n()).done) {
926
- _context19.next = 52;
927
- break;
928
- }
929
- url = _step.value;
930
- _context19.prev = 10;
931
- abort = false;
932
- this.registrationStatus = _types3.MobiusStatus.DEFAULT;
933
- this.lineEmitter(_types4.LINE_EVENTS.CONNECTING);
934
- _Logger.default.log("[".concat(caller, "] : Mobius url to contact: ").concat(url), {
935
- file: _constants.REGISTRATION_FILE,
936
- method: this.attemptRegistrationWithServers.name
937
- });
938
- // eslint-disable-next-line no-await-in-loop
939
- _context19.next = 17;
940
- return this.postRegistration(url);
941
- case 17:
942
- resp = _context19.sent;
943
- this.deviceInfo = resp.body;
944
- this.lineEmitter(_types4.LINE_EVENTS.REGISTERED, resp.body);
945
- this.registrationStatus = _types3.MobiusStatus.ACTIVE;
946
- this.setActiveMobiusUrl(url);
947
- this.setIntervalValues(this.deviceInfo);
948
- this.metricManager.setDeviceInfo(this.deviceInfo);
949
- this.metricManager.submitRegistrationMetric(_types2.METRIC_EVENT.REGISTRATION, _types2.REG_ACTION.REGISTER, _types2.METRIC_TYPE.BEHAVIORAL, undefined);
950
- this.startKeepaliveTimer((_this$deviceInfo$devi = this.deviceInfo.device) === null || _this$deviceInfo$devi === void 0 ? void 0 : _this$deviceInfo$devi.uri, this.deviceInfo.keepaliveInterval);
951
- this.initiateFailback();
952
- return _context19.abrupt("break", 52);
953
- case 30:
954
- _context19.prev = 30;
955
- _context19.t0 = _context19["catch"](10);
956
- body = _context19.t0; // eslint-disable-next-line no-await-in-loop, @typescript-eslint/no-unused-vars
957
- _context19.next = 35;
958
- return (0, _common.handleRegistrationErrors)(body, function (clientError, finalError) {
959
- if (finalError) {
960
- _this6.lineEmitter(_types4.LINE_EVENTS.ERROR, undefined, clientError);
961
- } else {
962
- _this6.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
963
- }
964
- _this6.metricManager.submitRegistrationMetric(_types2.METRIC_EVENT.REGISTRATION_ERROR, _types2.REG_ACTION.REGISTER, _types2.METRIC_TYPE.BEHAVIORAL, clientError);
965
- }, {
966
- method: this.attemptRegistrationWithServers.name,
967
- file: _constants.REGISTRATION_FILE
968
- }, this.restoreRegistrationCallBack());
969
- case 35:
970
- abort = _context19.sent;
971
- if (!(this.registrationStatus === _types3.MobiusStatus.ACTIVE)) {
972
- _context19.next = 39;
973
- break;
974
- }
975
- _Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(this.activeMobiusUrl), {
976
- file: _constants.REGISTRATION_FILE,
977
- method: this.attemptRegistrationWithServers.name
978
- });
979
- return _context19.abrupt("break", 52);
980
- case 39:
981
- if (!abort) {
982
- _context19.next = 43;
983
- break;
984
- }
985
- return _context19.abrupt("break", 52);
986
- case 43:
987
- if (!(caller === this.executeFailback.name)) {
988
- _context19.next = 50;
989
- break;
990
- }
991
- error = body.statusCode;
992
- if (!(error === _types.ERROR_CODE.TOO_MANY_REQUESTS)) {
993
- _context19.next = 50;
994
- break;
995
- }
996
- _context19.next = 48;
997
- return this.scheduleFailback429Retry();
998
- case 48:
999
- abort = true;
1000
- return _context19.abrupt("break", 52);
1001
- case 50:
1002
- _context19.next = 8;
1003
- break;
1004
- case 52:
1005
- _context19.next = 57;
1006
- break;
1007
- case 54:
1008
- _context19.prev = 54;
1009
- _context19.t1 = _context19["catch"](6);
1010
- _iterator.e(_context19.t1);
1011
- case 57:
1012
- _context19.prev = 57;
1013
- _iterator.f();
1014
- return _context19.finish(57);
1015
- case 60:
1016
- return _context19.abrupt("return", abort);
1017
- case 61:
1018
- case "end":
1019
- return _context19.stop();
1020
- }
1021
- }, _callee19, this, [[6, 54, 57, 60], [10, 30]]);
1022
- }));
1023
- function attemptRegistrationWithServers(_x11) {
1024
- return _attemptRegistrationWithServers.apply(this, arguments);
1025
- }
1026
- return attemptRegistrationWithServers;
1027
- }()
1028
- /**
1029
- * This method sets up a timer to periodically send keep-alive requests to maintain a connection.
1030
- * It handles retries, error handling, and re-registration attempts based on the response, ensuring continuous connectivity with the server.
1031
- * @param keepAliveRetryCount
1032
- * @param url
1033
- * @param logContext
1034
- * @param interval
1035
- * @returns
1036
- */
1037
- }, {
1038
- key: "startKeepaliveTimer",
1039
- value: function startKeepaliveTimer(url, interval) {
1040
- var _this7 = this;
1041
- var keepAliveRetryCount = 0;
1042
- this.clearKeepaliveTimer();
1043
- this.keepaliveTimer = setInterval( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
1044
- var logContext;
1045
- return _regenerator.default.wrap(function _callee21$(_context21) {
1046
- while (1) switch (_context21.prev = _context21.next) {
1047
- case 0:
1048
- logContext = {
1049
- file: _constants.REGISTRATION_FILE,
1050
- method: _this7.startKeepaliveTimer.name
1051
- };
1052
- _context21.next = 3;
1053
- return _this7.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
1054
- var res, error, abort;
1055
- return _regenerator.default.wrap(function _callee20$(_context20) {
1056
- while (1) switch (_context20.prev = _context20.next) {
1057
- case 0:
1058
- if (!(_this7.isDeviceRegistered() && keepAliveRetryCount < 5)) {
1059
- _context20.next = 29;
1060
- break;
1061
- }
1062
- _context20.prev = 1;
1063
- _context20.next = 4;
1064
- return _this7.postKeepAlive(url);
1065
- case 4:
1066
- res = _context20.sent;
1067
- _Logger.default.info("Sent Keepalive, status: ".concat(res.statusCode), logContext);
1068
- if (keepAliveRetryCount > 0) {
1069
- _this7.lineEmitter(_types4.LINE_EVENTS.RECONNECTED);
1070
- }
1071
- keepAliveRetryCount = 0;
1072
- _context20.next = 29;
1073
- break;
1074
- case 10:
1075
- _context20.prev = 10;
1076
- _context20.t0 = _context20["catch"](1);
1077
- keepAliveRetryCount += 1;
1078
- error = _context20.t0;
1079
- _Logger.default.warn("Keep-alive missed ".concat(keepAliveRetryCount, " times. Status -> ").concat(error.statusCode, " "), logContext);
1080
- _context20.next = 17;
1081
- return (0, _common.handleRegistrationErrors)(error, function (clientError, finalError) {
1082
- if (finalError) {
1083
- _this7.lineEmitter(_types4.LINE_EVENTS.ERROR, undefined, clientError);
1084
- }
1085
- _this7.metricManager.submitRegistrationMetric(_types2.METRIC_EVENT.REGISTRATION, _types2.REG_ACTION.KEEPALIVE_FAILURE, _types2.METRIC_TYPE.BEHAVIORAL, clientError);
1086
- }, {
1087
- method: _this7.startKeepaliveTimer.name,
1088
- file: _constants.REGISTRATION_FILE
1089
- });
1090
- case 17:
1091
- abort = _context20.sent;
1092
- if (!(abort || keepAliveRetryCount >= 5)) {
1093
- _context20.next = 28;
1094
- break;
1095
- }
1096
- _this7.setStatus(_types3.MobiusStatus.DEFAULT);
1097
- _this7.clearKeepaliveTimer();
1098
- _this7.clearFailbackTimer();
1099
- _this7.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
1100
- if (abort) {
1101
- _context20.next = 26;
1102
- break;
1103
- }
1104
- _context20.next = 26;
1105
- return _this7.reconnectOnFailure(_this7.startKeepaliveTimer.name);
1106
- case 26:
1107
- _context20.next = 29;
1108
- break;
1109
- case 28:
1110
- _this7.lineEmitter(_types4.LINE_EVENTS.RECONNECTING);
1111
- case 29:
1112
- case "end":
1113
- return _context20.stop();
1114
- }
1115
- }, _callee20, null, [[1, 10]]);
1116
- })));
1117
- case 3:
1118
- case "end":
1119
- return _context21.stop();
1120
- }
1121
- }, _callee21);
1122
- })), interval * 1000);
1123
- }
1124
-
1125
- /**
1126
- * Clears the keepalive timer if running.
1127
- */
1128
- }, {
1129
- key: "clearKeepaliveTimer",
1130
- value: function clearKeepaliveTimer() {
1131
- if (this.keepaliveTimer) {
1132
- clearInterval(this.keepaliveTimer);
1133
- this.keepaliveTimer = undefined;
1134
- }
1135
- }
1136
- }, {
1137
- key: "isReconnectPending",
1138
- value: function isReconnectPending() {
1139
- return this.reconnectPending;
1140
- }
1141
- }, {
1142
- key: "deregister",
1143
- value: function () {
1144
- var _deregister = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
1145
- var _this$deviceInfo$devi2, _this$deviceInfo$devi3;
1146
- return _regenerator.default.wrap(function _callee22$(_context22) {
1147
- while (1) switch (_context22.prev = _context22.next) {
1148
- case 0:
1149
- _context22.prev = 0;
1150
- _context22.next = 3;
1151
- return this.deleteRegistration(this.activeMobiusUrl, (_this$deviceInfo$devi2 = this.deviceInfo.device) === null || _this$deviceInfo$devi2 === void 0 ? void 0 : _this$deviceInfo$devi2.deviceId, (_this$deviceInfo$devi3 = this.deviceInfo.device) === null || _this$deviceInfo$devi3 === void 0 ? void 0 : _this$deviceInfo$devi3.clientDeviceUri);
1152
- case 3:
1153
- _context22.next = 8;
1154
- break;
1155
- case 5:
1156
- _context22.prev = 5;
1157
- _context22.t0 = _context22["catch"](0);
1158
- _Logger.default.warn("Delete failed with Mobius", {});
1159
- case 8:
1160
- this.clearKeepaliveTimer();
1161
- this.setStatus(_types3.MobiusStatus.DEFAULT);
1162
- case 10:
1163
- case "end":
1164
- return _context22.stop();
1165
- }
1166
- }, _callee22, this, [[0, 5]]);
1167
- }));
1168
- function deregister() {
1169
- return _deregister.apply(this, arguments);
1170
- }
1171
- return deregister;
1172
- }()
1173
- /**
1174
- * @returns The value of instance variable registerRetry.
1175
- * Indicates whether the calling client is in a mode
1176
- * to retry registration.
1177
- */
1178
- }, {
1179
- key: "isRegRetry",
1180
- value: function isRegRetry() {
1181
- return this.registerRetry;
1182
- }
1183
-
1184
- /**
1185
- * Sets the received value in instance variable
1186
- * registerRetry for registration retry cases.
1187
- *
1188
- * @param value - for registerRetry
1189
- */
1190
- }, {
1191
- key: "setRegRetry",
1192
- value: function setRegRetry(value) {
1193
- this.registerRetry = value;
1194
- }
1195
-
1196
- /**
1197
- * Restores the deviceInfo object in callingClient when receiving a 403 with error code 101.
1198
- *
1199
- * @param callingClient - Instance of CallingClient.
1200
- * @param restoreData - Data from Mobius with existing device information.
1201
- * @returns Boolean.
1202
- */
1203
- }, {
1204
- key: "getExistingDevice",
1205
- value: function getExistingDevice(restoreData) {
1206
- if (restoreData.devices && restoreData.devices.length > 0) {
1207
- this.deviceInfo = {
1208
- userId: restoreData.userId,
1209
- device: restoreData.devices[0],
1210
- keepaliveInterval: _constants.DEFAULT_KEEPALIVE_INTERVAL,
1211
- rehomingIntervalMax: _constants.DEFAULT_REHOMING_INTERVAL_MAX,
1212
- rehomingIntervalMin: _constants.DEFAULT_REHOMING_INTERVAL_MIN
1213
- };
1214
- var stringToReplace = "".concat(_constants.DEVICES_ENDPOINT_RESOURCE, "/").concat(restoreData.devices[0].deviceId);
1215
- var uri = restoreData.devices[0].uri.replace(stringToReplace, '');
1216
- this.setActiveMobiusUrl(uri);
1217
- this.registrationStatus = _types3.MobiusStatus.ACTIVE;
1218
- return true;
1219
- }
1220
- return false;
1221
- }
1222
-
1223
- /**
1224
- * Invoked to re-register in cases when the registration
1225
- * is lost due to some failure.
1226
- * If there are active calls, it will only mark reconnectPending
1227
- * as true and then retry will happen when this method gets
1228
- * invoked again on receiving all calls cleared event from
1229
- * callManager.
1230
- *
1231
- * @param caller - Caller of this method.
1232
- */
1233
- }, {
1234
- key: "reconnectOnFailure",
1235
- value: function () {
1236
- var _reconnectOnFailure = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(caller) {
1237
- var abort;
1238
- return _regenerator.default.wrap(function _callee23$(_context23) {
1239
- while (1) switch (_context23.prev = _context23.next) {
1240
- case 0:
1241
- this.reconnectPending = false;
1242
- if (this.isDeviceRegistered()) {
1243
- _context23.next = 13;
1244
- break;
1245
- }
1246
- if (!((0, _keys.default)(this.callManager.getActiveCalls()).length === 0)) {
1247
- _context23.next = 11;
1248
- break;
1249
- }
1250
- _context23.next = 5;
1251
- return this.restorePreviousRegistration(caller);
1252
- case 5:
1253
- abort = _context23.sent;
1254
- if (!(!abort && !this.isDeviceRegistered())) {
1255
- _context23.next = 9;
1256
- break;
1257
- }
1258
- _context23.next = 9;
1259
- return this.restartRegistration(caller);
1260
- case 9:
1261
- _context23.next = 13;
1262
- break;
1263
- case 11:
1264
- this.reconnectPending = true;
1265
- _Logger.default.info('Active call(s) present, deferred reconnect till call cleanup.', {
1266
- file: _constants.REGISTRATION_FILE,
1267
- method: this.reconnectOnFailure.name
1268
- });
1269
- case 13:
1270
- case "end":
1271
- return _context23.stop();
1272
- }
1273
- }, _callee23, this);
1274
- }));
1275
- function reconnectOnFailure(_x12) {
1276
- return _reconnectOnFailure.apply(this, arguments);
1277
- }
1278
- return reconnectOnFailure;
1279
- }()
1280
- }]);
1281
- return Registration;
1282
- }();
1283
- /**
1284
- * @param webex - A webex instance.
1285
- * @param serviceData - indicates whether the backend service is calling or contactcentre
1286
- * @param mutex - mutex which is used to run any registration scenario exclusively
1287
- * @param lineEmitter - Line emitter for registration related events
1288
- * @param logLevel - log level option for registration module
1289
- */
1290
- exports.Registration = Registration;
1291
- var createRegistration = function createRegistration(webex, serviceData, mutex, lineEmitter, logLevel) {
1292
- return new Registration(webex, serviceData, mutex, lineEmitter, logLevel);
1293
- };
1294
- exports.createRegistration = createRegistration;
1295
- //# sourceMappingURL=register.js.map