@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/utils.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
|
|
|
@@ -13726,6 +13766,7 @@ const Wazo = {
|
|
|
13726
13766
|
InvalidSubscription,
|
|
13727
13767
|
InvalidAuthorization,
|
|
13728
13768
|
CanceledCallError,
|
|
13769
|
+
SFUNotAvailableError,
|
|
13729
13770
|
};
|
|
13730
13771
|
|
|
13731
13772
|
if (window) {
|
|
@@ -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';
|
|
@@ -1720,8 +1720,10 @@ var updateFrom = (instance , from ) => {
|
|
|
1720
1720
|
|
|
1721
1721
|
|
|
1722
1722
|
|
|
1723
|
+
|
|
1723
1724
|
|
|
1724
1725
|
|
|
1726
|
+
|
|
1725
1727
|
|
|
1726
1728
|
|
|
1727
1729
|
|
|
@@ -1738,6 +1740,7 @@ var updateFrom = (instance , from ) => {
|
|
|
1738
1740
|
|
|
1739
1741
|
|
|
1740
1742
|
|
|
1743
|
+
|
|
1741
1744
|
|
|
1742
1745
|
|
|
1743
1746
|
class CallSession {
|
|
@@ -1757,8 +1760,12 @@ class CallSession {
|
|
|
1757
1760
|
|
|
1758
1761
|
|
|
1759
1762
|
|
|
1763
|
+
|
|
1764
|
+
|
|
1760
1765
|
|
|
1761
1766
|
|
|
1767
|
+
|
|
1768
|
+
|
|
1762
1769
|
|
|
1763
1770
|
|
|
1764
1771
|
|
|
@@ -1796,6 +1803,8 @@ class CallSession {
|
|
|
1796
1803
|
|
|
1797
1804
|
|
|
1798
1805
|
|
|
1806
|
+
|
|
1807
|
+
|
|
1799
1808
|
|
|
1800
1809
|
constructor({
|
|
1801
1810
|
answered,
|
|
@@ -1809,6 +1818,8 @@ class CallSession {
|
|
|
1809
1818
|
paused,
|
|
1810
1819
|
ringing,
|
|
1811
1820
|
startTime,
|
|
1821
|
+
creationTime,
|
|
1822
|
+
endTime,
|
|
1812
1823
|
cameraEnabled,
|
|
1813
1824
|
dialedExtension,
|
|
1814
1825
|
sipCallId,
|
|
@@ -1821,12 +1832,15 @@ class CallSession {
|
|
|
1821
1832
|
recording,
|
|
1822
1833
|
recordingPaused,
|
|
1823
1834
|
videoRemotelyDowngraded,
|
|
1835
|
+
sipSession,
|
|
1824
1836
|
} ) {
|
|
1825
1837
|
this.callId = callId;
|
|
1826
1838
|
this.sipCallId = sipCallId;
|
|
1827
1839
|
this.displayName = displayName;
|
|
1828
1840
|
this.number = number;
|
|
1841
|
+
this.creationTime = creationTime;
|
|
1829
1842
|
this.startTime = startTime;
|
|
1843
|
+
this.endTime = endTime;
|
|
1830
1844
|
this.isCaller = isCaller;
|
|
1831
1845
|
this.answered = answered;
|
|
1832
1846
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -1845,6 +1859,7 @@ class CallSession {
|
|
|
1845
1859
|
this.recording = recording || false;
|
|
1846
1860
|
this.recordingPaused = recordingPaused || false;
|
|
1847
1861
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
1862
|
+
this.sipSession = sipSession;
|
|
1848
1863
|
|
|
1849
1864
|
// Useful to compare instead of instanceof with minified code
|
|
1850
1865
|
this.type = 'CallSession';
|
|
@@ -68,8 +68,10 @@ var updateFrom = (instance , from ) => {
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
|
|
71
|
+
|
|
71
72
|
|
|
72
73
|
|
|
74
|
+
|
|
73
75
|
|
|
74
76
|
|
|
75
77
|
|
|
@@ -86,6 +88,7 @@ var updateFrom = (instance , from ) => {
|
|
|
86
88
|
|
|
87
89
|
|
|
88
90
|
|
|
91
|
+
|
|
89
92
|
|
|
90
93
|
|
|
91
94
|
class CallSession {
|
|
@@ -105,8 +108,12 @@ class CallSession {
|
|
|
105
108
|
|
|
106
109
|
|
|
107
110
|
|
|
111
|
+
|
|
112
|
+
|
|
108
113
|
|
|
109
114
|
|
|
115
|
+
|
|
116
|
+
|
|
110
117
|
|
|
111
118
|
|
|
112
119
|
|
|
@@ -144,6 +151,8 @@ class CallSession {
|
|
|
144
151
|
|
|
145
152
|
|
|
146
153
|
|
|
154
|
+
|
|
155
|
+
|
|
147
156
|
|
|
148
157
|
constructor({
|
|
149
158
|
answered,
|
|
@@ -157,6 +166,8 @@ class CallSession {
|
|
|
157
166
|
paused,
|
|
158
167
|
ringing,
|
|
159
168
|
startTime,
|
|
169
|
+
creationTime,
|
|
170
|
+
endTime,
|
|
160
171
|
cameraEnabled,
|
|
161
172
|
dialedExtension,
|
|
162
173
|
sipCallId,
|
|
@@ -169,12 +180,15 @@ class CallSession {
|
|
|
169
180
|
recording,
|
|
170
181
|
recordingPaused,
|
|
171
182
|
videoRemotelyDowngraded,
|
|
183
|
+
sipSession,
|
|
172
184
|
} ) {
|
|
173
185
|
this.callId = callId;
|
|
174
186
|
this.sipCallId = sipCallId;
|
|
175
187
|
this.displayName = displayName;
|
|
176
188
|
this.number = number;
|
|
189
|
+
this.creationTime = creationTime;
|
|
177
190
|
this.startTime = startTime;
|
|
191
|
+
this.endTime = endTime;
|
|
178
192
|
this.isCaller = isCaller;
|
|
179
193
|
this.answered = answered;
|
|
180
194
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -193,6 +207,7 @@ class CallSession {
|
|
|
193
207
|
this.recording = recording || false;
|
|
194
208
|
this.recordingPaused = recordingPaused || false;
|
|
195
209
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
210
|
+
this.sipSession = sipSession;
|
|
196
211
|
|
|
197
212
|
// Useful to compare instead of instanceof with minified code
|
|
198
213
|
this.type = 'CallSession';
|
|
@@ -887,6 +902,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
887
902
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
888
903
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
889
904
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
905
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
890
906
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
891
907
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
892
908
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -931,6 +947,7 @@ const events = [
|
|
|
931
947
|
ON_CAMERA_DISABLED,
|
|
932
948
|
ON_CALL_FAILED,
|
|
933
949
|
ON_CALL_ENDED,
|
|
950
|
+
ON_CALL_REJECTED,
|
|
934
951
|
ON_MESSAGE,
|
|
935
952
|
ON_REINVITE,
|
|
936
953
|
ON_TRACK,
|
|
@@ -1287,6 +1304,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1287
1304
|
|
|
1288
1305
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
1289
1306
|
const callSession = this._createCallSession(sipSession);
|
|
1307
|
+
callSession.endTime = new Date();
|
|
1290
1308
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
1291
1309
|
|
|
1292
1310
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -2006,6 +2024,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2006
2024
|
return Promise.resolve(null);
|
|
2007
2025
|
}
|
|
2008
2026
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
2027
|
+
callSession.creationTime = new Date();
|
|
2009
2028
|
|
|
2010
2029
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
2011
2030
|
|
|
@@ -2284,6 +2303,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2284
2303
|
callSession);
|
|
2285
2304
|
}
|
|
2286
2305
|
|
|
2306
|
+
callSession.creationTime = new Date();
|
|
2287
2307
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
2288
2308
|
});
|
|
2289
2309
|
|
|
@@ -2323,6 +2343,13 @@ class WebRTCPhone extends Emitter {
|
|
|
2323
2343
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
2324
2344
|
});
|
|
2325
2345
|
|
|
2346
|
+
this.client.on(this.client.REJECTED, session => {
|
|
2347
|
+
logger.info('WebRTC call rejected', session.id);
|
|
2348
|
+
const callSession = this._createCallSession(session);
|
|
2349
|
+
callSession.endTime = new Date();
|
|
2350
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
2351
|
+
});
|
|
2352
|
+
|
|
2326
2353
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
2327
2354
|
logger.info('WebRTC unregistered');
|
|
2328
2355
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -2535,6 +2562,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2535
2562
|
const number = identity ? identity.uri._normal.user : null;
|
|
2536
2563
|
const { state } = sipSession || {};
|
|
2537
2564
|
const sessionId = this.getSipSessionId(sipSession);
|
|
2565
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
2538
2566
|
|
|
2539
2567
|
const callSession = new CallSession({
|
|
2540
2568
|
callId: fromSession && fromSession.callId,
|
|
@@ -2542,6 +2570,8 @@ class WebRTCPhone extends Emitter {
|
|
|
2542
2570
|
sipStatus: state,
|
|
2543
2571
|
displayName: identity ? identity.displayName || number : number,
|
|
2544
2572
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
2573
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
2574
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
2545
2575
|
answered: state === sessionState.SessionState.Established,
|
|
2546
2576
|
paused: this.client.isCallHeld(sipSession),
|
|
2547
2577
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -2552,6 +2582,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2552
2582
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
2553
2583
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
2554
2584
|
recordingPaused: false, // @TODO
|
|
2585
|
+
sipSession,
|
|
2555
2586
|
...extra,
|
|
2556
2587
|
});
|
|
2557
2588
|
|
|
@@ -2575,6 +2606,7 @@ exports.ON_CALL_HELD = ON_CALL_HELD;
|
|
|
2575
2606
|
exports.ON_CALL_INCOMING = ON_CALL_INCOMING;
|
|
2576
2607
|
exports.ON_CALL_MUTED = ON_CALL_MUTED;
|
|
2577
2608
|
exports.ON_CALL_OUTGOING = ON_CALL_OUTGOING;
|
|
2609
|
+
exports.ON_CALL_REJECTED = ON_CALL_REJECTED;
|
|
2578
2610
|
exports.ON_CALL_RESUMED = ON_CALL_RESUMED;
|
|
2579
2611
|
exports.ON_CALL_UNHELD = ON_CALL_UNHELD;
|
|
2580
2612
|
exports.ON_CALL_UNMUTED = ON_CALL_UNMUTED;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* */
|
|
4
|
+
class SFUNotAvailableError extends Error {
|
|
5
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'SFUNotAvailableError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = SFUNotAvailableError;
|
|
@@ -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';
|
|
@@ -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';
|