@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
|
@@ -39,8 +39,10 @@ var updateFrom = (instance , from ) => {
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
+
|
|
42
43
|
|
|
43
44
|
|
|
45
|
+
|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
|
|
@@ -57,6 +59,7 @@ var updateFrom = (instance , from ) => {
|
|
|
57
59
|
|
|
58
60
|
|
|
59
61
|
|
|
62
|
+
|
|
60
63
|
|
|
61
64
|
|
|
62
65
|
class CallSession {
|
|
@@ -76,8 +79,12 @@ class CallSession {
|
|
|
76
79
|
|
|
77
80
|
|
|
78
81
|
|
|
82
|
+
|
|
83
|
+
|
|
79
84
|
|
|
80
85
|
|
|
86
|
+
|
|
87
|
+
|
|
81
88
|
|
|
82
89
|
|
|
83
90
|
|
|
@@ -115,6 +122,8 @@ class CallSession {
|
|
|
115
122
|
|
|
116
123
|
|
|
117
124
|
|
|
125
|
+
|
|
126
|
+
|
|
118
127
|
|
|
119
128
|
constructor({
|
|
120
129
|
answered,
|
|
@@ -128,6 +137,8 @@ class CallSession {
|
|
|
128
137
|
paused,
|
|
129
138
|
ringing,
|
|
130
139
|
startTime,
|
|
140
|
+
creationTime,
|
|
141
|
+
endTime,
|
|
131
142
|
cameraEnabled,
|
|
132
143
|
dialedExtension,
|
|
133
144
|
sipCallId,
|
|
@@ -140,12 +151,15 @@ class CallSession {
|
|
|
140
151
|
recording,
|
|
141
152
|
recordingPaused,
|
|
142
153
|
videoRemotelyDowngraded,
|
|
154
|
+
sipSession,
|
|
143
155
|
} ) {
|
|
144
156
|
this.callId = callId;
|
|
145
157
|
this.sipCallId = sipCallId;
|
|
146
158
|
this.displayName = displayName;
|
|
147
159
|
this.number = number;
|
|
160
|
+
this.creationTime = creationTime;
|
|
148
161
|
this.startTime = startTime;
|
|
162
|
+
this.endTime = endTime;
|
|
149
163
|
this.isCaller = isCaller;
|
|
150
164
|
this.answered = answered;
|
|
151
165
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -164,6 +178,7 @@ class CallSession {
|
|
|
164
178
|
this.recording = recording || false;
|
|
165
179
|
this.recordingPaused = recordingPaused || false;
|
|
166
180
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
181
|
+
this.sipSession = sipSession;
|
|
167
182
|
|
|
168
183
|
// Useful to compare instead of instanceof with minified code
|
|
169
184
|
this.type = 'CallSession';
|
package/lib/index.js
CHANGED
|
@@ -3265,8 +3265,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3265
3265
|
|
|
3266
3266
|
|
|
3267
3267
|
|
|
3268
|
+
|
|
3268
3269
|
|
|
3269
3270
|
|
|
3271
|
+
|
|
3270
3272
|
|
|
3271
3273
|
|
|
3272
3274
|
|
|
@@ -3283,6 +3285,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3283
3285
|
|
|
3284
3286
|
|
|
3285
3287
|
|
|
3288
|
+
|
|
3286
3289
|
|
|
3287
3290
|
|
|
3288
3291
|
class CallSession {
|
|
@@ -3302,8 +3305,12 @@ class CallSession {
|
|
|
3302
3305
|
|
|
3303
3306
|
|
|
3304
3307
|
|
|
3308
|
+
|
|
3309
|
+
|
|
3305
3310
|
|
|
3306
3311
|
|
|
3312
|
+
|
|
3313
|
+
|
|
3307
3314
|
|
|
3308
3315
|
|
|
3309
3316
|
|
|
@@ -3341,6 +3348,8 @@ class CallSession {
|
|
|
3341
3348
|
|
|
3342
3349
|
|
|
3343
3350
|
|
|
3351
|
+
|
|
3352
|
+
|
|
3344
3353
|
|
|
3345
3354
|
constructor({
|
|
3346
3355
|
answered,
|
|
@@ -3354,6 +3363,8 @@ class CallSession {
|
|
|
3354
3363
|
paused,
|
|
3355
3364
|
ringing,
|
|
3356
3365
|
startTime,
|
|
3366
|
+
creationTime,
|
|
3367
|
+
endTime,
|
|
3357
3368
|
cameraEnabled,
|
|
3358
3369
|
dialedExtension,
|
|
3359
3370
|
sipCallId,
|
|
@@ -3366,12 +3377,15 @@ class CallSession {
|
|
|
3366
3377
|
recording,
|
|
3367
3378
|
recordingPaused,
|
|
3368
3379
|
videoRemotelyDowngraded,
|
|
3380
|
+
sipSession,
|
|
3369
3381
|
} ) {
|
|
3370
3382
|
this.callId = callId;
|
|
3371
3383
|
this.sipCallId = sipCallId;
|
|
3372
3384
|
this.displayName = displayName;
|
|
3373
3385
|
this.number = number;
|
|
3386
|
+
this.creationTime = creationTime;
|
|
3374
3387
|
this.startTime = startTime;
|
|
3388
|
+
this.endTime = endTime;
|
|
3375
3389
|
this.isCaller = isCaller;
|
|
3376
3390
|
this.answered = answered;
|
|
3377
3391
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3390,6 +3404,7 @@ class CallSession {
|
|
|
3390
3404
|
this.recording = recording || false;
|
|
3391
3405
|
this.recordingPaused = recordingPaused || false;
|
|
3392
3406
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3407
|
+
this.sipSession = sipSession;
|
|
3393
3408
|
|
|
3394
3409
|
// Useful to compare instead of instanceof with minified code
|
|
3395
3410
|
this.type = 'CallSession';
|
|
@@ -8792,6 +8807,14 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
8792
8807
|
'default': WebSocketClient
|
|
8793
8808
|
});
|
|
8794
8809
|
|
|
8810
|
+
/* */
|
|
8811
|
+
class SFUNotAvailableError extends Error {
|
|
8812
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
8813
|
+
super(message);
|
|
8814
|
+
this.name = 'SFUNotAvailableError';
|
|
8815
|
+
}
|
|
8816
|
+
}
|
|
8817
|
+
|
|
8795
8818
|
var COUNTRIES = {
|
|
8796
8819
|
BELGIUM: 'BE',
|
|
8797
8820
|
CANADA: 'CA',
|
|
@@ -9189,6 +9212,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
9189
9212
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
9190
9213
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
9191
9214
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
9215
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
9192
9216
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
9193
9217
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
9194
9218
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -9233,6 +9257,7 @@ const events = [
|
|
|
9233
9257
|
ON_CAMERA_DISABLED,
|
|
9234
9258
|
ON_CALL_FAILED,
|
|
9235
9259
|
ON_CALL_ENDED,
|
|
9260
|
+
ON_CALL_REJECTED,
|
|
9236
9261
|
ON_MESSAGE,
|
|
9237
9262
|
ON_REINVITE,
|
|
9238
9263
|
ON_TRACK,
|
|
@@ -9589,6 +9614,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9589
9614
|
|
|
9590
9615
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9591
9616
|
const callSession = this._createCallSession(sipSession);
|
|
9617
|
+
callSession.endTime = new Date();
|
|
9592
9618
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9593
9619
|
|
|
9594
9620
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -10308,6 +10334,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10308
10334
|
return Promise.resolve(null);
|
|
10309
10335
|
}
|
|
10310
10336
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
10337
|
+
callSession.creationTime = new Date();
|
|
10311
10338
|
|
|
10312
10339
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
10313
10340
|
|
|
@@ -10586,6 +10613,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10586
10613
|
callSession);
|
|
10587
10614
|
}
|
|
10588
10615
|
|
|
10616
|
+
callSession.creationTime = new Date();
|
|
10589
10617
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10590
10618
|
});
|
|
10591
10619
|
|
|
@@ -10625,6 +10653,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10625
10653
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10626
10654
|
});
|
|
10627
10655
|
|
|
10656
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10657
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10658
|
+
const callSession = this._createCallSession(session);
|
|
10659
|
+
callSession.endTime = new Date();
|
|
10660
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10661
|
+
});
|
|
10662
|
+
|
|
10628
10663
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10629
10664
|
logger$7.info('WebRTC unregistered');
|
|
10630
10665
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10837,6 +10872,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10837
10872
|
const number = identity ? identity.uri._normal.user : null;
|
|
10838
10873
|
const { state } = sipSession || {};
|
|
10839
10874
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10875
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10840
10876
|
|
|
10841
10877
|
const callSession = new CallSession({
|
|
10842
10878
|
callId: fromSession && fromSession.callId,
|
|
@@ -10844,6 +10880,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10844
10880
|
sipStatus: state,
|
|
10845
10881
|
displayName: identity ? identity.displayName || number : number,
|
|
10846
10882
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10883
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10884
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10847
10885
|
answered: state === sessionState.SessionState.Established,
|
|
10848
10886
|
paused: this.client.isCallHeld(sipSession),
|
|
10849
10887
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10854,6 +10892,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10854
10892
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10855
10893
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10856
10894
|
recordingPaused: false, // @TODO
|
|
10895
|
+
sipSession,
|
|
10857
10896
|
...extra,
|
|
10858
10897
|
});
|
|
10859
10898
|
|
|
@@ -10882,6 +10921,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10882
10921
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10883
10922
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10884
10923
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10924
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10885
10925
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10886
10926
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10887
10927
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -12330,7 +12370,7 @@ class Phone extends Emitter {
|
|
|
12330
12370
|
|
|
12331
12371
|
checkSfu() {
|
|
12332
12372
|
if (!this.hasSfu()) {
|
|
12333
|
-
throw new
|
|
12373
|
+
throw new SFUNotAvailableError();
|
|
12334
12374
|
}
|
|
12335
12375
|
}
|
|
12336
12376
|
|
|
@@ -13891,6 +13931,7 @@ const Wazo = {
|
|
|
13891
13931
|
InvalidSubscription,
|
|
13892
13932
|
InvalidAuthorization,
|
|
13893
13933
|
CanceledCallError,
|
|
13934
|
+
SFUNotAvailableError,
|
|
13894
13935
|
};
|
|
13895
13936
|
|
|
13896
13937
|
if (window) {
|
|
@@ -13933,6 +13974,7 @@ var index = {
|
|
|
13933
13974
|
WazoWebSocketClient: WebSocketClient,
|
|
13934
13975
|
BadResponse,
|
|
13935
13976
|
ServerError,
|
|
13977
|
+
SFUNotAvailableError,
|
|
13936
13978
|
Call,
|
|
13937
13979
|
CallSession,
|
|
13938
13980
|
CTIPhone,
|
package/lib/simple/Auth.js
CHANGED
|
@@ -3265,8 +3265,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3265
3265
|
|
|
3266
3266
|
|
|
3267
3267
|
|
|
3268
|
+
|
|
3268
3269
|
|
|
3269
3270
|
|
|
3271
|
+
|
|
3270
3272
|
|
|
3271
3273
|
|
|
3272
3274
|
|
|
@@ -3283,6 +3285,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3283
3285
|
|
|
3284
3286
|
|
|
3285
3287
|
|
|
3288
|
+
|
|
3286
3289
|
|
|
3287
3290
|
|
|
3288
3291
|
class CallSession {
|
|
@@ -3302,8 +3305,12 @@ class CallSession {
|
|
|
3302
3305
|
|
|
3303
3306
|
|
|
3304
3307
|
|
|
3308
|
+
|
|
3309
|
+
|
|
3305
3310
|
|
|
3306
3311
|
|
|
3312
|
+
|
|
3313
|
+
|
|
3307
3314
|
|
|
3308
3315
|
|
|
3309
3316
|
|
|
@@ -3341,6 +3348,8 @@ class CallSession {
|
|
|
3341
3348
|
|
|
3342
3349
|
|
|
3343
3350
|
|
|
3351
|
+
|
|
3352
|
+
|
|
3344
3353
|
|
|
3345
3354
|
constructor({
|
|
3346
3355
|
answered,
|
|
@@ -3354,6 +3363,8 @@ class CallSession {
|
|
|
3354
3363
|
paused,
|
|
3355
3364
|
ringing,
|
|
3356
3365
|
startTime,
|
|
3366
|
+
creationTime,
|
|
3367
|
+
endTime,
|
|
3357
3368
|
cameraEnabled,
|
|
3358
3369
|
dialedExtension,
|
|
3359
3370
|
sipCallId,
|
|
@@ -3366,12 +3377,15 @@ class CallSession {
|
|
|
3366
3377
|
recording,
|
|
3367
3378
|
recordingPaused,
|
|
3368
3379
|
videoRemotelyDowngraded,
|
|
3380
|
+
sipSession,
|
|
3369
3381
|
} ) {
|
|
3370
3382
|
this.callId = callId;
|
|
3371
3383
|
this.sipCallId = sipCallId;
|
|
3372
3384
|
this.displayName = displayName;
|
|
3373
3385
|
this.number = number;
|
|
3386
|
+
this.creationTime = creationTime;
|
|
3374
3387
|
this.startTime = startTime;
|
|
3388
|
+
this.endTime = endTime;
|
|
3375
3389
|
this.isCaller = isCaller;
|
|
3376
3390
|
this.answered = answered;
|
|
3377
3391
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3390,6 +3404,7 @@ class CallSession {
|
|
|
3390
3404
|
this.recording = recording || false;
|
|
3391
3405
|
this.recordingPaused = recordingPaused || false;
|
|
3392
3406
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3407
|
+
this.sipSession = sipSession;
|
|
3393
3408
|
|
|
3394
3409
|
// Useful to compare instead of instanceof with minified code
|
|
3395
3410
|
this.type = 'CallSession';
|
|
@@ -8471,6 +8486,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8471
8486
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8472
8487
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8473
8488
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8489
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8474
8490
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8475
8491
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8476
8492
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8515,6 +8531,7 @@ const events = [
|
|
|
8515
8531
|
ON_CAMERA_DISABLED,
|
|
8516
8532
|
ON_CALL_FAILED,
|
|
8517
8533
|
ON_CALL_ENDED,
|
|
8534
|
+
ON_CALL_REJECTED,
|
|
8518
8535
|
ON_MESSAGE,
|
|
8519
8536
|
ON_REINVITE,
|
|
8520
8537
|
ON_TRACK,
|
|
@@ -8871,6 +8888,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8871
8888
|
|
|
8872
8889
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8873
8890
|
const callSession = this._createCallSession(sipSession);
|
|
8891
|
+
callSession.endTime = new Date();
|
|
8874
8892
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8875
8893
|
|
|
8876
8894
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9590,6 +9608,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9590
9608
|
return Promise.resolve(null);
|
|
9591
9609
|
}
|
|
9592
9610
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9611
|
+
callSession.creationTime = new Date();
|
|
9593
9612
|
|
|
9594
9613
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9595
9614
|
|
|
@@ -9868,6 +9887,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9868
9887
|
callSession);
|
|
9869
9888
|
}
|
|
9870
9889
|
|
|
9890
|
+
callSession.creationTime = new Date();
|
|
9871
9891
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
9872
9892
|
});
|
|
9873
9893
|
|
|
@@ -9907,6 +9927,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9907
9927
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9908
9928
|
});
|
|
9909
9929
|
|
|
9930
|
+
this.client.on(this.client.REJECTED, session => {
|
|
9931
|
+
logger$8.info('WebRTC call rejected', session.id);
|
|
9932
|
+
const callSession = this._createCallSession(session);
|
|
9933
|
+
callSession.endTime = new Date();
|
|
9934
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
9935
|
+
});
|
|
9936
|
+
|
|
9910
9937
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9911
9938
|
logger$8.info('WebRTC unregistered');
|
|
9912
9939
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10119,6 +10146,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10119
10146
|
const number = identity ? identity.uri._normal.user : null;
|
|
10120
10147
|
const { state } = sipSession || {};
|
|
10121
10148
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10149
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10122
10150
|
|
|
10123
10151
|
const callSession = new CallSession({
|
|
10124
10152
|
callId: fromSession && fromSession.callId,
|
|
@@ -10126,6 +10154,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10126
10154
|
sipStatus: state,
|
|
10127
10155
|
displayName: identity ? identity.displayName || number : number,
|
|
10128
10156
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10157
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10158
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10129
10159
|
answered: state === sessionState.SessionState.Established,
|
|
10130
10160
|
paused: this.client.isCallHeld(sipSession),
|
|
10131
10161
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10136,6 +10166,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10136
10166
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10137
10167
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10138
10168
|
recordingPaused: false, // @TODO
|
|
10169
|
+
sipSession,
|
|
10139
10170
|
...extra,
|
|
10140
10171
|
});
|
|
10141
10172
|
|
|
@@ -10164,6 +10195,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10164
10195
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10165
10196
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10166
10197
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10198
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10167
10199
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10168
10200
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10169
10201
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -10193,6 +10225,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10193
10225
|
'default': WebRTCPhone
|
|
10194
10226
|
});
|
|
10195
10227
|
|
|
10228
|
+
/* */
|
|
10229
|
+
class SFUNotAvailableError extends Error {
|
|
10230
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10231
|
+
super(message);
|
|
10232
|
+
this.name = 'SFUNotAvailableError';
|
|
10233
|
+
}
|
|
10234
|
+
}
|
|
10235
|
+
|
|
10196
10236
|
//
|
|
10197
10237
|
|
|
10198
10238
|
const logger$7 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10577,7 +10617,7 @@ class Phone extends Emitter {
|
|
|
10577
10617
|
|
|
10578
10618
|
checkSfu() {
|
|
10579
10619
|
if (!this.hasSfu()) {
|
|
10580
|
-
throw new
|
|
10620
|
+
throw new SFUNotAvailableError();
|
|
10581
10621
|
}
|
|
10582
10622
|
}
|
|
10583
10623
|
|
|
@@ -13490,6 +13530,7 @@ const Wazo = {
|
|
|
13490
13530
|
InvalidSubscription,
|
|
13491
13531
|
InvalidAuthorization,
|
|
13492
13532
|
CanceledCallError,
|
|
13533
|
+
SFUNotAvailableError,
|
|
13493
13534
|
};
|
|
13494
13535
|
|
|
13495
13536
|
if (window) {
|
|
@@ -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';
|
|
@@ -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,
|
|
@@ -10191,6 +10223,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10191
10223
|
'default': WebRTCPhone
|
|
10192
10224
|
});
|
|
10193
10225
|
|
|
10226
|
+
/* */
|
|
10227
|
+
class SFUNotAvailableError extends Error {
|
|
10228
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10229
|
+
super(message);
|
|
10230
|
+
this.name = 'SFUNotAvailableError';
|
|
10231
|
+
}
|
|
10232
|
+
}
|
|
10233
|
+
|
|
10194
10234
|
//
|
|
10195
10235
|
|
|
10196
10236
|
const logger$7 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10575,7 +10615,7 @@ class Phone extends Emitter {
|
|
|
10575
10615
|
|
|
10576
10616
|
checkSfu() {
|
|
10577
10617
|
if (!this.hasSfu()) {
|
|
10578
|
-
throw new
|
|
10618
|
+
throw new SFUNotAvailableError();
|
|
10579
10619
|
}
|
|
10580
10620
|
}
|
|
10581
10621
|
|
|
@@ -13471,6 +13511,7 @@ const Wazo = {
|
|
|
13471
13511
|
InvalidSubscription,
|
|
13472
13512
|
InvalidAuthorization,
|
|
13473
13513
|
CanceledCallError,
|
|
13514
|
+
SFUNotAvailableError,
|
|
13474
13515
|
};
|
|
13475
13516
|
|
|
13476
13517
|
if (window) {
|