@webex/calling 3.0.0-next.2 → 3.0.0-next.4
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/CHANGELOG.md +1403 -0
- package/README.md +74 -74
- package/dist/module/CallHistory/CallHistory.js +81 -81
- package/dist/module/CallHistory/callHistoryFixtures.js +307 -307
- package/dist/module/CallHistory/constants.js +9 -9
- package/dist/module/CallHistory/types.js +1 -1
- package/dist/module/CallSettings/CallSettings.js +65 -65
- package/dist/module/CallSettings/UcmBackendConnector.js +100 -100
- package/dist/module/CallSettings/WxCallBackendConnector.js +287 -287
- package/dist/module/CallSettings/constants.js +11 -11
- package/dist/module/CallSettings/testFixtures.js +62 -62
- package/dist/module/CallSettings/types.js +1 -1
- package/dist/module/CallingClient/CallingClient.js +248 -248
- package/dist/module/CallingClient/callRecordFixtures.js +93 -93
- package/dist/module/CallingClient/calling/CallerId/index.js +169 -169
- package/dist/module/CallingClient/calling/CallerId/types.js +1 -1
- package/dist/module/CallingClient/calling/call.js +1658 -1658
- package/dist/module/CallingClient/calling/callManager.js +284 -284
- package/dist/module/CallingClient/calling/index.js +2 -2
- package/dist/module/CallingClient/calling/types.js +53 -53
- package/dist/module/CallingClient/callingClientFixtures.js +38 -38
- package/dist/module/CallingClient/constants.js +122 -122
- package/dist/module/CallingClient/line/index.js +158 -158
- package/dist/module/CallingClient/line/types.js +15 -15
- package/dist/module/CallingClient/registration/index.js +1 -1
- package/dist/module/CallingClient/registration/register.js +507 -507
- package/dist/module/CallingClient/registration/registerFixtures.js +28 -28
- package/dist/module/CallingClient/registration/types.js +1 -1
- package/dist/module/CallingClient/types.js +1 -1
- package/dist/module/Contacts/ContactsClient.js +484 -484
- package/dist/module/Contacts/constants.js +20 -20
- package/dist/module/Contacts/contactFixtures.js +284 -284
- package/dist/module/Contacts/types.js +10 -10
- package/dist/module/Errors/catalog/CallError.js +26 -26
- package/dist/module/Errors/catalog/CallingDeviceError.js +18 -18
- package/dist/module/Errors/catalog/ExtendedError.js +10 -10
- package/dist/module/Errors/catalog/LineError.js +24 -24
- package/dist/module/Errors/index.js +2 -2
- package/dist/module/Errors/types.js +48 -48
- package/dist/module/Events/impl/index.js +19 -19
- package/dist/module/Events/types.js +83 -83
- package/dist/module/Logger/index.js +114 -114
- package/dist/module/Logger/types.js +25 -25
- package/dist/module/Metrics/index.js +232 -232
- package/dist/module/Metrics/types.js +37 -37
- package/dist/module/SDKConnector/index.js +39 -39
- package/dist/module/SDKConnector/types.js +1 -1
- package/dist/module/SDKConnector/utils.js +12 -12
- package/dist/module/Voicemail/BroadworksBackendConnector.js +291 -291
- package/dist/module/Voicemail/UcmBackendConnector.js +279 -279
- package/dist/module/Voicemail/Voicemail.js +110 -110
- package/dist/module/Voicemail/WxCallBackendConnector.js +279 -279
- package/dist/module/Voicemail/constants.js +29 -29
- package/dist/module/Voicemail/types.js +1 -1
- package/dist/module/Voicemail/voicemailFixture.js +510 -510
- package/dist/module/api.js +6 -6
- package/dist/module/common/Utils.js +802 -802
- package/dist/module/common/constants.js +41 -41
- package/dist/module/common/index.js +1 -1
- package/dist/module/common/testUtil.js +938 -938
- package/dist/module/common/types.js +57 -57
- package/dist/module/index.js +8 -8
- package/dist/types/CallHistory/CallHistory.d.ts +17 -17
- package/dist/types/CallHistory/callHistoryFixtures.d.ts +94 -94
- package/dist/types/CallHistory/constants.d.ts +9 -9
- package/dist/types/CallHistory/types.d.ts +18 -18
- package/dist/types/CallSettings/CallSettings.d.ts +19 -19
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +19 -19
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts +21 -21
- package/dist/types/CallSettings/constants.d.ts +11 -11
- package/dist/types/CallSettings/testFixtures.d.ts +15 -15
- package/dist/types/CallSettings/types.d.ts +107 -107
- package/dist/types/CallingClient/CallingClient.d.ts +35 -35
- package/dist/types/CallingClient/callRecordFixtures.d.ts +3 -3
- package/dist/types/CallingClient/calling/CallerId/index.d.ts +17 -17
- package/dist/types/CallingClient/calling/CallerId/types.d.ts +41 -41
- package/dist/types/CallingClient/calling/call.d.ts +96 -96
- package/dist/types/CallingClient/calling/callManager.d.ts +25 -25
- package/dist/types/CallingClient/calling/index.d.ts +2 -2
- package/dist/types/CallingClient/calling/types.d.ts +206 -206
- package/dist/types/CallingClient/callingClientFixtures.d.ts +18 -18
- package/dist/types/CallingClient/constants.d.ts +122 -122
- package/dist/types/CallingClient/line/index.d.ts +43 -43
- package/dist/types/CallingClient/line/types.d.ts +55 -55
- package/dist/types/CallingClient/registration/index.d.ts +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +64 -64
- package/dist/types/CallingClient/registration/registerFixtures.d.ts +28 -28
- package/dist/types/CallingClient/registration/types.d.ts +20 -20
- package/dist/types/CallingClient/types.d.ts +29 -29
- package/dist/types/Contacts/ContactsClient.d.ts +26 -26
- package/dist/types/Contacts/constants.d.ts +19 -19
- package/dist/types/Contacts/contactFixtures.d.ts +280 -280
- package/dist/types/Contacts/types.d.ts +72 -72
- package/dist/types/Errors/catalog/CallError.d.ts +11 -11
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts +10 -10
- package/dist/types/Errors/catalog/ExtendedError.d.ts +6 -6
- package/dist/types/Errors/catalog/LineError.d.ts +10 -10
- package/dist/types/Errors/index.d.ts +2 -2
- package/dist/types/Errors/types.d.ts +60 -60
- package/dist/types/Events/impl/index.d.ts +8 -8
- package/dist/types/Events/types.d.ts +288 -288
- package/dist/types/Logger/index.d.ts +12 -12
- package/dist/types/Logger/types.d.ts +25 -25
- package/dist/types/Metrics/index.d.ts +5 -5
- package/dist/types/Metrics/types.d.ts +42 -42
- package/dist/types/SDKConnector/index.d.ts +12 -12
- package/dist/types/SDKConnector/types.d.ts +128 -128
- package/dist/types/SDKConnector/utils.d.ts +5 -5
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts +27 -27
- package/dist/types/Voicemail/UcmBackendConnector.d.ts +34 -34
- package/dist/types/Voicemail/Voicemail.d.ts +27 -27
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +23 -23
- package/dist/types/Voicemail/constants.d.ts +29 -29
- package/dist/types/Voicemail/types.d.ts +133 -133
- package/dist/types/Voicemail/voicemailFixture.d.ts +417 -417
- package/dist/types/api.d.ts +16 -16
- package/dist/types/common/Utils.d.ts +34 -34
- package/dist/types/common/constants.d.ts +41 -41
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/common/testUtil.d.ts +3611 -3611
- package/dist/types/common/types.d.ts +191 -191
- package/dist/types/index.d.ts +8 -8
- package/package.json +4 -4
- package/dist/CallHistory/CallHistory.js +0 -203
- package/dist/CallHistory/CallHistory.js.map +0 -1
- package/dist/CallHistory/CallHistory.test.js +0 -133
- package/dist/CallHistory/CallHistory.test.js.map +0 -1
- package/dist/CallHistory/callHistoryFixtures.js +0 -310
- package/dist/CallHistory/callHistoryFixtures.js.map +0 -1
- package/dist/CallHistory/constants.js +0 -26
- package/dist/CallHistory/constants.js.map +0 -1
- package/dist/CallHistory/types.js +0 -7
- package/dist/CallHistory/types.js.map +0 -1
- package/dist/CallSettings/CallSettings.js +0 -276
- package/dist/CallSettings/CallSettings.js.map +0 -1
- package/dist/CallSettings/CallSettings.test.js +0 -122
- package/dist/CallSettings/CallSettings.test.js.map +0 -1
- package/dist/CallSettings/UcmBackendConnector.js +0 -217
- package/dist/CallSettings/UcmBackendConnector.js.map +0 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +0 -227
- package/dist/CallSettings/UcmBackendConnector.test.js.map +0 -1
- package/dist/CallSettings/WxCallBackendConnector.js +0 -541
- package/dist/CallSettings/WxCallBackendConnector.js.map +0 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +0 -802
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +0 -1
- package/dist/CallSettings/constants.js +0 -30
- package/dist/CallSettings/constants.js.map +0 -1
- package/dist/CallSettings/testFixtures.js +0 -72
- package/dist/CallSettings/testFixtures.js.map +0 -1
- package/dist/CallSettings/types.js +0 -7
- package/dist/CallSettings/types.js.map +0 -1
- package/dist/CallingClient/CallingClient.js +0 -572
- package/dist/CallingClient/CallingClient.js.map +0 -1
- package/dist/CallingClient/CallingClient.test.js +0 -931
- package/dist/CallingClient/CallingClient.test.js.map +0 -1
- package/dist/CallingClient/callRecordFixtures.js +0 -103
- package/dist/CallingClient/callRecordFixtures.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/index.js +0 -287
- package/dist/CallingClient/calling/CallerId/index.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +0 -274
- package/dist/CallingClient/calling/CallerId/index.test.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/types.js +0 -7
- package/dist/CallingClient/calling/CallerId/types.js.map +0 -1
- package/dist/CallingClient/calling/call.js +0 -2995
- package/dist/CallingClient/calling/call.js.map +0 -1
- package/dist/CallingClient/calling/call.test.js +0 -2614
- package/dist/CallingClient/calling/call.test.js.map +0 -1
- package/dist/CallingClient/calling/callManager.js +0 -443
- package/dist/CallingClient/calling/callManager.js.map +0 -1
- package/dist/CallingClient/calling/callManager.test.js +0 -683
- package/dist/CallingClient/calling/callManager.test.js.map +0 -1
- package/dist/CallingClient/calling/index.js +0 -30
- package/dist/CallingClient/calling/index.js.map +0 -1
- package/dist/CallingClient/calling/types.js +0 -71
- package/dist/CallingClient/calling/types.js.map +0 -1
- package/dist/CallingClient/callingClientFixtures.js +0 -53
- package/dist/CallingClient/callingClientFixtures.js.map +0 -1
- package/dist/CallingClient/constants.js +0 -226
- package/dist/CallingClient/constants.js.map +0 -1
- package/dist/CallingClient/line/index.js +0 -312
- package/dist/CallingClient/line/index.js.map +0 -1
- package/dist/CallingClient/line/line.test.js +0 -270
- package/dist/CallingClient/line/line.test.js.map +0 -1
- package/dist/CallingClient/line/types.js +0 -25
- package/dist/CallingClient/line/types.js.map +0 -1
- package/dist/CallingClient/registration/index.js +0 -19
- package/dist/CallingClient/registration/index.js.map +0 -1
- package/dist/CallingClient/registration/register.js +0 -1295
- package/dist/CallingClient/registration/register.js.map +0 -1
- package/dist/CallingClient/registration/register.test.js +0 -838
- package/dist/CallingClient/registration/register.test.js.map +0 -1
- package/dist/CallingClient/registration/registerFixtures.js +0 -41
- package/dist/CallingClient/registration/registerFixtures.js.map +0 -1
- package/dist/CallingClient/registration/types.js +0 -7
- package/dist/CallingClient/registration/types.js.map +0 -1
- package/dist/CallingClient/types.js +0 -7
- package/dist/CallingClient/types.js.map +0 -1
- package/dist/Contacts/ContactsClient.js +0 -1139
- package/dist/Contacts/ContactsClient.js.map +0 -1
- package/dist/Contacts/ContactsClient.test.js +0 -725
- package/dist/Contacts/ContactsClient.test.js.map +0 -1
- package/dist/Contacts/constants.js +0 -36
- package/dist/Contacts/constants.js.map +0 -1
- package/dist/Contacts/contactFixtures.js +0 -340
- package/dist/Contacts/contactFixtures.js.map +0 -1
- package/dist/Contacts/types.js +0 -20
- package/dist/Contacts/types.js.map +0 -1
- package/dist/Errors/catalog/CallError.js +0 -94
- package/dist/Errors/catalog/CallError.js.map +0 -1
- package/dist/Errors/catalog/CallingDeviceError.js +0 -88
- package/dist/Errors/catalog/CallingDeviceError.js.map +0 -1
- package/dist/Errors/catalog/ExtendedError.js +0 -45
- package/dist/Errors/catalog/ExtendedError.js.map +0 -1
- package/dist/Errors/catalog/LineError.js +0 -90
- package/dist/Errors/catalog/LineError.js.map +0 -1
- package/dist/Errors/index.js +0 -21
- package/dist/Errors/index.js.map +0 -1
- package/dist/Errors/types.js +0 -62
- package/dist/Errors/types.js.map +0 -1
- package/dist/Events/impl/index.js +0 -82
- package/dist/Events/impl/index.js.map +0 -1
- package/dist/Events/types.js +0 -111
- package/dist/Events/types.js.map +0 -1
- package/dist/Logger/index.js +0 -221
- package/dist/Logger/index.js.map +0 -1
- package/dist/Logger/index.test.js +0 -62
- package/dist/Logger/index.test.js.map +0 -1
- package/dist/Logger/types.js +0 -37
- package/dist/Logger/types.js.map +0 -1
- package/dist/Metrics/index.js +0 -329
- package/dist/Metrics/index.js.map +0 -1
- package/dist/Metrics/index.test.js +0 -291
- package/dist/Metrics/index.test.js.map +0 -1
- package/dist/Metrics/types.js +0 -50
- package/dist/Metrics/types.js.map +0 -1
- package/dist/SDKConnector/index.js +0 -105
- package/dist/SDKConnector/index.js.map +0 -1
- package/dist/SDKConnector/index.test.js +0 -9
- package/dist/SDKConnector/index.test.js.map +0 -1
- package/dist/SDKConnector/types.js +0 -7
- package/dist/SDKConnector/types.js.map +0 -1
- package/dist/SDKConnector/utils.js +0 -40
- package/dist/SDKConnector/utils.js.map +0 -1
- package/dist/SDKConnector/utils.test.js +0 -9
- package/dist/SDKConnector/utils.test.js.map +0 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +0 -632
- package/dist/Voicemail/BroadworksBackendConnector.js.map +0 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +0 -733
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/UcmBackendConnector.js +0 -566
- package/dist/Voicemail/UcmBackendConnector.js.map +0 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +0 -628
- package/dist/Voicemail/UcmBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/Voicemail.js +0 -378
- package/dist/Voicemail/Voicemail.js.map +0 -1
- package/dist/Voicemail/Voicemail.test.js +0 -226
- package/dist/Voicemail/Voicemail.test.js.map +0 -1
- package/dist/Voicemail/WxCallBackendConnector.js +0 -540
- package/dist/Voicemail/WxCallBackendConnector.js.map +0 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +0 -942
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/constants.js +0 -66
- package/dist/Voicemail/constants.js.map +0 -1
- package/dist/Voicemail/types.js +0 -7
- package/dist/Voicemail/types.js.map +0 -1
- package/dist/Voicemail/voicemailFixture.js +0 -559
- package/dist/Voicemail/voicemailFixture.js.map +0 -1
- package/dist/api.js +0 -134
- package/dist/api.js.map +0 -1
- package/dist/common/Utils.js +0 -1264
- package/dist/common/Utils.js.map +0 -1
- package/dist/common/Utils.test.js +0 -1227
- package/dist/common/Utils.test.js.map +0 -1
- package/dist/common/constants.js +0 -90
- package/dist/common/constants.js.map +0 -1
- package/dist/common/index.js +0 -19
- package/dist/common/index.js.map +0 -1
- package/dist/common/testUtil.js +0 -968
- package/dist/common/testUtil.js.map +0 -1
- package/dist/common/types.js +0 -75
- package/dist/common/types.js.map +0 -1
- package/dist/index.js +0 -63
- package/dist/index.js.map +0 -1
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
4
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
5
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
6
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
7
|
-
var _testUtil = require("../../../common/testUtil");
|
|
8
|
-
var _ = require(".");
|
|
9
|
-
var _Logger = _interopRequireDefault(require("../../../Logger"));
|
|
10
|
-
/* eslint-disable dot-notation */
|
|
11
|
-
|
|
12
|
-
var waitForMsecs = function waitForMsecs(msec) {
|
|
13
|
-
return new _promise.default(function (resolve) {
|
|
14
|
-
setTimeout(resolve, msec);
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
18
|
-
describe('CallerId tests', function () {
|
|
19
|
-
var dummyAvatar = 'https://avatar-int-us-east-1.webexcontent.com/Avtr~V1~1704d30d-a131-4bc7-9449-948487643793/V1~bf911e86a1561896d7d0053b46a8d0c9ed82a7bc434a1f84621c2c45cc825f37~3720694b1e4340818a3d12d70eb2b6e1~80';
|
|
20
|
-
var dummyScimResponse = {
|
|
21
|
-
totalResults: '1',
|
|
22
|
-
itemsPerPage: '1',
|
|
23
|
-
startIndex: '1',
|
|
24
|
-
schemas: ['urn:scim:schemas:core:1.0', 'urn:scim:schemas:extension:cisco:commonidentity:1.0'],
|
|
25
|
-
Resources: [{
|
|
26
|
-
userName: 'atlas.test.wxcwebrtc+user8@gmail.com',
|
|
27
|
-
emails: [{
|
|
28
|
-
primary: true,
|
|
29
|
-
type: 'work',
|
|
30
|
-
value: 'atlas.test.wxcwebrtc+user8@gmail.com'
|
|
31
|
-
}],
|
|
32
|
-
name: {
|
|
33
|
-
givenName: 'Cathy',
|
|
34
|
-
familyName: 'James'
|
|
35
|
-
},
|
|
36
|
-
phoneNumbers: [{
|
|
37
|
-
primary: true,
|
|
38
|
-
type: 'work',
|
|
39
|
-
value: '5008'
|
|
40
|
-
}],
|
|
41
|
-
entitlements: ['basic-meeting', 'basic-message', 'bc-sp-standard', 'screen-share', 'spark', 'spark-test-account', 'squared-call-initiation', 'webex-squared'],
|
|
42
|
-
cisSyncSource: 'SCIM',
|
|
43
|
-
photos: [{
|
|
44
|
-
type: 'photo',
|
|
45
|
-
value: dummyAvatar
|
|
46
|
-
}, {
|
|
47
|
-
type: 'thumbnail',
|
|
48
|
-
value: dummyAvatar
|
|
49
|
-
}],
|
|
50
|
-
id: '652fe0c7-05ce-4acd-8bda-9a080830187f',
|
|
51
|
-
meta: {
|
|
52
|
-
created: '2022-03-16T16:13:53.847Z',
|
|
53
|
-
lastModified: '2022-05-31T14:39:12.782Z',
|
|
54
|
-
lastLoginTime: '2022-05-31T14:39:12.780Z',
|
|
55
|
-
version: 'W/"66025591113"',
|
|
56
|
-
location: 'https://identitybts.webex.com/identity/scim/1704d30d-a131-4bc7-9449-948487643793/v1/Users/652fe0c7-05ce-4acd-8bda-9a080830187f',
|
|
57
|
-
organizationID: '1704d30d-a131-4bc7-9449-948487643793',
|
|
58
|
-
creator: '97fe25e3-d3e8-400e-856b-5b0cd5b0c790',
|
|
59
|
-
modifier: '8c7abf2f-0c8e-49cf-b8e4-693d4ec7daee'
|
|
60
|
-
},
|
|
61
|
-
displayName: 'Cathy',
|
|
62
|
-
active: true,
|
|
63
|
-
licenseID: ['BCSTD_8c81f40c-e848-484e-8ca8-0fb6dabc75a5'],
|
|
64
|
-
userSettings: ['{"spark.signUpDate":"1648547902173"}', '{"user-origin":"admin-invited"}'],
|
|
65
|
-
sipAddresses: [{
|
|
66
|
-
type: 'cloud-calling',
|
|
67
|
-
value: 'atlas.test.wxcwebrtc+user8@webrtcmobius.call.wbx2.com',
|
|
68
|
-
primary: true
|
|
69
|
-
}],
|
|
70
|
-
isTeamsOnJabberEnabled: false,
|
|
71
|
-
isUCCallOnJabberEnabled: false,
|
|
72
|
-
userType: 'user',
|
|
73
|
-
mfaEnabled: false,
|
|
74
|
-
teamsClusterId: 'urn:TEAM:us-east-1_int13'
|
|
75
|
-
}]
|
|
76
|
-
};
|
|
77
|
-
webex.request.mockResolvedValue({
|
|
78
|
-
statusCode: 200,
|
|
79
|
-
body: dummyScimResponse
|
|
80
|
-
});
|
|
81
|
-
var callerId;
|
|
82
|
-
it('create callerId Object', function () {
|
|
83
|
-
callerId = (0, _.createCallerId)(webex, function () {
|
|
84
|
-
return _Logger.default.log('dummy print', {});
|
|
85
|
-
});
|
|
86
|
-
expect(callerId).toBeTruthy();
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
/* Follow tests will follow different combinations of the headers.
|
|
90
|
-
* We will check whether the priority order is followed or not.
|
|
91
|
-
*/
|
|
92
|
-
it(' When PA-ID, From header is present along with x-broad-works, ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
93
|
-
var dummyCallerId, output;
|
|
94
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
95
|
-
while (1) switch (_context.prev = _context.next) {
|
|
96
|
-
case 0:
|
|
97
|
-
dummyCallerId = {
|
|
98
|
-
'x-broadworks-remote-party-info': 'userId="nkjwuovmbo@64941297.int10.bcld.webex.com";userDn="tel:+12142865888;ext=5888;country-code=1";externalId=69fde5ad-fb8b-4a1b-9998-b0999e95719b',
|
|
99
|
-
'p-asserted-identity': '"Bob Marley" <sip:5888@10.155.4.7;user=phone>',
|
|
100
|
-
from: '"Alice" <sip:5889@64941297.int10.bcld.webex.com>;tag=1932136170-1654008881246'
|
|
101
|
-
};
|
|
102
|
-
output = callerId.fetchCallerDetails(dummyCallerId);
|
|
103
|
-
/* PAI should be preferred */
|
|
104
|
-
expect(output.name).toStrictEqual('Bob Marley');
|
|
105
|
-
expect(output.num).toStrictEqual('5888');
|
|
106
|
-
_context.next = 6;
|
|
107
|
-
return waitForMsecs(50);
|
|
108
|
-
case 6:
|
|
109
|
-
/* Should be overwritten by x-broadworks */
|
|
110
|
-
expect(callerId['callerInfo'].avatarSrc).toStrictEqual(dummyAvatar);
|
|
111
|
-
expect(callerId['callerInfo'].id).toStrictEqual(dummyScimResponse.Resources[0].id);
|
|
112
|
-
expect(callerId['callerInfo'].name).toStrictEqual('Cathy');
|
|
113
|
-
expect(callerId['callerInfo'].num).toStrictEqual('5008');
|
|
114
|
-
case 10:
|
|
115
|
-
case "end":
|
|
116
|
-
return _context.stop();
|
|
117
|
-
}
|
|
118
|
-
}, _callee);
|
|
119
|
-
})));
|
|
120
|
-
it(' When PA-ID ,From header is present along with x-broad-works , but name in PAI is of wrong format', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
121
|
-
var dummyCallerId, output;
|
|
122
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
123
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
124
|
-
case 0:
|
|
125
|
-
dummyCallerId = {
|
|
126
|
-
'x-broadworks-remote-party-info': 'userId="nkjwuovmbo@64941297.int10.bcld.webex.com";userDn="tel:+12142865888;ext=5888;country-code=1";externalId=69fde5ad-fb8b-4a1b-9998-b0999e95719b',
|
|
127
|
-
'p-asserted-identity': '"69fde5ad-fb8b-4a1b-9998-b0999e95719b" <sip:5888@10.155.4.7;user=phone>',
|
|
128
|
-
from: '"Alice" <sip:5889@64941297.int10.bcld.webex.com>;tag=1932136170-1654008881246'
|
|
129
|
-
};
|
|
130
|
-
callerId['callerInfo'] = {};
|
|
131
|
-
output = callerId.fetchCallerDetails(dummyCallerId);
|
|
132
|
-
/* PAI name is ignored and From's name should be taken, but number is taken from PAI */
|
|
133
|
-
expect(output.name).toStrictEqual('Alice');
|
|
134
|
-
expect(output.num).toStrictEqual('5888');
|
|
135
|
-
_context2.next = 7;
|
|
136
|
-
return waitForMsecs(50);
|
|
137
|
-
case 7:
|
|
138
|
-
/* Should be overwritten by x-broadworks */
|
|
139
|
-
expect(callerId['callerInfo'].avatarSrc).toStrictEqual(dummyAvatar);
|
|
140
|
-
expect(callerId['callerInfo'].id).toStrictEqual(dummyScimResponse.Resources[0].id);
|
|
141
|
-
expect(callerId['callerInfo'].name).toStrictEqual('Cathy');
|
|
142
|
-
expect(callerId['callerInfo'].num).toStrictEqual('5008');
|
|
143
|
-
case 11:
|
|
144
|
-
case "end":
|
|
145
|
-
return _context2.stop();
|
|
146
|
-
}
|
|
147
|
-
}, _callee2);
|
|
148
|
-
})));
|
|
149
|
-
it(' When PA-ID ,From header is present along with x-broad-works , but name in PAI is of wrong format', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
150
|
-
var dummyCallerId, output;
|
|
151
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
152
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
153
|
-
case 0:
|
|
154
|
-
dummyCallerId = {
|
|
155
|
-
'x-broadworks-remote-party-info': 'userId="nkjwuovmbo@64941297.int10.bcld.webex.com";userDn="tel:+12142865888;ext=5888;country-code=1";externalId=69fde5ad-fb8b-4a1b-9998-b0999e95719b',
|
|
156
|
-
'p-asserted-identity': '"69fde5ad-fb8b-4a1b-9998-b0999e95719b" <sip:69fde5ad-fb8b-4a1b-9998-b0999e95719b@10.155.4.7;user=phone>',
|
|
157
|
-
from: '"Alice" <sip:5889@64941297.int10.bcld.webex.com>;tag=1932136170-1654008881246'
|
|
158
|
-
};
|
|
159
|
-
callerId['callerInfo'] = {};
|
|
160
|
-
output = callerId.fetchCallerDetails(dummyCallerId);
|
|
161
|
-
/* PAI name and number is ignored and From's name, number should be taken */
|
|
162
|
-
expect(output.name).toStrictEqual('Alice');
|
|
163
|
-
expect(output.num).toStrictEqual('5889');
|
|
164
|
-
_context3.next = 7;
|
|
165
|
-
return waitForMsecs(50);
|
|
166
|
-
case 7:
|
|
167
|
-
/* Should be overwritten by x-broadworks */
|
|
168
|
-
expect(callerId['callerInfo'].avatarSrc).toStrictEqual(dummyAvatar);
|
|
169
|
-
expect(callerId['callerInfo'].id).toStrictEqual(dummyScimResponse.Resources[0].id);
|
|
170
|
-
expect(callerId['callerInfo'].name).toStrictEqual('Cathy');
|
|
171
|
-
expect(callerId['callerInfo'].num).toStrictEqual('5008');
|
|
172
|
-
case 11:
|
|
173
|
-
case "end":
|
|
174
|
-
return _context3.stop();
|
|
175
|
-
}
|
|
176
|
-
}, _callee3);
|
|
177
|
-
})));
|
|
178
|
-
it(' When PA-ID is present but From header is absent', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
179
|
-
var dummyCallerId, output;
|
|
180
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
181
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
182
|
-
case 0:
|
|
183
|
-
dummyCallerId = {
|
|
184
|
-
'x-broadworks-remote-party-info': 'userId="nkjwuovmbo@64941297.int10.bcld.webex.com";userDn="tel:+12142865888;ext=5888;country-code=1";externalId=69fde5ad-fb8b-4a1b-9998-b0999e95719b',
|
|
185
|
-
'p-asserted-identity': '"Bob Marley" <sip:5888@10.155.4.7;user=phone>'
|
|
186
|
-
};
|
|
187
|
-
callerId['callerInfo'] = {};
|
|
188
|
-
output = callerId.fetchCallerDetails(dummyCallerId);
|
|
189
|
-
/* PAI name and number is taken */
|
|
190
|
-
expect(output.name).toStrictEqual('Bob Marley');
|
|
191
|
-
expect(output.num).toStrictEqual('5888');
|
|
192
|
-
_context4.next = 7;
|
|
193
|
-
return waitForMsecs(50);
|
|
194
|
-
case 7:
|
|
195
|
-
/* Should be overwritten by x-broadworks */
|
|
196
|
-
expect(callerId['callerInfo'].avatarSrc).toStrictEqual(dummyAvatar);
|
|
197
|
-
expect(callerId['callerInfo'].id).toStrictEqual(dummyScimResponse.Resources[0].id);
|
|
198
|
-
expect(callerId['callerInfo'].name).toStrictEqual('Cathy');
|
|
199
|
-
expect(callerId['callerInfo'].num).toStrictEqual('5008');
|
|
200
|
-
case 11:
|
|
201
|
-
case "end":
|
|
202
|
-
return _context4.stop();
|
|
203
|
-
}
|
|
204
|
-
}, _callee4);
|
|
205
|
-
})));
|
|
206
|
-
it(' When PA-ID, From header is present but x-broad-works does not have externalId, ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
207
|
-
var dummyCallerId, output;
|
|
208
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
209
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
210
|
-
case 0:
|
|
211
|
-
dummyCallerId = {
|
|
212
|
-
'x-broadworks-remote-party-info': 'userId="nkjwuovmbo@64941297.int10.bcld.webex.com";userDn="tel:+12142865888;ext=5888;country-code=1";',
|
|
213
|
-
'p-asserted-identity': '"Bob Marley" <sip:5888@10.155.4.7;user=phone>',
|
|
214
|
-
from: '"Alice" <sip:5889@64941297.int10.bcld.webex.com>;tag=1932136170-1654008881246'
|
|
215
|
-
};
|
|
216
|
-
callerId['callerInfo'] = {};
|
|
217
|
-
output = callerId.fetchCallerDetails(dummyCallerId);
|
|
218
|
-
/* PAI should be preferred */
|
|
219
|
-
expect(output.name).toStrictEqual('Bob Marley');
|
|
220
|
-
expect(output.num).toStrictEqual('5888');
|
|
221
|
-
_context5.next = 7;
|
|
222
|
-
return waitForMsecs(50);
|
|
223
|
-
case 7:
|
|
224
|
-
/* Since x-broadworks is not present , intermediary details should be retained */
|
|
225
|
-
expect(callerId['callerInfo'].avatarSrc).toBeFalsy();
|
|
226
|
-
expect(callerId['callerInfo'].id).toBeFalsy();
|
|
227
|
-
expect(callerId['callerInfo'].name).toStrictEqual('Bob Marley');
|
|
228
|
-
expect(callerId['callerInfo'].num).toStrictEqual('5888');
|
|
229
|
-
case 11:
|
|
230
|
-
case "end":
|
|
231
|
-
return _context5.stop();
|
|
232
|
-
}
|
|
233
|
-
}, _callee5);
|
|
234
|
-
})));
|
|
235
|
-
it(' When PA-ID, From header is present along with x-broad-works but SCIM query fails, ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
236
|
-
var dummyCallerId, warnSpy, output;
|
|
237
|
-
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
238
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
239
|
-
case 0:
|
|
240
|
-
dummyCallerId = {
|
|
241
|
-
'x-broadworks-remote-party-info': 'userId="nkjwuovmbo@64941297.int10.bcld.webex.com";userDn="tel:+12142865888;ext=5888;country-code=1";externalId=69fde5ad-fb8b-4a1b-9998-b0999e95719b',
|
|
242
|
-
'p-asserted-identity': '"Bob Marley" <sip:5888@10.155.4.7;user=phone>',
|
|
243
|
-
from: '"Alice" <sip:5889@64941297.int10.bcld.webex.com>;tag=1932136170-1654008881246'
|
|
244
|
-
};
|
|
245
|
-
webex.request.mockRejectedValue({
|
|
246
|
-
statusCode: 404,
|
|
247
|
-
body: dummyScimResponse
|
|
248
|
-
});
|
|
249
|
-
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
250
|
-
output = callerId.fetchCallerDetails(dummyCallerId);
|
|
251
|
-
/* PAI should be preferred */
|
|
252
|
-
expect(output.name).toStrictEqual('Bob Marley');
|
|
253
|
-
expect(output.num).toStrictEqual('5888');
|
|
254
|
-
_context6.next = 8;
|
|
255
|
-
return waitForMsecs(50);
|
|
256
|
-
case 8:
|
|
257
|
-
expect(warnSpy).toHaveBeenCalledWith('Error response: - 404', {
|
|
258
|
-
file: 'utils',
|
|
259
|
-
method: 'resolveCallerIdDisplay'
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
/* Should not be overwritten by x-broadworks */
|
|
263
|
-
expect(callerId['callerInfo'].avatarSrc).toBe(undefined);
|
|
264
|
-
expect(callerId['callerInfo'].id).toBe(undefined);
|
|
265
|
-
expect(callerId['callerInfo'].name).toStrictEqual('Bob Marley');
|
|
266
|
-
expect(callerId['callerInfo'].num).toStrictEqual('5888');
|
|
267
|
-
case 13:
|
|
268
|
-
case "end":
|
|
269
|
-
return _context6.stop();
|
|
270
|
-
}
|
|
271
|
-
}, _callee6);
|
|
272
|
-
})));
|
|
273
|
-
});
|
|
274
|
-
//# sourceMappingURL=index.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_testUtil","require","_","_Logger","_interopRequireDefault","waitForMsecs","msec","_promise","default","resolve","setTimeout","webex","getTestUtilsWebex","describe","dummyAvatar","dummyScimResponse","totalResults","itemsPerPage","startIndex","schemas","Resources","userName","emails","primary","type","value","name","givenName","familyName","phoneNumbers","entitlements","cisSyncSource","photos","id","meta","created","lastModified","lastLoginTime","version","location","organizationID","creator","modifier","displayName","active","licenseID","userSettings","sipAddresses","isTeamsOnJabberEnabled","isUCCallOnJabberEnabled","userType","mfaEnabled","teamsClusterId","request","mockResolvedValue","statusCode","body","callerId","it","createCallerId","log","expect","toBeTruthy","_asyncToGenerator2","_regenerator","mark","_callee","dummyCallerId","output","wrap","_callee$","_context","prev","next","from","fetchCallerDetails","toStrictEqual","num","avatarSrc","stop","_callee2","_callee2$","_context2","_callee3","_callee3$","_context3","_callee4","_callee4$","_context4","_callee5","_callee5$","_context5","toBeFalsy","_callee6","warnSpy","_callee6$","_context6","mockRejectedValue","jest","spyOn","toHaveBeenCalledWith","file","method","toBe","undefined"],"sources":["index.test.ts"],"sourcesContent":["/* eslint-disable dot-notation */\nimport {DisplayInformation} from '../../../common/types';\nimport {getTestUtilsWebex} from '../../../common/testUtil';\nimport {createCallerId} from '.';\nimport log from '../../../Logger';\nimport {ICallerId} from './types';\n\nconst waitForMsecs = (msec: number) =>\n new Promise((resolve) => {\n setTimeout(resolve, msec);\n });\n\nconst webex = getTestUtilsWebex();\n\ndescribe('CallerId tests', () => {\n const dummyAvatar =\n 'https://avatar-int-us-east-1.webexcontent.com/Avtr~V1~1704d30d-a131-4bc7-9449-948487643793/V1~bf911e86a1561896d7d0053b46a8d0c9ed82a7bc434a1f84621c2c45cc825f37~3720694b1e4340818a3d12d70eb2b6e1~80';\n\n const dummyScimResponse = {\n totalResults: '1',\n itemsPerPage: '1',\n startIndex: '1',\n schemas: ['urn:scim:schemas:core:1.0', 'urn:scim:schemas:extension:cisco:commonidentity:1.0'],\n Resources: [\n {\n userName: 'atlas.test.wxcwebrtc+user8@gmail.com',\n emails: [\n {\n primary: true,\n type: 'work',\n value: 'atlas.test.wxcwebrtc+user8@gmail.com',\n },\n ],\n name: {\n givenName: 'Cathy',\n familyName: 'James',\n },\n phoneNumbers: [\n {\n primary: true,\n type: 'work',\n value: '5008',\n },\n ],\n entitlements: [\n 'basic-meeting',\n 'basic-message',\n 'bc-sp-standard',\n 'screen-share',\n 'spark',\n 'spark-test-account',\n 'squared-call-initiation',\n 'webex-squared',\n ],\n cisSyncSource: 'SCIM',\n photos: [\n {\n type: 'photo',\n value: dummyAvatar,\n },\n {\n type: 'thumbnail',\n value: dummyAvatar,\n },\n ],\n id: '652fe0c7-05ce-4acd-8bda-9a080830187f',\n meta: {\n created: '2022-03-16T16:13:53.847Z',\n lastModified: '2022-05-31T14:39:12.782Z',\n lastLoginTime: '2022-05-31T14:39:12.780Z',\n version: 'W/\"66025591113\"',\n location:\n 'https://identitybts.webex.com/identity/scim/1704d30d-a131-4bc7-9449-948487643793/v1/Users/652fe0c7-05ce-4acd-8bda-9a080830187f',\n organizationID: '1704d30d-a131-4bc7-9449-948487643793',\n creator: '97fe25e3-d3e8-400e-856b-5b0cd5b0c790',\n modifier: '8c7abf2f-0c8e-49cf-b8e4-693d4ec7daee',\n },\n displayName: 'Cathy',\n active: true,\n licenseID: ['BCSTD_8c81f40c-e848-484e-8ca8-0fb6dabc75a5'],\n userSettings: ['{\"spark.signUpDate\":\"1648547902173\"}', '{\"user-origin\":\"admin-invited\"}'],\n sipAddresses: [\n {\n type: 'cloud-calling',\n value: 'atlas.test.wxcwebrtc+user8@webrtcmobius.call.wbx2.com',\n primary: true,\n },\n ],\n isTeamsOnJabberEnabled: false,\n isUCCallOnJabberEnabled: false,\n userType: 'user',\n mfaEnabled: false,\n teamsClusterId: 'urn:TEAM:us-east-1_int13',\n },\n ],\n };\n\n webex.request.mockResolvedValue({\n statusCode: 200,\n body: dummyScimResponse,\n });\n\n let callerId: ICallerId;\n\n it('create callerId Object', () => {\n callerId = createCallerId(webex, () => log.log('dummy print', {}));\n expect(callerId).toBeTruthy();\n });\n\n /* Follow tests will follow different combinations of the headers.\n * We will check whether the priority order is followed or not.\n */\n it(' When PA-ID, From header is present along with x-broad-works, ', async () => {\n const dummyCallerId = {\n 'x-broadworks-remote-party-info':\n 'userId=\"nkjwuovmbo@64941297.int10.bcld.webex.com\";userDn=\"tel:+12142865888;ext=5888;country-code=1\";externalId=69fde5ad-fb8b-4a1b-9998-b0999e95719b',\n 'p-asserted-identity': '\"Bob Marley\" <sip:5888@10.155.4.7;user=phone>',\n from: '\"Alice\" <sip:5889@64941297.int10.bcld.webex.com>;tag=1932136170-1654008881246',\n };\n\n const output = callerId.fetchCallerDetails(dummyCallerId);\n\n /* PAI should be preferred */\n expect(output.name).toStrictEqual('Bob Marley');\n expect(output.num).toStrictEqual('5888');\n await waitForMsecs(50);\n\n /* Should be overwritten by x-broadworks */\n expect(callerId['callerInfo'].avatarSrc).toStrictEqual(dummyAvatar);\n expect(callerId['callerInfo'].id).toStrictEqual(dummyScimResponse.Resources[0].id);\n expect(callerId['callerInfo'].name).toStrictEqual('Cathy');\n expect(callerId['callerInfo'].num).toStrictEqual('5008');\n });\n\n it(' When PA-ID ,From header is present along with x-broad-works , but name in PAI is of wrong format', async () => {\n const dummyCallerId = {\n 'x-broadworks-remote-party-info':\n 'userId=\"nkjwuovmbo@64941297.int10.bcld.webex.com\";userDn=\"tel:+12142865888;ext=5888;country-code=1\";externalId=69fde5ad-fb8b-4a1b-9998-b0999e95719b',\n 'p-asserted-identity':\n '\"69fde5ad-fb8b-4a1b-9998-b0999e95719b\" <sip:5888@10.155.4.7;user=phone>',\n from: '\"Alice\" <sip:5889@64941297.int10.bcld.webex.com>;tag=1932136170-1654008881246',\n };\n\n callerId['callerInfo'] = {} as DisplayInformation;\n const output = callerId.fetchCallerDetails(dummyCallerId);\n\n /* PAI name is ignored and From's name should be taken, but number is taken from PAI */\n expect(output.name).toStrictEqual('Alice');\n expect(output.num).toStrictEqual('5888');\n await waitForMsecs(50);\n\n /* Should be overwritten by x-broadworks */\n expect(callerId['callerInfo'].avatarSrc).toStrictEqual(dummyAvatar);\n expect(callerId['callerInfo'].id).toStrictEqual(dummyScimResponse.Resources[0].id);\n expect(callerId['callerInfo'].name).toStrictEqual('Cathy');\n expect(callerId['callerInfo'].num).toStrictEqual('5008');\n });\n\n it(' When PA-ID ,From header is present along with x-broad-works , but name in PAI is of wrong format', async () => {\n const dummyCallerId = {\n 'x-broadworks-remote-party-info':\n 'userId=\"nkjwuovmbo@64941297.int10.bcld.webex.com\";userDn=\"tel:+12142865888;ext=5888;country-code=1\";externalId=69fde5ad-fb8b-4a1b-9998-b0999e95719b',\n 'p-asserted-identity':\n '\"69fde5ad-fb8b-4a1b-9998-b0999e95719b\" <sip:69fde5ad-fb8b-4a1b-9998-b0999e95719b@10.155.4.7;user=phone>',\n from: '\"Alice\" <sip:5889@64941297.int10.bcld.webex.com>;tag=1932136170-1654008881246',\n };\n\n callerId['callerInfo'] = {} as DisplayInformation;\n const output = callerId.fetchCallerDetails(dummyCallerId);\n\n /* PAI name and number is ignored and From's name, number should be taken */\n expect(output.name).toStrictEqual('Alice');\n expect(output.num).toStrictEqual('5889');\n await waitForMsecs(50);\n\n /* Should be overwritten by x-broadworks */\n expect(callerId['callerInfo'].avatarSrc).toStrictEqual(dummyAvatar);\n expect(callerId['callerInfo'].id).toStrictEqual(dummyScimResponse.Resources[0].id);\n expect(callerId['callerInfo'].name).toStrictEqual('Cathy');\n expect(callerId['callerInfo'].num).toStrictEqual('5008');\n });\n\n it(' When PA-ID is present but From header is absent', async () => {\n const dummyCallerId = {\n 'x-broadworks-remote-party-info':\n 'userId=\"nkjwuovmbo@64941297.int10.bcld.webex.com\";userDn=\"tel:+12142865888;ext=5888;country-code=1\";externalId=69fde5ad-fb8b-4a1b-9998-b0999e95719b',\n 'p-asserted-identity': '\"Bob Marley\" <sip:5888@10.155.4.7;user=phone>',\n };\n\n callerId['callerInfo'] = {} as DisplayInformation;\n const output = callerId.fetchCallerDetails(dummyCallerId);\n\n /* PAI name and number is taken */\n expect(output.name).toStrictEqual('Bob Marley');\n expect(output.num).toStrictEqual('5888');\n await waitForMsecs(50);\n\n /* Should be overwritten by x-broadworks */\n expect(callerId['callerInfo'].avatarSrc).toStrictEqual(dummyAvatar);\n expect(callerId['callerInfo'].id).toStrictEqual(dummyScimResponse.Resources[0].id);\n expect(callerId['callerInfo'].name).toStrictEqual('Cathy');\n expect(callerId['callerInfo'].num).toStrictEqual('5008');\n });\n\n it(' When PA-ID, From header is present but x-broad-works does not have externalId, ', async () => {\n const dummyCallerId = {\n 'x-broadworks-remote-party-info':\n 'userId=\"nkjwuovmbo@64941297.int10.bcld.webex.com\";userDn=\"tel:+12142865888;ext=5888;country-code=1\";',\n 'p-asserted-identity': '\"Bob Marley\" <sip:5888@10.155.4.7;user=phone>',\n from: '\"Alice\" <sip:5889@64941297.int10.bcld.webex.com>;tag=1932136170-1654008881246',\n };\n\n callerId['callerInfo'] = {} as DisplayInformation;\n const output = callerId.fetchCallerDetails(dummyCallerId);\n\n /* PAI should be preferred */\n expect(output.name).toStrictEqual('Bob Marley');\n expect(output.num).toStrictEqual('5888');\n await waitForMsecs(50);\n\n /* Since x-broadworks is not present , intermediary details should be retained */\n expect(callerId['callerInfo'].avatarSrc).toBeFalsy();\n expect(callerId['callerInfo'].id).toBeFalsy();\n expect(callerId['callerInfo'].name).toStrictEqual('Bob Marley');\n expect(callerId['callerInfo'].num).toStrictEqual('5888');\n });\n\n it(' When PA-ID, From header is present along with x-broad-works but SCIM query fails, ', async () => {\n const dummyCallerId = {\n 'x-broadworks-remote-party-info':\n 'userId=\"nkjwuovmbo@64941297.int10.bcld.webex.com\";userDn=\"tel:+12142865888;ext=5888;country-code=1\";externalId=69fde5ad-fb8b-4a1b-9998-b0999e95719b',\n 'p-asserted-identity': '\"Bob Marley\" <sip:5888@10.155.4.7;user=phone>',\n from: '\"Alice\" <sip:5889@64941297.int10.bcld.webex.com>;tag=1932136170-1654008881246',\n };\n\n webex.request.mockRejectedValue({\n statusCode: 404,\n body: dummyScimResponse,\n });\n\n const warnSpy = jest.spyOn(log, 'warn');\n const output = callerId.fetchCallerDetails(dummyCallerId);\n\n /* PAI should be preferred */\n expect(output.name).toStrictEqual('Bob Marley');\n expect(output.num).toStrictEqual('5888');\n await waitForMsecs(50);\n\n expect(warnSpy).toHaveBeenCalledWith('Error response: - 404', {\n file: 'utils',\n method: 'resolveCallerIdDisplay',\n });\n\n /* Should not be overwritten by x-broadworks */\n expect(callerId['callerInfo'].avatarSrc).toBe(undefined);\n expect(callerId['callerInfo'].id).toBe(undefined);\n expect(callerId['callerInfo'].name).toStrictEqual('Bob Marley');\n expect(callerId['callerInfo'].num).toStrictEqual('5888');\n });\n});\n"],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH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AAC,CAACD,aAAa,CAAC,MAAM,CAAC;QAAC;QAAA;UAAA,OAAAoB,SAAA,CAAAjB,IAAA;MAAA;IAAA,GAAAc,QAAA;EAAA,CAC1D,GAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import {CallerIdInfo} from '../../../Events/types';\nimport {DisplayInformation, PhoneNumber} from '../../../common/types';\n\nexport type EmailType = {\n primary: boolean;\n type: string;\n value: string;\n};\n\nexport type SipAddressType = {\n type: string;\n value: string;\n primary?: boolean;\n};\n\nexport type PhotoType = {\n type: string;\n value: string;\n};\n\nexport type ResourceType = {\n userName: string;\n emails: Array<EmailType>;\n name: {\n givenName: string;\n familyName: string;\n };\n phoneNumbers: Array<PhoneNumber>;\n entitlements: Array<string>;\n id: string;\n photos: Array<PhotoType>;\n displayName: string;\n active: boolean;\n sipAddresses: Array<SipAddressType>;\n};\n\n/* The scim response has many fields , dropping few of them as they are not to be consumed by us */\nexport type scimResponseBody = {\n totalResults: number;\n itemsPerPage: number;\n startIndex: number;\n schemas: Array<string>;\n Resources: Array<ResourceType>;\n};\n\nexport interface ICallerId {\n fetchCallerDetails: (callerId: CallerIdInfo) => DisplayInformation;\n}\n"],"mappings":""}
|