@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/esm/simple/Phone.js
CHANGED
|
@@ -253,8 +253,10 @@ var updateFrom = (instance , from ) => {
|
|
|
253
253
|
|
|
254
254
|
|
|
255
255
|
|
|
256
|
+
|
|
256
257
|
|
|
257
258
|
|
|
259
|
+
|
|
258
260
|
|
|
259
261
|
|
|
260
262
|
|
|
@@ -271,6 +273,7 @@ var updateFrom = (instance , from ) => {
|
|
|
271
273
|
|
|
272
274
|
|
|
273
275
|
|
|
276
|
+
|
|
274
277
|
|
|
275
278
|
|
|
276
279
|
class CallSession {
|
|
@@ -290,8 +293,12 @@ class CallSession {
|
|
|
290
293
|
|
|
291
294
|
|
|
292
295
|
|
|
296
|
+
|
|
297
|
+
|
|
293
298
|
|
|
294
299
|
|
|
300
|
+
|
|
301
|
+
|
|
295
302
|
|
|
296
303
|
|
|
297
304
|
|
|
@@ -329,6 +336,8 @@ class CallSession {
|
|
|
329
336
|
|
|
330
337
|
|
|
331
338
|
|
|
339
|
+
|
|
340
|
+
|
|
332
341
|
|
|
333
342
|
constructor({
|
|
334
343
|
answered,
|
|
@@ -342,6 +351,8 @@ class CallSession {
|
|
|
342
351
|
paused,
|
|
343
352
|
ringing,
|
|
344
353
|
startTime,
|
|
354
|
+
creationTime,
|
|
355
|
+
endTime,
|
|
345
356
|
cameraEnabled,
|
|
346
357
|
dialedExtension,
|
|
347
358
|
sipCallId,
|
|
@@ -354,12 +365,15 @@ class CallSession {
|
|
|
354
365
|
recording,
|
|
355
366
|
recordingPaused,
|
|
356
367
|
videoRemotelyDowngraded,
|
|
368
|
+
sipSession,
|
|
357
369
|
} ) {
|
|
358
370
|
this.callId = callId;
|
|
359
371
|
this.sipCallId = sipCallId;
|
|
360
372
|
this.displayName = displayName;
|
|
361
373
|
this.number = number;
|
|
374
|
+
this.creationTime = creationTime;
|
|
362
375
|
this.startTime = startTime;
|
|
376
|
+
this.endTime = endTime;
|
|
363
377
|
this.isCaller = isCaller;
|
|
364
378
|
this.answered = answered;
|
|
365
379
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -378,6 +392,7 @@ class CallSession {
|
|
|
378
392
|
this.recording = recording || false;
|
|
379
393
|
this.recordingPaused = recordingPaused || false;
|
|
380
394
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
395
|
+
this.sipSession = sipSession;
|
|
381
396
|
|
|
382
397
|
// Useful to compare instead of instanceof with minified code
|
|
383
398
|
this.type = 'CallSession';
|
|
@@ -8459,6 +8474,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8459
8474
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8460
8475
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8461
8476
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8477
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8462
8478
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8463
8479
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8464
8480
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8503,6 +8519,7 @@ const events = [
|
|
|
8503
8519
|
ON_CAMERA_DISABLED,
|
|
8504
8520
|
ON_CALL_FAILED,
|
|
8505
8521
|
ON_CALL_ENDED,
|
|
8522
|
+
ON_CALL_REJECTED,
|
|
8506
8523
|
ON_MESSAGE,
|
|
8507
8524
|
ON_REINVITE,
|
|
8508
8525
|
ON_TRACK,
|
|
@@ -8859,6 +8876,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8859
8876
|
|
|
8860
8877
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8861
8878
|
const callSession = this._createCallSession(sipSession);
|
|
8879
|
+
callSession.endTime = new Date();
|
|
8862
8880
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8863
8881
|
|
|
8864
8882
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9578,6 +9596,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9578
9596
|
return Promise.resolve(null);
|
|
9579
9597
|
}
|
|
9580
9598
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9599
|
+
callSession.creationTime = new Date();
|
|
9581
9600
|
|
|
9582
9601
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9583
9602
|
|
|
@@ -9856,6 +9875,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9856
9875
|
callSession);
|
|
9857
9876
|
}
|
|
9858
9877
|
|
|
9878
|
+
callSession.creationTime = new Date();
|
|
9859
9879
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
9860
9880
|
});
|
|
9861
9881
|
|
|
@@ -9895,6 +9915,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9895
9915
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9896
9916
|
});
|
|
9897
9917
|
|
|
9918
|
+
this.client.on(this.client.REJECTED, session => {
|
|
9919
|
+
logger$8.info('WebRTC call rejected', session.id);
|
|
9920
|
+
const callSession = this._createCallSession(session);
|
|
9921
|
+
callSession.endTime = new Date();
|
|
9922
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
9923
|
+
});
|
|
9924
|
+
|
|
9898
9925
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9899
9926
|
logger$8.info('WebRTC unregistered');
|
|
9900
9927
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10107,6 +10134,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10107
10134
|
const number = identity ? identity.uri._normal.user : null;
|
|
10108
10135
|
const { state } = sipSession || {};
|
|
10109
10136
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10137
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10110
10138
|
|
|
10111
10139
|
const callSession = new CallSession({
|
|
10112
10140
|
callId: fromSession && fromSession.callId,
|
|
@@ -10114,6 +10142,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10114
10142
|
sipStatus: state,
|
|
10115
10143
|
displayName: identity ? identity.displayName || number : number,
|
|
10116
10144
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10145
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10146
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10117
10147
|
answered: state === SessionState.Established,
|
|
10118
10148
|
paused: this.client.isCallHeld(sipSession),
|
|
10119
10149
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10124,6 +10154,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10124
10154
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10125
10155
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10126
10156
|
recordingPaused: false, // @TODO
|
|
10157
|
+
sipSession,
|
|
10127
10158
|
...extra,
|
|
10128
10159
|
});
|
|
10129
10160
|
|
|
@@ -10152,6 +10183,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10152
10183
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10153
10184
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10154
10185
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10186
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10155
10187
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10156
10188
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10157
10189
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -12431,6 +12463,14 @@ const createLocalVideoStream = async (options ) => createLocalStream('vid
|
|
|
12431
12463
|
|
|
12432
12464
|
const createLocalAudioStream = async (options ) => createLocalStream('audio', options);
|
|
12433
12465
|
|
|
12466
|
+
/* */
|
|
12467
|
+
class SFUNotAvailableError extends Error {
|
|
12468
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
12469
|
+
super(message);
|
|
12470
|
+
this.name = 'SFUNotAvailableError';
|
|
12471
|
+
}
|
|
12472
|
+
}
|
|
12473
|
+
|
|
12434
12474
|
//
|
|
12435
12475
|
|
|
12436
12476
|
|
|
@@ -13332,6 +13372,7 @@ const Wazo = {
|
|
|
13332
13372
|
InvalidSubscription,
|
|
13333
13373
|
InvalidAuthorization,
|
|
13334
13374
|
CanceledCallError,
|
|
13375
|
+
SFUNotAvailableError,
|
|
13335
13376
|
};
|
|
13336
13377
|
|
|
13337
13378
|
if (window) {
|
|
@@ -13725,7 +13766,7 @@ class Phone extends Emitter {
|
|
|
13725
13766
|
|
|
13726
13767
|
checkSfu() {
|
|
13727
13768
|
if (!this.hasSfu()) {
|
|
13728
|
-
throw new
|
|
13769
|
+
throw new SFUNotAvailableError();
|
|
13729
13770
|
}
|
|
13730
13771
|
}
|
|
13731
13772
|
|
package/esm/simple/index.js
CHANGED
|
@@ -3253,8 +3253,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3253
3253
|
|
|
3254
3254
|
|
|
3255
3255
|
|
|
3256
|
+
|
|
3256
3257
|
|
|
3257
3258
|
|
|
3259
|
+
|
|
3258
3260
|
|
|
3259
3261
|
|
|
3260
3262
|
|
|
@@ -3271,6 +3273,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3271
3273
|
|
|
3272
3274
|
|
|
3273
3275
|
|
|
3276
|
+
|
|
3274
3277
|
|
|
3275
3278
|
|
|
3276
3279
|
class CallSession {
|
|
@@ -3290,8 +3293,12 @@ class CallSession {
|
|
|
3290
3293
|
|
|
3291
3294
|
|
|
3292
3295
|
|
|
3296
|
+
|
|
3297
|
+
|
|
3293
3298
|
|
|
3294
3299
|
|
|
3300
|
+
|
|
3301
|
+
|
|
3295
3302
|
|
|
3296
3303
|
|
|
3297
3304
|
|
|
@@ -3329,6 +3336,8 @@ class CallSession {
|
|
|
3329
3336
|
|
|
3330
3337
|
|
|
3331
3338
|
|
|
3339
|
+
|
|
3340
|
+
|
|
3332
3341
|
|
|
3333
3342
|
constructor({
|
|
3334
3343
|
answered,
|
|
@@ -3342,6 +3351,8 @@ class CallSession {
|
|
|
3342
3351
|
paused,
|
|
3343
3352
|
ringing,
|
|
3344
3353
|
startTime,
|
|
3354
|
+
creationTime,
|
|
3355
|
+
endTime,
|
|
3345
3356
|
cameraEnabled,
|
|
3346
3357
|
dialedExtension,
|
|
3347
3358
|
sipCallId,
|
|
@@ -3354,12 +3365,15 @@ class CallSession {
|
|
|
3354
3365
|
recording,
|
|
3355
3366
|
recordingPaused,
|
|
3356
3367
|
videoRemotelyDowngraded,
|
|
3368
|
+
sipSession,
|
|
3357
3369
|
} ) {
|
|
3358
3370
|
this.callId = callId;
|
|
3359
3371
|
this.sipCallId = sipCallId;
|
|
3360
3372
|
this.displayName = displayName;
|
|
3361
3373
|
this.number = number;
|
|
3374
|
+
this.creationTime = creationTime;
|
|
3362
3375
|
this.startTime = startTime;
|
|
3376
|
+
this.endTime = endTime;
|
|
3363
3377
|
this.isCaller = isCaller;
|
|
3364
3378
|
this.answered = answered;
|
|
3365
3379
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3378,6 +3392,7 @@ class CallSession {
|
|
|
3378
3392
|
this.recording = recording || false;
|
|
3379
3393
|
this.recordingPaused = recordingPaused || false;
|
|
3380
3394
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3395
|
+
this.sipSession = sipSession;
|
|
3381
3396
|
|
|
3382
3397
|
// Useful to compare instead of instanceof with minified code
|
|
3383
3398
|
this.type = 'CallSession';
|
|
@@ -8723,6 +8738,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8723
8738
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8724
8739
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8725
8740
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8741
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8726
8742
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8727
8743
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8728
8744
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8767,6 +8783,7 @@ const events = [
|
|
|
8767
8783
|
ON_CAMERA_DISABLED,
|
|
8768
8784
|
ON_CALL_FAILED,
|
|
8769
8785
|
ON_CALL_ENDED,
|
|
8786
|
+
ON_CALL_REJECTED,
|
|
8770
8787
|
ON_MESSAGE,
|
|
8771
8788
|
ON_REINVITE,
|
|
8772
8789
|
ON_TRACK,
|
|
@@ -9123,6 +9140,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9123
9140
|
|
|
9124
9141
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9125
9142
|
const callSession = this._createCallSession(sipSession);
|
|
9143
|
+
callSession.endTime = new Date();
|
|
9126
9144
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9127
9145
|
|
|
9128
9146
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9842,6 +9860,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9842
9860
|
return Promise.resolve(null);
|
|
9843
9861
|
}
|
|
9844
9862
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9863
|
+
callSession.creationTime = new Date();
|
|
9845
9864
|
|
|
9846
9865
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9847
9866
|
|
|
@@ -10120,6 +10139,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10120
10139
|
callSession);
|
|
10121
10140
|
}
|
|
10122
10141
|
|
|
10142
|
+
callSession.creationTime = new Date();
|
|
10123
10143
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10124
10144
|
});
|
|
10125
10145
|
|
|
@@ -10159,6 +10179,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10159
10179
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10160
10180
|
});
|
|
10161
10181
|
|
|
10182
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10183
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10184
|
+
const callSession = this._createCallSession(session);
|
|
10185
|
+
callSession.endTime = new Date();
|
|
10186
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10187
|
+
});
|
|
10188
|
+
|
|
10162
10189
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10163
10190
|
logger$7.info('WebRTC unregistered');
|
|
10164
10191
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10371,6 +10398,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10371
10398
|
const number = identity ? identity.uri._normal.user : null;
|
|
10372
10399
|
const { state } = sipSession || {};
|
|
10373
10400
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10401
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10374
10402
|
|
|
10375
10403
|
const callSession = new CallSession({
|
|
10376
10404
|
callId: fromSession && fromSession.callId,
|
|
@@ -10378,6 +10406,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10378
10406
|
sipStatus: state,
|
|
10379
10407
|
displayName: identity ? identity.displayName || number : number,
|
|
10380
10408
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10409
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10410
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10381
10411
|
answered: state === SessionState.Established,
|
|
10382
10412
|
paused: this.client.isCallHeld(sipSession),
|
|
10383
10413
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10388,6 +10418,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10388
10418
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10389
10419
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10390
10420
|
recordingPaused: false, // @TODO
|
|
10421
|
+
sipSession,
|
|
10391
10422
|
...extra,
|
|
10392
10423
|
});
|
|
10393
10424
|
|
|
@@ -10416,6 +10447,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10416
10447
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10417
10448
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10418
10449
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10450
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10419
10451
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10420
10452
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10421
10453
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -10445,6 +10477,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10445
10477
|
'default': WebRTCPhone
|
|
10446
10478
|
});
|
|
10447
10479
|
|
|
10480
|
+
/* */
|
|
10481
|
+
class SFUNotAvailableError extends Error {
|
|
10482
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10483
|
+
super(message);
|
|
10484
|
+
this.name = 'SFUNotAvailableError';
|
|
10485
|
+
}
|
|
10486
|
+
}
|
|
10487
|
+
|
|
10448
10488
|
//
|
|
10449
10489
|
|
|
10450
10490
|
const logger$6 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10829,7 +10869,7 @@ class Phone extends Emitter {
|
|
|
10829
10869
|
|
|
10830
10870
|
checkSfu() {
|
|
10831
10871
|
if (!this.hasSfu()) {
|
|
10832
|
-
throw new
|
|
10872
|
+
throw new SFUNotAvailableError();
|
|
10833
10873
|
}
|
|
10834
10874
|
}
|
|
10835
10875
|
|
|
@@ -13742,6 +13782,7 @@ const Wazo = {
|
|
|
13742
13782
|
InvalidSubscription,
|
|
13743
13783
|
InvalidAuthorization,
|
|
13744
13784
|
CanceledCallError,
|
|
13785
|
+
SFUNotAvailableError,
|
|
13745
13786
|
};
|
|
13746
13787
|
|
|
13747
13788
|
if (window) {
|
|
@@ -3279,8 +3279,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3279
3279
|
|
|
3280
3280
|
|
|
3281
3281
|
|
|
3282
|
+
|
|
3282
3283
|
|
|
3283
3284
|
|
|
3285
|
+
|
|
3284
3286
|
|
|
3285
3287
|
|
|
3286
3288
|
|
|
@@ -3297,6 +3299,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3297
3299
|
|
|
3298
3300
|
|
|
3299
3301
|
|
|
3302
|
+
|
|
3300
3303
|
|
|
3301
3304
|
|
|
3302
3305
|
class CallSession {
|
|
@@ -3316,8 +3319,12 @@ class CallSession {
|
|
|
3316
3319
|
|
|
3317
3320
|
|
|
3318
3321
|
|
|
3322
|
+
|
|
3323
|
+
|
|
3319
3324
|
|
|
3320
3325
|
|
|
3326
|
+
|
|
3327
|
+
|
|
3321
3328
|
|
|
3322
3329
|
|
|
3323
3330
|
|
|
@@ -3355,6 +3362,8 @@ class CallSession {
|
|
|
3355
3362
|
|
|
3356
3363
|
|
|
3357
3364
|
|
|
3365
|
+
|
|
3366
|
+
|
|
3358
3367
|
|
|
3359
3368
|
constructor({
|
|
3360
3369
|
answered,
|
|
@@ -3368,6 +3377,8 @@ class CallSession {
|
|
|
3368
3377
|
paused,
|
|
3369
3378
|
ringing,
|
|
3370
3379
|
startTime,
|
|
3380
|
+
creationTime,
|
|
3381
|
+
endTime,
|
|
3371
3382
|
cameraEnabled,
|
|
3372
3383
|
dialedExtension,
|
|
3373
3384
|
sipCallId,
|
|
@@ -3380,12 +3391,15 @@ class CallSession {
|
|
|
3380
3391
|
recording,
|
|
3381
3392
|
recordingPaused,
|
|
3382
3393
|
videoRemotelyDowngraded,
|
|
3394
|
+
sipSession,
|
|
3383
3395
|
} ) {
|
|
3384
3396
|
this.callId = callId;
|
|
3385
3397
|
this.sipCallId = sipCallId;
|
|
3386
3398
|
this.displayName = displayName;
|
|
3387
3399
|
this.number = number;
|
|
3400
|
+
this.creationTime = creationTime;
|
|
3388
3401
|
this.startTime = startTime;
|
|
3402
|
+
this.endTime = endTime;
|
|
3389
3403
|
this.isCaller = isCaller;
|
|
3390
3404
|
this.answered = answered;
|
|
3391
3405
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3404,6 +3418,7 @@ class CallSession {
|
|
|
3404
3418
|
this.recording = recording || false;
|
|
3405
3419
|
this.recordingPaused = recordingPaused || false;
|
|
3406
3420
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3421
|
+
this.sipSession = sipSession;
|
|
3407
3422
|
|
|
3408
3423
|
// Useful to compare instead of instanceof with minified code
|
|
3409
3424
|
this.type = 'CallSession';
|
|
@@ -8723,6 +8738,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8723
8738
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8724
8739
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8725
8740
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8741
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8726
8742
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8727
8743
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8728
8744
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8767,6 +8783,7 @@ const events = [
|
|
|
8767
8783
|
ON_CAMERA_DISABLED,
|
|
8768
8784
|
ON_CALL_FAILED,
|
|
8769
8785
|
ON_CALL_ENDED,
|
|
8786
|
+
ON_CALL_REJECTED,
|
|
8770
8787
|
ON_MESSAGE,
|
|
8771
8788
|
ON_REINVITE,
|
|
8772
8789
|
ON_TRACK,
|
|
@@ -9123,6 +9140,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9123
9140
|
|
|
9124
9141
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9125
9142
|
const callSession = this._createCallSession(sipSession);
|
|
9143
|
+
callSession.endTime = new Date();
|
|
9126
9144
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9127
9145
|
|
|
9128
9146
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9842,6 +9860,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9842
9860
|
return Promise.resolve(null);
|
|
9843
9861
|
}
|
|
9844
9862
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9863
|
+
callSession.creationTime = new Date();
|
|
9845
9864
|
|
|
9846
9865
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9847
9866
|
|
|
@@ -10120,6 +10139,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10120
10139
|
callSession);
|
|
10121
10140
|
}
|
|
10122
10141
|
|
|
10142
|
+
callSession.creationTime = new Date();
|
|
10123
10143
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10124
10144
|
});
|
|
10125
10145
|
|
|
@@ -10159,6 +10179,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10159
10179
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10160
10180
|
});
|
|
10161
10181
|
|
|
10182
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10183
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10184
|
+
const callSession = this._createCallSession(session);
|
|
10185
|
+
callSession.endTime = new Date();
|
|
10186
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10187
|
+
});
|
|
10188
|
+
|
|
10162
10189
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10163
10190
|
logger$7.info('WebRTC unregistered');
|
|
10164
10191
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10371,6 +10398,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10371
10398
|
const number = identity ? identity.uri._normal.user : null;
|
|
10372
10399
|
const { state } = sipSession || {};
|
|
10373
10400
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10401
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10374
10402
|
|
|
10375
10403
|
const callSession = new CallSession({
|
|
10376
10404
|
callId: fromSession && fromSession.callId,
|
|
@@ -10378,6 +10406,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10378
10406
|
sipStatus: state,
|
|
10379
10407
|
displayName: identity ? identity.displayName || number : number,
|
|
10380
10408
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10409
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10410
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10381
10411
|
answered: state === SessionState.Established,
|
|
10382
10412
|
paused: this.client.isCallHeld(sipSession),
|
|
10383
10413
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10388,6 +10418,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10388
10418
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10389
10419
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10390
10420
|
recordingPaused: false, // @TODO
|
|
10421
|
+
sipSession,
|
|
10391
10422
|
...extra,
|
|
10392
10423
|
});
|
|
10393
10424
|
|
|
@@ -10416,6 +10447,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10416
10447
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10417
10448
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10418
10449
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10450
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10419
10451
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10420
10452
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10421
10453
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -10445,6 +10477,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10445
10477
|
'default': WebRTCPhone
|
|
10446
10478
|
});
|
|
10447
10479
|
|
|
10480
|
+
/* */
|
|
10481
|
+
class SFUNotAvailableError extends Error {
|
|
10482
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10483
|
+
super(message);
|
|
10484
|
+
this.name = 'SFUNotAvailableError';
|
|
10485
|
+
}
|
|
10486
|
+
}
|
|
10487
|
+
|
|
10448
10488
|
//
|
|
10449
10489
|
|
|
10450
10490
|
const logger$6 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10829,7 +10869,7 @@ class Phone extends Emitter {
|
|
|
10829
10869
|
|
|
10830
10870
|
checkSfu() {
|
|
10831
10871
|
if (!this.hasSfu()) {
|
|
10832
|
-
throw new
|
|
10872
|
+
throw new SFUNotAvailableError();
|
|
10833
10873
|
}
|
|
10834
10874
|
}
|
|
10835
10875
|
|
|
@@ -12611,6 +12651,7 @@ const Wazo = {
|
|
|
12611
12651
|
InvalidSubscription,
|
|
12612
12652
|
InvalidAuthorization,
|
|
12613
12653
|
CanceledCallError,
|
|
12654
|
+
SFUNotAvailableError,
|
|
12614
12655
|
};
|
|
12615
12656
|
|
|
12616
12657
|
if (window) {
|