@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
|
@@ -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,
|
|
@@ -6620,6 +6647,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
6620
6647
|
|
|
6621
6648
|
|
|
6622
6649
|
|
|
6650
|
+
|
|
6623
6651
|
|
|
6624
6652
|
|
|
6625
6653
|
|
|
@@ -8236,6 +8264,13 @@ class WebRTCClient extends Emitter {
|
|
|
8236
8264
|
}
|
|
8237
8265
|
|
|
8238
8266
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
8267
|
+
let { host } = this.config;
|
|
8268
|
+
let port = this.config.port || 443;
|
|
8269
|
+
|
|
8270
|
+
if (this.config.websocketSip) {
|
|
8271
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
8272
|
+
}
|
|
8273
|
+
|
|
8239
8274
|
const config = {
|
|
8240
8275
|
authorizationUsername: this.config.authorizationUser,
|
|
8241
8276
|
authorizationPassword: this.config.password,
|
|
@@ -8271,7 +8306,7 @@ class WebRTCClient extends Emitter {
|
|
|
8271
8306
|
},
|
|
8272
8307
|
transportOptions: {
|
|
8273
8308
|
traceSip: configOverrides.traceSip || false,
|
|
8274
|
-
wsServers: `wss://${
|
|
8309
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
8275
8310
|
},
|
|
8276
8311
|
sessionDescriptionHandlerFactoryOptions: {
|
|
8277
8312
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -8733,6 +8768,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8733
8768
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8734
8769
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8735
8770
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8771
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8736
8772
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8737
8773
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8738
8774
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8777,6 +8813,7 @@ const events = [
|
|
|
8777
8813
|
ON_CAMERA_DISABLED,
|
|
8778
8814
|
ON_CALL_FAILED,
|
|
8779
8815
|
ON_CALL_ENDED,
|
|
8816
|
+
ON_CALL_REJECTED,
|
|
8780
8817
|
ON_MESSAGE,
|
|
8781
8818
|
ON_REINVITE,
|
|
8782
8819
|
ON_TRACK,
|
|
@@ -9133,6 +9170,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9133
9170
|
|
|
9134
9171
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9135
9172
|
const callSession = this._createCallSession(sipSession);
|
|
9173
|
+
callSession.endTime = new Date();
|
|
9136
9174
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9137
9175
|
|
|
9138
9176
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9328,6 +9366,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9328
9366
|
this.removeIncomingSessions(sipSessionId);
|
|
9329
9367
|
}
|
|
9330
9368
|
|
|
9369
|
+
callSession.answerTime = new Date();
|
|
9370
|
+
this._updateCallSession(callSession);
|
|
9331
9371
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9332
9372
|
|
|
9333
9373
|
return callSession;
|
|
@@ -9543,6 +9583,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9543
9583
|
}
|
|
9544
9584
|
|
|
9545
9585
|
this.shouldSendReinvite = false;
|
|
9586
|
+
callSession.answerTime = new Date();
|
|
9587
|
+
this._updateCallSession(callSession);
|
|
9546
9588
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9547
9589
|
|
|
9548
9590
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -9642,7 +9684,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9642
9684
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9643
9685
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9644
9686
|
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9645
|
-
this.holdSipSession(this.currentSipSession,
|
|
9687
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
9646
9688
|
}
|
|
9647
9689
|
|
|
9648
9690
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -9852,6 +9894,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9852
9894
|
return Promise.resolve(null);
|
|
9853
9895
|
}
|
|
9854
9896
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9897
|
+
callSession.creationTime = new Date();
|
|
9898
|
+
this._updateCallSession(callSession);
|
|
9855
9899
|
|
|
9856
9900
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9857
9901
|
|
|
@@ -10130,6 +10174,9 @@ class WebRTCPhone extends Emitter {
|
|
|
10130
10174
|
callSession);
|
|
10131
10175
|
}
|
|
10132
10176
|
|
|
10177
|
+
callSession.creationTime = new Date();
|
|
10178
|
+
this._updateCallSession(callSession);
|
|
10179
|
+
|
|
10133
10180
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10134
10181
|
});
|
|
10135
10182
|
|
|
@@ -10169,6 +10216,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10169
10216
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10170
10217
|
});
|
|
10171
10218
|
|
|
10219
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10220
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10221
|
+
const callSession = this._createCallSession(session);
|
|
10222
|
+
callSession.endTime = new Date();
|
|
10223
|
+
this._updateCallSession(callSession);
|
|
10224
|
+
|
|
10225
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10226
|
+
});
|
|
10227
|
+
|
|
10172
10228
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10173
10229
|
logger$7.info('WebRTC unregistered');
|
|
10174
10230
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10381,6 +10437,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10381
10437
|
const number = identity ? identity.uri._normal.user : null;
|
|
10382
10438
|
const { state } = sipSession || {};
|
|
10383
10439
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10440
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10384
10441
|
|
|
10385
10442
|
const callSession = new CallSession({
|
|
10386
10443
|
callId: fromSession && fromSession.callId,
|
|
@@ -10388,6 +10445,9 @@ class WebRTCPhone extends Emitter {
|
|
|
10388
10445
|
sipStatus: state,
|
|
10389
10446
|
displayName: identity ? identity.displayName || number : number,
|
|
10390
10447
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10448
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10449
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
10450
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10391
10451
|
answered: state === sessionState.SessionState.Established,
|
|
10392
10452
|
paused: this.client.isCallHeld(sipSession),
|
|
10393
10453
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10398,6 +10458,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10398
10458
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10399
10459
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10400
10460
|
recordingPaused: false, // @TODO
|
|
10461
|
+
sipSession,
|
|
10401
10462
|
...extra,
|
|
10402
10463
|
});
|
|
10403
10464
|
|
|
@@ -10426,6 +10487,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10426
10487
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10427
10488
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10428
10489
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10490
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10429
10491
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10430
10492
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10431
10493
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -10455,6 +10517,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10455
10517
|
'default': WebRTCPhone
|
|
10456
10518
|
});
|
|
10457
10519
|
|
|
10520
|
+
/* */
|
|
10521
|
+
class SFUNotAvailableError extends Error {
|
|
10522
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10523
|
+
super(message);
|
|
10524
|
+
this.name = 'SFUNotAvailableError';
|
|
10525
|
+
}
|
|
10526
|
+
}
|
|
10527
|
+
|
|
10458
10528
|
//
|
|
10459
10529
|
|
|
10460
10530
|
const logger$6 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10839,7 +10909,7 @@ class Phone extends Emitter {
|
|
|
10839
10909
|
|
|
10840
10910
|
checkSfu() {
|
|
10841
10911
|
if (!this.hasSfu()) {
|
|
10842
|
-
throw new
|
|
10912
|
+
throw new SFUNotAvailableError();
|
|
10843
10913
|
}
|
|
10844
10914
|
}
|
|
10845
10915
|
|
|
@@ -13613,6 +13683,7 @@ const Wazo = {
|
|
|
13613
13683
|
InvalidSubscription,
|
|
13614
13684
|
InvalidAuthorization,
|
|
13615
13685
|
CanceledCallError,
|
|
13686
|
+
SFUNotAvailableError,
|
|
13616
13687
|
};
|
|
13617
13688
|
|
|
13618
13689
|
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,
|
|
@@ -6620,6 +6647,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
6620
6647
|
|
|
6621
6648
|
|
|
6622
6649
|
|
|
6650
|
+
|
|
6623
6651
|
|
|
6624
6652
|
|
|
6625
6653
|
|
|
@@ -8236,6 +8264,13 @@ class WebRTCClient extends Emitter {
|
|
|
8236
8264
|
}
|
|
8237
8265
|
|
|
8238
8266
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
8267
|
+
let { host } = this.config;
|
|
8268
|
+
let port = this.config.port || 443;
|
|
8269
|
+
|
|
8270
|
+
if (this.config.websocketSip) {
|
|
8271
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
8272
|
+
}
|
|
8273
|
+
|
|
8239
8274
|
const config = {
|
|
8240
8275
|
authorizationUsername: this.config.authorizationUser,
|
|
8241
8276
|
authorizationPassword: this.config.password,
|
|
@@ -8271,7 +8306,7 @@ class WebRTCClient extends Emitter {
|
|
|
8271
8306
|
},
|
|
8272
8307
|
transportOptions: {
|
|
8273
8308
|
traceSip: configOverrides.traceSip || false,
|
|
8274
|
-
wsServers: `wss://${
|
|
8309
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
8275
8310
|
},
|
|
8276
8311
|
sessionDescriptionHandlerFactoryOptions: {
|
|
8277
8312
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -8733,6 +8768,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8733
8768
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8734
8769
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8735
8770
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8771
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8736
8772
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8737
8773
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8738
8774
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8777,6 +8813,7 @@ const events = [
|
|
|
8777
8813
|
ON_CAMERA_DISABLED,
|
|
8778
8814
|
ON_CALL_FAILED,
|
|
8779
8815
|
ON_CALL_ENDED,
|
|
8816
|
+
ON_CALL_REJECTED,
|
|
8780
8817
|
ON_MESSAGE,
|
|
8781
8818
|
ON_REINVITE,
|
|
8782
8819
|
ON_TRACK,
|
|
@@ -9133,6 +9170,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9133
9170
|
|
|
9134
9171
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9135
9172
|
const callSession = this._createCallSession(sipSession);
|
|
9173
|
+
callSession.endTime = new Date();
|
|
9136
9174
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9137
9175
|
|
|
9138
9176
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9328,6 +9366,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9328
9366
|
this.removeIncomingSessions(sipSessionId);
|
|
9329
9367
|
}
|
|
9330
9368
|
|
|
9369
|
+
callSession.answerTime = new Date();
|
|
9370
|
+
this._updateCallSession(callSession);
|
|
9331
9371
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9332
9372
|
|
|
9333
9373
|
return callSession;
|
|
@@ -9543,6 +9583,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9543
9583
|
}
|
|
9544
9584
|
|
|
9545
9585
|
this.shouldSendReinvite = false;
|
|
9586
|
+
callSession.answerTime = new Date();
|
|
9587
|
+
this._updateCallSession(callSession);
|
|
9546
9588
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9547
9589
|
|
|
9548
9590
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -9642,7 +9684,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9642
9684
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9643
9685
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9644
9686
|
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9645
|
-
this.holdSipSession(this.currentSipSession,
|
|
9687
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
9646
9688
|
}
|
|
9647
9689
|
|
|
9648
9690
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -9852,6 +9894,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9852
9894
|
return Promise.resolve(null);
|
|
9853
9895
|
}
|
|
9854
9896
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9897
|
+
callSession.creationTime = new Date();
|
|
9898
|
+
this._updateCallSession(callSession);
|
|
9855
9899
|
|
|
9856
9900
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9857
9901
|
|
|
@@ -10130,6 +10174,9 @@ class WebRTCPhone extends Emitter {
|
|
|
10130
10174
|
callSession);
|
|
10131
10175
|
}
|
|
10132
10176
|
|
|
10177
|
+
callSession.creationTime = new Date();
|
|
10178
|
+
this._updateCallSession(callSession);
|
|
10179
|
+
|
|
10133
10180
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10134
10181
|
});
|
|
10135
10182
|
|
|
@@ -10169,6 +10216,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10169
10216
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10170
10217
|
});
|
|
10171
10218
|
|
|
10219
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10220
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10221
|
+
const callSession = this._createCallSession(session);
|
|
10222
|
+
callSession.endTime = new Date();
|
|
10223
|
+
this._updateCallSession(callSession);
|
|
10224
|
+
|
|
10225
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10226
|
+
});
|
|
10227
|
+
|
|
10172
10228
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10173
10229
|
logger$7.info('WebRTC unregistered');
|
|
10174
10230
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10381,6 +10437,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10381
10437
|
const number = identity ? identity.uri._normal.user : null;
|
|
10382
10438
|
const { state } = sipSession || {};
|
|
10383
10439
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10440
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10384
10441
|
|
|
10385
10442
|
const callSession = new CallSession({
|
|
10386
10443
|
callId: fromSession && fromSession.callId,
|
|
@@ -10388,6 +10445,9 @@ class WebRTCPhone extends Emitter {
|
|
|
10388
10445
|
sipStatus: state,
|
|
10389
10446
|
displayName: identity ? identity.displayName || number : number,
|
|
10390
10447
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10448
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10449
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
10450
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10391
10451
|
answered: state === sessionState.SessionState.Established,
|
|
10392
10452
|
paused: this.client.isCallHeld(sipSession),
|
|
10393
10453
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10398,6 +10458,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10398
10458
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10399
10459
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10400
10460
|
recordingPaused: false, // @TODO
|
|
10461
|
+
sipSession,
|
|
10401
10462
|
...extra,
|
|
10402
10463
|
});
|
|
10403
10464
|
|
|
@@ -10426,6 +10487,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10426
10487
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10427
10488
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10428
10489
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10490
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10429
10491
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10430
10492
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10431
10493
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -10455,6 +10517,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10455
10517
|
'default': WebRTCPhone
|
|
10456
10518
|
});
|
|
10457
10519
|
|
|
10520
|
+
/* */
|
|
10521
|
+
class SFUNotAvailableError extends Error {
|
|
10522
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10523
|
+
super(message);
|
|
10524
|
+
this.name = 'SFUNotAvailableError';
|
|
10525
|
+
}
|
|
10526
|
+
}
|
|
10527
|
+
|
|
10458
10528
|
//
|
|
10459
10529
|
|
|
10460
10530
|
const logger$6 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10839,7 +10909,7 @@ class Phone extends Emitter {
|
|
|
10839
10909
|
|
|
10840
10910
|
checkSfu() {
|
|
10841
10911
|
if (!this.hasSfu()) {
|
|
10842
|
-
throw new
|
|
10912
|
+
throw new SFUNotAvailableError();
|
|
10843
10913
|
}
|
|
10844
10914
|
}
|
|
10845
10915
|
|
|
@@ -13694,6 +13764,7 @@ const Wazo = {
|
|
|
13694
13764
|
InvalidSubscription,
|
|
13695
13765
|
InvalidAuthorization,
|
|
13696
13766
|
CanceledCallError,
|
|
13767
|
+
SFUNotAvailableError,
|
|
13697
13768
|
};
|
|
13698
13769
|
|
|
13699
13770
|
if (window) {
|