@wazo/sdk 0.37.27 → 0.37.28
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 +1 -1
- package/dist/wazo-sdk.js +2 -2
- package/esm/domain/CallSession.js +15 -0
- package/esm/domain/Phone/CTIPhone.js +15 -0
- package/esm/domain/Phone/WebRTCPhone.js +32 -1
- package/esm/domain/SFUNotAvailableError.js +9 -0
- package/esm/domain/__tests__/CallSession.test.js +15 -0
- package/esm/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/esm/domain/__tests__/Room.test.js +15 -0
- package/esm/index.js +43 -1
- package/esm/simple/Auth.js +42 -1
- package/esm/simple/Configuration.js +42 -1
- package/esm/simple/Phone.js +42 -1
- package/esm/simple/index.js +42 -1
- package/esm/simple/room/LocalParticipant.js +42 -1
- package/esm/simple/room/Participant.js +42 -1
- package/esm/simple/room/RemoteParticipant.js +42 -1
- package/esm/simple/room/Room.js +42 -1
- package/esm/simple/room/SipRoom.js +42 -1
- package/esm/simple/room/Stream.js +42 -1
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +42 -1
- package/esm/simple/utils.js +42 -1
- package/lib/domain/CallSession.js +15 -0
- package/lib/domain/Phone/CTIPhone.js +15 -0
- package/lib/domain/Phone/WebRTCPhone.js +32 -0
- package/lib/domain/SFUNotAvailableError.js +11 -0
- package/lib/domain/__tests__/CallSession.test.js +15 -0
- package/lib/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/lib/domain/__tests__/Room.test.js +15 -0
- package/lib/index.js +43 -1
- package/lib/simple/Auth.js +42 -1
- package/lib/simple/Configuration.js +42 -1
- package/lib/simple/Phone.js +42 -1
- package/lib/simple/index.js +42 -1
- package/lib/simple/room/LocalParticipant.js +42 -1
- package/lib/simple/room/Participant.js +42 -1
- package/lib/simple/room/RemoteParticipant.js +42 -1
- package/lib/simple/room/Room.js +42 -1
- package/lib/simple/room/SipRoom.js +42 -1
- package/lib/simple/room/Stream.js +42 -1
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +42 -1
- package/lib/simple/utils.js +42 -1
- package/package.json +1 -1
- package/src/domain/CallSession.js +16 -0
- package/src/domain/Phone/WebRTCPhone.js +16 -0
- package/src/domain/SFUNotAvailableError.js +7 -0
- package/src/index.js +2 -0
- package/src/simple/Phone.js +2 -1
- package/src/simple/index.js +2 -0
package/lib/simple/Phone.js
CHANGED
|
@@ -263,8 +263,10 @@ var updateFrom = (instance , from ) => {
|
|
|
263
263
|
|
|
264
264
|
|
|
265
265
|
|
|
266
|
+
|
|
266
267
|
|
|
267
268
|
|
|
269
|
+
|
|
268
270
|
|
|
269
271
|
|
|
270
272
|
|
|
@@ -281,6 +283,7 @@ var updateFrom = (instance , from ) => {
|
|
|
281
283
|
|
|
282
284
|
|
|
283
285
|
|
|
286
|
+
|
|
284
287
|
|
|
285
288
|
|
|
286
289
|
class CallSession {
|
|
@@ -300,8 +303,12 @@ class CallSession {
|
|
|
300
303
|
|
|
301
304
|
|
|
302
305
|
|
|
306
|
+
|
|
307
|
+
|
|
303
308
|
|
|
304
309
|
|
|
310
|
+
|
|
311
|
+
|
|
305
312
|
|
|
306
313
|
|
|
307
314
|
|
|
@@ -339,6 +346,8 @@ class CallSession {
|
|
|
339
346
|
|
|
340
347
|
|
|
341
348
|
|
|
349
|
+
|
|
350
|
+
|
|
342
351
|
|
|
343
352
|
constructor({
|
|
344
353
|
answered,
|
|
@@ -352,6 +361,8 @@ class CallSession {
|
|
|
352
361
|
paused,
|
|
353
362
|
ringing,
|
|
354
363
|
startTime,
|
|
364
|
+
creationTime,
|
|
365
|
+
endTime,
|
|
355
366
|
cameraEnabled,
|
|
356
367
|
dialedExtension,
|
|
357
368
|
sipCallId,
|
|
@@ -364,12 +375,15 @@ class CallSession {
|
|
|
364
375
|
recording,
|
|
365
376
|
recordingPaused,
|
|
366
377
|
videoRemotelyDowngraded,
|
|
378
|
+
sipSession,
|
|
367
379
|
} ) {
|
|
368
380
|
this.callId = callId;
|
|
369
381
|
this.sipCallId = sipCallId;
|
|
370
382
|
this.displayName = displayName;
|
|
371
383
|
this.number = number;
|
|
384
|
+
this.creationTime = creationTime;
|
|
372
385
|
this.startTime = startTime;
|
|
386
|
+
this.endTime = endTime;
|
|
373
387
|
this.isCaller = isCaller;
|
|
374
388
|
this.answered = answered;
|
|
375
389
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -388,6 +402,7 @@ class CallSession {
|
|
|
388
402
|
this.recording = recording || false;
|
|
389
403
|
this.recordingPaused = recordingPaused || false;
|
|
390
404
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
405
|
+
this.sipSession = sipSession;
|
|
391
406
|
|
|
392
407
|
// Useful to compare instead of instanceof with minified code
|
|
393
408
|
this.type = 'CallSession';
|
|
@@ -8469,6 +8484,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8469
8484
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8470
8485
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8471
8486
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8487
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8472
8488
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8473
8489
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8474
8490
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8513,6 +8529,7 @@ const events = [
|
|
|
8513
8529
|
ON_CAMERA_DISABLED,
|
|
8514
8530
|
ON_CALL_FAILED,
|
|
8515
8531
|
ON_CALL_ENDED,
|
|
8532
|
+
ON_CALL_REJECTED,
|
|
8516
8533
|
ON_MESSAGE,
|
|
8517
8534
|
ON_REINVITE,
|
|
8518
8535
|
ON_TRACK,
|
|
@@ -8869,6 +8886,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8869
8886
|
|
|
8870
8887
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8871
8888
|
const callSession = this._createCallSession(sipSession);
|
|
8889
|
+
callSession.endTime = new Date();
|
|
8872
8890
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8873
8891
|
|
|
8874
8892
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9588,6 +9606,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9588
9606
|
return Promise.resolve(null);
|
|
9589
9607
|
}
|
|
9590
9608
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9609
|
+
callSession.creationTime = new Date();
|
|
9591
9610
|
|
|
9592
9611
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9593
9612
|
|
|
@@ -9866,6 +9885,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9866
9885
|
callSession);
|
|
9867
9886
|
}
|
|
9868
9887
|
|
|
9888
|
+
callSession.creationTime = new Date();
|
|
9869
9889
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
9870
9890
|
});
|
|
9871
9891
|
|
|
@@ -9905,6 +9925,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9905
9925
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9906
9926
|
});
|
|
9907
9927
|
|
|
9928
|
+
this.client.on(this.client.REJECTED, session => {
|
|
9929
|
+
logger$8.info('WebRTC call rejected', session.id);
|
|
9930
|
+
const callSession = this._createCallSession(session);
|
|
9931
|
+
callSession.endTime = new Date();
|
|
9932
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
9933
|
+
});
|
|
9934
|
+
|
|
9908
9935
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9909
9936
|
logger$8.info('WebRTC unregistered');
|
|
9910
9937
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10117,6 +10144,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10117
10144
|
const number = identity ? identity.uri._normal.user : null;
|
|
10118
10145
|
const { state } = sipSession || {};
|
|
10119
10146
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10147
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10120
10148
|
|
|
10121
10149
|
const callSession = new CallSession({
|
|
10122
10150
|
callId: fromSession && fromSession.callId,
|
|
@@ -10124,6 +10152,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10124
10152
|
sipStatus: state,
|
|
10125
10153
|
displayName: identity ? identity.displayName || number : number,
|
|
10126
10154
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10155
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10156
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10127
10157
|
answered: state === sessionState.SessionState.Established,
|
|
10128
10158
|
paused: this.client.isCallHeld(sipSession),
|
|
10129
10159
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10134,6 +10164,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10134
10164
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10135
10165
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10136
10166
|
recordingPaused: false, // @TODO
|
|
10167
|
+
sipSession,
|
|
10137
10168
|
...extra,
|
|
10138
10169
|
});
|
|
10139
10170
|
|
|
@@ -10162,6 +10193,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10162
10193
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10163
10194
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10164
10195
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10196
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10165
10197
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10166
10198
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10167
10199
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -12441,6 +12473,14 @@ const createLocalVideoStream = async (options ) => createLocalStream('vid
|
|
|
12441
12473
|
|
|
12442
12474
|
const createLocalAudioStream = async (options ) => createLocalStream('audio', options);
|
|
12443
12475
|
|
|
12476
|
+
/* */
|
|
12477
|
+
class SFUNotAvailableError extends Error {
|
|
12478
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
12479
|
+
super(message);
|
|
12480
|
+
this.name = 'SFUNotAvailableError';
|
|
12481
|
+
}
|
|
12482
|
+
}
|
|
12483
|
+
|
|
12444
12484
|
//
|
|
12445
12485
|
|
|
12446
12486
|
|
|
@@ -13342,6 +13382,7 @@ const Wazo = {
|
|
|
13342
13382
|
InvalidSubscription,
|
|
13343
13383
|
InvalidAuthorization,
|
|
13344
13384
|
CanceledCallError,
|
|
13385
|
+
SFUNotAvailableError,
|
|
13345
13386
|
};
|
|
13346
13387
|
|
|
13347
13388
|
if (window) {
|
|
@@ -13735,7 +13776,7 @@ class Phone extends Emitter {
|
|
|
13735
13776
|
|
|
13736
13777
|
checkSfu() {
|
|
13737
13778
|
if (!this.hasSfu()) {
|
|
13738
|
-
throw new
|
|
13779
|
+
throw new SFUNotAvailableError();
|
|
13739
13780
|
}
|
|
13740
13781
|
}
|
|
13741
13782
|
|
package/lib/simple/index.js
CHANGED
|
@@ -3263,8 +3263,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3263
3263
|
|
|
3264
3264
|
|
|
3265
3265
|
|
|
3266
|
+
|
|
3266
3267
|
|
|
3267
3268
|
|
|
3269
|
+
|
|
3268
3270
|
|
|
3269
3271
|
|
|
3270
3272
|
|
|
@@ -3281,6 +3283,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3281
3283
|
|
|
3282
3284
|
|
|
3283
3285
|
|
|
3286
|
+
|
|
3284
3287
|
|
|
3285
3288
|
|
|
3286
3289
|
class CallSession {
|
|
@@ -3300,8 +3303,12 @@ class CallSession {
|
|
|
3300
3303
|
|
|
3301
3304
|
|
|
3302
3305
|
|
|
3306
|
+
|
|
3307
|
+
|
|
3303
3308
|
|
|
3304
3309
|
|
|
3310
|
+
|
|
3311
|
+
|
|
3305
3312
|
|
|
3306
3313
|
|
|
3307
3314
|
|
|
@@ -3339,6 +3346,8 @@ class CallSession {
|
|
|
3339
3346
|
|
|
3340
3347
|
|
|
3341
3348
|
|
|
3349
|
+
|
|
3350
|
+
|
|
3342
3351
|
|
|
3343
3352
|
constructor({
|
|
3344
3353
|
answered,
|
|
@@ -3352,6 +3361,8 @@ class CallSession {
|
|
|
3352
3361
|
paused,
|
|
3353
3362
|
ringing,
|
|
3354
3363
|
startTime,
|
|
3364
|
+
creationTime,
|
|
3365
|
+
endTime,
|
|
3355
3366
|
cameraEnabled,
|
|
3356
3367
|
dialedExtension,
|
|
3357
3368
|
sipCallId,
|
|
@@ -3364,12 +3375,15 @@ class CallSession {
|
|
|
3364
3375
|
recording,
|
|
3365
3376
|
recordingPaused,
|
|
3366
3377
|
videoRemotelyDowngraded,
|
|
3378
|
+
sipSession,
|
|
3367
3379
|
} ) {
|
|
3368
3380
|
this.callId = callId;
|
|
3369
3381
|
this.sipCallId = sipCallId;
|
|
3370
3382
|
this.displayName = displayName;
|
|
3371
3383
|
this.number = number;
|
|
3384
|
+
this.creationTime = creationTime;
|
|
3372
3385
|
this.startTime = startTime;
|
|
3386
|
+
this.endTime = endTime;
|
|
3373
3387
|
this.isCaller = isCaller;
|
|
3374
3388
|
this.answered = answered;
|
|
3375
3389
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3388,6 +3402,7 @@ class CallSession {
|
|
|
3388
3402
|
this.recording = recording || false;
|
|
3389
3403
|
this.recordingPaused = recordingPaused || false;
|
|
3390
3404
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3405
|
+
this.sipSession = sipSession;
|
|
3391
3406
|
|
|
3392
3407
|
// Useful to compare instead of instanceof with minified code
|
|
3393
3408
|
this.type = 'CallSession';
|
|
@@ -8733,6 +8748,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8733
8748
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8734
8749
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8735
8750
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8751
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8736
8752
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8737
8753
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8738
8754
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8777,6 +8793,7 @@ const events = [
|
|
|
8777
8793
|
ON_CAMERA_DISABLED,
|
|
8778
8794
|
ON_CALL_FAILED,
|
|
8779
8795
|
ON_CALL_ENDED,
|
|
8796
|
+
ON_CALL_REJECTED,
|
|
8780
8797
|
ON_MESSAGE,
|
|
8781
8798
|
ON_REINVITE,
|
|
8782
8799
|
ON_TRACK,
|
|
@@ -9133,6 +9150,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9133
9150
|
|
|
9134
9151
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9135
9152
|
const callSession = this._createCallSession(sipSession);
|
|
9153
|
+
callSession.endTime = new Date();
|
|
9136
9154
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9137
9155
|
|
|
9138
9156
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9852,6 +9870,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9852
9870
|
return Promise.resolve(null);
|
|
9853
9871
|
}
|
|
9854
9872
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9873
|
+
callSession.creationTime = new Date();
|
|
9855
9874
|
|
|
9856
9875
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9857
9876
|
|
|
@@ -10130,6 +10149,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10130
10149
|
callSession);
|
|
10131
10150
|
}
|
|
10132
10151
|
|
|
10152
|
+
callSession.creationTime = new Date();
|
|
10133
10153
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10134
10154
|
});
|
|
10135
10155
|
|
|
@@ -10169,6 +10189,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10169
10189
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10170
10190
|
});
|
|
10171
10191
|
|
|
10192
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10193
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10194
|
+
const callSession = this._createCallSession(session);
|
|
10195
|
+
callSession.endTime = new Date();
|
|
10196
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10197
|
+
});
|
|
10198
|
+
|
|
10172
10199
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10173
10200
|
logger$7.info('WebRTC unregistered');
|
|
10174
10201
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10381,6 +10408,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10381
10408
|
const number = identity ? identity.uri._normal.user : null;
|
|
10382
10409
|
const { state } = sipSession || {};
|
|
10383
10410
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10411
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10384
10412
|
|
|
10385
10413
|
const callSession = new CallSession({
|
|
10386
10414
|
callId: fromSession && fromSession.callId,
|
|
@@ -10388,6 +10416,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10388
10416
|
sipStatus: state,
|
|
10389
10417
|
displayName: identity ? identity.displayName || number : number,
|
|
10390
10418
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10419
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10420
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10391
10421
|
answered: state === sessionState.SessionState.Established,
|
|
10392
10422
|
paused: this.client.isCallHeld(sipSession),
|
|
10393
10423
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10398,6 +10428,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10398
10428
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10399
10429
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10400
10430
|
recordingPaused: false, // @TODO
|
|
10431
|
+
sipSession,
|
|
10401
10432
|
...extra,
|
|
10402
10433
|
});
|
|
10403
10434
|
|
|
@@ -10426,6 +10457,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10426
10457
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10427
10458
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10428
10459
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10460
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10429
10461
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10430
10462
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10431
10463
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -10455,6 +10487,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10455
10487
|
'default': WebRTCPhone
|
|
10456
10488
|
});
|
|
10457
10489
|
|
|
10490
|
+
/* */
|
|
10491
|
+
class SFUNotAvailableError extends Error {
|
|
10492
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10493
|
+
super(message);
|
|
10494
|
+
this.name = 'SFUNotAvailableError';
|
|
10495
|
+
}
|
|
10496
|
+
}
|
|
10497
|
+
|
|
10458
10498
|
//
|
|
10459
10499
|
|
|
10460
10500
|
const logger$6 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10839,7 +10879,7 @@ class Phone extends Emitter {
|
|
|
10839
10879
|
|
|
10840
10880
|
checkSfu() {
|
|
10841
10881
|
if (!this.hasSfu()) {
|
|
10842
|
-
throw new
|
|
10882
|
+
throw new SFUNotAvailableError();
|
|
10843
10883
|
}
|
|
10844
10884
|
}
|
|
10845
10885
|
|
|
@@ -13752,6 +13792,7 @@ const Wazo = {
|
|
|
13752
13792
|
InvalidSubscription,
|
|
13753
13793
|
InvalidAuthorization,
|
|
13754
13794
|
CanceledCallError,
|
|
13795
|
+
SFUNotAvailableError,
|
|
13755
13796
|
};
|
|
13756
13797
|
|
|
13757
13798
|
if (window) {
|
|
@@ -3289,8 +3289,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3289
3289
|
|
|
3290
3290
|
|
|
3291
3291
|
|
|
3292
|
+
|
|
3292
3293
|
|
|
3293
3294
|
|
|
3295
|
+
|
|
3294
3296
|
|
|
3295
3297
|
|
|
3296
3298
|
|
|
@@ -3307,6 +3309,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3307
3309
|
|
|
3308
3310
|
|
|
3309
3311
|
|
|
3312
|
+
|
|
3310
3313
|
|
|
3311
3314
|
|
|
3312
3315
|
class CallSession {
|
|
@@ -3326,8 +3329,12 @@ class CallSession {
|
|
|
3326
3329
|
|
|
3327
3330
|
|
|
3328
3331
|
|
|
3332
|
+
|
|
3333
|
+
|
|
3329
3334
|
|
|
3330
3335
|
|
|
3336
|
+
|
|
3337
|
+
|
|
3331
3338
|
|
|
3332
3339
|
|
|
3333
3340
|
|
|
@@ -3365,6 +3372,8 @@ class CallSession {
|
|
|
3365
3372
|
|
|
3366
3373
|
|
|
3367
3374
|
|
|
3375
|
+
|
|
3376
|
+
|
|
3368
3377
|
|
|
3369
3378
|
constructor({
|
|
3370
3379
|
answered,
|
|
@@ -3378,6 +3387,8 @@ class CallSession {
|
|
|
3378
3387
|
paused,
|
|
3379
3388
|
ringing,
|
|
3380
3389
|
startTime,
|
|
3390
|
+
creationTime,
|
|
3391
|
+
endTime,
|
|
3381
3392
|
cameraEnabled,
|
|
3382
3393
|
dialedExtension,
|
|
3383
3394
|
sipCallId,
|
|
@@ -3390,12 +3401,15 @@ class CallSession {
|
|
|
3390
3401
|
recording,
|
|
3391
3402
|
recordingPaused,
|
|
3392
3403
|
videoRemotelyDowngraded,
|
|
3404
|
+
sipSession,
|
|
3393
3405
|
} ) {
|
|
3394
3406
|
this.callId = callId;
|
|
3395
3407
|
this.sipCallId = sipCallId;
|
|
3396
3408
|
this.displayName = displayName;
|
|
3397
3409
|
this.number = number;
|
|
3410
|
+
this.creationTime = creationTime;
|
|
3398
3411
|
this.startTime = startTime;
|
|
3412
|
+
this.endTime = endTime;
|
|
3399
3413
|
this.isCaller = isCaller;
|
|
3400
3414
|
this.answered = answered;
|
|
3401
3415
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3414,6 +3428,7 @@ class CallSession {
|
|
|
3414
3428
|
this.recording = recording || false;
|
|
3415
3429
|
this.recordingPaused = recordingPaused || false;
|
|
3416
3430
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3431
|
+
this.sipSession = sipSession;
|
|
3417
3432
|
|
|
3418
3433
|
// Useful to compare instead of instanceof with minified code
|
|
3419
3434
|
this.type = 'CallSession';
|
|
@@ -8733,6 +8748,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8733
8748
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8734
8749
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8735
8750
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8751
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8736
8752
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8737
8753
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8738
8754
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8777,6 +8793,7 @@ const events = [
|
|
|
8777
8793
|
ON_CAMERA_DISABLED,
|
|
8778
8794
|
ON_CALL_FAILED,
|
|
8779
8795
|
ON_CALL_ENDED,
|
|
8796
|
+
ON_CALL_REJECTED,
|
|
8780
8797
|
ON_MESSAGE,
|
|
8781
8798
|
ON_REINVITE,
|
|
8782
8799
|
ON_TRACK,
|
|
@@ -9133,6 +9150,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9133
9150
|
|
|
9134
9151
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9135
9152
|
const callSession = this._createCallSession(sipSession);
|
|
9153
|
+
callSession.endTime = new Date();
|
|
9136
9154
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9137
9155
|
|
|
9138
9156
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9852,6 +9870,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9852
9870
|
return Promise.resolve(null);
|
|
9853
9871
|
}
|
|
9854
9872
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9873
|
+
callSession.creationTime = new Date();
|
|
9855
9874
|
|
|
9856
9875
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9857
9876
|
|
|
@@ -10130,6 +10149,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10130
10149
|
callSession);
|
|
10131
10150
|
}
|
|
10132
10151
|
|
|
10152
|
+
callSession.creationTime = new Date();
|
|
10133
10153
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10134
10154
|
});
|
|
10135
10155
|
|
|
@@ -10169,6 +10189,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10169
10189
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10170
10190
|
});
|
|
10171
10191
|
|
|
10192
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10193
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10194
|
+
const callSession = this._createCallSession(session);
|
|
10195
|
+
callSession.endTime = new Date();
|
|
10196
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10197
|
+
});
|
|
10198
|
+
|
|
10172
10199
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10173
10200
|
logger$7.info('WebRTC unregistered');
|
|
10174
10201
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10381,6 +10408,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10381
10408
|
const number = identity ? identity.uri._normal.user : null;
|
|
10382
10409
|
const { state } = sipSession || {};
|
|
10383
10410
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10411
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10384
10412
|
|
|
10385
10413
|
const callSession = new CallSession({
|
|
10386
10414
|
callId: fromSession && fromSession.callId,
|
|
@@ -10388,6 +10416,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10388
10416
|
sipStatus: state,
|
|
10389
10417
|
displayName: identity ? identity.displayName || number : number,
|
|
10390
10418
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10419
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10420
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10391
10421
|
answered: state === sessionState.SessionState.Established,
|
|
10392
10422
|
paused: this.client.isCallHeld(sipSession),
|
|
10393
10423
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10398,6 +10428,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10398
10428
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10399
10429
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10400
10430
|
recordingPaused: false, // @TODO
|
|
10431
|
+
sipSession,
|
|
10401
10432
|
...extra,
|
|
10402
10433
|
});
|
|
10403
10434
|
|
|
@@ -10426,6 +10457,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10426
10457
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10427
10458
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10428
10459
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10460
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10429
10461
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10430
10462
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10431
10463
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -10455,6 +10487,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10455
10487
|
'default': WebRTCPhone
|
|
10456
10488
|
});
|
|
10457
10489
|
|
|
10490
|
+
/* */
|
|
10491
|
+
class SFUNotAvailableError extends Error {
|
|
10492
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10493
|
+
super(message);
|
|
10494
|
+
this.name = 'SFUNotAvailableError';
|
|
10495
|
+
}
|
|
10496
|
+
}
|
|
10497
|
+
|
|
10458
10498
|
//
|
|
10459
10499
|
|
|
10460
10500
|
const logger$6 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10839,7 +10879,7 @@ class Phone extends Emitter {
|
|
|
10839
10879
|
|
|
10840
10880
|
checkSfu() {
|
|
10841
10881
|
if (!this.hasSfu()) {
|
|
10842
|
-
throw new
|
|
10882
|
+
throw new SFUNotAvailableError();
|
|
10843
10883
|
}
|
|
10844
10884
|
}
|
|
10845
10885
|
|
|
@@ -12621,6 +12661,7 @@ const Wazo = {
|
|
|
12621
12661
|
InvalidSubscription,
|
|
12622
12662
|
InvalidAuthorization,
|
|
12623
12663
|
CanceledCallError,
|
|
12664
|
+
SFUNotAvailableError,
|
|
12624
12665
|
};
|
|
12625
12666
|
|
|
12626
12667
|
if (window) {
|