@wazo/sdk 0.43.12 → 0.43.13
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/wazo-sdk.js +1 -1
- package/esm/domain/CallLog.js +25 -7
- package/esm/domain/Contact.js +19 -1
- package/esm/domain/__tests__/CallLog.test.js +164 -56
- package/esm/domain/__tests__/Contact.test.js +12 -0
- package/esm/types/domain/CallLog.d.ts +19 -10
- package/esm/types/domain/CallLog.d.ts.map +1 -1
- package/esm/types/domain/Contact.d.ts +51 -45
- package/esm/types/domain/Contact.d.ts.map +1 -1
- package/esm/types/domain/Session.d.ts +0 -1
- package/esm/types/domain/Session.d.ts.map +1 -1
- package/lib/domain/CallLog.js +25 -7
- package/lib/domain/Contact.js +17 -1
- package/lib/domain/__tests__/CallLog.test.js +152 -56
- package/lib/domain/__tests__/Contact.test.js +12 -0
- package/lib/types/domain/CallLog.d.ts +19 -10
- package/lib/types/domain/CallLog.d.ts.map +1 -1
- package/lib/types/domain/Contact.d.ts +51 -45
- package/lib/types/domain/Contact.d.ts.map +1 -1
- package/lib/types/domain/Session.d.ts +0 -1
- package/lib/types/domain/Session.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/domain/CallLog.ts +46 -16
- package/src/domain/Contact.ts +69 -43
- package/src/domain/Session.ts +0 -2
- package/src/domain/__tests__/CallLog.test.ts +184 -56
- package/src/domain/__tests__/Contact.test.ts +12 -0
package/esm/domain/CallLog.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
2
|
import newFrom from '../utils/new-from';
|
|
3
3
|
import Recording from './Recording';
|
|
4
|
+
// note: 24.14 fixes requested (first contact reached) and destination (last contact reached)
|
|
5
|
+
export const CALL_LOG_VALID_REQUESTED_VERSION = '24.14';
|
|
4
6
|
export default class CallLog {
|
|
5
7
|
type;
|
|
6
8
|
answer;
|
|
@@ -8,6 +10,7 @@ export default class CallLog {
|
|
|
8
10
|
newMissedCall;
|
|
9
11
|
callDirection;
|
|
10
12
|
destination;
|
|
13
|
+
requested;
|
|
11
14
|
recordings;
|
|
12
15
|
source;
|
|
13
16
|
id;
|
|
@@ -34,14 +37,21 @@ export default class CallLog {
|
|
|
34
37
|
destination: {
|
|
35
38
|
// @TEMP: Temporarily assuming empty numbers are meetings
|
|
36
39
|
// which is admittedly a very dangerous assumption. Did i mention it was temporary?
|
|
37
|
-
extension: plain.requested_extension || plain.destination_extension || `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
38
|
-
name: plain.requested_name || plain.destination_name || '',
|
|
39
40
|
uuid: plain.destination_user_uuid,
|
|
41
|
+
name: plain.requested_name || plain.destination_name || '',
|
|
42
|
+
extension: plain.requested_extension || plain.destination_extension || `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
43
|
+
plainExtension: plain.destination_extension,
|
|
44
|
+
plainName: plain.destination_name,
|
|
45
|
+
},
|
|
46
|
+
requested: {
|
|
47
|
+
uuid: plain.requested_user_uuid,
|
|
48
|
+
name: plain.requested_name || '',
|
|
49
|
+
extension: plain.requested_extension,
|
|
40
50
|
},
|
|
41
51
|
source: {
|
|
42
|
-
extension: plain.source_extension,
|
|
43
|
-
name: plain.source_name,
|
|
44
52
|
uuid: plain.source_user_uuid,
|
|
53
|
+
name: plain.source_name,
|
|
54
|
+
extension: plain.source_extension,
|
|
45
55
|
},
|
|
46
56
|
id: plain.id,
|
|
47
57
|
duration: (plain.duration || 0) * 1000,
|
|
@@ -59,11 +69,12 @@ export default class CallLog {
|
|
|
59
69
|
static newFrom(profile) {
|
|
60
70
|
return newFrom(profile, CallLog);
|
|
61
71
|
}
|
|
62
|
-
constructor({ answer, answered, callDirection, destination, source, id, duration, start, end, recordings, }) {
|
|
72
|
+
constructor({ answer, answered, callDirection, destination, requested, source, id, duration, start, end, recordings, }) {
|
|
63
73
|
this.answer = answer;
|
|
64
74
|
this.answered = answered;
|
|
65
75
|
this.callDirection = callDirection;
|
|
66
76
|
this.destination = destination;
|
|
77
|
+
this.requested = requested;
|
|
67
78
|
this.source = source;
|
|
68
79
|
this.id = id;
|
|
69
80
|
this.duration = duration;
|
|
@@ -83,7 +94,7 @@ export default class CallLog {
|
|
|
83
94
|
if (this.callDirection === 'outbound') {
|
|
84
95
|
return this.destination;
|
|
85
96
|
}
|
|
86
|
-
return session
|
|
97
|
+
return session?.hasExtension(this.source.extension) ? this.destination : this.source;
|
|
87
98
|
}
|
|
88
99
|
isNewMissedCall() {
|
|
89
100
|
return this.newMissedCall;
|
|
@@ -106,10 +117,17 @@ export default class CallLog {
|
|
|
106
117
|
}
|
|
107
118
|
isIncoming(session) {
|
|
108
119
|
if (this.callDirection === 'internal') {
|
|
109
|
-
return session.hasExtension(this.destination.extension);
|
|
120
|
+
return session.hasExtension(this.destination.plainExtension) || session.hasExtension(this.requested.extension);
|
|
110
121
|
}
|
|
111
122
|
return this.callDirection === 'inbound';
|
|
112
123
|
}
|
|
124
|
+
// Example of call flow: User A => User B (No anwser forward) => User C or external number
|
|
125
|
+
isIncomingAndForwarded(session) {
|
|
126
|
+
if (!session.hasEngineVersionGte(CALL_LOG_VALID_REQUESTED_VERSION) || !this.isIncoming(session)) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return this.requested.extension !== this.destination.plainExtension;
|
|
130
|
+
}
|
|
113
131
|
isAnOutgoingCall(session) {
|
|
114
132
|
console.warn(`@wazo/sdk
|
|
115
133
|
CallLog.isAnOutgoingcall(session) method is obsolete.
|
package/esm/domain/Contact.js
CHANGED
|
@@ -15,6 +15,8 @@ export default class Contact {
|
|
|
15
15
|
id;
|
|
16
16
|
uuid;
|
|
17
17
|
name;
|
|
18
|
+
firstName;
|
|
19
|
+
lastName;
|
|
18
20
|
number;
|
|
19
21
|
numbers;
|
|
20
22
|
favorited;
|
|
@@ -78,6 +80,8 @@ export default class Contact {
|
|
|
78
80
|
const name = edge.node.firstname && edge.node.lastname ? `${edge.node.firstname || ''} ${edge.node.lastname || ''}` : edge.node.wazoReverse;
|
|
79
81
|
return new Contact({
|
|
80
82
|
name,
|
|
83
|
+
firstName: edge.node.firstname,
|
|
84
|
+
lastName: edge.node.lastname,
|
|
81
85
|
number: numbers[i],
|
|
82
86
|
numbers: [{
|
|
83
87
|
label: 'primary',
|
|
@@ -108,6 +112,8 @@ export default class Contact {
|
|
|
108
112
|
const email = plain.column_values[columns.indexOf('email')];
|
|
109
113
|
return new Contact({
|
|
110
114
|
name: plain.column_values[columns.indexOf('name')],
|
|
115
|
+
firstName: plain.column_values[columns.indexOf('firstname')],
|
|
116
|
+
lastName: plain.column_values[columns.indexOf('lastname')],
|
|
111
117
|
number: numbers.length ? numbers[0] : '',
|
|
112
118
|
numbers: numbers.map((number, i) => ({
|
|
113
119
|
label: i === 0 ? 'primary' : 'secondary',
|
|
@@ -137,6 +143,8 @@ export default class Contact {
|
|
|
137
143
|
static parsePersonal(plain) {
|
|
138
144
|
return new Contact({
|
|
139
145
|
name: `${plain.firstName || plain.firstname || ''} ${plain.lastName || plain.lastname || ''}`,
|
|
146
|
+
firstName: plain.firstName || plain.firstname,
|
|
147
|
+
lastName: plain.lastName || plain.lastname,
|
|
140
148
|
number: plain.number || '',
|
|
141
149
|
numbers: plain.number ? [{
|
|
142
150
|
label: 'primary',
|
|
@@ -171,6 +179,8 @@ export default class Contact {
|
|
|
171
179
|
const name = isCompanyAccount ? companyName : `${firstName} ${lastName}`;
|
|
172
180
|
return new Contact({
|
|
173
181
|
name,
|
|
182
|
+
firstName,
|
|
183
|
+
lastName,
|
|
174
184
|
number: plain.phoneNumbers.length ? plain.phoneNumbers[0].number : '',
|
|
175
185
|
// Make numbers unique
|
|
176
186
|
numbers: [...new Map(plain.phoneNumbers.map(item => [item.number, item])).values()].map((item, idx) => ({
|
|
@@ -223,6 +233,8 @@ export default class Contact {
|
|
|
223
233
|
return new Contact({
|
|
224
234
|
sourceId: single.id || '',
|
|
225
235
|
name: single.displayName || '',
|
|
236
|
+
firstName: single.givenName,
|
|
237
|
+
lastName: single.surname,
|
|
226
238
|
number: numbers.length ? numbers[0].number : '',
|
|
227
239
|
numbers,
|
|
228
240
|
emails,
|
|
@@ -258,6 +270,8 @@ export default class Contact {
|
|
|
258
270
|
return new Contact({
|
|
259
271
|
sourceId: single.id || '',
|
|
260
272
|
name: single.name || '',
|
|
273
|
+
firstName: single.lastname || '',
|
|
274
|
+
lastName: single.firstname || '',
|
|
261
275
|
number: numbers.length ? numbers[0].number : '',
|
|
262
276
|
numbers,
|
|
263
277
|
emails,
|
|
@@ -293,6 +307,8 @@ export default class Contact {
|
|
|
293
307
|
uuid: single.uuid,
|
|
294
308
|
sourceId: String(single.id) || '',
|
|
295
309
|
name: `${single.firstname}${single.lastname ? ` ${single.lastname}` : ''}`,
|
|
310
|
+
firstName: single.firstname,
|
|
311
|
+
lastName: single.lastname,
|
|
296
312
|
number: numbers.length ? numbers[0].number : '',
|
|
297
313
|
numbers,
|
|
298
314
|
emails,
|
|
@@ -325,10 +341,12 @@ export default class Contact {
|
|
|
325
341
|
static newFrom(contact) {
|
|
326
342
|
return newFrom(contact, Contact);
|
|
327
343
|
}
|
|
328
|
-
constructor({ id, uuid, name, number, numbers, email, emails, source, sourceId, entreprise, birthday, address, note, state, lineState, lastActivity, mobile, status, endpointId, personal, favorited, backend, personalStatus, sessions, connected, doNotDisturb, ringing, previousPresential, lines, } = {}) {
|
|
344
|
+
constructor({ id, uuid, name, firstName, lastName, number, numbers, email, emails, source, sourceId, entreprise, birthday, address, note, state, lineState, lastActivity, mobile, status, endpointId, personal, favorited, backend, personalStatus, sessions, connected, doNotDisturb, ringing, previousPresential, lines, } = {}) {
|
|
329
345
|
this.id = id;
|
|
330
346
|
this.uuid = uuid;
|
|
331
347
|
this.name = name || '';
|
|
348
|
+
this.firstName = firstName || '';
|
|
349
|
+
this.lastName = lastName || '';
|
|
332
350
|
this.number = number;
|
|
333
351
|
this.numbers = numbers;
|
|
334
352
|
this.email = email;
|
|
@@ -1,62 +1,170 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
|
-
import CallLog from '../CallLog';
|
|
2
|
+
import CallLog, { CALL_LOG_VALID_REQUESTED_VERSION } from '../CallLog';
|
|
3
3
|
import Recording from '../Recording';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import Session from '../Session';
|
|
5
|
+
import Profile from '../Profile';
|
|
6
|
+
import Line from '../Line';
|
|
7
|
+
const ALICE_EXTENSION = '41';
|
|
8
|
+
const ALICE_UUID = '11111111-1111-1111-1111-111111111111';
|
|
9
|
+
const BOB_EXTENSION = '42';
|
|
10
|
+
const BOB_UUID = '22222222-2222-2222-2222-222222222222';
|
|
11
|
+
const CHARLIE_EXTENSION = '43';
|
|
12
|
+
const CHARLIE_UUID = '33333333-3333-3333-3333-333333333333';
|
|
13
|
+
// Default scenario: Alice > Bob (No anwser forward) > Charlie
|
|
14
|
+
const CALL_LOG_RESPONSE = {
|
|
15
|
+
id: 1,
|
|
16
|
+
answer: '2024-01-02T00:00:00.000000+00:00',
|
|
17
|
+
answered: true,
|
|
18
|
+
call_direction: 'internal',
|
|
19
|
+
source_name: 'Alice',
|
|
20
|
+
source_extension: ALICE_EXTENSION,
|
|
21
|
+
source_user_uuid: ALICE_UUID,
|
|
22
|
+
requested_name: 'Bob',
|
|
23
|
+
requested_extension: BOB_EXTENSION,
|
|
24
|
+
requested_user_uuid: BOB_UUID,
|
|
25
|
+
destination_name: 'Charlie',
|
|
26
|
+
destination_extension: CHARLIE_EXTENSION,
|
|
27
|
+
destination_user_uuid: CHARLIE_UUID,
|
|
28
|
+
duration: 4,
|
|
29
|
+
start: '2024-01-01T00:00:00.000000+00:00',
|
|
30
|
+
end: '2024-01-01T00:00:04.000000+00:00',
|
|
31
|
+
recordings: [{
|
|
32
|
+
uuid: '0394ad6f-5c72-4072-8503-e3ad9a41c0a0',
|
|
33
|
+
start_time: '2024-01-01T00:00:00.000000+00:00',
|
|
34
|
+
end_time: '2024-01-01T00:00:04.000000+00:00',
|
|
35
|
+
filename: '2024-01-01T00_00_04UTC-61886-0394ad6f-5c72-4072-8503-e3ad9a41c0a0.wav',
|
|
36
|
+
deleted: false,
|
|
37
|
+
}],
|
|
38
|
+
};
|
|
39
|
+
const CALL_LOG = CallLog.parse(CALL_LOG_RESPONSE);
|
|
40
|
+
const generateBobSession = (opts) => new Session({
|
|
41
|
+
acl: [],
|
|
42
|
+
token: 'ref-12345',
|
|
43
|
+
uuid: BOB_UUID,
|
|
44
|
+
expiresAt: new Date(9999, 0, 1),
|
|
45
|
+
engineVersion: CALL_LOG_VALID_REQUESTED_VERSION,
|
|
46
|
+
profile: new Profile({
|
|
47
|
+
lines: [new Line({
|
|
48
|
+
id: 1,
|
|
49
|
+
extensions: [{
|
|
50
|
+
id: 1,
|
|
51
|
+
exten: BOB_EXTENSION,
|
|
52
|
+
context: 'internal',
|
|
53
|
+
}],
|
|
54
|
+
})],
|
|
55
|
+
}),
|
|
56
|
+
...(opts || {}),
|
|
57
|
+
});
|
|
58
|
+
const BOB_SESSION = generateBobSession();
|
|
59
|
+
describe('CallLog Domain', () => {
|
|
60
|
+
describe('parseMany', () => {
|
|
61
|
+
it('can parse a plain call log to domain', () => {
|
|
62
|
+
const response = {
|
|
63
|
+
filtered: 6,
|
|
64
|
+
items: [CALL_LOG_RESPONSE],
|
|
65
|
+
total: 233,
|
|
66
|
+
};
|
|
67
|
+
const logs = CallLog.parseMany(response);
|
|
68
|
+
expect(logs).toEqual([new CallLog({
|
|
69
|
+
id: 1,
|
|
70
|
+
answer: moment(CALL_LOG_RESPONSE.answer).toDate(),
|
|
10
71
|
answered: true,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
72
|
+
callDirection: 'internal',
|
|
73
|
+
source: {
|
|
74
|
+
uuid: ALICE_UUID,
|
|
75
|
+
name: 'Alice',
|
|
76
|
+
extension: ALICE_EXTENSION,
|
|
77
|
+
},
|
|
78
|
+
requested: {
|
|
79
|
+
uuid: BOB_UUID,
|
|
80
|
+
name: 'Bob',
|
|
81
|
+
extension: BOB_EXTENSION,
|
|
82
|
+
},
|
|
83
|
+
destination: {
|
|
84
|
+
uuid: CHARLIE_UUID,
|
|
85
|
+
name: 'Bob',
|
|
86
|
+
extension: BOB_EXTENSION,
|
|
87
|
+
plainExtension: CHARLIE_EXTENSION,
|
|
88
|
+
plainName: 'Charlie',
|
|
89
|
+
},
|
|
90
|
+
duration: 4000,
|
|
91
|
+
start: moment(CALL_LOG_RESPONSE.start).toDate(),
|
|
92
|
+
end: moment(CALL_LOG_RESPONSE.end).toDate(),
|
|
93
|
+
recordings: [new Recording({
|
|
94
|
+
uuid: CALL_LOG_RESPONSE.recordings[0].uuid,
|
|
95
|
+
start: moment(CALL_LOG_RESPONSE.recordings[0].start_time).toDate(),
|
|
96
|
+
end: moment(CALL_LOG_RESPONSE.recordings[0].end_time).toDate(),
|
|
97
|
+
fileName: CALL_LOG_RESPONSE.recordings[0].filename,
|
|
25
98
|
deleted: false,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
99
|
+
})],
|
|
100
|
+
})]);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
describe('isIconming', () => {
|
|
104
|
+
it('should be TRUE', () => {
|
|
105
|
+
// When requested is set to the same user session extension
|
|
106
|
+
expect(CALL_LOG.isIncomingAndForwarded(BOB_SESSION)).toBe(true);
|
|
107
|
+
// When destination is set to the same user session extension
|
|
108
|
+
const destinationCallLog = CallLog.parse({
|
|
109
|
+
...CALL_LOG_RESPONSE,
|
|
110
|
+
destination_extension: CALL_LOG_RESPONSE.requested_extension,
|
|
111
|
+
destination_name: CALL_LOG_RESPONSE.requested_name,
|
|
112
|
+
destination_user_uuid: CALL_LOG_RESPONSE.requested_user_uuid,
|
|
113
|
+
requested_extension: CALL_LOG_RESPONSE.destination_extension,
|
|
114
|
+
requested_name: CALL_LOG_RESPONSE.destination_name,
|
|
115
|
+
requested_user_uuid: CALL_LOG_RESPONSE.destination_user_uuid,
|
|
116
|
+
});
|
|
117
|
+
expect(destinationCallLog.isIncomingAndForwarded(BOB_SESSION)).toBe(true);
|
|
118
|
+
// When call direction is inbound
|
|
119
|
+
const inboundCallLog = CallLog.parse({ ...CALL_LOG_RESPONSE, call_direction: 'inbound' });
|
|
120
|
+
expect(inboundCallLog.isIncomingAndForwarded(BOB_SESSION)).toBe(true);
|
|
121
|
+
});
|
|
122
|
+
it('should be FALSE', () => {
|
|
123
|
+
// When call direction is outbound
|
|
124
|
+
const outboundCallLog = CallLog.parse({ ...CALL_LOG_RESPONSE, call_direction: 'outbound' });
|
|
125
|
+
expect(outboundCallLog.isIncomingAndForwarded(BOB_SESSION)).toBe(false);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
describe('isIncomingAndForwarded', () => {
|
|
129
|
+
it('should be TRUE when requested is current user extension and destination is another extesnion', () => {
|
|
130
|
+
// Internal call (requested contact)
|
|
131
|
+
expect(CALL_LOG.isIncomingAndForwarded(BOB_SESSION)).toBe(true);
|
|
132
|
+
// Inbound call (requested contact)
|
|
133
|
+
const inboundCallLog = CallLog.parse({
|
|
134
|
+
...CALL_LOG_RESPONSE,
|
|
135
|
+
call_direction: 'inbound',
|
|
136
|
+
source_extension: '18004444444',
|
|
137
|
+
source_name: '',
|
|
138
|
+
source_user_uuid: null,
|
|
139
|
+
});
|
|
140
|
+
expect(inboundCallLog.isIncomingAndForwarded(BOB_SESSION)).toBe(true);
|
|
141
|
+
// Current user is the final destination
|
|
142
|
+
const destinationCallLog = CallLog.parse({
|
|
143
|
+
...CALL_LOG_RESPONSE,
|
|
144
|
+
destination_extension: CALL_LOG_RESPONSE.requested_extension,
|
|
145
|
+
destination_name: CALL_LOG_RESPONSE.requested_name,
|
|
146
|
+
destination_user_uuid: CALL_LOG_RESPONSE.requested_user_uuid,
|
|
147
|
+
requested_extension: CALL_LOG_RESPONSE.destination_extension,
|
|
148
|
+
requested_name: CALL_LOG_RESPONSE.destination_name,
|
|
149
|
+
requested_user_uuid: CALL_LOG_RESPONSE.destination_user_uuid,
|
|
150
|
+
});
|
|
151
|
+
expect(destinationCallLog.isIncomingAndForwarded(BOB_SESSION)).toBe(true);
|
|
152
|
+
});
|
|
153
|
+
it('should be FALSE', () => {
|
|
154
|
+
// Requested and destination are same
|
|
155
|
+
const directCallLog = CallLog.parse({
|
|
156
|
+
...CALL_LOG_RESPONSE,
|
|
157
|
+
requested_extension: CALL_LOG_RESPONSE.destination_extension,
|
|
158
|
+
requested_name: CALL_LOG_RESPONSE.destination_name,
|
|
159
|
+
requested_user_uuid: CALL_LOG_RESPONSE.destination_user_uuid,
|
|
160
|
+
});
|
|
161
|
+
expect(directCallLog.isIncomingAndForwarded(BOB_SESSION)).toBe(false);
|
|
162
|
+
// Not incoming call
|
|
163
|
+
const outboundCallLog = CallLog.parse({ ...CALL_LOG_RESPONSE, call_direction: 'outbound' });
|
|
164
|
+
expect(outboundCallLog.isIncomingAndForwarded(BOB_SESSION)).toBe(false);
|
|
165
|
+
// Stack version
|
|
166
|
+
const oldStackSession = generateBobSession({ engineVersion: CALL_LOG_VALID_REQUESTED_VERSION.replace('14', '10') });
|
|
167
|
+
expect(CALL_LOG.isIncomingAndForwarded(oldStackSession)).toBe(false);
|
|
168
|
+
});
|
|
61
169
|
});
|
|
62
170
|
});
|
|
@@ -2,6 +2,8 @@ import Contact from '../Contact';
|
|
|
2
2
|
const genericContactResponse = {
|
|
3
3
|
column_types: [
|
|
4
4
|
'name',
|
|
5
|
+
'firstname',
|
|
6
|
+
'lastname',
|
|
5
7
|
'number',
|
|
6
8
|
'callable',
|
|
7
9
|
'voicemail',
|
|
@@ -12,6 +14,8 @@ const genericContactResponse = {
|
|
|
12
14
|
term: 'a',
|
|
13
15
|
column_headers: [
|
|
14
16
|
'Nom',
|
|
17
|
+
'Pr\u00e9nom',
|
|
18
|
+
'Nom de famille',
|
|
15
19
|
'Num\u00e9ro',
|
|
16
20
|
'Mobile',
|
|
17
21
|
'Bo\u00eete vocale',
|
|
@@ -25,6 +29,8 @@ const contact1 = {
|
|
|
25
29
|
source: 'internal',
|
|
26
30
|
column_values: [
|
|
27
31
|
'Jonathan Lessard',
|
|
32
|
+
'Jonathan',
|
|
33
|
+
'Lessard',
|
|
28
34
|
'8020',
|
|
29
35
|
'06800880',
|
|
30
36
|
null,
|
|
@@ -46,6 +52,8 @@ const contact2 = {
|
|
|
46
52
|
source: 'internal',
|
|
47
53
|
column_values: [
|
|
48
54
|
'John Doe',
|
|
55
|
+
'John',
|
|
56
|
+
'Doe',
|
|
49
57
|
'8021',
|
|
50
58
|
'06800881',
|
|
51
59
|
null,
|
|
@@ -65,6 +73,8 @@ const contact2 = {
|
|
|
65
73
|
};
|
|
66
74
|
const parsedContact1 = new Contact({
|
|
67
75
|
name: 'Jonathan Lessard',
|
|
76
|
+
firstName: 'Jonathan',
|
|
77
|
+
lastName: 'Lessard',
|
|
68
78
|
number: '8020',
|
|
69
79
|
numbers: [
|
|
70
80
|
{
|
|
@@ -97,6 +107,8 @@ const parsedContact1 = new Contact({
|
|
|
97
107
|
});
|
|
98
108
|
const parsedContact2 = new Contact({
|
|
99
109
|
name: 'John Doe',
|
|
110
|
+
firstName: 'John',
|
|
111
|
+
lastName: 'Doe',
|
|
100
112
|
number: '8021',
|
|
101
113
|
numbers: [
|
|
102
114
|
{
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import Session from './Session';
|
|
2
2
|
import type { RecordingResponse } from './Recording';
|
|
3
3
|
import Recording from './Recording';
|
|
4
|
-
|
|
4
|
+
export declare const CALL_LOG_VALID_REQUESTED_VERSION = "24.14";
|
|
5
|
+
export type CallLogResponse = {
|
|
5
6
|
answer: string | null | undefined;
|
|
6
7
|
answered: boolean;
|
|
7
8
|
call_direction: string;
|
|
8
|
-
destination_extension
|
|
9
|
-
destination_name
|
|
10
|
-
destination_user_uuid
|
|
9
|
+
destination_extension: string;
|
|
10
|
+
destination_name: string;
|
|
11
|
+
destination_user_uuid: string | null;
|
|
11
12
|
duration: number;
|
|
12
13
|
end: string | null | undefined;
|
|
13
14
|
id: number;
|
|
14
15
|
source_extension: string;
|
|
15
16
|
source_name: string;
|
|
16
|
-
source_user_uuid
|
|
17
|
+
source_user_uuid: string | null;
|
|
17
18
|
recordings: RecordingResponse[];
|
|
18
19
|
requested_extension: string;
|
|
19
20
|
requested_name: string;
|
|
21
|
+
requested_user_uuid: string | null;
|
|
20
22
|
start: string;
|
|
21
23
|
};
|
|
22
|
-
type Response = {
|
|
24
|
+
export type Response = {
|
|
23
25
|
filtered: number;
|
|
24
26
|
items: Array<CallLogResponse>;
|
|
25
27
|
total: number;
|
|
@@ -27,14 +29,19 @@ type Response = {
|
|
|
27
29
|
type LogOrigin = {
|
|
28
30
|
extension: string;
|
|
29
31
|
name: string;
|
|
30
|
-
uuid?: string;
|
|
32
|
+
uuid?: string | null;
|
|
33
|
+
};
|
|
34
|
+
type DestinationLogOrigin = LogOrigin & {
|
|
35
|
+
plainExtension: string;
|
|
36
|
+
plainName: string | null;
|
|
31
37
|
};
|
|
32
38
|
type CallLogArguments = {
|
|
33
39
|
answer: Date | null | undefined;
|
|
34
40
|
answered: boolean;
|
|
35
41
|
newMissedCall?: boolean;
|
|
36
42
|
callDirection: string;
|
|
37
|
-
destination:
|
|
43
|
+
destination: DestinationLogOrigin;
|
|
44
|
+
requested: LogOrigin;
|
|
38
45
|
source: LogOrigin;
|
|
39
46
|
id: number;
|
|
40
47
|
duration: number;
|
|
@@ -48,7 +55,8 @@ export default class CallLog {
|
|
|
48
55
|
answered: boolean;
|
|
49
56
|
newMissedCall: boolean;
|
|
50
57
|
callDirection: string;
|
|
51
|
-
destination:
|
|
58
|
+
destination: DestinationLogOrigin;
|
|
59
|
+
requested: LogOrigin;
|
|
52
60
|
recordings: Recording[];
|
|
53
61
|
source: LogOrigin;
|
|
54
62
|
id: number;
|
|
@@ -60,7 +68,7 @@ export default class CallLog {
|
|
|
60
68
|
static parse(plain: CallLogResponse): CallLog;
|
|
61
69
|
static parseNew(plain: CallLogResponse, session: Session): CallLog;
|
|
62
70
|
static newFrom(profile: CallLog): any;
|
|
63
|
-
constructor({ answer, answered, callDirection, destination, source, id, duration, start, end, recordings, }: CallLogArguments);
|
|
71
|
+
constructor({ answer, answered, callDirection, destination, requested, source, id, duration, start, end, recordings, }: CallLogArguments);
|
|
64
72
|
isFromSameParty(other: CallLog, session: Session): boolean;
|
|
65
73
|
theOtherParty(session: Session): LogOrigin;
|
|
66
74
|
isNewMissedCall(): boolean;
|
|
@@ -69,6 +77,7 @@ export default class CallLog {
|
|
|
69
77
|
isAnswered(): boolean;
|
|
70
78
|
isOutgoing(session: Session): boolean;
|
|
71
79
|
isIncoming(session: Session): boolean;
|
|
80
|
+
isIncomingAndForwarded(session: Session): boolean;
|
|
72
81
|
isAnOutgoingCall(session: Session): boolean;
|
|
73
82
|
isAMissedOutgoingCall(session: Session): boolean;
|
|
74
83
|
isAnIncomingCall(session: Session): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallLog.d.ts","sourceRoot":"","sources":["../../../src/domain/CallLog.ts"],"names":[],"mappings":"AAEA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