@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
package/esm/simple/Phone.js
CHANGED
|
@@ -248,6 +248,7 @@ var updateFrom = (instance , from ) => {
|
|
|
248
248
|
|
|
249
249
|
|
|
250
250
|
|
|
251
|
+
|
|
251
252
|
|
|
252
253
|
|
|
253
254
|
|
|
@@ -295,14 +296,14 @@ class CallSession {
|
|
|
295
296
|
|
|
296
297
|
|
|
297
298
|
|
|
299
|
+
// = creationTime
|
|
300
|
+
|
|
298
301
|
|
|
299
302
|
|
|
300
303
|
|
|
301
304
|
|
|
302
305
|
|
|
303
306
|
|
|
304
|
-
|
|
305
|
-
|
|
306
307
|
|
|
307
308
|
|
|
308
309
|
|
|
@@ -366,6 +367,7 @@ class CallSession {
|
|
|
366
367
|
recordingPaused,
|
|
367
368
|
videoRemotelyDowngraded,
|
|
368
369
|
sipSession,
|
|
370
|
+
answerTime,
|
|
369
371
|
} ) {
|
|
370
372
|
this.callId = callId;
|
|
371
373
|
this.sipCallId = sipCallId;
|
|
@@ -393,6 +395,7 @@ class CallSession {
|
|
|
393
395
|
this.recordingPaused = recordingPaused || false;
|
|
394
396
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
395
397
|
this.sipSession = sipSession;
|
|
398
|
+
this.answerTime = answerTime || this.answerTime;
|
|
396
399
|
|
|
397
400
|
// Useful to compare instead of instanceof with minified code
|
|
398
401
|
this.type = 'CallSession';
|
|
@@ -423,7 +426,7 @@ class CallSession {
|
|
|
423
426
|
}
|
|
424
427
|
|
|
425
428
|
answer() {
|
|
426
|
-
this.
|
|
429
|
+
this.answerTime = new Date();
|
|
427
430
|
}
|
|
428
431
|
|
|
429
432
|
systemAnswer() {
|
|
@@ -579,6 +582,15 @@ class CallSession {
|
|
|
579
582
|
return newFrom(callSession, CallSession);
|
|
580
583
|
}
|
|
581
584
|
|
|
585
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
586
|
+
set answered(value ) {
|
|
587
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
get answered() {
|
|
591
|
+
return !!this.answerTime;
|
|
592
|
+
}
|
|
593
|
+
|
|
582
594
|
static parseCall(call ) {
|
|
583
595
|
return new CallSession({
|
|
584
596
|
callId: call.id,
|
|
@@ -4830,6 +4842,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4830
4842
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4831
4843
|
});
|
|
4832
4844
|
|
|
4845
|
+
//
|
|
4846
|
+
|
|
4847
|
+
|
|
4848
|
+
|
|
4849
|
+
|
|
4850
|
+
|
|
4851
|
+
class MeetingStatus {
|
|
4852
|
+
|
|
4853
|
+
|
|
4854
|
+
|
|
4855
|
+
|
|
4856
|
+
constructor({
|
|
4857
|
+
full,
|
|
4858
|
+
} = {}) {
|
|
4859
|
+
this.full = full;
|
|
4860
|
+
|
|
4861
|
+
// Useful to compare instead of instanceof with minified code
|
|
4862
|
+
this.type = 'MeetingStatus';
|
|
4863
|
+
}
|
|
4864
|
+
|
|
4865
|
+
static parse(plain ) {
|
|
4866
|
+
return new MeetingStatus({
|
|
4867
|
+
full: plain.full,
|
|
4868
|
+
});
|
|
4869
|
+
}
|
|
4870
|
+
|
|
4871
|
+
}
|
|
4872
|
+
|
|
4833
4873
|
/* */
|
|
4834
4874
|
|
|
4835
4875
|
|
|
@@ -5024,6 +5064,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
5024
5064
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
5025
5065
|
ApiRequester.successResponseParser),
|
|
5026
5066
|
|
|
5067
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
5068
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
5027
5069
|
});
|
|
5028
5070
|
|
|
5029
5071
|
//
|
|
@@ -6361,6 +6403,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
6361
6403
|
|
|
6362
6404
|
|
|
6363
6405
|
|
|
6406
|
+
|
|
6364
6407
|
|
|
6365
6408
|
|
|
6366
6409
|
|
|
@@ -6402,6 +6445,7 @@ class WebRTCClient extends Emitter {
|
|
|
6402
6445
|
|
|
6403
6446
|
|
|
6404
6447
|
|
|
6448
|
+
|
|
6405
6449
|
|
|
6406
6450
|
// sugar
|
|
6407
6451
|
|
|
@@ -6464,6 +6508,7 @@ class WebRTCClient extends Emitter {
|
|
|
6464
6508
|
this.conferences = {};
|
|
6465
6509
|
this.networkMonitoringInterval = {};
|
|
6466
6510
|
this.sessionNetworkStats = {};
|
|
6511
|
+
this.forceClosed = false;
|
|
6467
6512
|
|
|
6468
6513
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
6469
6514
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -6585,6 +6630,8 @@ class WebRTCClient extends Emitter {
|
|
|
6585
6630
|
skipRegister: this.skipRegister,
|
|
6586
6631
|
};
|
|
6587
6632
|
|
|
6633
|
+
this.forceClosed = false;
|
|
6634
|
+
|
|
6588
6635
|
if (this.skipRegister) {
|
|
6589
6636
|
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6590
6637
|
return Promise.resolve();
|
|
@@ -6609,7 +6656,15 @@ class WebRTCClient extends Emitter {
|
|
|
6609
6656
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6610
6657
|
|
|
6611
6658
|
const onRegisterFailed = () => {
|
|
6612
|
-
logger$9.info('sdk webrtc registering failed', {
|
|
6659
|
+
logger$9.info('sdk webrtc registering failed', {
|
|
6660
|
+
tries,
|
|
6661
|
+
registerer: !!this.registerer,
|
|
6662
|
+
forceClosed: this.forceClosed,
|
|
6663
|
+
});
|
|
6664
|
+
if (this.forceClosed) {
|
|
6665
|
+
return;
|
|
6666
|
+
}
|
|
6667
|
+
|
|
6613
6668
|
this.connectionPromise = null;
|
|
6614
6669
|
if (this.registerer && this.registerer.waiting) {
|
|
6615
6670
|
this.registerer.waitingToggle(false);
|
|
@@ -6887,8 +6942,9 @@ class WebRTCClient extends Emitter {
|
|
|
6887
6942
|
}
|
|
6888
6943
|
}
|
|
6889
6944
|
|
|
6890
|
-
async close() {
|
|
6891
|
-
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6945
|
+
async close(force = false) {
|
|
6946
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
6947
|
+
this.forceClosed = force;
|
|
6892
6948
|
this._cleanupMedia();
|
|
6893
6949
|
this.connectionPromise = null;
|
|
6894
6950
|
|
|
@@ -6907,7 +6963,7 @@ class WebRTCClient extends Emitter {
|
|
|
6907
6963
|
this.userAgent.delegate = null;
|
|
6908
6964
|
this.userAgent.stateChange.removeAllListeners();
|
|
6909
6965
|
|
|
6910
|
-
await this._disconnectTransport();
|
|
6966
|
+
await this._disconnectTransport(force);
|
|
6911
6967
|
|
|
6912
6968
|
this._cleanupRegister();
|
|
6913
6969
|
|
|
@@ -7977,6 +8033,13 @@ class WebRTCClient extends Emitter {
|
|
|
7977
8033
|
}
|
|
7978
8034
|
|
|
7979
8035
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
8036
|
+
let { host } = this.config;
|
|
8037
|
+
let port = this.config.port || 443;
|
|
8038
|
+
|
|
8039
|
+
if (this.config.websocketSip) {
|
|
8040
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
8041
|
+
}
|
|
8042
|
+
|
|
7980
8043
|
const config = {
|
|
7981
8044
|
authorizationUsername: this.config.authorizationUser,
|
|
7982
8045
|
authorizationPassword: this.config.password,
|
|
@@ -8012,7 +8075,7 @@ class WebRTCClient extends Emitter {
|
|
|
8012
8075
|
},
|
|
8013
8076
|
transportOptions: {
|
|
8014
8077
|
traceSip: configOverrides.traceSip || false,
|
|
8015
|
-
wsServers: `wss://${
|
|
8078
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
8016
8079
|
},
|
|
8017
8080
|
sessionDescriptionHandlerFactoryOptions: {
|
|
8018
8081
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -8336,7 +8399,15 @@ class WebRTCClient extends Emitter {
|
|
|
8336
8399
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
8337
8400
|
}
|
|
8338
8401
|
|
|
8339
|
-
async _disconnectTransport() {
|
|
8402
|
+
async _disconnectTransport(force = false) {
|
|
8403
|
+
if (force) {
|
|
8404
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8405
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
8406
|
+
// eslint-disable-next-line
|
|
8407
|
+
this.userAgent.transport._ws.close(1000);
|
|
8408
|
+
return;
|
|
8409
|
+
}
|
|
8410
|
+
|
|
8340
8411
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
8341
8412
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
8342
8413
|
try {
|
|
@@ -9072,6 +9143,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9072
9143
|
this.removeIncomingSessions(sipSessionId);
|
|
9073
9144
|
}
|
|
9074
9145
|
|
|
9146
|
+
callSession.answerTime = new Date();
|
|
9147
|
+
this._updateCallSession(callSession);
|
|
9075
9148
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9076
9149
|
|
|
9077
9150
|
return callSession;
|
|
@@ -9287,6 +9360,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9287
9360
|
}
|
|
9288
9361
|
|
|
9289
9362
|
this.shouldSendReinvite = false;
|
|
9363
|
+
callSession.answerTime = new Date();
|
|
9364
|
+
this._updateCallSession(callSession);
|
|
9290
9365
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9291
9366
|
|
|
9292
9367
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -9386,7 +9461,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9386
9461
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9387
9462
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9388
9463
|
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9389
|
-
this.holdSipSession(this.currentSipSession,
|
|
9464
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
9390
9465
|
}
|
|
9391
9466
|
|
|
9392
9467
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -9597,6 +9672,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9597
9672
|
}
|
|
9598
9673
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9599
9674
|
callSession.creationTime = new Date();
|
|
9675
|
+
this._updateCallSession(callSession);
|
|
9600
9676
|
|
|
9601
9677
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9602
9678
|
|
|
@@ -9738,7 +9814,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9738
9814
|
return this.client && this.client.isConference(callSession.sipCallId);
|
|
9739
9815
|
}
|
|
9740
9816
|
|
|
9741
|
-
async close() {
|
|
9817
|
+
async close(force = false) {
|
|
9742
9818
|
logger$8.info('WebRTC close');
|
|
9743
9819
|
|
|
9744
9820
|
try {
|
|
@@ -9750,7 +9826,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9750
9826
|
logger$8.error('WebRTC close, unregister error', e);
|
|
9751
9827
|
}
|
|
9752
9828
|
|
|
9753
|
-
this.client.close();
|
|
9829
|
+
this.client.close(force);
|
|
9754
9830
|
this.unbind();
|
|
9755
9831
|
|
|
9756
9832
|
this.incomingSessions = [];
|
|
@@ -9876,6 +9952,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9876
9952
|
}
|
|
9877
9953
|
|
|
9878
9954
|
callSession.creationTime = new Date();
|
|
9955
|
+
this._updateCallSession(callSession);
|
|
9956
|
+
|
|
9879
9957
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
9880
9958
|
});
|
|
9881
9959
|
|
|
@@ -9919,6 +9997,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9919
9997
|
logger$8.info('WebRTC call rejected', session.id);
|
|
9920
9998
|
const callSession = this._createCallSession(session);
|
|
9921
9999
|
callSession.endTime = new Date();
|
|
10000
|
+
this._updateCallSession(callSession);
|
|
10001
|
+
|
|
9922
10002
|
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
9923
10003
|
});
|
|
9924
10004
|
|
|
@@ -10143,6 +10223,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10143
10223
|
displayName: identity ? identity.displayName || number : number,
|
|
10144
10224
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10145
10225
|
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10226
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
10146
10227
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10147
10228
|
answered: state === SessionState.Established,
|
|
10148
10229
|
paused: this.client.isCallHeld(sipSession),
|
package/esm/simple/index.js
CHANGED
|
@@ -3248,6 +3248,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3248
3248
|
|
|
3249
3249
|
|
|
3250
3250
|
|
|
3251
|
+
|
|
3251
3252
|
|
|
3252
3253
|
|
|
3253
3254
|
|
|
@@ -3295,14 +3296,14 @@ class CallSession {
|
|
|
3295
3296
|
|
|
3296
3297
|
|
|
3297
3298
|
|
|
3299
|
+
// = creationTime
|
|
3300
|
+
|
|
3298
3301
|
|
|
3299
3302
|
|
|
3300
3303
|
|
|
3301
3304
|
|
|
3302
3305
|
|
|
3303
3306
|
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
3307
|
|
|
3307
3308
|
|
|
3308
3309
|
|
|
@@ -3366,6 +3367,7 @@ class CallSession {
|
|
|
3366
3367
|
recordingPaused,
|
|
3367
3368
|
videoRemotelyDowngraded,
|
|
3368
3369
|
sipSession,
|
|
3370
|
+
answerTime,
|
|
3369
3371
|
} ) {
|
|
3370
3372
|
this.callId = callId;
|
|
3371
3373
|
this.sipCallId = sipCallId;
|
|
@@ -3393,6 +3395,7 @@ class CallSession {
|
|
|
3393
3395
|
this.recordingPaused = recordingPaused || false;
|
|
3394
3396
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3395
3397
|
this.sipSession = sipSession;
|
|
3398
|
+
this.answerTime = answerTime || this.answerTime;
|
|
3396
3399
|
|
|
3397
3400
|
// Useful to compare instead of instanceof with minified code
|
|
3398
3401
|
this.type = 'CallSession';
|
|
@@ -3423,7 +3426,7 @@ class CallSession {
|
|
|
3423
3426
|
}
|
|
3424
3427
|
|
|
3425
3428
|
answer() {
|
|
3426
|
-
this.
|
|
3429
|
+
this.answerTime = new Date();
|
|
3427
3430
|
}
|
|
3428
3431
|
|
|
3429
3432
|
systemAnswer() {
|
|
@@ -3579,6 +3582,15 @@ class CallSession {
|
|
|
3579
3582
|
return newFrom(callSession, CallSession);
|
|
3580
3583
|
}
|
|
3581
3584
|
|
|
3585
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
3586
|
+
set answered(value ) {
|
|
3587
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
get answered() {
|
|
3591
|
+
return !!this.answerTime;
|
|
3592
|
+
}
|
|
3593
|
+
|
|
3582
3594
|
static parseCall(call ) {
|
|
3583
3595
|
return new CallSession({
|
|
3584
3596
|
callId: call.id,
|
|
@@ -4830,6 +4842,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4830
4842
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4831
4843
|
});
|
|
4832
4844
|
|
|
4845
|
+
//
|
|
4846
|
+
|
|
4847
|
+
|
|
4848
|
+
|
|
4849
|
+
|
|
4850
|
+
|
|
4851
|
+
class MeetingStatus {
|
|
4852
|
+
|
|
4853
|
+
|
|
4854
|
+
|
|
4855
|
+
|
|
4856
|
+
constructor({
|
|
4857
|
+
full,
|
|
4858
|
+
} = {}) {
|
|
4859
|
+
this.full = full;
|
|
4860
|
+
|
|
4861
|
+
// Useful to compare instead of instanceof with minified code
|
|
4862
|
+
this.type = 'MeetingStatus';
|
|
4863
|
+
}
|
|
4864
|
+
|
|
4865
|
+
static parse(plain ) {
|
|
4866
|
+
return new MeetingStatus({
|
|
4867
|
+
full: plain.full,
|
|
4868
|
+
});
|
|
4869
|
+
}
|
|
4870
|
+
|
|
4871
|
+
}
|
|
4872
|
+
|
|
4833
4873
|
/* */
|
|
4834
4874
|
|
|
4835
4875
|
|
|
@@ -5024,6 +5064,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
5024
5064
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
5025
5065
|
ApiRequester.successResponseParser),
|
|
5026
5066
|
|
|
5067
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
5068
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
5027
5069
|
});
|
|
5028
5070
|
|
|
5029
5071
|
//
|
|
@@ -6625,6 +6667,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
6625
6667
|
|
|
6626
6668
|
|
|
6627
6669
|
|
|
6670
|
+
|
|
6628
6671
|
|
|
6629
6672
|
|
|
6630
6673
|
|
|
@@ -6666,6 +6709,7 @@ class WebRTCClient extends Emitter {
|
|
|
6666
6709
|
|
|
6667
6710
|
|
|
6668
6711
|
|
|
6712
|
+
|
|
6669
6713
|
|
|
6670
6714
|
// sugar
|
|
6671
6715
|
|
|
@@ -6728,6 +6772,7 @@ class WebRTCClient extends Emitter {
|
|
|
6728
6772
|
this.conferences = {};
|
|
6729
6773
|
this.networkMonitoringInterval = {};
|
|
6730
6774
|
this.sessionNetworkStats = {};
|
|
6775
|
+
this.forceClosed = false;
|
|
6731
6776
|
|
|
6732
6777
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
6733
6778
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -6849,6 +6894,8 @@ class WebRTCClient extends Emitter {
|
|
|
6849
6894
|
skipRegister: this.skipRegister,
|
|
6850
6895
|
};
|
|
6851
6896
|
|
|
6897
|
+
this.forceClosed = false;
|
|
6898
|
+
|
|
6852
6899
|
if (this.skipRegister) {
|
|
6853
6900
|
logger$8.info('sdk webrtc skip register...', logInfo);
|
|
6854
6901
|
return Promise.resolve();
|
|
@@ -6873,7 +6920,15 @@ class WebRTCClient extends Emitter {
|
|
|
6873
6920
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6874
6921
|
|
|
6875
6922
|
const onRegisterFailed = () => {
|
|
6876
|
-
logger$8.info('sdk webrtc registering failed', {
|
|
6923
|
+
logger$8.info('sdk webrtc registering failed', {
|
|
6924
|
+
tries,
|
|
6925
|
+
registerer: !!this.registerer,
|
|
6926
|
+
forceClosed: this.forceClosed,
|
|
6927
|
+
});
|
|
6928
|
+
if (this.forceClosed) {
|
|
6929
|
+
return;
|
|
6930
|
+
}
|
|
6931
|
+
|
|
6877
6932
|
this.connectionPromise = null;
|
|
6878
6933
|
if (this.registerer && this.registerer.waiting) {
|
|
6879
6934
|
this.registerer.waitingToggle(false);
|
|
@@ -7151,8 +7206,9 @@ class WebRTCClient extends Emitter {
|
|
|
7151
7206
|
}
|
|
7152
7207
|
}
|
|
7153
7208
|
|
|
7154
|
-
async close() {
|
|
7155
|
-
logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7209
|
+
async close(force = false) {
|
|
7210
|
+
logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
7211
|
+
this.forceClosed = force;
|
|
7156
7212
|
this._cleanupMedia();
|
|
7157
7213
|
this.connectionPromise = null;
|
|
7158
7214
|
|
|
@@ -7171,7 +7227,7 @@ class WebRTCClient extends Emitter {
|
|
|
7171
7227
|
this.userAgent.delegate = null;
|
|
7172
7228
|
this.userAgent.stateChange.removeAllListeners();
|
|
7173
7229
|
|
|
7174
|
-
await this._disconnectTransport();
|
|
7230
|
+
await this._disconnectTransport(force);
|
|
7175
7231
|
|
|
7176
7232
|
this._cleanupRegister();
|
|
7177
7233
|
|
|
@@ -8241,6 +8297,13 @@ class WebRTCClient extends Emitter {
|
|
|
8241
8297
|
}
|
|
8242
8298
|
|
|
8243
8299
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
8300
|
+
let { host } = this.config;
|
|
8301
|
+
let port = this.config.port || 443;
|
|
8302
|
+
|
|
8303
|
+
if (this.config.websocketSip) {
|
|
8304
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
8305
|
+
}
|
|
8306
|
+
|
|
8244
8307
|
const config = {
|
|
8245
8308
|
authorizationUsername: this.config.authorizationUser,
|
|
8246
8309
|
authorizationPassword: this.config.password,
|
|
@@ -8276,7 +8339,7 @@ class WebRTCClient extends Emitter {
|
|
|
8276
8339
|
},
|
|
8277
8340
|
transportOptions: {
|
|
8278
8341
|
traceSip: configOverrides.traceSip || false,
|
|
8279
|
-
wsServers: `wss://${
|
|
8342
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
8280
8343
|
},
|
|
8281
8344
|
sessionDescriptionHandlerFactoryOptions: {
|
|
8282
8345
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -8600,7 +8663,15 @@ class WebRTCClient extends Emitter {
|
|
|
8600
8663
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
8601
8664
|
}
|
|
8602
8665
|
|
|
8603
|
-
async _disconnectTransport() {
|
|
8666
|
+
async _disconnectTransport(force = false) {
|
|
8667
|
+
if (force) {
|
|
8668
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8669
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
8670
|
+
// eslint-disable-next-line
|
|
8671
|
+
this.userAgent.transport._ws.close(1000);
|
|
8672
|
+
return;
|
|
8673
|
+
}
|
|
8674
|
+
|
|
8604
8675
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
8605
8676
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
8606
8677
|
try {
|
|
@@ -9336,6 +9407,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9336
9407
|
this.removeIncomingSessions(sipSessionId);
|
|
9337
9408
|
}
|
|
9338
9409
|
|
|
9410
|
+
callSession.answerTime = new Date();
|
|
9411
|
+
this._updateCallSession(callSession);
|
|
9339
9412
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9340
9413
|
|
|
9341
9414
|
return callSession;
|
|
@@ -9551,6 +9624,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9551
9624
|
}
|
|
9552
9625
|
|
|
9553
9626
|
this.shouldSendReinvite = false;
|
|
9627
|
+
callSession.answerTime = new Date();
|
|
9628
|
+
this._updateCallSession(callSession);
|
|
9554
9629
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9555
9630
|
|
|
9556
9631
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -9650,7 +9725,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9650
9725
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9651
9726
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9652
9727
|
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9653
|
-
this.holdSipSession(this.currentSipSession,
|
|
9728
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
9654
9729
|
}
|
|
9655
9730
|
|
|
9656
9731
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -9861,6 +9936,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9861
9936
|
}
|
|
9862
9937
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9863
9938
|
callSession.creationTime = new Date();
|
|
9939
|
+
this._updateCallSession(callSession);
|
|
9864
9940
|
|
|
9865
9941
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9866
9942
|
|
|
@@ -10002,7 +10078,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10002
10078
|
return this.client && this.client.isConference(callSession.sipCallId);
|
|
10003
10079
|
}
|
|
10004
10080
|
|
|
10005
|
-
async close() {
|
|
10081
|
+
async close(force = false) {
|
|
10006
10082
|
logger$7.info('WebRTC close');
|
|
10007
10083
|
|
|
10008
10084
|
try {
|
|
@@ -10014,7 +10090,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10014
10090
|
logger$7.error('WebRTC close, unregister error', e);
|
|
10015
10091
|
}
|
|
10016
10092
|
|
|
10017
|
-
this.client.close();
|
|
10093
|
+
this.client.close(force);
|
|
10018
10094
|
this.unbind();
|
|
10019
10095
|
|
|
10020
10096
|
this.incomingSessions = [];
|
|
@@ -10140,6 +10216,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10140
10216
|
}
|
|
10141
10217
|
|
|
10142
10218
|
callSession.creationTime = new Date();
|
|
10219
|
+
this._updateCallSession(callSession);
|
|
10220
|
+
|
|
10143
10221
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10144
10222
|
});
|
|
10145
10223
|
|
|
@@ -10183,6 +10261,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10183
10261
|
logger$7.info('WebRTC call rejected', session.id);
|
|
10184
10262
|
const callSession = this._createCallSession(session);
|
|
10185
10263
|
callSession.endTime = new Date();
|
|
10264
|
+
this._updateCallSession(callSession);
|
|
10265
|
+
|
|
10186
10266
|
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10187
10267
|
});
|
|
10188
10268
|
|
|
@@ -10407,6 +10487,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10407
10487
|
displayName: identity ? identity.displayName || number : number,
|
|
10408
10488
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10409
10489
|
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10490
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
10410
10491
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10411
10492
|
answered: state === SessionState.Established,
|
|
10412
10493
|
paused: this.client.isCallHeld(sipSession),
|