@wazo/sdk 0.37.28 → 0.37.32
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 +2 -1
- package/dist/wazo-sdk.js +4 -4
- package/esm/__tests__/api-client.test.js +30 -0
- package/esm/__tests__/web-rtc-client.test.js +65 -6
- package/esm/api/calld.js +30 -0
- package/esm/api-client.js +30 -0
- package/esm/checker/Checker.js +65 -6
- package/esm/checker/checks/aor.js +30 -0
- package/esm/checker/checks/api.js +30 -0
- package/esm/checker/checks/index.js +65 -6
- package/esm/checker/checks/webrtc-transport.js +65 -6
- package/esm/checker/checks/webrtc.js +65 -6
- package/esm/domain/AdHocAPIConference.js +30 -0
- package/esm/domain/CallSession.js +15 -3
- package/esm/domain/Features.js +30 -0
- package/esm/domain/MeetingStatus.js +29 -0
- package/esm/domain/Phone/CTIPhone.js +45 -3
- package/esm/domain/Phone/WebRTCPhone.js +28 -6
- package/esm/domain/__tests__/CallSession.test.js +32 -3
- package/esm/domain/__tests__/IndirectTransfer.test.js +15 -3
- package/esm/domain/__tests__/Room.test.js +15 -3
- package/esm/index.js +93 -12
- package/esm/service/CallApi.js +30 -0
- package/esm/service/getApiClient.js +30 -0
- package/esm/simple/Auth.js +93 -12
- package/esm/simple/Configuration.js +93 -12
- package/esm/simple/Directory.js +30 -0
- package/esm/simple/Phone.js +93 -12
- package/esm/simple/index.js +93 -12
- package/esm/simple/room/LocalParticipant.js +93 -12
- package/esm/simple/room/Participant.js +93 -12
- package/esm/simple/room/RemoteParticipant.js +93 -12
- package/esm/simple/room/Room.js +93 -12
- package/esm/simple/room/SipRoom.js +93 -12
- package/esm/simple/room/Stream.js +93 -12
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +93 -12
- package/esm/simple/utils.js +93 -12
- package/esm/web-rtc-client.js +65 -6
- package/lib/__tests__/api-client.test.js +30 -0
- package/lib/__tests__/web-rtc-client.test.js +65 -6
- package/lib/api/calld.js +30 -0
- package/lib/api-client.js +30 -0
- package/lib/checker/Checker.js +65 -6
- package/lib/checker/checks/aor.js +30 -0
- package/lib/checker/checks/api.js +30 -0
- package/lib/checker/checks/index.js +65 -6
- package/lib/checker/checks/webrtc-transport.js +65 -6
- package/lib/checker/checks/webrtc.js +65 -6
- package/lib/domain/AdHocAPIConference.js +30 -0
- package/lib/domain/CallSession.js +15 -3
- package/lib/domain/Features.js +30 -0
- package/lib/domain/MeetingStatus.js +31 -0
- package/lib/domain/Phone/CTIPhone.js +45 -3
- package/lib/domain/Phone/WebRTCPhone.js +28 -6
- package/lib/domain/__tests__/CallSession.test.js +32 -3
- package/lib/domain/__tests__/IndirectTransfer.test.js +15 -3
- package/lib/domain/__tests__/Room.test.js +15 -3
- package/lib/index.js +93 -12
- package/lib/service/CallApi.js +30 -0
- package/lib/service/getApiClient.js +30 -0
- package/lib/simple/Auth.js +93 -12
- package/lib/simple/Configuration.js +93 -12
- package/lib/simple/Directory.js +30 -0
- package/lib/simple/Phone.js +93 -12
- package/lib/simple/index.js +93 -12
- package/lib/simple/room/LocalParticipant.js +93 -12
- package/lib/simple/room/Participant.js +93 -12
- package/lib/simple/room/RemoteParticipant.js +93 -12
- package/lib/simple/room/Room.js +93 -12
- package/lib/simple/room/SipRoom.js +93 -12
- package/lib/simple/room/Stream.js +93 -12
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +93 -12
- package/lib/simple/utils.js +93 -12
- package/lib/web-rtc-client.js +65 -6
- package/package.json +1 -1
- package/src/api/calld.js +3 -0
- package/src/domain/CallSession.js +16 -4
- package/src/domain/MeetingStatus.js +27 -0
- package/src/domain/Phone/WebRTCPhone.js +13 -3
- package/src/domain/__tests__/CallSession.test.js +17 -0
- package/src/web-rtc-client.js +35 -6
|
@@ -54,6 +54,7 @@ var updateFrom = (instance , from ) => {
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
|
|
57
58
|
|
|
58
59
|
|
|
59
60
|
|
|
@@ -101,14 +102,14 @@ class CallSession {
|
|
|
101
102
|
|
|
102
103
|
|
|
103
104
|
|
|
105
|
+
// = creationTime
|
|
106
|
+
|
|
104
107
|
|
|
105
108
|
|
|
106
109
|
|
|
107
110
|
|
|
108
111
|
|
|
109
112
|
|
|
110
|
-
|
|
111
|
-
|
|
112
113
|
|
|
113
114
|
|
|
114
115
|
|
|
@@ -172,6 +173,7 @@ class CallSession {
|
|
|
172
173
|
recordingPaused,
|
|
173
174
|
videoRemotelyDowngraded,
|
|
174
175
|
sipSession,
|
|
176
|
+
answerTime,
|
|
175
177
|
} ) {
|
|
176
178
|
this.callId = callId;
|
|
177
179
|
this.sipCallId = sipCallId;
|
|
@@ -199,6 +201,7 @@ class CallSession {
|
|
|
199
201
|
this.recordingPaused = recordingPaused || false;
|
|
200
202
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
201
203
|
this.sipSession = sipSession;
|
|
204
|
+
this.answerTime = answerTime || this.answerTime;
|
|
202
205
|
|
|
203
206
|
// Useful to compare instead of instanceof with minified code
|
|
204
207
|
this.type = 'CallSession';
|
|
@@ -229,7 +232,7 @@ class CallSession {
|
|
|
229
232
|
}
|
|
230
233
|
|
|
231
234
|
answer() {
|
|
232
|
-
this.
|
|
235
|
+
this.answerTime = new Date();
|
|
233
236
|
}
|
|
234
237
|
|
|
235
238
|
systemAnswer() {
|
|
@@ -385,6 +388,15 @@ class CallSession {
|
|
|
385
388
|
return newFrom(callSession, CallSession);
|
|
386
389
|
}
|
|
387
390
|
|
|
391
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
392
|
+
set answered(value ) {
|
|
393
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
get answered() {
|
|
397
|
+
return !!this.answerTime;
|
|
398
|
+
}
|
|
399
|
+
|
|
388
400
|
static parseCall(call ) {
|
|
389
401
|
return new CallSession({
|
|
390
402
|
callId: call.id,
|
|
@@ -1491,6 +1503,8 @@ class WebRTCPhone extends Emitter {
|
|
|
1491
1503
|
this.removeIncomingSessions(sipSessionId);
|
|
1492
1504
|
}
|
|
1493
1505
|
|
|
1506
|
+
callSession.answerTime = new Date();
|
|
1507
|
+
this._updateCallSession(callSession);
|
|
1494
1508
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
1495
1509
|
|
|
1496
1510
|
return callSession;
|
|
@@ -1706,6 +1720,8 @@ class WebRTCPhone extends Emitter {
|
|
|
1706
1720
|
}
|
|
1707
1721
|
|
|
1708
1722
|
this.shouldSendReinvite = false;
|
|
1723
|
+
callSession.answerTime = new Date();
|
|
1724
|
+
this._updateCallSession(callSession);
|
|
1709
1725
|
this.acceptedSessions[callSession.getId()] = true;
|
|
1710
1726
|
|
|
1711
1727
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -1805,7 +1821,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1805
1821
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
1806
1822
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
1807
1823
|
logger.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
1808
|
-
this.holdSipSession(this.currentSipSession,
|
|
1824
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
1809
1825
|
}
|
|
1810
1826
|
|
|
1811
1827
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -2016,6 +2032,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2016
2032
|
}
|
|
2017
2033
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
2018
2034
|
callSession.creationTime = new Date();
|
|
2035
|
+
this._updateCallSession(callSession);
|
|
2019
2036
|
|
|
2020
2037
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
2021
2038
|
|
|
@@ -2157,7 +2174,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2157
2174
|
return this.client && this.client.isConference(callSession.sipCallId);
|
|
2158
2175
|
}
|
|
2159
2176
|
|
|
2160
|
-
async close() {
|
|
2177
|
+
async close(force = false) {
|
|
2161
2178
|
logger.info('WebRTC close');
|
|
2162
2179
|
|
|
2163
2180
|
try {
|
|
@@ -2169,7 +2186,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2169
2186
|
logger.error('WebRTC close, unregister error', e);
|
|
2170
2187
|
}
|
|
2171
2188
|
|
|
2172
|
-
this.client.close();
|
|
2189
|
+
this.client.close(force);
|
|
2173
2190
|
this.unbind();
|
|
2174
2191
|
|
|
2175
2192
|
this.incomingSessions = [];
|
|
@@ -2295,6 +2312,8 @@ class WebRTCPhone extends Emitter {
|
|
|
2295
2312
|
}
|
|
2296
2313
|
|
|
2297
2314
|
callSession.creationTime = new Date();
|
|
2315
|
+
this._updateCallSession(callSession);
|
|
2316
|
+
|
|
2298
2317
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
2299
2318
|
});
|
|
2300
2319
|
|
|
@@ -2338,6 +2357,8 @@ class WebRTCPhone extends Emitter {
|
|
|
2338
2357
|
logger.info('WebRTC call rejected', session.id);
|
|
2339
2358
|
const callSession = this._createCallSession(session);
|
|
2340
2359
|
callSession.endTime = new Date();
|
|
2360
|
+
this._updateCallSession(callSession);
|
|
2361
|
+
|
|
2341
2362
|
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
2342
2363
|
});
|
|
2343
2364
|
|
|
@@ -2562,6 +2583,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2562
2583
|
displayName: identity ? identity.displayName || number : number,
|
|
2563
2584
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
2564
2585
|
creationTime: fromSession ? fromSession.creationTime : null,
|
|
2586
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
2565
2587
|
endTime: fromSession ? fromSession.endTime : null,
|
|
2566
2588
|
answered: state === SessionState.Established,
|
|
2567
2589
|
paused: this.client.isCallHeld(sipSession),
|
|
@@ -32,6 +32,7 @@ var updateFrom = (instance , from ) => {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
|
|
@@ -79,14 +80,14 @@ class CallSession {
|
|
|
79
80
|
|
|
80
81
|
|
|
81
82
|
|
|
83
|
+
// = creationTime
|
|
84
|
+
|
|
82
85
|
|
|
83
86
|
|
|
84
87
|
|
|
85
88
|
|
|
86
89
|
|
|
87
90
|
|
|
88
|
-
|
|
89
|
-
|
|
90
91
|
|
|
91
92
|
|
|
92
93
|
|
|
@@ -150,6 +151,7 @@ class CallSession {
|
|
|
150
151
|
recordingPaused,
|
|
151
152
|
videoRemotelyDowngraded,
|
|
152
153
|
sipSession,
|
|
154
|
+
answerTime,
|
|
153
155
|
} ) {
|
|
154
156
|
this.callId = callId;
|
|
155
157
|
this.sipCallId = sipCallId;
|
|
@@ -177,6 +179,7 @@ class CallSession {
|
|
|
177
179
|
this.recordingPaused = recordingPaused || false;
|
|
178
180
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
179
181
|
this.sipSession = sipSession;
|
|
182
|
+
this.answerTime = answerTime || this.answerTime;
|
|
180
183
|
|
|
181
184
|
// Useful to compare instead of instanceof with minified code
|
|
182
185
|
this.type = 'CallSession';
|
|
@@ -207,7 +210,7 @@ class CallSession {
|
|
|
207
210
|
}
|
|
208
211
|
|
|
209
212
|
answer() {
|
|
210
|
-
this.
|
|
213
|
+
this.answerTime = new Date();
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
systemAnswer() {
|
|
@@ -363,6 +366,15 @@ class CallSession {
|
|
|
363
366
|
return newFrom(callSession, CallSession);
|
|
364
367
|
}
|
|
365
368
|
|
|
369
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
370
|
+
set answered(value ) {
|
|
371
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
get answered() {
|
|
375
|
+
return !!this.answerTime;
|
|
376
|
+
}
|
|
377
|
+
|
|
366
378
|
static parseCall(call ) {
|
|
367
379
|
return new CallSession({
|
|
368
380
|
callId: call.id,
|
|
@@ -425,4 +437,21 @@ describe('CallSession domain', () => {
|
|
|
425
437
|
expect(cs1.is(cs2)).toBeTruthy();
|
|
426
438
|
expect(cs2.is(cs1)).toBeTruthy();
|
|
427
439
|
});
|
|
440
|
+
|
|
441
|
+
it('should set answerTime when setting answered', () => {
|
|
442
|
+
const cs1 = new CallSession({});
|
|
443
|
+
cs1.answered = true;
|
|
444
|
+
|
|
445
|
+
const cs2 = new CallSession({});
|
|
446
|
+
cs2.answer();
|
|
447
|
+
|
|
448
|
+
const cs3 = new CallSession({ answered: true });
|
|
449
|
+
|
|
450
|
+
expect(cs1.answered).toBeTruthy();
|
|
451
|
+
expect(cs1.answerTime).not.toBeNull();
|
|
452
|
+
expect(cs2.answered).toBeTruthy();
|
|
453
|
+
expect(cs2.answerTime).not.toBeNull();
|
|
454
|
+
expect(cs3.answered).toBeTruthy();
|
|
455
|
+
expect(cs3.answerTime).not.toBeNull();
|
|
456
|
+
});
|
|
428
457
|
});
|
|
@@ -32,6 +32,7 @@ var updateFrom = (instance , from ) => {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
|
|
@@ -79,14 +80,14 @@ class CallSession {
|
|
|
79
80
|
|
|
80
81
|
|
|
81
82
|
|
|
83
|
+
// = creationTime
|
|
84
|
+
|
|
82
85
|
|
|
83
86
|
|
|
84
87
|
|
|
85
88
|
|
|
86
89
|
|
|
87
90
|
|
|
88
|
-
|
|
89
|
-
|
|
90
91
|
|
|
91
92
|
|
|
92
93
|
|
|
@@ -150,6 +151,7 @@ class CallSession {
|
|
|
150
151
|
recordingPaused,
|
|
151
152
|
videoRemotelyDowngraded,
|
|
152
153
|
sipSession,
|
|
154
|
+
answerTime,
|
|
153
155
|
} ) {
|
|
154
156
|
this.callId = callId;
|
|
155
157
|
this.sipCallId = sipCallId;
|
|
@@ -177,6 +179,7 @@ class CallSession {
|
|
|
177
179
|
this.recordingPaused = recordingPaused || false;
|
|
178
180
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
179
181
|
this.sipSession = sipSession;
|
|
182
|
+
this.answerTime = answerTime || this.answerTime;
|
|
180
183
|
|
|
181
184
|
// Useful to compare instead of instanceof with minified code
|
|
182
185
|
this.type = 'CallSession';
|
|
@@ -207,7 +210,7 @@ class CallSession {
|
|
|
207
210
|
}
|
|
208
211
|
|
|
209
212
|
answer() {
|
|
210
|
-
this.
|
|
213
|
+
this.answerTime = new Date();
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
systemAnswer() {
|
|
@@ -363,6 +366,15 @@ class CallSession {
|
|
|
363
366
|
return newFrom(callSession, CallSession);
|
|
364
367
|
}
|
|
365
368
|
|
|
369
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
370
|
+
set answered(value ) {
|
|
371
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
get answered() {
|
|
375
|
+
return !!this.answerTime;
|
|
376
|
+
}
|
|
377
|
+
|
|
366
378
|
static parseCall(call ) {
|
|
367
379
|
return new CallSession({
|
|
368
380
|
callId: call.id,
|
|
@@ -32,6 +32,7 @@ var updateFrom = (instance , from ) => {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
|
|
@@ -79,14 +80,14 @@ class CallSession {
|
|
|
79
80
|
|
|
80
81
|
|
|
81
82
|
|
|
83
|
+
// = creationTime
|
|
84
|
+
|
|
82
85
|
|
|
83
86
|
|
|
84
87
|
|
|
85
88
|
|
|
86
89
|
|
|
87
90
|
|
|
88
|
-
|
|
89
|
-
|
|
90
91
|
|
|
91
92
|
|
|
92
93
|
|
|
@@ -150,6 +151,7 @@ class CallSession {
|
|
|
150
151
|
recordingPaused,
|
|
151
152
|
videoRemotelyDowngraded,
|
|
152
153
|
sipSession,
|
|
154
|
+
answerTime,
|
|
153
155
|
} ) {
|
|
154
156
|
this.callId = callId;
|
|
155
157
|
this.sipCallId = sipCallId;
|
|
@@ -177,6 +179,7 @@ class CallSession {
|
|
|
177
179
|
this.recordingPaused = recordingPaused || false;
|
|
178
180
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
179
181
|
this.sipSession = sipSession;
|
|
182
|
+
this.answerTime = answerTime || this.answerTime;
|
|
180
183
|
|
|
181
184
|
// Useful to compare instead of instanceof with minified code
|
|
182
185
|
this.type = 'CallSession';
|
|
@@ -207,7 +210,7 @@ class CallSession {
|
|
|
207
210
|
}
|
|
208
211
|
|
|
209
212
|
answer() {
|
|
210
|
-
this.
|
|
213
|
+
this.answerTime = new Date();
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
systemAnswer() {
|
|
@@ -363,6 +366,15 @@ class CallSession {
|
|
|
363
366
|
return newFrom(callSession, CallSession);
|
|
364
367
|
}
|
|
365
368
|
|
|
369
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
370
|
+
set answered(value ) {
|
|
371
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
get answered() {
|
|
375
|
+
return !!this.answerTime;
|
|
376
|
+
}
|
|
377
|
+
|
|
366
378
|
static parseCall(call ) {
|
|
367
379
|
return new CallSession({
|
|
368
380
|
callId: call.id,
|
package/esm/index.js
CHANGED
|
@@ -3249,6 +3249,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3249
3249
|
|
|
3250
3250
|
|
|
3251
3251
|
|
|
3252
|
+
|
|
3252
3253
|
|
|
3253
3254
|
|
|
3254
3255
|
|
|
@@ -3296,14 +3297,14 @@ class CallSession {
|
|
|
3296
3297
|
|
|
3297
3298
|
|
|
3298
3299
|
|
|
3300
|
+
// = creationTime
|
|
3301
|
+
|
|
3299
3302
|
|
|
3300
3303
|
|
|
3301
3304
|
|
|
3302
3305
|
|
|
3303
3306
|
|
|
3304
3307
|
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
3308
|
|
|
3308
3309
|
|
|
3309
3310
|
|
|
@@ -3367,6 +3368,7 @@ class CallSession {
|
|
|
3367
3368
|
recordingPaused,
|
|
3368
3369
|
videoRemotelyDowngraded,
|
|
3369
3370
|
sipSession,
|
|
3371
|
+
answerTime,
|
|
3370
3372
|
} ) {
|
|
3371
3373
|
this.callId = callId;
|
|
3372
3374
|
this.sipCallId = sipCallId;
|
|
@@ -3394,6 +3396,7 @@ class CallSession {
|
|
|
3394
3396
|
this.recordingPaused = recordingPaused || false;
|
|
3395
3397
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3396
3398
|
this.sipSession = sipSession;
|
|
3399
|
+
this.answerTime = answerTime || this.answerTime;
|
|
3397
3400
|
|
|
3398
3401
|
// Useful to compare instead of instanceof with minified code
|
|
3399
3402
|
this.type = 'CallSession';
|
|
@@ -3424,7 +3427,7 @@ class CallSession {
|
|
|
3424
3427
|
}
|
|
3425
3428
|
|
|
3426
3429
|
answer() {
|
|
3427
|
-
this.
|
|
3430
|
+
this.answerTime = new Date();
|
|
3428
3431
|
}
|
|
3429
3432
|
|
|
3430
3433
|
systemAnswer() {
|
|
@@ -3580,6 +3583,15 @@ class CallSession {
|
|
|
3580
3583
|
return newFrom(callSession, CallSession);
|
|
3581
3584
|
}
|
|
3582
3585
|
|
|
3586
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
3587
|
+
set answered(value ) {
|
|
3588
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
3589
|
+
}
|
|
3590
|
+
|
|
3591
|
+
get answered() {
|
|
3592
|
+
return !!this.answerTime;
|
|
3593
|
+
}
|
|
3594
|
+
|
|
3583
3595
|
static parseCall(call ) {
|
|
3584
3596
|
return new CallSession({
|
|
3585
3597
|
callId: call.id,
|
|
@@ -4914,6 +4926,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4914
4926
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4915
4927
|
});
|
|
4916
4928
|
|
|
4929
|
+
//
|
|
4930
|
+
|
|
4931
|
+
|
|
4932
|
+
|
|
4933
|
+
|
|
4934
|
+
|
|
4935
|
+
class MeetingStatus {
|
|
4936
|
+
|
|
4937
|
+
|
|
4938
|
+
|
|
4939
|
+
|
|
4940
|
+
constructor({
|
|
4941
|
+
full,
|
|
4942
|
+
} = {}) {
|
|
4943
|
+
this.full = full;
|
|
4944
|
+
|
|
4945
|
+
// Useful to compare instead of instanceof with minified code
|
|
4946
|
+
this.type = 'MeetingStatus';
|
|
4947
|
+
}
|
|
4948
|
+
|
|
4949
|
+
static parse(plain ) {
|
|
4950
|
+
return new MeetingStatus({
|
|
4951
|
+
full: plain.full,
|
|
4952
|
+
});
|
|
4953
|
+
}
|
|
4954
|
+
|
|
4955
|
+
}
|
|
4956
|
+
|
|
4917
4957
|
/* */
|
|
4918
4958
|
|
|
4919
4959
|
|
|
@@ -5108,6 +5148,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
5108
5148
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
5109
5149
|
ApiRequester.successResponseParser),
|
|
5110
5150
|
|
|
5151
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
5152
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
5111
5153
|
});
|
|
5112
5154
|
|
|
5113
5155
|
//
|
|
@@ -6187,6 +6229,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
6187
6229
|
|
|
6188
6230
|
|
|
6189
6231
|
|
|
6232
|
+
|
|
6190
6233
|
|
|
6191
6234
|
|
|
6192
6235
|
|
|
@@ -6228,6 +6271,7 @@ class WebRTCClient extends Emitter {
|
|
|
6228
6271
|
|
|
6229
6272
|
|
|
6230
6273
|
|
|
6274
|
+
|
|
6231
6275
|
|
|
6232
6276
|
// sugar
|
|
6233
6277
|
|
|
@@ -6290,6 +6334,7 @@ class WebRTCClient extends Emitter {
|
|
|
6290
6334
|
this.conferences = {};
|
|
6291
6335
|
this.networkMonitoringInterval = {};
|
|
6292
6336
|
this.sessionNetworkStats = {};
|
|
6337
|
+
this.forceClosed = false;
|
|
6293
6338
|
|
|
6294
6339
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
6295
6340
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -6411,6 +6456,8 @@ class WebRTCClient extends Emitter {
|
|
|
6411
6456
|
skipRegister: this.skipRegister,
|
|
6412
6457
|
};
|
|
6413
6458
|
|
|
6459
|
+
this.forceClosed = false;
|
|
6460
|
+
|
|
6414
6461
|
if (this.skipRegister) {
|
|
6415
6462
|
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6416
6463
|
return Promise.resolve();
|
|
@@ -6435,7 +6482,15 @@ class WebRTCClient extends Emitter {
|
|
|
6435
6482
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6436
6483
|
|
|
6437
6484
|
const onRegisterFailed = () => {
|
|
6438
|
-
logger$9.info('sdk webrtc registering failed', {
|
|
6485
|
+
logger$9.info('sdk webrtc registering failed', {
|
|
6486
|
+
tries,
|
|
6487
|
+
registerer: !!this.registerer,
|
|
6488
|
+
forceClosed: this.forceClosed,
|
|
6489
|
+
});
|
|
6490
|
+
if (this.forceClosed) {
|
|
6491
|
+
return;
|
|
6492
|
+
}
|
|
6493
|
+
|
|
6439
6494
|
this.connectionPromise = null;
|
|
6440
6495
|
if (this.registerer && this.registerer.waiting) {
|
|
6441
6496
|
this.registerer.waitingToggle(false);
|
|
@@ -6713,8 +6768,9 @@ class WebRTCClient extends Emitter {
|
|
|
6713
6768
|
}
|
|
6714
6769
|
}
|
|
6715
6770
|
|
|
6716
|
-
async close() {
|
|
6717
|
-
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6771
|
+
async close(force = false) {
|
|
6772
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
6773
|
+
this.forceClosed = force;
|
|
6718
6774
|
this._cleanupMedia();
|
|
6719
6775
|
this.connectionPromise = null;
|
|
6720
6776
|
|
|
@@ -6733,7 +6789,7 @@ class WebRTCClient extends Emitter {
|
|
|
6733
6789
|
this.userAgent.delegate = null;
|
|
6734
6790
|
this.userAgent.stateChange.removeAllListeners();
|
|
6735
6791
|
|
|
6736
|
-
await this._disconnectTransport();
|
|
6792
|
+
await this._disconnectTransport(force);
|
|
6737
6793
|
|
|
6738
6794
|
this._cleanupRegister();
|
|
6739
6795
|
|
|
@@ -7803,6 +7859,13 @@ class WebRTCClient extends Emitter {
|
|
|
7803
7859
|
}
|
|
7804
7860
|
|
|
7805
7861
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
7862
|
+
let { host } = this.config;
|
|
7863
|
+
let port = this.config.port || 443;
|
|
7864
|
+
|
|
7865
|
+
if (this.config.websocketSip) {
|
|
7866
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
7867
|
+
}
|
|
7868
|
+
|
|
7806
7869
|
const config = {
|
|
7807
7870
|
authorizationUsername: this.config.authorizationUser,
|
|
7808
7871
|
authorizationPassword: this.config.password,
|
|
@@ -7838,7 +7901,7 @@ class WebRTCClient extends Emitter {
|
|
|
7838
7901
|
},
|
|
7839
7902
|
transportOptions: {
|
|
7840
7903
|
traceSip: configOverrides.traceSip || false,
|
|
7841
|
-
wsServers: `wss://${
|
|
7904
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
7842
7905
|
},
|
|
7843
7906
|
sessionDescriptionHandlerFactoryOptions: {
|
|
7844
7907
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -8162,7 +8225,15 @@ class WebRTCClient extends Emitter {
|
|
|
8162
8225
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
8163
8226
|
}
|
|
8164
8227
|
|
|
8165
|
-
async _disconnectTransport() {
|
|
8228
|
+
async _disconnectTransport(force = false) {
|
|
8229
|
+
if (force) {
|
|
8230
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8231
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
8232
|
+
// eslint-disable-next-line
|
|
8233
|
+
this.userAgent.transport._ws.close(1000);
|
|
8234
|
+
return;
|
|
8235
|
+
}
|
|
8236
|
+
|
|
8166
8237
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
8167
8238
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
8168
8239
|
try {
|
|
@@ -9799,6 +9870,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9799
9870
|
this.removeIncomingSessions(sipSessionId);
|
|
9800
9871
|
}
|
|
9801
9872
|
|
|
9873
|
+
callSession.answerTime = new Date();
|
|
9874
|
+
this._updateCallSession(callSession);
|
|
9802
9875
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9803
9876
|
|
|
9804
9877
|
return callSession;
|
|
@@ -10014,6 +10087,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10014
10087
|
}
|
|
10015
10088
|
|
|
10016
10089
|
this.shouldSendReinvite = false;
|
|
10090
|
+
callSession.answerTime = new Date();
|
|
10091
|
+
this._updateCallSession(callSession);
|
|
10017
10092
|
this.acceptedSessions[callSession.getId()] = true;
|
|
10018
10093
|
|
|
10019
10094
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -10113,7 +10188,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10113
10188
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
10114
10189
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
10115
10190
|
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
10116
|
-
this.holdSipSession(this.currentSipSession,
|
|
10191
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
10117
10192
|
}
|
|
10118
10193
|
|
|
10119
10194
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -10324,6 +10399,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10324
10399
|
}
|
|
10325
10400
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
10326
10401
|
callSession.creationTime = new Date();
|
|
10402
|
+
this._updateCallSession(callSession);
|
|
10327
10403
|
|
|
10328
10404
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
10329
10405
|
|
|
@@ -10465,7 +10541,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10465
10541
|
return this.client && this.client.isConference(callSession.sipCallId);
|
|
10466
10542
|
}
|
|
10467
10543
|
|
|
10468
|
-
async close() {
|
|
10544
|
+
async close(force = false) {
|
|
10469
10545
|
logger$7.info('WebRTC close');
|
|
10470
10546
|
|
|
10471
10547
|
try {
|
|
@@ -10477,7 +10553,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10477
10553
|
logger$7.error('WebRTC close, unregister error', e);
|
|
10478
10554
|
}
|
|
10479
10555
|
|
|
10480
|
-
this.client.close();
|
|
10556
|
+
this.client.close(force);
|
|
10481
10557
|
this.unbind();
|
|
10482
10558
|
|
|
10483
10559
|
this.incomingSessions = [];
|
|
@@ -10603,6 +10679,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10603
10679
|
}
|
|
10604
10680
|
|
|
10605
10681
|
callSession.creationTime = new Date();
|
|
10682
|
+
this._updateCallSession(callSession);
|
|
10683
|
+
|
|
10606
10684
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10607
10685
|
});
|
|
10608
10686
|
|
|
@@ -10646,6 +10724,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10646
10724
|
logger$7.info('WebRTC call rejected', session.id);
|
|
10647
10725
|
const callSession = this._createCallSession(session);
|
|
10648
10726
|
callSession.endTime = new Date();
|
|
10727
|
+
this._updateCallSession(callSession);
|
|
10728
|
+
|
|
10649
10729
|
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10650
10730
|
});
|
|
10651
10731
|
|
|
@@ -10870,6 +10950,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10870
10950
|
displayName: identity ? identity.displayName || number : number,
|
|
10871
10951
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10872
10952
|
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10953
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
10873
10954
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10874
10955
|
answered: state === SessionState.Established,
|
|
10875
10956
|
paused: this.client.isCallHeld(sipSession),
|
package/esm/service/CallApi.js
CHANGED
|
@@ -4016,6 +4016,34 @@ class IndirectTransfer {
|
|
|
4016
4016
|
}
|
|
4017
4017
|
}
|
|
4018
4018
|
|
|
4019
|
+
//
|
|
4020
|
+
|
|
4021
|
+
|
|
4022
|
+
|
|
4023
|
+
|
|
4024
|
+
|
|
4025
|
+
class MeetingStatus {
|
|
4026
|
+
|
|
4027
|
+
|
|
4028
|
+
|
|
4029
|
+
|
|
4030
|
+
constructor({
|
|
4031
|
+
full,
|
|
4032
|
+
} = {}) {
|
|
4033
|
+
this.full = full;
|
|
4034
|
+
|
|
4035
|
+
// Useful to compare instead of instanceof with minified code
|
|
4036
|
+
this.type = 'MeetingStatus';
|
|
4037
|
+
}
|
|
4038
|
+
|
|
4039
|
+
static parse(plain ) {
|
|
4040
|
+
return new MeetingStatus({
|
|
4041
|
+
full: plain.full,
|
|
4042
|
+
});
|
|
4043
|
+
}
|
|
4044
|
+
|
|
4045
|
+
}
|
|
4046
|
+
|
|
4019
4047
|
/* */
|
|
4020
4048
|
|
|
4021
4049
|
|
|
@@ -4210,6 +4238,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4210
4238
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4211
4239
|
ApiRequester.successResponseParser),
|
|
4212
4240
|
|
|
4241
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4242
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4213
4243
|
});
|
|
4214
4244
|
|
|
4215
4245
|
//
|