@wazo/sdk 0.37.27 → 0.37.31
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 +3 -2
- package/dist/wazo-sdk.js +4 -4
- package/esm/__tests__/web-rtc-client.test.js +9 -1
- package/esm/checker/Checker.js +9 -1
- package/esm/checker/checks/index.js +9 -1
- package/esm/checker/checks/webrtc-transport.js +9 -1
- package/esm/checker/checks/webrtc.js +9 -1
- package/esm/domain/CallSession.js +29 -2
- package/esm/domain/Phone/CTIPhone.js +29 -2
- package/esm/domain/Phone/WebRTCPhone.js +57 -4
- package/esm/domain/SFUNotAvailableError.js +9 -0
- package/esm/domain/__tests__/CallSession.test.js +46 -2
- package/esm/domain/__tests__/IndirectTransfer.test.js +29 -2
- package/esm/domain/__tests__/Room.test.js +29 -2
- package/esm/index.js +77 -5
- package/esm/simple/Auth.js +76 -5
- package/esm/simple/Configuration.js +76 -5
- package/esm/simple/Phone.js +76 -5
- package/esm/simple/index.js +76 -5
- package/esm/simple/room/LocalParticipant.js +76 -5
- package/esm/simple/room/Participant.js +76 -5
- package/esm/simple/room/RemoteParticipant.js +76 -5
- package/esm/simple/room/Room.js +76 -5
- package/esm/simple/room/SipRoom.js +76 -5
- package/esm/simple/room/Stream.js +76 -5
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +76 -5
- package/esm/simple/utils.js +76 -5
- package/esm/web-rtc-client.js +9 -1
- package/lib/__tests__/web-rtc-client.test.js +9 -1
- package/lib/checker/Checker.js +9 -1
- package/lib/checker/checks/index.js +9 -1
- package/lib/checker/checks/webrtc-transport.js +9 -1
- package/lib/checker/checks/webrtc.js +9 -1
- package/lib/domain/CallSession.js +29 -2
- package/lib/domain/Phone/CTIPhone.js +29 -2
- package/lib/domain/Phone/WebRTCPhone.js +57 -3
- package/lib/domain/SFUNotAvailableError.js +11 -0
- package/lib/domain/__tests__/CallSession.test.js +46 -2
- package/lib/domain/__tests__/IndirectTransfer.test.js +29 -2
- package/lib/domain/__tests__/Room.test.js +29 -2
- package/lib/index.js +77 -5
- package/lib/simple/Auth.js +76 -5
- package/lib/simple/Configuration.js +76 -5
- package/lib/simple/Phone.js +76 -5
- package/lib/simple/index.js +76 -5
- package/lib/simple/room/LocalParticipant.js +76 -5
- package/lib/simple/room/Participant.js +76 -5
- package/lib/simple/room/RemoteParticipant.js +76 -5
- package/lib/simple/room/Room.js +76 -5
- package/lib/simple/room/SipRoom.js +76 -5
- package/lib/simple/room/Stream.js +76 -5
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +76 -5
- package/lib/simple/utils.js +76 -5
- package/lib/web-rtc-client.js +9 -1
- package/package.json +1 -1
- package/src/domain/CallSession.js +32 -4
- package/src/domain/Phone/WebRTCPhone.js +27 -1
- package/src/domain/SFUNotAvailableError.js +7 -0
- package/src/domain/__tests__/CallSession.test.js +17 -0
- package/src/index.js +2 -0
- package/src/simple/Phone.js +2 -1
- package/src/simple/index.js +2 -0
- package/src/web-rtc-client.js +9 -1
package/lib/simple/Auth.js
CHANGED
|
@@ -3260,13 +3260,16 @@ var updateFrom = (instance , from ) => {
|
|
|
3260
3260
|
|
|
3261
3261
|
|
|
3262
3262
|
|
|
3263
|
+
|
|
3263
3264
|
|
|
3264
3265
|
|
|
3265
3266
|
|
|
3266
3267
|
|
|
3267
3268
|
|
|
3269
|
+
|
|
3268
3270
|
|
|
3269
3271
|
|
|
3272
|
+
|
|
3270
3273
|
|
|
3271
3274
|
|
|
3272
3275
|
|
|
@@ -3283,6 +3286,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3283
3286
|
|
|
3284
3287
|
|
|
3285
3288
|
|
|
3289
|
+
|
|
3286
3290
|
|
|
3287
3291
|
|
|
3288
3292
|
class CallSession {
|
|
@@ -3302,10 +3306,14 @@ class CallSession {
|
|
|
3302
3306
|
|
|
3303
3307
|
|
|
3304
3308
|
|
|
3305
|
-
|
|
3309
|
+
|
|
3310
|
+
|
|
3311
|
+
// = creationTime
|
|
3306
3312
|
|
|
3307
3313
|
|
|
3308
3314
|
|
|
3315
|
+
|
|
3316
|
+
|
|
3309
3317
|
|
|
3310
3318
|
|
|
3311
3319
|
|
|
@@ -3341,6 +3349,8 @@ class CallSession {
|
|
|
3341
3349
|
|
|
3342
3350
|
|
|
3343
3351
|
|
|
3352
|
+
|
|
3353
|
+
|
|
3344
3354
|
|
|
3345
3355
|
constructor({
|
|
3346
3356
|
answered,
|
|
@@ -3354,6 +3364,8 @@ class CallSession {
|
|
|
3354
3364
|
paused,
|
|
3355
3365
|
ringing,
|
|
3356
3366
|
startTime,
|
|
3367
|
+
creationTime,
|
|
3368
|
+
endTime,
|
|
3357
3369
|
cameraEnabled,
|
|
3358
3370
|
dialedExtension,
|
|
3359
3371
|
sipCallId,
|
|
@@ -3366,12 +3378,16 @@ class CallSession {
|
|
|
3366
3378
|
recording,
|
|
3367
3379
|
recordingPaused,
|
|
3368
3380
|
videoRemotelyDowngraded,
|
|
3381
|
+
sipSession,
|
|
3382
|
+
answerTime,
|
|
3369
3383
|
} ) {
|
|
3370
3384
|
this.callId = callId;
|
|
3371
3385
|
this.sipCallId = sipCallId;
|
|
3372
3386
|
this.displayName = displayName;
|
|
3373
3387
|
this.number = number;
|
|
3388
|
+
this.creationTime = creationTime;
|
|
3374
3389
|
this.startTime = startTime;
|
|
3390
|
+
this.endTime = endTime;
|
|
3375
3391
|
this.isCaller = isCaller;
|
|
3376
3392
|
this.answered = answered;
|
|
3377
3393
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3390,6 +3406,8 @@ class CallSession {
|
|
|
3390
3406
|
this.recording = recording || false;
|
|
3391
3407
|
this.recordingPaused = recordingPaused || false;
|
|
3392
3408
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3409
|
+
this.sipSession = sipSession;
|
|
3410
|
+
this.answerTime = answerTime || this.answerTime;
|
|
3393
3411
|
|
|
3394
3412
|
// Useful to compare instead of instanceof with minified code
|
|
3395
3413
|
this.type = 'CallSession';
|
|
@@ -3420,7 +3438,7 @@ class CallSession {
|
|
|
3420
3438
|
}
|
|
3421
3439
|
|
|
3422
3440
|
answer() {
|
|
3423
|
-
this.
|
|
3441
|
+
this.answerTime = new Date();
|
|
3424
3442
|
}
|
|
3425
3443
|
|
|
3426
3444
|
systemAnswer() {
|
|
@@ -3576,6 +3594,15 @@ class CallSession {
|
|
|
3576
3594
|
return newFrom(callSession, CallSession);
|
|
3577
3595
|
}
|
|
3578
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 ? this.answerTime || new Date() : null;
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
get answered() {
|
|
3603
|
+
return !!this.answerTime;
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3579
3606
|
static parseCall(call ) {
|
|
3580
3607
|
return new CallSession({
|
|
3581
3608
|
callId: call.id,
|
|
@@ -6358,6 +6385,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
6358
6385
|
|
|
6359
6386
|
|
|
6360
6387
|
|
|
6388
|
+
|
|
6361
6389
|
|
|
6362
6390
|
|
|
6363
6391
|
|
|
@@ -7974,6 +8002,13 @@ class WebRTCClient extends Emitter {
|
|
|
7974
8002
|
}
|
|
7975
8003
|
|
|
7976
8004
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
8005
|
+
let { host } = this.config;
|
|
8006
|
+
let port = this.config.port || 443;
|
|
8007
|
+
|
|
8008
|
+
if (this.config.websocketSip) {
|
|
8009
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
8010
|
+
}
|
|
8011
|
+
|
|
7977
8012
|
const config = {
|
|
7978
8013
|
authorizationUsername: this.config.authorizationUser,
|
|
7979
8014
|
authorizationPassword: this.config.password,
|
|
@@ -8009,7 +8044,7 @@ class WebRTCClient extends Emitter {
|
|
|
8009
8044
|
},
|
|
8010
8045
|
transportOptions: {
|
|
8011
8046
|
traceSip: configOverrides.traceSip || false,
|
|
8012
|
-
wsServers: `wss://${
|
|
8047
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
8013
8048
|
},
|
|
8014
8049
|
sessionDescriptionHandlerFactoryOptions: {
|
|
8015
8050
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -8471,6 +8506,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8471
8506
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8472
8507
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8473
8508
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8509
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8474
8510
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8475
8511
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8476
8512
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8515,6 +8551,7 @@ const events = [
|
|
|
8515
8551
|
ON_CAMERA_DISABLED,
|
|
8516
8552
|
ON_CALL_FAILED,
|
|
8517
8553
|
ON_CALL_ENDED,
|
|
8554
|
+
ON_CALL_REJECTED,
|
|
8518
8555
|
ON_MESSAGE,
|
|
8519
8556
|
ON_REINVITE,
|
|
8520
8557
|
ON_TRACK,
|
|
@@ -8871,6 +8908,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8871
8908
|
|
|
8872
8909
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8873
8910
|
const callSession = this._createCallSession(sipSession);
|
|
8911
|
+
callSession.endTime = new Date();
|
|
8874
8912
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8875
8913
|
|
|
8876
8914
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9066,6 +9104,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9066
9104
|
this.removeIncomingSessions(sipSessionId);
|
|
9067
9105
|
}
|
|
9068
9106
|
|
|
9107
|
+
callSession.answerTime = new Date();
|
|
9108
|
+
this._updateCallSession(callSession);
|
|
9069
9109
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9070
9110
|
|
|
9071
9111
|
return callSession;
|
|
@@ -9281,6 +9321,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9281
9321
|
}
|
|
9282
9322
|
|
|
9283
9323
|
this.shouldSendReinvite = false;
|
|
9324
|
+
callSession.answerTime = new Date();
|
|
9325
|
+
this._updateCallSession(callSession);
|
|
9284
9326
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9285
9327
|
|
|
9286
9328
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -9380,7 +9422,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9380
9422
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9381
9423
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9382
9424
|
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9383
|
-
this.holdSipSession(this.currentSipSession,
|
|
9425
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
9384
9426
|
}
|
|
9385
9427
|
|
|
9386
9428
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -9590,6 +9632,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9590
9632
|
return Promise.resolve(null);
|
|
9591
9633
|
}
|
|
9592
9634
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9635
|
+
callSession.creationTime = new Date();
|
|
9636
|
+
this._updateCallSession(callSession);
|
|
9593
9637
|
|
|
9594
9638
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9595
9639
|
|
|
@@ -9868,6 +9912,9 @@ class WebRTCPhone extends Emitter {
|
|
|
9868
9912
|
callSession);
|
|
9869
9913
|
}
|
|
9870
9914
|
|
|
9915
|
+
callSession.creationTime = new Date();
|
|
9916
|
+
this._updateCallSession(callSession);
|
|
9917
|
+
|
|
9871
9918
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
9872
9919
|
});
|
|
9873
9920
|
|
|
@@ -9907,6 +9954,15 @@ class WebRTCPhone extends Emitter {
|
|
|
9907
9954
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9908
9955
|
});
|
|
9909
9956
|
|
|
9957
|
+
this.client.on(this.client.REJECTED, session => {
|
|
9958
|
+
logger$8.info('WebRTC call rejected', session.id);
|
|
9959
|
+
const callSession = this._createCallSession(session);
|
|
9960
|
+
callSession.endTime = new Date();
|
|
9961
|
+
this._updateCallSession(callSession);
|
|
9962
|
+
|
|
9963
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
9964
|
+
});
|
|
9965
|
+
|
|
9910
9966
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9911
9967
|
logger$8.info('WebRTC unregistered');
|
|
9912
9968
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10119,6 +10175,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10119
10175
|
const number = identity ? identity.uri._normal.user : null;
|
|
10120
10176
|
const { state } = sipSession || {};
|
|
10121
10177
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10178
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10122
10179
|
|
|
10123
10180
|
const callSession = new CallSession({
|
|
10124
10181
|
callId: fromSession && fromSession.callId,
|
|
@@ -10126,6 +10183,9 @@ class WebRTCPhone extends Emitter {
|
|
|
10126
10183
|
sipStatus: state,
|
|
10127
10184
|
displayName: identity ? identity.displayName || number : number,
|
|
10128
10185
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10186
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10187
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
10188
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10129
10189
|
answered: state === sessionState.SessionState.Established,
|
|
10130
10190
|
paused: this.client.isCallHeld(sipSession),
|
|
10131
10191
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10136,6 +10196,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10136
10196
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10137
10197
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10138
10198
|
recordingPaused: false, // @TODO
|
|
10199
|
+
sipSession,
|
|
10139
10200
|
...extra,
|
|
10140
10201
|
});
|
|
10141
10202
|
|
|
@@ -10164,6 +10225,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10164
10225
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10165
10226
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10166
10227
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10228
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10167
10229
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10168
10230
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10169
10231
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -10193,6 +10255,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10193
10255
|
'default': WebRTCPhone
|
|
10194
10256
|
});
|
|
10195
10257
|
|
|
10258
|
+
/* */
|
|
10259
|
+
class SFUNotAvailableError extends Error {
|
|
10260
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10261
|
+
super(message);
|
|
10262
|
+
this.name = 'SFUNotAvailableError';
|
|
10263
|
+
}
|
|
10264
|
+
}
|
|
10265
|
+
|
|
10196
10266
|
//
|
|
10197
10267
|
|
|
10198
10268
|
const logger$7 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10577,7 +10647,7 @@ class Phone extends Emitter {
|
|
|
10577
10647
|
|
|
10578
10648
|
checkSfu() {
|
|
10579
10649
|
if (!this.hasSfu()) {
|
|
10580
|
-
throw new
|
|
10650
|
+
throw new SFUNotAvailableError();
|
|
10581
10651
|
}
|
|
10582
10652
|
}
|
|
10583
10653
|
|
|
@@ -13490,6 +13560,7 @@ const Wazo = {
|
|
|
13490
13560
|
InvalidSubscription,
|
|
13491
13561
|
InvalidAuthorization,
|
|
13492
13562
|
CanceledCallError,
|
|
13563
|
+
SFUNotAvailableError,
|
|
13493
13564
|
};
|
|
13494
13565
|
|
|
13495
13566
|
if (window) {
|
|
@@ -3258,13 +3258,16 @@ var updateFrom = (instance , from ) => {
|
|
|
3258
3258
|
|
|
3259
3259
|
|
|
3260
3260
|
|
|
3261
|
+
|
|
3261
3262
|
|
|
3262
3263
|
|
|
3263
3264
|
|
|
3264
3265
|
|
|
3265
3266
|
|
|
3267
|
+
|
|
3266
3268
|
|
|
3267
3269
|
|
|
3270
|
+
|
|
3268
3271
|
|
|
3269
3272
|
|
|
3270
3273
|
|
|
@@ -3281,6 +3284,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3281
3284
|
|
|
3282
3285
|
|
|
3283
3286
|
|
|
3287
|
+
|
|
3284
3288
|
|
|
3285
3289
|
|
|
3286
3290
|
class CallSession {
|
|
@@ -3300,10 +3304,14 @@ class CallSession {
|
|
|
3300
3304
|
|
|
3301
3305
|
|
|
3302
3306
|
|
|
3303
|
-
|
|
3307
|
+
|
|
3308
|
+
|
|
3309
|
+
// = creationTime
|
|
3304
3310
|
|
|
3305
3311
|
|
|
3306
3312
|
|
|
3313
|
+
|
|
3314
|
+
|
|
3307
3315
|
|
|
3308
3316
|
|
|
3309
3317
|
|
|
@@ -3339,6 +3347,8 @@ class CallSession {
|
|
|
3339
3347
|
|
|
3340
3348
|
|
|
3341
3349
|
|
|
3350
|
+
|
|
3351
|
+
|
|
3342
3352
|
|
|
3343
3353
|
constructor({
|
|
3344
3354
|
answered,
|
|
@@ -3352,6 +3362,8 @@ class CallSession {
|
|
|
3352
3362
|
paused,
|
|
3353
3363
|
ringing,
|
|
3354
3364
|
startTime,
|
|
3365
|
+
creationTime,
|
|
3366
|
+
endTime,
|
|
3355
3367
|
cameraEnabled,
|
|
3356
3368
|
dialedExtension,
|
|
3357
3369
|
sipCallId,
|
|
@@ -3364,12 +3376,16 @@ class CallSession {
|
|
|
3364
3376
|
recording,
|
|
3365
3377
|
recordingPaused,
|
|
3366
3378
|
videoRemotelyDowngraded,
|
|
3379
|
+
sipSession,
|
|
3380
|
+
answerTime,
|
|
3367
3381
|
} ) {
|
|
3368
3382
|
this.callId = callId;
|
|
3369
3383
|
this.sipCallId = sipCallId;
|
|
3370
3384
|
this.displayName = displayName;
|
|
3371
3385
|
this.number = number;
|
|
3386
|
+
this.creationTime = creationTime;
|
|
3372
3387
|
this.startTime = startTime;
|
|
3388
|
+
this.endTime = endTime;
|
|
3373
3389
|
this.isCaller = isCaller;
|
|
3374
3390
|
this.answered = answered;
|
|
3375
3391
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3388,6 +3404,8 @@ class CallSession {
|
|
|
3388
3404
|
this.recording = recording || false;
|
|
3389
3405
|
this.recordingPaused = recordingPaused || false;
|
|
3390
3406
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3407
|
+
this.sipSession = sipSession;
|
|
3408
|
+
this.answerTime = answerTime || this.answerTime;
|
|
3391
3409
|
|
|
3392
3410
|
// Useful to compare instead of instanceof with minified code
|
|
3393
3411
|
this.type = 'CallSession';
|
|
@@ -3418,7 +3436,7 @@ class CallSession {
|
|
|
3418
3436
|
}
|
|
3419
3437
|
|
|
3420
3438
|
answer() {
|
|
3421
|
-
this.
|
|
3439
|
+
this.answerTime = new Date();
|
|
3422
3440
|
}
|
|
3423
3441
|
|
|
3424
3442
|
systemAnswer() {
|
|
@@ -3574,6 +3592,15 @@ class CallSession {
|
|
|
3574
3592
|
return newFrom(callSession, CallSession);
|
|
3575
3593
|
}
|
|
3576
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 ? this.answerTime || new Date() : null;
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
get answered() {
|
|
3601
|
+
return !!this.answerTime;
|
|
3602
|
+
}
|
|
3603
|
+
|
|
3577
3604
|
static parseCall(call ) {
|
|
3578
3605
|
return new CallSession({
|
|
3579
3606
|
callId: call.id,
|
|
@@ -6356,6 +6383,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
6356
6383
|
|
|
6357
6384
|
|
|
6358
6385
|
|
|
6386
|
+
|
|
6359
6387
|
|
|
6360
6388
|
|
|
6361
6389
|
|
|
@@ -7972,6 +8000,13 @@ class WebRTCClient extends Emitter {
|
|
|
7972
8000
|
}
|
|
7973
8001
|
|
|
7974
8002
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
8003
|
+
let { host } = this.config;
|
|
8004
|
+
let port = this.config.port || 443;
|
|
8005
|
+
|
|
8006
|
+
if (this.config.websocketSip) {
|
|
8007
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
8008
|
+
}
|
|
8009
|
+
|
|
7975
8010
|
const config = {
|
|
7976
8011
|
authorizationUsername: this.config.authorizationUser,
|
|
7977
8012
|
authorizationPassword: this.config.password,
|
|
@@ -8007,7 +8042,7 @@ class WebRTCClient extends Emitter {
|
|
|
8007
8042
|
},
|
|
8008
8043
|
transportOptions: {
|
|
8009
8044
|
traceSip: configOverrides.traceSip || false,
|
|
8010
|
-
wsServers: `wss://${
|
|
8045
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
8011
8046
|
},
|
|
8012
8047
|
sessionDescriptionHandlerFactoryOptions: {
|
|
8013
8048
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -8469,6 +8504,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8469
8504
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8470
8505
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8471
8506
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8507
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8472
8508
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8473
8509
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8474
8510
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8513,6 +8549,7 @@ const events = [
|
|
|
8513
8549
|
ON_CAMERA_DISABLED,
|
|
8514
8550
|
ON_CALL_FAILED,
|
|
8515
8551
|
ON_CALL_ENDED,
|
|
8552
|
+
ON_CALL_REJECTED,
|
|
8516
8553
|
ON_MESSAGE,
|
|
8517
8554
|
ON_REINVITE,
|
|
8518
8555
|
ON_TRACK,
|
|
@@ -8869,6 +8906,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8869
8906
|
|
|
8870
8907
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8871
8908
|
const callSession = this._createCallSession(sipSession);
|
|
8909
|
+
callSession.endTime = new Date();
|
|
8872
8910
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8873
8911
|
|
|
8874
8912
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9064,6 +9102,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9064
9102
|
this.removeIncomingSessions(sipSessionId);
|
|
9065
9103
|
}
|
|
9066
9104
|
|
|
9105
|
+
callSession.answerTime = new Date();
|
|
9106
|
+
this._updateCallSession(callSession);
|
|
9067
9107
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9068
9108
|
|
|
9069
9109
|
return callSession;
|
|
@@ -9279,6 +9319,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9279
9319
|
}
|
|
9280
9320
|
|
|
9281
9321
|
this.shouldSendReinvite = false;
|
|
9322
|
+
callSession.answerTime = new Date();
|
|
9323
|
+
this._updateCallSession(callSession);
|
|
9282
9324
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9283
9325
|
|
|
9284
9326
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -9378,7 +9420,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9378
9420
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9379
9421
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9380
9422
|
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9381
|
-
this.holdSipSession(this.currentSipSession,
|
|
9423
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
9382
9424
|
}
|
|
9383
9425
|
|
|
9384
9426
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -9588,6 +9630,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9588
9630
|
return Promise.resolve(null);
|
|
9589
9631
|
}
|
|
9590
9632
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9633
|
+
callSession.creationTime = new Date();
|
|
9634
|
+
this._updateCallSession(callSession);
|
|
9591
9635
|
|
|
9592
9636
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9593
9637
|
|
|
@@ -9866,6 +9910,9 @@ class WebRTCPhone extends Emitter {
|
|
|
9866
9910
|
callSession);
|
|
9867
9911
|
}
|
|
9868
9912
|
|
|
9913
|
+
callSession.creationTime = new Date();
|
|
9914
|
+
this._updateCallSession(callSession);
|
|
9915
|
+
|
|
9869
9916
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
9870
9917
|
});
|
|
9871
9918
|
|
|
@@ -9905,6 +9952,15 @@ class WebRTCPhone extends Emitter {
|
|
|
9905
9952
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9906
9953
|
});
|
|
9907
9954
|
|
|
9955
|
+
this.client.on(this.client.REJECTED, session => {
|
|
9956
|
+
logger$8.info('WebRTC call rejected', session.id);
|
|
9957
|
+
const callSession = this._createCallSession(session);
|
|
9958
|
+
callSession.endTime = new Date();
|
|
9959
|
+
this._updateCallSession(callSession);
|
|
9960
|
+
|
|
9961
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
9962
|
+
});
|
|
9963
|
+
|
|
9908
9964
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9909
9965
|
logger$8.info('WebRTC unregistered');
|
|
9910
9966
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10117,6 +10173,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10117
10173
|
const number = identity ? identity.uri._normal.user : null;
|
|
10118
10174
|
const { state } = sipSession || {};
|
|
10119
10175
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10176
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10120
10177
|
|
|
10121
10178
|
const callSession = new CallSession({
|
|
10122
10179
|
callId: fromSession && fromSession.callId,
|
|
@@ -10124,6 +10181,9 @@ class WebRTCPhone extends Emitter {
|
|
|
10124
10181
|
sipStatus: state,
|
|
10125
10182
|
displayName: identity ? identity.displayName || number : number,
|
|
10126
10183
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10184
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10185
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
10186
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10127
10187
|
answered: state === sessionState.SessionState.Established,
|
|
10128
10188
|
paused: this.client.isCallHeld(sipSession),
|
|
10129
10189
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10134,6 +10194,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10134
10194
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10135
10195
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10136
10196
|
recordingPaused: false, // @TODO
|
|
10197
|
+
sipSession,
|
|
10137
10198
|
...extra,
|
|
10138
10199
|
});
|
|
10139
10200
|
|
|
@@ -10162,6 +10223,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10162
10223
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10163
10224
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10164
10225
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10226
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10165
10227
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10166
10228
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10167
10229
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -10191,6 +10253,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10191
10253
|
'default': WebRTCPhone
|
|
10192
10254
|
});
|
|
10193
10255
|
|
|
10256
|
+
/* */
|
|
10257
|
+
class SFUNotAvailableError extends Error {
|
|
10258
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10259
|
+
super(message);
|
|
10260
|
+
this.name = 'SFUNotAvailableError';
|
|
10261
|
+
}
|
|
10262
|
+
}
|
|
10263
|
+
|
|
10194
10264
|
//
|
|
10195
10265
|
|
|
10196
10266
|
const logger$7 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10575,7 +10645,7 @@ class Phone extends Emitter {
|
|
|
10575
10645
|
|
|
10576
10646
|
checkSfu() {
|
|
10577
10647
|
if (!this.hasSfu()) {
|
|
10578
|
-
throw new
|
|
10648
|
+
throw new SFUNotAvailableError();
|
|
10579
10649
|
}
|
|
10580
10650
|
}
|
|
10581
10651
|
|
|
@@ -13471,6 +13541,7 @@ const Wazo = {
|
|
|
13471
13541
|
InvalidSubscription,
|
|
13472
13542
|
InvalidAuthorization,
|
|
13473
13543
|
CanceledCallError,
|
|
13544
|
+
SFUNotAvailableError,
|
|
13474
13545
|
};
|
|
13475
13546
|
|
|
13476
13547
|
if (window) {
|