@wazo/sdk 0.37.28 → 0.37.32
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/README.md +2 -1
- package/dist/wazo-sdk.js +4 -4
- package/esm/__tests__/api-client.test.js +30 -0
- package/esm/__tests__/web-rtc-client.test.js +65 -6
- package/esm/api/calld.js +30 -0
- package/esm/api-client.js +30 -0
- package/esm/checker/Checker.js +65 -6
- package/esm/checker/checks/aor.js +30 -0
- package/esm/checker/checks/api.js +30 -0
- package/esm/checker/checks/index.js +65 -6
- package/esm/checker/checks/webrtc-transport.js +65 -6
- package/esm/checker/checks/webrtc.js +65 -6
- package/esm/domain/AdHocAPIConference.js +30 -0
- package/esm/domain/CallSession.js +15 -3
- package/esm/domain/Features.js +30 -0
- package/esm/domain/MeetingStatus.js +29 -0
- package/esm/domain/Phone/CTIPhone.js +45 -3
- package/esm/domain/Phone/WebRTCPhone.js +28 -6
- package/esm/domain/__tests__/CallSession.test.js +32 -3
- package/esm/domain/__tests__/IndirectTransfer.test.js +15 -3
- package/esm/domain/__tests__/Room.test.js +15 -3
- package/esm/index.js +93 -12
- package/esm/service/CallApi.js +30 -0
- package/esm/service/getApiClient.js +30 -0
- package/esm/simple/Auth.js +93 -12
- package/esm/simple/Configuration.js +93 -12
- package/esm/simple/Directory.js +30 -0
- package/esm/simple/Phone.js +93 -12
- package/esm/simple/index.js +93 -12
- package/esm/simple/room/LocalParticipant.js +93 -12
- package/esm/simple/room/Participant.js +93 -12
- package/esm/simple/room/RemoteParticipant.js +93 -12
- package/esm/simple/room/Room.js +93 -12
- package/esm/simple/room/SipRoom.js +93 -12
- package/esm/simple/room/Stream.js +93 -12
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +93 -12
- package/esm/simple/utils.js +93 -12
- package/esm/web-rtc-client.js +65 -6
- package/lib/__tests__/api-client.test.js +30 -0
- package/lib/__tests__/web-rtc-client.test.js +65 -6
- package/lib/api/calld.js +30 -0
- package/lib/api-client.js +30 -0
- package/lib/checker/Checker.js +65 -6
- package/lib/checker/checks/aor.js +30 -0
- package/lib/checker/checks/api.js +30 -0
- package/lib/checker/checks/index.js +65 -6
- package/lib/checker/checks/webrtc-transport.js +65 -6
- package/lib/checker/checks/webrtc.js +65 -6
- package/lib/domain/AdHocAPIConference.js +30 -0
- package/lib/domain/CallSession.js +15 -3
- package/lib/domain/Features.js +30 -0
- package/lib/domain/MeetingStatus.js +31 -0
- package/lib/domain/Phone/CTIPhone.js +45 -3
- package/lib/domain/Phone/WebRTCPhone.js +28 -6
- package/lib/domain/__tests__/CallSession.test.js +32 -3
- package/lib/domain/__tests__/IndirectTransfer.test.js +15 -3
- package/lib/domain/__tests__/Room.test.js +15 -3
- package/lib/index.js +93 -12
- package/lib/service/CallApi.js +30 -0
- package/lib/service/getApiClient.js +30 -0
- package/lib/simple/Auth.js +93 -12
- package/lib/simple/Configuration.js +93 -12
- package/lib/simple/Directory.js +30 -0
- package/lib/simple/Phone.js +93 -12
- package/lib/simple/index.js +93 -12
- package/lib/simple/room/LocalParticipant.js +93 -12
- package/lib/simple/room/Participant.js +93 -12
- package/lib/simple/room/RemoteParticipant.js +93 -12
- package/lib/simple/room/Room.js +93 -12
- package/lib/simple/room/SipRoom.js +93 -12
- package/lib/simple/room/Stream.js +93 -12
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +93 -12
- package/lib/simple/utils.js +93 -12
- package/lib/web-rtc-client.js +65 -6
- package/package.json +1 -1
- package/src/api/calld.js +3 -0
- package/src/domain/CallSession.js +16 -4
- package/src/domain/MeetingStatus.js +27 -0
- package/src/domain/Phone/WebRTCPhone.js +13 -3
- package/src/domain/__tests__/CallSession.test.js +17 -0
- package/src/web-rtc-client.js +35 -6
|
@@ -1715,6 +1715,7 @@ var updateFrom = (instance , from ) => {
|
|
|
1715
1715
|
|
|
1716
1716
|
|
|
1717
1717
|
|
|
1718
|
+
|
|
1718
1719
|
|
|
1719
1720
|
|
|
1720
1721
|
|
|
@@ -1762,14 +1763,14 @@ class CallSession {
|
|
|
1762
1763
|
|
|
1763
1764
|
|
|
1764
1765
|
|
|
1766
|
+
// = creationTime
|
|
1767
|
+
|
|
1765
1768
|
|
|
1766
1769
|
|
|
1767
1770
|
|
|
1768
1771
|
|
|
1769
1772
|
|
|
1770
1773
|
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
1774
|
|
|
1774
1775
|
|
|
1775
1776
|
|
|
@@ -1833,6 +1834,7 @@ class CallSession {
|
|
|
1833
1834
|
recordingPaused,
|
|
1834
1835
|
videoRemotelyDowngraded,
|
|
1835
1836
|
sipSession,
|
|
1837
|
+
answerTime,
|
|
1836
1838
|
} ) {
|
|
1837
1839
|
this.callId = callId;
|
|
1838
1840
|
this.sipCallId = sipCallId;
|
|
@@ -1860,6 +1862,7 @@ class CallSession {
|
|
|
1860
1862
|
this.recordingPaused = recordingPaused || false;
|
|
1861
1863
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
1862
1864
|
this.sipSession = sipSession;
|
|
1865
|
+
this.answerTime = answerTime || this.answerTime;
|
|
1863
1866
|
|
|
1864
1867
|
// Useful to compare instead of instanceof with minified code
|
|
1865
1868
|
this.type = 'CallSession';
|
|
@@ -1890,7 +1893,7 @@ class CallSession {
|
|
|
1890
1893
|
}
|
|
1891
1894
|
|
|
1892
1895
|
answer() {
|
|
1893
|
-
this.
|
|
1896
|
+
this.answerTime = new Date();
|
|
1894
1897
|
}
|
|
1895
1898
|
|
|
1896
1899
|
systemAnswer() {
|
|
@@ -2046,6 +2049,15 @@ class CallSession {
|
|
|
2046
2049
|
return newFrom(callSession, CallSession);
|
|
2047
2050
|
}
|
|
2048
2051
|
|
|
2052
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
2053
|
+
set answered(value ) {
|
|
2054
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
get answered() {
|
|
2058
|
+
return !!this.answerTime;
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2049
2061
|
static parseCall(call ) {
|
|
2050
2062
|
return new CallSession({
|
|
2051
2063
|
callId: call.id,
|
|
@@ -4404,6 +4416,34 @@ class IndirectTransfer {
|
|
|
4404
4416
|
}
|
|
4405
4417
|
}
|
|
4406
4418
|
|
|
4419
|
+
//
|
|
4420
|
+
|
|
4421
|
+
|
|
4422
|
+
|
|
4423
|
+
|
|
4424
|
+
|
|
4425
|
+
class MeetingStatus {
|
|
4426
|
+
|
|
4427
|
+
|
|
4428
|
+
|
|
4429
|
+
|
|
4430
|
+
constructor({
|
|
4431
|
+
full,
|
|
4432
|
+
} = {}) {
|
|
4433
|
+
this.full = full;
|
|
4434
|
+
|
|
4435
|
+
// Useful to compare instead of instanceof with minified code
|
|
4436
|
+
this.type = 'MeetingStatus';
|
|
4437
|
+
}
|
|
4438
|
+
|
|
4439
|
+
static parse(plain ) {
|
|
4440
|
+
return new MeetingStatus({
|
|
4441
|
+
full: plain.full,
|
|
4442
|
+
});
|
|
4443
|
+
}
|
|
4444
|
+
|
|
4445
|
+
}
|
|
4446
|
+
|
|
4407
4447
|
/* */
|
|
4408
4448
|
|
|
4409
4449
|
|
|
@@ -4598,6 +4638,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4598
4638
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4599
4639
|
ApiRequester.successResponseParser),
|
|
4600
4640
|
|
|
4641
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4642
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4601
4643
|
});
|
|
4602
4644
|
|
|
4603
4645
|
//
|
|
@@ -63,6 +63,7 @@ var updateFrom = (instance , from ) => {
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
|
|
66
|
+
|
|
66
67
|
|
|
67
68
|
|
|
68
69
|
|
|
@@ -110,14 +111,14 @@ class CallSession {
|
|
|
110
111
|
|
|
111
112
|
|
|
112
113
|
|
|
114
|
+
// = creationTime
|
|
115
|
+
|
|
113
116
|
|
|
114
117
|
|
|
115
118
|
|
|
116
119
|
|
|
117
120
|
|
|
118
121
|
|
|
119
|
-
|
|
120
|
-
|
|
121
122
|
|
|
122
123
|
|
|
123
124
|
|
|
@@ -181,6 +182,7 @@ class CallSession {
|
|
|
181
182
|
recordingPaused,
|
|
182
183
|
videoRemotelyDowngraded,
|
|
183
184
|
sipSession,
|
|
185
|
+
answerTime,
|
|
184
186
|
} ) {
|
|
185
187
|
this.callId = callId;
|
|
186
188
|
this.sipCallId = sipCallId;
|
|
@@ -208,6 +210,7 @@ class CallSession {
|
|
|
208
210
|
this.recordingPaused = recordingPaused || false;
|
|
209
211
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
210
212
|
this.sipSession = sipSession;
|
|
213
|
+
this.answerTime = answerTime || this.answerTime;
|
|
211
214
|
|
|
212
215
|
// Useful to compare instead of instanceof with minified code
|
|
213
216
|
this.type = 'CallSession';
|
|
@@ -238,7 +241,7 @@ class CallSession {
|
|
|
238
241
|
}
|
|
239
242
|
|
|
240
243
|
answer() {
|
|
241
|
-
this.
|
|
244
|
+
this.answerTime = new Date();
|
|
242
245
|
}
|
|
243
246
|
|
|
244
247
|
systemAnswer() {
|
|
@@ -394,6 +397,15 @@ class CallSession {
|
|
|
394
397
|
return newFrom(callSession, CallSession);
|
|
395
398
|
}
|
|
396
399
|
|
|
400
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
401
|
+
set answered(value ) {
|
|
402
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
get answered() {
|
|
406
|
+
return !!this.answerTime;
|
|
407
|
+
}
|
|
408
|
+
|
|
397
409
|
static parseCall(call ) {
|
|
398
410
|
return new CallSession({
|
|
399
411
|
callId: call.id,
|
|
@@ -1500,6 +1512,8 @@ class WebRTCPhone extends Emitter {
|
|
|
1500
1512
|
this.removeIncomingSessions(sipSessionId);
|
|
1501
1513
|
}
|
|
1502
1514
|
|
|
1515
|
+
callSession.answerTime = new Date();
|
|
1516
|
+
this._updateCallSession(callSession);
|
|
1503
1517
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
1504
1518
|
|
|
1505
1519
|
return callSession;
|
|
@@ -1715,6 +1729,8 @@ class WebRTCPhone extends Emitter {
|
|
|
1715
1729
|
}
|
|
1716
1730
|
|
|
1717
1731
|
this.shouldSendReinvite = false;
|
|
1732
|
+
callSession.answerTime = new Date();
|
|
1733
|
+
this._updateCallSession(callSession);
|
|
1718
1734
|
this.acceptedSessions[callSession.getId()] = true;
|
|
1719
1735
|
|
|
1720
1736
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -1814,7 +1830,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1814
1830
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
1815
1831
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
1816
1832
|
logger.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
1817
|
-
this.holdSipSession(this.currentSipSession,
|
|
1833
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
1818
1834
|
}
|
|
1819
1835
|
|
|
1820
1836
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -2025,6 +2041,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2025
2041
|
}
|
|
2026
2042
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
2027
2043
|
callSession.creationTime = new Date();
|
|
2044
|
+
this._updateCallSession(callSession);
|
|
2028
2045
|
|
|
2029
2046
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
2030
2047
|
|
|
@@ -2166,7 +2183,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2166
2183
|
return this.client && this.client.isConference(callSession.sipCallId);
|
|
2167
2184
|
}
|
|
2168
2185
|
|
|
2169
|
-
async close() {
|
|
2186
|
+
async close(force = false) {
|
|
2170
2187
|
logger.info('WebRTC close');
|
|
2171
2188
|
|
|
2172
2189
|
try {
|
|
@@ -2178,7 +2195,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2178
2195
|
logger.error('WebRTC close, unregister error', e);
|
|
2179
2196
|
}
|
|
2180
2197
|
|
|
2181
|
-
this.client.close();
|
|
2198
|
+
this.client.close(force);
|
|
2182
2199
|
this.unbind();
|
|
2183
2200
|
|
|
2184
2201
|
this.incomingSessions = [];
|
|
@@ -2304,6 +2321,8 @@ class WebRTCPhone extends Emitter {
|
|
|
2304
2321
|
}
|
|
2305
2322
|
|
|
2306
2323
|
callSession.creationTime = new Date();
|
|
2324
|
+
this._updateCallSession(callSession);
|
|
2325
|
+
|
|
2307
2326
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
2308
2327
|
});
|
|
2309
2328
|
|
|
@@ -2347,6 +2366,8 @@ class WebRTCPhone extends Emitter {
|
|
|
2347
2366
|
logger.info('WebRTC call rejected', session.id);
|
|
2348
2367
|
const callSession = this._createCallSession(session);
|
|
2349
2368
|
callSession.endTime = new Date();
|
|
2369
|
+
this._updateCallSession(callSession);
|
|
2370
|
+
|
|
2350
2371
|
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
2351
2372
|
});
|
|
2352
2373
|
|
|
@@ -2571,6 +2592,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2571
2592
|
displayName: identity ? identity.displayName || number : number,
|
|
2572
2593
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
2573
2594
|
creationTime: fromSession ? fromSession.creationTime : null,
|
|
2595
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
2574
2596
|
endTime: fromSession ? fromSession.endTime : null,
|
|
2575
2597
|
answered: state === sessionState.SessionState.Established,
|
|
2576
2598
|
paused: this.client.isCallHeld(sipSession),
|
|
@@ -34,6 +34,7 @@ var updateFrom = (instance , from ) => {
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
|
|
@@ -81,14 +82,14 @@ class CallSession {
|
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
|
|
85
|
+
// = creationTime
|
|
86
|
+
|
|
84
87
|
|
|
85
88
|
|
|
86
89
|
|
|
87
90
|
|
|
88
91
|
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
92
93
|
|
|
93
94
|
|
|
94
95
|
|
|
@@ -152,6 +153,7 @@ class CallSession {
|
|
|
152
153
|
recordingPaused,
|
|
153
154
|
videoRemotelyDowngraded,
|
|
154
155
|
sipSession,
|
|
156
|
+
answerTime,
|
|
155
157
|
} ) {
|
|
156
158
|
this.callId = callId;
|
|
157
159
|
this.sipCallId = sipCallId;
|
|
@@ -179,6 +181,7 @@ class CallSession {
|
|
|
179
181
|
this.recordingPaused = recordingPaused || false;
|
|
180
182
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
181
183
|
this.sipSession = sipSession;
|
|
184
|
+
this.answerTime = answerTime || this.answerTime;
|
|
182
185
|
|
|
183
186
|
// Useful to compare instead of instanceof with minified code
|
|
184
187
|
this.type = 'CallSession';
|
|
@@ -209,7 +212,7 @@ class CallSession {
|
|
|
209
212
|
}
|
|
210
213
|
|
|
211
214
|
answer() {
|
|
212
|
-
this.
|
|
215
|
+
this.answerTime = new Date();
|
|
213
216
|
}
|
|
214
217
|
|
|
215
218
|
systemAnswer() {
|
|
@@ -365,6 +368,15 @@ class CallSession {
|
|
|
365
368
|
return newFrom(callSession, CallSession);
|
|
366
369
|
}
|
|
367
370
|
|
|
371
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
372
|
+
set answered(value ) {
|
|
373
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
get answered() {
|
|
377
|
+
return !!this.answerTime;
|
|
378
|
+
}
|
|
379
|
+
|
|
368
380
|
static parseCall(call ) {
|
|
369
381
|
return new CallSession({
|
|
370
382
|
callId: call.id,
|
|
@@ -427,4 +439,21 @@ describe('CallSession domain', () => {
|
|
|
427
439
|
expect(cs1.is(cs2)).toBeTruthy();
|
|
428
440
|
expect(cs2.is(cs1)).toBeTruthy();
|
|
429
441
|
});
|
|
442
|
+
|
|
443
|
+
it('should set answerTime when setting answered', () => {
|
|
444
|
+
const cs1 = new CallSession({});
|
|
445
|
+
cs1.answered = true;
|
|
446
|
+
|
|
447
|
+
const cs2 = new CallSession({});
|
|
448
|
+
cs2.answer();
|
|
449
|
+
|
|
450
|
+
const cs3 = new CallSession({ answered: true });
|
|
451
|
+
|
|
452
|
+
expect(cs1.answered).toBeTruthy();
|
|
453
|
+
expect(cs1.answerTime).not.toBeNull();
|
|
454
|
+
expect(cs2.answered).toBeTruthy();
|
|
455
|
+
expect(cs2.answerTime).not.toBeNull();
|
|
456
|
+
expect(cs3.answered).toBeTruthy();
|
|
457
|
+
expect(cs3.answerTime).not.toBeNull();
|
|
458
|
+
});
|
|
430
459
|
});
|
|
@@ -34,6 +34,7 @@ var updateFrom = (instance , from ) => {
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
|
|
@@ -81,14 +82,14 @@ class CallSession {
|
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
|
|
85
|
+
// = creationTime
|
|
86
|
+
|
|
84
87
|
|
|
85
88
|
|
|
86
89
|
|
|
87
90
|
|
|
88
91
|
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
92
93
|
|
|
93
94
|
|
|
94
95
|
|
|
@@ -152,6 +153,7 @@ class CallSession {
|
|
|
152
153
|
recordingPaused,
|
|
153
154
|
videoRemotelyDowngraded,
|
|
154
155
|
sipSession,
|
|
156
|
+
answerTime,
|
|
155
157
|
} ) {
|
|
156
158
|
this.callId = callId;
|
|
157
159
|
this.sipCallId = sipCallId;
|
|
@@ -179,6 +181,7 @@ class CallSession {
|
|
|
179
181
|
this.recordingPaused = recordingPaused || false;
|
|
180
182
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
181
183
|
this.sipSession = sipSession;
|
|
184
|
+
this.answerTime = answerTime || this.answerTime;
|
|
182
185
|
|
|
183
186
|
// Useful to compare instead of instanceof with minified code
|
|
184
187
|
this.type = 'CallSession';
|
|
@@ -209,7 +212,7 @@ class CallSession {
|
|
|
209
212
|
}
|
|
210
213
|
|
|
211
214
|
answer() {
|
|
212
|
-
this.
|
|
215
|
+
this.answerTime = new Date();
|
|
213
216
|
}
|
|
214
217
|
|
|
215
218
|
systemAnswer() {
|
|
@@ -365,6 +368,15 @@ class CallSession {
|
|
|
365
368
|
return newFrom(callSession, CallSession);
|
|
366
369
|
}
|
|
367
370
|
|
|
371
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
372
|
+
set answered(value ) {
|
|
373
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
get answered() {
|
|
377
|
+
return !!this.answerTime;
|
|
378
|
+
}
|
|
379
|
+
|
|
368
380
|
static parseCall(call ) {
|
|
369
381
|
return new CallSession({
|
|
370
382
|
callId: call.id,
|
|
@@ -34,6 +34,7 @@ var updateFrom = (instance , from ) => {
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
|
|
@@ -81,14 +82,14 @@ class CallSession {
|
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
|
|
85
|
+
// = creationTime
|
|
86
|
+
|
|
84
87
|
|
|
85
88
|
|
|
86
89
|
|
|
87
90
|
|
|
88
91
|
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
92
93
|
|
|
93
94
|
|
|
94
95
|
|
|
@@ -152,6 +153,7 @@ class CallSession {
|
|
|
152
153
|
recordingPaused,
|
|
153
154
|
videoRemotelyDowngraded,
|
|
154
155
|
sipSession,
|
|
156
|
+
answerTime,
|
|
155
157
|
} ) {
|
|
156
158
|
this.callId = callId;
|
|
157
159
|
this.sipCallId = sipCallId;
|
|
@@ -179,6 +181,7 @@ class CallSession {
|
|
|
179
181
|
this.recordingPaused = recordingPaused || false;
|
|
180
182
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
181
183
|
this.sipSession = sipSession;
|
|
184
|
+
this.answerTime = answerTime || this.answerTime;
|
|
182
185
|
|
|
183
186
|
// Useful to compare instead of instanceof with minified code
|
|
184
187
|
this.type = 'CallSession';
|
|
@@ -209,7 +212,7 @@ class CallSession {
|
|
|
209
212
|
}
|
|
210
213
|
|
|
211
214
|
answer() {
|
|
212
|
-
this.
|
|
215
|
+
this.answerTime = new Date();
|
|
213
216
|
}
|
|
214
217
|
|
|
215
218
|
systemAnswer() {
|
|
@@ -365,6 +368,15 @@ class CallSession {
|
|
|
365
368
|
return newFrom(callSession, CallSession);
|
|
366
369
|
}
|
|
367
370
|
|
|
371
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
372
|
+
set answered(value ) {
|
|
373
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
get answered() {
|
|
377
|
+
return !!this.answerTime;
|
|
378
|
+
}
|
|
379
|
+
|
|
368
380
|
static parseCall(call ) {
|
|
369
381
|
return new CallSession({
|
|
370
382
|
callId: call.id,
|