@webex/calling 3.8.0 → 3.8.1-next.2
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 +100 -63
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +115 -19
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallHistory/constants.js +9 -1
- package/dist/CallHistory/constants.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +46 -13
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +62 -18
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +70 -7
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +153 -103
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +52 -15
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/constants.js +15 -1
- package/dist/CallSettings/constants.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +220 -159
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +53 -24
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +251 -189
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +96 -41
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +73 -48
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +96 -37
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/constants.js +105 -3
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +47 -18
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +2 -2
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +359 -297
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +561 -163
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +156 -102
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +197 -49
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Contacts/constants.js +11 -1
- package/dist/Contacts/constants.js.map +1 -1
- package/dist/Errors/types.js +2 -0
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/impl/index.js +1 -1
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Metrics/index.js +102 -41
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +10 -4
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/Metrics/types.js +4 -1
- package/dist/Metrics/types.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +154 -91
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +99 -19
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +105 -54
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +127 -17
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +198 -79
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +188 -23
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +277 -161
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +268 -10
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/constants.js +25 -1
- package/dist/Voicemail/constants.js.map +1 -1
- package/dist/Voicemail/types.js.map +1 -1
- package/dist/common/Utils.js +168 -104
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +199 -35
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +2 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +3 -0
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +32 -13
- package/dist/module/CallHistory/constants.js +6 -0
- package/dist/module/CallSettings/CallSettings.js +36 -3
- package/dist/module/CallSettings/UcmBackendConnector.js +50 -5
- package/dist/module/CallSettings/WxCallBackendConnector.js +54 -18
- package/dist/module/CallSettings/constants.js +12 -0
- package/dist/module/CallingClient/CallingClient.js +54 -16
- package/dist/module/CallingClient/calling/call.js +172 -121
- package/dist/module/CallingClient/calling/callManager.js +51 -26
- package/dist/module/CallingClient/constants.js +102 -2
- package/dist/module/CallingClient/line/index.js +37 -8
- package/dist/module/CallingClient/registration/register.js +103 -64
- package/dist/module/Contacts/ContactsClient.js +65 -21
- package/dist/module/Contacts/constants.js +10 -0
- package/dist/module/Errors/types.js +2 -0
- package/dist/module/Events/impl/index.js +1 -1
- package/dist/module/Metrics/index.js +57 -2
- package/dist/module/Metrics/types.js +3 -0
- package/dist/module/Voicemail/BroadworksBackendConnector.js +66 -17
- package/dist/module/Voicemail/UcmBackendConnector.js +51 -11
- package/dist/module/Voicemail/Voicemail.js +109 -9
- package/dist/module/Voicemail/WxCallBackendConnector.js +67 -18
- package/dist/module/Voicemail/constants.js +21 -0
- package/dist/module/common/Utils.js +51 -12
- package/dist/module/common/constants.js +1 -0
- package/dist/module/common/testUtil.js +3 -0
- package/dist/module/index.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallHistory/constants.d.ts +6 -0
- package/dist/types/CallHistory/constants.d.ts.map +1 -1
- package/dist/types/CallSettings/CallSettings.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/constants.d.ts +12 -0
- package/dist/types/CallSettings/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +2 -3
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +102 -2
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +3 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +1 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Contacts/constants.d.ts +10 -0
- package/dist/types/Contacts/constants.d.ts.map +1 -1
- package/dist/types/Errors/types.d.ts +2 -0
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +7 -2
- package/dist/types/Metrics/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +11 -2
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/Voicemail.d.ts +1 -1
- package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +3 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/constants.d.ts +21 -0
- package/dist/types/Voicemail/constants.d.ts.map +1 -1
- package/dist/types/Voicemail/types.d.ts +1 -1
- package/dist/types/Voicemail/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +4 -4
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +1 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +3 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +12 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -25,6 +25,7 @@ var _testUtil = require("../../common/testUtil");
|
|
|
25
25
|
var _callManager = require("./callManager");
|
|
26
26
|
var _Logger = _interopRequireDefault(require("../../Logger"));
|
|
27
27
|
var _Errors = require("../../Errors");
|
|
28
|
+
var _constants2 = require("../../common/constants");
|
|
28
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
29
30
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
30
31
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -32,6 +33,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
32
33
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
33
34
|
|
|
34
35
|
jest.mock('@webex/internal-media-core');
|
|
36
|
+
var uploadLogsSpy = jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
|
|
35
37
|
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
36
38
|
var mockInternalMediaCoreModule = InternalMediaCoreModule;
|
|
37
39
|
var defaultServiceIndicator = _types3.ServiceIndicator.CALLING;
|
|
@@ -134,7 +136,7 @@ describe('Call Tests', function () {
|
|
|
134
136
|
expect(call).toBeTruthy();
|
|
135
137
|
});
|
|
136
138
|
it('should log a warning when sending a digit fails', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
137
|
-
var tone, errorMessage, mockMediaConnection, callManager, call, realMediaConnection,
|
|
139
|
+
var tone, errorMessage, mockMediaConnection, callManager, call, realMediaConnection, warnSpy, infoSpy;
|
|
138
140
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
139
141
|
while (1) switch (_context.prev = _context.next) {
|
|
140
142
|
case 0:
|
|
@@ -150,12 +152,19 @@ describe('Call Tests', function () {
|
|
|
150
152
|
realMediaConnection = call.mediaConnection; // Set the mock mediaConnection object
|
|
151
153
|
call.mediaConnection = mockMediaConnection;
|
|
152
154
|
|
|
153
|
-
// Spy on the log
|
|
154
|
-
|
|
155
|
+
// Spy on the log methods
|
|
156
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
157
|
+
infoSpy = jest.spyOn(_Logger.default, 'info'); // Call the sendDigit method
|
|
155
158
|
call.sendDigit(tone);
|
|
156
159
|
|
|
160
|
+
// Expect log.info to be called with the digit being sent
|
|
161
|
+
expect(infoSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(tone), {
|
|
162
|
+
file: 'call',
|
|
163
|
+
method: 'sendDigit'
|
|
164
|
+
});
|
|
165
|
+
|
|
157
166
|
// Expect the log.warn method to be called with the error message
|
|
158
|
-
expect(
|
|
167
|
+
expect(warnSpy).toHaveBeenCalledWith("Unable to send digit on call: ".concat(errorMessage), {
|
|
159
168
|
file: 'call',
|
|
160
169
|
method: 'sendDigit'
|
|
161
170
|
});
|
|
@@ -163,21 +172,21 @@ describe('Call Tests', function () {
|
|
|
163
172
|
// Restore the real mediaConnection object
|
|
164
173
|
call.mediaConnection = realMediaConnection;
|
|
165
174
|
call.end();
|
|
166
|
-
_context.next =
|
|
175
|
+
_context.next = 16;
|
|
167
176
|
return (0, _Utils.waitForMsecs)(50);
|
|
168
|
-
case
|
|
177
|
+
case 16:
|
|
169
178
|
// Need to add a small delay for Promise and callback to finish.
|
|
170
179
|
|
|
171
180
|
/* After call ends, call manager should have 0 record */
|
|
172
181
|
expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(0);
|
|
173
|
-
case
|
|
182
|
+
case 17:
|
|
174
183
|
case "end":
|
|
175
184
|
return _context.stop();
|
|
176
185
|
}
|
|
177
186
|
}, _callee);
|
|
178
187
|
})));
|
|
179
188
|
it('delete call object when ending the call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
180
|
-
var callManager, mockStream, localAudioStream, call;
|
|
189
|
+
var callManager, mockStream, localAudioStream, call, infoSpy;
|
|
181
190
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
182
191
|
while (1) switch (_context2.prev = _context2.next) {
|
|
183
192
|
case 0:
|
|
@@ -198,19 +207,28 @@ describe('Call Tests', function () {
|
|
|
198
207
|
};
|
|
199
208
|
localAudioStream = mockStream;
|
|
200
209
|
call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
|
|
210
|
+
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
201
211
|
expect(call).toBeTruthy();
|
|
202
212
|
/* After creation , call manager should have 1 record */
|
|
203
213
|
expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(1);
|
|
204
214
|
call.mute(localAudioStream);
|
|
205
215
|
expect(call.isMuted()).toEqual(true);
|
|
206
216
|
expect(mockStream.setUserMuted).toBeCalledOnceWith(true);
|
|
217
|
+
expect(infoSpy).toHaveBeenCalledWith('invoking with: user mute', {
|
|
218
|
+
file: 'call',
|
|
219
|
+
method: 'mute'
|
|
220
|
+
});
|
|
207
221
|
call.mute(localAudioStream);
|
|
208
222
|
expect(mockStream.setUserMuted).toBeCalledWith(false);
|
|
209
223
|
expect(call.isMuted()).toEqual(false);
|
|
210
224
|
call.end();
|
|
211
|
-
|
|
225
|
+
expect(infoSpy).toHaveBeenCalledWith(_constants2.METHOD_START_MESSAGE, {
|
|
226
|
+
file: 'call',
|
|
227
|
+
method: 'end'
|
|
228
|
+
});
|
|
229
|
+
_context2.next = 19;
|
|
212
230
|
return (0, _Utils.waitForMsecs)(50);
|
|
213
|
-
case
|
|
231
|
+
case 19:
|
|
214
232
|
// Need to add a small delay for Promise and callback to finish.
|
|
215
233
|
expect(parseMediaQualityStatisticsMock).toHaveBeenCalledTimes(1);
|
|
216
234
|
expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
|
|
@@ -219,7 +237,7 @@ describe('Call Tests', function () {
|
|
|
219
237
|
|
|
220
238
|
/* After call ends, call manager should have 0 record */
|
|
221
239
|
expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(0);
|
|
222
|
-
case
|
|
240
|
+
case 24:
|
|
223
241
|
case "end":
|
|
224
242
|
return _context2.stop();
|
|
225
243
|
}
|
|
@@ -330,7 +348,7 @@ describe('Call Tests', function () {
|
|
|
330
348
|
}, _callee6, null, [[1, 7]]);
|
|
331
349
|
})));
|
|
332
350
|
it('dial functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
333
|
-
var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy;
|
|
351
|
+
var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy, logSpy;
|
|
334
352
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
335
353
|
while (1) switch (_context7.prev = _context7.next) {
|
|
336
354
|
case 0:
|
|
@@ -347,10 +365,12 @@ describe('Call Tests', function () {
|
|
|
347
365
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
348
366
|
call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
|
|
349
367
|
bnrMetricSpy = jest.spyOn(call['metricManager'], 'submitBNRMetric');
|
|
368
|
+
logSpy = jest.spyOn(_Logger.default, 'log');
|
|
350
369
|
call.dial(localAudioStream);
|
|
351
370
|
expect(mockTrack.enabled).toEqual(true);
|
|
352
371
|
expect(mockInternalMediaCoreModule.RoapMediaConnection).toBeCalledOnceWith(roapMediaConnectionConfig, roapMediaConnectionOptions, expect.any(String), expect.any(Function), expect.any(Function), expect.any(Function));
|
|
353
372
|
expect(call['mediaStateMachine'].state.value).toBe('S_SEND_ROAP_OFFER');
|
|
373
|
+
expect(logSpy).toHaveBeenCalled();
|
|
354
374
|
expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
|
|
355
375
|
|
|
356
376
|
/* Now change the state and recall to check for error */
|
|
@@ -361,14 +381,14 @@ describe('Call Tests', function () {
|
|
|
361
381
|
file: 'call',
|
|
362
382
|
method: 'dial'
|
|
363
383
|
});
|
|
364
|
-
case
|
|
384
|
+
case 16:
|
|
365
385
|
case "end":
|
|
366
386
|
return _context7.stop();
|
|
367
387
|
}
|
|
368
388
|
}, _callee7);
|
|
369
389
|
})));
|
|
370
390
|
it('answer functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
371
|
-
var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy;
|
|
391
|
+
var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy, infoSpy;
|
|
372
392
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
373
393
|
while (1) switch (_context8.prev = _context8.next) {
|
|
374
394
|
case 0:
|
|
@@ -386,6 +406,7 @@ describe('Call Tests', function () {
|
|
|
386
406
|
call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
|
|
387
407
|
/** Cannot answer in idle state */
|
|
388
408
|
bnrMetricSpy = jest.spyOn(call['metricManager'], 'submitBNRMetric');
|
|
409
|
+
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
389
410
|
call.answer(localAudioStream);
|
|
390
411
|
expect(mockTrack.enabled).toEqual(true);
|
|
391
412
|
expect(mockInternalMediaCoreModule.RoapMediaConnection).toBeCalledOnceWith(roapMediaConnectionConfig, roapMediaConnectionOptions, expect.any(String), expect.any(Function), expect.any(Function), expect.any(Function));
|
|
@@ -394,13 +415,14 @@ describe('Call Tests', function () {
|
|
|
394
415
|
file: 'call',
|
|
395
416
|
method: 'answer'
|
|
396
417
|
});
|
|
418
|
+
expect(infoSpy).toHaveBeenCalled();
|
|
397
419
|
|
|
398
420
|
/* Now change the state and recall to check for correct flow */
|
|
399
421
|
call['callStateMachine'].state.value = 'S_SEND_CALL_PROGRESS';
|
|
400
422
|
call.answer(localAudioStream);
|
|
401
423
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
|
|
402
424
|
expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
|
|
403
|
-
case
|
|
425
|
+
case 16:
|
|
404
426
|
case "end":
|
|
405
427
|
return _context8.stop();
|
|
406
428
|
}
|
|
@@ -601,6 +623,7 @@ describe('Call Tests', function () {
|
|
|
601
623
|
it('update media with invalid stream', function () {
|
|
602
624
|
var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
603
625
|
var warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
626
|
+
var infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
604
627
|
var mockStream = {
|
|
605
628
|
outputStream: {
|
|
606
629
|
getAudioTracks: jest.fn().mockReturnValue([mockTrack])
|
|
@@ -620,10 +643,14 @@ describe('Call Tests', function () {
|
|
|
620
643
|
var localAudioStream2 = errorStream;
|
|
621
644
|
call.updateMedia(localAudioStream2);
|
|
622
645
|
expect(call['mediaConnection'].updateLocalTracks).not.toBeCalled();
|
|
623
|
-
expect(warnSpy).
|
|
646
|
+
expect(warnSpy).toHaveBeenCalledWith("Did not find a local track while updating media for call ".concat(call.getCorrelationId(), ". Will not update media"), {
|
|
624
647
|
file: 'call',
|
|
625
648
|
method: 'updateMedia'
|
|
626
649
|
});
|
|
650
|
+
expect(infoSpy).toHaveBeenCalledWith('invoking with stream', {
|
|
651
|
+
file: 'call',
|
|
652
|
+
method: 'dial'
|
|
653
|
+
});
|
|
627
654
|
});
|
|
628
655
|
it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
629
656
|
var logSpy, callManager, mockStream, localAudioStream, call;
|
|
@@ -661,7 +688,7 @@ describe('Call Tests', function () {
|
|
|
661
688
|
call.mute(localAudioStream, _types5.MUTE_TYPE.USER);
|
|
662
689
|
expect(call.isMuted()).toEqual(true);
|
|
663
690
|
expect(mockStream.setUserMuted).not.toBeCalledOnceWith(true);
|
|
664
|
-
expect(logSpy).
|
|
691
|
+
expect(logSpy).toHaveBeenCalledWith("Call is muted on the system - ".concat(call.getCorrelationId(), "."), {
|
|
665
692
|
file: 'call',
|
|
666
693
|
method: 'mute'
|
|
667
694
|
});
|
|
@@ -682,7 +709,7 @@ describe('Call Tests', function () {
|
|
|
682
709
|
mockStream.systemMuted = true;
|
|
683
710
|
call.mute(localAudioStream, _types5.MUTE_TYPE.SYSTEM);
|
|
684
711
|
expect(call.isMuted()).toEqual(true);
|
|
685
|
-
expect(logSpy).
|
|
712
|
+
expect(logSpy).toHaveBeenCalledWith("Call is muted by the user already - ".concat(call.getCorrelationId(), "."), {
|
|
686
713
|
file: 'call',
|
|
687
714
|
method: 'mute'
|
|
688
715
|
});
|
|
@@ -817,7 +844,11 @@ describe('State Machine handler tests', function () {
|
|
|
817
844
|
file: 'call',
|
|
818
845
|
method: 'handleCallEstablished'
|
|
819
846
|
});
|
|
820
|
-
|
|
847
|
+
expect(logSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
|
|
848
|
+
file: 'call',
|
|
849
|
+
method: 'handleCallEstablished'
|
|
850
|
+
});
|
|
851
|
+
case 15:
|
|
821
852
|
case "end":
|
|
822
853
|
return _context15.stop();
|
|
823
854
|
}
|
|
@@ -967,11 +998,12 @@ describe('State Machine handler tests', function () {
|
|
|
967
998
|
}, _callee18);
|
|
968
999
|
})));
|
|
969
1000
|
it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
970
|
-
var warnSpy, stateMachineSpy, statusPayload, roapMessage;
|
|
1001
|
+
var warnSpy, errorSpy, stateMachineSpy, statusPayload, roapMessage;
|
|
971
1002
|
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
972
1003
|
while (1) switch (_context19.prev = _context19.next) {
|
|
973
1004
|
case 0:
|
|
974
1005
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1006
|
+
errorSpy = jest.spyOn(_Logger.default, 'error');
|
|
975
1007
|
stateMachineSpy = jest.spyOn(call, 'sendCallStateMachineEvt');
|
|
976
1008
|
statusPayload = {
|
|
977
1009
|
statusCode: 200,
|
|
@@ -995,22 +1027,23 @@ describe('State Machine handler tests', function () {
|
|
|
995
1027
|
webex.request.mockRejectedValueOnce({
|
|
996
1028
|
statusCode: 403
|
|
997
1029
|
}).mockResolvedValue(statusPayload);
|
|
998
|
-
_context19.next =
|
|
1030
|
+
_context19.next = 13;
|
|
999
1031
|
return call['handleOutgoingCallConnect']({
|
|
1000
1032
|
type: 'E_SEND_CALL_CONNECT'
|
|
1001
1033
|
});
|
|
1002
|
-
case
|
|
1034
|
+
case 13:
|
|
1003
1035
|
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
1004
1036
|
expect(stateMachineSpy).toBeCalledTimes(3);
|
|
1005
|
-
expect(warnSpy).toBeCalledTimes(
|
|
1006
|
-
|
|
1037
|
+
expect(warnSpy).toBeCalledTimes(3);
|
|
1038
|
+
expect(errorSpy).toBeCalledTimes(1);
|
|
1039
|
+
case 17:
|
|
1007
1040
|
case "end":
|
|
1008
1041
|
return _context19.stop();
|
|
1009
1042
|
}
|
|
1010
1043
|
}, _callee19);
|
|
1011
1044
|
})));
|
|
1012
1045
|
it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1013
|
-
var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent;
|
|
1046
|
+
var statusPayload, dummyEvent, postMediaSpy, logSpy, dummyOkEvent;
|
|
1014
1047
|
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
1015
1048
|
while (1) switch (_context20.prev = _context20.next) {
|
|
1016
1049
|
case 0:
|
|
@@ -1023,9 +1056,11 @@ describe('State Machine handler tests', function () {
|
|
|
1023
1056
|
data: undefined
|
|
1024
1057
|
};
|
|
1025
1058
|
postMediaSpy = jest.spyOn(call, 'postMedia');
|
|
1059
|
+
logSpy = jest.spyOn(_Logger.default, 'log');
|
|
1026
1060
|
webex.request.mockReturnValue(statusPayload);
|
|
1027
1061
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1028
1062
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
|
|
1063
|
+
expect(logSpy).toHaveBeenCalled();
|
|
1029
1064
|
dummyEvent.type = 'E_RECV_CALL_PROGRESS';
|
|
1030
1065
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1031
1066
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_PROGRESS');
|
|
@@ -1084,7 +1119,7 @@ describe('State Machine handler tests', function () {
|
|
|
1084
1119
|
type: 'E_SEND_CALL_DISCONNECT'
|
|
1085
1120
|
});
|
|
1086
1121
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
|
|
1087
|
-
case
|
|
1122
|
+
case 42:
|
|
1088
1123
|
case "end":
|
|
1089
1124
|
return _context20.stop();
|
|
1090
1125
|
}
|
|
@@ -1212,7 +1247,7 @@ describe('State Machine handler tests', function () {
|
|
|
1212
1247
|
}, _callee22);
|
|
1213
1248
|
})));
|
|
1214
1249
|
it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1215
|
-
var statusPayload, dummyEvent;
|
|
1250
|
+
var statusPayload, dummyEvent, errorSpy;
|
|
1216
1251
|
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
1217
1252
|
while (1) switch (_context23.prev = _context23.next) {
|
|
1218
1253
|
case 0:
|
|
@@ -1229,19 +1264,25 @@ describe('State Machine handler tests', function () {
|
|
|
1229
1264
|
}
|
|
1230
1265
|
};
|
|
1231
1266
|
webex.request.mockRejectedValueOnce(statusPayload);
|
|
1267
|
+
errorSpy = jest.spyOn(_Logger.default, 'error');
|
|
1232
1268
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1233
|
-
_context23.next =
|
|
1269
|
+
_context23.next = 7;
|
|
1234
1270
|
return (0, _testUtil.flushPromises)(3);
|
|
1235
|
-
case 6:
|
|
1236
|
-
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
1237
1271
|
case 7:
|
|
1272
|
+
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
1273
|
+
expect(errorSpy).toHaveBeenCalled();
|
|
1274
|
+
expect(uploadLogsSpy).toHaveBeenCalledWith({
|
|
1275
|
+
correlationId: call.getCorrelationId(),
|
|
1276
|
+
callId: call.getCallId()
|
|
1277
|
+
});
|
|
1278
|
+
case 10:
|
|
1238
1279
|
case "end":
|
|
1239
1280
|
return _context23.stop();
|
|
1240
1281
|
}
|
|
1241
1282
|
}, _callee23);
|
|
1242
1283
|
})));
|
|
1243
1284
|
it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1244
|
-
var statusPayload, dummyEvent;
|
|
1285
|
+
var statusPayload, dummyEvent, warnSpy;
|
|
1245
1286
|
return _regenerator.default.wrap(function _callee24$(_context24) {
|
|
1246
1287
|
while (1) switch (_context24.prev = _context24.next) {
|
|
1247
1288
|
case 0:
|
|
@@ -1260,16 +1301,26 @@ describe('State Machine handler tests', function () {
|
|
|
1260
1301
|
call['earlyMedia'] = true;
|
|
1261
1302
|
call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
|
|
1262
1303
|
webex.request.mockRejectedValue(statusPayload);
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
case 8:
|
|
1304
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1305
|
+
jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
|
|
1266
1306
|
_context24.next = 10;
|
|
1267
|
-
return (
|
|
1307
|
+
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1268
1308
|
case 10:
|
|
1309
|
+
_context24.next = 12;
|
|
1310
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1311
|
+
case 12:
|
|
1269
1312
|
expect(call.isConnected()).toBe(false);
|
|
1270
1313
|
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_ERROR');
|
|
1271
1314
|
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
1272
|
-
|
|
1315
|
+
expect(warnSpy).toHaveBeenCalledWith('Failed to process MediaOk request', {
|
|
1316
|
+
file: 'call',
|
|
1317
|
+
method: 'handleRoapEstablished'
|
|
1318
|
+
});
|
|
1319
|
+
expect(uploadLogsSpy).toHaveBeenCalledWith({
|
|
1320
|
+
correlationId: call.getCorrelationId(),
|
|
1321
|
+
callId: call.getCallId()
|
|
1322
|
+
});
|
|
1323
|
+
case 17:
|
|
1273
1324
|
case "end":
|
|
1274
1325
|
return _context24.stop();
|
|
1275
1326
|
}
|
|
@@ -1991,7 +2042,7 @@ describe('State Machine handler tests', function () {
|
|
|
1991
2042
|
dummyEvent.data = undefined;
|
|
1992
2043
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1993
2044
|
expect(call['callStateMachine'].state.value).toBe('S_CALL_HOLD');
|
|
1994
|
-
expect(infoSpy).toHaveBeenLastCalledWith("
|
|
2045
|
+
expect(infoSpy).toHaveBeenLastCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
|
|
1995
2046
|
file: 'call',
|
|
1996
2047
|
method: 'handleCallHold'
|
|
1997
2048
|
});
|
|
@@ -2949,7 +3000,7 @@ describe('Supplementary Services tests', function () {
|
|
|
2949
3000
|
return _regenerator.default.wrap(function _callee63$(_context63) {
|
|
2950
3001
|
while (1) switch (_context63.prev = _context63.next) {
|
|
2951
3002
|
case 0:
|
|
2952
|
-
expect.assertions(
|
|
3003
|
+
expect.assertions(12); // Updated to match actual assertion count
|
|
2953
3004
|
responsePayload = {
|
|
2954
3005
|
statusCode: 200,
|
|
2955
3006
|
body: mockResponseBody
|
|
@@ -3012,7 +3063,9 @@ describe('Supplementary Services tests', function () {
|
|
|
3012
3063
|
expect(uploadLogsSpy).not.toBeCalled();
|
|
3013
3064
|
expect(infoSpy).toHaveBeenCalledWith("Initiating Consult transfer between : ".concat(call.getCallId(), " and ").concat(secondCall.getCallId()), transferLoggingContext);
|
|
3014
3065
|
expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3015
|
-
|
|
3066
|
+
expect(infoSpy).toHaveBeenCalledWith("Initiating Consult transfer between : ".concat(call.getCallId(), " and ").concat(secondCall.getCallId()), transferLoggingContext);
|
|
3067
|
+
expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3068
|
+
case 24:
|
|
3016
3069
|
case "end":
|
|
3017
3070
|
return _context63.stop();
|
|
3018
3071
|
}
|
|
@@ -3023,7 +3076,7 @@ describe('Supplementary Services tests', function () {
|
|
|
3023
3076
|
return _regenerator.default.wrap(function _callee65$(_context65) {
|
|
3024
3077
|
while (1) switch (_context65.prev = _context65.next) {
|
|
3025
3078
|
case 0:
|
|
3026
|
-
expect.assertions(
|
|
3079
|
+
expect.assertions(10); // Updated to match actual assertion count
|
|
3027
3080
|
responsePayload = {
|
|
3028
3081
|
statusCode: 200,
|
|
3029
3082
|
body: mockResponseBody
|
|
@@ -3066,7 +3119,9 @@ describe('Supplementary Services tests', function () {
|
|
|
3066
3119
|
expect(uploadLogsSpy).not.toBeCalled();
|
|
3067
3120
|
expect(infoSpy).toHaveBeenCalledWith("Initiating Blind transfer with : ".concat(transfereeNumber), transferLoggingContext);
|
|
3068
3121
|
expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3069
|
-
|
|
3122
|
+
expect(infoSpy).toHaveBeenCalledWith("Initiating Blind transfer with : ".concat(transfereeNumber), transferLoggingContext);
|
|
3123
|
+
expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3124
|
+
case 21:
|
|
3070
3125
|
case "end":
|
|
3071
3126
|
return _context65.stop();
|
|
3072
3127
|
}
|