@webex/calling 3.10.0 → 3.11.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallHistory/CallHistory.js +128 -133
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +289 -186
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +17 -18
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +14 -14
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +72 -25
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +138 -48
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +138 -145
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +149 -150
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +407 -359
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +378 -401
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +7 -8
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +666 -624
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +908 -556
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +22 -18
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +114 -114
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/constants.js +7 -1
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +57 -74
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +22 -22
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +675 -527
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +657 -309
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +24 -24
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +20 -20
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +259 -268
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +64 -63
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +7 -10
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +6 -9
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +6 -8
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +6 -9
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Events/impl/index.js +12 -14
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Logger/index.js +3 -3
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/Metrics/index.js +1 -2
- package/dist/Metrics/index.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/Voicemail/BroadworksBackendConnector.js +131 -139
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +106 -98
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +88 -92
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +103 -131
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +20 -20
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +117 -131
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +180 -154
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/common/Utils.js +198 -166
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +436 -191
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +3 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +5 -4
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +20 -11
- package/dist/module/CallSettings/UcmBackendConnector.js +21 -8
- package/dist/module/CallSettings/WxCallBackendConnector.js +10 -15
- package/dist/module/CallingClient/CallingClient.js +125 -123
- package/dist/module/CallingClient/calling/call.js +76 -60
- package/dist/module/CallingClient/calling/callManager.js +7 -0
- package/dist/module/CallingClient/constants.js +5 -0
- package/dist/module/CallingClient/registration/register.js +93 -5
- package/dist/module/CallingClient/registration/webWorker.js +2 -2
- package/dist/module/CallingClient/registration/webWorkerStr.js +2 -2
- package/dist/module/Contacts/ContactsClient.js +19 -25
- package/dist/module/Events/impl/index.js +1 -1
- package/dist/module/Logger/index.js +2 -2
- package/dist/module/Voicemail/BroadworksBackendConnector.js +10 -18
- package/dist/module/Voicemail/UcmBackendConnector.js +7 -11
- package/dist/module/Voicemail/Voicemail.js +42 -68
- package/dist/module/Voicemail/WxCallBackendConnector.js +14 -28
- package/dist/module/common/Utils.js +31 -5
- package/dist/module/common/constants.js +2 -0
- package/dist/module/common/testUtil.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +2 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +4 -0
- 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 +5 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +6 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +8 -1
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +2 -1
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Logger/index.d.ts +1 -2
- package/dist/types/Logger/index.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +16 -0
- 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.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/constants.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 +4 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -8,10 +8,11 @@ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequ
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
9
9
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
10
10
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
11
|
+
var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
|
|
11
12
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
12
13
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
13
14
|
var InternalMediaCoreModule = _interopRequireWildcard(require("@webex/internal-media-core"));
|
|
14
|
-
var
|
|
15
|
+
var _mediaHelpers = require("@webex/media-helpers");
|
|
15
16
|
var _types = require("../../Errors/types");
|
|
16
17
|
var _Utils = _interopRequireWildcard(require("../../common/Utils"));
|
|
17
18
|
var Utils = _Utils;
|
|
@@ -26,7 +27,7 @@ var _callManager = require("./callManager");
|
|
|
26
27
|
var _Logger = _interopRequireDefault(require("../../Logger"));
|
|
27
28
|
var _Errors = require("../../Errors");
|
|
28
29
|
var _constants2 = require("../../common/constants");
|
|
29
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
30
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
30
31
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
31
32
|
/* eslint-disable dot-notation */
|
|
32
33
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
@@ -136,7 +137,7 @@ describe('Call Tests', function () {
|
|
|
136
137
|
});
|
|
137
138
|
it('should log a warning when sending a digit fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
138
139
|
var tone, errorMessage, mockMediaConnection, callManager, call, realMediaConnection, warnSpy, infoSpy;
|
|
139
|
-
return _regenerator.default.wrap(function
|
|
140
|
+
return _regenerator.default.wrap(function (_context) {
|
|
140
141
|
while (1) switch (_context.prev = _context.next) {
|
|
141
142
|
case 0:
|
|
142
143
|
tone = '1';
|
|
@@ -171,14 +172,14 @@ describe('Call Tests', function () {
|
|
|
171
172
|
// Restore the real mediaConnection object
|
|
172
173
|
call.mediaConnection = realMediaConnection;
|
|
173
174
|
call.end();
|
|
174
|
-
_context.next =
|
|
175
|
+
_context.next = 1;
|
|
175
176
|
return (0, _Utils.waitForMsecs)(50);
|
|
176
|
-
case
|
|
177
|
+
case 1:
|
|
177
178
|
// Need to add a small delay for Promise and callback to finish.
|
|
178
179
|
|
|
179
180
|
/* After call ends, call manager should have 0 record */
|
|
180
181
|
expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(0);
|
|
181
|
-
case
|
|
182
|
+
case 2:
|
|
182
183
|
case "end":
|
|
183
184
|
return _context.stop();
|
|
184
185
|
}
|
|
@@ -186,7 +187,7 @@ describe('Call Tests', function () {
|
|
|
186
187
|
})));
|
|
187
188
|
it('delete call object when ending the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
188
189
|
var callManager, mockStream, localAudioStream, call, infoSpy;
|
|
189
|
-
return _regenerator.default.wrap(function
|
|
190
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
190
191
|
while (1) switch (_context2.prev = _context2.next) {
|
|
191
192
|
case 0:
|
|
192
193
|
webex.request.mockReturnValue({
|
|
@@ -225,9 +226,9 @@ describe('Call Tests', function () {
|
|
|
225
226
|
file: 'call',
|
|
226
227
|
method: 'end'
|
|
227
228
|
});
|
|
228
|
-
_context2.next =
|
|
229
|
+
_context2.next = 1;
|
|
229
230
|
return (0, _Utils.waitForMsecs)(50);
|
|
230
|
-
case
|
|
231
|
+
case 1:
|
|
231
232
|
// Need to add a small delay for Promise and callback to finish.
|
|
232
233
|
expect(parseMediaQualityStatisticsMock).toHaveBeenCalledTimes(1);
|
|
233
234
|
expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
|
|
@@ -236,7 +237,7 @@ describe('Call Tests', function () {
|
|
|
236
237
|
|
|
237
238
|
/* After call ends, call manager should have 0 record */
|
|
238
239
|
expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(0);
|
|
239
|
-
case
|
|
240
|
+
case 2:
|
|
240
241
|
case "end":
|
|
241
242
|
return _context2.stop();
|
|
242
243
|
}
|
|
@@ -244,7 +245,7 @@ describe('Call Tests', function () {
|
|
|
244
245
|
})));
|
|
245
246
|
it('Check whether media requests succeed or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
246
247
|
var mediaResponse, call, response;
|
|
247
|
-
return _regenerator.default.wrap(function
|
|
248
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
248
249
|
while (1) switch (_context3.prev = _context3.next) {
|
|
249
250
|
case 0:
|
|
250
251
|
webex.request.mockReturnValue({
|
|
@@ -268,12 +269,12 @@ describe('Call Tests', function () {
|
|
|
268
269
|
}
|
|
269
270
|
};
|
|
270
271
|
call = callManager.createCall(_types3.CallDirection.INBOUND, deviceId, mockLineId, dest);
|
|
271
|
-
_context3.next =
|
|
272
|
+
_context3.next = 1;
|
|
272
273
|
return call['postMedia']({});
|
|
273
|
-
case
|
|
274
|
+
case 1:
|
|
274
275
|
response = _context3.sent;
|
|
275
276
|
expect(response.body).toStrictEqual(mediaResponse.body);
|
|
276
|
-
case
|
|
277
|
+
case 2:
|
|
277
278
|
case "end":
|
|
278
279
|
return _context3.stop();
|
|
279
280
|
}
|
|
@@ -281,18 +282,18 @@ describe('Call Tests', function () {
|
|
|
281
282
|
})));
|
|
282
283
|
it('check whether callerId midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
283
284
|
var call;
|
|
284
|
-
return _regenerator.default.wrap(function
|
|
285
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
285
286
|
while (1) switch (_context4.prev = _context4.next) {
|
|
286
287
|
case 0:
|
|
287
288
|
call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
|
|
288
289
|
call.handleMidCallEvent(dummyMidCallEvent);
|
|
289
|
-
_context4.next =
|
|
290
|
+
_context4.next = 1;
|
|
290
291
|
return (0, _Utils.waitForMsecs)(50);
|
|
291
|
-
case
|
|
292
|
+
case 1:
|
|
292
293
|
expect(call.getCallerInfo().name).toStrictEqual('Bob Marley');
|
|
293
294
|
expect(call.getCallerInfo().num).toStrictEqual('5010');
|
|
294
295
|
expect(call.getCallerInfo().avatarSrc).toBeFalsy();
|
|
295
|
-
case
|
|
296
|
+
case 2:
|
|
296
297
|
case "end":
|
|
297
298
|
return _context4.stop();
|
|
298
299
|
}
|
|
@@ -300,55 +301,55 @@ describe('Call Tests', function () {
|
|
|
300
301
|
})));
|
|
301
302
|
it('check whether call midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
302
303
|
var call, logSpy, corelationId;
|
|
303
|
-
return _regenerator.default.wrap(function
|
|
304
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
304
305
|
while (1) switch (_context5.prev = _context5.next) {
|
|
305
306
|
case 0:
|
|
306
307
|
call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
|
|
307
308
|
dummyMidCallEvent.eventType = 'callState';
|
|
308
309
|
logSpy = jest.spyOn(_Logger.default, 'log');
|
|
309
310
|
call.handleMidCallEvent(dummyMidCallEvent);
|
|
310
|
-
_context5.next =
|
|
311
|
+
_context5.next = 1;
|
|
311
312
|
return (0, _Utils.waitForMsecs)(50);
|
|
312
|
-
case
|
|
313
|
+
case 1:
|
|
313
314
|
corelationId = call.getCorrelationId();
|
|
314
315
|
expect(logSpy).toHaveBeenLastCalledWith("Received Midcall call event for correlationId : ".concat(corelationId), {
|
|
315
316
|
file: 'call',
|
|
316
317
|
method: 'handleMidCallEvent'
|
|
317
318
|
});
|
|
318
|
-
case
|
|
319
|
+
case 2:
|
|
319
320
|
case "end":
|
|
320
321
|
return _context5.stop();
|
|
321
322
|
}
|
|
322
323
|
}, _callee5);
|
|
323
324
|
})));
|
|
324
325
|
it('check call stats for active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
325
|
-
var call, callRtpStats;
|
|
326
|
-
return _regenerator.default.wrap(function
|
|
326
|
+
var call, callRtpStats, _t;
|
|
327
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
327
328
|
while (1) switch (_context6.prev = _context6.next) {
|
|
328
329
|
case 0:
|
|
329
330
|
call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
|
|
330
331
|
_context6.prev = 1;
|
|
331
|
-
_context6.next =
|
|
332
|
+
_context6.next = 2;
|
|
332
333
|
return call.getCallRtpStats();
|
|
333
|
-
case
|
|
334
|
+
case 2:
|
|
334
335
|
callRtpStats = _context6.sent;
|
|
335
|
-
_context6.next =
|
|
336
|
+
_context6.next = 4;
|
|
336
337
|
break;
|
|
337
|
-
case
|
|
338
|
-
_context6.prev =
|
|
339
|
-
|
|
340
|
-
console.error(
|
|
341
|
-
case
|
|
338
|
+
case 3:
|
|
339
|
+
_context6.prev = 3;
|
|
340
|
+
_t = _context6["catch"](1);
|
|
341
|
+
console.error(_t);
|
|
342
|
+
case 4:
|
|
342
343
|
expect(callRtpStats).toStrictEqual(disconnectStats);
|
|
343
|
-
case
|
|
344
|
+
case 5:
|
|
344
345
|
case "end":
|
|
345
346
|
return _context6.stop();
|
|
346
347
|
}
|
|
347
|
-
}, _callee6, null, [[1,
|
|
348
|
+
}, _callee6, null, [[1, 3]]);
|
|
348
349
|
})));
|
|
349
350
|
it('dial functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
350
351
|
var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy, logSpy;
|
|
351
|
-
return _regenerator.default.wrap(function
|
|
352
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
352
353
|
while (1) switch (_context7.prev = _context7.next) {
|
|
353
354
|
case 0:
|
|
354
355
|
mockStream = {
|
|
@@ -380,7 +381,7 @@ describe('Call Tests', function () {
|
|
|
380
381
|
file: 'call',
|
|
381
382
|
method: 'dial'
|
|
382
383
|
});
|
|
383
|
-
case
|
|
384
|
+
case 1:
|
|
384
385
|
case "end":
|
|
385
386
|
return _context7.stop();
|
|
386
387
|
}
|
|
@@ -388,7 +389,7 @@ describe('Call Tests', function () {
|
|
|
388
389
|
})));
|
|
389
390
|
it('answer functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
390
391
|
var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy, infoSpy;
|
|
391
|
-
return _regenerator.default.wrap(function
|
|
392
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
392
393
|
while (1) switch (_context8.prev = _context8.next) {
|
|
393
394
|
case 0:
|
|
394
395
|
mockStream = {
|
|
@@ -421,7 +422,7 @@ describe('Call Tests', function () {
|
|
|
421
422
|
call.answer(localAudioStream);
|
|
422
423
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
|
|
423
424
|
expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
|
|
424
|
-
case
|
|
425
|
+
case 1:
|
|
425
426
|
case "end":
|
|
426
427
|
return _context8.stop();
|
|
427
428
|
}
|
|
@@ -429,7 +430,7 @@ describe('Call Tests', function () {
|
|
|
429
430
|
})));
|
|
430
431
|
it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
431
432
|
var mockStream, localAudioStream, onStreamSpy, onEffectSpy, offStreamSpy, offEffectSpy, call, updateLocalTracksSpy, bnrMetricSpy;
|
|
432
|
-
return _regenerator.default.wrap(function
|
|
433
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
433
434
|
while (1) switch (_context9.prev = _context9.next) {
|
|
434
435
|
case 0:
|
|
435
436
|
mockStream = {
|
|
@@ -462,8 +463,8 @@ describe('Call Tests', function () {
|
|
|
462
463
|
bnrMetricSpy.mockClear();
|
|
463
464
|
/* Invoking the callback function to trigger EffectAdded event to simulate adding effect to the stream */
|
|
464
465
|
onStreamSpy.mock.calls[1][1](mockEffect);
|
|
465
|
-
expect(onEffectSpy).toBeCalledWith(
|
|
466
|
-
expect(onEffectSpy).toBeCalledWith(
|
|
466
|
+
expect(onEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Enabled, expect.any(Function));
|
|
467
|
+
expect(onEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Disabled, expect.any(Function));
|
|
467
468
|
|
|
468
469
|
/* Send Enabled event on the effect, update track and send metrics for BNR disabled */
|
|
469
470
|
onStreamSpy.mock.calls[0][1](mockTrack);
|
|
@@ -486,16 +487,16 @@ describe('Call Tests', function () {
|
|
|
486
487
|
});
|
|
487
488
|
expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_DISABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
|
|
488
489
|
call.end();
|
|
489
|
-
_context9.next =
|
|
490
|
+
_context9.next = 1;
|
|
490
491
|
return (0, _Utils.waitForMsecs)(50);
|
|
491
|
-
case
|
|
492
|
+
case 1:
|
|
492
493
|
/* Checks for switching off the listeners on call disconnect */
|
|
493
494
|
expect(offStreamSpy).toBeCalledTimes(2);
|
|
494
495
|
expect(offStreamSpy).toBeCalledWith(InternalMediaCoreModule.LocalStreamEventNames.OutputTrackChange, expect.any(Function));
|
|
495
496
|
expect(offStreamSpy).toBeCalledWith(InternalMediaCoreModule.LocalStreamEventNames.EffectAdded, expect.any(Function));
|
|
496
|
-
expect(offEffectSpy).toBeCalledWith(
|
|
497
|
-
expect(offEffectSpy).toBeCalledWith(
|
|
498
|
-
case
|
|
497
|
+
expect(offEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Enabled, expect.any(Function));
|
|
498
|
+
expect(offEffectSpy).toBeCalledWith(_mediaHelpers.EffectEvent.Disabled, expect.any(Function));
|
|
499
|
+
case 2:
|
|
499
500
|
case "end":
|
|
500
501
|
return _context9.stop();
|
|
501
502
|
}
|
|
@@ -503,7 +504,7 @@ describe('Call Tests', function () {
|
|
|
503
504
|
})));
|
|
504
505
|
it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
505
506
|
var mockStream, localAudioStream, warnSpy, call;
|
|
506
|
-
return _regenerator.default.wrap(function
|
|
507
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
507
508
|
while (1) switch (_context0.prev = _context0.next) {
|
|
508
509
|
case 0:
|
|
509
510
|
mockStream = {
|
|
@@ -528,9 +529,9 @@ describe('Call Tests', function () {
|
|
|
528
529
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
529
530
|
call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
|
|
530
531
|
call.answer(localAudioStream);
|
|
531
|
-
_context0.next =
|
|
532
|
+
_context0.next = 1;
|
|
532
533
|
return (0, _Utils.waitForMsecs)(50);
|
|
533
|
-
case
|
|
534
|
+
case 1:
|
|
534
535
|
expect(warnSpy).toBeCalledTimes(2);
|
|
535
536
|
expect(warnSpy).toBeCalledWith("Did not find a local track while answering the call ".concat(call.getCorrelationId()), {
|
|
536
537
|
file: 'call',
|
|
@@ -541,7 +542,7 @@ describe('Call Tests', function () {
|
|
|
541
542
|
expect(call.getDisconnectReason().code).toBe(_types5.DisconnectCode.MEDIA_INACTIVITY);
|
|
542
543
|
expect(call.getDisconnectReason().cause).toBe(_types5.DisconnectCause.MEDIA_INACTIVITY);
|
|
543
544
|
expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
|
|
544
|
-
case
|
|
545
|
+
case 2:
|
|
545
546
|
case "end":
|
|
546
547
|
return _context0.stop();
|
|
547
548
|
}
|
|
@@ -549,7 +550,7 @@ describe('Call Tests', function () {
|
|
|
549
550
|
})));
|
|
550
551
|
it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
551
552
|
var mockStream, localAudioStream, warnSpy, call;
|
|
552
|
-
return _regenerator.default.wrap(function
|
|
553
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
553
554
|
while (1) switch (_context1.prev = _context1.next) {
|
|
554
555
|
case 0:
|
|
555
556
|
mockStream = {
|
|
@@ -562,9 +563,9 @@ describe('Call Tests', function () {
|
|
|
562
563
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
563
564
|
call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
|
|
564
565
|
call.dial(localAudioStream);
|
|
565
|
-
_context1.next =
|
|
566
|
+
_context1.next = 1;
|
|
566
567
|
return (0, _Utils.waitForMsecs)(50);
|
|
567
|
-
case
|
|
568
|
+
case 1:
|
|
568
569
|
expect(warnSpy).toBeCalledTimes(1);
|
|
569
570
|
expect(warnSpy).toBeCalledWith("Did not find a local track while dialing the call ".concat(call.getCorrelationId()), {
|
|
570
571
|
file: 'call',
|
|
@@ -573,7 +574,7 @@ describe('Call Tests', function () {
|
|
|
573
574
|
expect(call['callStateMachine'].state.value).toBe('S_IDLE');
|
|
574
575
|
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_IDLE');
|
|
575
576
|
expect(webex.request).not.toBeCalledOnceWith();
|
|
576
|
-
case
|
|
577
|
+
case 2:
|
|
577
578
|
case "end":
|
|
578
579
|
return _context1.stop();
|
|
579
580
|
}
|
|
@@ -653,7 +654,7 @@ describe('Call Tests', function () {
|
|
|
653
654
|
});
|
|
654
655
|
it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
655
656
|
var logSpy, callManager, mockStream, localAudioStream, call;
|
|
656
|
-
return _regenerator.default.wrap(function
|
|
657
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
657
658
|
while (1) switch (_context10.prev = _context10.next) {
|
|
658
659
|
case 0:
|
|
659
660
|
logSpy = jest.spyOn(_Logger.default, 'info');
|
|
@@ -728,7 +729,7 @@ describe('Call Tests', function () {
|
|
|
728
729
|
call.mute(localAudioStream, _types5.MUTE_TYPE.USER);
|
|
729
730
|
expect(call.isMuted()).toEqual(false);
|
|
730
731
|
expect(mockStream.setUserMuted).toBeCalledOnceWith(false);
|
|
731
|
-
case
|
|
732
|
+
case 1:
|
|
732
733
|
case "end":
|
|
733
734
|
return _context10.stop();
|
|
734
735
|
}
|
|
@@ -742,7 +743,7 @@ describe('Call Tests', function () {
|
|
|
742
743
|
var call;
|
|
743
744
|
it('outgoing call without guest calling must have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
744
745
|
var requestSpy, requestArgs;
|
|
745
|
-
return _regenerator.default.wrap(function
|
|
746
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
746
747
|
while (1) switch (_context11.prev = _context11.next) {
|
|
747
748
|
case 0:
|
|
748
749
|
call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
|
|
@@ -754,7 +755,7 @@ describe('Call Tests', function () {
|
|
|
754
755
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
755
756
|
requestArgs = requestSpy.mock.calls[0][0];
|
|
756
757
|
expect('callee' in requestArgs.body).toBe(true);
|
|
757
|
-
case
|
|
758
|
+
case 1:
|
|
758
759
|
case "end":
|
|
759
760
|
return _context11.stop();
|
|
760
761
|
}
|
|
@@ -762,7 +763,7 @@ describe('Call Tests', function () {
|
|
|
762
763
|
})));
|
|
763
764
|
it('outgoing call for guest calling must not have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
764
765
|
var requestSpy, requestArgs;
|
|
765
|
-
return _regenerator.default.wrap(function
|
|
766
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
766
767
|
while (1) switch (_context12.prev = _context12.next) {
|
|
767
768
|
case 0:
|
|
768
769
|
call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
|
|
@@ -774,7 +775,7 @@ describe('Call Tests', function () {
|
|
|
774
775
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
775
776
|
requestArgs = requestSpy.mock.calls[0][0];
|
|
776
777
|
expect('callee' in requestArgs.body).toBe(false);
|
|
777
|
-
case
|
|
778
|
+
case 1:
|
|
778
779
|
case "end":
|
|
779
780
|
return _context12.stop();
|
|
780
781
|
}
|
|
@@ -813,7 +814,7 @@ describe('State Machine handler tests', function () {
|
|
|
813
814
|
|
|
814
815
|
it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
815
816
|
var statusPayload, dummyEvent, funcSpy, logSpy;
|
|
816
|
-
return _regenerator.default.wrap(function
|
|
817
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
817
818
|
while (1) switch (_context13.prev = _context13.next) {
|
|
818
819
|
case 0:
|
|
819
820
|
statusPayload = {
|
|
@@ -834,29 +835,65 @@ describe('State Machine handler tests', function () {
|
|
|
834
835
|
/* This is to flush all the promises from the Promise queue so that
|
|
835
836
|
* Jest.fakeTimers can advance time and also clear the promise Queue
|
|
836
837
|
*/
|
|
837
|
-
_context13.next =
|
|
838
|
+
_context13.next = 1;
|
|
838
839
|
return (0, _testUtil.flushPromises)(3);
|
|
839
|
-
case
|
|
840
|
+
case 1:
|
|
840
841
|
expect(setInterval).toHaveBeenCalledTimes(1);
|
|
842
|
+
expect(setInterval).toHaveBeenCalledWith(expect.any(Function), _constants.DEFAULT_SESSION_TIMER);
|
|
841
843
|
expect(funcSpy).toBeCalledTimes(1);
|
|
842
844
|
expect(logSpy).toBeCalledWith('Session refresh successful', {
|
|
843
845
|
file: 'call',
|
|
844
|
-
method: '
|
|
846
|
+
method: 'scheduleCallKeepaliveInterval'
|
|
845
847
|
});
|
|
846
848
|
expect(logSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
|
|
847
849
|
file: 'call',
|
|
848
850
|
method: 'handleCallEstablished'
|
|
849
851
|
});
|
|
850
|
-
case
|
|
852
|
+
case 2:
|
|
851
853
|
case "end":
|
|
852
854
|
return _context13.stop();
|
|
853
855
|
}
|
|
854
856
|
}, _callee13);
|
|
855
857
|
})));
|
|
856
|
-
it('session refresh
|
|
857
|
-
var statusPayload, funcSpy;
|
|
858
|
-
return _regenerator.default.wrap(function
|
|
858
|
+
it('session refresh 401 emits token error and ends the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
859
|
+
var statusPayload, emitSpy, funcSpy;
|
|
860
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
859
861
|
while (1) switch (_context14.prev = _context14.next) {
|
|
862
|
+
case 0:
|
|
863
|
+
expect.assertions(4);
|
|
864
|
+
statusPayload = {
|
|
865
|
+
statusCode: 401
|
|
866
|
+
};
|
|
867
|
+
webex.request.mockReturnValue(statusPayload);
|
|
868
|
+
jest.spyOn(global, 'clearInterval');
|
|
869
|
+
emitSpy = jest.spyOn(call, 'emit');
|
|
870
|
+
call.on(_types2.CALL_EVENT_KEYS.CALL_ERROR, function (errObj) {
|
|
871
|
+
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TOKEN_ERROR);
|
|
872
|
+
});
|
|
873
|
+
funcSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(statusPayload);
|
|
874
|
+
call['handleCallEstablished']({});
|
|
875
|
+
jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
|
|
876
|
+
_context14.next = 1;
|
|
877
|
+
return _promise.default.resolve();
|
|
878
|
+
case 1:
|
|
879
|
+
_context14.next = 2;
|
|
880
|
+
return _promise.default.resolve();
|
|
881
|
+
case 2:
|
|
882
|
+
// clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
|
|
883
|
+
// and once in handleCallKeepaliveError when clearing timer due to error
|
|
884
|
+
expect(clearInterval).toHaveBeenCalledTimes(2);
|
|
885
|
+
expect(funcSpy).toBeCalledTimes(1);
|
|
886
|
+
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
887
|
+
case 3:
|
|
888
|
+
case "end":
|
|
889
|
+
return _context14.stop();
|
|
890
|
+
}
|
|
891
|
+
}, _callee14);
|
|
892
|
+
})));
|
|
893
|
+
it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
894
|
+
var statusPayload, funcSpy;
|
|
895
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
896
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
860
897
|
case 0:
|
|
861
898
|
expect.assertions(4);
|
|
862
899
|
statusPayload = {
|
|
@@ -869,35 +906,159 @@ describe('State Machine handler tests', function () {
|
|
|
869
906
|
expect(errObj.message).toStrictEqual('An unauthorized action has been received. This action has been blocked. Please contact the administrator if this persists.');
|
|
870
907
|
});
|
|
871
908
|
funcSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(statusPayload);
|
|
872
|
-
if (call['sessionTimer'] === undefined) {
|
|
873
|
-
/* In cases where this test is run independently/alone, there is no sessionTimer initiated
|
|
874
|
-
Thus we will check and initialize the timer when not present by calling handleCallEstablish() */
|
|
875
|
-
call['handleCallEstablished']({});
|
|
876
|
-
}
|
|
877
909
|
call['handleCallEstablished']({});
|
|
878
910
|
jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
|
|
879
911
|
|
|
880
912
|
/* This is to flush all the promises from the Promise queue so that
|
|
881
913
|
* Jest.fakeTimers can advance time and also clear the promise Queue
|
|
882
914
|
*/
|
|
883
|
-
|
|
884
|
-
return
|
|
885
|
-
case
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
expect(clearInterval).toHaveBeenCalledTimes(2); // check this
|
|
915
|
+
_context15.next = 1;
|
|
916
|
+
return (0, _testUtil.flushPromises)(2);
|
|
917
|
+
case 1:
|
|
918
|
+
// clearInterval is called twice: once in scheduleCallKeepaliveInterval (at start)
|
|
919
|
+
// and once in handleCallKeepaliveError when clearing timer due to error
|
|
920
|
+
expect(clearInterval).toHaveBeenCalledTimes(2);
|
|
890
921
|
expect(funcSpy).toBeCalledTimes(1);
|
|
891
|
-
case
|
|
922
|
+
case 2:
|
|
892
923
|
case "end":
|
|
893
|
-
return
|
|
924
|
+
return _context15.stop();
|
|
894
925
|
}
|
|
895
|
-
},
|
|
926
|
+
}, _callee15);
|
|
927
|
+
})));
|
|
928
|
+
it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
929
|
+
var errorPayload, okPayload, scheduleKeepaliveSpy, postStatusSpy;
|
|
930
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
931
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
932
|
+
case 0:
|
|
933
|
+
errorPayload = {
|
|
934
|
+
statusCode: 500,
|
|
935
|
+
headers: {
|
|
936
|
+
'retry-after': 1
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
okPayload = {
|
|
940
|
+
statusCode: 200,
|
|
941
|
+
body: {}
|
|
942
|
+
};
|
|
943
|
+
scheduleKeepaliveSpy = jest.spyOn(call, 'scheduleCallKeepaliveInterval');
|
|
944
|
+
postStatusSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(errorPayload).mockResolvedValueOnce(okPayload);
|
|
945
|
+
if (call['sessionTimer'] === undefined) {
|
|
946
|
+
call['handleCallEstablished']({});
|
|
947
|
+
}
|
|
948
|
+
jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
|
|
949
|
+
_context16.next = 1;
|
|
950
|
+
return (0, _testUtil.flushPromises)(2);
|
|
951
|
+
case 1:
|
|
952
|
+
expect(postStatusSpy).toHaveBeenCalledTimes(1);
|
|
953
|
+
|
|
954
|
+
// Now advance by 1 second for the retry-after interval
|
|
955
|
+
jest.advanceTimersByTime(1000);
|
|
956
|
+
_context16.next = 2;
|
|
957
|
+
return (0, _testUtil.flushPromises)(2);
|
|
958
|
+
case 2:
|
|
959
|
+
expect(postStatusSpy).toHaveBeenCalledTimes(2);
|
|
960
|
+
expect(scheduleKeepaliveSpy).toHaveBeenCalledTimes(2);
|
|
961
|
+
case 3:
|
|
962
|
+
case "end":
|
|
963
|
+
return _context16.stop();
|
|
964
|
+
}
|
|
965
|
+
}, _callee16);
|
|
896
966
|
})));
|
|
897
|
-
it('
|
|
967
|
+
it('scheduleCallKeepaliveInterval clears existing interval before creating new one', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
968
|
+
var firstTimer, secondTimer;
|
|
969
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
970
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
971
|
+
case 0:
|
|
972
|
+
jest.spyOn(global, 'setInterval');
|
|
973
|
+
jest.spyOn(global, 'clearInterval');
|
|
974
|
+
|
|
975
|
+
// Setup the first keepalive interval
|
|
976
|
+
call['handleCallEstablished']({});
|
|
977
|
+
|
|
978
|
+
// At this point, scheduleCallKeepaliveInterval was called once
|
|
979
|
+
// It should have called clearInterval once (at the start) and setInterval once
|
|
980
|
+
expect(clearInterval).toHaveBeenCalledTimes(1);
|
|
981
|
+
expect(setInterval).toHaveBeenCalledTimes(1);
|
|
982
|
+
firstTimer = call['sessionTimer'];
|
|
983
|
+
expect(firstTimer).toBeDefined();
|
|
984
|
+
|
|
985
|
+
// Manually call scheduleCallKeepaliveInterval again to simulate a retry scenario
|
|
986
|
+
call['scheduleCallKeepaliveInterval']();
|
|
987
|
+
|
|
988
|
+
// clearInterval should have been called again to clear the previous timer
|
|
989
|
+
expect(clearInterval).toHaveBeenCalledTimes(2);
|
|
990
|
+
// A new interval should have been created
|
|
991
|
+
expect(setInterval).toHaveBeenCalledTimes(2);
|
|
992
|
+
|
|
993
|
+
// The sessionTimer should be different (new timer)
|
|
994
|
+
secondTimer = call['sessionTimer'];
|
|
995
|
+
expect(secondTimer).toBeDefined();
|
|
996
|
+
case 1:
|
|
997
|
+
case "end":
|
|
998
|
+
return _context17.stop();
|
|
999
|
+
}
|
|
1000
|
+
}, _callee17);
|
|
1001
|
+
})));
|
|
1002
|
+
it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
1003
|
+
var errorPayload, warnSpy, postStatusSpy;
|
|
1004
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1005
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1006
|
+
case 0:
|
|
1007
|
+
errorPayload = {
|
|
1008
|
+
statusCode: 500,
|
|
1009
|
+
headers: {
|
|
1010
|
+
'retry-after': 1
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
jest.spyOn(global, 'clearInterval');
|
|
1014
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1015
|
+
postStatusSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(errorPayload); // Put the call in the S_CALL_ESTABLISHED state and set it as connected
|
|
1016
|
+
call['callStateMachine'].state.value = 'S_CALL_ESTABLISHED';
|
|
1017
|
+
call['connected'] = true;
|
|
1018
|
+
|
|
1019
|
+
// Call handleCallEstablished which will setup interval
|
|
1020
|
+
call['handleCallEstablished']({});
|
|
1021
|
+
|
|
1022
|
+
// Advance timer to trigger the first failure (uses DEFAULT_SESSION_TIMER)
|
|
1023
|
+
jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
|
|
1024
|
+
_context18.next = 1;
|
|
1025
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1026
|
+
case 1:
|
|
1027
|
+
// Now advance by 1 second for each of the 4 retry attempts (retry-after: 1 second each)
|
|
1028
|
+
// Need to do this separately to allow state machine to process and create new intervals
|
|
1029
|
+
jest.advanceTimersByTime(1000);
|
|
1030
|
+
_context18.next = 2;
|
|
1031
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1032
|
+
case 2:
|
|
1033
|
+
jest.advanceTimersByTime(1000);
|
|
1034
|
+
_context18.next = 3;
|
|
1035
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1036
|
+
case 3:
|
|
1037
|
+
jest.advanceTimersByTime(1000);
|
|
1038
|
+
_context18.next = 4;
|
|
1039
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1040
|
+
case 4:
|
|
1041
|
+
jest.advanceTimersByTime(1000);
|
|
1042
|
+
_context18.next = 5;
|
|
1043
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1044
|
+
case 5:
|
|
1045
|
+
// The error handler should detect we're at max retry count and stop
|
|
1046
|
+
expect(warnSpy).toHaveBeenCalledWith("Max keepalive retry attempts reached. Aborting call keepalive for callId: ".concat(call.getCallId()), {
|
|
1047
|
+
file: 'call',
|
|
1048
|
+
method: 'keepaliveRetryCallback'
|
|
1049
|
+
});
|
|
1050
|
+
expect(postStatusSpy).toHaveBeenCalledTimes(5);
|
|
1051
|
+
expect(call['callKeepaliveRetryCount']).toBe(4);
|
|
1052
|
+
case 6:
|
|
1053
|
+
case "end":
|
|
1054
|
+
return _context18.stop();
|
|
1055
|
+
}
|
|
1056
|
+
}, _callee18);
|
|
1057
|
+
})));
|
|
1058
|
+
it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
898
1059
|
var statusPayload, dummyEvent, postMediaSpy, deleteSpy, dummyOkEvent;
|
|
899
|
-
return _regenerator.default.wrap(function
|
|
900
|
-
while (1) switch (
|
|
1060
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1061
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
901
1062
|
case 0:
|
|
902
1063
|
statusPayload = {
|
|
903
1064
|
statusCode: 200,
|
|
@@ -951,16 +1112,16 @@ describe('State Machine handler tests', function () {
|
|
|
951
1112
|
});
|
|
952
1113
|
expect(deleteSpy).toBeCalledOnceWith();
|
|
953
1114
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
954
|
-
case
|
|
1115
|
+
case 1:
|
|
955
1116
|
case "end":
|
|
956
|
-
return
|
|
1117
|
+
return _context19.stop();
|
|
957
1118
|
}
|
|
958
|
-
},
|
|
1119
|
+
}, _callee19);
|
|
959
1120
|
})));
|
|
960
|
-
it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1121
|
+
it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
961
1122
|
var statusPayload, dummyEvent;
|
|
962
|
-
return _regenerator.default.wrap(function
|
|
963
|
-
while (1) switch (
|
|
1123
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1124
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
964
1125
|
case 0:
|
|
965
1126
|
call['direction'] = _types3.CallDirection.INBOUND;
|
|
966
1127
|
statusPayload = {
|
|
@@ -978,11 +1139,11 @@ describe('State Machine handler tests', function () {
|
|
|
978
1139
|
webex.request.mockReturnValue(statusPayload);
|
|
979
1140
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
980
1141
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
|
|
981
|
-
|
|
1142
|
+
_context20.next = 1;
|
|
982
1143
|
return call['handleOutgoingCallConnect']({
|
|
983
1144
|
type: 'E_SEND_CALL_CONNECT'
|
|
984
1145
|
});
|
|
985
|
-
case
|
|
1146
|
+
case 1:
|
|
986
1147
|
/* state should not change since there is no offer received. */
|
|
987
1148
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
|
|
988
1149
|
expect(call.isConnected()).toBeFalsy();
|
|
@@ -990,16 +1151,117 @@ describe('State Machine handler tests', function () {
|
|
|
990
1151
|
type: 'E_RECV_CALL_DISCONNECT'
|
|
991
1152
|
});
|
|
992
1153
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
993
|
-
case
|
|
1154
|
+
case 2:
|
|
994
1155
|
case "end":
|
|
995
|
-
return
|
|
1156
|
+
return _context20.stop();
|
|
996
1157
|
}
|
|
997
|
-
},
|
|
1158
|
+
}, _callee20);
|
|
998
1159
|
})));
|
|
999
|
-
it('
|
|
1160
|
+
it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1161
|
+
var callManager, statusPayload, call, dummyEvent, dummyOkEvent, emitSpy, startCallerIdSpy, mobiusProgressEvent;
|
|
1162
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
1163
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1164
|
+
case 0:
|
|
1165
|
+
callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
1166
|
+
statusPayload = {
|
|
1167
|
+
statusCode: 200,
|
|
1168
|
+
body: mockStatusBody
|
|
1169
|
+
};
|
|
1170
|
+
call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
|
|
1171
|
+
webex.request.mockReturnValue(statusPayload);
|
|
1172
|
+
|
|
1173
|
+
// Move to S_SEND_CALL_SETUP
|
|
1174
|
+
dummyEvent = {
|
|
1175
|
+
type: 'E_SEND_CALL_SETUP',
|
|
1176
|
+
data: {
|
|
1177
|
+
seq: 1,
|
|
1178
|
+
message: {},
|
|
1179
|
+
type: 'OFFER'
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
call.sendCallStateMachineEvt(dummyEvent);
|
|
1183
|
+
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
|
|
1184
|
+
|
|
1185
|
+
// Complete media negotiation to allow connect -> established
|
|
1186
|
+
// Ask media SDK to initiate offer
|
|
1187
|
+
dummyEvent.type = 'E_SEND_ROAP_OFFER';
|
|
1188
|
+
dummyEvent.data = {
|
|
1189
|
+
seq: 1,
|
|
1190
|
+
messageType: 'OFFER',
|
|
1191
|
+
sdp: 'sdp'
|
|
1192
|
+
};
|
|
1193
|
+
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1194
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_SEND_ROAP_OFFER');
|
|
1195
|
+
dummyEvent.type = 'E_RECV_ROAP_ANSWER';
|
|
1196
|
+
dummyEvent.data = {
|
|
1197
|
+
seq: 1,
|
|
1198
|
+
messageType: 'ANSWER',
|
|
1199
|
+
sdp: 'sdp'
|
|
1200
|
+
};
|
|
1201
|
+
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1202
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_RECV_ROAP_ANSWER');
|
|
1203
|
+
// Send OK
|
|
1204
|
+
dummyOkEvent = {
|
|
1205
|
+
type: 'E_ROAP_OK',
|
|
1206
|
+
data: {
|
|
1207
|
+
received: false,
|
|
1208
|
+
message: {
|
|
1209
|
+
seq: 1,
|
|
1210
|
+
messageType: 'OK'
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
1215
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_OK');
|
|
1216
|
+
expect(call['mediaNegotiationCompleted']).toBe(true);
|
|
1217
|
+
|
|
1218
|
+
// Move call to established
|
|
1219
|
+
dummyEvent.type = 'E_RECV_CALL_CONNECT';
|
|
1220
|
+
dummyEvent.data = undefined;
|
|
1221
|
+
call.sendCallStateMachineEvt(dummyEvent);
|
|
1222
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_ESTABLISHED');
|
|
1223
|
+
emitSpy = jest.spyOn(call, 'emit');
|
|
1224
|
+
startCallerIdSpy = jest.spyOn(call, 'startCallerIdResolution'); // Now send progress with callerId while established via CallManager (Mobius event)
|
|
1225
|
+
mobiusProgressEvent = {
|
|
1226
|
+
id: 'evt1',
|
|
1227
|
+
timestamp: (0, _now.default)(),
|
|
1228
|
+
trackingId: 'track-1',
|
|
1229
|
+
data: {
|
|
1230
|
+
eventType: _types5.MobiusEventType.CALL_PROGRESS,
|
|
1231
|
+
callerId: {
|
|
1232
|
+
from: '"Bob Marley" <sip:5010@207.182.171.130;user=phone>;tag=888068389-1654853820619-'
|
|
1233
|
+
},
|
|
1234
|
+
callProgressData: {
|
|
1235
|
+
inbandMedia: true,
|
|
1236
|
+
alerting: false
|
|
1237
|
+
},
|
|
1238
|
+
callId: call.getCallId(),
|
|
1239
|
+
callUrl: 'https://mobius.example/call',
|
|
1240
|
+
deviceId: deviceId,
|
|
1241
|
+
correlationId: call.getCorrelationId()
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
callManager['dequeueWsEvents'](mobiusProgressEvent);
|
|
1245
|
+
|
|
1246
|
+
// CallerId resolution should be triggered exactly once (handled by CallManager)
|
|
1247
|
+
expect(startCallerIdSpy).toBeCalledOnceWith(mobiusProgressEvent.data.callerId);
|
|
1248
|
+
// Since it returns early in established state, PROGRESS event should not be emitted here
|
|
1249
|
+
expect(emitSpy.mock.calls.find(function (args) {
|
|
1250
|
+
return args && args[0] === _types2.CALL_EVENT_KEYS.PROGRESS;
|
|
1251
|
+
})).toBeUndefined();
|
|
1252
|
+
expect(call['callStateMachine'].state.value).not.toBe('S_RECV_CALL_PROGRESS');
|
|
1253
|
+
// Early media flag should not be set due to early return
|
|
1254
|
+
expect(call.earlyMedia).not.toBe(true);
|
|
1255
|
+
case 1:
|
|
1256
|
+
case "end":
|
|
1257
|
+
return _context21.stop();
|
|
1258
|
+
}
|
|
1259
|
+
}, _callee21);
|
|
1260
|
+
})));
|
|
1261
|
+
it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
1000
1262
|
var warnSpy, errorSpy, stateMachineSpy, statusPayload, roapMessage;
|
|
1001
|
-
return _regenerator.default.wrap(function
|
|
1002
|
-
while (1) switch (
|
|
1263
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
1264
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1003
1265
|
case 0:
|
|
1004
1266
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1005
1267
|
errorSpy = jest.spyOn(_Logger.default, 'error');
|
|
@@ -1026,25 +1288,25 @@ describe('State Machine handler tests', function () {
|
|
|
1026
1288
|
webex.request.mockRejectedValueOnce({
|
|
1027
1289
|
statusCode: 403
|
|
1028
1290
|
}).mockResolvedValue(statusPayload);
|
|
1029
|
-
|
|
1291
|
+
_context22.next = 1;
|
|
1030
1292
|
return call['handleOutgoingCallConnect']({
|
|
1031
1293
|
type: 'E_SEND_CALL_CONNECT'
|
|
1032
1294
|
});
|
|
1033
|
-
case
|
|
1295
|
+
case 1:
|
|
1034
1296
|
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
1035
1297
|
expect(stateMachineSpy).toBeCalledTimes(3);
|
|
1036
1298
|
expect(warnSpy).toBeCalledTimes(3);
|
|
1037
1299
|
expect(errorSpy).toBeCalledTimes(1);
|
|
1038
|
-
case
|
|
1300
|
+
case 2:
|
|
1039
1301
|
case "end":
|
|
1040
|
-
return
|
|
1302
|
+
return _context22.stop();
|
|
1041
1303
|
}
|
|
1042
|
-
},
|
|
1304
|
+
}, _callee22);
|
|
1043
1305
|
})));
|
|
1044
|
-
it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1306
|
+
it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1045
1307
|
var statusPayload, dummyEvent, postMediaSpy, logSpy, dummyOkEvent;
|
|
1046
|
-
return _regenerator.default.wrap(function
|
|
1047
|
-
while (1) switch (
|
|
1308
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
1309
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1048
1310
|
case 0:
|
|
1049
1311
|
statusPayload = {
|
|
1050
1312
|
statusCode: 200,
|
|
@@ -1118,16 +1380,16 @@ describe('State Machine handler tests', function () {
|
|
|
1118
1380
|
type: 'E_SEND_CALL_DISCONNECT'
|
|
1119
1381
|
});
|
|
1120
1382
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
|
|
1121
|
-
case
|
|
1383
|
+
case 1:
|
|
1122
1384
|
case "end":
|
|
1123
|
-
return
|
|
1385
|
+
return _context23.stop();
|
|
1124
1386
|
}
|
|
1125
|
-
},
|
|
1387
|
+
}, _callee23);
|
|
1126
1388
|
})));
|
|
1127
|
-
it('outgoing call where we receive connect directly after setup. Media established before connect. test call and media state changes', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1389
|
+
it('outgoing call where we receive connect directly after setup. Media established before connect. test call and media state changes', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1128
1390
|
var statusPayload, dummySetupEvent, dummyConnectEvent, dummyOfferEvent, dummyAnswerEvent, dummyOkEvent, postMediaSpy;
|
|
1129
|
-
return _regenerator.default.wrap(function
|
|
1130
|
-
while (1) switch (
|
|
1391
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
1392
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1131
1393
|
case 0:
|
|
1132
1394
|
statusPayload = {
|
|
1133
1395
|
statusCode: 200,
|
|
@@ -1193,16 +1455,16 @@ describe('State Machine handler tests', function () {
|
|
|
1193
1455
|
type: 'E_SEND_CALL_DISCONNECT'
|
|
1194
1456
|
});
|
|
1195
1457
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
|
|
1196
|
-
case
|
|
1458
|
+
case 1:
|
|
1197
1459
|
case "end":
|
|
1198
|
-
return
|
|
1460
|
+
return _context24.stop();
|
|
1199
1461
|
}
|
|
1200
|
-
},
|
|
1462
|
+
}, _callee24);
|
|
1201
1463
|
})));
|
|
1202
|
-
it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1464
|
+
it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
1203
1465
|
var statusPayload, dummyEvent;
|
|
1204
|
-
return _regenerator.default.wrap(function
|
|
1205
|
-
while (1) switch (
|
|
1466
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
1467
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1206
1468
|
case 0:
|
|
1207
1469
|
statusPayload = {
|
|
1208
1470
|
statusCode: 200,
|
|
@@ -1239,16 +1501,16 @@ describe('State Machine handler tests', function () {
|
|
|
1239
1501
|
type: 'E_RECV_CALL_DISCONNECT'
|
|
1240
1502
|
});
|
|
1241
1503
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
1242
|
-
case
|
|
1504
|
+
case 1:
|
|
1243
1505
|
case "end":
|
|
1244
|
-
return
|
|
1506
|
+
return _context25.stop();
|
|
1245
1507
|
}
|
|
1246
|
-
},
|
|
1508
|
+
}, _callee25);
|
|
1247
1509
|
})));
|
|
1248
|
-
it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1510
|
+
it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
1249
1511
|
var statusPayload, dummyEvent, errorSpy;
|
|
1250
|
-
return _regenerator.default.wrap(function
|
|
1251
|
-
while (1) switch (
|
|
1512
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
1513
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1252
1514
|
case 0:
|
|
1253
1515
|
statusPayload = {
|
|
1254
1516
|
statusCode: 403,
|
|
@@ -1265,25 +1527,25 @@ describe('State Machine handler tests', function () {
|
|
|
1265
1527
|
webex.request.mockRejectedValueOnce(statusPayload);
|
|
1266
1528
|
errorSpy = jest.spyOn(_Logger.default, 'error');
|
|
1267
1529
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1268
|
-
|
|
1530
|
+
_context26.next = 1;
|
|
1269
1531
|
return (0, _testUtil.flushPromises)(3);
|
|
1270
|
-
case
|
|
1532
|
+
case 1:
|
|
1271
1533
|
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
1272
1534
|
expect(errorSpy).toHaveBeenCalled();
|
|
1273
1535
|
expect(uploadLogsSpy).toHaveBeenCalledWith({
|
|
1274
1536
|
correlationId: call.getCorrelationId(),
|
|
1275
1537
|
callId: call.getCallId()
|
|
1276
1538
|
});
|
|
1277
|
-
case
|
|
1539
|
+
case 2:
|
|
1278
1540
|
case "end":
|
|
1279
|
-
return
|
|
1541
|
+
return _context26.stop();
|
|
1280
1542
|
}
|
|
1281
|
-
},
|
|
1543
|
+
}, _callee26);
|
|
1282
1544
|
})));
|
|
1283
|
-
it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1545
|
+
it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
1284
1546
|
var statusPayload, dummyEvent, warnSpy;
|
|
1285
|
-
return _regenerator.default.wrap(function
|
|
1286
|
-
while (1) switch (
|
|
1547
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
1548
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1287
1549
|
case 0:
|
|
1288
1550
|
statusPayload = {
|
|
1289
1551
|
statusCode: 403,
|
|
@@ -1302,33 +1564,33 @@ describe('State Machine handler tests', function () {
|
|
|
1302
1564
|
webex.request.mockRejectedValue(statusPayload);
|
|
1303
1565
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1304
1566
|
jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
|
|
1305
|
-
|
|
1567
|
+
_context27.next = 1;
|
|
1306
1568
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1307
|
-
case
|
|
1308
|
-
|
|
1569
|
+
case 1:
|
|
1570
|
+
_context27.next = 2;
|
|
1309
1571
|
return (0, _testUtil.flushPromises)(2);
|
|
1310
|
-
case
|
|
1572
|
+
case 2:
|
|
1311
1573
|
expect(call.isConnected()).toBe(false);
|
|
1312
|
-
expect(call['mediaStateMachine'].state.value).toBe('
|
|
1313
|
-
expect(call['callStateMachine'].state.value).toBe('
|
|
1574
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
|
|
1575
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
|
|
1314
1576
|
expect(warnSpy).toHaveBeenCalledWith('Failed to process MediaOk request', {
|
|
1315
1577
|
file: 'call',
|
|
1316
1578
|
method: 'handleRoapEstablished'
|
|
1317
1579
|
});
|
|
1318
|
-
expect(
|
|
1319
|
-
|
|
1320
|
-
|
|
1580
|
+
expect(warnSpy).toHaveBeenCalledWith('Call failed due to media issue', {
|
|
1581
|
+
file: 'call',
|
|
1582
|
+
method: 'handleRoapError'
|
|
1321
1583
|
});
|
|
1322
|
-
case
|
|
1584
|
+
case 3:
|
|
1323
1585
|
case "end":
|
|
1324
|
-
return
|
|
1586
|
+
return _context27.stop();
|
|
1325
1587
|
}
|
|
1326
|
-
},
|
|
1588
|
+
}, _callee27);
|
|
1327
1589
|
})));
|
|
1328
|
-
it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1590
|
+
it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
1329
1591
|
var statusPayload, dummyEvent;
|
|
1330
|
-
return _regenerator.default.wrap(function
|
|
1331
|
-
while (1) switch (
|
|
1592
|
+
return _regenerator.default.wrap(function (_context28) {
|
|
1593
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1332
1594
|
case 0:
|
|
1333
1595
|
statusPayload = {
|
|
1334
1596
|
statusCode: 403,
|
|
@@ -1349,16 +1611,16 @@ describe('State Machine handler tests', function () {
|
|
|
1349
1611
|
and an initiateOffer request to be sent to SDK only once */
|
|
1350
1612
|
expect(call['mediaStateMachine'].state.value).toBe('S_SEND_ROAP_OFFER');
|
|
1351
1613
|
expect(_testUtil.mediaConnection.initiateOffer).toBeCalledOnceWith();
|
|
1352
|
-
case
|
|
1614
|
+
case 1:
|
|
1353
1615
|
case "end":
|
|
1354
|
-
return
|
|
1616
|
+
return _context28.stop();
|
|
1355
1617
|
}
|
|
1356
|
-
},
|
|
1618
|
+
}, _callee28);
|
|
1357
1619
|
})));
|
|
1358
|
-
it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1620
|
+
it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
1359
1621
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1360
|
-
return _regenerator.default.wrap(function
|
|
1361
|
-
while (1) switch (
|
|
1622
|
+
return _regenerator.default.wrap(function (_context29) {
|
|
1623
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1362
1624
|
case 0:
|
|
1363
1625
|
statusPayload = {
|
|
1364
1626
|
statusCode: 503,
|
|
@@ -1380,9 +1642,9 @@ describe('State Machine handler tests', function () {
|
|
|
1380
1642
|
}
|
|
1381
1643
|
};
|
|
1382
1644
|
call['connected'] = true;
|
|
1383
|
-
|
|
1645
|
+
_context29.next = 1;
|
|
1384
1646
|
return call['handleOutgoingRoapOffer']({}, dummyEvent);
|
|
1385
|
-
case
|
|
1647
|
+
case 1:
|
|
1386
1648
|
jest.advanceTimersByTime(1005);
|
|
1387
1649
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
1388
1650
|
expect(funcSpy).toHaveBeenCalledWith(dummyEvent.data);
|
|
@@ -1390,16 +1652,16 @@ describe('State Machine handler tests', function () {
|
|
|
1390
1652
|
/* first failure , and second because of retry-after */
|
|
1391
1653
|
expect(funcSpy).toHaveBeenCalledTimes(2);
|
|
1392
1654
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
1393
|
-
case
|
|
1655
|
+
case 2:
|
|
1394
1656
|
case "end":
|
|
1395
|
-
return
|
|
1657
|
+
return _context29.stop();
|
|
1396
1658
|
}
|
|
1397
|
-
},
|
|
1659
|
+
}, _callee29);
|
|
1398
1660
|
})));
|
|
1399
|
-
it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1661
|
+
it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
1400
1662
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1401
|
-
return _regenerator.default.wrap(function
|
|
1402
|
-
while (1) switch (
|
|
1663
|
+
return _regenerator.default.wrap(function (_context30) {
|
|
1664
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1403
1665
|
case 0:
|
|
1404
1666
|
statusPayload = {
|
|
1405
1667
|
statusCode: 503,
|
|
@@ -1421,25 +1683,25 @@ describe('State Machine handler tests', function () {
|
|
|
1421
1683
|
}
|
|
1422
1684
|
};
|
|
1423
1685
|
call['connected'] = false;
|
|
1424
|
-
|
|
1686
|
+
_context30.next = 1;
|
|
1425
1687
|
return call['handleOutgoingRoapOffer']({}, dummyEvent);
|
|
1426
|
-
case
|
|
1688
|
+
case 1:
|
|
1427
1689
|
jest.advanceTimersByTime(1005);
|
|
1428
1690
|
expect(funcSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1429
1691
|
|
|
1430
1692
|
/* These shouldn't be called as call is not connected yet */
|
|
1431
1693
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
1432
1694
|
expect(stateMachineSpy).not.toBeCalled();
|
|
1433
|
-
case
|
|
1695
|
+
case 2:
|
|
1434
1696
|
case "end":
|
|
1435
|
-
return
|
|
1697
|
+
return _context30.stop();
|
|
1436
1698
|
}
|
|
1437
|
-
},
|
|
1699
|
+
}, _callee30);
|
|
1438
1700
|
})));
|
|
1439
|
-
it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1701
|
+
it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
1440
1702
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1441
|
-
return _regenerator.default.wrap(function
|
|
1442
|
-
while (1) switch (
|
|
1703
|
+
return _regenerator.default.wrap(function (_context31) {
|
|
1704
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1443
1705
|
case 0:
|
|
1444
1706
|
statusPayload = {
|
|
1445
1707
|
statusCode: 503,
|
|
@@ -1461,9 +1723,9 @@ describe('State Machine handler tests', function () {
|
|
|
1461
1723
|
};
|
|
1462
1724
|
call['connected'] = true;
|
|
1463
1725
|
call['mediaStateMachine'].state.value = 'S_RECV_ROAP_OFFER';
|
|
1464
|
-
|
|
1726
|
+
_context31.next = 1;
|
|
1465
1727
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
1466
|
-
case
|
|
1728
|
+
case 1:
|
|
1467
1729
|
jest.advanceTimersByTime(1005);
|
|
1468
1730
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
1469
1731
|
expect(funcSpy).toHaveBeenCalledWith(dummyEvent.data);
|
|
@@ -1471,16 +1733,16 @@ describe('State Machine handler tests', function () {
|
|
|
1471
1733
|
/* first failure , and second because of retry-after */
|
|
1472
1734
|
expect(funcSpy).toHaveBeenCalledTimes(2);
|
|
1473
1735
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
1474
|
-
case
|
|
1736
|
+
case 2:
|
|
1475
1737
|
case "end":
|
|
1476
|
-
return
|
|
1738
|
+
return _context31.stop();
|
|
1477
1739
|
}
|
|
1478
|
-
},
|
|
1740
|
+
}, _callee31);
|
|
1479
1741
|
})));
|
|
1480
|
-
it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1742
|
+
it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
|
|
1481
1743
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1482
|
-
return _regenerator.default.wrap(function
|
|
1483
|
-
while (1) switch (
|
|
1744
|
+
return _regenerator.default.wrap(function (_context32) {
|
|
1745
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1484
1746
|
case 0:
|
|
1485
1747
|
statusPayload = {
|
|
1486
1748
|
statusCode: 503,
|
|
@@ -1501,9 +1763,9 @@ describe('State Machine handler tests', function () {
|
|
|
1501
1763
|
}
|
|
1502
1764
|
};
|
|
1503
1765
|
call['connected'] = false;
|
|
1504
|
-
|
|
1766
|
+
_context32.next = 1;
|
|
1505
1767
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
1506
|
-
case
|
|
1768
|
+
case 1:
|
|
1507
1769
|
jest.advanceTimersByTime(1005);
|
|
1508
1770
|
expect(funcSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1509
1771
|
expect(funcSpy).toHaveBeenCalledTimes(1);
|
|
@@ -1511,16 +1773,16 @@ describe('State Machine handler tests', function () {
|
|
|
1511
1773
|
/* These shouldn't be called as call is not connected yet */
|
|
1512
1774
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
1513
1775
|
expect(stateMachineSpy).not.toBeCalled();
|
|
1514
|
-
case
|
|
1776
|
+
case 2:
|
|
1515
1777
|
case "end":
|
|
1516
|
-
return
|
|
1778
|
+
return _context32.stop();
|
|
1517
1779
|
}
|
|
1518
|
-
},
|
|
1780
|
+
}, _callee32);
|
|
1519
1781
|
})));
|
|
1520
|
-
it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1782
|
+
it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
|
|
1521
1783
|
var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
|
|
1522
|
-
return _regenerator.default.wrap(function
|
|
1523
|
-
while (1) switch (
|
|
1784
|
+
return _regenerator.default.wrap(function (_context33) {
|
|
1785
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1524
1786
|
case 0:
|
|
1525
1787
|
statusPayload = {
|
|
1526
1788
|
statusCode: 200,
|
|
@@ -1543,16 +1805,16 @@ describe('State Machine handler tests', function () {
|
|
|
1543
1805
|
expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
|
|
1544
1806
|
expect(warnSpy).not.toHaveBeenCalled();
|
|
1545
1807
|
expect(stateMachineSpy).not.toHaveBeenCalled();
|
|
1546
|
-
case
|
|
1808
|
+
case 1:
|
|
1547
1809
|
case "end":
|
|
1548
|
-
return
|
|
1810
|
+
return _context33.stop();
|
|
1549
1811
|
}
|
|
1550
|
-
},
|
|
1812
|
+
}, _callee33);
|
|
1551
1813
|
})));
|
|
1552
|
-
it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1814
|
+
it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
|
|
1553
1815
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1554
|
-
return _regenerator.default.wrap(function
|
|
1555
|
-
while (1) switch (
|
|
1816
|
+
return _regenerator.default.wrap(function (_context34) {
|
|
1817
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1556
1818
|
case 0:
|
|
1557
1819
|
statusPayload = {
|
|
1558
1820
|
statusCode: 503,
|
|
@@ -1574,9 +1836,9 @@ describe('State Machine handler tests', function () {
|
|
|
1574
1836
|
};
|
|
1575
1837
|
call['connected'] = true;
|
|
1576
1838
|
call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
|
|
1577
|
-
|
|
1839
|
+
_context34.next = 1;
|
|
1578
1840
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1579
|
-
case
|
|
1841
|
+
case 1:
|
|
1580
1842
|
jest.advanceTimersByTime(1005);
|
|
1581
1843
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
1582
1844
|
expect(funcSpy).toHaveBeenCalled();
|
|
@@ -1584,16 +1846,16 @@ describe('State Machine handler tests', function () {
|
|
|
1584
1846
|
/* first failure , and second because of retry-after */
|
|
1585
1847
|
expect(funcSpy).toHaveBeenCalledTimes(2);
|
|
1586
1848
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
1587
|
-
case
|
|
1849
|
+
case 2:
|
|
1588
1850
|
case "end":
|
|
1589
|
-
return
|
|
1851
|
+
return _context34.stop();
|
|
1590
1852
|
}
|
|
1591
|
-
},
|
|
1853
|
+
}, _callee34);
|
|
1592
1854
|
})));
|
|
1593
|
-
it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1855
|
+
it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
|
|
1594
1856
|
var statusPayload, stateMachineSpy, funcSpy, errorEvent;
|
|
1595
|
-
return _regenerator.default.wrap(function
|
|
1596
|
-
while (1) switch (
|
|
1857
|
+
return _regenerator.default.wrap(function (_context35) {
|
|
1858
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1597
1859
|
case 0:
|
|
1598
1860
|
statusPayload = {
|
|
1599
1861
|
statusCode: 403,
|
|
@@ -1614,16 +1876,16 @@ describe('State Machine handler tests', function () {
|
|
|
1614
1876
|
call.sendMediaStateMachineEvt(errorEvent);
|
|
1615
1877
|
expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
|
|
1616
1878
|
expect(stateMachineSpy).not.toHaveBeenCalled();
|
|
1617
|
-
case
|
|
1879
|
+
case 1:
|
|
1618
1880
|
case "end":
|
|
1619
|
-
return
|
|
1881
|
+
return _context35.stop();
|
|
1620
1882
|
}
|
|
1621
|
-
},
|
|
1883
|
+
}, _callee35);
|
|
1622
1884
|
})));
|
|
1623
|
-
it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1885
|
+
it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
|
|
1624
1886
|
var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
|
|
1625
|
-
return _regenerator.default.wrap(function
|
|
1626
|
-
while (1) switch (
|
|
1887
|
+
return _regenerator.default.wrap(function (_context36) {
|
|
1888
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1627
1889
|
case 0:
|
|
1628
1890
|
statusPayload = {
|
|
1629
1891
|
statusCode: 200,
|
|
@@ -1641,9 +1903,9 @@ describe('State Machine handler tests', function () {
|
|
|
1641
1903
|
}
|
|
1642
1904
|
};
|
|
1643
1905
|
call['connected'] = false;
|
|
1644
|
-
|
|
1906
|
+
_context36.next = 1;
|
|
1645
1907
|
return call['handleRoapError']({}, errorEvent);
|
|
1646
|
-
case
|
|
1908
|
+
case 1:
|
|
1647
1909
|
expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
|
|
1648
1910
|
expect(warnSpy).toBeCalledOnceWith('Call failed due to media issue', {
|
|
1649
1911
|
file: 'call',
|
|
@@ -1655,16 +1917,82 @@ describe('State Machine handler tests', function () {
|
|
|
1655
1917
|
},
|
|
1656
1918
|
type: 'E_UNKNOWN'
|
|
1657
1919
|
});
|
|
1658
|
-
case
|
|
1920
|
+
case 2:
|
|
1659
1921
|
case "end":
|
|
1660
|
-
return
|
|
1922
|
+
return _context36.stop();
|
|
1661
1923
|
}
|
|
1662
|
-
},
|
|
1924
|
+
}, _callee36);
|
|
1663
1925
|
})));
|
|
1664
|
-
it('
|
|
1926
|
+
it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
|
|
1927
|
+
var statusPayload, warnSpy, postMediaSpy, setupEvent, connectEvent, offerEvent, answerEvent;
|
|
1928
|
+
return _regenerator.default.wrap(function (_context37) {
|
|
1929
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1930
|
+
case 0:
|
|
1931
|
+
statusPayload = {
|
|
1932
|
+
statusCode: 403,
|
|
1933
|
+
body: mockStatusBody
|
|
1934
|
+
};
|
|
1935
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1936
|
+
postMediaSpy = jest.spyOn(call, 'postMedia').mockRejectedValueOnce(statusPayload); // Simulate inbound call flow
|
|
1937
|
+
call['direction'] = _types3.CallDirection.INBOUND;
|
|
1938
|
+
setupEvent = {
|
|
1939
|
+
type: 'E_RECV_CALL_SETUP',
|
|
1940
|
+
data: {
|
|
1941
|
+
seq: 1,
|
|
1942
|
+
messageType: 'OFFER'
|
|
1943
|
+
}
|
|
1944
|
+
};
|
|
1945
|
+
call.sendCallStateMachineEvt(setupEvent);
|
|
1946
|
+
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
|
|
1947
|
+
connectEvent = {
|
|
1948
|
+
type: 'E_SEND_CALL_CONNECT'
|
|
1949
|
+
};
|
|
1950
|
+
call.sendCallStateMachineEvt(connectEvent);
|
|
1951
|
+
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
|
|
1952
|
+
offerEvent = {
|
|
1953
|
+
type: 'E_RECV_ROAP_OFFER',
|
|
1954
|
+
data: {
|
|
1955
|
+
seq: 1,
|
|
1956
|
+
messageType: 'OFFER'
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1959
|
+
call.sendMediaStateMachineEvt(offerEvent);
|
|
1960
|
+
answerEvent = {
|
|
1961
|
+
type: 'E_SEND_ROAP_ANSWER',
|
|
1962
|
+
data: {
|
|
1963
|
+
seq: 1,
|
|
1964
|
+
messageType: 'ANSWER'
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
1967
|
+
_context37.next = 1;
|
|
1968
|
+
return call.sendMediaStateMachineEvt(answerEvent);
|
|
1969
|
+
case 1:
|
|
1970
|
+
_context37.next = 2;
|
|
1971
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1972
|
+
case 2:
|
|
1973
|
+
expect(postMediaSpy).toBeCalledOnceWith(answerEvent.data);
|
|
1974
|
+
expect(warnSpy).toHaveBeenCalledWith('Failed to send MediaAnswer request', {
|
|
1975
|
+
file: 'call',
|
|
1976
|
+
method: 'handleOutgoingRoapAnswer'
|
|
1977
|
+
});
|
|
1978
|
+
expect(warnSpy).toHaveBeenCalledWith('Call failed due to media issue', {
|
|
1979
|
+
file: 'call',
|
|
1980
|
+
method: 'handleRoapError'
|
|
1981
|
+
});
|
|
1982
|
+
|
|
1983
|
+
// Final state should be torn down and cleared for unconnected call
|
|
1984
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
|
|
1985
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
|
|
1986
|
+
case 3:
|
|
1987
|
+
case "end":
|
|
1988
|
+
return _context37.stop();
|
|
1989
|
+
}
|
|
1990
|
+
}, _callee37);
|
|
1991
|
+
})));
|
|
1992
|
+
it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
|
|
1665
1993
|
var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
|
|
1666
|
-
return _regenerator.default.wrap(function
|
|
1667
|
-
while (1) switch (
|
|
1994
|
+
return _regenerator.default.wrap(function (_context38) {
|
|
1995
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1668
1996
|
case 0:
|
|
1669
1997
|
statusPayload = {
|
|
1670
1998
|
statusCode: 200,
|
|
@@ -1697,9 +2025,9 @@ describe('State Machine handler tests', function () {
|
|
|
1697
2025
|
seq: 1,
|
|
1698
2026
|
messageType: 'ANSWER'
|
|
1699
2027
|
};
|
|
1700
|
-
|
|
2028
|
+
_context38.next = 1;
|
|
1701
2029
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1702
|
-
case
|
|
2030
|
+
case 1:
|
|
1703
2031
|
expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1704
2032
|
|
|
1705
2033
|
/* we receive roap Offer Request followed by roap Ok from mobius and handle
|
|
@@ -1719,9 +2047,9 @@ describe('State Machine handler tests', function () {
|
|
|
1719
2047
|
seq: 2,
|
|
1720
2048
|
messageType: 'OFFER_REQUEST'
|
|
1721
2049
|
};
|
|
1722
|
-
|
|
2050
|
+
_context38.next = 2;
|
|
1723
2051
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1724
|
-
case
|
|
2052
|
+
case 2:
|
|
1725
2053
|
expect(call['receivedRoapOKSeq']).toBe(0);
|
|
1726
2054
|
expect(_testUtil.mediaConnection.roapMessageReceived).not.toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1727
2055
|
call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
@@ -1769,18 +2097,18 @@ describe('State Machine handler tests', function () {
|
|
|
1769
2097
|
};
|
|
1770
2098
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1771
2099
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1772
|
-
|
|
2100
|
+
_context38.next = 3;
|
|
1773
2101
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1774
|
-
case
|
|
2102
|
+
case 3:
|
|
1775
2103
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1776
2104
|
dummyEvent.type = 'E_SEND_ROAP_ANSWER';
|
|
1777
2105
|
dummyEvent.data = {
|
|
1778
2106
|
seq: 3,
|
|
1779
2107
|
messageType: 'ANSWER'
|
|
1780
2108
|
};
|
|
1781
|
-
|
|
2109
|
+
_context38.next = 4;
|
|
1782
2110
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1783
|
-
case
|
|
2111
|
+
case 4:
|
|
1784
2112
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1785
2113
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1786
2114
|
dummyEvent.data = {
|
|
@@ -1797,9 +2125,9 @@ describe('State Machine handler tests', function () {
|
|
|
1797
2125
|
messageType: 'OK'
|
|
1798
2126
|
}
|
|
1799
2127
|
};
|
|
1800
|
-
|
|
2128
|
+
_context38.next = 5;
|
|
1801
2129
|
return call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
1802
|
-
case
|
|
2130
|
+
case 5:
|
|
1803
2131
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
|
|
1804
2132
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1805
2133
|
dummyEvent.type = 'E_SEND_ROAP_ANSWER';
|
|
@@ -1810,16 +2138,16 @@ describe('State Machine handler tests', function () {
|
|
|
1810
2138
|
expect(call['mediaStateMachine'].state.value).toBe('S_RECV_ROAP_OFFER');
|
|
1811
2139
|
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1812
2140
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1813
|
-
case
|
|
2141
|
+
case 6:
|
|
1814
2142
|
case "end":
|
|
1815
|
-
return
|
|
2143
|
+
return _context38.stop();
|
|
1816
2144
|
}
|
|
1817
|
-
},
|
|
2145
|
+
}, _callee38);
|
|
1818
2146
|
})));
|
|
1819
|
-
it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2147
|
+
it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
|
|
1820
2148
|
var mockStatusBody, statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
|
|
1821
|
-
return _regenerator.default.wrap(function
|
|
1822
|
-
while (1) switch (
|
|
2149
|
+
return _regenerator.default.wrap(function (_context39) {
|
|
2150
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1823
2151
|
case 0:
|
|
1824
2152
|
mockStatusBody = {
|
|
1825
2153
|
device: {
|
|
@@ -1859,9 +2187,9 @@ describe('State Machine handler tests', function () {
|
|
|
1859
2187
|
seq: 1,
|
|
1860
2188
|
messageType: 'ANSWER'
|
|
1861
2189
|
};
|
|
1862
|
-
|
|
2190
|
+
_context39.next = 1;
|
|
1863
2191
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1864
|
-
case
|
|
2192
|
+
case 1:
|
|
1865
2193
|
expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1866
2194
|
|
|
1867
2195
|
/* we receive roap Offer Request followed by roap Ok from mobius and handle
|
|
@@ -1881,9 +2209,9 @@ describe('State Machine handler tests', function () {
|
|
|
1881
2209
|
seq: 2,
|
|
1882
2210
|
messageType: 'OFFER_REQUEST'
|
|
1883
2211
|
};
|
|
1884
|
-
|
|
2212
|
+
_context39.next = 2;
|
|
1885
2213
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1886
|
-
case
|
|
2214
|
+
case 2:
|
|
1887
2215
|
expect(call['receivedRoapOKSeq']).toBe(0);
|
|
1888
2216
|
expect(_testUtil.mediaConnection.roapMessageReceived).not.toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1889
2217
|
call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
@@ -1931,18 +2259,18 @@ describe('State Machine handler tests', function () {
|
|
|
1931
2259
|
};
|
|
1932
2260
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1933
2261
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1934
|
-
|
|
2262
|
+
_context39.next = 3;
|
|
1935
2263
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1936
|
-
case
|
|
2264
|
+
case 3:
|
|
1937
2265
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1938
2266
|
dummyEvent.type = 'E_SEND_ROAP_ANSWER';
|
|
1939
2267
|
dummyEvent.data = {
|
|
1940
2268
|
seq: 3,
|
|
1941
2269
|
messageType: 'ANSWER'
|
|
1942
2270
|
};
|
|
1943
|
-
|
|
2271
|
+
_context39.next = 4;
|
|
1944
2272
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1945
|
-
case
|
|
2273
|
+
case 4:
|
|
1946
2274
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1947
2275
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1948
2276
|
dummyEvent.data = {
|
|
@@ -1957,9 +2285,9 @@ describe('State Machine handler tests', function () {
|
|
|
1957
2285
|
}
|
|
1958
2286
|
};
|
|
1959
2287
|
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1960
|
-
|
|
2288
|
+
_context39.next = 5;
|
|
1961
2289
|
return call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
1962
|
-
case
|
|
2290
|
+
case 5:
|
|
1963
2291
|
expect(call['receivedRoapOKSeq']).toBe(3);
|
|
1964
2292
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
|
|
1965
2293
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
@@ -1971,16 +2299,16 @@ describe('State Machine handler tests', function () {
|
|
|
1971
2299
|
expect(call['mediaStateMachine'].state.value).toBe('S_RECV_ROAP_OFFER');
|
|
1972
2300
|
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1973
2301
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1974
|
-
case
|
|
2302
|
+
case 6:
|
|
1975
2303
|
case "end":
|
|
1976
|
-
return
|
|
2304
|
+
return _context39.stop();
|
|
1977
2305
|
}
|
|
1978
|
-
},
|
|
2306
|
+
}, _callee39);
|
|
1979
2307
|
})));
|
|
1980
|
-
it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2308
|
+
it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
|
|
1981
2309
|
var statusPayload, dummyEvent, postMediaSpy, infoSpy, dummyOkEvent;
|
|
1982
|
-
return _regenerator.default.wrap(function
|
|
1983
|
-
while (1) switch (
|
|
2310
|
+
return _regenerator.default.wrap(function (_context40) {
|
|
2311
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1984
2312
|
case 0:
|
|
1985
2313
|
statusPayload = {
|
|
1986
2314
|
statusCode: 200,
|
|
@@ -2045,11 +2373,35 @@ describe('State Machine handler tests', function () {
|
|
|
2045
2373
|
file: 'call',
|
|
2046
2374
|
method: 'handleCallHold'
|
|
2047
2375
|
});
|
|
2048
|
-
case
|
|
2376
|
+
case 1:
|
|
2049
2377
|
case "end":
|
|
2050
|
-
return
|
|
2378
|
+
return _context40.stop();
|
|
2051
2379
|
}
|
|
2052
|
-
},
|
|
2380
|
+
}, _callee40);
|
|
2381
|
+
})));
|
|
2382
|
+
it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
|
|
2383
|
+
var emitSpy, deleteSpy;
|
|
2384
|
+
return _regenerator.default.wrap(function (_context41) {
|
|
2385
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
2386
|
+
case 0:
|
|
2387
|
+
emitSpy = jest.spyOn(call, 'emit');
|
|
2388
|
+
deleteSpy = jest.spyOn(call, 'delete').mockResolvedValue({
|
|
2389
|
+
statusCode: 200
|
|
2390
|
+
});
|
|
2391
|
+
call.sendCallStateMachineEvt({
|
|
2392
|
+
type: 'E_RECV_CALL_DISCONNECT'
|
|
2393
|
+
});
|
|
2394
|
+
_context41.next = 1;
|
|
2395
|
+
return (0, _testUtil.flushPromises)(1);
|
|
2396
|
+
case 1:
|
|
2397
|
+
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
2398
|
+
expect(deleteSpy).toHaveBeenCalled();
|
|
2399
|
+
expect(emitSpy.mock.invocationCallOrder[0]).toBeLessThan(deleteSpy.mock.invocationCallOrder[0]);
|
|
2400
|
+
case 2:
|
|
2401
|
+
case "end":
|
|
2402
|
+
return _context41.stop();
|
|
2403
|
+
}
|
|
2404
|
+
}, _callee41);
|
|
2053
2405
|
})));
|
|
2054
2406
|
describe('Call event timers tests', function () {
|
|
2055
2407
|
var callManager;
|
|
@@ -2060,10 +2412,10 @@ describe('State Machine handler tests', function () {
|
|
|
2060
2412
|
afterEach(function () {
|
|
2061
2413
|
jest.clearAllTimers();
|
|
2062
2414
|
});
|
|
2063
|
-
it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2415
|
+
it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
|
|
2064
2416
|
var statusPayload, dummyEvent, logSpy, emitSpy, deleteSpy, dummyOkEvent;
|
|
2065
|
-
return _regenerator.default.wrap(function
|
|
2066
|
-
while (1) switch (
|
|
2417
|
+
return _regenerator.default.wrap(function (_context42) {
|
|
2418
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
2067
2419
|
case 0:
|
|
2068
2420
|
statusPayload = {
|
|
2069
2421
|
statusCode: 200,
|
|
@@ -2080,9 +2432,9 @@ describe('State Machine handler tests', function () {
|
|
|
2080
2432
|
webex.request.mockReturnValue(statusPayload);
|
|
2081
2433
|
|
|
2082
2434
|
// handleOutgoingCallSetup is asynchronous
|
|
2083
|
-
|
|
2435
|
+
_context42.next = 1;
|
|
2084
2436
|
return call.sendCallStateMachineEvt(dummyEvent);
|
|
2085
|
-
case
|
|
2437
|
+
case 1:
|
|
2086
2438
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
|
|
2087
2439
|
dummyEvent.type = 'E_RECV_CALL_PROGRESS';
|
|
2088
2440
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
@@ -2121,16 +2473,16 @@ describe('State Machine handler tests', function () {
|
|
|
2121
2473
|
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
2122
2474
|
expect(deleteSpy).toHaveBeenCalledTimes(1);
|
|
2123
2475
|
expect(callManager.callCollection).toStrictEqual({});
|
|
2124
|
-
case
|
|
2476
|
+
case 2:
|
|
2125
2477
|
case "end":
|
|
2126
|
-
return
|
|
2478
|
+
return _context42.stop();
|
|
2127
2479
|
}
|
|
2128
|
-
},
|
|
2480
|
+
}, _callee42);
|
|
2129
2481
|
})));
|
|
2130
|
-
it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2482
|
+
it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
|
|
2131
2483
|
var statusPayload, dummyEvent, call, emitSpy, deleteSpy, logSpy;
|
|
2132
|
-
return _regenerator.default.wrap(function
|
|
2133
|
-
while (1) switch (
|
|
2484
|
+
return _regenerator.default.wrap(function (_context43) {
|
|
2485
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
2134
2486
|
case 0:
|
|
2135
2487
|
statusPayload = {
|
|
2136
2488
|
statusCode: 200,
|
|
@@ -2149,9 +2501,9 @@ describe('State Machine handler tests', function () {
|
|
|
2149
2501
|
expect((0, _keys.default)(callManager.callCollection)[0]).toBe(call.getCorrelationId());
|
|
2150
2502
|
|
|
2151
2503
|
// handleOutgoingCallSetup is asynchronous
|
|
2152
|
-
|
|
2504
|
+
_context43.next = 1;
|
|
2153
2505
|
return call.sendCallStateMachineEvt(dummyEvent);
|
|
2154
|
-
case
|
|
2506
|
+
case 1:
|
|
2155
2507
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
|
|
2156
2508
|
logSpy.mockClear();
|
|
2157
2509
|
jest.advanceTimersByTime(10000);
|
|
@@ -2159,11 +2511,11 @@ describe('State Machine handler tests', function () {
|
|
|
2159
2511
|
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
2160
2512
|
expect(deleteSpy).toHaveBeenCalledTimes(1);
|
|
2161
2513
|
expect(callManager.callCollection).toStrictEqual({});
|
|
2162
|
-
case
|
|
2514
|
+
case 2:
|
|
2163
2515
|
case "end":
|
|
2164
|
-
return
|
|
2516
|
+
return _context43.stop();
|
|
2165
2517
|
}
|
|
2166
|
-
},
|
|
2518
|
+
}, _callee43);
|
|
2167
2519
|
})));
|
|
2168
2520
|
});
|
|
2169
2521
|
});
|
|
@@ -2223,10 +2575,10 @@ describe('Supplementary Services tests', function () {
|
|
|
2223
2575
|
beforeEach(function () {
|
|
2224
2576
|
call.removeAllListeners();
|
|
2225
2577
|
});
|
|
2226
|
-
it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2578
|
+
it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
|
|
2227
2579
|
var responsePayload, warnSpy, roapEvent;
|
|
2228
|
-
return _regenerator.default.wrap(function
|
|
2229
|
-
while (1) switch (
|
|
2580
|
+
return _regenerator.default.wrap(function (_context45) {
|
|
2581
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
2230
2582
|
case 0:
|
|
2231
2583
|
expect.assertions(7);
|
|
2232
2584
|
responsePayload = {
|
|
@@ -2239,27 +2591,27 @@ describe('Supplementary Services tests', function () {
|
|
|
2239
2591
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2240
2592
|
call['held'] = false;
|
|
2241
2593
|
call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
|
|
2242
|
-
var
|
|
2243
|
-
return _regenerator.default.wrap(function
|
|
2244
|
-
while (1) switch (
|
|
2594
|
+
var _ref45 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44(correlationId) {
|
|
2595
|
+
return _regenerator.default.wrap(function (_context44) {
|
|
2596
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
2245
2597
|
case 0:
|
|
2246
2598
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2247
2599
|
case 1:
|
|
2248
2600
|
case "end":
|
|
2249
|
-
return
|
|
2601
|
+
return _context44.stop();
|
|
2250
2602
|
}
|
|
2251
|
-
},
|
|
2603
|
+
}, _callee44);
|
|
2252
2604
|
}));
|
|
2253
2605
|
return function (_x) {
|
|
2254
|
-
return
|
|
2606
|
+
return _ref45.apply(this, arguments);
|
|
2255
2607
|
};
|
|
2256
2608
|
}());
|
|
2257
|
-
|
|
2609
|
+
_context45.next = 1;
|
|
2258
2610
|
return call.doHoldResume();
|
|
2259
|
-
case
|
|
2260
|
-
|
|
2611
|
+
case 1:
|
|
2612
|
+
_context45.next = 2;
|
|
2261
2613
|
return (0, _testUtil.flushPromises)(2);
|
|
2262
|
-
case
|
|
2614
|
+
case 2:
|
|
2263
2615
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2264
2616
|
call.handleMidCallEvent(mockHeldEvent);
|
|
2265
2617
|
|
|
@@ -2273,13 +2625,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2273
2625
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2274
2626
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2275
2627
|
roapEvent.data.type = 'ANSWER';
|
|
2276
|
-
|
|
2628
|
+
_context45.next = 3;
|
|
2277
2629
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2278
|
-
case
|
|
2630
|
+
case 3:
|
|
2279
2631
|
roapEvent.data.type = 'OK';
|
|
2280
|
-
|
|
2632
|
+
_context45.next = 4;
|
|
2281
2633
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2282
|
-
case
|
|
2634
|
+
case 4:
|
|
2283
2635
|
expect(clearTimeout).toHaveBeenCalledTimes(1);
|
|
2284
2636
|
/* isHeld flag should be set and an Hold event should be emitted */
|
|
2285
2637
|
expect(call.isHeld()).toStrictEqual(true);
|
|
@@ -2290,16 +2642,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2290
2642
|
file: 'call',
|
|
2291
2643
|
method: 'handleCallHold'
|
|
2292
2644
|
});
|
|
2293
|
-
case
|
|
2645
|
+
case 5:
|
|
2294
2646
|
case "end":
|
|
2295
|
-
return
|
|
2647
|
+
return _context45.stop();
|
|
2296
2648
|
}
|
|
2297
|
-
},
|
|
2649
|
+
}, _callee45);
|
|
2298
2650
|
})));
|
|
2299
|
-
it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2651
|
+
it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
|
|
2300
2652
|
var responsePayload, warnSpy, roapEvent;
|
|
2301
|
-
return _regenerator.default.wrap(function
|
|
2302
|
-
while (1) switch (
|
|
2653
|
+
return _regenerator.default.wrap(function (_context47) {
|
|
2654
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
2303
2655
|
case 0:
|
|
2304
2656
|
expect.assertions(8);
|
|
2305
2657
|
responsePayload = {
|
|
@@ -2312,28 +2664,28 @@ describe('Supplementary Services tests', function () {
|
|
|
2312
2664
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2313
2665
|
call['held'] = false;
|
|
2314
2666
|
call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
|
|
2315
|
-
var
|
|
2316
|
-
return _regenerator.default.wrap(function
|
|
2317
|
-
while (1) switch (
|
|
2667
|
+
var _ref47 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46(correlationId) {
|
|
2668
|
+
return _regenerator.default.wrap(function (_context46) {
|
|
2669
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
2318
2670
|
case 0:
|
|
2319
2671
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2320
2672
|
case 1:
|
|
2321
2673
|
case "end":
|
|
2322
|
-
return
|
|
2674
|
+
return _context46.stop();
|
|
2323
2675
|
}
|
|
2324
|
-
},
|
|
2676
|
+
}, _callee46);
|
|
2325
2677
|
}));
|
|
2326
2678
|
return function (_x2) {
|
|
2327
|
-
return
|
|
2679
|
+
return _ref47.apply(this, arguments);
|
|
2328
2680
|
};
|
|
2329
2681
|
}());
|
|
2330
2682
|
call.doHoldResume();
|
|
2331
|
-
|
|
2683
|
+
_context47.next = 1;
|
|
2332
2684
|
return _promise.default.resolve();
|
|
2333
|
-
case
|
|
2334
|
-
|
|
2685
|
+
case 1:
|
|
2686
|
+
_context47.next = 2;
|
|
2335
2687
|
return _promise.default.resolve();
|
|
2336
|
-
case
|
|
2688
|
+
case 2:
|
|
2337
2689
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
2338
2690
|
call.handleMidCallEvent(mockHeldEvent);
|
|
2339
2691
|
|
|
@@ -2347,13 +2699,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2347
2699
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2348
2700
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2349
2701
|
roapEvent.data.type = 'ANSWER';
|
|
2350
|
-
|
|
2702
|
+
_context47.next = 3;
|
|
2351
2703
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2352
|
-
case
|
|
2704
|
+
case 3:
|
|
2353
2705
|
roapEvent.data.type = 'OK';
|
|
2354
|
-
|
|
2706
|
+
_context47.next = 4;
|
|
2355
2707
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2356
|
-
case
|
|
2708
|
+
case 4:
|
|
2357
2709
|
expect(clearTimeout).not.toHaveBeenCalled();
|
|
2358
2710
|
/* isHeld flag should be set and an Hold event should be emitted */
|
|
2359
2711
|
expect(call.isHeld()).toStrictEqual(true);
|
|
@@ -2364,16 +2716,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2364
2716
|
file: 'call',
|
|
2365
2717
|
method: 'handleCallHold'
|
|
2366
2718
|
});
|
|
2367
|
-
case
|
|
2719
|
+
case 5:
|
|
2368
2720
|
case "end":
|
|
2369
|
-
return
|
|
2721
|
+
return _context47.stop();
|
|
2370
2722
|
}
|
|
2371
|
-
},
|
|
2723
|
+
}, _callee47);
|
|
2372
2724
|
})));
|
|
2373
|
-
it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2725
|
+
it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
|
|
2374
2726
|
var responsePayload;
|
|
2375
|
-
return _regenerator.default.wrap(function
|
|
2376
|
-
while (1) switch (
|
|
2727
|
+
return _regenerator.default.wrap(function (_context49) {
|
|
2728
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
2377
2729
|
case 0:
|
|
2378
2730
|
expect.assertions(4);
|
|
2379
2731
|
responsePayload = {
|
|
@@ -2383,43 +2735,43 @@ describe('Supplementary Services tests', function () {
|
|
|
2383
2735
|
jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
2384
2736
|
call['held'] = false;
|
|
2385
2737
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
2386
|
-
var
|
|
2387
|
-
return _regenerator.default.wrap(function
|
|
2388
|
-
while (1) switch (
|
|
2738
|
+
var _ref49 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48(errObj) {
|
|
2739
|
+
return _regenerator.default.wrap(function (_context48) {
|
|
2740
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
2389
2741
|
case 0:
|
|
2390
2742
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2391
2743
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2392
|
-
case
|
|
2744
|
+
case 1:
|
|
2393
2745
|
case "end":
|
|
2394
|
-
return
|
|
2746
|
+
return _context48.stop();
|
|
2395
2747
|
}
|
|
2396
|
-
},
|
|
2748
|
+
}, _callee48);
|
|
2397
2749
|
}));
|
|
2398
2750
|
return function (_x3) {
|
|
2399
|
-
return
|
|
2751
|
+
return _ref49.apply(this, arguments);
|
|
2400
2752
|
};
|
|
2401
2753
|
}());
|
|
2402
|
-
|
|
2754
|
+
_context49.next = 1;
|
|
2403
2755
|
return call.doHoldResume();
|
|
2404
|
-
case
|
|
2405
|
-
|
|
2756
|
+
case 1:
|
|
2757
|
+
_context49.next = 2;
|
|
2406
2758
|
return (0, _testUtil.flushPromises)(2);
|
|
2407
|
-
case
|
|
2759
|
+
case 2:
|
|
2408
2760
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2409
2761
|
|
|
2410
2762
|
/* At this point , the Call State should transition to S_CALL_ESTABLISHED
|
|
2411
2763
|
*/
|
|
2412
2764
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2413
|
-
case
|
|
2765
|
+
case 3:
|
|
2414
2766
|
case "end":
|
|
2415
|
-
return
|
|
2767
|
+
return _context49.stop();
|
|
2416
2768
|
}
|
|
2417
|
-
},
|
|
2769
|
+
}, _callee49);
|
|
2418
2770
|
})));
|
|
2419
|
-
it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2771
|
+
it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
|
|
2420
2772
|
var responsePayload, rejectPayload, roapEvent;
|
|
2421
|
-
return _regenerator.default.wrap(function
|
|
2422
|
-
while (1) switch (
|
|
2773
|
+
return _regenerator.default.wrap(function (_context51) {
|
|
2774
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
2423
2775
|
case 0:
|
|
2424
2776
|
expect.assertions(5);
|
|
2425
2777
|
responsePayload = {
|
|
@@ -2433,26 +2785,26 @@ describe('Supplementary Services tests', function () {
|
|
|
2433
2785
|
jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
|
|
2434
2786
|
call['held'] = false;
|
|
2435
2787
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
2436
|
-
var
|
|
2437
|
-
return _regenerator.default.wrap(function
|
|
2438
|
-
while (1) switch (
|
|
2788
|
+
var _ref51 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50(errObj) {
|
|
2789
|
+
return _regenerator.default.wrap(function (_context50) {
|
|
2790
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
2439
2791
|
case 0:
|
|
2440
2792
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2441
2793
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2442
|
-
case
|
|
2794
|
+
case 1:
|
|
2443
2795
|
case "end":
|
|
2444
|
-
return
|
|
2796
|
+
return _context50.stop();
|
|
2445
2797
|
}
|
|
2446
|
-
},
|
|
2798
|
+
}, _callee50);
|
|
2447
2799
|
}));
|
|
2448
2800
|
return function (_x4) {
|
|
2449
|
-
return
|
|
2801
|
+
return _ref51.apply(this, arguments);
|
|
2450
2802
|
};
|
|
2451
2803
|
}());
|
|
2452
2804
|
call.doHoldResume();
|
|
2453
|
-
|
|
2805
|
+
_context51.next = 1;
|
|
2454
2806
|
return (0, _testUtil.flushPromises)(2);
|
|
2455
|
-
case
|
|
2807
|
+
case 1:
|
|
2456
2808
|
/* the Call State should transition to S_CALL_ESTABLISHED
|
|
2457
2809
|
*/
|
|
2458
2810
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_HOLD');
|
|
@@ -2460,22 +2812,22 @@ describe('Supplementary Services tests', function () {
|
|
|
2460
2812
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2461
2813
|
/* We are intentionally failing the ROAP ANSWER */
|
|
2462
2814
|
roapEvent.data.type = 'ANSWER';
|
|
2463
|
-
|
|
2815
|
+
_context51.next = 2;
|
|
2464
2816
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2465
|
-
case
|
|
2817
|
+
case 2:
|
|
2466
2818
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2467
2819
|
/* We should return back to call established state */
|
|
2468
2820
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2469
|
-
case
|
|
2821
|
+
case 3:
|
|
2470
2822
|
case "end":
|
|
2471
|
-
return
|
|
2823
|
+
return _context51.stop();
|
|
2472
2824
|
}
|
|
2473
|
-
},
|
|
2825
|
+
}, _callee51);
|
|
2474
2826
|
})));
|
|
2475
|
-
it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2827
|
+
it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
|
|
2476
2828
|
var responsePayload, warnSpy, roapEvent;
|
|
2477
|
-
return _regenerator.default.wrap(function
|
|
2478
|
-
while (1) switch (
|
|
2829
|
+
return _regenerator.default.wrap(function (_context52) {
|
|
2830
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
2479
2831
|
case 0:
|
|
2480
2832
|
responsePayload = {
|
|
2481
2833
|
statusCode: 200,
|
|
@@ -2486,12 +2838,12 @@ describe('Supplementary Services tests', function () {
|
|
|
2486
2838
|
jest.spyOn(global, 'clearTimeout');
|
|
2487
2839
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2488
2840
|
call['held'] = false;
|
|
2489
|
-
|
|
2841
|
+
_context52.next = 1;
|
|
2490
2842
|
return call.doHoldResume();
|
|
2491
|
-
case
|
|
2492
|
-
|
|
2843
|
+
case 1:
|
|
2844
|
+
_context52.next = 2;
|
|
2493
2845
|
return (0, _testUtil.flushPromises)(2);
|
|
2494
|
-
case
|
|
2846
|
+
case 2:
|
|
2495
2847
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2496
2848
|
|
|
2497
2849
|
/* At this point, the Call State should be S_CALL_HOLD
|
|
@@ -2504,21 +2856,21 @@ describe('Supplementary Services tests', function () {
|
|
|
2504
2856
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2505
2857
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2506
2858
|
roapEvent.data.type = 'ANSWER';
|
|
2507
|
-
|
|
2859
|
+
_context52.next = 3;
|
|
2508
2860
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2509
|
-
case
|
|
2861
|
+
case 3:
|
|
2510
2862
|
jest.spyOn(webex, 'request').mockRejectedValue({
|
|
2511
2863
|
statusCode: 403
|
|
2512
2864
|
});
|
|
2513
2865
|
roapEvent.data.type = 'OK';
|
|
2514
|
-
|
|
2866
|
+
_context52.next = 4;
|
|
2515
2867
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2516
|
-
case
|
|
2868
|
+
case 4:
|
|
2517
2869
|
/* this is for coverage */
|
|
2518
2870
|
call['callStateMachine'].state.value = 'S_CALL_HOLD';
|
|
2519
|
-
|
|
2871
|
+
_context52.next = 5;
|
|
2520
2872
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2521
|
-
case
|
|
2873
|
+
case 5:
|
|
2522
2874
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2523
2875
|
/* We should return back to call established state */
|
|
2524
2876
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -2526,16 +2878,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2526
2878
|
file: 'call',
|
|
2527
2879
|
method: 'handleRoapEstablished'
|
|
2528
2880
|
});
|
|
2529
|
-
case
|
|
2881
|
+
case 6:
|
|
2530
2882
|
case "end":
|
|
2531
|
-
return
|
|
2883
|
+
return _context52.stop();
|
|
2532
2884
|
}
|
|
2533
|
-
},
|
|
2885
|
+
}, _callee52);
|
|
2534
2886
|
})));
|
|
2535
|
-
it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2887
|
+
it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
|
|
2536
2888
|
var responsePayload, warnSpy, roapEvent;
|
|
2537
|
-
return _regenerator.default.wrap(function
|
|
2538
|
-
while (1) switch (
|
|
2889
|
+
return _regenerator.default.wrap(function (_context53) {
|
|
2890
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
2539
2891
|
case 0:
|
|
2540
2892
|
responsePayload = {
|
|
2541
2893
|
statusCode: 200,
|
|
@@ -2546,12 +2898,12 @@ describe('Supplementary Services tests', function () {
|
|
|
2546
2898
|
jest.spyOn(global, 'clearTimeout');
|
|
2547
2899
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2548
2900
|
call['held'] = true;
|
|
2549
|
-
|
|
2901
|
+
_context53.next = 1;
|
|
2550
2902
|
return call.doHoldResume();
|
|
2551
|
-
case
|
|
2552
|
-
|
|
2903
|
+
case 1:
|
|
2904
|
+
_context53.next = 2;
|
|
2553
2905
|
return (0, _testUtil.flushPromises)(2);
|
|
2554
|
-
case
|
|
2906
|
+
case 2:
|
|
2555
2907
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2556
2908
|
|
|
2557
2909
|
/* At this point, the Call State should be S_CALL_RESUME
|
|
@@ -2564,16 +2916,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2564
2916
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2565
2917
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2566
2918
|
roapEvent.data.type = 'ANSWER';
|
|
2567
|
-
|
|
2919
|
+
_context53.next = 3;
|
|
2568
2920
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2569
|
-
case
|
|
2921
|
+
case 3:
|
|
2570
2922
|
jest.spyOn(webex, 'request').mockRejectedValue({
|
|
2571
2923
|
statusCode: 403
|
|
2572
2924
|
});
|
|
2573
2925
|
roapEvent.data.type = 'OK';
|
|
2574
|
-
|
|
2926
|
+
_context53.next = 4;
|
|
2575
2927
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2576
|
-
case
|
|
2928
|
+
case 4:
|
|
2577
2929
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2578
2930
|
/* We should return back to call established state */
|
|
2579
2931
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -2581,16 +2933,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2581
2933
|
file: 'call',
|
|
2582
2934
|
method: 'handleRoapEstablished'
|
|
2583
2935
|
});
|
|
2584
|
-
case
|
|
2936
|
+
case 5:
|
|
2585
2937
|
case "end":
|
|
2586
|
-
return
|
|
2938
|
+
return _context53.stop();
|
|
2587
2939
|
}
|
|
2588
|
-
},
|
|
2940
|
+
}, _callee53);
|
|
2589
2941
|
})));
|
|
2590
|
-
it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2942
|
+
it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
|
|
2591
2943
|
var responsePayload, roapEvent;
|
|
2592
|
-
return _regenerator.default.wrap(function
|
|
2593
|
-
while (1) switch (
|
|
2944
|
+
return _regenerator.default.wrap(function (_context55) {
|
|
2945
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
2594
2946
|
case 0:
|
|
2595
2947
|
expect.assertions(5);
|
|
2596
2948
|
responsePayload = {
|
|
@@ -2600,27 +2952,27 @@ describe('Supplementary Services tests', function () {
|
|
|
2600
2952
|
jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
|
|
2601
2953
|
call['held'] = false;
|
|
2602
2954
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
2603
|
-
var
|
|
2604
|
-
return _regenerator.default.wrap(function
|
|
2605
|
-
while (1) switch (
|
|
2955
|
+
var _ref55 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54(errObj) {
|
|
2956
|
+
return _regenerator.default.wrap(function (_context54) {
|
|
2957
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
2606
2958
|
case 0:
|
|
2607
2959
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
|
|
2608
2960
|
expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
|
|
2609
|
-
case
|
|
2961
|
+
case 1:
|
|
2610
2962
|
case "end":
|
|
2611
|
-
return
|
|
2963
|
+
return _context54.stop();
|
|
2612
2964
|
}
|
|
2613
|
-
},
|
|
2965
|
+
}, _callee54);
|
|
2614
2966
|
}));
|
|
2615
2967
|
return function (_x5) {
|
|
2616
|
-
return
|
|
2968
|
+
return _ref55.apply(this, arguments);
|
|
2617
2969
|
};
|
|
2618
2970
|
}());
|
|
2619
2971
|
jest.runAllTimers();
|
|
2620
2972
|
call.doHoldResume();
|
|
2621
|
-
|
|
2973
|
+
_context55.next = 1;
|
|
2622
2974
|
return (0, _testUtil.flushPromises)(2);
|
|
2623
|
-
case
|
|
2975
|
+
case 1:
|
|
2624
2976
|
/* At this point, the Call State should be S_CALL_HOLD
|
|
2625
2977
|
*/
|
|
2626
2978
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_HOLD');
|
|
@@ -2631,13 +2983,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2631
2983
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2632
2984
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2633
2985
|
roapEvent.data.type = 'ANSWER';
|
|
2634
|
-
|
|
2986
|
+
_context55.next = 2;
|
|
2635
2987
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2636
|
-
case
|
|
2988
|
+
case 2:
|
|
2637
2989
|
roapEvent.data.type = 'OK';
|
|
2638
|
-
|
|
2990
|
+
_context55.next = 3;
|
|
2639
2991
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2640
|
-
case
|
|
2992
|
+
case 3:
|
|
2641
2993
|
/* Advancing timer by 12 seconds so that it gets timed out */
|
|
2642
2994
|
jest.advanceTimersByTime(12000);
|
|
2643
2995
|
|
|
@@ -2645,16 +2997,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2645
2997
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2646
2998
|
/* We should return back to call established state */
|
|
2647
2999
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2648
|
-
case
|
|
3000
|
+
case 4:
|
|
2649
3001
|
case "end":
|
|
2650
|
-
return
|
|
3002
|
+
return _context55.stop();
|
|
2651
3003
|
}
|
|
2652
|
-
},
|
|
3004
|
+
}, _callee55);
|
|
2653
3005
|
})));
|
|
2654
|
-
it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3006
|
+
it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
|
|
2655
3007
|
var responsePayload, warnSpy, roapEvent;
|
|
2656
|
-
return _regenerator.default.wrap(function
|
|
2657
|
-
while (1) switch (
|
|
3008
|
+
return _regenerator.default.wrap(function (_context57) {
|
|
3009
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
2658
3010
|
case 0:
|
|
2659
3011
|
expect.assertions(7);
|
|
2660
3012
|
responsePayload = {
|
|
@@ -2667,27 +3019,27 @@ describe('Supplementary Services tests', function () {
|
|
|
2667
3019
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2668
3020
|
call['held'] = true;
|
|
2669
3021
|
call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
|
|
2670
|
-
var
|
|
2671
|
-
return _regenerator.default.wrap(function
|
|
2672
|
-
while (1) switch (
|
|
3022
|
+
var _ref57 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56(correlationId) {
|
|
3023
|
+
return _regenerator.default.wrap(function (_context56) {
|
|
3024
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
2673
3025
|
case 0:
|
|
2674
3026
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2675
3027
|
case 1:
|
|
2676
3028
|
case "end":
|
|
2677
|
-
return
|
|
3029
|
+
return _context56.stop();
|
|
2678
3030
|
}
|
|
2679
|
-
},
|
|
3031
|
+
}, _callee56);
|
|
2680
3032
|
}));
|
|
2681
3033
|
return function (_x6) {
|
|
2682
|
-
return
|
|
3034
|
+
return _ref57.apply(this, arguments);
|
|
2683
3035
|
};
|
|
2684
3036
|
}());
|
|
2685
|
-
|
|
3037
|
+
_context57.next = 1;
|
|
2686
3038
|
return call.doHoldResume();
|
|
2687
|
-
case
|
|
2688
|
-
|
|
3039
|
+
case 1:
|
|
3040
|
+
_context57.next = 2;
|
|
2689
3041
|
return (0, _testUtil.flushPromises)(2);
|
|
2690
|
-
case
|
|
3042
|
+
case 2:
|
|
2691
3043
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2692
3044
|
call.handleMidCallEvent(mockResumeEvent);
|
|
2693
3045
|
|
|
@@ -2701,13 +3053,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2701
3053
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2702
3054
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2703
3055
|
roapEvent.data.type = 'ANSWER';
|
|
2704
|
-
|
|
3056
|
+
_context57.next = 3;
|
|
2705
3057
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2706
|
-
case
|
|
3058
|
+
case 3:
|
|
2707
3059
|
roapEvent.data.type = 'OK';
|
|
2708
|
-
|
|
3060
|
+
_context57.next = 4;
|
|
2709
3061
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2710
|
-
case
|
|
3062
|
+
case 4:
|
|
2711
3063
|
expect(clearTimeout).toHaveBeenCalledTimes(1);
|
|
2712
3064
|
/* isHeld flag should not be set and an Resume event should be emitted */
|
|
2713
3065
|
expect(call.isHeld()).toStrictEqual(false);
|
|
@@ -2718,16 +3070,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2718
3070
|
file: 'call',
|
|
2719
3071
|
method: 'handleCallResume'
|
|
2720
3072
|
});
|
|
2721
|
-
case
|
|
3073
|
+
case 5:
|
|
2722
3074
|
case "end":
|
|
2723
|
-
return
|
|
3075
|
+
return _context57.stop();
|
|
2724
3076
|
}
|
|
2725
|
-
},
|
|
3077
|
+
}, _callee57);
|
|
2726
3078
|
})));
|
|
2727
|
-
it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3079
|
+
it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59() {
|
|
2728
3080
|
var responsePayload, warnSpy, roapEvent;
|
|
2729
|
-
return _regenerator.default.wrap(function
|
|
2730
|
-
while (1) switch (
|
|
3081
|
+
return _regenerator.default.wrap(function (_context59) {
|
|
3082
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
2731
3083
|
case 0:
|
|
2732
3084
|
expect.assertions(7);
|
|
2733
3085
|
responsePayload = {
|
|
@@ -2740,28 +3092,28 @@ describe('Supplementary Services tests', function () {
|
|
|
2740
3092
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2741
3093
|
call['held'] = true;
|
|
2742
3094
|
call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
|
|
2743
|
-
var
|
|
2744
|
-
return _regenerator.default.wrap(function
|
|
2745
|
-
while (1) switch (
|
|
3095
|
+
var _ref59 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58(correlationId) {
|
|
3096
|
+
return _regenerator.default.wrap(function (_context58) {
|
|
3097
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
2746
3098
|
case 0:
|
|
2747
3099
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2748
3100
|
case 1:
|
|
2749
3101
|
case "end":
|
|
2750
|
-
return
|
|
3102
|
+
return _context58.stop();
|
|
2751
3103
|
}
|
|
2752
|
-
},
|
|
3104
|
+
}, _callee58);
|
|
2753
3105
|
}));
|
|
2754
3106
|
return function (_x7) {
|
|
2755
|
-
return
|
|
3107
|
+
return _ref59.apply(this, arguments);
|
|
2756
3108
|
};
|
|
2757
3109
|
}());
|
|
2758
3110
|
call.doHoldResume();
|
|
2759
|
-
|
|
3111
|
+
_context59.next = 1;
|
|
2760
3112
|
return _promise.default.resolve();
|
|
2761
|
-
case
|
|
2762
|
-
|
|
3113
|
+
case 1:
|
|
3114
|
+
_context59.next = 2;
|
|
2763
3115
|
return _promise.default.resolve();
|
|
2764
|
-
case
|
|
3116
|
+
case 2:
|
|
2765
3117
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
2766
3118
|
call.handleMidCallEvent(mockResumeEvent);
|
|
2767
3119
|
|
|
@@ -2775,13 +3127,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2775
3127
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2776
3128
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2777
3129
|
roapEvent.data.type = 'ANSWER';
|
|
2778
|
-
|
|
3130
|
+
_context59.next = 3;
|
|
2779
3131
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2780
|
-
case
|
|
3132
|
+
case 3:
|
|
2781
3133
|
roapEvent.data.type = 'OK';
|
|
2782
|
-
|
|
3134
|
+
_context59.next = 4;
|
|
2783
3135
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2784
|
-
case
|
|
3136
|
+
case 4:
|
|
2785
3137
|
expect(clearTimeout).not.toHaveBeenCalled();
|
|
2786
3138
|
/* isHeld flag should not be set and an Resume event should be emitted */
|
|
2787
3139
|
expect(call.isHeld()).toStrictEqual(false);
|
|
@@ -2792,16 +3144,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2792
3144
|
file: 'call',
|
|
2793
3145
|
method: 'handleCallResume'
|
|
2794
3146
|
});
|
|
2795
|
-
case
|
|
3147
|
+
case 5:
|
|
2796
3148
|
case "end":
|
|
2797
|
-
return
|
|
3149
|
+
return _context59.stop();
|
|
2798
3150
|
}
|
|
2799
|
-
},
|
|
3151
|
+
}, _callee59);
|
|
2800
3152
|
})));
|
|
2801
|
-
it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3153
|
+
it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61() {
|
|
2802
3154
|
var responsePayload;
|
|
2803
|
-
return _regenerator.default.wrap(function
|
|
2804
|
-
while (1) switch (
|
|
3155
|
+
return _regenerator.default.wrap(function (_context61) {
|
|
3156
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
2805
3157
|
case 0:
|
|
2806
3158
|
expect.assertions(4);
|
|
2807
3159
|
responsePayload = {
|
|
@@ -2811,44 +3163,44 @@ describe('Supplementary Services tests', function () {
|
|
|
2811
3163
|
jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
2812
3164
|
call['held'] = true;
|
|
2813
3165
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2814
|
-
var
|
|
2815
|
-
return _regenerator.default.wrap(function
|
|
2816
|
-
while (1) switch (
|
|
3166
|
+
var _ref61 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60(errObj) {
|
|
3167
|
+
return _regenerator.default.wrap(function (_context60) {
|
|
3168
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
2817
3169
|
case 0:
|
|
2818
3170
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2819
3171
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2820
|
-
case
|
|
3172
|
+
case 1:
|
|
2821
3173
|
case "end":
|
|
2822
|
-
return
|
|
3174
|
+
return _context60.stop();
|
|
2823
3175
|
}
|
|
2824
|
-
},
|
|
3176
|
+
}, _callee60);
|
|
2825
3177
|
}));
|
|
2826
3178
|
return function (_x8) {
|
|
2827
|
-
return
|
|
3179
|
+
return _ref61.apply(this, arguments);
|
|
2828
3180
|
};
|
|
2829
3181
|
}());
|
|
2830
|
-
|
|
3182
|
+
_context61.next = 1;
|
|
2831
3183
|
return call.doHoldResume();
|
|
2832
|
-
case
|
|
2833
|
-
|
|
3184
|
+
case 1:
|
|
3185
|
+
_context61.next = 2;
|
|
2834
3186
|
return (0, _testUtil.flushPromises)(2);
|
|
2835
|
-
case
|
|
3187
|
+
case 2:
|
|
2836
3188
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2837
3189
|
|
|
2838
3190
|
/* At this point , the Call State should transition to S_CALL_ESTABLISHED
|
|
2839
3191
|
*/
|
|
2840
3192
|
|
|
2841
3193
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2842
|
-
case
|
|
3194
|
+
case 3:
|
|
2843
3195
|
case "end":
|
|
2844
|
-
return
|
|
3196
|
+
return _context61.stop();
|
|
2845
3197
|
}
|
|
2846
|
-
},
|
|
3198
|
+
}, _callee61);
|
|
2847
3199
|
})));
|
|
2848
|
-
it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3200
|
+
it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
|
|
2849
3201
|
var responsePayload, rejectPayload, roapEvent;
|
|
2850
|
-
return _regenerator.default.wrap(function
|
|
2851
|
-
while (1) switch (
|
|
3202
|
+
return _regenerator.default.wrap(function (_context63) {
|
|
3203
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
2852
3204
|
case 0:
|
|
2853
3205
|
expect.assertions(5);
|
|
2854
3206
|
responsePayload = {
|
|
@@ -2862,26 +3214,26 @@ describe('Supplementary Services tests', function () {
|
|
|
2862
3214
|
jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
|
|
2863
3215
|
call['held'] = true;
|
|
2864
3216
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2865
|
-
var
|
|
2866
|
-
return _regenerator.default.wrap(function
|
|
2867
|
-
while (1) switch (
|
|
3217
|
+
var _ref63 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62(errObj) {
|
|
3218
|
+
return _regenerator.default.wrap(function (_context62) {
|
|
3219
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
2868
3220
|
case 0:
|
|
2869
3221
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2870
3222
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2871
|
-
case
|
|
3223
|
+
case 1:
|
|
2872
3224
|
case "end":
|
|
2873
|
-
return
|
|
3225
|
+
return _context62.stop();
|
|
2874
3226
|
}
|
|
2875
|
-
},
|
|
3227
|
+
}, _callee62);
|
|
2876
3228
|
}));
|
|
2877
3229
|
return function (_x9) {
|
|
2878
|
-
return
|
|
3230
|
+
return _ref63.apply(this, arguments);
|
|
2879
3231
|
};
|
|
2880
3232
|
}());
|
|
2881
3233
|
call.doHoldResume();
|
|
2882
|
-
|
|
3234
|
+
_context63.next = 1;
|
|
2883
3235
|
return (0, _testUtil.flushPromises)(2);
|
|
2884
|
-
case
|
|
3236
|
+
case 1:
|
|
2885
3237
|
/* At this point , the Call State should transition to S_CALL_ESTABLISHED
|
|
2886
3238
|
*/
|
|
2887
3239
|
|
|
@@ -2890,22 +3242,22 @@ describe('Supplementary Services tests', function () {
|
|
|
2890
3242
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2891
3243
|
/* We are intentionally failing the ROAP ANSWER */
|
|
2892
3244
|
roapEvent.data.type = 'ANSWER';
|
|
2893
|
-
|
|
3245
|
+
_context63.next = 2;
|
|
2894
3246
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2895
|
-
case
|
|
3247
|
+
case 2:
|
|
2896
3248
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2897
3249
|
/* We should return back to call established state */
|
|
2898
3250
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2899
|
-
case
|
|
3251
|
+
case 3:
|
|
2900
3252
|
case "end":
|
|
2901
|
-
return
|
|
3253
|
+
return _context63.stop();
|
|
2902
3254
|
}
|
|
2903
|
-
},
|
|
3255
|
+
}, _callee63);
|
|
2904
3256
|
})));
|
|
2905
|
-
it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3257
|
+
it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65() {
|
|
2906
3258
|
var responsePayload, roapEvent;
|
|
2907
|
-
return _regenerator.default.wrap(function
|
|
2908
|
-
while (1) switch (
|
|
3259
|
+
return _regenerator.default.wrap(function (_context65) {
|
|
3260
|
+
while (1) switch (_context65.prev = _context65.next) {
|
|
2909
3261
|
case 0:
|
|
2910
3262
|
expect.assertions(5);
|
|
2911
3263
|
responsePayload = {
|
|
@@ -2915,26 +3267,26 @@ describe('Supplementary Services tests', function () {
|
|
|
2915
3267
|
jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
|
|
2916
3268
|
call['held'] = true;
|
|
2917
3269
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2918
|
-
var
|
|
2919
|
-
return _regenerator.default.wrap(function
|
|
2920
|
-
while (1) switch (
|
|
3270
|
+
var _ref65 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64(errObj) {
|
|
3271
|
+
return _regenerator.default.wrap(function (_context64) {
|
|
3272
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
2921
3273
|
case 0:
|
|
2922
3274
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
|
|
2923
3275
|
expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
|
|
2924
|
-
case
|
|
3276
|
+
case 1:
|
|
2925
3277
|
case "end":
|
|
2926
|
-
return
|
|
3278
|
+
return _context64.stop();
|
|
2927
3279
|
}
|
|
2928
|
-
},
|
|
3280
|
+
}, _callee64);
|
|
2929
3281
|
}));
|
|
2930
3282
|
return function (_x0) {
|
|
2931
|
-
return
|
|
3283
|
+
return _ref65.apply(this, arguments);
|
|
2932
3284
|
};
|
|
2933
3285
|
}());
|
|
2934
3286
|
call.doHoldResume();
|
|
2935
|
-
|
|
3287
|
+
_context65.next = 1;
|
|
2936
3288
|
return (0, _testUtil.flushPromises)(2);
|
|
2937
|
-
case
|
|
3289
|
+
case 1:
|
|
2938
3290
|
/* At this point ,the Call State should be S_CALL_RESUME
|
|
2939
3291
|
*/
|
|
2940
3292
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_RESUME');
|
|
@@ -2945,23 +3297,23 @@ describe('Supplementary Services tests', function () {
|
|
|
2945
3297
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2946
3298
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2947
3299
|
roapEvent.data.type = 'ANSWER';
|
|
2948
|
-
|
|
3300
|
+
_context65.next = 2;
|
|
2949
3301
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2950
|
-
case
|
|
3302
|
+
case 2:
|
|
2951
3303
|
roapEvent.data.type = 'OK';
|
|
2952
|
-
|
|
3304
|
+
_context65.next = 3;
|
|
2953
3305
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2954
|
-
case
|
|
3306
|
+
case 3:
|
|
2955
3307
|
/* Advancing timer by 12 seconds so that it gets timed out */
|
|
2956
3308
|
jest.advanceTimersByTime(12000);
|
|
2957
3309
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2958
3310
|
/* We should return back to call established state */
|
|
2959
3311
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2960
|
-
case
|
|
3312
|
+
case 4:
|
|
2961
3313
|
case "end":
|
|
2962
|
-
return
|
|
3314
|
+
return _context65.stop();
|
|
2963
3315
|
}
|
|
2964
|
-
},
|
|
3316
|
+
}, _callee65);
|
|
2965
3317
|
})));
|
|
2966
3318
|
});
|
|
2967
3319
|
describe('Call transfer tests', function () {
|
|
@@ -2994,10 +3346,10 @@ describe('Supplementary Services tests', function () {
|
|
|
2994
3346
|
secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
|
|
2995
3347
|
secondCall['held'] = false;
|
|
2996
3348
|
});
|
|
2997
|
-
it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3349
|
+
it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68() {
|
|
2998
3350
|
var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
|
|
2999
|
-
return _regenerator.default.wrap(function
|
|
3000
|
-
while (1) switch (
|
|
3351
|
+
return _regenerator.default.wrap(function (_context68) {
|
|
3352
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
3001
3353
|
case 0:
|
|
3002
3354
|
expect.assertions(12); // Updated to match actual assertion count
|
|
3003
3355
|
responsePayload = {
|
|
@@ -3009,43 +3361,43 @@ describe('Supplementary Services tests', function () {
|
|
|
3009
3361
|
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
3010
3362
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3011
3363
|
call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
3012
|
-
var
|
|
3013
|
-
return _regenerator.default.wrap(function
|
|
3014
|
-
while (1) switch (
|
|
3364
|
+
var _ref67 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66(correlationId) {
|
|
3365
|
+
return _regenerator.default.wrap(function (_context66) {
|
|
3366
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
3015
3367
|
case 0:
|
|
3016
3368
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
3017
3369
|
case 1:
|
|
3018
3370
|
case "end":
|
|
3019
|
-
return
|
|
3371
|
+
return _context66.stop();
|
|
3020
3372
|
}
|
|
3021
|
-
},
|
|
3373
|
+
}, _callee66);
|
|
3022
3374
|
}));
|
|
3023
3375
|
return function (_x1) {
|
|
3024
|
-
return
|
|
3376
|
+
return _ref67.apply(this, arguments);
|
|
3025
3377
|
};
|
|
3026
3378
|
}());
|
|
3027
3379
|
secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
3028
|
-
var
|
|
3029
|
-
return _regenerator.default.wrap(function
|
|
3030
|
-
while (1) switch (
|
|
3380
|
+
var _ref68 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67(correlationId) {
|
|
3381
|
+
return _regenerator.default.wrap(function (_context67) {
|
|
3382
|
+
while (1) switch (_context67.prev = _context67.next) {
|
|
3031
3383
|
case 0:
|
|
3032
3384
|
expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
|
|
3033
3385
|
case 1:
|
|
3034
3386
|
case "end":
|
|
3035
|
-
return
|
|
3387
|
+
return _context67.stop();
|
|
3036
3388
|
}
|
|
3037
|
-
},
|
|
3389
|
+
}, _callee67);
|
|
3038
3390
|
}));
|
|
3039
3391
|
return function (_x10) {
|
|
3040
|
-
return
|
|
3392
|
+
return _ref68.apply(this, arguments);
|
|
3041
3393
|
};
|
|
3042
3394
|
}());
|
|
3043
|
-
|
|
3395
|
+
_context68.next = 1;
|
|
3044
3396
|
return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
|
|
3045
|
-
case
|
|
3046
|
-
|
|
3397
|
+
case 1:
|
|
3398
|
+
_context68.next = 2;
|
|
3047
3399
|
return (0, _testUtil.flushPromises)(2);
|
|
3048
|
-
case
|
|
3400
|
+
case 2:
|
|
3049
3401
|
expect(requestSpy).toBeCalled();
|
|
3050
3402
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined);
|
|
3051
3403
|
call.sendCallStateMachineEvt({
|
|
@@ -3064,16 +3416,16 @@ describe('Supplementary Services tests', function () {
|
|
|
3064
3416
|
expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3065
3417
|
expect(infoSpy).toHaveBeenCalledWith("Initiating Consult transfer between : ".concat(call.getCallId(), " and ").concat(secondCall.getCallId()), transferLoggingContext);
|
|
3066
3418
|
expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3067
|
-
case
|
|
3419
|
+
case 3:
|
|
3068
3420
|
case "end":
|
|
3069
|
-
return
|
|
3421
|
+
return _context68.stop();
|
|
3070
3422
|
}
|
|
3071
|
-
},
|
|
3423
|
+
}, _callee68);
|
|
3072
3424
|
})));
|
|
3073
|
-
it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3425
|
+
it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
|
|
3074
3426
|
var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
|
|
3075
|
-
return _regenerator.default.wrap(function
|
|
3076
|
-
while (1) switch (
|
|
3427
|
+
return _regenerator.default.wrap(function (_context70) {
|
|
3428
|
+
while (1) switch (_context70.prev = _context70.next) {
|
|
3077
3429
|
case 0:
|
|
3078
3430
|
expect.assertions(10); // Updated to match actual assertion count
|
|
3079
3431
|
responsePayload = {
|
|
@@ -3085,27 +3437,27 @@ describe('Supplementary Services tests', function () {
|
|
|
3085
3437
|
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
3086
3438
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3087
3439
|
call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
3088
|
-
var
|
|
3089
|
-
return _regenerator.default.wrap(function
|
|
3090
|
-
while (1) switch (
|
|
3440
|
+
var _ref70 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69(correlationId) {
|
|
3441
|
+
return _regenerator.default.wrap(function (_context69) {
|
|
3442
|
+
while (1) switch (_context69.prev = _context69.next) {
|
|
3091
3443
|
case 0:
|
|
3092
3444
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
3093
3445
|
case 1:
|
|
3094
3446
|
case "end":
|
|
3095
|
-
return
|
|
3447
|
+
return _context69.stop();
|
|
3096
3448
|
}
|
|
3097
|
-
},
|
|
3449
|
+
}, _callee69);
|
|
3098
3450
|
}));
|
|
3099
3451
|
return function (_x11) {
|
|
3100
|
-
return
|
|
3452
|
+
return _ref70.apply(this, arguments);
|
|
3101
3453
|
};
|
|
3102
3454
|
}());
|
|
3103
|
-
|
|
3455
|
+
_context70.next = 1;
|
|
3104
3456
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
|
|
3105
|
-
case
|
|
3106
|
-
|
|
3457
|
+
case 1:
|
|
3458
|
+
_context70.next = 2;
|
|
3107
3459
|
return (0, _testUtil.flushPromises)(2);
|
|
3108
|
-
case
|
|
3460
|
+
case 2:
|
|
3109
3461
|
expect(requestSpy).toBeCalled();
|
|
3110
3462
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined);
|
|
3111
3463
|
call.sendCallStateMachineEvt({
|
|
@@ -3120,16 +3472,16 @@ describe('Supplementary Services tests', function () {
|
|
|
3120
3472
|
expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3121
3473
|
expect(infoSpy).toHaveBeenCalledWith("Initiating Blind transfer with : ".concat(transfereeNumber), transferLoggingContext);
|
|
3122
3474
|
expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3123
|
-
case
|
|
3475
|
+
case 3:
|
|
3124
3476
|
case "end":
|
|
3125
|
-
return
|
|
3477
|
+
return _context70.stop();
|
|
3126
3478
|
}
|
|
3127
|
-
},
|
|
3479
|
+
}, _callee70);
|
|
3128
3480
|
})));
|
|
3129
|
-
it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3481
|
+
it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
|
|
3130
3482
|
var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
|
|
3131
|
-
return _regenerator.default.wrap(function
|
|
3132
|
-
while (1) switch (
|
|
3483
|
+
return _regenerator.default.wrap(function (_context71) {
|
|
3484
|
+
while (1) switch (_context71.prev = _context71.next) {
|
|
3133
3485
|
case 0:
|
|
3134
3486
|
responsePayload = {
|
|
3135
3487
|
statusCode: 403,
|
|
@@ -3140,12 +3492,12 @@ describe('Supplementary Services tests', function () {
|
|
|
3140
3492
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3141
3493
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3142
3494
|
call['broadworksCorrelationInfo'] = 'dummy-broadworks-correlation-info';
|
|
3143
|
-
|
|
3495
|
+
_context71.next = 1;
|
|
3144
3496
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
|
|
3145
|
-
case
|
|
3146
|
-
|
|
3497
|
+
case 1:
|
|
3498
|
+
_context71.next = 2;
|
|
3147
3499
|
return (0, _testUtil.flushPromises)(1);
|
|
3148
|
-
case
|
|
3500
|
+
case 2:
|
|
3149
3501
|
expect(requestSpy).toBeCalled();
|
|
3150
3502
|
/* We should be in CALL_ESTABLISHED state */
|
|
3151
3503
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3162,16 +3514,16 @@ describe('Supplementary Services tests', function () {
|
|
|
3162
3514
|
expect(emitSpy).toBeCalledOnceWith(_types2.CALL_EVENT_KEYS.TRANSFER_ERROR, expect.any(_Errors.CallError));
|
|
3163
3515
|
expect(warnSpy).toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3164
3516
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
|
|
3165
|
-
case
|
|
3517
|
+
case 3:
|
|
3166
3518
|
case "end":
|
|
3167
|
-
return
|
|
3519
|
+
return _context71.stop();
|
|
3168
3520
|
}
|
|
3169
|
-
},
|
|
3521
|
+
}, _callee71);
|
|
3170
3522
|
})));
|
|
3171
|
-
it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3523
|
+
it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
|
|
3172
3524
|
var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
|
|
3173
|
-
return _regenerator.default.wrap(function
|
|
3174
|
-
while (1) switch (
|
|
3525
|
+
return _regenerator.default.wrap(function (_context72) {
|
|
3526
|
+
while (1) switch (_context72.prev = _context72.next) {
|
|
3175
3527
|
case 0:
|
|
3176
3528
|
responsePayload = {
|
|
3177
3529
|
statusCode: 403,
|
|
@@ -3181,12 +3533,12 @@ describe('Supplementary Services tests', function () {
|
|
|
3181
3533
|
requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
3182
3534
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3183
3535
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3184
|
-
|
|
3536
|
+
_context72.next = 1;
|
|
3185
3537
|
return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
|
|
3186
|
-
case
|
|
3187
|
-
|
|
3538
|
+
case 1:
|
|
3539
|
+
_context72.next = 2;
|
|
3188
3540
|
return (0, _testUtil.flushPromises)(2);
|
|
3189
|
-
case
|
|
3541
|
+
case 2:
|
|
3190
3542
|
expect(requestSpy).toBeCalled();
|
|
3191
3543
|
/* We should be in CALL_ESTABLISHED state */
|
|
3192
3544
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3203,22 +3555,22 @@ describe('Supplementary Services tests', function () {
|
|
|
3203
3555
|
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.TRANSFER_ERROR, expect.any(_Errors.CallError));
|
|
3204
3556
|
expect(warnSpy).toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3205
3557
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
|
|
3206
|
-
case
|
|
3558
|
+
case 3:
|
|
3207
3559
|
case "end":
|
|
3208
|
-
return
|
|
3560
|
+
return _context72.stop();
|
|
3209
3561
|
}
|
|
3210
|
-
},
|
|
3562
|
+
}, _callee72);
|
|
3211
3563
|
})));
|
|
3212
|
-
it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3564
|
+
it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
|
|
3213
3565
|
var requestSpy, warnSpy;
|
|
3214
|
-
return _regenerator.default.wrap(function
|
|
3215
|
-
while (1) switch (
|
|
3566
|
+
return _regenerator.default.wrap(function (_context73) {
|
|
3567
|
+
while (1) switch (_context73.prev = _context73.next) {
|
|
3216
3568
|
case 0:
|
|
3217
3569
|
requestSpy = jest.spyOn(webex, 'request');
|
|
3218
3570
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3219
|
-
|
|
3571
|
+
_context73.next = 1;
|
|
3220
3572
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
|
|
3221
|
-
case
|
|
3573
|
+
case 1:
|
|
3222
3574
|
/* We should be in CALL_ESTABLISHED state */
|
|
3223
3575
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
3224
3576
|
expect(secondCall['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3226,22 +3578,22 @@ describe('Supplementary Services tests', function () {
|
|
|
3226
3578
|
expect(uploadLogsSpy).not.toBeCalled();
|
|
3227
3579
|
expect(requestSpy).not.toBeCalled();
|
|
3228
3580
|
expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3229
|
-
case
|
|
3581
|
+
case 2:
|
|
3230
3582
|
case "end":
|
|
3231
|
-
return
|
|
3583
|
+
return _context73.stop();
|
|
3232
3584
|
}
|
|
3233
|
-
},
|
|
3585
|
+
}, _callee73);
|
|
3234
3586
|
})));
|
|
3235
|
-
it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3587
|
+
it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee74() {
|
|
3236
3588
|
var requestSpy, warnSpy;
|
|
3237
|
-
return _regenerator.default.wrap(function
|
|
3238
|
-
while (1) switch (
|
|
3589
|
+
return _regenerator.default.wrap(function (_context74) {
|
|
3590
|
+
while (1) switch (_context74.prev = _context74.next) {
|
|
3239
3591
|
case 0:
|
|
3240
3592
|
requestSpy = jest.spyOn(webex, 'request');
|
|
3241
3593
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3242
|
-
|
|
3594
|
+
_context74.next = 1;
|
|
3243
3595
|
return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
|
|
3244
|
-
case
|
|
3596
|
+
case 1:
|
|
3245
3597
|
/* We should be in CALL_ESTABLISHED state */
|
|
3246
3598
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
3247
3599
|
expect(secondCall['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3249,11 +3601,11 @@ describe('Supplementary Services tests', function () {
|
|
|
3249
3601
|
expect(uploadLogsSpy).not.toBeCalled();
|
|
3250
3602
|
expect(requestSpy).not.toBeCalled();
|
|
3251
3603
|
expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3252
|
-
case
|
|
3604
|
+
case 2:
|
|
3253
3605
|
case "end":
|
|
3254
|
-
return
|
|
3606
|
+
return _context74.stop();
|
|
3255
3607
|
}
|
|
3256
|
-
},
|
|
3608
|
+
}, _callee74);
|
|
3257
3609
|
})));
|
|
3258
3610
|
});
|
|
3259
3611
|
});
|