@webex/calling 3.10.0 → 3.11.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallHistory/CallHistory.js +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 +298 -347
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +267 -405
- 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 +657 -616
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +864 -551
- 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 +5 -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 +659 -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/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/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 +83 -123
- package/dist/module/CallingClient/calling/call.js +73 -58
- package/dist/module/CallingClient/calling/callManager.js +7 -0
- package/dist/module/CallingClient/constants.js +3 -0
- package/dist/module/CallingClient/registration/register.js +85 -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.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 +3 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +4 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +6 -0
- 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/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/package.json +4 -4
|
@@ -8,6 +8,7 @@ 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"));
|
|
@@ -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 = {
|
|
@@ -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
497
|
expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Enabled, expect.any(Function));
|
|
497
498
|
expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Disabled, expect.any(Function));
|
|
498
|
-
case
|
|
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,63 @@ 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
|
+
expect(clearInterval).toHaveBeenCalledTimes(1);
|
|
883
|
+
expect(funcSpy).toBeCalledTimes(1);
|
|
884
|
+
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
885
|
+
case 3:
|
|
886
|
+
case "end":
|
|
887
|
+
return _context14.stop();
|
|
888
|
+
}
|
|
889
|
+
}, _callee14);
|
|
890
|
+
})));
|
|
891
|
+
it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
892
|
+
var statusPayload, funcSpy;
|
|
893
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
894
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
860
895
|
case 0:
|
|
861
896
|
expect.assertions(4);
|
|
862
897
|
statusPayload = {
|
|
@@ -869,35 +904,122 @@ describe('State Machine handler tests', function () {
|
|
|
869
904
|
expect(errObj.message).toStrictEqual('An unauthorized action has been received. This action has been blocked. Please contact the administrator if this persists.');
|
|
870
905
|
});
|
|
871
906
|
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
907
|
call['handleCallEstablished']({});
|
|
878
908
|
jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
|
|
879
909
|
|
|
880
910
|
/* This is to flush all the promises from the Promise queue so that
|
|
881
911
|
* Jest.fakeTimers can advance time and also clear the promise Queue
|
|
882
912
|
*/
|
|
883
|
-
|
|
884
|
-
return
|
|
885
|
-
case
|
|
886
|
-
|
|
887
|
-
return _promise.default.resolve();
|
|
888
|
-
case 13:
|
|
889
|
-
expect(clearInterval).toHaveBeenCalledTimes(2); // check this
|
|
913
|
+
_context15.next = 1;
|
|
914
|
+
return (0, _testUtil.flushPromises)(2);
|
|
915
|
+
case 1:
|
|
916
|
+
expect(clearInterval).toHaveBeenCalledTimes(1);
|
|
890
917
|
expect(funcSpy).toBeCalledTimes(1);
|
|
891
|
-
case
|
|
918
|
+
case 2:
|
|
892
919
|
case "end":
|
|
893
|
-
return
|
|
920
|
+
return _context15.stop();
|
|
894
921
|
}
|
|
895
|
-
},
|
|
922
|
+
}, _callee15);
|
|
896
923
|
})));
|
|
897
|
-
it('
|
|
924
|
+
it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
925
|
+
var errorPayload, okPayload, scheduleKeepaliveSpy, postStatusSpy;
|
|
926
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
927
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
928
|
+
case 0:
|
|
929
|
+
errorPayload = {
|
|
930
|
+
statusCode: 500,
|
|
931
|
+
headers: {
|
|
932
|
+
'retry-after': 1
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
okPayload = {
|
|
936
|
+
statusCode: 200,
|
|
937
|
+
body: {}
|
|
938
|
+
};
|
|
939
|
+
scheduleKeepaliveSpy = jest.spyOn(call, 'scheduleCallKeepaliveInterval');
|
|
940
|
+
postStatusSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(errorPayload).mockResolvedValueOnce(okPayload);
|
|
941
|
+
if (call['sessionTimer'] === undefined) {
|
|
942
|
+
call['handleCallEstablished']({});
|
|
943
|
+
}
|
|
944
|
+
jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
|
|
945
|
+
_context16.next = 1;
|
|
946
|
+
return (0, _testUtil.flushPromises)(2);
|
|
947
|
+
case 1:
|
|
948
|
+
expect(postStatusSpy).toHaveBeenCalledTimes(1);
|
|
949
|
+
|
|
950
|
+
// Now advance by 1 second for the retry-after interval
|
|
951
|
+
jest.advanceTimersByTime(1000);
|
|
952
|
+
_context16.next = 2;
|
|
953
|
+
return (0, _testUtil.flushPromises)(2);
|
|
954
|
+
case 2:
|
|
955
|
+
expect(postStatusSpy).toHaveBeenCalledTimes(2);
|
|
956
|
+
expect(scheduleKeepaliveSpy).toHaveBeenCalledTimes(2);
|
|
957
|
+
case 3:
|
|
958
|
+
case "end":
|
|
959
|
+
return _context16.stop();
|
|
960
|
+
}
|
|
961
|
+
}, _callee16);
|
|
962
|
+
})));
|
|
963
|
+
it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
964
|
+
var errorPayload, warnSpy, postStatusSpy;
|
|
965
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
966
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
967
|
+
case 0:
|
|
968
|
+
errorPayload = {
|
|
969
|
+
statusCode: 500,
|
|
970
|
+
headers: {
|
|
971
|
+
'retry-after': 1
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
jest.spyOn(global, 'clearInterval');
|
|
975
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
976
|
+
postStatusSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(errorPayload); // Put the call in the S_CALL_ESTABLISHED state and set it as connected
|
|
977
|
+
call['callStateMachine'].state.value = 'S_CALL_ESTABLISHED';
|
|
978
|
+
call['connected'] = true;
|
|
979
|
+
|
|
980
|
+
// Call handleCallEstablished which will setup interval
|
|
981
|
+
call['handleCallEstablished']({});
|
|
982
|
+
|
|
983
|
+
// Advance timer to trigger the first failure (uses DEFAULT_SESSION_TIMER)
|
|
984
|
+
jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
|
|
985
|
+
_context17.next = 1;
|
|
986
|
+
return (0, _testUtil.flushPromises)(2);
|
|
987
|
+
case 1:
|
|
988
|
+
// Now advance by 1 second for each of the 4 retry attempts (retry-after: 1 second each)
|
|
989
|
+
// Need to do this separately to allow state machine to process and create new intervals
|
|
990
|
+
jest.advanceTimersByTime(1000);
|
|
991
|
+
_context17.next = 2;
|
|
992
|
+
return (0, _testUtil.flushPromises)(2);
|
|
993
|
+
case 2:
|
|
994
|
+
jest.advanceTimersByTime(1000);
|
|
995
|
+
_context17.next = 3;
|
|
996
|
+
return (0, _testUtil.flushPromises)(2);
|
|
997
|
+
case 3:
|
|
998
|
+
jest.advanceTimersByTime(1000);
|
|
999
|
+
_context17.next = 4;
|
|
1000
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1001
|
+
case 4:
|
|
1002
|
+
jest.advanceTimersByTime(1000);
|
|
1003
|
+
_context17.next = 5;
|
|
1004
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1005
|
+
case 5:
|
|
1006
|
+
// The error handler should detect we're at max retry count and stop
|
|
1007
|
+
expect(warnSpy).toHaveBeenCalledWith("Max keepalive retry attempts reached. Aborting call keepalive for callId: ".concat(call.getCallId()), {
|
|
1008
|
+
file: 'call',
|
|
1009
|
+
method: 'keepaliveRetryCallback'
|
|
1010
|
+
});
|
|
1011
|
+
expect(postStatusSpy).toHaveBeenCalledTimes(5);
|
|
1012
|
+
expect(call['callKeepaliveRetryCount']).toBe(4);
|
|
1013
|
+
case 6:
|
|
1014
|
+
case "end":
|
|
1015
|
+
return _context17.stop();
|
|
1016
|
+
}
|
|
1017
|
+
}, _callee17);
|
|
1018
|
+
})));
|
|
1019
|
+
it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
898
1020
|
var statusPayload, dummyEvent, postMediaSpy, deleteSpy, dummyOkEvent;
|
|
899
|
-
return _regenerator.default.wrap(function
|
|
900
|
-
while (1) switch (
|
|
1021
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1022
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
901
1023
|
case 0:
|
|
902
1024
|
statusPayload = {
|
|
903
1025
|
statusCode: 200,
|
|
@@ -951,16 +1073,16 @@ describe('State Machine handler tests', function () {
|
|
|
951
1073
|
});
|
|
952
1074
|
expect(deleteSpy).toBeCalledOnceWith();
|
|
953
1075
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
954
|
-
case
|
|
1076
|
+
case 1:
|
|
955
1077
|
case "end":
|
|
956
|
-
return
|
|
1078
|
+
return _context18.stop();
|
|
957
1079
|
}
|
|
958
|
-
},
|
|
1080
|
+
}, _callee18);
|
|
959
1081
|
})));
|
|
960
|
-
it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1082
|
+
it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
961
1083
|
var statusPayload, dummyEvent;
|
|
962
|
-
return _regenerator.default.wrap(function
|
|
963
|
-
while (1) switch (
|
|
1084
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1085
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
964
1086
|
case 0:
|
|
965
1087
|
call['direction'] = _types3.CallDirection.INBOUND;
|
|
966
1088
|
statusPayload = {
|
|
@@ -978,11 +1100,11 @@ describe('State Machine handler tests', function () {
|
|
|
978
1100
|
webex.request.mockReturnValue(statusPayload);
|
|
979
1101
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
980
1102
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
|
|
981
|
-
|
|
1103
|
+
_context19.next = 1;
|
|
982
1104
|
return call['handleOutgoingCallConnect']({
|
|
983
1105
|
type: 'E_SEND_CALL_CONNECT'
|
|
984
1106
|
});
|
|
985
|
-
case
|
|
1107
|
+
case 1:
|
|
986
1108
|
/* state should not change since there is no offer received. */
|
|
987
1109
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
|
|
988
1110
|
expect(call.isConnected()).toBeFalsy();
|
|
@@ -990,16 +1112,117 @@ describe('State Machine handler tests', function () {
|
|
|
990
1112
|
type: 'E_RECV_CALL_DISCONNECT'
|
|
991
1113
|
});
|
|
992
1114
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
993
|
-
case
|
|
1115
|
+
case 2:
|
|
994
1116
|
case "end":
|
|
995
|
-
return
|
|
1117
|
+
return _context19.stop();
|
|
996
1118
|
}
|
|
997
|
-
},
|
|
1119
|
+
}, _callee19);
|
|
1120
|
+
})));
|
|
1121
|
+
it('processes callerId on received progress event in established state without emitting PROGRESS', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1122
|
+
var callManager, statusPayload, call, dummyEvent, dummyOkEvent, emitSpy, startCallerIdSpy, mobiusProgressEvent;
|
|
1123
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1124
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1125
|
+
case 0:
|
|
1126
|
+
callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
1127
|
+
statusPayload = {
|
|
1128
|
+
statusCode: 200,
|
|
1129
|
+
body: mockStatusBody
|
|
1130
|
+
};
|
|
1131
|
+
call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
|
|
1132
|
+
webex.request.mockReturnValue(statusPayload);
|
|
1133
|
+
|
|
1134
|
+
// Move to S_SEND_CALL_SETUP
|
|
1135
|
+
dummyEvent = {
|
|
1136
|
+
type: 'E_SEND_CALL_SETUP',
|
|
1137
|
+
data: {
|
|
1138
|
+
seq: 1,
|
|
1139
|
+
message: {},
|
|
1140
|
+
type: 'OFFER'
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
call.sendCallStateMachineEvt(dummyEvent);
|
|
1144
|
+
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
|
|
1145
|
+
|
|
1146
|
+
// Complete media negotiation to allow connect -> established
|
|
1147
|
+
// Ask media SDK to initiate offer
|
|
1148
|
+
dummyEvent.type = 'E_SEND_ROAP_OFFER';
|
|
1149
|
+
dummyEvent.data = {
|
|
1150
|
+
seq: 1,
|
|
1151
|
+
messageType: 'OFFER',
|
|
1152
|
+
sdp: 'sdp'
|
|
1153
|
+
};
|
|
1154
|
+
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1155
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_SEND_ROAP_OFFER');
|
|
1156
|
+
dummyEvent.type = 'E_RECV_ROAP_ANSWER';
|
|
1157
|
+
dummyEvent.data = {
|
|
1158
|
+
seq: 1,
|
|
1159
|
+
messageType: 'ANSWER',
|
|
1160
|
+
sdp: 'sdp'
|
|
1161
|
+
};
|
|
1162
|
+
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1163
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_RECV_ROAP_ANSWER');
|
|
1164
|
+
// Send OK
|
|
1165
|
+
dummyOkEvent = {
|
|
1166
|
+
type: 'E_ROAP_OK',
|
|
1167
|
+
data: {
|
|
1168
|
+
received: false,
|
|
1169
|
+
message: {
|
|
1170
|
+
seq: 1,
|
|
1171
|
+
messageType: 'OK'
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
};
|
|
1175
|
+
call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
1176
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_OK');
|
|
1177
|
+
expect(call['mediaNegotiationCompleted']).toBe(true);
|
|
1178
|
+
|
|
1179
|
+
// Move call to established
|
|
1180
|
+
dummyEvent.type = 'E_RECV_CALL_CONNECT';
|
|
1181
|
+
dummyEvent.data = undefined;
|
|
1182
|
+
call.sendCallStateMachineEvt(dummyEvent);
|
|
1183
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_ESTABLISHED');
|
|
1184
|
+
emitSpy = jest.spyOn(call, 'emit');
|
|
1185
|
+
startCallerIdSpy = jest.spyOn(call, 'startCallerIdResolution'); // Now send progress with callerId while established via CallManager (Mobius event)
|
|
1186
|
+
mobiusProgressEvent = {
|
|
1187
|
+
id: 'evt1',
|
|
1188
|
+
timestamp: (0, _now.default)(),
|
|
1189
|
+
trackingId: 'track-1',
|
|
1190
|
+
data: {
|
|
1191
|
+
eventType: _types5.MobiusEventType.CALL_PROGRESS,
|
|
1192
|
+
callerId: {
|
|
1193
|
+
from: '"Bob Marley" <sip:5010@207.182.171.130;user=phone>;tag=888068389-1654853820619-'
|
|
1194
|
+
},
|
|
1195
|
+
callProgressData: {
|
|
1196
|
+
inbandMedia: true,
|
|
1197
|
+
alerting: false
|
|
1198
|
+
},
|
|
1199
|
+
callId: call.getCallId(),
|
|
1200
|
+
callUrl: 'https://mobius.example/call',
|
|
1201
|
+
deviceId: deviceId,
|
|
1202
|
+
correlationId: call.getCorrelationId()
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1205
|
+
callManager['dequeueWsEvents'](mobiusProgressEvent);
|
|
1206
|
+
|
|
1207
|
+
// CallerId resolution should be triggered exactly once (handled by CallManager)
|
|
1208
|
+
expect(startCallerIdSpy).toBeCalledOnceWith(mobiusProgressEvent.data.callerId);
|
|
1209
|
+
// Since it returns early in established state, PROGRESS event should not be emitted here
|
|
1210
|
+
expect(emitSpy.mock.calls.find(function (args) {
|
|
1211
|
+
return args && args[0] === _types2.CALL_EVENT_KEYS.PROGRESS;
|
|
1212
|
+
})).toBeUndefined();
|
|
1213
|
+
expect(call['callStateMachine'].state.value).not.toBe('S_RECV_CALL_PROGRESS');
|
|
1214
|
+
// Early media flag should not be set due to early return
|
|
1215
|
+
expect(call.earlyMedia).not.toBe(true);
|
|
1216
|
+
case 1:
|
|
1217
|
+
case "end":
|
|
1218
|
+
return _context20.stop();
|
|
1219
|
+
}
|
|
1220
|
+
}, _callee20);
|
|
998
1221
|
})));
|
|
999
|
-
it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1222
|
+
it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1000
1223
|
var warnSpy, errorSpy, stateMachineSpy, statusPayload, roapMessage;
|
|
1001
|
-
return _regenerator.default.wrap(function
|
|
1002
|
-
while (1) switch (
|
|
1224
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
1225
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1003
1226
|
case 0:
|
|
1004
1227
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1005
1228
|
errorSpy = jest.spyOn(_Logger.default, 'error');
|
|
@@ -1026,25 +1249,25 @@ describe('State Machine handler tests', function () {
|
|
|
1026
1249
|
webex.request.mockRejectedValueOnce({
|
|
1027
1250
|
statusCode: 403
|
|
1028
1251
|
}).mockResolvedValue(statusPayload);
|
|
1029
|
-
|
|
1252
|
+
_context21.next = 1;
|
|
1030
1253
|
return call['handleOutgoingCallConnect']({
|
|
1031
1254
|
type: 'E_SEND_CALL_CONNECT'
|
|
1032
1255
|
});
|
|
1033
|
-
case
|
|
1256
|
+
case 1:
|
|
1034
1257
|
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
1035
1258
|
expect(stateMachineSpy).toBeCalledTimes(3);
|
|
1036
1259
|
expect(warnSpy).toBeCalledTimes(3);
|
|
1037
1260
|
expect(errorSpy).toBeCalledTimes(1);
|
|
1038
|
-
case
|
|
1261
|
+
case 2:
|
|
1039
1262
|
case "end":
|
|
1040
|
-
return
|
|
1263
|
+
return _context21.stop();
|
|
1041
1264
|
}
|
|
1042
|
-
},
|
|
1265
|
+
}, _callee21);
|
|
1043
1266
|
})));
|
|
1044
|
-
it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1267
|
+
it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
1045
1268
|
var statusPayload, dummyEvent, postMediaSpy, logSpy, dummyOkEvent;
|
|
1046
|
-
return _regenerator.default.wrap(function
|
|
1047
|
-
while (1) switch (
|
|
1269
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
1270
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1048
1271
|
case 0:
|
|
1049
1272
|
statusPayload = {
|
|
1050
1273
|
statusCode: 200,
|
|
@@ -1118,16 +1341,16 @@ describe('State Machine handler tests', function () {
|
|
|
1118
1341
|
type: 'E_SEND_CALL_DISCONNECT'
|
|
1119
1342
|
});
|
|
1120
1343
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
|
|
1121
|
-
case
|
|
1344
|
+
case 1:
|
|
1122
1345
|
case "end":
|
|
1123
|
-
return
|
|
1346
|
+
return _context22.stop();
|
|
1124
1347
|
}
|
|
1125
|
-
},
|
|
1348
|
+
}, _callee22);
|
|
1126
1349
|
})));
|
|
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
|
|
1350
|
+
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 _callee23() {
|
|
1128
1351
|
var statusPayload, dummySetupEvent, dummyConnectEvent, dummyOfferEvent, dummyAnswerEvent, dummyOkEvent, postMediaSpy;
|
|
1129
|
-
return _regenerator.default.wrap(function
|
|
1130
|
-
while (1) switch (
|
|
1352
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
1353
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1131
1354
|
case 0:
|
|
1132
1355
|
statusPayload = {
|
|
1133
1356
|
statusCode: 200,
|
|
@@ -1193,16 +1416,16 @@ describe('State Machine handler tests', function () {
|
|
|
1193
1416
|
type: 'E_SEND_CALL_DISCONNECT'
|
|
1194
1417
|
});
|
|
1195
1418
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
|
|
1196
|
-
case
|
|
1419
|
+
case 1:
|
|
1197
1420
|
case "end":
|
|
1198
|
-
return
|
|
1421
|
+
return _context23.stop();
|
|
1199
1422
|
}
|
|
1200
|
-
},
|
|
1423
|
+
}, _callee23);
|
|
1201
1424
|
})));
|
|
1202
|
-
it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1425
|
+
it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1203
1426
|
var statusPayload, dummyEvent;
|
|
1204
|
-
return _regenerator.default.wrap(function
|
|
1205
|
-
while (1) switch (
|
|
1427
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
1428
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1206
1429
|
case 0:
|
|
1207
1430
|
statusPayload = {
|
|
1208
1431
|
statusCode: 200,
|
|
@@ -1239,16 +1462,16 @@ describe('State Machine handler tests', function () {
|
|
|
1239
1462
|
type: 'E_RECV_CALL_DISCONNECT'
|
|
1240
1463
|
});
|
|
1241
1464
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
1242
|
-
case
|
|
1465
|
+
case 1:
|
|
1243
1466
|
case "end":
|
|
1244
|
-
return
|
|
1467
|
+
return _context24.stop();
|
|
1245
1468
|
}
|
|
1246
|
-
},
|
|
1469
|
+
}, _callee24);
|
|
1247
1470
|
})));
|
|
1248
|
-
it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1471
|
+
it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
1249
1472
|
var statusPayload, dummyEvent, errorSpy;
|
|
1250
|
-
return _regenerator.default.wrap(function
|
|
1251
|
-
while (1) switch (
|
|
1473
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
1474
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1252
1475
|
case 0:
|
|
1253
1476
|
statusPayload = {
|
|
1254
1477
|
statusCode: 403,
|
|
@@ -1265,25 +1488,25 @@ describe('State Machine handler tests', function () {
|
|
|
1265
1488
|
webex.request.mockRejectedValueOnce(statusPayload);
|
|
1266
1489
|
errorSpy = jest.spyOn(_Logger.default, 'error');
|
|
1267
1490
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1268
|
-
|
|
1491
|
+
_context25.next = 1;
|
|
1269
1492
|
return (0, _testUtil.flushPromises)(3);
|
|
1270
|
-
case
|
|
1493
|
+
case 1:
|
|
1271
1494
|
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
1272
1495
|
expect(errorSpy).toHaveBeenCalled();
|
|
1273
1496
|
expect(uploadLogsSpy).toHaveBeenCalledWith({
|
|
1274
1497
|
correlationId: call.getCorrelationId(),
|
|
1275
1498
|
callId: call.getCallId()
|
|
1276
1499
|
});
|
|
1277
|
-
case
|
|
1500
|
+
case 2:
|
|
1278
1501
|
case "end":
|
|
1279
|
-
return
|
|
1502
|
+
return _context25.stop();
|
|
1280
1503
|
}
|
|
1281
|
-
},
|
|
1504
|
+
}, _callee25);
|
|
1282
1505
|
})));
|
|
1283
|
-
it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1506
|
+
it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
1284
1507
|
var statusPayload, dummyEvent, warnSpy;
|
|
1285
|
-
return _regenerator.default.wrap(function
|
|
1286
|
-
while (1) switch (
|
|
1508
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
1509
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1287
1510
|
case 0:
|
|
1288
1511
|
statusPayload = {
|
|
1289
1512
|
statusCode: 403,
|
|
@@ -1302,33 +1525,33 @@ describe('State Machine handler tests', function () {
|
|
|
1302
1525
|
webex.request.mockRejectedValue(statusPayload);
|
|
1303
1526
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1304
1527
|
jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
|
|
1305
|
-
|
|
1528
|
+
_context26.next = 1;
|
|
1306
1529
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1307
|
-
case
|
|
1308
|
-
|
|
1530
|
+
case 1:
|
|
1531
|
+
_context26.next = 2;
|
|
1309
1532
|
return (0, _testUtil.flushPromises)(2);
|
|
1310
|
-
case
|
|
1533
|
+
case 2:
|
|
1311
1534
|
expect(call.isConnected()).toBe(false);
|
|
1312
|
-
expect(call['mediaStateMachine'].state.value).toBe('
|
|
1313
|
-
expect(call['callStateMachine'].state.value).toBe('
|
|
1535
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
|
|
1536
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
|
|
1314
1537
|
expect(warnSpy).toHaveBeenCalledWith('Failed to process MediaOk request', {
|
|
1315
1538
|
file: 'call',
|
|
1316
1539
|
method: 'handleRoapEstablished'
|
|
1317
1540
|
});
|
|
1318
|
-
expect(
|
|
1319
|
-
|
|
1320
|
-
|
|
1541
|
+
expect(warnSpy).toHaveBeenCalledWith('Call failed due to media issue', {
|
|
1542
|
+
file: 'call',
|
|
1543
|
+
method: 'handleRoapError'
|
|
1321
1544
|
});
|
|
1322
|
-
case
|
|
1545
|
+
case 3:
|
|
1323
1546
|
case "end":
|
|
1324
|
-
return
|
|
1547
|
+
return _context26.stop();
|
|
1325
1548
|
}
|
|
1326
|
-
},
|
|
1549
|
+
}, _callee26);
|
|
1327
1550
|
})));
|
|
1328
|
-
it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1551
|
+
it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
1329
1552
|
var statusPayload, dummyEvent;
|
|
1330
|
-
return _regenerator.default.wrap(function
|
|
1331
|
-
while (1) switch (
|
|
1553
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
1554
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1332
1555
|
case 0:
|
|
1333
1556
|
statusPayload = {
|
|
1334
1557
|
statusCode: 403,
|
|
@@ -1349,16 +1572,16 @@ describe('State Machine handler tests', function () {
|
|
|
1349
1572
|
and an initiateOffer request to be sent to SDK only once */
|
|
1350
1573
|
expect(call['mediaStateMachine'].state.value).toBe('S_SEND_ROAP_OFFER');
|
|
1351
1574
|
expect(_testUtil.mediaConnection.initiateOffer).toBeCalledOnceWith();
|
|
1352
|
-
case
|
|
1575
|
+
case 1:
|
|
1353
1576
|
case "end":
|
|
1354
|
-
return
|
|
1577
|
+
return _context27.stop();
|
|
1355
1578
|
}
|
|
1356
|
-
},
|
|
1579
|
+
}, _callee27);
|
|
1357
1580
|
})));
|
|
1358
|
-
it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1581
|
+
it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
1359
1582
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1360
|
-
return _regenerator.default.wrap(function
|
|
1361
|
-
while (1) switch (
|
|
1583
|
+
return _regenerator.default.wrap(function (_context28) {
|
|
1584
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1362
1585
|
case 0:
|
|
1363
1586
|
statusPayload = {
|
|
1364
1587
|
statusCode: 503,
|
|
@@ -1380,9 +1603,9 @@ describe('State Machine handler tests', function () {
|
|
|
1380
1603
|
}
|
|
1381
1604
|
};
|
|
1382
1605
|
call['connected'] = true;
|
|
1383
|
-
|
|
1606
|
+
_context28.next = 1;
|
|
1384
1607
|
return call['handleOutgoingRoapOffer']({}, dummyEvent);
|
|
1385
|
-
case
|
|
1608
|
+
case 1:
|
|
1386
1609
|
jest.advanceTimersByTime(1005);
|
|
1387
1610
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
1388
1611
|
expect(funcSpy).toHaveBeenCalledWith(dummyEvent.data);
|
|
@@ -1390,16 +1613,16 @@ describe('State Machine handler tests', function () {
|
|
|
1390
1613
|
/* first failure , and second because of retry-after */
|
|
1391
1614
|
expect(funcSpy).toHaveBeenCalledTimes(2);
|
|
1392
1615
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
1393
|
-
case
|
|
1616
|
+
case 2:
|
|
1394
1617
|
case "end":
|
|
1395
|
-
return
|
|
1618
|
+
return _context28.stop();
|
|
1396
1619
|
}
|
|
1397
|
-
},
|
|
1620
|
+
}, _callee28);
|
|
1398
1621
|
})));
|
|
1399
|
-
it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1622
|
+
it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
1400
1623
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1401
|
-
return _regenerator.default.wrap(function
|
|
1402
|
-
while (1) switch (
|
|
1624
|
+
return _regenerator.default.wrap(function (_context29) {
|
|
1625
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1403
1626
|
case 0:
|
|
1404
1627
|
statusPayload = {
|
|
1405
1628
|
statusCode: 503,
|
|
@@ -1421,25 +1644,25 @@ describe('State Machine handler tests', function () {
|
|
|
1421
1644
|
}
|
|
1422
1645
|
};
|
|
1423
1646
|
call['connected'] = false;
|
|
1424
|
-
|
|
1647
|
+
_context29.next = 1;
|
|
1425
1648
|
return call['handleOutgoingRoapOffer']({}, dummyEvent);
|
|
1426
|
-
case
|
|
1649
|
+
case 1:
|
|
1427
1650
|
jest.advanceTimersByTime(1005);
|
|
1428
1651
|
expect(funcSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1429
1652
|
|
|
1430
1653
|
/* These shouldn't be called as call is not connected yet */
|
|
1431
1654
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
1432
1655
|
expect(stateMachineSpy).not.toBeCalled();
|
|
1433
|
-
case
|
|
1656
|
+
case 2:
|
|
1434
1657
|
case "end":
|
|
1435
|
-
return
|
|
1658
|
+
return _context29.stop();
|
|
1436
1659
|
}
|
|
1437
|
-
},
|
|
1660
|
+
}, _callee29);
|
|
1438
1661
|
})));
|
|
1439
|
-
it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1662
|
+
it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
1440
1663
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1441
|
-
return _regenerator.default.wrap(function
|
|
1442
|
-
while (1) switch (
|
|
1664
|
+
return _regenerator.default.wrap(function (_context30) {
|
|
1665
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1443
1666
|
case 0:
|
|
1444
1667
|
statusPayload = {
|
|
1445
1668
|
statusCode: 503,
|
|
@@ -1461,9 +1684,9 @@ describe('State Machine handler tests', function () {
|
|
|
1461
1684
|
};
|
|
1462
1685
|
call['connected'] = true;
|
|
1463
1686
|
call['mediaStateMachine'].state.value = 'S_RECV_ROAP_OFFER';
|
|
1464
|
-
|
|
1687
|
+
_context30.next = 1;
|
|
1465
1688
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
1466
|
-
case
|
|
1689
|
+
case 1:
|
|
1467
1690
|
jest.advanceTimersByTime(1005);
|
|
1468
1691
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
1469
1692
|
expect(funcSpy).toHaveBeenCalledWith(dummyEvent.data);
|
|
@@ -1471,16 +1694,16 @@ describe('State Machine handler tests', function () {
|
|
|
1471
1694
|
/* first failure , and second because of retry-after */
|
|
1472
1695
|
expect(funcSpy).toHaveBeenCalledTimes(2);
|
|
1473
1696
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
1474
|
-
case
|
|
1697
|
+
case 2:
|
|
1475
1698
|
case "end":
|
|
1476
|
-
return
|
|
1699
|
+
return _context30.stop();
|
|
1477
1700
|
}
|
|
1478
|
-
},
|
|
1701
|
+
}, _callee30);
|
|
1479
1702
|
})));
|
|
1480
|
-
it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1703
|
+
it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
1481
1704
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1482
|
-
return _regenerator.default.wrap(function
|
|
1483
|
-
while (1) switch (
|
|
1705
|
+
return _regenerator.default.wrap(function (_context31) {
|
|
1706
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1484
1707
|
case 0:
|
|
1485
1708
|
statusPayload = {
|
|
1486
1709
|
statusCode: 503,
|
|
@@ -1501,9 +1724,9 @@ describe('State Machine handler tests', function () {
|
|
|
1501
1724
|
}
|
|
1502
1725
|
};
|
|
1503
1726
|
call['connected'] = false;
|
|
1504
|
-
|
|
1727
|
+
_context31.next = 1;
|
|
1505
1728
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
1506
|
-
case
|
|
1729
|
+
case 1:
|
|
1507
1730
|
jest.advanceTimersByTime(1005);
|
|
1508
1731
|
expect(funcSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1509
1732
|
expect(funcSpy).toHaveBeenCalledTimes(1);
|
|
@@ -1511,16 +1734,16 @@ describe('State Machine handler tests', function () {
|
|
|
1511
1734
|
/* These shouldn't be called as call is not connected yet */
|
|
1512
1735
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
1513
1736
|
expect(stateMachineSpy).not.toBeCalled();
|
|
1514
|
-
case
|
|
1737
|
+
case 2:
|
|
1515
1738
|
case "end":
|
|
1516
|
-
return
|
|
1739
|
+
return _context31.stop();
|
|
1517
1740
|
}
|
|
1518
|
-
},
|
|
1741
|
+
}, _callee31);
|
|
1519
1742
|
})));
|
|
1520
|
-
it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1743
|
+
it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
|
|
1521
1744
|
var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
|
|
1522
|
-
return _regenerator.default.wrap(function
|
|
1523
|
-
while (1) switch (
|
|
1745
|
+
return _regenerator.default.wrap(function (_context32) {
|
|
1746
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1524
1747
|
case 0:
|
|
1525
1748
|
statusPayload = {
|
|
1526
1749
|
statusCode: 200,
|
|
@@ -1543,16 +1766,16 @@ describe('State Machine handler tests', function () {
|
|
|
1543
1766
|
expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
|
|
1544
1767
|
expect(warnSpy).not.toHaveBeenCalled();
|
|
1545
1768
|
expect(stateMachineSpy).not.toHaveBeenCalled();
|
|
1546
|
-
case
|
|
1769
|
+
case 1:
|
|
1547
1770
|
case "end":
|
|
1548
|
-
return
|
|
1771
|
+
return _context32.stop();
|
|
1549
1772
|
}
|
|
1550
|
-
},
|
|
1773
|
+
}, _callee32);
|
|
1551
1774
|
})));
|
|
1552
|
-
it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1775
|
+
it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
|
|
1553
1776
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1554
|
-
return _regenerator.default.wrap(function
|
|
1555
|
-
while (1) switch (
|
|
1777
|
+
return _regenerator.default.wrap(function (_context33) {
|
|
1778
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1556
1779
|
case 0:
|
|
1557
1780
|
statusPayload = {
|
|
1558
1781
|
statusCode: 503,
|
|
@@ -1574,9 +1797,9 @@ describe('State Machine handler tests', function () {
|
|
|
1574
1797
|
};
|
|
1575
1798
|
call['connected'] = true;
|
|
1576
1799
|
call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
|
|
1577
|
-
|
|
1800
|
+
_context33.next = 1;
|
|
1578
1801
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1579
|
-
case
|
|
1802
|
+
case 1:
|
|
1580
1803
|
jest.advanceTimersByTime(1005);
|
|
1581
1804
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
1582
1805
|
expect(funcSpy).toHaveBeenCalled();
|
|
@@ -1584,16 +1807,16 @@ describe('State Machine handler tests', function () {
|
|
|
1584
1807
|
/* first failure , and second because of retry-after */
|
|
1585
1808
|
expect(funcSpy).toHaveBeenCalledTimes(2);
|
|
1586
1809
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
1587
|
-
case
|
|
1810
|
+
case 2:
|
|
1588
1811
|
case "end":
|
|
1589
|
-
return
|
|
1812
|
+
return _context33.stop();
|
|
1590
1813
|
}
|
|
1591
|
-
},
|
|
1814
|
+
}, _callee33);
|
|
1592
1815
|
})));
|
|
1593
|
-
it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1816
|
+
it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
|
|
1594
1817
|
var statusPayload, stateMachineSpy, funcSpy, errorEvent;
|
|
1595
|
-
return _regenerator.default.wrap(function
|
|
1596
|
-
while (1) switch (
|
|
1818
|
+
return _regenerator.default.wrap(function (_context34) {
|
|
1819
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1597
1820
|
case 0:
|
|
1598
1821
|
statusPayload = {
|
|
1599
1822
|
statusCode: 403,
|
|
@@ -1614,16 +1837,16 @@ describe('State Machine handler tests', function () {
|
|
|
1614
1837
|
call.sendMediaStateMachineEvt(errorEvent);
|
|
1615
1838
|
expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
|
|
1616
1839
|
expect(stateMachineSpy).not.toHaveBeenCalled();
|
|
1617
|
-
case
|
|
1840
|
+
case 1:
|
|
1618
1841
|
case "end":
|
|
1619
|
-
return
|
|
1842
|
+
return _context34.stop();
|
|
1620
1843
|
}
|
|
1621
|
-
},
|
|
1844
|
+
}, _callee34);
|
|
1622
1845
|
})));
|
|
1623
|
-
it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1846
|
+
it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
|
|
1624
1847
|
var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
|
|
1625
|
-
return _regenerator.default.wrap(function
|
|
1626
|
-
while (1) switch (
|
|
1848
|
+
return _regenerator.default.wrap(function (_context35) {
|
|
1849
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1627
1850
|
case 0:
|
|
1628
1851
|
statusPayload = {
|
|
1629
1852
|
statusCode: 200,
|
|
@@ -1641,9 +1864,9 @@ describe('State Machine handler tests', function () {
|
|
|
1641
1864
|
}
|
|
1642
1865
|
};
|
|
1643
1866
|
call['connected'] = false;
|
|
1644
|
-
|
|
1867
|
+
_context35.next = 1;
|
|
1645
1868
|
return call['handleRoapError']({}, errorEvent);
|
|
1646
|
-
case
|
|
1869
|
+
case 1:
|
|
1647
1870
|
expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
|
|
1648
1871
|
expect(warnSpy).toBeCalledOnceWith('Call failed due to media issue', {
|
|
1649
1872
|
file: 'call',
|
|
@@ -1655,16 +1878,82 @@ describe('State Machine handler tests', function () {
|
|
|
1655
1878
|
},
|
|
1656
1879
|
type: 'E_UNKNOWN'
|
|
1657
1880
|
});
|
|
1658
|
-
case
|
|
1881
|
+
case 2:
|
|
1659
1882
|
case "end":
|
|
1660
|
-
return
|
|
1883
|
+
return _context35.stop();
|
|
1661
1884
|
}
|
|
1662
|
-
},
|
|
1885
|
+
}, _callee35);
|
|
1663
1886
|
})));
|
|
1664
|
-
it('
|
|
1887
|
+
it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
|
|
1888
|
+
var statusPayload, warnSpy, postMediaSpy, setupEvent, connectEvent, offerEvent, answerEvent;
|
|
1889
|
+
return _regenerator.default.wrap(function (_context36) {
|
|
1890
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1891
|
+
case 0:
|
|
1892
|
+
statusPayload = {
|
|
1893
|
+
statusCode: 403,
|
|
1894
|
+
body: mockStatusBody
|
|
1895
|
+
};
|
|
1896
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1897
|
+
postMediaSpy = jest.spyOn(call, 'postMedia').mockRejectedValueOnce(statusPayload); // Simulate inbound call flow
|
|
1898
|
+
call['direction'] = _types3.CallDirection.INBOUND;
|
|
1899
|
+
setupEvent = {
|
|
1900
|
+
type: 'E_RECV_CALL_SETUP',
|
|
1901
|
+
data: {
|
|
1902
|
+
seq: 1,
|
|
1903
|
+
messageType: 'OFFER'
|
|
1904
|
+
}
|
|
1905
|
+
};
|
|
1906
|
+
call.sendCallStateMachineEvt(setupEvent);
|
|
1907
|
+
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
|
|
1908
|
+
connectEvent = {
|
|
1909
|
+
type: 'E_SEND_CALL_CONNECT'
|
|
1910
|
+
};
|
|
1911
|
+
call.sendCallStateMachineEvt(connectEvent);
|
|
1912
|
+
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
|
|
1913
|
+
offerEvent = {
|
|
1914
|
+
type: 'E_RECV_ROAP_OFFER',
|
|
1915
|
+
data: {
|
|
1916
|
+
seq: 1,
|
|
1917
|
+
messageType: 'OFFER'
|
|
1918
|
+
}
|
|
1919
|
+
};
|
|
1920
|
+
call.sendMediaStateMachineEvt(offerEvent);
|
|
1921
|
+
answerEvent = {
|
|
1922
|
+
type: 'E_SEND_ROAP_ANSWER',
|
|
1923
|
+
data: {
|
|
1924
|
+
seq: 1,
|
|
1925
|
+
messageType: 'ANSWER'
|
|
1926
|
+
}
|
|
1927
|
+
};
|
|
1928
|
+
_context36.next = 1;
|
|
1929
|
+
return call.sendMediaStateMachineEvt(answerEvent);
|
|
1930
|
+
case 1:
|
|
1931
|
+
_context36.next = 2;
|
|
1932
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1933
|
+
case 2:
|
|
1934
|
+
expect(postMediaSpy).toBeCalledOnceWith(answerEvent.data);
|
|
1935
|
+
expect(warnSpy).toHaveBeenCalledWith('Failed to send MediaAnswer request', {
|
|
1936
|
+
file: 'call',
|
|
1937
|
+
method: 'handleOutgoingRoapAnswer'
|
|
1938
|
+
});
|
|
1939
|
+
expect(warnSpy).toHaveBeenCalledWith('Call failed due to media issue', {
|
|
1940
|
+
file: 'call',
|
|
1941
|
+
method: 'handleRoapError'
|
|
1942
|
+
});
|
|
1943
|
+
|
|
1944
|
+
// Final state should be torn down and cleared for unconnected call
|
|
1945
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
|
|
1946
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
|
|
1947
|
+
case 3:
|
|
1948
|
+
case "end":
|
|
1949
|
+
return _context36.stop();
|
|
1950
|
+
}
|
|
1951
|
+
}, _callee36);
|
|
1952
|
+
})));
|
|
1953
|
+
it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
|
|
1665
1954
|
var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
|
|
1666
|
-
return _regenerator.default.wrap(function
|
|
1667
|
-
while (1) switch (
|
|
1955
|
+
return _regenerator.default.wrap(function (_context37) {
|
|
1956
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1668
1957
|
case 0:
|
|
1669
1958
|
statusPayload = {
|
|
1670
1959
|
statusCode: 200,
|
|
@@ -1697,9 +1986,9 @@ describe('State Machine handler tests', function () {
|
|
|
1697
1986
|
seq: 1,
|
|
1698
1987
|
messageType: 'ANSWER'
|
|
1699
1988
|
};
|
|
1700
|
-
|
|
1989
|
+
_context37.next = 1;
|
|
1701
1990
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1702
|
-
case
|
|
1991
|
+
case 1:
|
|
1703
1992
|
expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1704
1993
|
|
|
1705
1994
|
/* we receive roap Offer Request followed by roap Ok from mobius and handle
|
|
@@ -1719,9 +2008,9 @@ describe('State Machine handler tests', function () {
|
|
|
1719
2008
|
seq: 2,
|
|
1720
2009
|
messageType: 'OFFER_REQUEST'
|
|
1721
2010
|
};
|
|
1722
|
-
|
|
2011
|
+
_context37.next = 2;
|
|
1723
2012
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1724
|
-
case
|
|
2013
|
+
case 2:
|
|
1725
2014
|
expect(call['receivedRoapOKSeq']).toBe(0);
|
|
1726
2015
|
expect(_testUtil.mediaConnection.roapMessageReceived).not.toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1727
2016
|
call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
@@ -1769,18 +2058,18 @@ describe('State Machine handler tests', function () {
|
|
|
1769
2058
|
};
|
|
1770
2059
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1771
2060
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1772
|
-
|
|
2061
|
+
_context37.next = 3;
|
|
1773
2062
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1774
|
-
case
|
|
2063
|
+
case 3:
|
|
1775
2064
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1776
2065
|
dummyEvent.type = 'E_SEND_ROAP_ANSWER';
|
|
1777
2066
|
dummyEvent.data = {
|
|
1778
2067
|
seq: 3,
|
|
1779
2068
|
messageType: 'ANSWER'
|
|
1780
2069
|
};
|
|
1781
|
-
|
|
2070
|
+
_context37.next = 4;
|
|
1782
2071
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1783
|
-
case
|
|
2072
|
+
case 4:
|
|
1784
2073
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1785
2074
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1786
2075
|
dummyEvent.data = {
|
|
@@ -1797,9 +2086,9 @@ describe('State Machine handler tests', function () {
|
|
|
1797
2086
|
messageType: 'OK'
|
|
1798
2087
|
}
|
|
1799
2088
|
};
|
|
1800
|
-
|
|
2089
|
+
_context37.next = 5;
|
|
1801
2090
|
return call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
1802
|
-
case
|
|
2091
|
+
case 5:
|
|
1803
2092
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
|
|
1804
2093
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1805
2094
|
dummyEvent.type = 'E_SEND_ROAP_ANSWER';
|
|
@@ -1810,16 +2099,16 @@ describe('State Machine handler tests', function () {
|
|
|
1810
2099
|
expect(call['mediaStateMachine'].state.value).toBe('S_RECV_ROAP_OFFER');
|
|
1811
2100
|
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1812
2101
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1813
|
-
case
|
|
2102
|
+
case 6:
|
|
1814
2103
|
case "end":
|
|
1815
|
-
return
|
|
2104
|
+
return _context37.stop();
|
|
1816
2105
|
}
|
|
1817
|
-
},
|
|
2106
|
+
}, _callee37);
|
|
1818
2107
|
})));
|
|
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
|
|
2108
|
+
it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
|
|
1820
2109
|
var mockStatusBody, statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
|
|
1821
|
-
return _regenerator.default.wrap(function
|
|
1822
|
-
while (1) switch (
|
|
2110
|
+
return _regenerator.default.wrap(function (_context38) {
|
|
2111
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1823
2112
|
case 0:
|
|
1824
2113
|
mockStatusBody = {
|
|
1825
2114
|
device: {
|
|
@@ -1859,9 +2148,9 @@ describe('State Machine handler tests', function () {
|
|
|
1859
2148
|
seq: 1,
|
|
1860
2149
|
messageType: 'ANSWER'
|
|
1861
2150
|
};
|
|
1862
|
-
|
|
2151
|
+
_context38.next = 1;
|
|
1863
2152
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1864
|
-
case
|
|
2153
|
+
case 1:
|
|
1865
2154
|
expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1866
2155
|
|
|
1867
2156
|
/* we receive roap Offer Request followed by roap Ok from mobius and handle
|
|
@@ -1881,9 +2170,9 @@ describe('State Machine handler tests', function () {
|
|
|
1881
2170
|
seq: 2,
|
|
1882
2171
|
messageType: 'OFFER_REQUEST'
|
|
1883
2172
|
};
|
|
1884
|
-
|
|
2173
|
+
_context38.next = 2;
|
|
1885
2174
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1886
|
-
case
|
|
2175
|
+
case 2:
|
|
1887
2176
|
expect(call['receivedRoapOKSeq']).toBe(0);
|
|
1888
2177
|
expect(_testUtil.mediaConnection.roapMessageReceived).not.toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1889
2178
|
call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
@@ -1931,18 +2220,18 @@ describe('State Machine handler tests', function () {
|
|
|
1931
2220
|
};
|
|
1932
2221
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1933
2222
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1934
|
-
|
|
2223
|
+
_context38.next = 3;
|
|
1935
2224
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1936
|
-
case
|
|
2225
|
+
case 3:
|
|
1937
2226
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1938
2227
|
dummyEvent.type = 'E_SEND_ROAP_ANSWER';
|
|
1939
2228
|
dummyEvent.data = {
|
|
1940
2229
|
seq: 3,
|
|
1941
2230
|
messageType: 'ANSWER'
|
|
1942
2231
|
};
|
|
1943
|
-
|
|
2232
|
+
_context38.next = 4;
|
|
1944
2233
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1945
|
-
case
|
|
2234
|
+
case 4:
|
|
1946
2235
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1947
2236
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1948
2237
|
dummyEvent.data = {
|
|
@@ -1957,9 +2246,9 @@ describe('State Machine handler tests', function () {
|
|
|
1957
2246
|
}
|
|
1958
2247
|
};
|
|
1959
2248
|
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1960
|
-
|
|
2249
|
+
_context38.next = 5;
|
|
1961
2250
|
return call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
1962
|
-
case
|
|
2251
|
+
case 5:
|
|
1963
2252
|
expect(call['receivedRoapOKSeq']).toBe(3);
|
|
1964
2253
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
|
|
1965
2254
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
@@ -1971,16 +2260,16 @@ describe('State Machine handler tests', function () {
|
|
|
1971
2260
|
expect(call['mediaStateMachine'].state.value).toBe('S_RECV_ROAP_OFFER');
|
|
1972
2261
|
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1973
2262
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1974
|
-
case
|
|
2263
|
+
case 6:
|
|
1975
2264
|
case "end":
|
|
1976
|
-
return
|
|
2265
|
+
return _context38.stop();
|
|
1977
2266
|
}
|
|
1978
|
-
},
|
|
2267
|
+
}, _callee38);
|
|
1979
2268
|
})));
|
|
1980
|
-
it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2269
|
+
it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
|
|
1981
2270
|
var statusPayload, dummyEvent, postMediaSpy, infoSpy, dummyOkEvent;
|
|
1982
|
-
return _regenerator.default.wrap(function
|
|
1983
|
-
while (1) switch (
|
|
2271
|
+
return _regenerator.default.wrap(function (_context39) {
|
|
2272
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1984
2273
|
case 0:
|
|
1985
2274
|
statusPayload = {
|
|
1986
2275
|
statusCode: 200,
|
|
@@ -2045,11 +2334,35 @@ describe('State Machine handler tests', function () {
|
|
|
2045
2334
|
file: 'call',
|
|
2046
2335
|
method: 'handleCallHold'
|
|
2047
2336
|
});
|
|
2048
|
-
case
|
|
2337
|
+
case 1:
|
|
2049
2338
|
case "end":
|
|
2050
|
-
return
|
|
2339
|
+
return _context39.stop();
|
|
2051
2340
|
}
|
|
2052
|
-
},
|
|
2341
|
+
}, _callee39);
|
|
2342
|
+
})));
|
|
2343
|
+
it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
|
|
2344
|
+
var emitSpy, deleteSpy;
|
|
2345
|
+
return _regenerator.default.wrap(function (_context40) {
|
|
2346
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
2347
|
+
case 0:
|
|
2348
|
+
emitSpy = jest.spyOn(call, 'emit');
|
|
2349
|
+
deleteSpy = jest.spyOn(call, 'delete').mockResolvedValue({
|
|
2350
|
+
statusCode: 200
|
|
2351
|
+
});
|
|
2352
|
+
call.sendCallStateMachineEvt({
|
|
2353
|
+
type: 'E_RECV_CALL_DISCONNECT'
|
|
2354
|
+
});
|
|
2355
|
+
_context40.next = 1;
|
|
2356
|
+
return (0, _testUtil.flushPromises)(1);
|
|
2357
|
+
case 1:
|
|
2358
|
+
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
2359
|
+
expect(deleteSpy).toHaveBeenCalled();
|
|
2360
|
+
expect(emitSpy.mock.invocationCallOrder[0]).toBeLessThan(deleteSpy.mock.invocationCallOrder[0]);
|
|
2361
|
+
case 2:
|
|
2362
|
+
case "end":
|
|
2363
|
+
return _context40.stop();
|
|
2364
|
+
}
|
|
2365
|
+
}, _callee40);
|
|
2053
2366
|
})));
|
|
2054
2367
|
describe('Call event timers tests', function () {
|
|
2055
2368
|
var callManager;
|
|
@@ -2060,10 +2373,10 @@ describe('State Machine handler tests', function () {
|
|
|
2060
2373
|
afterEach(function () {
|
|
2061
2374
|
jest.clearAllTimers();
|
|
2062
2375
|
});
|
|
2063
|
-
it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2376
|
+
it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
|
|
2064
2377
|
var statusPayload, dummyEvent, logSpy, emitSpy, deleteSpy, dummyOkEvent;
|
|
2065
|
-
return _regenerator.default.wrap(function
|
|
2066
|
-
while (1) switch (
|
|
2378
|
+
return _regenerator.default.wrap(function (_context41) {
|
|
2379
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
2067
2380
|
case 0:
|
|
2068
2381
|
statusPayload = {
|
|
2069
2382
|
statusCode: 200,
|
|
@@ -2080,9 +2393,9 @@ describe('State Machine handler tests', function () {
|
|
|
2080
2393
|
webex.request.mockReturnValue(statusPayload);
|
|
2081
2394
|
|
|
2082
2395
|
// handleOutgoingCallSetup is asynchronous
|
|
2083
|
-
|
|
2396
|
+
_context41.next = 1;
|
|
2084
2397
|
return call.sendCallStateMachineEvt(dummyEvent);
|
|
2085
|
-
case
|
|
2398
|
+
case 1:
|
|
2086
2399
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
|
|
2087
2400
|
dummyEvent.type = 'E_RECV_CALL_PROGRESS';
|
|
2088
2401
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
@@ -2121,16 +2434,16 @@ describe('State Machine handler tests', function () {
|
|
|
2121
2434
|
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
2122
2435
|
expect(deleteSpy).toHaveBeenCalledTimes(1);
|
|
2123
2436
|
expect(callManager.callCollection).toStrictEqual({});
|
|
2124
|
-
case
|
|
2437
|
+
case 2:
|
|
2125
2438
|
case "end":
|
|
2126
|
-
return
|
|
2439
|
+
return _context41.stop();
|
|
2127
2440
|
}
|
|
2128
|
-
},
|
|
2441
|
+
}, _callee41);
|
|
2129
2442
|
})));
|
|
2130
|
-
it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2443
|
+
it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
|
|
2131
2444
|
var statusPayload, dummyEvent, call, emitSpy, deleteSpy, logSpy;
|
|
2132
|
-
return _regenerator.default.wrap(function
|
|
2133
|
-
while (1) switch (
|
|
2445
|
+
return _regenerator.default.wrap(function (_context42) {
|
|
2446
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
2134
2447
|
case 0:
|
|
2135
2448
|
statusPayload = {
|
|
2136
2449
|
statusCode: 200,
|
|
@@ -2149,9 +2462,9 @@ describe('State Machine handler tests', function () {
|
|
|
2149
2462
|
expect((0, _keys.default)(callManager.callCollection)[0]).toBe(call.getCorrelationId());
|
|
2150
2463
|
|
|
2151
2464
|
// handleOutgoingCallSetup is asynchronous
|
|
2152
|
-
|
|
2465
|
+
_context42.next = 1;
|
|
2153
2466
|
return call.sendCallStateMachineEvt(dummyEvent);
|
|
2154
|
-
case
|
|
2467
|
+
case 1:
|
|
2155
2468
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
|
|
2156
2469
|
logSpy.mockClear();
|
|
2157
2470
|
jest.advanceTimersByTime(10000);
|
|
@@ -2159,11 +2472,11 @@ describe('State Machine handler tests', function () {
|
|
|
2159
2472
|
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
2160
2473
|
expect(deleteSpy).toHaveBeenCalledTimes(1);
|
|
2161
2474
|
expect(callManager.callCollection).toStrictEqual({});
|
|
2162
|
-
case
|
|
2475
|
+
case 2:
|
|
2163
2476
|
case "end":
|
|
2164
|
-
return
|
|
2477
|
+
return _context42.stop();
|
|
2165
2478
|
}
|
|
2166
|
-
},
|
|
2479
|
+
}, _callee42);
|
|
2167
2480
|
})));
|
|
2168
2481
|
});
|
|
2169
2482
|
});
|
|
@@ -2223,10 +2536,10 @@ describe('Supplementary Services tests', function () {
|
|
|
2223
2536
|
beforeEach(function () {
|
|
2224
2537
|
call.removeAllListeners();
|
|
2225
2538
|
});
|
|
2226
|
-
it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2539
|
+
it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
|
|
2227
2540
|
var responsePayload, warnSpy, roapEvent;
|
|
2228
|
-
return _regenerator.default.wrap(function
|
|
2229
|
-
while (1) switch (
|
|
2541
|
+
return _regenerator.default.wrap(function (_context44) {
|
|
2542
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
2230
2543
|
case 0:
|
|
2231
2544
|
expect.assertions(7);
|
|
2232
2545
|
responsePayload = {
|
|
@@ -2239,27 +2552,27 @@ describe('Supplementary Services tests', function () {
|
|
|
2239
2552
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2240
2553
|
call['held'] = false;
|
|
2241
2554
|
call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
|
|
2242
|
-
var
|
|
2243
|
-
return _regenerator.default.wrap(function
|
|
2244
|
-
while (1) switch (
|
|
2555
|
+
var _ref44 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43(correlationId) {
|
|
2556
|
+
return _regenerator.default.wrap(function (_context43) {
|
|
2557
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
2245
2558
|
case 0:
|
|
2246
2559
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2247
2560
|
case 1:
|
|
2248
2561
|
case "end":
|
|
2249
|
-
return
|
|
2562
|
+
return _context43.stop();
|
|
2250
2563
|
}
|
|
2251
|
-
},
|
|
2564
|
+
}, _callee43);
|
|
2252
2565
|
}));
|
|
2253
2566
|
return function (_x) {
|
|
2254
|
-
return
|
|
2567
|
+
return _ref44.apply(this, arguments);
|
|
2255
2568
|
};
|
|
2256
2569
|
}());
|
|
2257
|
-
|
|
2570
|
+
_context44.next = 1;
|
|
2258
2571
|
return call.doHoldResume();
|
|
2259
|
-
case
|
|
2260
|
-
|
|
2572
|
+
case 1:
|
|
2573
|
+
_context44.next = 2;
|
|
2261
2574
|
return (0, _testUtil.flushPromises)(2);
|
|
2262
|
-
case
|
|
2575
|
+
case 2:
|
|
2263
2576
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2264
2577
|
call.handleMidCallEvent(mockHeldEvent);
|
|
2265
2578
|
|
|
@@ -2273,13 +2586,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2273
2586
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2274
2587
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2275
2588
|
roapEvent.data.type = 'ANSWER';
|
|
2276
|
-
|
|
2589
|
+
_context44.next = 3;
|
|
2277
2590
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2278
|
-
case
|
|
2591
|
+
case 3:
|
|
2279
2592
|
roapEvent.data.type = 'OK';
|
|
2280
|
-
|
|
2593
|
+
_context44.next = 4;
|
|
2281
2594
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2282
|
-
case
|
|
2595
|
+
case 4:
|
|
2283
2596
|
expect(clearTimeout).toHaveBeenCalledTimes(1);
|
|
2284
2597
|
/* isHeld flag should be set and an Hold event should be emitted */
|
|
2285
2598
|
expect(call.isHeld()).toStrictEqual(true);
|
|
@@ -2290,16 +2603,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2290
2603
|
file: 'call',
|
|
2291
2604
|
method: 'handleCallHold'
|
|
2292
2605
|
});
|
|
2293
|
-
case
|
|
2606
|
+
case 5:
|
|
2294
2607
|
case "end":
|
|
2295
|
-
return
|
|
2608
|
+
return _context44.stop();
|
|
2296
2609
|
}
|
|
2297
|
-
},
|
|
2610
|
+
}, _callee44);
|
|
2298
2611
|
})));
|
|
2299
|
-
it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2612
|
+
it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
|
|
2300
2613
|
var responsePayload, warnSpy, roapEvent;
|
|
2301
|
-
return _regenerator.default.wrap(function
|
|
2302
|
-
while (1) switch (
|
|
2614
|
+
return _regenerator.default.wrap(function (_context46) {
|
|
2615
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
2303
2616
|
case 0:
|
|
2304
2617
|
expect.assertions(8);
|
|
2305
2618
|
responsePayload = {
|
|
@@ -2312,28 +2625,28 @@ describe('Supplementary Services tests', function () {
|
|
|
2312
2625
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2313
2626
|
call['held'] = false;
|
|
2314
2627
|
call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
|
|
2315
|
-
var
|
|
2316
|
-
return _regenerator.default.wrap(function
|
|
2317
|
-
while (1) switch (
|
|
2628
|
+
var _ref46 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45(correlationId) {
|
|
2629
|
+
return _regenerator.default.wrap(function (_context45) {
|
|
2630
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
2318
2631
|
case 0:
|
|
2319
2632
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2320
2633
|
case 1:
|
|
2321
2634
|
case "end":
|
|
2322
|
-
return
|
|
2635
|
+
return _context45.stop();
|
|
2323
2636
|
}
|
|
2324
|
-
},
|
|
2637
|
+
}, _callee45);
|
|
2325
2638
|
}));
|
|
2326
2639
|
return function (_x2) {
|
|
2327
|
-
return
|
|
2640
|
+
return _ref46.apply(this, arguments);
|
|
2328
2641
|
};
|
|
2329
2642
|
}());
|
|
2330
2643
|
call.doHoldResume();
|
|
2331
|
-
|
|
2644
|
+
_context46.next = 1;
|
|
2332
2645
|
return _promise.default.resolve();
|
|
2333
|
-
case
|
|
2334
|
-
|
|
2646
|
+
case 1:
|
|
2647
|
+
_context46.next = 2;
|
|
2335
2648
|
return _promise.default.resolve();
|
|
2336
|
-
case
|
|
2649
|
+
case 2:
|
|
2337
2650
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
2338
2651
|
call.handleMidCallEvent(mockHeldEvent);
|
|
2339
2652
|
|
|
@@ -2347,13 +2660,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2347
2660
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2348
2661
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2349
2662
|
roapEvent.data.type = 'ANSWER';
|
|
2350
|
-
|
|
2663
|
+
_context46.next = 3;
|
|
2351
2664
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2352
|
-
case
|
|
2665
|
+
case 3:
|
|
2353
2666
|
roapEvent.data.type = 'OK';
|
|
2354
|
-
|
|
2667
|
+
_context46.next = 4;
|
|
2355
2668
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2356
|
-
case
|
|
2669
|
+
case 4:
|
|
2357
2670
|
expect(clearTimeout).not.toHaveBeenCalled();
|
|
2358
2671
|
/* isHeld flag should be set and an Hold event should be emitted */
|
|
2359
2672
|
expect(call.isHeld()).toStrictEqual(true);
|
|
@@ -2364,16 +2677,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2364
2677
|
file: 'call',
|
|
2365
2678
|
method: 'handleCallHold'
|
|
2366
2679
|
});
|
|
2367
|
-
case
|
|
2680
|
+
case 5:
|
|
2368
2681
|
case "end":
|
|
2369
|
-
return
|
|
2682
|
+
return _context46.stop();
|
|
2370
2683
|
}
|
|
2371
|
-
},
|
|
2684
|
+
}, _callee46);
|
|
2372
2685
|
})));
|
|
2373
|
-
it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2686
|
+
it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48() {
|
|
2374
2687
|
var responsePayload;
|
|
2375
|
-
return _regenerator.default.wrap(function
|
|
2376
|
-
while (1) switch (
|
|
2688
|
+
return _regenerator.default.wrap(function (_context48) {
|
|
2689
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
2377
2690
|
case 0:
|
|
2378
2691
|
expect.assertions(4);
|
|
2379
2692
|
responsePayload = {
|
|
@@ -2383,43 +2696,43 @@ describe('Supplementary Services tests', function () {
|
|
|
2383
2696
|
jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
2384
2697
|
call['held'] = false;
|
|
2385
2698
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
2386
|
-
var
|
|
2387
|
-
return _regenerator.default.wrap(function
|
|
2388
|
-
while (1) switch (
|
|
2699
|
+
var _ref48 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47(errObj) {
|
|
2700
|
+
return _regenerator.default.wrap(function (_context47) {
|
|
2701
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
2389
2702
|
case 0:
|
|
2390
2703
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2391
2704
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2392
|
-
case
|
|
2705
|
+
case 1:
|
|
2393
2706
|
case "end":
|
|
2394
|
-
return
|
|
2707
|
+
return _context47.stop();
|
|
2395
2708
|
}
|
|
2396
|
-
},
|
|
2709
|
+
}, _callee47);
|
|
2397
2710
|
}));
|
|
2398
2711
|
return function (_x3) {
|
|
2399
|
-
return
|
|
2712
|
+
return _ref48.apply(this, arguments);
|
|
2400
2713
|
};
|
|
2401
2714
|
}());
|
|
2402
|
-
|
|
2715
|
+
_context48.next = 1;
|
|
2403
2716
|
return call.doHoldResume();
|
|
2404
|
-
case
|
|
2405
|
-
|
|
2717
|
+
case 1:
|
|
2718
|
+
_context48.next = 2;
|
|
2406
2719
|
return (0, _testUtil.flushPromises)(2);
|
|
2407
|
-
case
|
|
2720
|
+
case 2:
|
|
2408
2721
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2409
2722
|
|
|
2410
2723
|
/* At this point , the Call State should transition to S_CALL_ESTABLISHED
|
|
2411
2724
|
*/
|
|
2412
2725
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2413
|
-
case
|
|
2726
|
+
case 3:
|
|
2414
2727
|
case "end":
|
|
2415
|
-
return
|
|
2728
|
+
return _context48.stop();
|
|
2416
2729
|
}
|
|
2417
|
-
},
|
|
2730
|
+
}, _callee48);
|
|
2418
2731
|
})));
|
|
2419
|
-
it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2732
|
+
it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
|
|
2420
2733
|
var responsePayload, rejectPayload, roapEvent;
|
|
2421
|
-
return _regenerator.default.wrap(function
|
|
2422
|
-
while (1) switch (
|
|
2734
|
+
return _regenerator.default.wrap(function (_context50) {
|
|
2735
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
2423
2736
|
case 0:
|
|
2424
2737
|
expect.assertions(5);
|
|
2425
2738
|
responsePayload = {
|
|
@@ -2433,26 +2746,26 @@ describe('Supplementary Services tests', function () {
|
|
|
2433
2746
|
jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
|
|
2434
2747
|
call['held'] = false;
|
|
2435
2748
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
2436
|
-
var
|
|
2437
|
-
return _regenerator.default.wrap(function
|
|
2438
|
-
while (1) switch (
|
|
2749
|
+
var _ref50 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49(errObj) {
|
|
2750
|
+
return _regenerator.default.wrap(function (_context49) {
|
|
2751
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
2439
2752
|
case 0:
|
|
2440
2753
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2441
2754
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2442
|
-
case
|
|
2755
|
+
case 1:
|
|
2443
2756
|
case "end":
|
|
2444
|
-
return
|
|
2757
|
+
return _context49.stop();
|
|
2445
2758
|
}
|
|
2446
|
-
},
|
|
2759
|
+
}, _callee49);
|
|
2447
2760
|
}));
|
|
2448
2761
|
return function (_x4) {
|
|
2449
|
-
return
|
|
2762
|
+
return _ref50.apply(this, arguments);
|
|
2450
2763
|
};
|
|
2451
2764
|
}());
|
|
2452
2765
|
call.doHoldResume();
|
|
2453
|
-
|
|
2766
|
+
_context50.next = 1;
|
|
2454
2767
|
return (0, _testUtil.flushPromises)(2);
|
|
2455
|
-
case
|
|
2768
|
+
case 1:
|
|
2456
2769
|
/* the Call State should transition to S_CALL_ESTABLISHED
|
|
2457
2770
|
*/
|
|
2458
2771
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_HOLD');
|
|
@@ -2460,22 +2773,22 @@ describe('Supplementary Services tests', function () {
|
|
|
2460
2773
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2461
2774
|
/* We are intentionally failing the ROAP ANSWER */
|
|
2462
2775
|
roapEvent.data.type = 'ANSWER';
|
|
2463
|
-
|
|
2776
|
+
_context50.next = 2;
|
|
2464
2777
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2465
|
-
case
|
|
2778
|
+
case 2:
|
|
2466
2779
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2467
2780
|
/* We should return back to call established state */
|
|
2468
2781
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2469
|
-
case
|
|
2782
|
+
case 3:
|
|
2470
2783
|
case "end":
|
|
2471
|
-
return
|
|
2784
|
+
return _context50.stop();
|
|
2472
2785
|
}
|
|
2473
|
-
},
|
|
2786
|
+
}, _callee50);
|
|
2474
2787
|
})));
|
|
2475
|
-
it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2788
|
+
it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
|
|
2476
2789
|
var responsePayload, warnSpy, roapEvent;
|
|
2477
|
-
return _regenerator.default.wrap(function
|
|
2478
|
-
while (1) switch (
|
|
2790
|
+
return _regenerator.default.wrap(function (_context51) {
|
|
2791
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
2479
2792
|
case 0:
|
|
2480
2793
|
responsePayload = {
|
|
2481
2794
|
statusCode: 200,
|
|
@@ -2486,12 +2799,12 @@ describe('Supplementary Services tests', function () {
|
|
|
2486
2799
|
jest.spyOn(global, 'clearTimeout');
|
|
2487
2800
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2488
2801
|
call['held'] = false;
|
|
2489
|
-
|
|
2802
|
+
_context51.next = 1;
|
|
2490
2803
|
return call.doHoldResume();
|
|
2491
|
-
case
|
|
2492
|
-
|
|
2804
|
+
case 1:
|
|
2805
|
+
_context51.next = 2;
|
|
2493
2806
|
return (0, _testUtil.flushPromises)(2);
|
|
2494
|
-
case
|
|
2807
|
+
case 2:
|
|
2495
2808
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2496
2809
|
|
|
2497
2810
|
/* At this point, the Call State should be S_CALL_HOLD
|
|
@@ -2504,21 +2817,21 @@ describe('Supplementary Services tests', function () {
|
|
|
2504
2817
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2505
2818
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2506
2819
|
roapEvent.data.type = 'ANSWER';
|
|
2507
|
-
|
|
2820
|
+
_context51.next = 3;
|
|
2508
2821
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2509
|
-
case
|
|
2822
|
+
case 3:
|
|
2510
2823
|
jest.spyOn(webex, 'request').mockRejectedValue({
|
|
2511
2824
|
statusCode: 403
|
|
2512
2825
|
});
|
|
2513
2826
|
roapEvent.data.type = 'OK';
|
|
2514
|
-
|
|
2827
|
+
_context51.next = 4;
|
|
2515
2828
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2516
|
-
case
|
|
2829
|
+
case 4:
|
|
2517
2830
|
/* this is for coverage */
|
|
2518
2831
|
call['callStateMachine'].state.value = 'S_CALL_HOLD';
|
|
2519
|
-
|
|
2832
|
+
_context51.next = 5;
|
|
2520
2833
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2521
|
-
case
|
|
2834
|
+
case 5:
|
|
2522
2835
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2523
2836
|
/* We should return back to call established state */
|
|
2524
2837
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -2526,16 +2839,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2526
2839
|
file: 'call',
|
|
2527
2840
|
method: 'handleRoapEstablished'
|
|
2528
2841
|
});
|
|
2529
|
-
case
|
|
2842
|
+
case 6:
|
|
2530
2843
|
case "end":
|
|
2531
|
-
return
|
|
2844
|
+
return _context51.stop();
|
|
2532
2845
|
}
|
|
2533
|
-
},
|
|
2846
|
+
}, _callee51);
|
|
2534
2847
|
})));
|
|
2535
|
-
it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2848
|
+
it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
|
|
2536
2849
|
var responsePayload, warnSpy, roapEvent;
|
|
2537
|
-
return _regenerator.default.wrap(function
|
|
2538
|
-
while (1) switch (
|
|
2850
|
+
return _regenerator.default.wrap(function (_context52) {
|
|
2851
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
2539
2852
|
case 0:
|
|
2540
2853
|
responsePayload = {
|
|
2541
2854
|
statusCode: 200,
|
|
@@ -2546,12 +2859,12 @@ describe('Supplementary Services tests', function () {
|
|
|
2546
2859
|
jest.spyOn(global, 'clearTimeout');
|
|
2547
2860
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2548
2861
|
call['held'] = true;
|
|
2549
|
-
|
|
2862
|
+
_context52.next = 1;
|
|
2550
2863
|
return call.doHoldResume();
|
|
2551
|
-
case
|
|
2552
|
-
|
|
2864
|
+
case 1:
|
|
2865
|
+
_context52.next = 2;
|
|
2553
2866
|
return (0, _testUtil.flushPromises)(2);
|
|
2554
|
-
case
|
|
2867
|
+
case 2:
|
|
2555
2868
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2556
2869
|
|
|
2557
2870
|
/* At this point, the Call State should be S_CALL_RESUME
|
|
@@ -2564,16 +2877,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2564
2877
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2565
2878
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2566
2879
|
roapEvent.data.type = 'ANSWER';
|
|
2567
|
-
|
|
2880
|
+
_context52.next = 3;
|
|
2568
2881
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2569
|
-
case
|
|
2882
|
+
case 3:
|
|
2570
2883
|
jest.spyOn(webex, 'request').mockRejectedValue({
|
|
2571
2884
|
statusCode: 403
|
|
2572
2885
|
});
|
|
2573
2886
|
roapEvent.data.type = 'OK';
|
|
2574
|
-
|
|
2887
|
+
_context52.next = 4;
|
|
2575
2888
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2576
|
-
case
|
|
2889
|
+
case 4:
|
|
2577
2890
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2578
2891
|
/* We should return back to call established state */
|
|
2579
2892
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -2581,16 +2894,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2581
2894
|
file: 'call',
|
|
2582
2895
|
method: 'handleRoapEstablished'
|
|
2583
2896
|
});
|
|
2584
|
-
case
|
|
2897
|
+
case 5:
|
|
2585
2898
|
case "end":
|
|
2586
|
-
return
|
|
2899
|
+
return _context52.stop();
|
|
2587
2900
|
}
|
|
2588
|
-
},
|
|
2901
|
+
}, _callee52);
|
|
2589
2902
|
})));
|
|
2590
|
-
it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2903
|
+
it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54() {
|
|
2591
2904
|
var responsePayload, roapEvent;
|
|
2592
|
-
return _regenerator.default.wrap(function
|
|
2593
|
-
while (1) switch (
|
|
2905
|
+
return _regenerator.default.wrap(function (_context54) {
|
|
2906
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
2594
2907
|
case 0:
|
|
2595
2908
|
expect.assertions(5);
|
|
2596
2909
|
responsePayload = {
|
|
@@ -2600,27 +2913,27 @@ describe('Supplementary Services tests', function () {
|
|
|
2600
2913
|
jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
|
|
2601
2914
|
call['held'] = false;
|
|
2602
2915
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
2603
|
-
var
|
|
2604
|
-
return _regenerator.default.wrap(function
|
|
2605
|
-
while (1) switch (
|
|
2916
|
+
var _ref54 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53(errObj) {
|
|
2917
|
+
return _regenerator.default.wrap(function (_context53) {
|
|
2918
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
2606
2919
|
case 0:
|
|
2607
2920
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
|
|
2608
2921
|
expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
|
|
2609
|
-
case
|
|
2922
|
+
case 1:
|
|
2610
2923
|
case "end":
|
|
2611
|
-
return
|
|
2924
|
+
return _context53.stop();
|
|
2612
2925
|
}
|
|
2613
|
-
},
|
|
2926
|
+
}, _callee53);
|
|
2614
2927
|
}));
|
|
2615
2928
|
return function (_x5) {
|
|
2616
|
-
return
|
|
2929
|
+
return _ref54.apply(this, arguments);
|
|
2617
2930
|
};
|
|
2618
2931
|
}());
|
|
2619
2932
|
jest.runAllTimers();
|
|
2620
2933
|
call.doHoldResume();
|
|
2621
|
-
|
|
2934
|
+
_context54.next = 1;
|
|
2622
2935
|
return (0, _testUtil.flushPromises)(2);
|
|
2623
|
-
case
|
|
2936
|
+
case 1:
|
|
2624
2937
|
/* At this point, the Call State should be S_CALL_HOLD
|
|
2625
2938
|
*/
|
|
2626
2939
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_HOLD');
|
|
@@ -2631,13 +2944,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2631
2944
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2632
2945
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2633
2946
|
roapEvent.data.type = 'ANSWER';
|
|
2634
|
-
|
|
2947
|
+
_context54.next = 2;
|
|
2635
2948
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2636
|
-
case
|
|
2949
|
+
case 2:
|
|
2637
2950
|
roapEvent.data.type = 'OK';
|
|
2638
|
-
|
|
2951
|
+
_context54.next = 3;
|
|
2639
2952
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2640
|
-
case
|
|
2953
|
+
case 3:
|
|
2641
2954
|
/* Advancing timer by 12 seconds so that it gets timed out */
|
|
2642
2955
|
jest.advanceTimersByTime(12000);
|
|
2643
2956
|
|
|
@@ -2645,16 +2958,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2645
2958
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2646
2959
|
/* We should return back to call established state */
|
|
2647
2960
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2648
|
-
case
|
|
2961
|
+
case 4:
|
|
2649
2962
|
case "end":
|
|
2650
|
-
return
|
|
2963
|
+
return _context54.stop();
|
|
2651
2964
|
}
|
|
2652
|
-
},
|
|
2965
|
+
}, _callee54);
|
|
2653
2966
|
})));
|
|
2654
|
-
it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2967
|
+
it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56() {
|
|
2655
2968
|
var responsePayload, warnSpy, roapEvent;
|
|
2656
|
-
return _regenerator.default.wrap(function
|
|
2657
|
-
while (1) switch (
|
|
2969
|
+
return _regenerator.default.wrap(function (_context56) {
|
|
2970
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
2658
2971
|
case 0:
|
|
2659
2972
|
expect.assertions(7);
|
|
2660
2973
|
responsePayload = {
|
|
@@ -2667,27 +2980,27 @@ describe('Supplementary Services tests', function () {
|
|
|
2667
2980
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2668
2981
|
call['held'] = true;
|
|
2669
2982
|
call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
|
|
2670
|
-
var
|
|
2671
|
-
return _regenerator.default.wrap(function
|
|
2672
|
-
while (1) switch (
|
|
2983
|
+
var _ref56 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55(correlationId) {
|
|
2984
|
+
return _regenerator.default.wrap(function (_context55) {
|
|
2985
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
2673
2986
|
case 0:
|
|
2674
2987
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2675
2988
|
case 1:
|
|
2676
2989
|
case "end":
|
|
2677
|
-
return
|
|
2990
|
+
return _context55.stop();
|
|
2678
2991
|
}
|
|
2679
|
-
},
|
|
2992
|
+
}, _callee55);
|
|
2680
2993
|
}));
|
|
2681
2994
|
return function (_x6) {
|
|
2682
|
-
return
|
|
2995
|
+
return _ref56.apply(this, arguments);
|
|
2683
2996
|
};
|
|
2684
2997
|
}());
|
|
2685
|
-
|
|
2998
|
+
_context56.next = 1;
|
|
2686
2999
|
return call.doHoldResume();
|
|
2687
|
-
case
|
|
2688
|
-
|
|
3000
|
+
case 1:
|
|
3001
|
+
_context56.next = 2;
|
|
2689
3002
|
return (0, _testUtil.flushPromises)(2);
|
|
2690
|
-
case
|
|
3003
|
+
case 2:
|
|
2691
3004
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2692
3005
|
call.handleMidCallEvent(mockResumeEvent);
|
|
2693
3006
|
|
|
@@ -2701,13 +3014,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2701
3014
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2702
3015
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2703
3016
|
roapEvent.data.type = 'ANSWER';
|
|
2704
|
-
|
|
3017
|
+
_context56.next = 3;
|
|
2705
3018
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2706
|
-
case
|
|
3019
|
+
case 3:
|
|
2707
3020
|
roapEvent.data.type = 'OK';
|
|
2708
|
-
|
|
3021
|
+
_context56.next = 4;
|
|
2709
3022
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2710
|
-
case
|
|
3023
|
+
case 4:
|
|
2711
3024
|
expect(clearTimeout).toHaveBeenCalledTimes(1);
|
|
2712
3025
|
/* isHeld flag should not be set and an Resume event should be emitted */
|
|
2713
3026
|
expect(call.isHeld()).toStrictEqual(false);
|
|
@@ -2718,16 +3031,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2718
3031
|
file: 'call',
|
|
2719
3032
|
method: 'handleCallResume'
|
|
2720
3033
|
});
|
|
2721
|
-
case
|
|
3034
|
+
case 5:
|
|
2722
3035
|
case "end":
|
|
2723
|
-
return
|
|
3036
|
+
return _context56.stop();
|
|
2724
3037
|
}
|
|
2725
|
-
},
|
|
3038
|
+
}, _callee56);
|
|
2726
3039
|
})));
|
|
2727
|
-
it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3040
|
+
it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58() {
|
|
2728
3041
|
var responsePayload, warnSpy, roapEvent;
|
|
2729
|
-
return _regenerator.default.wrap(function
|
|
2730
|
-
while (1) switch (
|
|
3042
|
+
return _regenerator.default.wrap(function (_context58) {
|
|
3043
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
2731
3044
|
case 0:
|
|
2732
3045
|
expect.assertions(7);
|
|
2733
3046
|
responsePayload = {
|
|
@@ -2740,28 +3053,28 @@ describe('Supplementary Services tests', function () {
|
|
|
2740
3053
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2741
3054
|
call['held'] = true;
|
|
2742
3055
|
call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
|
|
2743
|
-
var
|
|
2744
|
-
return _regenerator.default.wrap(function
|
|
2745
|
-
while (1) switch (
|
|
3056
|
+
var _ref58 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57(correlationId) {
|
|
3057
|
+
return _regenerator.default.wrap(function (_context57) {
|
|
3058
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
2746
3059
|
case 0:
|
|
2747
3060
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2748
3061
|
case 1:
|
|
2749
3062
|
case "end":
|
|
2750
|
-
return
|
|
3063
|
+
return _context57.stop();
|
|
2751
3064
|
}
|
|
2752
|
-
},
|
|
3065
|
+
}, _callee57);
|
|
2753
3066
|
}));
|
|
2754
3067
|
return function (_x7) {
|
|
2755
|
-
return
|
|
3068
|
+
return _ref58.apply(this, arguments);
|
|
2756
3069
|
};
|
|
2757
3070
|
}());
|
|
2758
3071
|
call.doHoldResume();
|
|
2759
|
-
|
|
3072
|
+
_context58.next = 1;
|
|
2760
3073
|
return _promise.default.resolve();
|
|
2761
|
-
case
|
|
2762
|
-
|
|
3074
|
+
case 1:
|
|
3075
|
+
_context58.next = 2;
|
|
2763
3076
|
return _promise.default.resolve();
|
|
2764
|
-
case
|
|
3077
|
+
case 2:
|
|
2765
3078
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
2766
3079
|
call.handleMidCallEvent(mockResumeEvent);
|
|
2767
3080
|
|
|
@@ -2775,13 +3088,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2775
3088
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2776
3089
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2777
3090
|
roapEvent.data.type = 'ANSWER';
|
|
2778
|
-
|
|
3091
|
+
_context58.next = 3;
|
|
2779
3092
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2780
|
-
case
|
|
3093
|
+
case 3:
|
|
2781
3094
|
roapEvent.data.type = 'OK';
|
|
2782
|
-
|
|
3095
|
+
_context58.next = 4;
|
|
2783
3096
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2784
|
-
case
|
|
3097
|
+
case 4:
|
|
2785
3098
|
expect(clearTimeout).not.toHaveBeenCalled();
|
|
2786
3099
|
/* isHeld flag should not be set and an Resume event should be emitted */
|
|
2787
3100
|
expect(call.isHeld()).toStrictEqual(false);
|
|
@@ -2792,16 +3105,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2792
3105
|
file: 'call',
|
|
2793
3106
|
method: 'handleCallResume'
|
|
2794
3107
|
});
|
|
2795
|
-
case
|
|
3108
|
+
case 5:
|
|
2796
3109
|
case "end":
|
|
2797
|
-
return
|
|
3110
|
+
return _context58.stop();
|
|
2798
3111
|
}
|
|
2799
|
-
},
|
|
3112
|
+
}, _callee58);
|
|
2800
3113
|
})));
|
|
2801
|
-
it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3114
|
+
it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60() {
|
|
2802
3115
|
var responsePayload;
|
|
2803
|
-
return _regenerator.default.wrap(function
|
|
2804
|
-
while (1) switch (
|
|
3116
|
+
return _regenerator.default.wrap(function (_context60) {
|
|
3117
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
2805
3118
|
case 0:
|
|
2806
3119
|
expect.assertions(4);
|
|
2807
3120
|
responsePayload = {
|
|
@@ -2811,44 +3124,44 @@ describe('Supplementary Services tests', function () {
|
|
|
2811
3124
|
jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
2812
3125
|
call['held'] = true;
|
|
2813
3126
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2814
|
-
var
|
|
2815
|
-
return _regenerator.default.wrap(function
|
|
2816
|
-
while (1) switch (
|
|
3127
|
+
var _ref60 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59(errObj) {
|
|
3128
|
+
return _regenerator.default.wrap(function (_context59) {
|
|
3129
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
2817
3130
|
case 0:
|
|
2818
3131
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2819
3132
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2820
|
-
case
|
|
3133
|
+
case 1:
|
|
2821
3134
|
case "end":
|
|
2822
|
-
return
|
|
3135
|
+
return _context59.stop();
|
|
2823
3136
|
}
|
|
2824
|
-
},
|
|
3137
|
+
}, _callee59);
|
|
2825
3138
|
}));
|
|
2826
3139
|
return function (_x8) {
|
|
2827
|
-
return
|
|
3140
|
+
return _ref60.apply(this, arguments);
|
|
2828
3141
|
};
|
|
2829
3142
|
}());
|
|
2830
|
-
|
|
3143
|
+
_context60.next = 1;
|
|
2831
3144
|
return call.doHoldResume();
|
|
2832
|
-
case
|
|
2833
|
-
|
|
3145
|
+
case 1:
|
|
3146
|
+
_context60.next = 2;
|
|
2834
3147
|
return (0, _testUtil.flushPromises)(2);
|
|
2835
|
-
case
|
|
3148
|
+
case 2:
|
|
2836
3149
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2837
3150
|
|
|
2838
3151
|
/* At this point , the Call State should transition to S_CALL_ESTABLISHED
|
|
2839
3152
|
*/
|
|
2840
3153
|
|
|
2841
3154
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2842
|
-
case
|
|
3155
|
+
case 3:
|
|
2843
3156
|
case "end":
|
|
2844
|
-
return
|
|
3157
|
+
return _context60.stop();
|
|
2845
3158
|
}
|
|
2846
|
-
},
|
|
3159
|
+
}, _callee60);
|
|
2847
3160
|
})));
|
|
2848
|
-
it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3161
|
+
it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62() {
|
|
2849
3162
|
var responsePayload, rejectPayload, roapEvent;
|
|
2850
|
-
return _regenerator.default.wrap(function
|
|
2851
|
-
while (1) switch (
|
|
3163
|
+
return _regenerator.default.wrap(function (_context62) {
|
|
3164
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
2852
3165
|
case 0:
|
|
2853
3166
|
expect.assertions(5);
|
|
2854
3167
|
responsePayload = {
|
|
@@ -2862,26 +3175,26 @@ describe('Supplementary Services tests', function () {
|
|
|
2862
3175
|
jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
|
|
2863
3176
|
call['held'] = true;
|
|
2864
3177
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2865
|
-
var
|
|
2866
|
-
return _regenerator.default.wrap(function
|
|
2867
|
-
while (1) switch (
|
|
3178
|
+
var _ref62 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61(errObj) {
|
|
3179
|
+
return _regenerator.default.wrap(function (_context61) {
|
|
3180
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
2868
3181
|
case 0:
|
|
2869
3182
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2870
3183
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2871
|
-
case
|
|
3184
|
+
case 1:
|
|
2872
3185
|
case "end":
|
|
2873
|
-
return
|
|
3186
|
+
return _context61.stop();
|
|
2874
3187
|
}
|
|
2875
|
-
},
|
|
3188
|
+
}, _callee61);
|
|
2876
3189
|
}));
|
|
2877
3190
|
return function (_x9) {
|
|
2878
|
-
return
|
|
3191
|
+
return _ref62.apply(this, arguments);
|
|
2879
3192
|
};
|
|
2880
3193
|
}());
|
|
2881
3194
|
call.doHoldResume();
|
|
2882
|
-
|
|
3195
|
+
_context62.next = 1;
|
|
2883
3196
|
return (0, _testUtil.flushPromises)(2);
|
|
2884
|
-
case
|
|
3197
|
+
case 1:
|
|
2885
3198
|
/* At this point , the Call State should transition to S_CALL_ESTABLISHED
|
|
2886
3199
|
*/
|
|
2887
3200
|
|
|
@@ -2890,22 +3203,22 @@ describe('Supplementary Services tests', function () {
|
|
|
2890
3203
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2891
3204
|
/* We are intentionally failing the ROAP ANSWER */
|
|
2892
3205
|
roapEvent.data.type = 'ANSWER';
|
|
2893
|
-
|
|
3206
|
+
_context62.next = 2;
|
|
2894
3207
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2895
|
-
case
|
|
3208
|
+
case 2:
|
|
2896
3209
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2897
3210
|
/* We should return back to call established state */
|
|
2898
3211
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2899
|
-
case
|
|
3212
|
+
case 3:
|
|
2900
3213
|
case "end":
|
|
2901
|
-
return
|
|
3214
|
+
return _context62.stop();
|
|
2902
3215
|
}
|
|
2903
|
-
},
|
|
3216
|
+
}, _callee62);
|
|
2904
3217
|
})));
|
|
2905
|
-
it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3218
|
+
it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64() {
|
|
2906
3219
|
var responsePayload, roapEvent;
|
|
2907
|
-
return _regenerator.default.wrap(function
|
|
2908
|
-
while (1) switch (
|
|
3220
|
+
return _regenerator.default.wrap(function (_context64) {
|
|
3221
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
2909
3222
|
case 0:
|
|
2910
3223
|
expect.assertions(5);
|
|
2911
3224
|
responsePayload = {
|
|
@@ -2915,26 +3228,26 @@ describe('Supplementary Services tests', function () {
|
|
|
2915
3228
|
jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
|
|
2916
3229
|
call['held'] = true;
|
|
2917
3230
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2918
|
-
var
|
|
2919
|
-
return _regenerator.default.wrap(function
|
|
2920
|
-
while (1) switch (
|
|
3231
|
+
var _ref64 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63(errObj) {
|
|
3232
|
+
return _regenerator.default.wrap(function (_context63) {
|
|
3233
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
2921
3234
|
case 0:
|
|
2922
3235
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
|
|
2923
3236
|
expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
|
|
2924
|
-
case
|
|
3237
|
+
case 1:
|
|
2925
3238
|
case "end":
|
|
2926
|
-
return
|
|
3239
|
+
return _context63.stop();
|
|
2927
3240
|
}
|
|
2928
|
-
},
|
|
3241
|
+
}, _callee63);
|
|
2929
3242
|
}));
|
|
2930
3243
|
return function (_x0) {
|
|
2931
|
-
return
|
|
3244
|
+
return _ref64.apply(this, arguments);
|
|
2932
3245
|
};
|
|
2933
3246
|
}());
|
|
2934
3247
|
call.doHoldResume();
|
|
2935
|
-
|
|
3248
|
+
_context64.next = 1;
|
|
2936
3249
|
return (0, _testUtil.flushPromises)(2);
|
|
2937
|
-
case
|
|
3250
|
+
case 1:
|
|
2938
3251
|
/* At this point ,the Call State should be S_CALL_RESUME
|
|
2939
3252
|
*/
|
|
2940
3253
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_RESUME');
|
|
@@ -2945,23 +3258,23 @@ describe('Supplementary Services tests', function () {
|
|
|
2945
3258
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2946
3259
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2947
3260
|
roapEvent.data.type = 'ANSWER';
|
|
2948
|
-
|
|
3261
|
+
_context64.next = 2;
|
|
2949
3262
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2950
|
-
case
|
|
3263
|
+
case 2:
|
|
2951
3264
|
roapEvent.data.type = 'OK';
|
|
2952
|
-
|
|
3265
|
+
_context64.next = 3;
|
|
2953
3266
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2954
|
-
case
|
|
3267
|
+
case 3:
|
|
2955
3268
|
/* Advancing timer by 12 seconds so that it gets timed out */
|
|
2956
3269
|
jest.advanceTimersByTime(12000);
|
|
2957
3270
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2958
3271
|
/* We should return back to call established state */
|
|
2959
3272
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2960
|
-
case
|
|
3273
|
+
case 4:
|
|
2961
3274
|
case "end":
|
|
2962
|
-
return
|
|
3275
|
+
return _context64.stop();
|
|
2963
3276
|
}
|
|
2964
|
-
},
|
|
3277
|
+
}, _callee64);
|
|
2965
3278
|
})));
|
|
2966
3279
|
});
|
|
2967
3280
|
describe('Call transfer tests', function () {
|
|
@@ -2994,10 +3307,10 @@ describe('Supplementary Services tests', function () {
|
|
|
2994
3307
|
secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
|
|
2995
3308
|
secondCall['held'] = false;
|
|
2996
3309
|
});
|
|
2997
|
-
it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3310
|
+
it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67() {
|
|
2998
3311
|
var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
|
|
2999
|
-
return _regenerator.default.wrap(function
|
|
3000
|
-
while (1) switch (
|
|
3312
|
+
return _regenerator.default.wrap(function (_context67) {
|
|
3313
|
+
while (1) switch (_context67.prev = _context67.next) {
|
|
3001
3314
|
case 0:
|
|
3002
3315
|
expect.assertions(12); // Updated to match actual assertion count
|
|
3003
3316
|
responsePayload = {
|
|
@@ -3009,43 +3322,43 @@ describe('Supplementary Services tests', function () {
|
|
|
3009
3322
|
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
3010
3323
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3011
3324
|
call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
3012
|
-
var
|
|
3013
|
-
return _regenerator.default.wrap(function
|
|
3014
|
-
while (1) switch (
|
|
3325
|
+
var _ref66 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65(correlationId) {
|
|
3326
|
+
return _regenerator.default.wrap(function (_context65) {
|
|
3327
|
+
while (1) switch (_context65.prev = _context65.next) {
|
|
3015
3328
|
case 0:
|
|
3016
3329
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
3017
3330
|
case 1:
|
|
3018
3331
|
case "end":
|
|
3019
|
-
return
|
|
3332
|
+
return _context65.stop();
|
|
3020
3333
|
}
|
|
3021
|
-
},
|
|
3334
|
+
}, _callee65);
|
|
3022
3335
|
}));
|
|
3023
3336
|
return function (_x1) {
|
|
3024
|
-
return
|
|
3337
|
+
return _ref66.apply(this, arguments);
|
|
3025
3338
|
};
|
|
3026
3339
|
}());
|
|
3027
3340
|
secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
3028
|
-
var
|
|
3029
|
-
return _regenerator.default.wrap(function
|
|
3030
|
-
while (1) switch (
|
|
3341
|
+
var _ref67 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66(correlationId) {
|
|
3342
|
+
return _regenerator.default.wrap(function (_context66) {
|
|
3343
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
3031
3344
|
case 0:
|
|
3032
3345
|
expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
|
|
3033
3346
|
case 1:
|
|
3034
3347
|
case "end":
|
|
3035
|
-
return
|
|
3348
|
+
return _context66.stop();
|
|
3036
3349
|
}
|
|
3037
|
-
},
|
|
3350
|
+
}, _callee66);
|
|
3038
3351
|
}));
|
|
3039
3352
|
return function (_x10) {
|
|
3040
|
-
return
|
|
3353
|
+
return _ref67.apply(this, arguments);
|
|
3041
3354
|
};
|
|
3042
3355
|
}());
|
|
3043
|
-
|
|
3356
|
+
_context67.next = 1;
|
|
3044
3357
|
return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
|
|
3045
|
-
case
|
|
3046
|
-
|
|
3358
|
+
case 1:
|
|
3359
|
+
_context67.next = 2;
|
|
3047
3360
|
return (0, _testUtil.flushPromises)(2);
|
|
3048
|
-
case
|
|
3361
|
+
case 2:
|
|
3049
3362
|
expect(requestSpy).toBeCalled();
|
|
3050
3363
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined);
|
|
3051
3364
|
call.sendCallStateMachineEvt({
|
|
@@ -3064,16 +3377,16 @@ describe('Supplementary Services tests', function () {
|
|
|
3064
3377
|
expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3065
3378
|
expect(infoSpy).toHaveBeenCalledWith("Initiating Consult transfer between : ".concat(call.getCallId(), " and ").concat(secondCall.getCallId()), transferLoggingContext);
|
|
3066
3379
|
expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3067
|
-
case
|
|
3380
|
+
case 3:
|
|
3068
3381
|
case "end":
|
|
3069
|
-
return
|
|
3382
|
+
return _context67.stop();
|
|
3070
3383
|
}
|
|
3071
|
-
},
|
|
3384
|
+
}, _callee67);
|
|
3072
3385
|
})));
|
|
3073
|
-
it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3386
|
+
it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69() {
|
|
3074
3387
|
var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
|
|
3075
|
-
return _regenerator.default.wrap(function
|
|
3076
|
-
while (1) switch (
|
|
3388
|
+
return _regenerator.default.wrap(function (_context69) {
|
|
3389
|
+
while (1) switch (_context69.prev = _context69.next) {
|
|
3077
3390
|
case 0:
|
|
3078
3391
|
expect.assertions(10); // Updated to match actual assertion count
|
|
3079
3392
|
responsePayload = {
|
|
@@ -3085,27 +3398,27 @@ describe('Supplementary Services tests', function () {
|
|
|
3085
3398
|
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
3086
3399
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3087
3400
|
call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
3088
|
-
var
|
|
3089
|
-
return _regenerator.default.wrap(function
|
|
3090
|
-
while (1) switch (
|
|
3401
|
+
var _ref69 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68(correlationId) {
|
|
3402
|
+
return _regenerator.default.wrap(function (_context68) {
|
|
3403
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
3091
3404
|
case 0:
|
|
3092
3405
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
3093
3406
|
case 1:
|
|
3094
3407
|
case "end":
|
|
3095
|
-
return
|
|
3408
|
+
return _context68.stop();
|
|
3096
3409
|
}
|
|
3097
|
-
},
|
|
3410
|
+
}, _callee68);
|
|
3098
3411
|
}));
|
|
3099
3412
|
return function (_x11) {
|
|
3100
|
-
return
|
|
3413
|
+
return _ref69.apply(this, arguments);
|
|
3101
3414
|
};
|
|
3102
3415
|
}());
|
|
3103
|
-
|
|
3416
|
+
_context69.next = 1;
|
|
3104
3417
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
|
|
3105
|
-
case
|
|
3106
|
-
|
|
3418
|
+
case 1:
|
|
3419
|
+
_context69.next = 2;
|
|
3107
3420
|
return (0, _testUtil.flushPromises)(2);
|
|
3108
|
-
case
|
|
3421
|
+
case 2:
|
|
3109
3422
|
expect(requestSpy).toBeCalled();
|
|
3110
3423
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined);
|
|
3111
3424
|
call.sendCallStateMachineEvt({
|
|
@@ -3120,16 +3433,16 @@ describe('Supplementary Services tests', function () {
|
|
|
3120
3433
|
expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3121
3434
|
expect(infoSpy).toHaveBeenCalledWith("Initiating Blind transfer with : ".concat(transfereeNumber), transferLoggingContext);
|
|
3122
3435
|
expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3123
|
-
case
|
|
3436
|
+
case 3:
|
|
3124
3437
|
case "end":
|
|
3125
|
-
return
|
|
3438
|
+
return _context69.stop();
|
|
3126
3439
|
}
|
|
3127
|
-
},
|
|
3440
|
+
}, _callee69);
|
|
3128
3441
|
})));
|
|
3129
|
-
it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3442
|
+
it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
|
|
3130
3443
|
var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
|
|
3131
|
-
return _regenerator.default.wrap(function
|
|
3132
|
-
while (1) switch (
|
|
3444
|
+
return _regenerator.default.wrap(function (_context70) {
|
|
3445
|
+
while (1) switch (_context70.prev = _context70.next) {
|
|
3133
3446
|
case 0:
|
|
3134
3447
|
responsePayload = {
|
|
3135
3448
|
statusCode: 403,
|
|
@@ -3140,12 +3453,12 @@ describe('Supplementary Services tests', function () {
|
|
|
3140
3453
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3141
3454
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3142
3455
|
call['broadworksCorrelationInfo'] = 'dummy-broadworks-correlation-info';
|
|
3143
|
-
|
|
3456
|
+
_context70.next = 1;
|
|
3144
3457
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
|
|
3145
|
-
case
|
|
3146
|
-
|
|
3458
|
+
case 1:
|
|
3459
|
+
_context70.next = 2;
|
|
3147
3460
|
return (0, _testUtil.flushPromises)(1);
|
|
3148
|
-
case
|
|
3461
|
+
case 2:
|
|
3149
3462
|
expect(requestSpy).toBeCalled();
|
|
3150
3463
|
/* We should be in CALL_ESTABLISHED state */
|
|
3151
3464
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3162,16 +3475,16 @@ describe('Supplementary Services tests', function () {
|
|
|
3162
3475
|
expect(emitSpy).toBeCalledOnceWith(_types2.CALL_EVENT_KEYS.TRANSFER_ERROR, expect.any(_Errors.CallError));
|
|
3163
3476
|
expect(warnSpy).toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3164
3477
|
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
|
|
3478
|
+
case 3:
|
|
3166
3479
|
case "end":
|
|
3167
|
-
return
|
|
3480
|
+
return _context70.stop();
|
|
3168
3481
|
}
|
|
3169
|
-
},
|
|
3482
|
+
}, _callee70);
|
|
3170
3483
|
})));
|
|
3171
|
-
it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3484
|
+
it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
|
|
3172
3485
|
var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
|
|
3173
|
-
return _regenerator.default.wrap(function
|
|
3174
|
-
while (1) switch (
|
|
3486
|
+
return _regenerator.default.wrap(function (_context71) {
|
|
3487
|
+
while (1) switch (_context71.prev = _context71.next) {
|
|
3175
3488
|
case 0:
|
|
3176
3489
|
responsePayload = {
|
|
3177
3490
|
statusCode: 403,
|
|
@@ -3181,12 +3494,12 @@ describe('Supplementary Services tests', function () {
|
|
|
3181
3494
|
requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
3182
3495
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3183
3496
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3184
|
-
|
|
3497
|
+
_context71.next = 1;
|
|
3185
3498
|
return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
|
|
3186
|
-
case
|
|
3187
|
-
|
|
3499
|
+
case 1:
|
|
3500
|
+
_context71.next = 2;
|
|
3188
3501
|
return (0, _testUtil.flushPromises)(2);
|
|
3189
|
-
case
|
|
3502
|
+
case 2:
|
|
3190
3503
|
expect(requestSpy).toBeCalled();
|
|
3191
3504
|
/* We should be in CALL_ESTABLISHED state */
|
|
3192
3505
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3203,22 +3516,22 @@ describe('Supplementary Services tests', function () {
|
|
|
3203
3516
|
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.TRANSFER_ERROR, expect.any(_Errors.CallError));
|
|
3204
3517
|
expect(warnSpy).toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3205
3518
|
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
|
|
3519
|
+
case 3:
|
|
3207
3520
|
case "end":
|
|
3208
|
-
return
|
|
3521
|
+
return _context71.stop();
|
|
3209
3522
|
}
|
|
3210
|
-
},
|
|
3523
|
+
}, _callee71);
|
|
3211
3524
|
})));
|
|
3212
|
-
it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3525
|
+
it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
|
|
3213
3526
|
var requestSpy, warnSpy;
|
|
3214
|
-
return _regenerator.default.wrap(function
|
|
3215
|
-
while (1) switch (
|
|
3527
|
+
return _regenerator.default.wrap(function (_context72) {
|
|
3528
|
+
while (1) switch (_context72.prev = _context72.next) {
|
|
3216
3529
|
case 0:
|
|
3217
3530
|
requestSpy = jest.spyOn(webex, 'request');
|
|
3218
3531
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3219
|
-
|
|
3532
|
+
_context72.next = 1;
|
|
3220
3533
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
|
|
3221
|
-
case
|
|
3534
|
+
case 1:
|
|
3222
3535
|
/* We should be in CALL_ESTABLISHED state */
|
|
3223
3536
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
3224
3537
|
expect(secondCall['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3226,22 +3539,22 @@ describe('Supplementary Services tests', function () {
|
|
|
3226
3539
|
expect(uploadLogsSpy).not.toBeCalled();
|
|
3227
3540
|
expect(requestSpy).not.toBeCalled();
|
|
3228
3541
|
expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3229
|
-
case
|
|
3542
|
+
case 2:
|
|
3230
3543
|
case "end":
|
|
3231
|
-
return
|
|
3544
|
+
return _context72.stop();
|
|
3232
3545
|
}
|
|
3233
|
-
},
|
|
3546
|
+
}, _callee72);
|
|
3234
3547
|
})));
|
|
3235
|
-
it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3548
|
+
it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee73() {
|
|
3236
3549
|
var requestSpy, warnSpy;
|
|
3237
|
-
return _regenerator.default.wrap(function
|
|
3238
|
-
while (1) switch (
|
|
3550
|
+
return _regenerator.default.wrap(function (_context73) {
|
|
3551
|
+
while (1) switch (_context73.prev = _context73.next) {
|
|
3239
3552
|
case 0:
|
|
3240
3553
|
requestSpy = jest.spyOn(webex, 'request');
|
|
3241
3554
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3242
|
-
|
|
3555
|
+
_context73.next = 1;
|
|
3243
3556
|
return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
|
|
3244
|
-
case
|
|
3557
|
+
case 1:
|
|
3245
3558
|
/* We should be in CALL_ESTABLISHED state */
|
|
3246
3559
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
3247
3560
|
expect(secondCall['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3249,11 +3562,11 @@ describe('Supplementary Services tests', function () {
|
|
|
3249
3562
|
expect(uploadLogsSpy).not.toBeCalled();
|
|
3250
3563
|
expect(requestSpy).not.toBeCalled();
|
|
3251
3564
|
expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3252
|
-
case
|
|
3565
|
+
case 2:
|
|
3253
3566
|
case "end":
|
|
3254
|
-
return
|
|
3567
|
+
return _context73.stop();
|
|
3255
3568
|
}
|
|
3256
|
-
},
|
|
3569
|
+
}, _callee73);
|
|
3257
3570
|
})));
|
|
3258
3571
|
});
|
|
3259
3572
|
});
|