@wazo/sdk 0.37.28 → 0.37.29
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 +2 -2
- package/esm/domain/CallSession.js +15 -3
- package/esm/domain/Phone/CTIPhone.js +15 -3
- package/esm/domain/Phone/WebRTCPhone.js +17 -3
- 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 +17 -3
- package/esm/simple/Auth.js +17 -3
- package/esm/simple/Configuration.js +17 -3
- package/esm/simple/Phone.js +17 -3
- package/esm/simple/index.js +17 -3
- package/esm/simple/room/LocalParticipant.js +17 -3
- package/esm/simple/room/Participant.js +17 -3
- package/esm/simple/room/RemoteParticipant.js +17 -3
- package/esm/simple/room/Room.js +17 -3
- package/esm/simple/room/SipRoom.js +17 -3
- package/esm/simple/room/Stream.js +17 -3
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +17 -3
- package/esm/simple/utils.js +17 -3
- package/lib/domain/CallSession.js +15 -3
- package/lib/domain/Phone/CTIPhone.js +15 -3
- package/lib/domain/Phone/WebRTCPhone.js +17 -3
- 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 +17 -3
- package/lib/simple/Auth.js +17 -3
- package/lib/simple/Configuration.js +17 -3
- package/lib/simple/Phone.js +17 -3
- package/lib/simple/index.js +17 -3
- package/lib/simple/room/LocalParticipant.js +17 -3
- package/lib/simple/room/Participant.js +17 -3
- package/lib/simple/room/RemoteParticipant.js +17 -3
- package/lib/simple/room/Room.js +17 -3
- package/lib/simple/room/SipRoom.js +17 -3
- package/lib/simple/room/Stream.js +17 -3
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +17 -3
- package/lib/simple/utils.js +17 -3
- package/package.json +1 -1
- package/src/domain/CallSession.js +16 -4
- package/src/domain/Phone/WebRTCPhone.js +2 -0
- package/src/domain/__tests__/CallSession.test.js +17 -0
|
@@ -3258,6 +3258,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3258
3258
|
|
|
3259
3259
|
|
|
3260
3260
|
|
|
3261
|
+
|
|
3261
3262
|
|
|
3262
3263
|
|
|
3263
3264
|
|
|
@@ -3305,14 +3306,14 @@ class CallSession {
|
|
|
3305
3306
|
|
|
3306
3307
|
|
|
3307
3308
|
|
|
3309
|
+
// = creationTime
|
|
3310
|
+
|
|
3308
3311
|
|
|
3309
3312
|
|
|
3310
3313
|
|
|
3311
3314
|
|
|
3312
3315
|
|
|
3313
3316
|
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
3317
|
|
|
3317
3318
|
|
|
3318
3319
|
|
|
@@ -3376,6 +3377,7 @@ class CallSession {
|
|
|
3376
3377
|
recordingPaused,
|
|
3377
3378
|
videoRemotelyDowngraded,
|
|
3378
3379
|
sipSession,
|
|
3380
|
+
answerTime,
|
|
3379
3381
|
} ) {
|
|
3380
3382
|
this.callId = callId;
|
|
3381
3383
|
this.sipCallId = sipCallId;
|
|
@@ -3403,6 +3405,7 @@ class CallSession {
|
|
|
3403
3405
|
this.recordingPaused = recordingPaused || false;
|
|
3404
3406
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3405
3407
|
this.sipSession = sipSession;
|
|
3408
|
+
this.answerTime = answerTime || this.answerTime;
|
|
3406
3409
|
|
|
3407
3410
|
// Useful to compare instead of instanceof with minified code
|
|
3408
3411
|
this.type = 'CallSession';
|
|
@@ -3433,7 +3436,7 @@ class CallSession {
|
|
|
3433
3436
|
}
|
|
3434
3437
|
|
|
3435
3438
|
answer() {
|
|
3436
|
-
this.
|
|
3439
|
+
this.answerTime = new Date();
|
|
3437
3440
|
}
|
|
3438
3441
|
|
|
3439
3442
|
systemAnswer() {
|
|
@@ -3589,6 +3592,15 @@ class CallSession {
|
|
|
3589
3592
|
return newFrom(callSession, CallSession);
|
|
3590
3593
|
}
|
|
3591
3594
|
|
|
3595
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
3596
|
+
set answered(value ) {
|
|
3597
|
+
this.answerTime = value ? new Date() : null;
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
get answered() {
|
|
3601
|
+
return !!this.answerTime;
|
|
3602
|
+
}
|
|
3603
|
+
|
|
3592
3604
|
static parseCall(call ) {
|
|
3593
3605
|
return new CallSession({
|
|
3594
3606
|
callId: call.id,
|
|
@@ -9346,6 +9358,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9346
9358
|
this.removeIncomingSessions(sipSessionId);
|
|
9347
9359
|
}
|
|
9348
9360
|
|
|
9361
|
+
callSession.answerTime = new Date();
|
|
9349
9362
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9350
9363
|
|
|
9351
9364
|
return callSession;
|
|
@@ -9561,6 +9574,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9561
9574
|
}
|
|
9562
9575
|
|
|
9563
9576
|
this.shouldSendReinvite = false;
|
|
9577
|
+
callSession.answerTime = new Date();
|
|
9564
9578
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9565
9579
|
|
|
9566
9580
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -3258,6 +3258,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3258
3258
|
|
|
3259
3259
|
|
|
3260
3260
|
|
|
3261
|
+
|
|
3261
3262
|
|
|
3262
3263
|
|
|
3263
3264
|
|
|
@@ -3305,14 +3306,14 @@ class CallSession {
|
|
|
3305
3306
|
|
|
3306
3307
|
|
|
3307
3308
|
|
|
3309
|
+
// = creationTime
|
|
3310
|
+
|
|
3308
3311
|
|
|
3309
3312
|
|
|
3310
3313
|
|
|
3311
3314
|
|
|
3312
3315
|
|
|
3313
3316
|
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
3317
|
|
|
3317
3318
|
|
|
3318
3319
|
|
|
@@ -3376,6 +3377,7 @@ class CallSession {
|
|
|
3376
3377
|
recordingPaused,
|
|
3377
3378
|
videoRemotelyDowngraded,
|
|
3378
3379
|
sipSession,
|
|
3380
|
+
answerTime,
|
|
3379
3381
|
} ) {
|
|
3380
3382
|
this.callId = callId;
|
|
3381
3383
|
this.sipCallId = sipCallId;
|
|
@@ -3403,6 +3405,7 @@ class CallSession {
|
|
|
3403
3405
|
this.recordingPaused = recordingPaused || false;
|
|
3404
3406
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3405
3407
|
this.sipSession = sipSession;
|
|
3408
|
+
this.answerTime = answerTime || this.answerTime;
|
|
3406
3409
|
|
|
3407
3410
|
// Useful to compare instead of instanceof with minified code
|
|
3408
3411
|
this.type = 'CallSession';
|
|
@@ -3433,7 +3436,7 @@ class CallSession {
|
|
|
3433
3436
|
}
|
|
3434
3437
|
|
|
3435
3438
|
answer() {
|
|
3436
|
-
this.
|
|
3439
|
+
this.answerTime = new Date();
|
|
3437
3440
|
}
|
|
3438
3441
|
|
|
3439
3442
|
systemAnswer() {
|
|
@@ -3589,6 +3592,15 @@ class CallSession {
|
|
|
3589
3592
|
return newFrom(callSession, CallSession);
|
|
3590
3593
|
}
|
|
3591
3594
|
|
|
3595
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
3596
|
+
set answered(value ) {
|
|
3597
|
+
this.answerTime = value ? new Date() : null;
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
get answered() {
|
|
3601
|
+
return !!this.answerTime;
|
|
3602
|
+
}
|
|
3603
|
+
|
|
3592
3604
|
static parseCall(call ) {
|
|
3593
3605
|
return new CallSession({
|
|
3594
3606
|
callId: call.id,
|
|
@@ -9346,6 +9358,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9346
9358
|
this.removeIncomingSessions(sipSessionId);
|
|
9347
9359
|
}
|
|
9348
9360
|
|
|
9361
|
+
callSession.answerTime = new Date();
|
|
9349
9362
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9350
9363
|
|
|
9351
9364
|
return callSession;
|
|
@@ -9561,6 +9574,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9561
9574
|
}
|
|
9562
9575
|
|
|
9563
9576
|
this.shouldSendReinvite = false;
|
|
9577
|
+
callSession.answerTime = new Date();
|
|
9564
9578
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9565
9579
|
|
|
9566
9580
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -3258,6 +3258,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3258
3258
|
|
|
3259
3259
|
|
|
3260
3260
|
|
|
3261
|
+
|
|
3261
3262
|
|
|
3262
3263
|
|
|
3263
3264
|
|
|
@@ -3305,14 +3306,14 @@ class CallSession {
|
|
|
3305
3306
|
|
|
3306
3307
|
|
|
3307
3308
|
|
|
3309
|
+
// = creationTime
|
|
3310
|
+
|
|
3308
3311
|
|
|
3309
3312
|
|
|
3310
3313
|
|
|
3311
3314
|
|
|
3312
3315
|
|
|
3313
3316
|
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
3317
|
|
|
3317
3318
|
|
|
3318
3319
|
|
|
@@ -3376,6 +3377,7 @@ class CallSession {
|
|
|
3376
3377
|
recordingPaused,
|
|
3377
3378
|
videoRemotelyDowngraded,
|
|
3378
3379
|
sipSession,
|
|
3380
|
+
answerTime,
|
|
3379
3381
|
} ) {
|
|
3380
3382
|
this.callId = callId;
|
|
3381
3383
|
this.sipCallId = sipCallId;
|
|
@@ -3403,6 +3405,7 @@ class CallSession {
|
|
|
3403
3405
|
this.recordingPaused = recordingPaused || false;
|
|
3404
3406
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3405
3407
|
this.sipSession = sipSession;
|
|
3408
|
+
this.answerTime = answerTime || this.answerTime;
|
|
3406
3409
|
|
|
3407
3410
|
// Useful to compare instead of instanceof with minified code
|
|
3408
3411
|
this.type = 'CallSession';
|
|
@@ -3433,7 +3436,7 @@ class CallSession {
|
|
|
3433
3436
|
}
|
|
3434
3437
|
|
|
3435
3438
|
answer() {
|
|
3436
|
-
this.
|
|
3439
|
+
this.answerTime = new Date();
|
|
3437
3440
|
}
|
|
3438
3441
|
|
|
3439
3442
|
systemAnswer() {
|
|
@@ -3589,6 +3592,15 @@ class CallSession {
|
|
|
3589
3592
|
return newFrom(callSession, CallSession);
|
|
3590
3593
|
}
|
|
3591
3594
|
|
|
3595
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
3596
|
+
set answered(value ) {
|
|
3597
|
+
this.answerTime = value ? new Date() : null;
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
get answered() {
|
|
3601
|
+
return !!this.answerTime;
|
|
3602
|
+
}
|
|
3603
|
+
|
|
3592
3604
|
static parseCall(call ) {
|
|
3593
3605
|
return new CallSession({
|
|
3594
3606
|
callId: call.id,
|
|
@@ -9346,6 +9358,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9346
9358
|
this.removeIncomingSessions(sipSessionId);
|
|
9347
9359
|
}
|
|
9348
9360
|
|
|
9361
|
+
callSession.answerTime = new Date();
|
|
9349
9362
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9350
9363
|
|
|
9351
9364
|
return callSession;
|
|
@@ -9561,6 +9574,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9561
9574
|
}
|
|
9562
9575
|
|
|
9563
9576
|
this.shouldSendReinvite = false;
|
|
9577
|
+
callSession.answerTime = new Date();
|
|
9564
9578
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9565
9579
|
|
|
9566
9580
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
package/lib/simple/utils.js
CHANGED
|
@@ -3260,6 +3260,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3260
3260
|
|
|
3261
3261
|
|
|
3262
3262
|
|
|
3263
|
+
|
|
3263
3264
|
|
|
3264
3265
|
|
|
3265
3266
|
|
|
@@ -3307,14 +3308,14 @@ class CallSession {
|
|
|
3307
3308
|
|
|
3308
3309
|
|
|
3309
3310
|
|
|
3311
|
+
// = creationTime
|
|
3312
|
+
|
|
3310
3313
|
|
|
3311
3314
|
|
|
3312
3315
|
|
|
3313
3316
|
|
|
3314
3317
|
|
|
3315
3318
|
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
3319
|
|
|
3319
3320
|
|
|
3320
3321
|
|
|
@@ -3378,6 +3379,7 @@ class CallSession {
|
|
|
3378
3379
|
recordingPaused,
|
|
3379
3380
|
videoRemotelyDowngraded,
|
|
3380
3381
|
sipSession,
|
|
3382
|
+
answerTime,
|
|
3381
3383
|
} ) {
|
|
3382
3384
|
this.callId = callId;
|
|
3383
3385
|
this.sipCallId = sipCallId;
|
|
@@ -3405,6 +3407,7 @@ class CallSession {
|
|
|
3405
3407
|
this.recordingPaused = recordingPaused || false;
|
|
3406
3408
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3407
3409
|
this.sipSession = sipSession;
|
|
3410
|
+
this.answerTime = answerTime || this.answerTime;
|
|
3408
3411
|
|
|
3409
3412
|
// Useful to compare instead of instanceof with minified code
|
|
3410
3413
|
this.type = 'CallSession';
|
|
@@ -3435,7 +3438,7 @@ class CallSession {
|
|
|
3435
3438
|
}
|
|
3436
3439
|
|
|
3437
3440
|
answer() {
|
|
3438
|
-
this.
|
|
3441
|
+
this.answerTime = new Date();
|
|
3439
3442
|
}
|
|
3440
3443
|
|
|
3441
3444
|
systemAnswer() {
|
|
@@ -3591,6 +3594,15 @@ class CallSession {
|
|
|
3591
3594
|
return newFrom(callSession, CallSession);
|
|
3592
3595
|
}
|
|
3593
3596
|
|
|
3597
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
3598
|
+
set answered(value ) {
|
|
3599
|
+
this.answerTime = value ? new Date() : null;
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
get answered() {
|
|
3603
|
+
return !!this.answerTime;
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3594
3606
|
static parseCall(call ) {
|
|
3595
3607
|
return new CallSession({
|
|
3596
3608
|
callId: call.id,
|
|
@@ -9348,6 +9360,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9348
9360
|
this.removeIncomingSessions(sipSessionId);
|
|
9349
9361
|
}
|
|
9350
9362
|
|
|
9363
|
+
callSession.answerTime = new Date();
|
|
9351
9364
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9352
9365
|
|
|
9353
9366
|
return callSession;
|
|
@@ -9563,6 +9576,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9563
9576
|
}
|
|
9564
9577
|
|
|
9565
9578
|
this.shouldSendReinvite = false;
|
|
9579
|
+
callSession.answerTime = new Date();
|
|
9566
9580
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9567
9581
|
|
|
9568
9582
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import updateFrom from '../utils/update-from';
|
|
|
8
8
|
|
|
9
9
|
type CallSessionArguments = {
|
|
10
10
|
answered: boolean,
|
|
11
|
+
answerTime?: ?Date,
|
|
11
12
|
answeredBySystem: boolean,
|
|
12
13
|
call: ?Call,
|
|
13
14
|
callId: string,
|
|
@@ -55,14 +56,14 @@ export default class CallSession {
|
|
|
55
56
|
|
|
56
57
|
creationTime: ?Date;
|
|
57
58
|
|
|
58
|
-
startTime: number;
|
|
59
|
+
startTime: number; // = creationTime
|
|
60
|
+
|
|
61
|
+
answerTime: ?Date;
|
|
59
62
|
|
|
60
63
|
endTime: ?Date;
|
|
61
64
|
|
|
62
65
|
isCaller: boolean;
|
|
63
66
|
|
|
64
|
-
answered: boolean;
|
|
65
|
-
|
|
66
67
|
answeredBySystem: boolean;
|
|
67
68
|
|
|
68
69
|
dialedExtension: string;
|
|
@@ -126,6 +127,7 @@ export default class CallSession {
|
|
|
126
127
|
recordingPaused,
|
|
127
128
|
videoRemotelyDowngraded,
|
|
128
129
|
sipSession,
|
|
130
|
+
answerTime,
|
|
129
131
|
}: CallSessionArguments) {
|
|
130
132
|
this.callId = callId;
|
|
131
133
|
this.sipCallId = sipCallId;
|
|
@@ -153,6 +155,7 @@ export default class CallSession {
|
|
|
153
155
|
this.recordingPaused = recordingPaused || false;
|
|
154
156
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
155
157
|
this.sipSession = sipSession;
|
|
158
|
+
this.answerTime = answerTime || this.answerTime;
|
|
156
159
|
|
|
157
160
|
// Useful to compare instead of instanceof with minified code
|
|
158
161
|
this.type = 'CallSession';
|
|
@@ -183,7 +186,7 @@ export default class CallSession {
|
|
|
183
186
|
}
|
|
184
187
|
|
|
185
188
|
answer() {
|
|
186
|
-
this.
|
|
189
|
+
this.answerTime = new Date();
|
|
187
190
|
}
|
|
188
191
|
|
|
189
192
|
systemAnswer() {
|
|
@@ -339,6 +342,15 @@ export default class CallSession {
|
|
|
339
342
|
return newFrom(callSession, CallSession);
|
|
340
343
|
}
|
|
341
344
|
|
|
345
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
346
|
+
set answered(value: boolean) {
|
|
347
|
+
this.answerTime = value ? new Date() : null;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
get answered(): boolean {
|
|
351
|
+
return !!this.answerTime;
|
|
352
|
+
}
|
|
353
|
+
|
|
342
354
|
static parseCall(call: Call): CallSession {
|
|
343
355
|
return new CallSession({
|
|
344
356
|
callId: call.id,
|
|
@@ -630,6 +630,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
|
|
|
630
630
|
this.removeIncomingSessions(sipSessionId);
|
|
631
631
|
}
|
|
632
632
|
|
|
633
|
+
callSession.answerTime = new Date();
|
|
633
634
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
634
635
|
|
|
635
636
|
return callSession;
|
|
@@ -845,6 +846,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
|
|
|
845
846
|
}
|
|
846
847
|
|
|
847
848
|
this.shouldSendReinvite = false;
|
|
849
|
+
callSession.answerTime = new Date();
|
|
848
850
|
this.acceptedSessions[callSession.getId()] = true;
|
|
849
851
|
|
|
850
852
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -37,4 +37,21 @@ describe('CallSession domain', () => {
|
|
|
37
37
|
expect(cs1.is(cs2)).toBeTruthy();
|
|
38
38
|
expect(cs2.is(cs1)).toBeTruthy();
|
|
39
39
|
});
|
|
40
|
+
|
|
41
|
+
it('should set answerTime when setting answered', () => {
|
|
42
|
+
const cs1 = new CallSession({});
|
|
43
|
+
cs1.answered = true;
|
|
44
|
+
|
|
45
|
+
const cs2 = new CallSession({});
|
|
46
|
+
cs2.answer();
|
|
47
|
+
|
|
48
|
+
const cs3 = new CallSession({ answered: true });
|
|
49
|
+
|
|
50
|
+
expect(cs1.answered).toBeTruthy();
|
|
51
|
+
expect(cs1.answerTime).not.toBeNull();
|
|
52
|
+
expect(cs2.answered).toBeTruthy();
|
|
53
|
+
expect(cs2.answerTime).not.toBeNull();
|
|
54
|
+
expect(cs3.answered).toBeTruthy();
|
|
55
|
+
expect(cs3.answerTime).not.toBeNull();
|
|
56
|
+
});
|
|
40
57
|
});
|