@webex/calling 3.0.0-next.8 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallHistory/CallHistory.js +49 -49
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +9 -0
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallHistory/callHistoryFixtures.js +63 -7
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
- package/dist/CallHistory/constants.js +9 -18
- package/dist/CallHistory/constants.js.map +1 -1
- package/dist/CallHistory/types.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +18 -13
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +7 -8
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +69 -37
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +19 -13
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +2 -2
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/constants.js +11 -22
- package/dist/CallSettings/constants.js.map +1 -1
- package/dist/CallSettings/testFixtures.js +4 -8
- package/dist/CallSettings/testFixtures.js.map +1 -1
- package/dist/CallSettings/types.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +134 -75
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +170 -109
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/callRecordFixtures.js +2 -4
- package/dist/CallingClient/callRecordFixtures.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +9 -29
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/types.js.map +1 -1
- package/dist/CallingClient/calling/call.js +140 -80
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +651 -409
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +3 -14
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +1 -1
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/types.js +31 -33
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/callingClientFixtures.js +107 -17
- package/dist/CallingClient/callingClientFixtures.js.map +1 -1
- package/dist/CallingClient/constants.js +101 -193
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +20 -18
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +13 -13
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/line/types.js +7 -11
- package/dist/CallingClient/line/types.js.map +1 -1
- package/dist/CallingClient/registration/register.js +102 -111
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +33 -32
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/registerFixtures.js +5 -10
- package/dist/CallingClient/registration/registerFixtures.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +30 -19
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +4 -4
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Contacts/constants.js +10 -18
- package/dist/Contacts/constants.js.map +1 -1
- package/dist/Contacts/contactFixtures.js +26 -52
- package/dist/Contacts/contactFixtures.js.map +1 -1
- package/dist/Contacts/types.js +29 -9
- package/dist/Contacts/types.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +3 -5
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +4 -6
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +2 -3
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +5 -7
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Errors/index.js +7 -0
- package/dist/Errors/index.js.map +1 -1
- package/dist/Errors/types.js +15 -20
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/impl/index.js +2 -3
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Events/types.js +44 -52
- package/dist/Events/types.js.map +1 -1
- package/dist/Logger/index.js +1 -2
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/Logger/types.js +9 -12
- package/dist/Logger/types.js.map +1 -1
- package/dist/Metrics/index.js +2 -4
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +3 -3
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/Metrics/types.js +15 -20
- package/dist/Metrics/types.js.map +1 -1
- package/dist/SDKConnector/index.js +1 -2
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/SDKConnector/utils.js +1 -2
- package/dist/SDKConnector/utils.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +21 -12
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +2 -2
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +19 -11
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +5 -4
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +35 -33
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +18 -11
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +4 -4
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/constants.js +29 -58
- package/dist/Voicemail/constants.js.map +1 -1
- package/dist/Voicemail/types.js.map +1 -1
- package/dist/Voicemail/voicemailFixture.js +35 -70
- package/dist/Voicemail/voicemailFixture.js.map +1 -1
- package/dist/api.js +13 -20
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +18 -25
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +3 -3
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +41 -82
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +12 -21
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js +34 -43
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +246 -0
- package/dist/index.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +7 -5
- package/dist/module/CallHistory/callHistoryFixtures.js +59 -0
- package/dist/module/CallSettings/UcmBackendConnector.js +4 -4
- package/dist/module/CallingClient/CallingClient.js +59 -42
- package/dist/module/CallingClient/calling/CallerId/index.js +3 -23
- package/dist/module/CallingClient/calling/call.js +69 -26
- package/dist/module/CallingClient/calling/callManager.js +0 -6
- package/dist/module/CallingClient/callingClientFixtures.js +119 -1
- package/dist/module/CallingClient/constants.js +8 -4
- package/dist/module/CallingClient/line/index.js +9 -12
- package/dist/module/CallingClient/line/types.js +0 -5
- package/dist/module/CallingClient/registration/register.js +28 -20
- package/dist/module/Errors/catalog/CallingDeviceError.js +2 -2
- package/dist/module/Errors/catalog/LineError.js +2 -2
- package/dist/module/Errors/index.js +1 -0
- package/dist/module/Events/types.js +2 -0
- package/dist/module/common/Utils.js +14 -19
- package/dist/module/common/testUtil.js +2 -1
- package/dist/module/common/types.js +6 -5
- package/dist/module/index.js +9 -0
- package/dist/types/CallHistory/CallHistory.d.ts +2 -1
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallHistory/callHistoryFixtures.d.ts +1 -0
- package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/types.d.ts +1 -0
- package/dist/types/CallSettings/types.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +2 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/CallerId/types.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +2 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +0 -1
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +30 -30
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/callingClientFixtures.d.ts +69 -1
- package/dist/types/CallingClient/callingClientFixtures.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +7 -3
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +6 -6
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/line/types.d.ts +11 -23
- package/dist/types/CallingClient/line/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +3 -3
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +14 -14
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +6 -4
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +1 -1
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts +4 -4
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts.map +1 -1
- package/dist/types/Errors/catalog/LineError.d.ts +4 -4
- package/dist/types/Errors/catalog/LineError.d.ts.map +1 -1
- package/dist/types/Errors/index.d.ts +1 -0
- package/dist/types/Errors/index.d.ts.map +1 -1
- package/dist/types/Errors/types.d.ts +2 -3
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +28 -5
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +2 -1
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts +1 -1
- package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +1 -1
- package/dist/types/Voicemail/types.d.ts +10 -10
- package/dist/types/Voicemail/types.d.ts.map +1 -1
- package/dist/types/api.d.ts +4 -5
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +3 -2
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -34,13 +34,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
34
34
|
/**
|
|
35
35
|
*
|
|
36
36
|
*/
|
|
37
|
-
var Registration = /*#__PURE__*/function () {
|
|
37
|
+
var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
38
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
39
|
*/
|
|
45
40
|
function Registration(webex, serviceData, mutex, lineEmitter, logLevel) {
|
|
46
41
|
(0, _classCallCheck2.default)(this, Registration);
|
|
@@ -71,7 +66,7 @@ var Registration = /*#__PURE__*/function () {
|
|
|
71
66
|
}
|
|
72
67
|
this.webex = this.sdkConnector.getWebex();
|
|
73
68
|
this.userId = this.webex.internal.device.userId;
|
|
74
|
-
this.registrationStatus = _types3.
|
|
69
|
+
this.registrationStatus = _types3.RegistrationStatus.IDLE;
|
|
75
70
|
this.failback429RetryAttempts = 0;
|
|
76
71
|
_Logger.default.setLogger(logLevel, _constants.REGISTRATION_FILE);
|
|
77
72
|
this.rehomingIntervalMin = _constants.DEFAULT_REHOMING_INTERVAL_MIN;
|
|
@@ -108,21 +103,18 @@ var Registration = /*#__PURE__*/function () {
|
|
|
108
103
|
/**
|
|
109
104
|
* Implementation of sending keepalive.
|
|
110
105
|
*
|
|
111
|
-
* @param url - Entire device url.
|
|
112
|
-
* @returns Promise<boolean>.
|
|
113
106
|
*/
|
|
114
107
|
}, {
|
|
115
108
|
key: "postKeepAlive",
|
|
116
|
-
value: function () {
|
|
109
|
+
value: (function () {
|
|
117
110
|
var _postKeepAlive = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url) {
|
|
118
|
-
var _headers;
|
|
119
111
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
120
112
|
while (1) switch (_context.prev = _context.next) {
|
|
121
113
|
case 0:
|
|
122
114
|
return _context.abrupt("return", this.webex.request({
|
|
123
115
|
uri: "".concat(url, "/status"),
|
|
124
116
|
method: _types3.HTTP_METHODS.POST,
|
|
125
|
-
headers: (
|
|
117
|
+
headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.CISCO_DEVICE_URL, this.webex.internal.device.url), _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT),
|
|
126
118
|
service: _types3.ALLOWED_SERVICES.MOBIUS
|
|
127
119
|
}));
|
|
128
120
|
case 1:
|
|
@@ -139,49 +131,58 @@ var Registration = /*#__PURE__*/function () {
|
|
|
139
131
|
/**
|
|
140
132
|
* Implementation of delete device.
|
|
141
133
|
*
|
|
142
|
-
* @param url -.
|
|
143
|
-
* @param deviceId -.
|
|
144
|
-
* @param deviceUrl -.
|
|
145
134
|
*/
|
|
135
|
+
)
|
|
146
136
|
}, {
|
|
147
137
|
key: "deleteRegistration",
|
|
148
|
-
value: function () {
|
|
138
|
+
value: (function () {
|
|
149
139
|
var _deleteRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url, deviceId, deviceUrl) {
|
|
150
|
-
var
|
|
140
|
+
var _response;
|
|
151
141
|
var response;
|
|
152
142
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
153
143
|
while (1) switch (_context2.prev = _context2.next) {
|
|
154
144
|
case 0:
|
|
145
|
+
_context2.prev = 0;
|
|
155
146
|
_context2.t0 = fetch;
|
|
156
147
|
_context2.t1 = "".concat(url).concat(_constants.DEVICES_ENDPOINT_RESOURCE, "/").concat(deviceId);
|
|
157
148
|
_context2.t2 = _types3.HTTP_METHODS.DELETE;
|
|
158
|
-
_headers2 = {};
|
|
159
|
-
(0, _defineProperty2.default)(_headers2, _constants.CISCO_DEVICE_URL, deviceUrl);
|
|
160
149
|
_context2.t3 = _defineProperty2.default;
|
|
161
|
-
_context2.t4 =
|
|
162
|
-
_context2.
|
|
150
|
+
_context2.t4 = _defineProperty2.default;
|
|
151
|
+
_context2.t5 = _defineProperty2.default;
|
|
152
|
+
_context2.t6 = (0, _defineProperty2.default)({}, _constants.CISCO_DEVICE_URL, deviceUrl);
|
|
153
|
+
_context2.next = 10;
|
|
163
154
|
return this.webex.credentials.getUserToken();
|
|
164
|
-
case
|
|
165
|
-
_context2.
|
|
166
|
-
(0, _context2.
|
|
167
|
-
|
|
168
|
-
(0,
|
|
169
|
-
_context2.
|
|
170
|
-
_context2.
|
|
155
|
+
case 10:
|
|
156
|
+
_context2.t7 = _context2.sent;
|
|
157
|
+
_context2.t8 = (0, _context2.t5)(_context2.t6, "Authorization", _context2.t7);
|
|
158
|
+
_context2.t9 = "".concat(_constants.WEBEX_WEB_CLIENT, "_").concat((0, _uuid.v4)());
|
|
159
|
+
_context2.t10 = (0, _context2.t4)(_context2.t8, "trackingId", _context2.t9);
|
|
160
|
+
_context2.t11 = _constants.SPARK_USER_AGENT;
|
|
161
|
+
_context2.t12 = _constants.CALLING_USER_AGENT;
|
|
162
|
+
_context2.t13 = (0, _context2.t3)(_context2.t10, _context2.t11, _context2.t12);
|
|
163
|
+
_context2.t14 = {
|
|
171
164
|
method: _context2.t2,
|
|
172
|
-
headers: _context2.
|
|
165
|
+
headers: _context2.t13
|
|
173
166
|
};
|
|
174
|
-
_context2.next =
|
|
175
|
-
return (0, _context2.t0)(_context2.t1, _context2.
|
|
176
|
-
case
|
|
167
|
+
_context2.next = 20;
|
|
168
|
+
return (0, _context2.t0)(_context2.t1, _context2.t14);
|
|
169
|
+
case 20:
|
|
177
170
|
response = _context2.sent;
|
|
171
|
+
_context2.next = 26;
|
|
172
|
+
break;
|
|
173
|
+
case 23:
|
|
174
|
+
_context2.prev = 23;
|
|
175
|
+
_context2.t15 = _context2["catch"](0);
|
|
176
|
+
_Logger.default.warn("Delete failed with Mobius", {});
|
|
177
|
+
case 26:
|
|
178
|
+
this.setStatus(_types3.RegistrationStatus.INACTIVE);
|
|
178
179
|
this.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
|
|
179
|
-
return _context2.abrupt("return", response.json());
|
|
180
|
-
case
|
|
180
|
+
return _context2.abrupt("return", (_response = response) === null || _response === void 0 ? void 0 : _response.json());
|
|
181
|
+
case 29:
|
|
181
182
|
case "end":
|
|
182
183
|
return _context2.stop();
|
|
183
184
|
}
|
|
184
|
-
}, _callee2, this);
|
|
185
|
+
}, _callee2, this, [[0, 23]]);
|
|
185
186
|
}));
|
|
186
187
|
function deleteRegistration(_x2, _x3, _x4) {
|
|
187
188
|
return _deleteRegistration.apply(this, arguments);
|
|
@@ -191,13 +192,12 @@ var Registration = /*#__PURE__*/function () {
|
|
|
191
192
|
/**
|
|
192
193
|
* Implementation of POST request for device registration.
|
|
193
194
|
*
|
|
194
|
-
* @param url - backend service url for registration
|
|
195
195
|
*/
|
|
196
|
+
)
|
|
196
197
|
}, {
|
|
197
198
|
key: "postRegistration",
|
|
198
|
-
value: function () {
|
|
199
|
+
value: (function () {
|
|
199
200
|
var _postRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(url) {
|
|
200
|
-
var _headers3;
|
|
201
201
|
var deviceInfo;
|
|
202
202
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
203
203
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -210,7 +210,7 @@ var Registration = /*#__PURE__*/function () {
|
|
|
210
210
|
return _context3.abrupt("return", this.webex.request({
|
|
211
211
|
uri: "".concat(url, "device"),
|
|
212
212
|
method: _types3.HTTP_METHODS.POST,
|
|
213
|
-
headers: (
|
|
213
|
+
headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.CISCO_DEVICE_URL, deviceInfo.clientDeviceUri), _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT),
|
|
214
214
|
body: deviceInfo,
|
|
215
215
|
service: _types3.ALLOWED_SERVICES.MOBIUS
|
|
216
216
|
}));
|
|
@@ -228,11 +228,11 @@ var Registration = /*#__PURE__*/function () {
|
|
|
228
228
|
/**
|
|
229
229
|
* Re-attempts registration with the mobius url it was last registered
|
|
230
230
|
* to, that mobius url is expected to be updated already in this.activeMobiusUrl.
|
|
231
|
-
* @param caller - Caller of this method.
|
|
232
231
|
*/
|
|
232
|
+
)
|
|
233
233
|
}, {
|
|
234
234
|
key: "restorePreviousRegistration",
|
|
235
|
-
value: function () {
|
|
235
|
+
value: (function () {
|
|
236
236
|
var _restorePreviousRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(caller) {
|
|
237
237
|
var abort;
|
|
238
238
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
@@ -266,9 +266,10 @@ var Registration = /*#__PURE__*/function () {
|
|
|
266
266
|
* can handle this device registration now, in such cases this
|
|
267
267
|
* method is called to retry sooner than the rehoming timer value.
|
|
268
268
|
*/
|
|
269
|
+
)
|
|
269
270
|
}, {
|
|
270
271
|
key: "scheduleFailback429Retry",
|
|
271
|
-
value: function () {
|
|
272
|
+
value: (function () {
|
|
272
273
|
var _scheduleFailback429Retry = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
273
274
|
var interval, abort;
|
|
274
275
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
@@ -313,9 +314,9 @@ var Registration = /*#__PURE__*/function () {
|
|
|
313
314
|
* Calculates and returns a random interval value using input argument
|
|
314
315
|
* attempt as the variable factor.
|
|
315
316
|
*
|
|
316
|
-
* @param attempt - Number of times registration has been
|
|
317
317
|
* attempted already.
|
|
318
318
|
*/
|
|
319
|
+
)
|
|
319
320
|
}, {
|
|
320
321
|
key: "getRegRetryInterval",
|
|
321
322
|
value: function getRegRetryInterval() {
|
|
@@ -329,12 +330,10 @@ var Registration = /*#__PURE__*/function () {
|
|
|
329
330
|
* Once the time taken since the beginning of retry attempt exceeds the
|
|
330
331
|
* retry threshold, it switches over to backup mobius servers.
|
|
331
332
|
*
|
|
332
|
-
* @param attempt - Number of times registration has been attempted already.
|
|
333
|
-
* @param timeElapsed - Time elapsed since the first registration attempt.
|
|
334
333
|
*/
|
|
335
334
|
}, {
|
|
336
335
|
key: "startFailoverTimer",
|
|
337
|
-
value: function () {
|
|
336
|
+
value: (function () {
|
|
338
337
|
var _startFailoverTimer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
339
338
|
var _this = this;
|
|
340
339
|
var attempt,
|
|
@@ -464,6 +463,7 @@ var Registration = /*#__PURE__*/function () {
|
|
|
464
463
|
/**
|
|
465
464
|
* Clears the failback timer if running.
|
|
466
465
|
*/
|
|
466
|
+
)
|
|
467
467
|
}, {
|
|
468
468
|
key: "clearFailbackTimer",
|
|
469
469
|
value: function clearFailbackTimer() {
|
|
@@ -514,7 +514,6 @@ var Registration = /*#__PURE__*/function () {
|
|
|
514
514
|
/**
|
|
515
515
|
* Starts failback timer with the interval value received.
|
|
516
516
|
*
|
|
517
|
-
* @param intervalInSeconds - Failback timer interval value in seconds.
|
|
518
517
|
*/
|
|
519
518
|
}, {
|
|
520
519
|
key: "startFailbackTimer",
|
|
@@ -543,7 +542,7 @@ var Registration = /*#__PURE__*/function () {
|
|
|
543
542
|
*/
|
|
544
543
|
}, {
|
|
545
544
|
key: "executeFailback",
|
|
546
|
-
value: function () {
|
|
545
|
+
value: (function () {
|
|
547
546
|
var _executeFailback = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
548
547
|
var _this3 = this;
|
|
549
548
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
@@ -633,8 +632,8 @@ var Registration = /*#__PURE__*/function () {
|
|
|
633
632
|
* if received in registration response from a primary mobius
|
|
634
633
|
* server.
|
|
635
634
|
*
|
|
636
|
-
* @param deviceInfo - Line info.
|
|
637
635
|
*/
|
|
636
|
+
)
|
|
638
637
|
}, {
|
|
639
638
|
key: "setIntervalValues",
|
|
640
639
|
value: function setIntervalValues(deviceInfo) {
|
|
@@ -643,6 +642,11 @@ var Registration = /*#__PURE__*/function () {
|
|
|
643
642
|
this.rehomingIntervalMax = deviceInfo !== null && deviceInfo !== void 0 && deviceInfo.rehomingIntervalMax ? deviceInfo.rehomingIntervalMax : _constants.DEFAULT_REHOMING_INTERVAL_MAX;
|
|
644
643
|
}
|
|
645
644
|
}
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Retrieves information about the device as {@link IDeviceInfo}.
|
|
648
|
+
*
|
|
649
|
+
*/
|
|
646
650
|
}, {
|
|
647
651
|
key: "getDeviceInfo",
|
|
648
652
|
value: function getDeviceInfo() {
|
|
@@ -650,16 +654,15 @@ var Registration = /*#__PURE__*/function () {
|
|
|
650
654
|
}
|
|
651
655
|
|
|
652
656
|
/**
|
|
653
|
-
* .
|
|
657
|
+
* Checks if the device is currently registered.
|
|
654
658
|
*
|
|
655
|
-
* @returns True if this device is in registered state
|
|
656
659
|
* by checking if isRegistered state is set to
|
|
657
660
|
* ACTIVE, else false.
|
|
658
661
|
*/
|
|
659
662
|
}, {
|
|
660
663
|
key: "isDeviceRegistered",
|
|
661
664
|
value: function isDeviceRegistered() {
|
|
662
|
-
return this.registrationStatus === _types3.
|
|
665
|
+
return this.registrationStatus === _types3.RegistrationStatus.ACTIVE;
|
|
663
666
|
}
|
|
664
667
|
}, {
|
|
665
668
|
key: "getStatus",
|
|
@@ -676,11 +679,10 @@ var Registration = /*#__PURE__*/function () {
|
|
|
676
679
|
* Start fresh registration cycle with the mobius
|
|
677
680
|
* server list already present.
|
|
678
681
|
*
|
|
679
|
-
* @param caller - Caller of this method.
|
|
680
682
|
*/
|
|
681
683
|
}, {
|
|
682
684
|
key: "restartRegistration",
|
|
683
|
-
value: function () {
|
|
685
|
+
value: (function () {
|
|
684
686
|
var _restartRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(caller) {
|
|
685
687
|
var abort;
|
|
686
688
|
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
@@ -713,9 +715,15 @@ var Registration = /*#__PURE__*/function () {
|
|
|
713
715
|
}
|
|
714
716
|
return restartRegistration;
|
|
715
717
|
}()
|
|
718
|
+
/**
|
|
719
|
+
* Restores the connection and attempts refreshing existing registration with server.
|
|
720
|
+
* Allows retry if not restored in the first attempt.
|
|
721
|
+
*
|
|
722
|
+
*/
|
|
723
|
+
)
|
|
716
724
|
}, {
|
|
717
725
|
key: "handleConnectionRestoration",
|
|
718
|
-
value: function () {
|
|
726
|
+
value: (function () {
|
|
719
727
|
var _handleConnectionRestoration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(retry) {
|
|
720
728
|
var _this4 = this;
|
|
721
729
|
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
@@ -731,7 +739,7 @@ var Registration = /*#__PURE__*/function () {
|
|
|
731
739
|
_context15.next = 14;
|
|
732
740
|
break;
|
|
733
741
|
}
|
|
734
|
-
_Logger.default.info('Mercury connection is up again,
|
|
742
|
+
_Logger.default.info('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
735
743
|
file: _constants.REGISTRATION_FILE,
|
|
736
744
|
method: _this4.handleConnectionRestoration.name
|
|
737
745
|
});
|
|
@@ -783,6 +791,7 @@ var Registration = /*#__PURE__*/function () {
|
|
|
783
791
|
* due to device registration already exists.
|
|
784
792
|
*
|
|
785
793
|
*/
|
|
794
|
+
)
|
|
786
795
|
}, {
|
|
787
796
|
key: "restoreRegistrationCallBack",
|
|
788
797
|
value: function restoreRegistrationCallBack() {
|
|
@@ -846,7 +855,7 @@ var Registration = /*#__PURE__*/function () {
|
|
|
846
855
|
*/
|
|
847
856
|
}, {
|
|
848
857
|
key: "triggerRegistration",
|
|
849
|
-
value: function () {
|
|
858
|
+
value: (function () {
|
|
850
859
|
var _triggerRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
851
860
|
var abort;
|
|
852
861
|
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
@@ -882,15 +891,13 @@ var Registration = /*#__PURE__*/function () {
|
|
|
882
891
|
* argument one by one until registration either succeeds with
|
|
883
892
|
* one or all of them are tried.
|
|
884
893
|
*
|
|
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
894
|
* attempt has hit a final error and a retry should not be scheduled
|
|
889
895
|
* else false.
|
|
890
896
|
*/
|
|
897
|
+
)
|
|
891
898
|
}, {
|
|
892
899
|
key: "attemptRegistrationWithServers",
|
|
893
|
-
value: function () {
|
|
900
|
+
value: (function () {
|
|
894
901
|
var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(caller) {
|
|
895
902
|
var _this6 = this;
|
|
896
903
|
var servers,
|
|
@@ -923,13 +930,13 @@ var Registration = /*#__PURE__*/function () {
|
|
|
923
930
|
_iterator.s();
|
|
924
931
|
case 8:
|
|
925
932
|
if ((_step = _iterator.n()).done) {
|
|
926
|
-
_context19.next =
|
|
933
|
+
_context19.next = 53;
|
|
927
934
|
break;
|
|
928
935
|
}
|
|
929
936
|
url = _step.value;
|
|
930
937
|
_context19.prev = 10;
|
|
931
938
|
abort = false;
|
|
932
|
-
this.registrationStatus = _types3.
|
|
939
|
+
this.registrationStatus = _types3.RegistrationStatus.INACTIVE;
|
|
933
940
|
this.lineEmitter(_types4.LINE_EVENTS.CONNECTING);
|
|
934
941
|
_Logger.default.log("[".concat(caller, "] : Mobius url to contact: ").concat(url), {
|
|
935
942
|
file: _constants.REGISTRATION_FILE,
|
|
@@ -941,15 +948,15 @@ var Registration = /*#__PURE__*/function () {
|
|
|
941
948
|
case 17:
|
|
942
949
|
resp = _context19.sent;
|
|
943
950
|
this.deviceInfo = resp.body;
|
|
951
|
+
this.registrationStatus = _types3.RegistrationStatus.ACTIVE;
|
|
944
952
|
this.lineEmitter(_types4.LINE_EVENTS.REGISTERED, resp.body);
|
|
945
|
-
this.registrationStatus = _types3.MobiusStatus.ACTIVE;
|
|
946
953
|
this.setActiveMobiusUrl(url);
|
|
947
954
|
this.setIntervalValues(this.deviceInfo);
|
|
948
955
|
this.metricManager.setDeviceInfo(this.deviceInfo);
|
|
949
956
|
this.metricManager.submitRegistrationMetric(_types2.METRIC_EVENT.REGISTRATION, _types2.REG_ACTION.REGISTER, _types2.METRIC_TYPE.BEHAVIORAL, undefined);
|
|
950
957
|
this.startKeepaliveTimer((_this$deviceInfo$devi = this.deviceInfo.device) === null || _this$deviceInfo$devi === void 0 ? void 0 : _this$deviceInfo$devi.uri, this.deviceInfo.keepaliveInterval);
|
|
951
958
|
this.initiateFailback();
|
|
952
|
-
return _context19.abrupt("break",
|
|
959
|
+
return _context19.abrupt("break", 53);
|
|
953
960
|
case 30:
|
|
954
961
|
_context19.prev = 30;
|
|
955
962
|
_context19.t0 = _context19["catch"](10);
|
|
@@ -968,7 +975,7 @@ var Registration = /*#__PURE__*/function () {
|
|
|
968
975
|
}, this.restoreRegistrationCallBack());
|
|
969
976
|
case 35:
|
|
970
977
|
abort = _context19.sent;
|
|
971
|
-
if (!(this.registrationStatus === _types3.
|
|
978
|
+
if (!(this.registrationStatus === _types3.RegistrationStatus.ACTIVE)) {
|
|
972
979
|
_context19.next = 39;
|
|
973
980
|
break;
|
|
974
981
|
}
|
|
@@ -976,49 +983,50 @@ var Registration = /*#__PURE__*/function () {
|
|
|
976
983
|
file: _constants.REGISTRATION_FILE,
|
|
977
984
|
method: this.attemptRegistrationWithServers.name
|
|
978
985
|
});
|
|
979
|
-
return _context19.abrupt("break",
|
|
986
|
+
return _context19.abrupt("break", 53);
|
|
980
987
|
case 39:
|
|
981
988
|
if (!abort) {
|
|
982
|
-
_context19.next =
|
|
989
|
+
_context19.next = 44;
|
|
983
990
|
break;
|
|
984
991
|
}
|
|
985
|
-
|
|
986
|
-
|
|
992
|
+
this.setStatus(_types3.RegistrationStatus.INACTIVE);
|
|
993
|
+
return _context19.abrupt("break", 53);
|
|
994
|
+
case 44:
|
|
987
995
|
if (!(caller === this.executeFailback.name)) {
|
|
988
|
-
_context19.next =
|
|
996
|
+
_context19.next = 51;
|
|
989
997
|
break;
|
|
990
998
|
}
|
|
991
999
|
error = body.statusCode;
|
|
992
1000
|
if (!(error === _types.ERROR_CODE.TOO_MANY_REQUESTS)) {
|
|
993
|
-
_context19.next =
|
|
1001
|
+
_context19.next = 51;
|
|
994
1002
|
break;
|
|
995
1003
|
}
|
|
996
|
-
_context19.next =
|
|
1004
|
+
_context19.next = 49;
|
|
997
1005
|
return this.scheduleFailback429Retry();
|
|
998
|
-
case
|
|
1006
|
+
case 49:
|
|
999
1007
|
abort = true;
|
|
1000
|
-
return _context19.abrupt("break",
|
|
1001
|
-
case
|
|
1008
|
+
return _context19.abrupt("break", 53);
|
|
1009
|
+
case 51:
|
|
1002
1010
|
_context19.next = 8;
|
|
1003
1011
|
break;
|
|
1004
|
-
case
|
|
1005
|
-
_context19.next =
|
|
1012
|
+
case 53:
|
|
1013
|
+
_context19.next = 58;
|
|
1006
1014
|
break;
|
|
1007
|
-
case
|
|
1008
|
-
_context19.prev =
|
|
1015
|
+
case 55:
|
|
1016
|
+
_context19.prev = 55;
|
|
1009
1017
|
_context19.t1 = _context19["catch"](6);
|
|
1010
1018
|
_iterator.e(_context19.t1);
|
|
1011
|
-
case
|
|
1012
|
-
_context19.prev =
|
|
1019
|
+
case 58:
|
|
1020
|
+
_context19.prev = 58;
|
|
1013
1021
|
_iterator.f();
|
|
1014
|
-
return _context19.finish(
|
|
1015
|
-
case 60:
|
|
1016
|
-
return _context19.abrupt("return", abort);
|
|
1022
|
+
return _context19.finish(58);
|
|
1017
1023
|
case 61:
|
|
1024
|
+
return _context19.abrupt("return", abort);
|
|
1025
|
+
case 62:
|
|
1018
1026
|
case "end":
|
|
1019
1027
|
return _context19.stop();
|
|
1020
1028
|
}
|
|
1021
|
-
}, _callee19, this, [[6,
|
|
1029
|
+
}, _callee19, this, [[6, 55, 58, 61], [10, 30]]);
|
|
1022
1030
|
}));
|
|
1023
1031
|
function attemptRegistrationWithServers(_x11) {
|
|
1024
1032
|
return _attemptRegistrationWithServers.apply(this, arguments);
|
|
@@ -1028,12 +1036,8 @@ var Registration = /*#__PURE__*/function () {
|
|
|
1028
1036
|
/**
|
|
1029
1037
|
* This method sets up a timer to periodically send keep-alive requests to maintain a connection.
|
|
1030
1038
|
* 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
1039
|
*/
|
|
1040
|
+
)
|
|
1037
1041
|
}, {
|
|
1038
1042
|
key: "startKeepaliveTimer",
|
|
1039
1043
|
value: function startKeepaliveTimer(url, interval) {
|
|
@@ -1093,7 +1097,7 @@ var Registration = /*#__PURE__*/function () {
|
|
|
1093
1097
|
_context20.next = 28;
|
|
1094
1098
|
break;
|
|
1095
1099
|
}
|
|
1096
|
-
_this7.setStatus(_types3.
|
|
1100
|
+
_this7.setStatus(_types3.RegistrationStatus.INACTIVE);
|
|
1097
1101
|
_this7.clearKeepaliveTimer();
|
|
1098
1102
|
_this7.clearFailbackTimer();
|
|
1099
1103
|
_this7.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
|
|
@@ -1158,7 +1162,7 @@ var Registration = /*#__PURE__*/function () {
|
|
|
1158
1162
|
_Logger.default.warn("Delete failed with Mobius", {});
|
|
1159
1163
|
case 8:
|
|
1160
1164
|
this.clearKeepaliveTimer();
|
|
1161
|
-
this.setStatus(_types3.
|
|
1165
|
+
this.setStatus(_types3.RegistrationStatus.INACTIVE);
|
|
1162
1166
|
case 10:
|
|
1163
1167
|
case "end":
|
|
1164
1168
|
return _context22.stop();
|
|
@@ -1171,7 +1175,6 @@ var Registration = /*#__PURE__*/function () {
|
|
|
1171
1175
|
return deregister;
|
|
1172
1176
|
}()
|
|
1173
1177
|
/**
|
|
1174
|
-
* @returns The value of instance variable registerRetry.
|
|
1175
1178
|
* Indicates whether the calling client is in a mode
|
|
1176
1179
|
* to retry registration.
|
|
1177
1180
|
*/
|
|
@@ -1185,7 +1188,6 @@ var Registration = /*#__PURE__*/function () {
|
|
|
1185
1188
|
* Sets the received value in instance variable
|
|
1186
1189
|
* registerRetry for registration retry cases.
|
|
1187
1190
|
*
|
|
1188
|
-
* @param value - for registerRetry
|
|
1189
1191
|
*/
|
|
1190
1192
|
}, {
|
|
1191
1193
|
key: "setRegRetry",
|
|
@@ -1196,9 +1198,6 @@ var Registration = /*#__PURE__*/function () {
|
|
|
1196
1198
|
/**
|
|
1197
1199
|
* Restores the deviceInfo object in callingClient when receiving a 403 with error code 101.
|
|
1198
1200
|
*
|
|
1199
|
-
* @param callingClient - Instance of CallingClient.
|
|
1200
|
-
* @param restoreData - Data from Mobius with existing device information.
|
|
1201
|
-
* @returns Boolean.
|
|
1202
1201
|
*/
|
|
1203
1202
|
}, {
|
|
1204
1203
|
key: "getExistingDevice",
|
|
@@ -1214,7 +1213,7 @@ var Registration = /*#__PURE__*/function () {
|
|
|
1214
1213
|
var stringToReplace = "".concat(_constants.DEVICES_ENDPOINT_RESOURCE, "/").concat(restoreData.devices[0].deviceId);
|
|
1215
1214
|
var uri = restoreData.devices[0].uri.replace(stringToReplace, '');
|
|
1216
1215
|
this.setActiveMobiusUrl(uri);
|
|
1217
|
-
this.registrationStatus = _types3.
|
|
1216
|
+
this.registrationStatus = _types3.RegistrationStatus.ACTIVE;
|
|
1218
1217
|
return true;
|
|
1219
1218
|
}
|
|
1220
1219
|
return false;
|
|
@@ -1228,11 +1227,10 @@ var Registration = /*#__PURE__*/function () {
|
|
|
1228
1227
|
* invoked again on receiving all calls cleared event from
|
|
1229
1228
|
* callManager.
|
|
1230
1229
|
*
|
|
1231
|
-
* @param caller - Caller of this method.
|
|
1232
1230
|
*/
|
|
1233
1231
|
}, {
|
|
1234
1232
|
key: "reconnectOnFailure",
|
|
1235
|
-
value: function () {
|
|
1233
|
+
value: (function () {
|
|
1236
1234
|
var _reconnectOnFailure = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(caller) {
|
|
1237
1235
|
var abort;
|
|
1238
1236
|
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
@@ -1276,20 +1274,13 @@ var Registration = /*#__PURE__*/function () {
|
|
|
1276
1274
|
return _reconnectOnFailure.apply(this, arguments);
|
|
1277
1275
|
}
|
|
1278
1276
|
return reconnectOnFailure;
|
|
1279
|
-
}()
|
|
1277
|
+
}())
|
|
1280
1278
|
}]);
|
|
1281
1279
|
return Registration;
|
|
1282
1280
|
}();
|
|
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
|
|
1281
|
+
/*
|
|
1289
1282
|
*/
|
|
1290
|
-
exports.
|
|
1291
|
-
var createRegistration = function createRegistration(webex, serviceData, mutex, lineEmitter, logLevel) {
|
|
1283
|
+
var createRegistration = exports.createRegistration = function createRegistration(webex, serviceData, mutex, lineEmitter, logLevel) {
|
|
1292
1284
|
return new Registration(webex, serviceData, mutex, lineEmitter, logLevel);
|
|
1293
1285
|
};
|
|
1294
|
-
exports.createRegistration = createRegistration;
|
|
1295
1286
|
//# sourceMappingURL=register.js.map
|