@wazo/sdk 0.37.29 → 0.37.33
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 +9 -1
- package/esm/domain/Features.js +30 -0
- package/esm/domain/MeetingStatus.js +29 -0
- package/esm/domain/Phone/CTIPhone.js +39 -1
- package/esm/domain/Phone/WebRTCPhone.js +20 -4
- package/esm/domain/__tests__/CallSession.test.js +41 -5
- package/esm/domain/__tests__/IndirectTransfer.test.js +9 -1
- package/esm/domain/__tests__/Room.test.js +9 -1
- package/esm/index.js +85 -10
- package/esm/service/CallApi.js +30 -0
- package/esm/service/getApiClient.js +30 -0
- package/esm/simple/Auth.js +85 -10
- package/esm/simple/Configuration.js +85 -10
- package/esm/simple/Directory.js +30 -0
- package/esm/simple/Phone.js +85 -10
- package/esm/simple/index.js +85 -10
- package/esm/simple/room/LocalParticipant.js +85 -10
- package/esm/simple/room/Participant.js +85 -10
- package/esm/simple/room/RemoteParticipant.js +85 -10
- package/esm/simple/room/Room.js +85 -10
- package/esm/simple/room/SipRoom.js +85 -10
- package/esm/simple/room/Stream.js +85 -10
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +85 -10
- package/esm/simple/utils.js +85 -10
- 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 +9 -1
- package/lib/domain/Features.js +30 -0
- package/lib/domain/MeetingStatus.js +31 -0
- package/lib/domain/Phone/CTIPhone.js +39 -1
- package/lib/domain/Phone/WebRTCPhone.js +20 -4
- package/lib/domain/__tests__/CallSession.test.js +41 -5
- package/lib/domain/__tests__/IndirectTransfer.test.js +9 -1
- package/lib/domain/__tests__/Room.test.js +9 -1
- package/lib/index.js +85 -10
- package/lib/service/CallApi.js +30 -0
- package/lib/service/getApiClient.js +30 -0
- package/lib/simple/Auth.js +85 -10
- package/lib/simple/Configuration.js +85 -10
- package/lib/simple/Directory.js +30 -0
- package/lib/simple/Phone.js +85 -10
- package/lib/simple/index.js +85 -10
- package/lib/simple/room/LocalParticipant.js +85 -10
- package/lib/simple/room/Participant.js +85 -10
- package/lib/simple/room/RemoteParticipant.js +85 -10
- package/lib/simple/room/Room.js +85 -10
- package/lib/simple/room/SipRoom.js +85 -10
- package/lib/simple/room/Stream.js +85 -10
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +85 -10
- package/lib/simple/utils.js +85 -10
- 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 +9 -1
- package/src/domain/MeetingStatus.js +27 -0
- package/src/domain/Phone/WebRTCPhone.js +11 -3
- package/src/domain/__tests__/CallSession.test.js +32 -4
- package/src/web-rtc-client.js +35 -6
|
@@ -4022,6 +4022,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4022
4022
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4023
4023
|
});
|
|
4024
4024
|
|
|
4025
|
+
//
|
|
4026
|
+
|
|
4027
|
+
|
|
4028
|
+
|
|
4029
|
+
|
|
4030
|
+
|
|
4031
|
+
class MeetingStatus {
|
|
4032
|
+
|
|
4033
|
+
|
|
4034
|
+
|
|
4035
|
+
|
|
4036
|
+
constructor({
|
|
4037
|
+
full,
|
|
4038
|
+
} = {}) {
|
|
4039
|
+
this.full = full;
|
|
4040
|
+
|
|
4041
|
+
// Useful to compare instead of instanceof with minified code
|
|
4042
|
+
this.type = 'MeetingStatus';
|
|
4043
|
+
}
|
|
4044
|
+
|
|
4045
|
+
static parse(plain ) {
|
|
4046
|
+
return new MeetingStatus({
|
|
4047
|
+
full: plain.full,
|
|
4048
|
+
});
|
|
4049
|
+
}
|
|
4050
|
+
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4025
4053
|
/* */
|
|
4026
4054
|
|
|
4027
4055
|
|
|
@@ -4216,6 +4244,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4216
4244
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4217
4245
|
ApiRequester.successResponseParser),
|
|
4218
4246
|
|
|
4247
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4248
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4219
4249
|
});
|
|
4220
4250
|
|
|
4221
4251
|
//
|
|
@@ -370,13 +370,21 @@ class CallSession {
|
|
|
370
370
|
|
|
371
371
|
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
372
372
|
set answered(value ) {
|
|
373
|
-
this.answerTime = value ? new Date() : null;
|
|
373
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
get answered() {
|
|
377
377
|
return !!this.answerTime;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
+
toJSON() {
|
|
381
|
+
const jsonObj = { ...this };
|
|
382
|
+
// $FlowFixMe
|
|
383
|
+
jsonObj.answered = this.answered;
|
|
384
|
+
|
|
385
|
+
return jsonObj;
|
|
386
|
+
}
|
|
387
|
+
|
|
380
388
|
static parseCall(call ) {
|
|
381
389
|
return new CallSession({
|
|
382
390
|
callId: call.id,
|
package/lib/domain/Features.js
CHANGED
|
@@ -4024,6 +4024,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4024
4024
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4025
4025
|
});
|
|
4026
4026
|
|
|
4027
|
+
//
|
|
4028
|
+
|
|
4029
|
+
|
|
4030
|
+
|
|
4031
|
+
|
|
4032
|
+
|
|
4033
|
+
class MeetingStatus {
|
|
4034
|
+
|
|
4035
|
+
|
|
4036
|
+
|
|
4037
|
+
|
|
4038
|
+
constructor({
|
|
4039
|
+
full,
|
|
4040
|
+
} = {}) {
|
|
4041
|
+
this.full = full;
|
|
4042
|
+
|
|
4043
|
+
// Useful to compare instead of instanceof with minified code
|
|
4044
|
+
this.type = 'MeetingStatus';
|
|
4045
|
+
}
|
|
4046
|
+
|
|
4047
|
+
static parse(plain ) {
|
|
4048
|
+
return new MeetingStatus({
|
|
4049
|
+
full: plain.full,
|
|
4050
|
+
});
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
}
|
|
4054
|
+
|
|
4027
4055
|
/* */
|
|
4028
4056
|
|
|
4029
4057
|
|
|
@@ -4218,6 +4246,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4218
4246
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4219
4247
|
ApiRequester.successResponseParser),
|
|
4220
4248
|
|
|
4249
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4250
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4221
4251
|
});
|
|
4222
4252
|
|
|
4223
4253
|
//
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MeetingStatus {
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
constructor({
|
|
15
|
+
full,
|
|
16
|
+
} = {}) {
|
|
17
|
+
this.full = full;
|
|
18
|
+
|
|
19
|
+
// Useful to compare instead of instanceof with minified code
|
|
20
|
+
this.type = 'MeetingStatus';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static parse(plain ) {
|
|
24
|
+
return new MeetingStatus({
|
|
25
|
+
full: plain.full,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = MeetingStatus;
|
|
@@ -2051,13 +2051,21 @@ class CallSession {
|
|
|
2051
2051
|
|
|
2052
2052
|
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
2053
2053
|
set answered(value ) {
|
|
2054
|
-
this.answerTime = value ? new Date() : null;
|
|
2054
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
2055
2055
|
}
|
|
2056
2056
|
|
|
2057
2057
|
get answered() {
|
|
2058
2058
|
return !!this.answerTime;
|
|
2059
2059
|
}
|
|
2060
2060
|
|
|
2061
|
+
toJSON() {
|
|
2062
|
+
const jsonObj = { ...this };
|
|
2063
|
+
// $FlowFixMe
|
|
2064
|
+
jsonObj.answered = this.answered;
|
|
2065
|
+
|
|
2066
|
+
return jsonObj;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2061
2069
|
static parseCall(call ) {
|
|
2062
2070
|
return new CallSession({
|
|
2063
2071
|
callId: call.id,
|
|
@@ -4416,6 +4424,34 @@ class IndirectTransfer {
|
|
|
4416
4424
|
}
|
|
4417
4425
|
}
|
|
4418
4426
|
|
|
4427
|
+
//
|
|
4428
|
+
|
|
4429
|
+
|
|
4430
|
+
|
|
4431
|
+
|
|
4432
|
+
|
|
4433
|
+
class MeetingStatus {
|
|
4434
|
+
|
|
4435
|
+
|
|
4436
|
+
|
|
4437
|
+
|
|
4438
|
+
constructor({
|
|
4439
|
+
full,
|
|
4440
|
+
} = {}) {
|
|
4441
|
+
this.full = full;
|
|
4442
|
+
|
|
4443
|
+
// Useful to compare instead of instanceof with minified code
|
|
4444
|
+
this.type = 'MeetingStatus';
|
|
4445
|
+
}
|
|
4446
|
+
|
|
4447
|
+
static parse(plain ) {
|
|
4448
|
+
return new MeetingStatus({
|
|
4449
|
+
full: plain.full,
|
|
4450
|
+
});
|
|
4451
|
+
}
|
|
4452
|
+
|
|
4453
|
+
}
|
|
4454
|
+
|
|
4419
4455
|
/* */
|
|
4420
4456
|
|
|
4421
4457
|
|
|
@@ -4610,6 +4646,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4610
4646
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4611
4647
|
ApiRequester.successResponseParser),
|
|
4612
4648
|
|
|
4649
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4650
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4613
4651
|
});
|
|
4614
4652
|
|
|
4615
4653
|
//
|
|
@@ -399,13 +399,21 @@ class CallSession {
|
|
|
399
399
|
|
|
400
400
|
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
401
401
|
set answered(value ) {
|
|
402
|
-
this.answerTime = value ? new Date() : null;
|
|
402
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
get answered() {
|
|
406
406
|
return !!this.answerTime;
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
+
toJSON() {
|
|
410
|
+
const jsonObj = { ...this };
|
|
411
|
+
// $FlowFixMe
|
|
412
|
+
jsonObj.answered = this.answered;
|
|
413
|
+
|
|
414
|
+
return jsonObj;
|
|
415
|
+
}
|
|
416
|
+
|
|
409
417
|
static parseCall(call ) {
|
|
410
418
|
return new CallSession({
|
|
411
419
|
callId: call.id,
|
|
@@ -1513,6 +1521,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1513
1521
|
}
|
|
1514
1522
|
|
|
1515
1523
|
callSession.answerTime = new Date();
|
|
1524
|
+
this._updateCallSession(callSession);
|
|
1516
1525
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
1517
1526
|
|
|
1518
1527
|
return callSession;
|
|
@@ -1729,6 +1738,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1729
1738
|
|
|
1730
1739
|
this.shouldSendReinvite = false;
|
|
1731
1740
|
callSession.answerTime = new Date();
|
|
1741
|
+
this._updateCallSession(callSession);
|
|
1732
1742
|
this.acceptedSessions[callSession.getId()] = true;
|
|
1733
1743
|
|
|
1734
1744
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -1828,7 +1838,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1828
1838
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
1829
1839
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
1830
1840
|
logger.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
1831
|
-
this.holdSipSession(this.currentSipSession,
|
|
1841
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
1832
1842
|
}
|
|
1833
1843
|
|
|
1834
1844
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -2039,6 +2049,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2039
2049
|
}
|
|
2040
2050
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
2041
2051
|
callSession.creationTime = new Date();
|
|
2052
|
+
this._updateCallSession(callSession);
|
|
2042
2053
|
|
|
2043
2054
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
2044
2055
|
|
|
@@ -2180,7 +2191,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2180
2191
|
return this.client && this.client.isConference(callSession.sipCallId);
|
|
2181
2192
|
}
|
|
2182
2193
|
|
|
2183
|
-
async close() {
|
|
2194
|
+
async close(force = false) {
|
|
2184
2195
|
logger.info('WebRTC close');
|
|
2185
2196
|
|
|
2186
2197
|
try {
|
|
@@ -2192,7 +2203,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2192
2203
|
logger.error('WebRTC close, unregister error', e);
|
|
2193
2204
|
}
|
|
2194
2205
|
|
|
2195
|
-
this.client.close();
|
|
2206
|
+
this.client.close(force);
|
|
2196
2207
|
this.unbind();
|
|
2197
2208
|
|
|
2198
2209
|
this.incomingSessions = [];
|
|
@@ -2318,6 +2329,8 @@ class WebRTCPhone extends Emitter {
|
|
|
2318
2329
|
}
|
|
2319
2330
|
|
|
2320
2331
|
callSession.creationTime = new Date();
|
|
2332
|
+
this._updateCallSession(callSession);
|
|
2333
|
+
|
|
2321
2334
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
2322
2335
|
});
|
|
2323
2336
|
|
|
@@ -2361,6 +2374,8 @@ class WebRTCPhone extends Emitter {
|
|
|
2361
2374
|
logger.info('WebRTC call rejected', session.id);
|
|
2362
2375
|
const callSession = this._createCallSession(session);
|
|
2363
2376
|
callSession.endTime = new Date();
|
|
2377
|
+
this._updateCallSession(callSession);
|
|
2378
|
+
|
|
2364
2379
|
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
2365
2380
|
});
|
|
2366
2381
|
|
|
@@ -2585,6 +2600,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2585
2600
|
displayName: identity ? identity.displayName || number : number,
|
|
2586
2601
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
2587
2602
|
creationTime: fromSession ? fromSession.creationTime : null,
|
|
2603
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
2588
2604
|
endTime: fromSession ? fromSession.endTime : null,
|
|
2589
2605
|
answered: state === sessionState.SessionState.Established,
|
|
2590
2606
|
paused: this.client.isCallHeld(sipSession),
|
|
@@ -370,13 +370,21 @@ class CallSession {
|
|
|
370
370
|
|
|
371
371
|
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
372
372
|
set answered(value ) {
|
|
373
|
-
this.answerTime = value ? new Date() : null;
|
|
373
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
get answered() {
|
|
377
377
|
return !!this.answerTime;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
+
toJSON() {
|
|
381
|
+
const jsonObj = { ...this };
|
|
382
|
+
// $FlowFixMe
|
|
383
|
+
jsonObj.answered = this.answered;
|
|
384
|
+
|
|
385
|
+
return jsonObj;
|
|
386
|
+
}
|
|
387
|
+
|
|
380
388
|
static parseCall(call ) {
|
|
381
389
|
return new CallSession({
|
|
382
390
|
callId: call.id,
|
|
@@ -402,6 +410,8 @@ class CallSession {
|
|
|
402
410
|
}
|
|
403
411
|
}
|
|
404
412
|
|
|
413
|
+
const stringify = cs => JSON.parse(JSON.stringify(cs));
|
|
414
|
+
|
|
405
415
|
describe('CallSession domain', () => {
|
|
406
416
|
it('should update from another CallSession without data loss', () => {
|
|
407
417
|
const callSession = new CallSession({
|
|
@@ -440,7 +450,7 @@ describe('CallSession domain', () => {
|
|
|
440
450
|
expect(cs2.is(cs1)).toBeTruthy();
|
|
441
451
|
});
|
|
442
452
|
|
|
443
|
-
it('should set answerTime when setting answered', () => {
|
|
453
|
+
it('should set answerTime when setting answered to true', () => {
|
|
444
454
|
const cs1 = new CallSession({});
|
|
445
455
|
cs1.answered = true;
|
|
446
456
|
|
|
@@ -449,11 +459,37 @@ describe('CallSession domain', () => {
|
|
|
449
459
|
|
|
450
460
|
const cs3 = new CallSession({ answered: true });
|
|
451
461
|
|
|
452
|
-
expect(cs1.answered).
|
|
462
|
+
expect(cs1.answered).toEqual(true);
|
|
453
463
|
expect(cs1.answerTime).not.toBeNull();
|
|
454
|
-
expect(cs2.answered).
|
|
464
|
+
expect(cs2.answered).toEqual(true);
|
|
455
465
|
expect(cs2.answerTime).not.toBeNull();
|
|
456
|
-
expect(cs3.answered).
|
|
466
|
+
expect(cs3.answered).toEqual(true);
|
|
457
467
|
expect(cs3.answerTime).not.toBeNull();
|
|
468
|
+
|
|
469
|
+
const cs4 = stringify(cs1);
|
|
470
|
+
const cs5 = stringify(cs2);
|
|
471
|
+
const cs6 = stringify(cs3);
|
|
472
|
+
|
|
473
|
+
expect(cs4.answered).toEqual(true);
|
|
474
|
+
expect(cs5.answered).toEqual(true);
|
|
475
|
+
expect(cs6.answered).toEqual(true);
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('should reset answerTime when setting answered to false', () => {
|
|
479
|
+
const cs1 = new CallSession({});
|
|
480
|
+
cs1.answered = false;
|
|
481
|
+
|
|
482
|
+
const cs2 = new CallSession({ answered: false });
|
|
483
|
+
|
|
484
|
+
expect(cs1.answered).toEqual(false);
|
|
485
|
+
expect(cs1.answerTime).toBeNull();
|
|
486
|
+
expect(cs2.answered).toEqual(false);
|
|
487
|
+
expect(cs2.answerTime).toBeNull();
|
|
488
|
+
|
|
489
|
+
const cs4 = stringify(cs1);
|
|
490
|
+
const cs5 = stringify(cs2);
|
|
491
|
+
|
|
492
|
+
expect(cs4.answered).toEqual(false);
|
|
493
|
+
expect(cs5.answered).toEqual(false);
|
|
458
494
|
});
|
|
459
495
|
});
|
|
@@ -370,13 +370,21 @@ class CallSession {
|
|
|
370
370
|
|
|
371
371
|
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
372
372
|
set answered(value ) {
|
|
373
|
-
this.answerTime = value ? new Date() : null;
|
|
373
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
get answered() {
|
|
377
377
|
return !!this.answerTime;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
+
toJSON() {
|
|
381
|
+
const jsonObj = { ...this };
|
|
382
|
+
// $FlowFixMe
|
|
383
|
+
jsonObj.answered = this.answered;
|
|
384
|
+
|
|
385
|
+
return jsonObj;
|
|
386
|
+
}
|
|
387
|
+
|
|
380
388
|
static parseCall(call ) {
|
|
381
389
|
return new CallSession({
|
|
382
390
|
callId: call.id,
|
|
@@ -370,13 +370,21 @@ class CallSession {
|
|
|
370
370
|
|
|
371
371
|
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
372
372
|
set answered(value ) {
|
|
373
|
-
this.answerTime = value ? new Date() : null;
|
|
373
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
get answered() {
|
|
377
377
|
return !!this.answerTime;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
+
toJSON() {
|
|
381
|
+
const jsonObj = { ...this };
|
|
382
|
+
// $FlowFixMe
|
|
383
|
+
jsonObj.answered = this.answered;
|
|
384
|
+
|
|
385
|
+
return jsonObj;
|
|
386
|
+
}
|
|
387
|
+
|
|
380
388
|
static parseCall(call ) {
|
|
381
389
|
return new CallSession({
|
|
382
390
|
callId: call.id,
|
package/lib/index.js
CHANGED
|
@@ -3596,13 +3596,21 @@ class CallSession {
|
|
|
3596
3596
|
|
|
3597
3597
|
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
3598
3598
|
set answered(value ) {
|
|
3599
|
-
this.answerTime = value ? new Date() : null;
|
|
3599
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
3600
3600
|
}
|
|
3601
3601
|
|
|
3602
3602
|
get answered() {
|
|
3603
3603
|
return !!this.answerTime;
|
|
3604
3604
|
}
|
|
3605
3605
|
|
|
3606
|
+
toJSON() {
|
|
3607
|
+
const jsonObj = { ...this };
|
|
3608
|
+
// $FlowFixMe
|
|
3609
|
+
jsonObj.answered = this.answered;
|
|
3610
|
+
|
|
3611
|
+
return jsonObj;
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3606
3614
|
static parseCall(call ) {
|
|
3607
3615
|
return new CallSession({
|
|
3608
3616
|
callId: call.id,
|
|
@@ -4937,6 +4945,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4937
4945
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4938
4946
|
});
|
|
4939
4947
|
|
|
4948
|
+
//
|
|
4949
|
+
|
|
4950
|
+
|
|
4951
|
+
|
|
4952
|
+
|
|
4953
|
+
|
|
4954
|
+
class MeetingStatus {
|
|
4955
|
+
|
|
4956
|
+
|
|
4957
|
+
|
|
4958
|
+
|
|
4959
|
+
constructor({
|
|
4960
|
+
full,
|
|
4961
|
+
} = {}) {
|
|
4962
|
+
this.full = full;
|
|
4963
|
+
|
|
4964
|
+
// Useful to compare instead of instanceof with minified code
|
|
4965
|
+
this.type = 'MeetingStatus';
|
|
4966
|
+
}
|
|
4967
|
+
|
|
4968
|
+
static parse(plain ) {
|
|
4969
|
+
return new MeetingStatus({
|
|
4970
|
+
full: plain.full,
|
|
4971
|
+
});
|
|
4972
|
+
}
|
|
4973
|
+
|
|
4974
|
+
}
|
|
4975
|
+
|
|
4940
4976
|
/* */
|
|
4941
4977
|
|
|
4942
4978
|
|
|
@@ -5131,6 +5167,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
5131
5167
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
5132
5168
|
ApiRequester.successResponseParser),
|
|
5133
5169
|
|
|
5170
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
5171
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
5134
5172
|
});
|
|
5135
5173
|
|
|
5136
5174
|
//
|
|
@@ -6210,6 +6248,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
6210
6248
|
|
|
6211
6249
|
|
|
6212
6250
|
|
|
6251
|
+
|
|
6213
6252
|
|
|
6214
6253
|
|
|
6215
6254
|
|
|
@@ -6251,6 +6290,7 @@ class WebRTCClient extends Emitter {
|
|
|
6251
6290
|
|
|
6252
6291
|
|
|
6253
6292
|
|
|
6293
|
+
|
|
6254
6294
|
|
|
6255
6295
|
// sugar
|
|
6256
6296
|
|
|
@@ -6313,6 +6353,7 @@ class WebRTCClient extends Emitter {
|
|
|
6313
6353
|
this.conferences = {};
|
|
6314
6354
|
this.networkMonitoringInterval = {};
|
|
6315
6355
|
this.sessionNetworkStats = {};
|
|
6356
|
+
this.forceClosed = false;
|
|
6316
6357
|
|
|
6317
6358
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
6318
6359
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -6434,6 +6475,8 @@ class WebRTCClient extends Emitter {
|
|
|
6434
6475
|
skipRegister: this.skipRegister,
|
|
6435
6476
|
};
|
|
6436
6477
|
|
|
6478
|
+
this.forceClosed = false;
|
|
6479
|
+
|
|
6437
6480
|
if (this.skipRegister) {
|
|
6438
6481
|
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6439
6482
|
return Promise.resolve();
|
|
@@ -6458,7 +6501,15 @@ class WebRTCClient extends Emitter {
|
|
|
6458
6501
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6459
6502
|
|
|
6460
6503
|
const onRegisterFailed = () => {
|
|
6461
|
-
logger$9.info('sdk webrtc registering failed', {
|
|
6504
|
+
logger$9.info('sdk webrtc registering failed', {
|
|
6505
|
+
tries,
|
|
6506
|
+
registerer: !!this.registerer,
|
|
6507
|
+
forceClosed: this.forceClosed,
|
|
6508
|
+
});
|
|
6509
|
+
if (this.forceClosed) {
|
|
6510
|
+
return;
|
|
6511
|
+
}
|
|
6512
|
+
|
|
6462
6513
|
this.connectionPromise = null;
|
|
6463
6514
|
if (this.registerer && this.registerer.waiting) {
|
|
6464
6515
|
this.registerer.waitingToggle(false);
|
|
@@ -6736,8 +6787,9 @@ class WebRTCClient extends Emitter {
|
|
|
6736
6787
|
}
|
|
6737
6788
|
}
|
|
6738
6789
|
|
|
6739
|
-
async close() {
|
|
6740
|
-
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6790
|
+
async close(force = false) {
|
|
6791
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
6792
|
+
this.forceClosed = force;
|
|
6741
6793
|
this._cleanupMedia();
|
|
6742
6794
|
this.connectionPromise = null;
|
|
6743
6795
|
|
|
@@ -6756,7 +6808,7 @@ class WebRTCClient extends Emitter {
|
|
|
6756
6808
|
this.userAgent.delegate = null;
|
|
6757
6809
|
this.userAgent.stateChange.removeAllListeners();
|
|
6758
6810
|
|
|
6759
|
-
await this._disconnectTransport();
|
|
6811
|
+
await this._disconnectTransport(force);
|
|
6760
6812
|
|
|
6761
6813
|
this._cleanupRegister();
|
|
6762
6814
|
|
|
@@ -7826,6 +7878,13 @@ class WebRTCClient extends Emitter {
|
|
|
7826
7878
|
}
|
|
7827
7879
|
|
|
7828
7880
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
7881
|
+
let { host } = this.config;
|
|
7882
|
+
let port = this.config.port || 443;
|
|
7883
|
+
|
|
7884
|
+
if (this.config.websocketSip) {
|
|
7885
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
7886
|
+
}
|
|
7887
|
+
|
|
7829
7888
|
const config = {
|
|
7830
7889
|
authorizationUsername: this.config.authorizationUser,
|
|
7831
7890
|
authorizationPassword: this.config.password,
|
|
@@ -7861,7 +7920,7 @@ class WebRTCClient extends Emitter {
|
|
|
7861
7920
|
},
|
|
7862
7921
|
transportOptions: {
|
|
7863
7922
|
traceSip: configOverrides.traceSip || false,
|
|
7864
|
-
wsServers: `wss://${
|
|
7923
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
7865
7924
|
},
|
|
7866
7925
|
sessionDescriptionHandlerFactoryOptions: {
|
|
7867
7926
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -8185,7 +8244,15 @@ class WebRTCClient extends Emitter {
|
|
|
8185
8244
|
return userAgent.UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
8186
8245
|
}
|
|
8187
8246
|
|
|
8188
|
-
async _disconnectTransport() {
|
|
8247
|
+
async _disconnectTransport(force = false) {
|
|
8248
|
+
if (force) {
|
|
8249
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8250
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
8251
|
+
// eslint-disable-next-line
|
|
8252
|
+
this.userAgent.transport._ws.close(1000);
|
|
8253
|
+
return;
|
|
8254
|
+
}
|
|
8255
|
+
|
|
8189
8256
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
8190
8257
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
8191
8258
|
try {
|
|
@@ -9823,6 +9890,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9823
9890
|
}
|
|
9824
9891
|
|
|
9825
9892
|
callSession.answerTime = new Date();
|
|
9893
|
+
this._updateCallSession(callSession);
|
|
9826
9894
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9827
9895
|
|
|
9828
9896
|
return callSession;
|
|
@@ -10039,6 +10107,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10039
10107
|
|
|
10040
10108
|
this.shouldSendReinvite = false;
|
|
10041
10109
|
callSession.answerTime = new Date();
|
|
10110
|
+
this._updateCallSession(callSession);
|
|
10042
10111
|
this.acceptedSessions[callSession.getId()] = true;
|
|
10043
10112
|
|
|
10044
10113
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -10138,7 +10207,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10138
10207
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
10139
10208
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
10140
10209
|
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
10141
|
-
this.holdSipSession(this.currentSipSession,
|
|
10210
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
10142
10211
|
}
|
|
10143
10212
|
|
|
10144
10213
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -10349,6 +10418,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10349
10418
|
}
|
|
10350
10419
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
10351
10420
|
callSession.creationTime = new Date();
|
|
10421
|
+
this._updateCallSession(callSession);
|
|
10352
10422
|
|
|
10353
10423
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
10354
10424
|
|
|
@@ -10490,7 +10560,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10490
10560
|
return this.client && this.client.isConference(callSession.sipCallId);
|
|
10491
10561
|
}
|
|
10492
10562
|
|
|
10493
|
-
async close() {
|
|
10563
|
+
async close(force = false) {
|
|
10494
10564
|
logger$7.info('WebRTC close');
|
|
10495
10565
|
|
|
10496
10566
|
try {
|
|
@@ -10502,7 +10572,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10502
10572
|
logger$7.error('WebRTC close, unregister error', e);
|
|
10503
10573
|
}
|
|
10504
10574
|
|
|
10505
|
-
this.client.close();
|
|
10575
|
+
this.client.close(force);
|
|
10506
10576
|
this.unbind();
|
|
10507
10577
|
|
|
10508
10578
|
this.incomingSessions = [];
|
|
@@ -10628,6 +10698,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10628
10698
|
}
|
|
10629
10699
|
|
|
10630
10700
|
callSession.creationTime = new Date();
|
|
10701
|
+
this._updateCallSession(callSession);
|
|
10702
|
+
|
|
10631
10703
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10632
10704
|
});
|
|
10633
10705
|
|
|
@@ -10671,6 +10743,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10671
10743
|
logger$7.info('WebRTC call rejected', session.id);
|
|
10672
10744
|
const callSession = this._createCallSession(session);
|
|
10673
10745
|
callSession.endTime = new Date();
|
|
10746
|
+
this._updateCallSession(callSession);
|
|
10747
|
+
|
|
10674
10748
|
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10675
10749
|
});
|
|
10676
10750
|
|
|
@@ -10895,6 +10969,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10895
10969
|
displayName: identity ? identity.displayName || number : number,
|
|
10896
10970
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10897
10971
|
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10972
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
10898
10973
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10899
10974
|
answered: state === sessionState.SessionState.Established,
|
|
10900
10975
|
paused: this.client.isCallHeld(sipSession),
|