@webex/calling 3.0.0-next.9 → 3.0.1-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallHistory/CallHistory.js +48 -48
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +9 -0
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallHistory/callHistoryFixtures.js +63 -7
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
- package/dist/CallHistory/constants.js +9 -18
- package/dist/CallHistory/constants.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +18 -13
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +7 -8
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +69 -37
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +19 -13
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +2 -2
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/constants.js +11 -22
- package/dist/CallSettings/constants.js.map +1 -1
- package/dist/CallSettings/testFixtures.js +4 -8
- package/dist/CallSettings/testFixtures.js.map +1 -1
- package/dist/CallSettings/types.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +108 -64
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +170 -109
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/callRecordFixtures.js +2 -4
- package/dist/CallingClient/callRecordFixtures.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +9 -29
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +200 -78
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +762 -414
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +3 -5
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +1 -1
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/types.js +31 -33
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/callingClientFixtures.js +107 -17
- package/dist/CallingClient/callingClientFixtures.js.map +1 -1
- package/dist/CallingClient/constants.js +103 -193
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +18 -17
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +13 -13
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/line/types.js +7 -14
- package/dist/CallingClient/line/types.js.map +1 -1
- package/dist/CallingClient/registration/register.js +90 -71
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +33 -32
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/registerFixtures.js +5 -10
- package/dist/CallingClient/registration/registerFixtures.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +30 -19
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +4 -4
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Contacts/constants.js +10 -18
- package/dist/Contacts/constants.js.map +1 -1
- package/dist/Contacts/contactFixtures.js +26 -52
- package/dist/Contacts/contactFixtures.js.map +1 -1
- package/dist/Contacts/types.js +29 -9
- package/dist/Contacts/types.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +3 -5
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +4 -6
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +2 -3
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +5 -7
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Errors/index.js +7 -0
- package/dist/Errors/index.js.map +1 -1
- package/dist/Errors/types.js +15 -20
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/impl/index.js +2 -3
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Events/types.js +44 -52
- package/dist/Events/types.js.map +1 -1
- package/dist/Logger/index.js +1 -2
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/Logger/types.js +9 -12
- package/dist/Logger/types.js.map +1 -1
- package/dist/Metrics/index.js +32 -4
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +55 -5
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/Metrics/types.js +17 -20
- package/dist/Metrics/types.js.map +1 -1
- package/dist/SDKConnector/index.js +1 -2
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/SDKConnector/utils.js +1 -2
- package/dist/SDKConnector/utils.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +21 -12
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +2 -2
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +19 -11
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +5 -4
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +17 -12
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +17 -10
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +4 -4
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/constants.js +29 -58
- package/dist/Voicemail/constants.js.map +1 -1
- package/dist/Voicemail/voicemailFixture.js +35 -70
- package/dist/Voicemail/voicemailFixture.js.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +18 -25
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +3 -3
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +41 -82
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +12 -21
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js +34 -43
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +246 -0
- package/dist/index.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +7 -5
- package/dist/module/CallHistory/callHistoryFixtures.js +59 -0
- package/dist/module/CallSettings/UcmBackendConnector.js +4 -4
- package/dist/module/CallingClient/CallingClient.js +59 -42
- package/dist/module/CallingClient/calling/CallerId/index.js +3 -23
- package/dist/module/CallingClient/calling/call.js +126 -32
- package/dist/module/CallingClient/callingClientFixtures.js +119 -1
- package/dist/module/CallingClient/constants.js +9 -4
- package/dist/module/CallingClient/line/index.js +9 -12
- package/dist/module/CallingClient/line/types.js +0 -5
- package/dist/module/CallingClient/registration/register.js +28 -20
- package/dist/module/Errors/catalog/CallingDeviceError.js +2 -2
- package/dist/module/Errors/catalog/LineError.js +2 -2
- package/dist/module/Errors/index.js +1 -0
- package/dist/module/Events/types.js +2 -0
- package/dist/module/Metrics/index.js +28 -0
- package/dist/module/Metrics/types.js +2 -0
- package/dist/module/common/Utils.js +14 -19
- package/dist/module/common/testUtil.js +2 -1
- package/dist/module/common/types.js +6 -5
- package/dist/module/index.js +9 -0
- package/dist/types/CallHistory/CallHistory.d.ts +2 -1
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallHistory/callHistoryFixtures.d.ts +1 -0
- package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/types.d.ts +1 -0
- package/dist/types/CallSettings/types.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +2 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +8 -1
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +1 -0
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/callingClientFixtures.d.ts +69 -1
- package/dist/types/CallingClient/callingClientFixtures.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +8 -3
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +6 -6
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/line/types.d.ts +5 -17
- package/dist/types/CallingClient/line/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +3 -3
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +3 -3
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +1 -1
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts +4 -4
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts.map +1 -1
- package/dist/types/Errors/catalog/LineError.d.ts +4 -4
- package/dist/types/Errors/catalog/LineError.d.ts.map +1 -1
- package/dist/types/Errors/index.d.ts +1 -0
- package/dist/types/Errors/index.d.ts.map +1 -1
- package/dist/types/Errors/types.d.ts +2 -3
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +28 -5
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +3 -0
- package/dist/types/Metrics/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +2 -1
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +1 -1
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +3 -2
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -11,8 +11,10 @@ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/pr
|
|
|
11
11
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
13
13
|
var MediaSDK = _interopRequireWildcard(require("@webex/internal-media-core"));
|
|
14
|
+
var _webMediaEffects = require("@webex/web-media-effects");
|
|
14
15
|
var _types = require("../../Errors/types");
|
|
15
|
-
var
|
|
16
|
+
var _Utils = _interopRequireWildcard(require("../../common/Utils"));
|
|
17
|
+
var Utils = _Utils;
|
|
16
18
|
var _types2 = require("../../Events/types");
|
|
17
19
|
var _constants = require("../constants");
|
|
18
20
|
var _types3 = require("../../common/types");
|
|
@@ -23,8 +25,8 @@ var _testUtil = require("../../common/testUtil");
|
|
|
23
25
|
var _callManager = require("./callManager");
|
|
24
26
|
var _Logger = _interopRequireDefault(require("../../Logger"));
|
|
25
27
|
var _Errors = require("../../Errors");
|
|
26
|
-
function _getRequireWildcardCache(
|
|
27
|
-
function _interopRequireWildcard(
|
|
28
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
29
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
30
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
29
31
|
/* eslint-disable dot-notation */
|
|
30
32
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
@@ -102,6 +104,12 @@ describe('Call Tests', function () {
|
|
|
102
104
|
var mockTrack = {
|
|
103
105
|
enabled: false
|
|
104
106
|
};
|
|
107
|
+
var mockEffect = {
|
|
108
|
+
isEnabled: true,
|
|
109
|
+
effectTrack: mockTrack,
|
|
110
|
+
on: jest.fn(),
|
|
111
|
+
off: jest.fn()
|
|
112
|
+
};
|
|
105
113
|
var roapMediaConnectionConfig = {
|
|
106
114
|
skipInactiveTransceivers: true,
|
|
107
115
|
iceServers: [],
|
|
@@ -143,10 +151,53 @@ describe('Call Tests', function () {
|
|
|
143
151
|
var call = (0, _call.createCall)(activeUrl, webex, dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator);
|
|
144
152
|
expect(call).toBeTruthy();
|
|
145
153
|
});
|
|
146
|
-
it('
|
|
147
|
-
var callManager,
|
|
154
|
+
it('should log a warning when sending a digit fails', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
155
|
+
var tone, errorMessage, mockMediaConnection, callManager, call, realMediaConnection, logWarnSpy;
|
|
148
156
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
149
157
|
while (1) switch (_context.prev = _context.next) {
|
|
158
|
+
case 0:
|
|
159
|
+
tone = '1';
|
|
160
|
+
errorMessage = 'Failed to send digit'; // Mock the mediaConnection object
|
|
161
|
+
mockMediaConnection = {
|
|
162
|
+
insertDTMF: jest.fn(function () {
|
|
163
|
+
throw new Error(errorMessage);
|
|
164
|
+
})
|
|
165
|
+
};
|
|
166
|
+
callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
167
|
+
call = callManager.createCall(dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId);
|
|
168
|
+
realMediaConnection = call.mediaConnection; // Set the mock mediaConnection object
|
|
169
|
+
call.mediaConnection = mockMediaConnection;
|
|
170
|
+
|
|
171
|
+
// Spy on the log.warn method
|
|
172
|
+
logWarnSpy = jest.spyOn(_Logger.default, 'warn'); // Call the sendDigit method
|
|
173
|
+
call.sendDigit(tone);
|
|
174
|
+
|
|
175
|
+
// Expect the log.warn method to be called with the error message
|
|
176
|
+
expect(logWarnSpy).toHaveBeenLastCalledWith("Unable to send digit on call: ".concat(errorMessage), {
|
|
177
|
+
file: 'call',
|
|
178
|
+
method: 'sendDigit'
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Restore the real mediaConnection object
|
|
182
|
+
call.mediaConnection = realMediaConnection;
|
|
183
|
+
call.end();
|
|
184
|
+
_context.next = 14;
|
|
185
|
+
return (0, _Utils.waitForMsecs)(50);
|
|
186
|
+
case 14:
|
|
187
|
+
// Need to add a small delay for Promise and callback to finish.
|
|
188
|
+
|
|
189
|
+
/* After call ends, call manager should have 0 record */
|
|
190
|
+
expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(0);
|
|
191
|
+
case 15:
|
|
192
|
+
case "end":
|
|
193
|
+
return _context.stop();
|
|
194
|
+
}
|
|
195
|
+
}, _callee);
|
|
196
|
+
})));
|
|
197
|
+
it('delete call object when ending the call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
198
|
+
var callManager, mockStream, localAudioStream, call;
|
|
199
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
200
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
150
201
|
case 0:
|
|
151
202
|
webex.request.mockReturnValue({
|
|
152
203
|
statusCode: 200,
|
|
@@ -162,7 +213,8 @@ describe('Call Tests', function () {
|
|
|
162
213
|
mockStream = {
|
|
163
214
|
outputStream: {
|
|
164
215
|
getAudioTracks: jest.fn().mockReturnValue([mockTrack])
|
|
165
|
-
}
|
|
216
|
+
},
|
|
217
|
+
on: jest.fn()
|
|
166
218
|
};
|
|
167
219
|
localAudioStream = mockStream;
|
|
168
220
|
call = callManager.createCall(dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId);
|
|
@@ -176,8 +228,8 @@ describe('Call Tests', function () {
|
|
|
176
228
|
expect(mockTrack.enabled).toEqual(true);
|
|
177
229
|
expect(call.isMuted()).toEqual(false);
|
|
178
230
|
call.end();
|
|
179
|
-
|
|
180
|
-
return (0,
|
|
231
|
+
_context2.next = 16;
|
|
232
|
+
return (0, _Utils.waitForMsecs)(50);
|
|
181
233
|
case 16:
|
|
182
234
|
// Need to add a small delay for Promise and callback to finish.
|
|
183
235
|
expect(parseMediaQualityStatisticsMock).toHaveBeenCalledTimes(1);
|
|
@@ -189,14 +241,14 @@ describe('Call Tests', function () {
|
|
|
189
241
|
expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(0);
|
|
190
242
|
case 21:
|
|
191
243
|
case "end":
|
|
192
|
-
return
|
|
244
|
+
return _context2.stop();
|
|
193
245
|
}
|
|
194
|
-
},
|
|
246
|
+
}, _callee2);
|
|
195
247
|
})));
|
|
196
|
-
it('Check whether media requests succeed or not', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
248
|
+
it('Check whether media requests succeed or not', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
197
249
|
var mediaResponse, call, response;
|
|
198
|
-
return _regenerator.default.wrap(function
|
|
199
|
-
while (1) switch (
|
|
250
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
251
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
200
252
|
case 0:
|
|
201
253
|
webex.request.mockReturnValue({
|
|
202
254
|
statusCode: 200,
|
|
@@ -219,47 +271,47 @@ describe('Call Tests', function () {
|
|
|
219
271
|
}
|
|
220
272
|
};
|
|
221
273
|
call = callManager.createCall(dest, _types3.CallDirection.INBOUND, deviceId, mockLineId);
|
|
222
|
-
|
|
274
|
+
_context3.next = 5;
|
|
223
275
|
return call['postMedia']({});
|
|
224
276
|
case 5:
|
|
225
|
-
response =
|
|
277
|
+
response = _context3.sent;
|
|
226
278
|
expect(response.body).toStrictEqual(mediaResponse.body);
|
|
227
279
|
case 7:
|
|
228
280
|
case "end":
|
|
229
|
-
return
|
|
281
|
+
return _context3.stop();
|
|
230
282
|
}
|
|
231
|
-
},
|
|
283
|
+
}, _callee3);
|
|
232
284
|
})));
|
|
233
|
-
it('check whether callerId midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
285
|
+
it('check whether callerId midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
234
286
|
var call;
|
|
235
|
-
return _regenerator.default.wrap(function
|
|
236
|
-
while (1) switch (
|
|
287
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
288
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
237
289
|
case 0:
|
|
238
290
|
call = callManager.createCall(dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId);
|
|
239
291
|
call.handleMidCallEvent(dummyMidCallEvent);
|
|
240
|
-
|
|
241
|
-
return (0,
|
|
292
|
+
_context4.next = 4;
|
|
293
|
+
return (0, _Utils.waitForMsecs)(50);
|
|
242
294
|
case 4:
|
|
243
295
|
expect(call.getCallerInfo().name).toStrictEqual('Bob Marley');
|
|
244
296
|
expect(call.getCallerInfo().num).toStrictEqual('5010');
|
|
245
297
|
expect(call.getCallerInfo().avatarSrc).toBeFalsy();
|
|
246
298
|
case 7:
|
|
247
299
|
case "end":
|
|
248
|
-
return
|
|
300
|
+
return _context4.stop();
|
|
249
301
|
}
|
|
250
|
-
},
|
|
302
|
+
}, _callee4);
|
|
251
303
|
})));
|
|
252
|
-
it('check whether call midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
304
|
+
it('check whether call midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
253
305
|
var call, logSpy, corelationId;
|
|
254
|
-
return _regenerator.default.wrap(function
|
|
255
|
-
while (1) switch (
|
|
306
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
307
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
256
308
|
case 0:
|
|
257
309
|
call = callManager.createCall(dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId);
|
|
258
310
|
dummyMidCallEvent.eventType = 'callState';
|
|
259
311
|
logSpy = jest.spyOn(_Logger.default, 'log');
|
|
260
312
|
call.handleMidCallEvent(dummyMidCallEvent);
|
|
261
|
-
|
|
262
|
-
return (0,
|
|
313
|
+
_context5.next = 6;
|
|
314
|
+
return (0, _Utils.waitForMsecs)(50);
|
|
263
315
|
case 6:
|
|
264
316
|
corelationId = call.getCorrelationId();
|
|
265
317
|
expect(logSpy).toHaveBeenLastCalledWith("Received Midcall call event for correlationId : ".concat(corelationId), {
|
|
@@ -268,53 +320,59 @@ describe('Call Tests', function () {
|
|
|
268
320
|
});
|
|
269
321
|
case 8:
|
|
270
322
|
case "end":
|
|
271
|
-
return
|
|
323
|
+
return _context5.stop();
|
|
272
324
|
}
|
|
273
|
-
},
|
|
325
|
+
}, _callee5);
|
|
274
326
|
})));
|
|
275
|
-
it('check call stats for active call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
327
|
+
it('check call stats for active call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
276
328
|
var call, callRtpStats;
|
|
277
|
-
return _regenerator.default.wrap(function
|
|
278
|
-
while (1) switch (
|
|
329
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
330
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
279
331
|
case 0:
|
|
280
332
|
call = callManager.createCall(dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId);
|
|
281
|
-
|
|
282
|
-
|
|
333
|
+
_context6.prev = 1;
|
|
334
|
+
_context6.next = 4;
|
|
283
335
|
return call.getCallRtpStats();
|
|
284
336
|
case 4:
|
|
285
|
-
callRtpStats =
|
|
286
|
-
|
|
337
|
+
callRtpStats = _context6.sent;
|
|
338
|
+
_context6.next = 10;
|
|
287
339
|
break;
|
|
288
340
|
case 7:
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
console.error(
|
|
341
|
+
_context6.prev = 7;
|
|
342
|
+
_context6.t0 = _context6["catch"](1);
|
|
343
|
+
console.error(_context6.t0);
|
|
292
344
|
case 10:
|
|
293
345
|
expect(callRtpStats).toStrictEqual(disconnectStats);
|
|
294
346
|
case 11:
|
|
295
347
|
case "end":
|
|
296
|
-
return
|
|
348
|
+
return _context6.stop();
|
|
297
349
|
}
|
|
298
|
-
},
|
|
350
|
+
}, _callee6, null, [[1, 7]]);
|
|
299
351
|
})));
|
|
300
|
-
it('dial functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
301
|
-
var mockStream, localAudioStream, warnSpy, call;
|
|
302
|
-
return _regenerator.default.wrap(function
|
|
303
|
-
while (1) switch (
|
|
352
|
+
it('dial functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
353
|
+
var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy;
|
|
354
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
355
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
304
356
|
case 0:
|
|
305
357
|
mockStream = {
|
|
306
358
|
outputStream: {
|
|
307
359
|
getAudioTracks: jest.fn().mockReturnValue([mockTrack])
|
|
308
360
|
},
|
|
309
|
-
on: jest.fn()
|
|
361
|
+
on: jest.fn(),
|
|
362
|
+
getEffectByKind: jest.fn().mockImplementation(function () {
|
|
363
|
+
return mockEffect;
|
|
364
|
+
})
|
|
310
365
|
};
|
|
311
366
|
localAudioStream = mockStream;
|
|
312
367
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
313
368
|
call = (0, _call.createCall)(activeUrl, webex, dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator);
|
|
369
|
+
bnrMetricSpy = jest.spyOn(call['metricManager'], 'submitBNRMetric');
|
|
314
370
|
call.dial(localAudioStream);
|
|
315
371
|
expect(mockTrack.enabled).toEqual(true);
|
|
316
372
|
expect(mockMediaSDK.RoapMediaConnection).toBeCalledOnceWith(roapMediaConnectionConfig, roapMediaConnectionOptions, expect.any(String));
|
|
317
373
|
expect(call['mediaStateMachine'].state.value).toBe('S_SEND_ROAP_OFFER');
|
|
374
|
+
expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
|
|
375
|
+
|
|
318
376
|
/* Now change the state and recall to check for error */
|
|
319
377
|
call['mediaStateMachine'].state.value = 'S_SEND_ROAP_OFFER';
|
|
320
378
|
call.dial(localAudioStream);
|
|
@@ -323,27 +381,31 @@ describe('Call Tests', function () {
|
|
|
323
381
|
file: 'call',
|
|
324
382
|
method: 'dial'
|
|
325
383
|
});
|
|
326
|
-
case
|
|
384
|
+
case 14:
|
|
327
385
|
case "end":
|
|
328
|
-
return
|
|
386
|
+
return _context7.stop();
|
|
329
387
|
}
|
|
330
|
-
},
|
|
388
|
+
}, _callee7);
|
|
331
389
|
})));
|
|
332
|
-
it('answer functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
333
|
-
var mockStream, localAudioStream, warnSpy, call;
|
|
334
|
-
return _regenerator.default.wrap(function
|
|
335
|
-
while (1) switch (
|
|
390
|
+
it('answer functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
391
|
+
var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy;
|
|
392
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
393
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
336
394
|
case 0:
|
|
337
395
|
mockStream = {
|
|
338
396
|
outputStream: {
|
|
339
397
|
getAudioTracks: jest.fn().mockReturnValue([mockTrack])
|
|
340
398
|
},
|
|
341
|
-
on: jest.fn()
|
|
399
|
+
on: jest.fn(),
|
|
400
|
+
getEffectByKind: jest.fn().mockImplementation(function () {
|
|
401
|
+
return mockEffect;
|
|
402
|
+
})
|
|
342
403
|
};
|
|
343
404
|
localAudioStream = mockStream;
|
|
344
405
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
345
406
|
call = (0, _call.createCall)(activeUrl, webex, dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator);
|
|
346
407
|
/** Cannot answer in idle state */
|
|
408
|
+
bnrMetricSpy = jest.spyOn(call['metricManager'], 'submitBNRMetric');
|
|
347
409
|
call.answer(localAudioStream);
|
|
348
410
|
expect(mockTrack.enabled).toEqual(true);
|
|
349
411
|
expect(mockMediaSDK.RoapMediaConnection).toBeCalledOnceWith(roapMediaConnectionConfig, roapMediaConnectionOptions, expect.any(String));
|
|
@@ -357,12 +419,230 @@ describe('Call Tests', function () {
|
|
|
357
419
|
call['callStateMachine'].state.value = 'S_SEND_CALL_PROGRESS';
|
|
358
420
|
call.answer(localAudioStream);
|
|
359
421
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
|
|
422
|
+
expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
|
|
423
|
+
case 14:
|
|
424
|
+
case "end":
|
|
425
|
+
return _context8.stop();
|
|
426
|
+
}
|
|
427
|
+
}, _callee8);
|
|
428
|
+
})));
|
|
429
|
+
it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
430
|
+
var mockStream, localAudioStream, onStreamSpy, onEffectSpy, offStreamSpy, offEffectSpy, call, updateLocalTracksSpy, bnrMetricSpy;
|
|
431
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
432
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
433
|
+
case 0:
|
|
434
|
+
mockStream = {
|
|
435
|
+
outputStream: {
|
|
436
|
+
getAudioTracks: jest.fn().mockReturnValue([mockTrack])
|
|
437
|
+
},
|
|
438
|
+
on: jest.fn(),
|
|
439
|
+
off: jest.fn(),
|
|
440
|
+
getEffectByKind: jest.fn()
|
|
441
|
+
};
|
|
442
|
+
localAudioStream = mockStream;
|
|
443
|
+
onStreamSpy = jest.spyOn(localAudioStream, 'on');
|
|
444
|
+
onEffectSpy = jest.spyOn(mockEffect, 'on');
|
|
445
|
+
offStreamSpy = jest.spyOn(localAudioStream, 'off');
|
|
446
|
+
offEffectSpy = jest.spyOn(mockEffect, 'off');
|
|
447
|
+
call = (0, _call.createCall)(activeUrl, webex, dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator);
|
|
448
|
+
call.dial(localAudioStream);
|
|
449
|
+
expect(mockTrack.enabled).toEqual(true);
|
|
450
|
+
expect(mockMediaSDK.RoapMediaConnection).toBeCalledOnceWith(roapMediaConnectionConfig, roapMediaConnectionOptions, expect.any(String));
|
|
451
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_SEND_ROAP_OFFER');
|
|
452
|
+
updateLocalTracksSpy = jest.spyOn(call['mediaConnection'], 'updateLocalTracks');
|
|
453
|
+
bnrMetricSpy = jest.spyOn(call['metricManager'], 'submitBNRMetric');
|
|
454
|
+
/* Update the stream with the effect */
|
|
455
|
+
jest.spyOn(localAudioStream, 'getEffectByKind').mockReturnValue(mockEffect);
|
|
456
|
+
|
|
457
|
+
/* Checking if listeners on the localAudioStream have been registered */
|
|
458
|
+
expect(onStreamSpy).toBeCalledTimes(2);
|
|
459
|
+
expect(onStreamSpy).toBeCalledWith(MediaSDK.LocalStreamEventNames.OutputTrackChange, expect.any(Function));
|
|
460
|
+
expect(onStreamSpy).toBeCalledWith(MediaSDK.LocalStreamEventNames.EffectAdded, expect.any(Function));
|
|
461
|
+
bnrMetricSpy.mockClear();
|
|
462
|
+
/* Invoking the callback function to trigger EffectAdded event to simulate adding effect to the stream */
|
|
463
|
+
onStreamSpy.mock.calls[1][1](mockEffect);
|
|
464
|
+
expect(onEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Enabled, expect.any(Function));
|
|
465
|
+
expect(onEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Disabled, expect.any(Function));
|
|
466
|
+
|
|
467
|
+
/* Send Enabled event on the effect, update track and send metrics for BNR disabled */
|
|
468
|
+
onStreamSpy.mock.calls[0][1](mockTrack);
|
|
469
|
+
onEffectSpy.mock.calls[0][1]();
|
|
470
|
+
expect(updateLocalTracksSpy).toBeCalledOnceWith({
|
|
471
|
+
audio: mockTrack
|
|
472
|
+
});
|
|
473
|
+
expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
|
|
474
|
+
|
|
475
|
+
/* Clear the mocks */
|
|
476
|
+
updateLocalTracksSpy.mockClear();
|
|
477
|
+
bnrMetricSpy.mockClear();
|
|
478
|
+
|
|
479
|
+
/* Send Disabled event on the effect, update track and send metrics for BNR disabled */
|
|
480
|
+
mockEffect.isEnabled = false;
|
|
481
|
+
onStreamSpy.mock.calls[0][1](mockTrack);
|
|
482
|
+
onEffectSpy.mock.calls[1][1]();
|
|
483
|
+
expect(updateLocalTracksSpy).toBeCalledOnceWith({
|
|
484
|
+
audio: mockTrack
|
|
485
|
+
});
|
|
486
|
+
expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_DISABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
|
|
487
|
+
call.end();
|
|
488
|
+
_context9.next = 35;
|
|
489
|
+
return (0, _Utils.waitForMsecs)(50);
|
|
490
|
+
case 35:
|
|
491
|
+
/* Checks for switching off the listeners on call disconnect */
|
|
492
|
+
expect(offStreamSpy).toBeCalledWith(MediaSDK.LocalStreamEventNames.EffectAdded, expect.any(Function));
|
|
493
|
+
expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Enabled, expect.any(Function));
|
|
494
|
+
expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Disabled, expect.any(Function));
|
|
495
|
+
case 38:
|
|
496
|
+
case "end":
|
|
497
|
+
return _context9.stop();
|
|
498
|
+
}
|
|
499
|
+
}, _callee9);
|
|
500
|
+
})));
|
|
501
|
+
it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
502
|
+
var mockStream, localAudioStream, warnSpy, call;
|
|
503
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
504
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
505
|
+
case 0:
|
|
506
|
+
mockStream = {
|
|
507
|
+
outputStream: {
|
|
508
|
+
getAudioTracks: jest.fn().mockReturnValue([])
|
|
509
|
+
},
|
|
510
|
+
on: jest.fn(),
|
|
511
|
+
off: jest.fn(),
|
|
512
|
+
getEffectByKind: jest.fn()
|
|
513
|
+
};
|
|
514
|
+
localAudioStream = mockStream;
|
|
515
|
+
webex.request.mockReturnValue({
|
|
516
|
+
statusCode: 200,
|
|
517
|
+
body: {
|
|
518
|
+
device: {
|
|
519
|
+
deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010',
|
|
520
|
+
correlationId: '8a67806f-fc4d-446b-a131-31e71ea5b011'
|
|
521
|
+
},
|
|
522
|
+
callId: '8a67806f-fc4d-446b-a131-31e71ea5b020'
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
526
|
+
call = (0, _call.createCall)(activeUrl, webex, dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator);
|
|
527
|
+
call.answer(localAudioStream);
|
|
528
|
+
_context10.next = 8;
|
|
529
|
+
return (0, _Utils.waitForMsecs)(50);
|
|
530
|
+
case 8:
|
|
531
|
+
expect(warnSpy).toBeCalledTimes(2);
|
|
532
|
+
expect(warnSpy).toBeCalledWith("Did not find a local track while answering the call ".concat(call.getCorrelationId()), {
|
|
533
|
+
file: 'call',
|
|
534
|
+
method: 'answer'
|
|
535
|
+
});
|
|
536
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
|
|
537
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_IDLE');
|
|
538
|
+
expect(call.getDisconnectReason().code).toBe(_types5.DisconnectCode.MEDIA_INACTIVITY);
|
|
539
|
+
expect(call.getDisconnectReason().cause).toBe(_types5.DisconnectCause.MEDIA_INACTIVITY);
|
|
540
|
+
expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
|
|
541
|
+
case 15:
|
|
542
|
+
case "end":
|
|
543
|
+
return _context10.stop();
|
|
544
|
+
}
|
|
545
|
+
}, _callee10);
|
|
546
|
+
})));
|
|
547
|
+
it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
548
|
+
var mockStream, localAudioStream, warnSpy, call;
|
|
549
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
550
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
551
|
+
case 0:
|
|
552
|
+
mockStream = {
|
|
553
|
+
outputStream: {
|
|
554
|
+
getAudioTracks: jest.fn().mockReturnValue([])
|
|
555
|
+
},
|
|
556
|
+
on: jest.fn()
|
|
557
|
+
};
|
|
558
|
+
localAudioStream = mockStream;
|
|
559
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
560
|
+
call = (0, _call.createCall)(activeUrl, webex, dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator);
|
|
561
|
+
call.dial(localAudioStream);
|
|
562
|
+
_context11.next = 7;
|
|
563
|
+
return (0, _Utils.waitForMsecs)(50);
|
|
564
|
+
case 7:
|
|
565
|
+
expect(warnSpy).toBeCalledTimes(1);
|
|
566
|
+
expect(warnSpy).toBeCalledWith("Did not find a local track while dialing the call ".concat(call.getCorrelationId()), {
|
|
567
|
+
file: 'call',
|
|
568
|
+
method: 'dial'
|
|
569
|
+
});
|
|
570
|
+
expect(call['callStateMachine'].state.value).toBe('S_IDLE');
|
|
571
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_IDLE');
|
|
572
|
+
expect(webex.request).not.toBeCalledOnceWith();
|
|
360
573
|
case 12:
|
|
361
574
|
case "end":
|
|
362
|
-
return
|
|
575
|
+
return _context11.stop();
|
|
363
576
|
}
|
|
364
|
-
},
|
|
577
|
+
}, _callee11);
|
|
365
578
|
})));
|
|
579
|
+
it('update media after call creation with valid stream', function () {
|
|
580
|
+
var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
581
|
+
var mockStream = {
|
|
582
|
+
outputStream: {
|
|
583
|
+
getAudioTracks: jest.fn().mockReturnValue([mockTrack])
|
|
584
|
+
},
|
|
585
|
+
on: jest.fn(),
|
|
586
|
+
off: jest.fn(),
|
|
587
|
+
getEffectByKind: jest.fn()
|
|
588
|
+
};
|
|
589
|
+
var localAudioStream = mockStream;
|
|
590
|
+
var onStream1Spy = jest.spyOn(localAudioStream, 'on');
|
|
591
|
+
var offStream1Spy = jest.spyOn(localAudioStream, 'off');
|
|
592
|
+
var call = callManager.createCall(dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId);
|
|
593
|
+
call.dial(localAudioStream);
|
|
594
|
+
expect(mockTrack.enabled).toEqual(true);
|
|
595
|
+
expect(onStream1Spy).toBeCalledTimes(2);
|
|
596
|
+
expect(onStream1Spy).toBeCalledWith(MediaSDK.LocalStreamEventNames.OutputTrackChange, expect.any(Function));
|
|
597
|
+
expect(onStream1Spy).toBeCalledWith(MediaSDK.LocalStreamEventNames.EffectAdded, expect.any(Function));
|
|
598
|
+
var mockTrack2 = {
|
|
599
|
+
enabled: true
|
|
600
|
+
};
|
|
601
|
+
var mockStream2 = {
|
|
602
|
+
outputStream: {
|
|
603
|
+
getAudioTracks: jest.fn().mockReturnValue([mockTrack2])
|
|
604
|
+
},
|
|
605
|
+
on: jest.fn(),
|
|
606
|
+
getEffectByKind: jest.fn()
|
|
607
|
+
};
|
|
608
|
+
var localAudioStream2 = mockStream2;
|
|
609
|
+
var onStream2Spy = jest.spyOn(localAudioStream2, 'on');
|
|
610
|
+
call.updateMedia(localAudioStream2);
|
|
611
|
+
expect(call['mediaConnection'].updateLocalTracks).toBeCalledOnceWith({
|
|
612
|
+
audio: mockTrack2
|
|
613
|
+
});
|
|
614
|
+
expect(call['localAudioStream']).toEqual(localAudioStream2);
|
|
615
|
+
expect(offStream1Spy).toBeCalledWith(MediaSDK.LocalStreamEventNames.EffectAdded, expect.any(Function));
|
|
616
|
+
expect(onStream2Spy).toBeCalledWith(MediaSDK.LocalStreamEventNames.OutputTrackChange, expect.any(Function));
|
|
617
|
+
expect(onStream2Spy).toBeCalledWith(MediaSDK.LocalStreamEventNames.EffectAdded, expect.any(Function));
|
|
618
|
+
});
|
|
619
|
+
it('update media with invalid stream', function () {
|
|
620
|
+
var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
621
|
+
var warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
622
|
+
var mockStream = {
|
|
623
|
+
outputStream: {
|
|
624
|
+
getAudioTracks: jest.fn().mockReturnValue([mockTrack])
|
|
625
|
+
},
|
|
626
|
+
on: jest.fn(),
|
|
627
|
+
getEffectByKind: jest.fn()
|
|
628
|
+
};
|
|
629
|
+
var localAudioStream = mockStream;
|
|
630
|
+
var call = callManager.createCall(dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId);
|
|
631
|
+
call.dial(localAudioStream);
|
|
632
|
+
expect(mockTrack.enabled).toEqual(true);
|
|
633
|
+
var errorStream = {
|
|
634
|
+
outputStream: {
|
|
635
|
+
getAudioTracks: jest.fn().mockReturnValue([])
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
var localAudioStream2 = errorStream;
|
|
639
|
+
call.updateMedia(localAudioStream2);
|
|
640
|
+
expect(call['mediaConnection'].updateLocalTracks).not.toBeCalled();
|
|
641
|
+
expect(warnSpy).toBeCalledOnceWith("Did not find a local track while updating media for call ".concat(call.getCorrelationId(), ". Will not update media"), {
|
|
642
|
+
file: 'call',
|
|
643
|
+
method: 'updateMedia'
|
|
644
|
+
});
|
|
645
|
+
});
|
|
366
646
|
});
|
|
367
647
|
describe('State Machine handler tests', function () {
|
|
368
648
|
var deviceId = '55dfb53f-bed2-36da-8e85-cee7f02aa68e';
|
|
@@ -393,10 +673,10 @@ describe('State Machine handler tests', function () {
|
|
|
393
673
|
|
|
394
674
|
// afterEach(() => call.removeAllListeners());
|
|
395
675
|
|
|
396
|
-
it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
676
|
+
it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
397
677
|
var statusPayload, dummyEvent, funcSpy, logSpy;
|
|
398
|
-
return _regenerator.default.wrap(function
|
|
399
|
-
while (1) switch (
|
|
678
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
679
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
400
680
|
case 0:
|
|
401
681
|
statusPayload = {
|
|
402
682
|
statusCode: 200,
|
|
@@ -416,7 +696,7 @@ describe('State Machine handler tests', function () {
|
|
|
416
696
|
/* This is to flush all the promises from the Promise queue so that
|
|
417
697
|
* Jest.fakeTimers can advance time and also clear the promise Queue
|
|
418
698
|
*/
|
|
419
|
-
|
|
699
|
+
_context12.next = 11;
|
|
420
700
|
return (0, _testUtil.flushPromises)(3);
|
|
421
701
|
case 11:
|
|
422
702
|
expect(setInterval).toHaveBeenCalledTimes(1);
|
|
@@ -427,14 +707,14 @@ describe('State Machine handler tests', function () {
|
|
|
427
707
|
});
|
|
428
708
|
case 14:
|
|
429
709
|
case "end":
|
|
430
|
-
return
|
|
710
|
+
return _context12.stop();
|
|
431
711
|
}
|
|
432
|
-
},
|
|
712
|
+
}, _callee12);
|
|
433
713
|
})));
|
|
434
|
-
it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
714
|
+
it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
435
715
|
var statusPayload, funcSpy;
|
|
436
|
-
return _regenerator.default.wrap(function
|
|
437
|
-
while (1) switch (
|
|
716
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
717
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
438
718
|
case 0:
|
|
439
719
|
expect.assertions(4);
|
|
440
720
|
statusPayload = {
|
|
@@ -458,24 +738,24 @@ describe('State Machine handler tests', function () {
|
|
|
458
738
|
/* This is to flush all the promises from the Promise queue so that
|
|
459
739
|
* Jest.fakeTimers can advance time and also clear the promise Queue
|
|
460
740
|
*/
|
|
461
|
-
|
|
741
|
+
_context13.next = 11;
|
|
462
742
|
return _promise.default.resolve();
|
|
463
743
|
case 11:
|
|
464
|
-
|
|
744
|
+
_context13.next = 13;
|
|
465
745
|
return _promise.default.resolve();
|
|
466
746
|
case 13:
|
|
467
747
|
expect(clearInterval).toHaveBeenCalledTimes(1);
|
|
468
748
|
expect(funcSpy).toBeCalledTimes(1);
|
|
469
749
|
case 15:
|
|
470
750
|
case "end":
|
|
471
|
-
return
|
|
751
|
+
return _context13.stop();
|
|
472
752
|
}
|
|
473
|
-
},
|
|
753
|
+
}, _callee13);
|
|
474
754
|
})));
|
|
475
|
-
it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
755
|
+
it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
476
756
|
var statusPayload, dummyEvent, postMediaSpy, deleteSpy, dummyOkEvent;
|
|
477
|
-
return _regenerator.default.wrap(function
|
|
478
|
-
while (1) switch (
|
|
757
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
758
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
479
759
|
case 0:
|
|
480
760
|
statusPayload = {
|
|
481
761
|
statusCode: 200,
|
|
@@ -531,14 +811,14 @@ describe('State Machine handler tests', function () {
|
|
|
531
811
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
532
812
|
case 27:
|
|
533
813
|
case "end":
|
|
534
|
-
return
|
|
814
|
+
return _context14.stop();
|
|
535
815
|
}
|
|
536
|
-
},
|
|
816
|
+
}, _callee14);
|
|
537
817
|
})));
|
|
538
|
-
it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
818
|
+
it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
539
819
|
var statusPayload, dummyEvent;
|
|
540
|
-
return _regenerator.default.wrap(function
|
|
541
|
-
while (1) switch (
|
|
820
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
821
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
542
822
|
case 0:
|
|
543
823
|
call['direction'] = _types3.CallDirection.INBOUND;
|
|
544
824
|
statusPayload = {
|
|
@@ -556,7 +836,7 @@ describe('State Machine handler tests', function () {
|
|
|
556
836
|
webex.request.mockReturnValue(statusPayload);
|
|
557
837
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
558
838
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
|
|
559
|
-
|
|
839
|
+
_context15.next = 8;
|
|
560
840
|
return call['handleOutgoingCallConnect']({
|
|
561
841
|
type: 'E_SEND_CALL_CONNECT'
|
|
562
842
|
});
|
|
@@ -570,14 +850,14 @@ describe('State Machine handler tests', function () {
|
|
|
570
850
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
571
851
|
case 12:
|
|
572
852
|
case "end":
|
|
573
|
-
return
|
|
853
|
+
return _context15.stop();
|
|
574
854
|
}
|
|
575
|
-
},
|
|
855
|
+
}, _callee15);
|
|
576
856
|
})));
|
|
577
|
-
it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
857
|
+
it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
578
858
|
var warnSpy, stateMachineSpy, statusPayload, roapMessage;
|
|
579
|
-
return _regenerator.default.wrap(function
|
|
580
|
-
while (1) switch (
|
|
859
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
860
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
581
861
|
case 0:
|
|
582
862
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
583
863
|
stateMachineSpy = jest.spyOn(call, 'sendCallStateMachineEvt');
|
|
@@ -603,7 +883,7 @@ describe('State Machine handler tests', function () {
|
|
|
603
883
|
webex.request.mockRejectedValueOnce({
|
|
604
884
|
statusCode: 403
|
|
605
885
|
}).mockResolvedValue(statusPayload);
|
|
606
|
-
|
|
886
|
+
_context16.next = 12;
|
|
607
887
|
return call['handleOutgoingCallConnect']({
|
|
608
888
|
type: 'E_SEND_CALL_CONNECT'
|
|
609
889
|
});
|
|
@@ -611,23 +891,16 @@ describe('State Machine handler tests', function () {
|
|
|
611
891
|
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
612
892
|
expect(stateMachineSpy).toBeCalledTimes(3);
|
|
613
893
|
expect(warnSpy).toBeCalledTimes(4);
|
|
614
|
-
|
|
615
|
-
/* Try sending a dtmf which shouldn't work as call is not connected. */
|
|
616
|
-
call.sendDigit('1');
|
|
617
|
-
expect(warnSpy).toBeCalledOnceWith("Can't send DTMF as call is not yet connected", {
|
|
618
|
-
file: 'call',
|
|
619
|
-
method: 'sendDigit'
|
|
620
|
-
});
|
|
621
|
-
case 18:
|
|
894
|
+
case 15:
|
|
622
895
|
case "end":
|
|
623
|
-
return
|
|
896
|
+
return _context16.stop();
|
|
624
897
|
}
|
|
625
|
-
},
|
|
898
|
+
}, _callee16);
|
|
626
899
|
})));
|
|
627
|
-
it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
900
|
+
it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
628
901
|
var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent;
|
|
629
|
-
return _regenerator.default.wrap(function
|
|
630
|
-
while (1) switch (
|
|
902
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
903
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
631
904
|
case 0:
|
|
632
905
|
statusPayload = {
|
|
633
906
|
statusCode: 200,
|
|
@@ -701,14 +974,89 @@ describe('State Machine handler tests', function () {
|
|
|
701
974
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
|
|
702
975
|
case 40:
|
|
703
976
|
case "end":
|
|
704
|
-
return
|
|
977
|
+
return _context17.stop();
|
|
705
978
|
}
|
|
706
|
-
},
|
|
979
|
+
}, _callee17);
|
|
980
|
+
})));
|
|
981
|
+
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 _callee18() {
|
|
982
|
+
var statusPayload, dummySetupEvent, dummyConnectEvent, dummyOfferEvent, dummyAnswerEvent, dummyOkEvent, postMediaSpy;
|
|
983
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
984
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
985
|
+
case 0:
|
|
986
|
+
statusPayload = {
|
|
987
|
+
statusCode: 200,
|
|
988
|
+
body: mockStatusBody
|
|
989
|
+
};
|
|
990
|
+
dummySetupEvent = {
|
|
991
|
+
type: 'E_SEND_CALL_SETUP',
|
|
992
|
+
data: undefined
|
|
993
|
+
};
|
|
994
|
+
dummyConnectEvent = {
|
|
995
|
+
type: 'E_RECV_CALL_CONNECT',
|
|
996
|
+
data: undefined
|
|
997
|
+
};
|
|
998
|
+
dummyOfferEvent = {
|
|
999
|
+
type: 'E_SEND_ROAP_OFFER',
|
|
1000
|
+
data: undefined
|
|
1001
|
+
};
|
|
1002
|
+
dummyAnswerEvent = {
|
|
1003
|
+
type: 'E_RECV_ROAP_ANSWER',
|
|
1004
|
+
data: {
|
|
1005
|
+
seq: 1,
|
|
1006
|
+
messageType: 'ANSWER',
|
|
1007
|
+
sdp: 'sdp'
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
dummyOkEvent = {
|
|
1011
|
+
type: 'E_ROAP_OK',
|
|
1012
|
+
data: {
|
|
1013
|
+
received: false,
|
|
1014
|
+
message: {
|
|
1015
|
+
seq: 1,
|
|
1016
|
+
messageType: 'OK'
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
};
|
|
1020
|
+
postMediaSpy = jest.spyOn(call, 'postMedia');
|
|
1021
|
+
webex.request.mockReturnValue(statusPayload);
|
|
1022
|
+
call.sendCallStateMachineEvt(dummySetupEvent);
|
|
1023
|
+
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
|
|
1024
|
+
call.sendMediaStateMachineEvt(dummyOfferEvent);
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Since the event doesn't have any data above, we should request media sdk for an offer here.
|
|
1028
|
+
* The below event is expected to be called again my mediaSdk.
|
|
1029
|
+
*/
|
|
1030
|
+
dummyOfferEvent.data = {
|
|
1031
|
+
seq: 1,
|
|
1032
|
+
messageType: 'OFFER',
|
|
1033
|
+
sdp: 'sdp'
|
|
1034
|
+
};
|
|
1035
|
+
call.sendMediaStateMachineEvt(dummyOfferEvent);
|
|
1036
|
+
expect(_testUtil.mediaConnection.initiateOffer).toHaveBeenCalledTimes(1);
|
|
1037
|
+
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyOfferEvent.data);
|
|
1038
|
+
call.sendMediaStateMachineEvt(dummyAnswerEvent);
|
|
1039
|
+
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyAnswerEvent.data);
|
|
1040
|
+
call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
1041
|
+
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyOkEvent.data.message);
|
|
1042
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_OK');
|
|
1043
|
+
call.sendCallStateMachineEvt(dummyConnectEvent);
|
|
1044
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_ESTABLISHED');
|
|
1045
|
+
expect(call.isConnected()).toBe(true);
|
|
1046
|
+
call.sendCallStateMachineEvt({
|
|
1047
|
+
type: 'E_SEND_CALL_DISCONNECT'
|
|
1048
|
+
});
|
|
1049
|
+
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
|
|
1050
|
+
case 25:
|
|
1051
|
+
case "end":
|
|
1052
|
+
return _context18.stop();
|
|
1053
|
+
}
|
|
1054
|
+
}, _callee18);
|
|
707
1055
|
})));
|
|
708
|
-
it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1056
|
+
it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
709
1057
|
var statusPayload, dummyEvent;
|
|
710
|
-
return _regenerator.default.wrap(function
|
|
711
|
-
while (1) switch (
|
|
1058
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
1059
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
712
1060
|
case 0:
|
|
713
1061
|
statusPayload = {
|
|
714
1062
|
statusCode: 200,
|
|
@@ -747,14 +1095,14 @@ describe('State Machine handler tests', function () {
|
|
|
747
1095
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
748
1096
|
case 17:
|
|
749
1097
|
case "end":
|
|
750
|
-
return
|
|
1098
|
+
return _context19.stop();
|
|
751
1099
|
}
|
|
752
|
-
},
|
|
1100
|
+
}, _callee19);
|
|
753
1101
|
})));
|
|
754
|
-
it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1102
|
+
it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
755
1103
|
var statusPayload, dummyEvent;
|
|
756
|
-
return _regenerator.default.wrap(function
|
|
757
|
-
while (1) switch (
|
|
1104
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
1105
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
758
1106
|
case 0:
|
|
759
1107
|
statusPayload = {
|
|
760
1108
|
statusCode: 403,
|
|
@@ -770,20 +1118,20 @@ describe('State Machine handler tests', function () {
|
|
|
770
1118
|
};
|
|
771
1119
|
webex.request.mockRejectedValueOnce(statusPayload);
|
|
772
1120
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
773
|
-
|
|
1121
|
+
_context20.next = 6;
|
|
774
1122
|
return (0, _testUtil.flushPromises)(3);
|
|
775
1123
|
case 6:
|
|
776
1124
|
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
777
1125
|
case 7:
|
|
778
1126
|
case "end":
|
|
779
|
-
return
|
|
1127
|
+
return _context20.stop();
|
|
780
1128
|
}
|
|
781
|
-
},
|
|
1129
|
+
}, _callee20);
|
|
782
1130
|
})));
|
|
783
|
-
it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1131
|
+
it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
784
1132
|
var statusPayload, dummyEvent;
|
|
785
|
-
return _regenerator.default.wrap(function
|
|
786
|
-
while (1) switch (
|
|
1133
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
1134
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
787
1135
|
case 0:
|
|
788
1136
|
statusPayload = {
|
|
789
1137
|
statusCode: 403,
|
|
@@ -800,10 +1148,10 @@ describe('State Machine handler tests', function () {
|
|
|
800
1148
|
call['earlyMedia'] = true;
|
|
801
1149
|
call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
|
|
802
1150
|
webex.request.mockRejectedValue(statusPayload);
|
|
803
|
-
|
|
1151
|
+
_context21.next = 8;
|
|
804
1152
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
805
1153
|
case 8:
|
|
806
|
-
|
|
1154
|
+
_context21.next = 10;
|
|
807
1155
|
return (0, _testUtil.flushPromises)(2);
|
|
808
1156
|
case 10:
|
|
809
1157
|
expect(call.isConnected()).toBe(false);
|
|
@@ -811,14 +1159,14 @@ describe('State Machine handler tests', function () {
|
|
|
811
1159
|
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
812
1160
|
case 13:
|
|
813
1161
|
case "end":
|
|
814
|
-
return
|
|
1162
|
+
return _context21.stop();
|
|
815
1163
|
}
|
|
816
|
-
},
|
|
1164
|
+
}, _callee21);
|
|
817
1165
|
})));
|
|
818
|
-
it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1166
|
+
it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
819
1167
|
var statusPayload, dummyEvent;
|
|
820
|
-
return _regenerator.default.wrap(function
|
|
821
|
-
while (1) switch (
|
|
1168
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
|
1169
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
822
1170
|
case 0:
|
|
823
1171
|
statusPayload = {
|
|
824
1172
|
statusCode: 403,
|
|
@@ -841,14 +1189,14 @@ describe('State Machine handler tests', function () {
|
|
|
841
1189
|
expect(_testUtil.mediaConnection.initiateOffer).toBeCalledOnceWith();
|
|
842
1190
|
case 8:
|
|
843
1191
|
case "end":
|
|
844
|
-
return
|
|
1192
|
+
return _context22.stop();
|
|
845
1193
|
}
|
|
846
|
-
},
|
|
1194
|
+
}, _callee22);
|
|
847
1195
|
})));
|
|
848
|
-
it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1196
|
+
it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
849
1197
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
850
|
-
return _regenerator.default.wrap(function
|
|
851
|
-
while (1) switch (
|
|
1198
|
+
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
1199
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
852
1200
|
case 0:
|
|
853
1201
|
statusPayload = {
|
|
854
1202
|
statusCode: 503,
|
|
@@ -870,7 +1218,7 @@ describe('State Machine handler tests', function () {
|
|
|
870
1218
|
}
|
|
871
1219
|
};
|
|
872
1220
|
call['connected'] = true;
|
|
873
|
-
|
|
1221
|
+
_context23.next = 8;
|
|
874
1222
|
return call['handleOutgoingRoapOffer']({}, dummyEvent);
|
|
875
1223
|
case 8:
|
|
876
1224
|
jest.advanceTimersByTime(1005);
|
|
@@ -882,14 +1230,14 @@ describe('State Machine handler tests', function () {
|
|
|
882
1230
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
883
1231
|
case 13:
|
|
884
1232
|
case "end":
|
|
885
|
-
return
|
|
1233
|
+
return _context23.stop();
|
|
886
1234
|
}
|
|
887
|
-
},
|
|
1235
|
+
}, _callee23);
|
|
888
1236
|
})));
|
|
889
|
-
it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1237
|
+
it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
890
1238
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
891
|
-
return _regenerator.default.wrap(function
|
|
892
|
-
while (1) switch (
|
|
1239
|
+
return _regenerator.default.wrap(function _callee24$(_context24) {
|
|
1240
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
893
1241
|
case 0:
|
|
894
1242
|
statusPayload = {
|
|
895
1243
|
statusCode: 503,
|
|
@@ -911,7 +1259,7 @@ describe('State Machine handler tests', function () {
|
|
|
911
1259
|
}
|
|
912
1260
|
};
|
|
913
1261
|
call['connected'] = false;
|
|
914
|
-
|
|
1262
|
+
_context24.next = 8;
|
|
915
1263
|
return call['handleOutgoingRoapOffer']({}, dummyEvent);
|
|
916
1264
|
case 8:
|
|
917
1265
|
jest.advanceTimersByTime(1005);
|
|
@@ -922,14 +1270,14 @@ describe('State Machine handler tests', function () {
|
|
|
922
1270
|
expect(stateMachineSpy).not.toBeCalled();
|
|
923
1271
|
case 12:
|
|
924
1272
|
case "end":
|
|
925
|
-
return
|
|
1273
|
+
return _context24.stop();
|
|
926
1274
|
}
|
|
927
|
-
},
|
|
1275
|
+
}, _callee24);
|
|
928
1276
|
})));
|
|
929
|
-
it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1277
|
+
it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
930
1278
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
931
|
-
return _regenerator.default.wrap(function
|
|
932
|
-
while (1) switch (
|
|
1279
|
+
return _regenerator.default.wrap(function _callee25$(_context25) {
|
|
1280
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
933
1281
|
case 0:
|
|
934
1282
|
statusPayload = {
|
|
935
1283
|
statusCode: 503,
|
|
@@ -951,7 +1299,7 @@ describe('State Machine handler tests', function () {
|
|
|
951
1299
|
};
|
|
952
1300
|
call['connected'] = true;
|
|
953
1301
|
call['mediaStateMachine'].state.value = 'S_RECV_ROAP_OFFER';
|
|
954
|
-
|
|
1302
|
+
_context25.next = 9;
|
|
955
1303
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
956
1304
|
case 9:
|
|
957
1305
|
jest.advanceTimersByTime(1005);
|
|
@@ -963,14 +1311,14 @@ describe('State Machine handler tests', function () {
|
|
|
963
1311
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
964
1312
|
case 14:
|
|
965
1313
|
case "end":
|
|
966
|
-
return
|
|
1314
|
+
return _context25.stop();
|
|
967
1315
|
}
|
|
968
|
-
},
|
|
1316
|
+
}, _callee25);
|
|
969
1317
|
})));
|
|
970
|
-
it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1318
|
+
it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
971
1319
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
972
|
-
return _regenerator.default.wrap(function
|
|
973
|
-
while (1) switch (
|
|
1320
|
+
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
1321
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
974
1322
|
case 0:
|
|
975
1323
|
statusPayload = {
|
|
976
1324
|
statusCode: 503,
|
|
@@ -991,7 +1339,7 @@ describe('State Machine handler tests', function () {
|
|
|
991
1339
|
}
|
|
992
1340
|
};
|
|
993
1341
|
call['connected'] = false;
|
|
994
|
-
|
|
1342
|
+
_context26.next = 8;
|
|
995
1343
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
996
1344
|
case 8:
|
|
997
1345
|
jest.advanceTimersByTime(1005);
|
|
@@ -1003,14 +1351,14 @@ describe('State Machine handler tests', function () {
|
|
|
1003
1351
|
expect(stateMachineSpy).not.toBeCalled();
|
|
1004
1352
|
case 13:
|
|
1005
1353
|
case "end":
|
|
1006
|
-
return
|
|
1354
|
+
return _context26.stop();
|
|
1007
1355
|
}
|
|
1008
|
-
},
|
|
1356
|
+
}, _callee26);
|
|
1009
1357
|
})));
|
|
1010
|
-
it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1358
|
+
it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
1011
1359
|
var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
|
|
1012
|
-
return _regenerator.default.wrap(function
|
|
1013
|
-
while (1) switch (
|
|
1360
|
+
return _regenerator.default.wrap(function _callee27$(_context27) {
|
|
1361
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1014
1362
|
case 0:
|
|
1015
1363
|
statusPayload = {
|
|
1016
1364
|
statusCode: 200,
|
|
@@ -1035,14 +1383,14 @@ describe('State Machine handler tests', function () {
|
|
|
1035
1383
|
expect(stateMachineSpy).not.toHaveBeenCalled();
|
|
1036
1384
|
case 11:
|
|
1037
1385
|
case "end":
|
|
1038
|
-
return
|
|
1386
|
+
return _context27.stop();
|
|
1039
1387
|
}
|
|
1040
|
-
},
|
|
1388
|
+
}, _callee27);
|
|
1041
1389
|
})));
|
|
1042
|
-
it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1390
|
+
it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
1043
1391
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1044
|
-
return _regenerator.default.wrap(function
|
|
1045
|
-
while (1) switch (
|
|
1392
|
+
return _regenerator.default.wrap(function _callee28$(_context28) {
|
|
1393
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1046
1394
|
case 0:
|
|
1047
1395
|
statusPayload = {
|
|
1048
1396
|
statusCode: 503,
|
|
@@ -1064,7 +1412,7 @@ describe('State Machine handler tests', function () {
|
|
|
1064
1412
|
};
|
|
1065
1413
|
call['connected'] = true;
|
|
1066
1414
|
call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
|
|
1067
|
-
|
|
1415
|
+
_context28.next = 9;
|
|
1068
1416
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1069
1417
|
case 9:
|
|
1070
1418
|
jest.advanceTimersByTime(1005);
|
|
@@ -1076,14 +1424,14 @@ describe('State Machine handler tests', function () {
|
|
|
1076
1424
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
1077
1425
|
case 14:
|
|
1078
1426
|
case "end":
|
|
1079
|
-
return
|
|
1427
|
+
return _context28.stop();
|
|
1080
1428
|
}
|
|
1081
|
-
},
|
|
1429
|
+
}, _callee28);
|
|
1082
1430
|
})));
|
|
1083
|
-
it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1431
|
+
it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
1084
1432
|
var statusPayload, stateMachineSpy, funcSpy, errorEvent;
|
|
1085
|
-
return _regenerator.default.wrap(function
|
|
1086
|
-
while (1) switch (
|
|
1433
|
+
return _regenerator.default.wrap(function _callee29$(_context29) {
|
|
1434
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1087
1435
|
case 0:
|
|
1088
1436
|
statusPayload = {
|
|
1089
1437
|
statusCode: 403,
|
|
@@ -1106,14 +1454,14 @@ describe('State Machine handler tests', function () {
|
|
|
1106
1454
|
expect(stateMachineSpy).not.toHaveBeenCalled();
|
|
1107
1455
|
case 9:
|
|
1108
1456
|
case "end":
|
|
1109
|
-
return
|
|
1457
|
+
return _context29.stop();
|
|
1110
1458
|
}
|
|
1111
|
-
},
|
|
1459
|
+
}, _callee29);
|
|
1112
1460
|
})));
|
|
1113
|
-
it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1461
|
+
it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
1114
1462
|
var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
|
|
1115
|
-
return _regenerator.default.wrap(function
|
|
1116
|
-
while (1) switch (
|
|
1463
|
+
return _regenerator.default.wrap(function _callee30$(_context30) {
|
|
1464
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1117
1465
|
case 0:
|
|
1118
1466
|
statusPayload = {
|
|
1119
1467
|
statusCode: 200,
|
|
@@ -1131,7 +1479,7 @@ describe('State Machine handler tests', function () {
|
|
|
1131
1479
|
}
|
|
1132
1480
|
};
|
|
1133
1481
|
call['connected'] = false;
|
|
1134
|
-
|
|
1482
|
+
_context30.next = 8;
|
|
1135
1483
|
return call['handleRoapError']({}, errorEvent);
|
|
1136
1484
|
case 8:
|
|
1137
1485
|
expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
|
|
@@ -1147,14 +1495,14 @@ describe('State Machine handler tests', function () {
|
|
|
1147
1495
|
});
|
|
1148
1496
|
case 11:
|
|
1149
1497
|
case "end":
|
|
1150
|
-
return
|
|
1498
|
+
return _context30.stop();
|
|
1151
1499
|
}
|
|
1152
|
-
},
|
|
1500
|
+
}, _callee30);
|
|
1153
1501
|
})));
|
|
1154
|
-
it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1502
|
+
it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
1155
1503
|
var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
|
|
1156
|
-
return _regenerator.default.wrap(function
|
|
1157
|
-
while (1) switch (
|
|
1504
|
+
return _regenerator.default.wrap(function _callee31$(_context31) {
|
|
1505
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1158
1506
|
case 0:
|
|
1159
1507
|
statusPayload = {
|
|
1160
1508
|
statusCode: 200,
|
|
@@ -1187,7 +1535,7 @@ describe('State Machine handler tests', function () {
|
|
|
1187
1535
|
seq: 1,
|
|
1188
1536
|
messageType: 'ANSWER'
|
|
1189
1537
|
};
|
|
1190
|
-
|
|
1538
|
+
_context31.next = 17;
|
|
1191
1539
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1192
1540
|
case 17:
|
|
1193
1541
|
expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
@@ -1209,7 +1557,7 @@ describe('State Machine handler tests', function () {
|
|
|
1209
1557
|
seq: 2,
|
|
1210
1558
|
messageType: 'OFFER_REQUEST'
|
|
1211
1559
|
};
|
|
1212
|
-
|
|
1560
|
+
_context31.next = 23;
|
|
1213
1561
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1214
1562
|
case 23:
|
|
1215
1563
|
expect(call['receivedRoapOKSeq']).toBe(0);
|
|
@@ -1259,7 +1607,7 @@ describe('State Machine handler tests', function () {
|
|
|
1259
1607
|
};
|
|
1260
1608
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1261
1609
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1262
|
-
|
|
1610
|
+
_context31.next = 49;
|
|
1263
1611
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1264
1612
|
case 49:
|
|
1265
1613
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
@@ -1268,7 +1616,7 @@ describe('State Machine handler tests', function () {
|
|
|
1268
1616
|
seq: 3,
|
|
1269
1617
|
messageType: 'ANSWER'
|
|
1270
1618
|
};
|
|
1271
|
-
|
|
1619
|
+
_context31.next = 54;
|
|
1272
1620
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1273
1621
|
case 54:
|
|
1274
1622
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
@@ -1287,7 +1635,7 @@ describe('State Machine handler tests', function () {
|
|
|
1287
1635
|
messageType: 'OK'
|
|
1288
1636
|
}
|
|
1289
1637
|
};
|
|
1290
|
-
|
|
1638
|
+
_context31.next = 63;
|
|
1291
1639
|
return call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
1292
1640
|
case 63:
|
|
1293
1641
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
|
|
@@ -1302,14 +1650,14 @@ describe('State Machine handler tests', function () {
|
|
|
1302
1650
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1303
1651
|
case 70:
|
|
1304
1652
|
case "end":
|
|
1305
|
-
return
|
|
1653
|
+
return _context31.stop();
|
|
1306
1654
|
}
|
|
1307
|
-
},
|
|
1655
|
+
}, _callee31);
|
|
1308
1656
|
})));
|
|
1309
|
-
it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1657
|
+
it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
|
|
1310
1658
|
var mockStatusBody, statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
|
|
1311
|
-
return _regenerator.default.wrap(function
|
|
1312
|
-
while (1) switch (
|
|
1659
|
+
return _regenerator.default.wrap(function _callee32$(_context32) {
|
|
1660
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1313
1661
|
case 0:
|
|
1314
1662
|
mockStatusBody = {
|
|
1315
1663
|
device: {
|
|
@@ -1349,7 +1697,7 @@ describe('State Machine handler tests', function () {
|
|
|
1349
1697
|
seq: 1,
|
|
1350
1698
|
messageType: 'ANSWER'
|
|
1351
1699
|
};
|
|
1352
|
-
|
|
1700
|
+
_context32.next = 18;
|
|
1353
1701
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1354
1702
|
case 18:
|
|
1355
1703
|
expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
@@ -1371,7 +1719,7 @@ describe('State Machine handler tests', function () {
|
|
|
1371
1719
|
seq: 2,
|
|
1372
1720
|
messageType: 'OFFER_REQUEST'
|
|
1373
1721
|
};
|
|
1374
|
-
|
|
1722
|
+
_context32.next = 24;
|
|
1375
1723
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1376
1724
|
case 24:
|
|
1377
1725
|
expect(call['receivedRoapOKSeq']).toBe(0);
|
|
@@ -1421,7 +1769,7 @@ describe('State Machine handler tests', function () {
|
|
|
1421
1769
|
};
|
|
1422
1770
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1423
1771
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1424
|
-
|
|
1772
|
+
_context32.next = 50;
|
|
1425
1773
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1426
1774
|
case 50:
|
|
1427
1775
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
@@ -1430,7 +1778,7 @@ describe('State Machine handler tests', function () {
|
|
|
1430
1778
|
seq: 3,
|
|
1431
1779
|
messageType: 'ANSWER'
|
|
1432
1780
|
};
|
|
1433
|
-
|
|
1781
|
+
_context32.next = 55;
|
|
1434
1782
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1435
1783
|
case 55:
|
|
1436
1784
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
@@ -1447,7 +1795,7 @@ describe('State Machine handler tests', function () {
|
|
|
1447
1795
|
}
|
|
1448
1796
|
};
|
|
1449
1797
|
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1450
|
-
|
|
1798
|
+
_context32.next = 62;
|
|
1451
1799
|
return call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
1452
1800
|
case 62:
|
|
1453
1801
|
expect(call['receivedRoapOKSeq']).toBe(3);
|
|
@@ -1463,14 +1811,14 @@ describe('State Machine handler tests', function () {
|
|
|
1463
1811
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1464
1812
|
case 70:
|
|
1465
1813
|
case "end":
|
|
1466
|
-
return
|
|
1814
|
+
return _context32.stop();
|
|
1467
1815
|
}
|
|
1468
|
-
},
|
|
1816
|
+
}, _callee32);
|
|
1469
1817
|
})));
|
|
1470
|
-
it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1818
|
+
it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33() {
|
|
1471
1819
|
var statusPayload, dummyEvent, postMediaSpy, infoSpy, dummyOkEvent;
|
|
1472
|
-
return _regenerator.default.wrap(function
|
|
1473
|
-
while (1) switch (
|
|
1820
|
+
return _regenerator.default.wrap(function _callee33$(_context33) {
|
|
1821
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1474
1822
|
case 0:
|
|
1475
1823
|
statusPayload = {
|
|
1476
1824
|
statusCode: 200,
|
|
@@ -1537,9 +1885,9 @@ describe('State Machine handler tests', function () {
|
|
|
1537
1885
|
});
|
|
1538
1886
|
case 33:
|
|
1539
1887
|
case "end":
|
|
1540
|
-
return
|
|
1888
|
+
return _context33.stop();
|
|
1541
1889
|
}
|
|
1542
|
-
},
|
|
1890
|
+
}, _callee33);
|
|
1543
1891
|
})));
|
|
1544
1892
|
});
|
|
1545
1893
|
describe('Supplementary Services tests', function () {
|
|
@@ -1598,10 +1946,10 @@ describe('Supplementary Services tests', function () {
|
|
|
1598
1946
|
beforeEach(function () {
|
|
1599
1947
|
call.removeAllListeners();
|
|
1600
1948
|
});
|
|
1601
|
-
it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1949
|
+
it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35() {
|
|
1602
1950
|
var responsePayload, warnSpy, roapEvent;
|
|
1603
|
-
return _regenerator.default.wrap(function
|
|
1604
|
-
while (1) switch (
|
|
1951
|
+
return _regenerator.default.wrap(function _callee35$(_context35) {
|
|
1952
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1605
1953
|
case 0:
|
|
1606
1954
|
expect.assertions(7);
|
|
1607
1955
|
responsePayload = {
|
|
@@ -1614,25 +1962,25 @@ describe('Supplementary Services tests', function () {
|
|
|
1614
1962
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1615
1963
|
call['held'] = false;
|
|
1616
1964
|
call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
|
|
1617
|
-
var
|
|
1618
|
-
return _regenerator.default.wrap(function
|
|
1619
|
-
while (1) switch (
|
|
1965
|
+
var _ref35 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(correlationId) {
|
|
1966
|
+
return _regenerator.default.wrap(function _callee34$(_context34) {
|
|
1967
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1620
1968
|
case 0:
|
|
1621
1969
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
1622
1970
|
case 1:
|
|
1623
1971
|
case "end":
|
|
1624
|
-
return
|
|
1972
|
+
return _context34.stop();
|
|
1625
1973
|
}
|
|
1626
|
-
},
|
|
1974
|
+
}, _callee34);
|
|
1627
1975
|
}));
|
|
1628
1976
|
return function (_x) {
|
|
1629
|
-
return
|
|
1977
|
+
return _ref35.apply(this, arguments);
|
|
1630
1978
|
};
|
|
1631
1979
|
}());
|
|
1632
|
-
|
|
1980
|
+
_context35.next = 10;
|
|
1633
1981
|
return call.doHoldResume();
|
|
1634
1982
|
case 10:
|
|
1635
|
-
|
|
1983
|
+
_context35.next = 12;
|
|
1636
1984
|
return (0, _testUtil.flushPromises)(2);
|
|
1637
1985
|
case 12:
|
|
1638
1986
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
@@ -1648,11 +1996,11 @@ describe('Supplementary Services tests', function () {
|
|
|
1648
1996
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
1649
1997
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
1650
1998
|
roapEvent.data.type = 'ANSWER';
|
|
1651
|
-
|
|
1999
|
+
_context35.next = 20;
|
|
1652
2000
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
1653
2001
|
case 20:
|
|
1654
2002
|
roapEvent.data.type = 'OK';
|
|
1655
|
-
|
|
2003
|
+
_context35.next = 23;
|
|
1656
2004
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1657
2005
|
case 23:
|
|
1658
2006
|
expect(clearTimeout).toHaveBeenCalledTimes(1);
|
|
@@ -1667,14 +2015,14 @@ describe('Supplementary Services tests', function () {
|
|
|
1667
2015
|
});
|
|
1668
2016
|
case 28:
|
|
1669
2017
|
case "end":
|
|
1670
|
-
return
|
|
2018
|
+
return _context35.stop();
|
|
1671
2019
|
}
|
|
1672
|
-
},
|
|
2020
|
+
}, _callee35);
|
|
1673
2021
|
})));
|
|
1674
|
-
it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2022
|
+
it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37() {
|
|
1675
2023
|
var responsePayload, warnSpy, roapEvent;
|
|
1676
|
-
return _regenerator.default.wrap(function
|
|
1677
|
-
while (1) switch (
|
|
2024
|
+
return _regenerator.default.wrap(function _callee37$(_context37) {
|
|
2025
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1678
2026
|
case 0:
|
|
1679
2027
|
expect.assertions(8);
|
|
1680
2028
|
responsePayload = {
|
|
@@ -1687,26 +2035,26 @@ describe('Supplementary Services tests', function () {
|
|
|
1687
2035
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1688
2036
|
call['held'] = false;
|
|
1689
2037
|
call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
|
|
1690
|
-
var
|
|
1691
|
-
return _regenerator.default.wrap(function
|
|
1692
|
-
while (1) switch (
|
|
2038
|
+
var _ref37 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36(correlationId) {
|
|
2039
|
+
return _regenerator.default.wrap(function _callee36$(_context36) {
|
|
2040
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1693
2041
|
case 0:
|
|
1694
2042
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
1695
2043
|
case 1:
|
|
1696
2044
|
case "end":
|
|
1697
|
-
return
|
|
2045
|
+
return _context36.stop();
|
|
1698
2046
|
}
|
|
1699
|
-
},
|
|
2047
|
+
}, _callee36);
|
|
1700
2048
|
}));
|
|
1701
2049
|
return function (_x2) {
|
|
1702
|
-
return
|
|
2050
|
+
return _ref37.apply(this, arguments);
|
|
1703
2051
|
};
|
|
1704
2052
|
}());
|
|
1705
2053
|
call.doHoldResume();
|
|
1706
|
-
|
|
2054
|
+
_context37.next = 11;
|
|
1707
2055
|
return _promise.default.resolve();
|
|
1708
2056
|
case 11:
|
|
1709
|
-
|
|
2057
|
+
_context37.next = 13;
|
|
1710
2058
|
return _promise.default.resolve();
|
|
1711
2059
|
case 13:
|
|
1712
2060
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
@@ -1722,11 +2070,11 @@ describe('Supplementary Services tests', function () {
|
|
|
1722
2070
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
1723
2071
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
1724
2072
|
roapEvent.data.type = 'ANSWER';
|
|
1725
|
-
|
|
2073
|
+
_context37.next = 22;
|
|
1726
2074
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
1727
2075
|
case 22:
|
|
1728
2076
|
roapEvent.data.type = 'OK';
|
|
1729
|
-
|
|
2077
|
+
_context37.next = 25;
|
|
1730
2078
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1731
2079
|
case 25:
|
|
1732
2080
|
expect(clearTimeout).not.toHaveBeenCalled();
|
|
@@ -1741,14 +2089,14 @@ describe('Supplementary Services tests', function () {
|
|
|
1741
2089
|
});
|
|
1742
2090
|
case 30:
|
|
1743
2091
|
case "end":
|
|
1744
|
-
return
|
|
2092
|
+
return _context37.stop();
|
|
1745
2093
|
}
|
|
1746
|
-
},
|
|
2094
|
+
}, _callee37);
|
|
1747
2095
|
})));
|
|
1748
|
-
it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2096
|
+
it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39() {
|
|
1749
2097
|
var responsePayload;
|
|
1750
|
-
return _regenerator.default.wrap(function
|
|
1751
|
-
while (1) switch (
|
|
2098
|
+
return _regenerator.default.wrap(function _callee39$(_context39) {
|
|
2099
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1752
2100
|
case 0:
|
|
1753
2101
|
expect.assertions(4);
|
|
1754
2102
|
responsePayload = {
|
|
@@ -1758,26 +2106,26 @@ describe('Supplementary Services tests', function () {
|
|
|
1758
2106
|
jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
1759
2107
|
call['held'] = false;
|
|
1760
2108
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
1761
|
-
var
|
|
1762
|
-
return _regenerator.default.wrap(function
|
|
1763
|
-
while (1) switch (
|
|
2109
|
+
var _ref39 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38(errObj) {
|
|
2110
|
+
return _regenerator.default.wrap(function _callee38$(_context38) {
|
|
2111
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1764
2112
|
case 0:
|
|
1765
2113
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
1766
2114
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
1767
2115
|
case 2:
|
|
1768
2116
|
case "end":
|
|
1769
|
-
return
|
|
2117
|
+
return _context38.stop();
|
|
1770
2118
|
}
|
|
1771
|
-
},
|
|
2119
|
+
}, _callee38);
|
|
1772
2120
|
}));
|
|
1773
2121
|
return function (_x3) {
|
|
1774
|
-
return
|
|
2122
|
+
return _ref39.apply(this, arguments);
|
|
1775
2123
|
};
|
|
1776
2124
|
}());
|
|
1777
|
-
|
|
2125
|
+
_context39.next = 7;
|
|
1778
2126
|
return call.doHoldResume();
|
|
1779
2127
|
case 7:
|
|
1780
|
-
|
|
2128
|
+
_context39.next = 9;
|
|
1781
2129
|
return (0, _testUtil.flushPromises)(2);
|
|
1782
2130
|
case 9:
|
|
1783
2131
|
expect(call.isHeld()).toStrictEqual(false);
|
|
@@ -1787,14 +2135,14 @@ describe('Supplementary Services tests', function () {
|
|
|
1787
2135
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
1788
2136
|
case 11:
|
|
1789
2137
|
case "end":
|
|
1790
|
-
return
|
|
2138
|
+
return _context39.stop();
|
|
1791
2139
|
}
|
|
1792
|
-
},
|
|
2140
|
+
}, _callee39);
|
|
1793
2141
|
})));
|
|
1794
|
-
it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2142
|
+
it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41() {
|
|
1795
2143
|
var responsePayload, rejectPayload, roapEvent;
|
|
1796
|
-
return _regenerator.default.wrap(function
|
|
1797
|
-
while (1) switch (
|
|
2144
|
+
return _regenerator.default.wrap(function _callee41$(_context41) {
|
|
2145
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
1798
2146
|
case 0:
|
|
1799
2147
|
expect.assertions(5);
|
|
1800
2148
|
responsePayload = {
|
|
@@ -1808,24 +2156,24 @@ describe('Supplementary Services tests', function () {
|
|
|
1808
2156
|
jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
|
|
1809
2157
|
call['held'] = false;
|
|
1810
2158
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
1811
|
-
var
|
|
1812
|
-
return _regenerator.default.wrap(function
|
|
1813
|
-
while (1) switch (
|
|
2159
|
+
var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40(errObj) {
|
|
2160
|
+
return _regenerator.default.wrap(function _callee40$(_context40) {
|
|
2161
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1814
2162
|
case 0:
|
|
1815
2163
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
1816
2164
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
1817
2165
|
case 2:
|
|
1818
2166
|
case "end":
|
|
1819
|
-
return
|
|
2167
|
+
return _context40.stop();
|
|
1820
2168
|
}
|
|
1821
|
-
},
|
|
2169
|
+
}, _callee40);
|
|
1822
2170
|
}));
|
|
1823
2171
|
return function (_x4) {
|
|
1824
|
-
return
|
|
2172
|
+
return _ref41.apply(this, arguments);
|
|
1825
2173
|
};
|
|
1826
2174
|
}());
|
|
1827
2175
|
call.doHoldResume();
|
|
1828
|
-
|
|
2176
|
+
_context41.next = 9;
|
|
1829
2177
|
return (0, _testUtil.flushPromises)(2);
|
|
1830
2178
|
case 9:
|
|
1831
2179
|
/* the Call State should transition to S_CALL_ESTABLISHED
|
|
@@ -1835,7 +2183,7 @@ describe('Supplementary Services tests', function () {
|
|
|
1835
2183
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
1836
2184
|
/* We are intentionally failing the ROAP ANSWER */
|
|
1837
2185
|
roapEvent.data.type = 'ANSWER';
|
|
1838
|
-
|
|
2186
|
+
_context41.next = 15;
|
|
1839
2187
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
1840
2188
|
case 15:
|
|
1841
2189
|
expect(call.isHeld()).toStrictEqual(false);
|
|
@@ -1843,14 +2191,14 @@ describe('Supplementary Services tests', function () {
|
|
|
1843
2191
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
1844
2192
|
case 17:
|
|
1845
2193
|
case "end":
|
|
1846
|
-
return
|
|
2194
|
+
return _context41.stop();
|
|
1847
2195
|
}
|
|
1848
|
-
},
|
|
2196
|
+
}, _callee41);
|
|
1849
2197
|
})));
|
|
1850
|
-
it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2198
|
+
it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42() {
|
|
1851
2199
|
var responsePayload, warnSpy, roapEvent;
|
|
1852
|
-
return _regenerator.default.wrap(function
|
|
1853
|
-
while (1) switch (
|
|
2200
|
+
return _regenerator.default.wrap(function _callee42$(_context42) {
|
|
2201
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
1854
2202
|
case 0:
|
|
1855
2203
|
responsePayload = {
|
|
1856
2204
|
statusCode: 200,
|
|
@@ -1861,10 +2209,10 @@ describe('Supplementary Services tests', function () {
|
|
|
1861
2209
|
jest.spyOn(global, 'clearTimeout');
|
|
1862
2210
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1863
2211
|
call['held'] = false;
|
|
1864
|
-
|
|
2212
|
+
_context42.next = 8;
|
|
1865
2213
|
return call.doHoldResume();
|
|
1866
2214
|
case 8:
|
|
1867
|
-
|
|
2215
|
+
_context42.next = 10;
|
|
1868
2216
|
return (0, _testUtil.flushPromises)(2);
|
|
1869
2217
|
case 10:
|
|
1870
2218
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
@@ -1879,38 +2227,38 @@ describe('Supplementary Services tests', function () {
|
|
|
1879
2227
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
1880
2228
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
1881
2229
|
roapEvent.data.type = 'ANSWER';
|
|
1882
|
-
|
|
2230
|
+
_context42.next = 17;
|
|
1883
2231
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
1884
2232
|
case 17:
|
|
1885
2233
|
jest.spyOn(webex, 'request').mockRejectedValue({
|
|
1886
2234
|
statusCode: 403
|
|
1887
2235
|
});
|
|
1888
2236
|
roapEvent.data.type = 'OK';
|
|
1889
|
-
|
|
2237
|
+
_context42.next = 21;
|
|
1890
2238
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1891
2239
|
case 21:
|
|
1892
2240
|
/* this is for coverage */
|
|
1893
2241
|
call['callStateMachine'].state.value = 'S_CALL_HOLD';
|
|
1894
|
-
|
|
2242
|
+
_context42.next = 24;
|
|
1895
2243
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1896
2244
|
case 24:
|
|
1897
2245
|
expect(call.isHeld()).toStrictEqual(false);
|
|
1898
2246
|
/* We should return back to call established state */
|
|
1899
2247
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
1900
|
-
expect(warnSpy).toHaveBeenCalledWith('
|
|
2248
|
+
expect(warnSpy).toHaveBeenCalledWith('Failed to process MediaOk request', {
|
|
1901
2249
|
file: 'call',
|
|
1902
2250
|
method: 'handleRoapEstablished'
|
|
1903
2251
|
});
|
|
1904
2252
|
case 27:
|
|
1905
2253
|
case "end":
|
|
1906
|
-
return
|
|
2254
|
+
return _context42.stop();
|
|
1907
2255
|
}
|
|
1908
|
-
},
|
|
2256
|
+
}, _callee42);
|
|
1909
2257
|
})));
|
|
1910
|
-
it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2258
|
+
it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43() {
|
|
1911
2259
|
var responsePayload, warnSpy, roapEvent;
|
|
1912
|
-
return _regenerator.default.wrap(function
|
|
1913
|
-
while (1) switch (
|
|
2260
|
+
return _regenerator.default.wrap(function _callee43$(_context43) {
|
|
2261
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
1914
2262
|
case 0:
|
|
1915
2263
|
responsePayload = {
|
|
1916
2264
|
statusCode: 200,
|
|
@@ -1921,10 +2269,10 @@ describe('Supplementary Services tests', function () {
|
|
|
1921
2269
|
jest.spyOn(global, 'clearTimeout');
|
|
1922
2270
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1923
2271
|
call['held'] = true;
|
|
1924
|
-
|
|
2272
|
+
_context43.next = 8;
|
|
1925
2273
|
return call.doHoldResume();
|
|
1926
2274
|
case 8:
|
|
1927
|
-
|
|
2275
|
+
_context43.next = 10;
|
|
1928
2276
|
return (0, _testUtil.flushPromises)(2);
|
|
1929
2277
|
case 10:
|
|
1930
2278
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
@@ -1939,33 +2287,33 @@ describe('Supplementary Services tests', function () {
|
|
|
1939
2287
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
1940
2288
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
1941
2289
|
roapEvent.data.type = 'ANSWER';
|
|
1942
|
-
|
|
2290
|
+
_context43.next = 17;
|
|
1943
2291
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
1944
2292
|
case 17:
|
|
1945
2293
|
jest.spyOn(webex, 'request').mockRejectedValue({
|
|
1946
2294
|
statusCode: 403
|
|
1947
2295
|
});
|
|
1948
2296
|
roapEvent.data.type = 'OK';
|
|
1949
|
-
|
|
2297
|
+
_context43.next = 21;
|
|
1950
2298
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1951
2299
|
case 21:
|
|
1952
2300
|
expect(call.isHeld()).toStrictEqual(true);
|
|
1953
2301
|
/* We should return back to call established state */
|
|
1954
2302
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
1955
|
-
expect(warnSpy).toHaveBeenCalledWith('
|
|
2303
|
+
expect(warnSpy).toHaveBeenCalledWith('Failed to process MediaOk request', {
|
|
1956
2304
|
file: 'call',
|
|
1957
2305
|
method: 'handleRoapEstablished'
|
|
1958
2306
|
});
|
|
1959
2307
|
case 24:
|
|
1960
2308
|
case "end":
|
|
1961
|
-
return
|
|
2309
|
+
return _context43.stop();
|
|
1962
2310
|
}
|
|
1963
|
-
},
|
|
2311
|
+
}, _callee43);
|
|
1964
2312
|
})));
|
|
1965
|
-
it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2313
|
+
it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45() {
|
|
1966
2314
|
var responsePayload, roapEvent;
|
|
1967
|
-
return _regenerator.default.wrap(function
|
|
1968
|
-
while (1) switch (
|
|
2315
|
+
return _regenerator.default.wrap(function _callee45$(_context45) {
|
|
2316
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
1969
2317
|
case 0:
|
|
1970
2318
|
expect.assertions(5);
|
|
1971
2319
|
responsePayload = {
|
|
@@ -1975,25 +2323,25 @@ describe('Supplementary Services tests', function () {
|
|
|
1975
2323
|
jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
|
|
1976
2324
|
call['held'] = false;
|
|
1977
2325
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
1978
|
-
var
|
|
1979
|
-
return _regenerator.default.wrap(function
|
|
1980
|
-
while (1) switch (
|
|
2326
|
+
var _ref45 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44(errObj) {
|
|
2327
|
+
return _regenerator.default.wrap(function _callee44$(_context44) {
|
|
2328
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
1981
2329
|
case 0:
|
|
1982
2330
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
|
|
1983
2331
|
expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
|
|
1984
2332
|
case 2:
|
|
1985
2333
|
case "end":
|
|
1986
|
-
return
|
|
2334
|
+
return _context44.stop();
|
|
1987
2335
|
}
|
|
1988
|
-
},
|
|
2336
|
+
}, _callee44);
|
|
1989
2337
|
}));
|
|
1990
2338
|
return function (_x5) {
|
|
1991
|
-
return
|
|
2339
|
+
return _ref45.apply(this, arguments);
|
|
1992
2340
|
};
|
|
1993
2341
|
}());
|
|
1994
2342
|
jest.runAllTimers();
|
|
1995
2343
|
call.doHoldResume();
|
|
1996
|
-
|
|
2344
|
+
_context45.next = 9;
|
|
1997
2345
|
return (0, _testUtil.flushPromises)(2);
|
|
1998
2346
|
case 9:
|
|
1999
2347
|
/* At this point, the Call State should be S_CALL_HOLD
|
|
@@ -2006,11 +2354,11 @@ describe('Supplementary Services tests', function () {
|
|
|
2006
2354
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2007
2355
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2008
2356
|
roapEvent.data.type = 'ANSWER';
|
|
2009
|
-
|
|
2357
|
+
_context45.next = 15;
|
|
2010
2358
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2011
2359
|
case 15:
|
|
2012
2360
|
roapEvent.data.type = 'OK';
|
|
2013
|
-
|
|
2361
|
+
_context45.next = 18;
|
|
2014
2362
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2015
2363
|
case 18:
|
|
2016
2364
|
/* Advancing timer by 12 seconds so that it gets timed out */
|
|
@@ -2022,14 +2370,14 @@ describe('Supplementary Services tests', function () {
|
|
|
2022
2370
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2023
2371
|
case 21:
|
|
2024
2372
|
case "end":
|
|
2025
|
-
return
|
|
2373
|
+
return _context45.stop();
|
|
2026
2374
|
}
|
|
2027
|
-
},
|
|
2375
|
+
}, _callee45);
|
|
2028
2376
|
})));
|
|
2029
|
-
it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2377
|
+
it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47() {
|
|
2030
2378
|
var responsePayload, warnSpy, roapEvent;
|
|
2031
|
-
return _regenerator.default.wrap(function
|
|
2032
|
-
while (1) switch (
|
|
2379
|
+
return _regenerator.default.wrap(function _callee47$(_context47) {
|
|
2380
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
2033
2381
|
case 0:
|
|
2034
2382
|
expect.assertions(7);
|
|
2035
2383
|
responsePayload = {
|
|
@@ -2042,25 +2390,25 @@ describe('Supplementary Services tests', function () {
|
|
|
2042
2390
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2043
2391
|
call['held'] = true;
|
|
2044
2392
|
call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
|
|
2045
|
-
var
|
|
2046
|
-
return _regenerator.default.wrap(function
|
|
2047
|
-
while (1) switch (
|
|
2393
|
+
var _ref47 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46(correlationId) {
|
|
2394
|
+
return _regenerator.default.wrap(function _callee46$(_context46) {
|
|
2395
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
2048
2396
|
case 0:
|
|
2049
2397
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2050
2398
|
case 1:
|
|
2051
2399
|
case "end":
|
|
2052
|
-
return
|
|
2400
|
+
return _context46.stop();
|
|
2053
2401
|
}
|
|
2054
|
-
},
|
|
2402
|
+
}, _callee46);
|
|
2055
2403
|
}));
|
|
2056
2404
|
return function (_x6) {
|
|
2057
|
-
return
|
|
2405
|
+
return _ref47.apply(this, arguments);
|
|
2058
2406
|
};
|
|
2059
2407
|
}());
|
|
2060
|
-
|
|
2408
|
+
_context47.next = 10;
|
|
2061
2409
|
return call.doHoldResume();
|
|
2062
2410
|
case 10:
|
|
2063
|
-
|
|
2411
|
+
_context47.next = 12;
|
|
2064
2412
|
return (0, _testUtil.flushPromises)(2);
|
|
2065
2413
|
case 12:
|
|
2066
2414
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
@@ -2076,11 +2424,11 @@ describe('Supplementary Services tests', function () {
|
|
|
2076
2424
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2077
2425
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2078
2426
|
roapEvent.data.type = 'ANSWER';
|
|
2079
|
-
|
|
2427
|
+
_context47.next = 20;
|
|
2080
2428
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2081
2429
|
case 20:
|
|
2082
2430
|
roapEvent.data.type = 'OK';
|
|
2083
|
-
|
|
2431
|
+
_context47.next = 23;
|
|
2084
2432
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2085
2433
|
case 23:
|
|
2086
2434
|
expect(clearTimeout).toHaveBeenCalledTimes(1);
|
|
@@ -2095,14 +2443,14 @@ describe('Supplementary Services tests', function () {
|
|
|
2095
2443
|
});
|
|
2096
2444
|
case 28:
|
|
2097
2445
|
case "end":
|
|
2098
|
-
return
|
|
2446
|
+
return _context47.stop();
|
|
2099
2447
|
}
|
|
2100
|
-
},
|
|
2448
|
+
}, _callee47);
|
|
2101
2449
|
})));
|
|
2102
|
-
it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2450
|
+
it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49() {
|
|
2103
2451
|
var responsePayload, warnSpy, roapEvent;
|
|
2104
|
-
return _regenerator.default.wrap(function
|
|
2105
|
-
while (1) switch (
|
|
2452
|
+
return _regenerator.default.wrap(function _callee49$(_context49) {
|
|
2453
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
2106
2454
|
case 0:
|
|
2107
2455
|
expect.assertions(7);
|
|
2108
2456
|
responsePayload = {
|
|
@@ -2115,26 +2463,26 @@ describe('Supplementary Services tests', function () {
|
|
|
2115
2463
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2116
2464
|
call['held'] = true;
|
|
2117
2465
|
call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
|
|
2118
|
-
var
|
|
2119
|
-
return _regenerator.default.wrap(function
|
|
2120
|
-
while (1) switch (
|
|
2466
|
+
var _ref49 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(correlationId) {
|
|
2467
|
+
return _regenerator.default.wrap(function _callee48$(_context48) {
|
|
2468
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
2121
2469
|
case 0:
|
|
2122
2470
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2123
2471
|
case 1:
|
|
2124
2472
|
case "end":
|
|
2125
|
-
return
|
|
2473
|
+
return _context48.stop();
|
|
2126
2474
|
}
|
|
2127
|
-
},
|
|
2475
|
+
}, _callee48);
|
|
2128
2476
|
}));
|
|
2129
2477
|
return function (_x7) {
|
|
2130
|
-
return
|
|
2478
|
+
return _ref49.apply(this, arguments);
|
|
2131
2479
|
};
|
|
2132
2480
|
}());
|
|
2133
2481
|
call.doHoldResume();
|
|
2134
|
-
|
|
2482
|
+
_context49.next = 11;
|
|
2135
2483
|
return _promise.default.resolve();
|
|
2136
2484
|
case 11:
|
|
2137
|
-
|
|
2485
|
+
_context49.next = 13;
|
|
2138
2486
|
return _promise.default.resolve();
|
|
2139
2487
|
case 13:
|
|
2140
2488
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
@@ -2150,11 +2498,11 @@ describe('Supplementary Services tests', function () {
|
|
|
2150
2498
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2151
2499
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2152
2500
|
roapEvent.data.type = 'ANSWER';
|
|
2153
|
-
|
|
2501
|
+
_context49.next = 21;
|
|
2154
2502
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2155
2503
|
case 21:
|
|
2156
2504
|
roapEvent.data.type = 'OK';
|
|
2157
|
-
|
|
2505
|
+
_context49.next = 24;
|
|
2158
2506
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2159
2507
|
case 24:
|
|
2160
2508
|
expect(clearTimeout).not.toHaveBeenCalled();
|
|
@@ -2169,14 +2517,14 @@ describe('Supplementary Services tests', function () {
|
|
|
2169
2517
|
});
|
|
2170
2518
|
case 29:
|
|
2171
2519
|
case "end":
|
|
2172
|
-
return
|
|
2520
|
+
return _context49.stop();
|
|
2173
2521
|
}
|
|
2174
|
-
},
|
|
2522
|
+
}, _callee49);
|
|
2175
2523
|
})));
|
|
2176
|
-
it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2524
|
+
it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51() {
|
|
2177
2525
|
var responsePayload;
|
|
2178
|
-
return _regenerator.default.wrap(function
|
|
2179
|
-
while (1) switch (
|
|
2526
|
+
return _regenerator.default.wrap(function _callee51$(_context51) {
|
|
2527
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
2180
2528
|
case 0:
|
|
2181
2529
|
expect.assertions(4);
|
|
2182
2530
|
responsePayload = {
|
|
@@ -2186,26 +2534,26 @@ describe('Supplementary Services tests', function () {
|
|
|
2186
2534
|
jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
2187
2535
|
call['held'] = true;
|
|
2188
2536
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2189
|
-
var
|
|
2190
|
-
return _regenerator.default.wrap(function
|
|
2191
|
-
while (1) switch (
|
|
2537
|
+
var _ref51 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50(errObj) {
|
|
2538
|
+
return _regenerator.default.wrap(function _callee50$(_context50) {
|
|
2539
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
2192
2540
|
case 0:
|
|
2193
2541
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2194
2542
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2195
2543
|
case 2:
|
|
2196
2544
|
case "end":
|
|
2197
|
-
return
|
|
2545
|
+
return _context50.stop();
|
|
2198
2546
|
}
|
|
2199
|
-
},
|
|
2547
|
+
}, _callee50);
|
|
2200
2548
|
}));
|
|
2201
2549
|
return function (_x8) {
|
|
2202
|
-
return
|
|
2550
|
+
return _ref51.apply(this, arguments);
|
|
2203
2551
|
};
|
|
2204
2552
|
}());
|
|
2205
|
-
|
|
2553
|
+
_context51.next = 7;
|
|
2206
2554
|
return call.doHoldResume();
|
|
2207
2555
|
case 7:
|
|
2208
|
-
|
|
2556
|
+
_context51.next = 9;
|
|
2209
2557
|
return (0, _testUtil.flushPromises)(2);
|
|
2210
2558
|
case 9:
|
|
2211
2559
|
expect(call.isHeld()).toStrictEqual(true);
|
|
@@ -2216,14 +2564,14 @@ describe('Supplementary Services tests', function () {
|
|
|
2216
2564
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2217
2565
|
case 11:
|
|
2218
2566
|
case "end":
|
|
2219
|
-
return
|
|
2567
|
+
return _context51.stop();
|
|
2220
2568
|
}
|
|
2221
|
-
},
|
|
2569
|
+
}, _callee51);
|
|
2222
2570
|
})));
|
|
2223
|
-
it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2571
|
+
it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53() {
|
|
2224
2572
|
var responsePayload, rejectPayload, roapEvent;
|
|
2225
|
-
return _regenerator.default.wrap(function
|
|
2226
|
-
while (1) switch (
|
|
2573
|
+
return _regenerator.default.wrap(function _callee53$(_context53) {
|
|
2574
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
2227
2575
|
case 0:
|
|
2228
2576
|
expect.assertions(5);
|
|
2229
2577
|
responsePayload = {
|
|
@@ -2237,24 +2585,24 @@ describe('Supplementary Services tests', function () {
|
|
|
2237
2585
|
jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
|
|
2238
2586
|
call['held'] = true;
|
|
2239
2587
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2240
|
-
var
|
|
2241
|
-
return _regenerator.default.wrap(function
|
|
2242
|
-
while (1) switch (
|
|
2588
|
+
var _ref53 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52(errObj) {
|
|
2589
|
+
return _regenerator.default.wrap(function _callee52$(_context52) {
|
|
2590
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
2243
2591
|
case 0:
|
|
2244
2592
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2245
2593
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2246
2594
|
case 2:
|
|
2247
2595
|
case "end":
|
|
2248
|
-
return
|
|
2596
|
+
return _context52.stop();
|
|
2249
2597
|
}
|
|
2250
|
-
},
|
|
2598
|
+
}, _callee52);
|
|
2251
2599
|
}));
|
|
2252
2600
|
return function (_x9) {
|
|
2253
|
-
return
|
|
2601
|
+
return _ref53.apply(this, arguments);
|
|
2254
2602
|
};
|
|
2255
2603
|
}());
|
|
2256
2604
|
call.doHoldResume();
|
|
2257
|
-
|
|
2605
|
+
_context53.next = 9;
|
|
2258
2606
|
return (0, _testUtil.flushPromises)(2);
|
|
2259
2607
|
case 9:
|
|
2260
2608
|
/* At this point , the Call State should transition to S_CALL_ESTABLISHED
|
|
@@ -2265,7 +2613,7 @@ describe('Supplementary Services tests', function () {
|
|
|
2265
2613
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2266
2614
|
/* We are intentionally failing the ROAP ANSWER */
|
|
2267
2615
|
roapEvent.data.type = 'ANSWER';
|
|
2268
|
-
|
|
2616
|
+
_context53.next = 15;
|
|
2269
2617
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2270
2618
|
case 15:
|
|
2271
2619
|
expect(call.isHeld()).toStrictEqual(true);
|
|
@@ -2273,14 +2621,14 @@ describe('Supplementary Services tests', function () {
|
|
|
2273
2621
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2274
2622
|
case 17:
|
|
2275
2623
|
case "end":
|
|
2276
|
-
return
|
|
2624
|
+
return _context53.stop();
|
|
2277
2625
|
}
|
|
2278
|
-
},
|
|
2626
|
+
}, _callee53);
|
|
2279
2627
|
})));
|
|
2280
|
-
it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2628
|
+
it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55() {
|
|
2281
2629
|
var responsePayload, roapEvent;
|
|
2282
|
-
return _regenerator.default.wrap(function
|
|
2283
|
-
while (1) switch (
|
|
2630
|
+
return _regenerator.default.wrap(function _callee55$(_context55) {
|
|
2631
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
2284
2632
|
case 0:
|
|
2285
2633
|
expect.assertions(5);
|
|
2286
2634
|
responsePayload = {
|
|
@@ -2290,24 +2638,24 @@ describe('Supplementary Services tests', function () {
|
|
|
2290
2638
|
jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
|
|
2291
2639
|
call['held'] = true;
|
|
2292
2640
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2293
|
-
var
|
|
2294
|
-
return _regenerator.default.wrap(function
|
|
2295
|
-
while (1) switch (
|
|
2641
|
+
var _ref55 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54(errObj) {
|
|
2642
|
+
return _regenerator.default.wrap(function _callee54$(_context54) {
|
|
2643
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
2296
2644
|
case 0:
|
|
2297
2645
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
|
|
2298
2646
|
expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
|
|
2299
2647
|
case 2:
|
|
2300
2648
|
case "end":
|
|
2301
|
-
return
|
|
2649
|
+
return _context54.stop();
|
|
2302
2650
|
}
|
|
2303
|
-
},
|
|
2651
|
+
}, _callee54);
|
|
2304
2652
|
}));
|
|
2305
2653
|
return function (_x10) {
|
|
2306
|
-
return
|
|
2654
|
+
return _ref55.apply(this, arguments);
|
|
2307
2655
|
};
|
|
2308
2656
|
}());
|
|
2309
2657
|
call.doHoldResume();
|
|
2310
|
-
|
|
2658
|
+
_context55.next = 8;
|
|
2311
2659
|
return (0, _testUtil.flushPromises)(2);
|
|
2312
2660
|
case 8:
|
|
2313
2661
|
/* At this point ,the Call State should be S_CALL_RESUME
|
|
@@ -2320,11 +2668,11 @@ describe('Supplementary Services tests', function () {
|
|
|
2320
2668
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2321
2669
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2322
2670
|
roapEvent.data.type = 'ANSWER';
|
|
2323
|
-
|
|
2671
|
+
_context55.next = 14;
|
|
2324
2672
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2325
2673
|
case 14:
|
|
2326
2674
|
roapEvent.data.type = 'OK';
|
|
2327
|
-
|
|
2675
|
+
_context55.next = 17;
|
|
2328
2676
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2329
2677
|
case 17:
|
|
2330
2678
|
/* Advancing timer by 12 seconds so that it gets timed out */
|
|
@@ -2334,9 +2682,9 @@ describe('Supplementary Services tests', function () {
|
|
|
2334
2682
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2335
2683
|
case 20:
|
|
2336
2684
|
case "end":
|
|
2337
|
-
return
|
|
2685
|
+
return _context55.stop();
|
|
2338
2686
|
}
|
|
2339
|
-
},
|
|
2687
|
+
}, _callee55);
|
|
2340
2688
|
})));
|
|
2341
2689
|
});
|
|
2342
2690
|
describe('Call transfer tests', function () {
|
|
@@ -2368,10 +2716,10 @@ describe('Supplementary Services tests', function () {
|
|
|
2368
2716
|
secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
|
|
2369
2717
|
secondCall['held'] = false;
|
|
2370
2718
|
});
|
|
2371
|
-
it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2719
|
+
it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58() {
|
|
2372
2720
|
var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
|
|
2373
|
-
return _regenerator.default.wrap(function
|
|
2374
|
-
while (1) switch (
|
|
2721
|
+
return _regenerator.default.wrap(function _callee58$(_context58) {
|
|
2722
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
2375
2723
|
case 0:
|
|
2376
2724
|
expect.assertions(9);
|
|
2377
2725
|
responsePayload = {
|
|
@@ -2383,41 +2731,41 @@ describe('Supplementary Services tests', function () {
|
|
|
2383
2731
|
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
2384
2732
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
2385
2733
|
call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
2386
|
-
var
|
|
2387
|
-
return _regenerator.default.wrap(function
|
|
2388
|
-
while (1) switch (
|
|
2734
|
+
var _ref57 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(correlationId) {
|
|
2735
|
+
return _regenerator.default.wrap(function _callee56$(_context56) {
|
|
2736
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
2389
2737
|
case 0:
|
|
2390
2738
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2391
2739
|
case 1:
|
|
2392
2740
|
case "end":
|
|
2393
|
-
return
|
|
2741
|
+
return _context56.stop();
|
|
2394
2742
|
}
|
|
2395
|
-
},
|
|
2743
|
+
}, _callee56);
|
|
2396
2744
|
}));
|
|
2397
2745
|
return function (_x11) {
|
|
2398
|
-
return
|
|
2746
|
+
return _ref57.apply(this, arguments);
|
|
2399
2747
|
};
|
|
2400
2748
|
}());
|
|
2401
2749
|
secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
2402
|
-
var
|
|
2403
|
-
return _regenerator.default.wrap(function
|
|
2404
|
-
while (1) switch (
|
|
2750
|
+
var _ref58 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57(correlationId) {
|
|
2751
|
+
return _regenerator.default.wrap(function _callee57$(_context57) {
|
|
2752
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
2405
2753
|
case 0:
|
|
2406
2754
|
expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
|
|
2407
2755
|
case 1:
|
|
2408
2756
|
case "end":
|
|
2409
|
-
return
|
|
2757
|
+
return _context57.stop();
|
|
2410
2758
|
}
|
|
2411
|
-
},
|
|
2759
|
+
}, _callee57);
|
|
2412
2760
|
}));
|
|
2413
2761
|
return function (_x12) {
|
|
2414
|
-
return
|
|
2762
|
+
return _ref58.apply(this, arguments);
|
|
2415
2763
|
};
|
|
2416
2764
|
}());
|
|
2417
|
-
|
|
2765
|
+
_context58.next = 10;
|
|
2418
2766
|
return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
|
|
2419
2767
|
case 10:
|
|
2420
|
-
|
|
2768
|
+
_context58.next = 12;
|
|
2421
2769
|
return (0, _testUtil.flushPromises)(2);
|
|
2422
2770
|
case 12:
|
|
2423
2771
|
expect(requestSpy).toBeCalled();
|
|
@@ -2437,14 +2785,14 @@ describe('Supplementary Services tests', function () {
|
|
|
2437
2785
|
expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
2438
2786
|
case 21:
|
|
2439
2787
|
case "end":
|
|
2440
|
-
return
|
|
2788
|
+
return _context58.stop();
|
|
2441
2789
|
}
|
|
2442
|
-
},
|
|
2790
|
+
}, _callee58);
|
|
2443
2791
|
})));
|
|
2444
|
-
it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2792
|
+
it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60() {
|
|
2445
2793
|
var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
|
|
2446
|
-
return _regenerator.default.wrap(function
|
|
2447
|
-
while (1) switch (
|
|
2794
|
+
return _regenerator.default.wrap(function _callee60$(_context60) {
|
|
2795
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
2448
2796
|
case 0:
|
|
2449
2797
|
expect.assertions(7);
|
|
2450
2798
|
responsePayload = {
|
|
@@ -2456,25 +2804,25 @@ describe('Supplementary Services tests', function () {
|
|
|
2456
2804
|
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
2457
2805
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
2458
2806
|
call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
2459
|
-
var
|
|
2460
|
-
return _regenerator.default.wrap(function
|
|
2461
|
-
while (1) switch (
|
|
2807
|
+
var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(correlationId) {
|
|
2808
|
+
return _regenerator.default.wrap(function _callee59$(_context59) {
|
|
2809
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
2462
2810
|
case 0:
|
|
2463
2811
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2464
2812
|
case 1:
|
|
2465
2813
|
case "end":
|
|
2466
|
-
return
|
|
2814
|
+
return _context59.stop();
|
|
2467
2815
|
}
|
|
2468
|
-
},
|
|
2816
|
+
}, _callee59);
|
|
2469
2817
|
}));
|
|
2470
2818
|
return function (_x13) {
|
|
2471
|
-
return
|
|
2819
|
+
return _ref60.apply(this, arguments);
|
|
2472
2820
|
};
|
|
2473
2821
|
}());
|
|
2474
|
-
|
|
2822
|
+
_context60.next = 9;
|
|
2475
2823
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
|
|
2476
2824
|
case 9:
|
|
2477
|
-
|
|
2825
|
+
_context60.next = 11;
|
|
2478
2826
|
return (0, _testUtil.flushPromises)(2);
|
|
2479
2827
|
case 11:
|
|
2480
2828
|
expect(requestSpy).toBeCalled();
|
|
@@ -2490,14 +2838,14 @@ describe('Supplementary Services tests', function () {
|
|
|
2490
2838
|
expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
2491
2839
|
case 18:
|
|
2492
2840
|
case "end":
|
|
2493
|
-
return
|
|
2841
|
+
return _context60.stop();
|
|
2494
2842
|
}
|
|
2495
|
-
},
|
|
2843
|
+
}, _callee60);
|
|
2496
2844
|
})));
|
|
2497
|
-
it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2845
|
+
it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61() {
|
|
2498
2846
|
var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
|
|
2499
|
-
return _regenerator.default.wrap(function
|
|
2500
|
-
while (1) switch (
|
|
2847
|
+
return _regenerator.default.wrap(function _callee61$(_context61) {
|
|
2848
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
2501
2849
|
case 0:
|
|
2502
2850
|
responsePayload = {
|
|
2503
2851
|
statusCode: 403,
|
|
@@ -2507,10 +2855,10 @@ describe('Supplementary Services tests', function () {
|
|
|
2507
2855
|
requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
2508
2856
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2509
2857
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
2510
|
-
|
|
2858
|
+
_context61.next = 7;
|
|
2511
2859
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
|
|
2512
2860
|
case 7:
|
|
2513
|
-
|
|
2861
|
+
_context61.next = 9;
|
|
2514
2862
|
return (0, _testUtil.flushPromises)(1);
|
|
2515
2863
|
case 9:
|
|
2516
2864
|
expect(requestSpy).toBeCalled();
|
|
@@ -2526,14 +2874,14 @@ describe('Supplementary Services tests', function () {
|
|
|
2526
2874
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
|
|
2527
2875
|
case 16:
|
|
2528
2876
|
case "end":
|
|
2529
|
-
return
|
|
2877
|
+
return _context61.stop();
|
|
2530
2878
|
}
|
|
2531
|
-
},
|
|
2879
|
+
}, _callee61);
|
|
2532
2880
|
})));
|
|
2533
|
-
it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2881
|
+
it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62() {
|
|
2534
2882
|
var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
|
|
2535
|
-
return _regenerator.default.wrap(function
|
|
2536
|
-
while (1) switch (
|
|
2883
|
+
return _regenerator.default.wrap(function _callee62$(_context62) {
|
|
2884
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
2537
2885
|
case 0:
|
|
2538
2886
|
responsePayload = {
|
|
2539
2887
|
statusCode: 403,
|
|
@@ -2543,10 +2891,10 @@ describe('Supplementary Services tests', function () {
|
|
|
2543
2891
|
requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
2544
2892
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2545
2893
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
2546
|
-
|
|
2894
|
+
_context62.next = 7;
|
|
2547
2895
|
return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
|
|
2548
2896
|
case 7:
|
|
2549
|
-
|
|
2897
|
+
_context62.next = 9;
|
|
2550
2898
|
return (0, _testUtil.flushPromises)(2);
|
|
2551
2899
|
case 9:
|
|
2552
2900
|
expect(requestSpy).toBeCalled();
|
|
@@ -2563,18 +2911,18 @@ describe('Supplementary Services tests', function () {
|
|
|
2563
2911
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
|
|
2564
2912
|
case 17:
|
|
2565
2913
|
case "end":
|
|
2566
|
-
return
|
|
2914
|
+
return _context62.stop();
|
|
2567
2915
|
}
|
|
2568
|
-
},
|
|
2916
|
+
}, _callee62);
|
|
2569
2917
|
})));
|
|
2570
|
-
it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2918
|
+
it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63() {
|
|
2571
2919
|
var requestSpy, warnSpy;
|
|
2572
|
-
return _regenerator.default.wrap(function
|
|
2573
|
-
while (1) switch (
|
|
2920
|
+
return _regenerator.default.wrap(function _callee63$(_context63) {
|
|
2921
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
2574
2922
|
case 0:
|
|
2575
2923
|
requestSpy = jest.spyOn(webex, 'request');
|
|
2576
2924
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2577
|
-
|
|
2925
|
+
_context63.next = 4;
|
|
2578
2926
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
|
|
2579
2927
|
case 4:
|
|
2580
2928
|
/* We should be in CALL_ESTABLISHED state */
|
|
@@ -2585,18 +2933,18 @@ describe('Supplementary Services tests', function () {
|
|
|
2585
2933
|
expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
2586
2934
|
case 9:
|
|
2587
2935
|
case "end":
|
|
2588
|
-
return
|
|
2936
|
+
return _context63.stop();
|
|
2589
2937
|
}
|
|
2590
|
-
},
|
|
2938
|
+
}, _callee63);
|
|
2591
2939
|
})));
|
|
2592
|
-
it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2940
|
+
it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64() {
|
|
2593
2941
|
var requestSpy, warnSpy;
|
|
2594
|
-
return _regenerator.default.wrap(function
|
|
2595
|
-
while (1) switch (
|
|
2942
|
+
return _regenerator.default.wrap(function _callee64$(_context64) {
|
|
2943
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
2596
2944
|
case 0:
|
|
2597
2945
|
requestSpy = jest.spyOn(webex, 'request');
|
|
2598
2946
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2599
|
-
|
|
2947
|
+
_context64.next = 4;
|
|
2600
2948
|
return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
|
|
2601
2949
|
case 4:
|
|
2602
2950
|
/* We should be in CALL_ESTABLISHED state */
|
|
@@ -2607,9 +2955,9 @@ describe('Supplementary Services tests', function () {
|
|
|
2607
2955
|
expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
2608
2956
|
case 9:
|
|
2609
2957
|
case "end":
|
|
2610
|
-
return
|
|
2958
|
+
return _context64.stop();
|
|
2611
2959
|
}
|
|
2612
|
-
},
|
|
2960
|
+
}, _callee64);
|
|
2613
2961
|
})));
|
|
2614
2962
|
});
|
|
2615
2963
|
});
|