@wazo/sdk 0.37.29 → 0.37.33
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 +9 -1
- package/esm/domain/Features.js +30 -0
- package/esm/domain/MeetingStatus.js +29 -0
- package/esm/domain/Phone/CTIPhone.js +39 -1
- package/esm/domain/Phone/WebRTCPhone.js +20 -4
- package/esm/domain/__tests__/CallSession.test.js +41 -5
- package/esm/domain/__tests__/IndirectTransfer.test.js +9 -1
- package/esm/domain/__tests__/Room.test.js +9 -1
- package/esm/index.js +85 -10
- package/esm/service/CallApi.js +30 -0
- package/esm/service/getApiClient.js +30 -0
- package/esm/simple/Auth.js +85 -10
- package/esm/simple/Configuration.js +85 -10
- package/esm/simple/Directory.js +30 -0
- package/esm/simple/Phone.js +85 -10
- package/esm/simple/index.js +85 -10
- package/esm/simple/room/LocalParticipant.js +85 -10
- package/esm/simple/room/Participant.js +85 -10
- package/esm/simple/room/RemoteParticipant.js +85 -10
- package/esm/simple/room/Room.js +85 -10
- package/esm/simple/room/SipRoom.js +85 -10
- package/esm/simple/room/Stream.js +85 -10
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +85 -10
- package/esm/simple/utils.js +85 -10
- 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 +9 -1
- package/lib/domain/Features.js +30 -0
- package/lib/domain/MeetingStatus.js +31 -0
- package/lib/domain/Phone/CTIPhone.js +39 -1
- package/lib/domain/Phone/WebRTCPhone.js +20 -4
- package/lib/domain/__tests__/CallSession.test.js +41 -5
- package/lib/domain/__tests__/IndirectTransfer.test.js +9 -1
- package/lib/domain/__tests__/Room.test.js +9 -1
- package/lib/index.js +85 -10
- package/lib/service/CallApi.js +30 -0
- package/lib/service/getApiClient.js +30 -0
- package/lib/simple/Auth.js +85 -10
- package/lib/simple/Configuration.js +85 -10
- package/lib/simple/Directory.js +30 -0
- package/lib/simple/Phone.js +85 -10
- package/lib/simple/index.js +85 -10
- package/lib/simple/room/LocalParticipant.js +85 -10
- package/lib/simple/room/Participant.js +85 -10
- package/lib/simple/room/RemoteParticipant.js +85 -10
- package/lib/simple/room/Room.js +85 -10
- package/lib/simple/room/SipRoom.js +85 -10
- package/lib/simple/room/Stream.js +85 -10
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +85 -10
- package/lib/simple/utils.js +85 -10
- 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 +9 -1
- package/src/domain/MeetingStatus.js +27 -0
- package/src/domain/Phone/WebRTCPhone.js +11 -3
- package/src/domain/__tests__/CallSession.test.js +32 -4
- package/src/web-rtc-client.js +35 -6
package/esm/simple/utils.js
CHANGED
|
@@ -3584,13 +3584,21 @@ class CallSession {
|
|
|
3584
3584
|
|
|
3585
3585
|
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
3586
3586
|
set answered(value ) {
|
|
3587
|
-
this.answerTime = value ? new Date() : null;
|
|
3587
|
+
this.answerTime = value ? this.answerTime || new Date() : null;
|
|
3588
3588
|
}
|
|
3589
3589
|
|
|
3590
3590
|
get answered() {
|
|
3591
3591
|
return !!this.answerTime;
|
|
3592
3592
|
}
|
|
3593
3593
|
|
|
3594
|
+
toJSON() {
|
|
3595
|
+
const jsonObj = { ...this };
|
|
3596
|
+
// $FlowFixMe
|
|
3597
|
+
jsonObj.answered = this.answered;
|
|
3598
|
+
|
|
3599
|
+
return jsonObj;
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3594
3602
|
static parseCall(call ) {
|
|
3595
3603
|
return new CallSession({
|
|
3596
3604
|
callId: call.id,
|
|
@@ -4842,6 +4850,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4842
4850
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4843
4851
|
});
|
|
4844
4852
|
|
|
4853
|
+
//
|
|
4854
|
+
|
|
4855
|
+
|
|
4856
|
+
|
|
4857
|
+
|
|
4858
|
+
|
|
4859
|
+
class MeetingStatus {
|
|
4860
|
+
|
|
4861
|
+
|
|
4862
|
+
|
|
4863
|
+
|
|
4864
|
+
constructor({
|
|
4865
|
+
full,
|
|
4866
|
+
} = {}) {
|
|
4867
|
+
this.full = full;
|
|
4868
|
+
|
|
4869
|
+
// Useful to compare instead of instanceof with minified code
|
|
4870
|
+
this.type = 'MeetingStatus';
|
|
4871
|
+
}
|
|
4872
|
+
|
|
4873
|
+
static parse(plain ) {
|
|
4874
|
+
return new MeetingStatus({
|
|
4875
|
+
full: plain.full,
|
|
4876
|
+
});
|
|
4877
|
+
}
|
|
4878
|
+
|
|
4879
|
+
}
|
|
4880
|
+
|
|
4845
4881
|
/* */
|
|
4846
4882
|
|
|
4847
4883
|
|
|
@@ -5036,6 +5072,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
5036
5072
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
5037
5073
|
ApiRequester.successResponseParser),
|
|
5038
5074
|
|
|
5075
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
5076
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
5039
5077
|
});
|
|
5040
5078
|
|
|
5041
5079
|
//
|
|
@@ -6637,6 +6675,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
6637
6675
|
|
|
6638
6676
|
|
|
6639
6677
|
|
|
6678
|
+
|
|
6640
6679
|
|
|
6641
6680
|
|
|
6642
6681
|
|
|
@@ -6678,6 +6717,7 @@ class WebRTCClient extends Emitter {
|
|
|
6678
6717
|
|
|
6679
6718
|
|
|
6680
6719
|
|
|
6720
|
+
|
|
6681
6721
|
|
|
6682
6722
|
// sugar
|
|
6683
6723
|
|
|
@@ -6740,6 +6780,7 @@ class WebRTCClient extends Emitter {
|
|
|
6740
6780
|
this.conferences = {};
|
|
6741
6781
|
this.networkMonitoringInterval = {};
|
|
6742
6782
|
this.sessionNetworkStats = {};
|
|
6783
|
+
this.forceClosed = false;
|
|
6743
6784
|
|
|
6744
6785
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
6745
6786
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -6861,6 +6902,8 @@ class WebRTCClient extends Emitter {
|
|
|
6861
6902
|
skipRegister: this.skipRegister,
|
|
6862
6903
|
};
|
|
6863
6904
|
|
|
6905
|
+
this.forceClosed = false;
|
|
6906
|
+
|
|
6864
6907
|
if (this.skipRegister) {
|
|
6865
6908
|
logger$8.info('sdk webrtc skip register...', logInfo);
|
|
6866
6909
|
return Promise.resolve();
|
|
@@ -6885,7 +6928,15 @@ class WebRTCClient extends Emitter {
|
|
|
6885
6928
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6886
6929
|
|
|
6887
6930
|
const onRegisterFailed = () => {
|
|
6888
|
-
logger$8.info('sdk webrtc registering failed', {
|
|
6931
|
+
logger$8.info('sdk webrtc registering failed', {
|
|
6932
|
+
tries,
|
|
6933
|
+
registerer: !!this.registerer,
|
|
6934
|
+
forceClosed: this.forceClosed,
|
|
6935
|
+
});
|
|
6936
|
+
if (this.forceClosed) {
|
|
6937
|
+
return;
|
|
6938
|
+
}
|
|
6939
|
+
|
|
6889
6940
|
this.connectionPromise = null;
|
|
6890
6941
|
if (this.registerer && this.registerer.waiting) {
|
|
6891
6942
|
this.registerer.waitingToggle(false);
|
|
@@ -7163,8 +7214,9 @@ class WebRTCClient extends Emitter {
|
|
|
7163
7214
|
}
|
|
7164
7215
|
}
|
|
7165
7216
|
|
|
7166
|
-
async close() {
|
|
7167
|
-
logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7217
|
+
async close(force = false) {
|
|
7218
|
+
logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
7219
|
+
this.forceClosed = force;
|
|
7168
7220
|
this._cleanupMedia();
|
|
7169
7221
|
this.connectionPromise = null;
|
|
7170
7222
|
|
|
@@ -7183,7 +7235,7 @@ class WebRTCClient extends Emitter {
|
|
|
7183
7235
|
this.userAgent.delegate = null;
|
|
7184
7236
|
this.userAgent.stateChange.removeAllListeners();
|
|
7185
7237
|
|
|
7186
|
-
await this._disconnectTransport();
|
|
7238
|
+
await this._disconnectTransport(force);
|
|
7187
7239
|
|
|
7188
7240
|
this._cleanupRegister();
|
|
7189
7241
|
|
|
@@ -8253,6 +8305,13 @@ class WebRTCClient extends Emitter {
|
|
|
8253
8305
|
}
|
|
8254
8306
|
|
|
8255
8307
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
8308
|
+
let { host } = this.config;
|
|
8309
|
+
let port = this.config.port || 443;
|
|
8310
|
+
|
|
8311
|
+
if (this.config.websocketSip) {
|
|
8312
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
8313
|
+
}
|
|
8314
|
+
|
|
8256
8315
|
const config = {
|
|
8257
8316
|
authorizationUsername: this.config.authorizationUser,
|
|
8258
8317
|
authorizationPassword: this.config.password,
|
|
@@ -8288,7 +8347,7 @@ class WebRTCClient extends Emitter {
|
|
|
8288
8347
|
},
|
|
8289
8348
|
transportOptions: {
|
|
8290
8349
|
traceSip: configOverrides.traceSip || false,
|
|
8291
|
-
wsServers: `wss://${
|
|
8350
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
8292
8351
|
},
|
|
8293
8352
|
sessionDescriptionHandlerFactoryOptions: {
|
|
8294
8353
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -8612,7 +8671,15 @@ class WebRTCClient extends Emitter {
|
|
|
8612
8671
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
8613
8672
|
}
|
|
8614
8673
|
|
|
8615
|
-
async _disconnectTransport() {
|
|
8674
|
+
async _disconnectTransport(force = false) {
|
|
8675
|
+
if (force) {
|
|
8676
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8677
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
8678
|
+
// eslint-disable-next-line
|
|
8679
|
+
this.userAgent.transport._ws.close(1000);
|
|
8680
|
+
return;
|
|
8681
|
+
}
|
|
8682
|
+
|
|
8616
8683
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
8617
8684
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
8618
8685
|
try {
|
|
@@ -9349,6 +9416,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9349
9416
|
}
|
|
9350
9417
|
|
|
9351
9418
|
callSession.answerTime = new Date();
|
|
9419
|
+
this._updateCallSession(callSession);
|
|
9352
9420
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9353
9421
|
|
|
9354
9422
|
return callSession;
|
|
@@ -9565,6 +9633,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9565
9633
|
|
|
9566
9634
|
this.shouldSendReinvite = false;
|
|
9567
9635
|
callSession.answerTime = new Date();
|
|
9636
|
+
this._updateCallSession(callSession);
|
|
9568
9637
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9569
9638
|
|
|
9570
9639
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -9664,7 +9733,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9664
9733
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9665
9734
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9666
9735
|
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9667
|
-
this.holdSipSession(this.currentSipSession,
|
|
9736
|
+
this.holdSipSession(this.currentSipSession, this.currentCallSession);
|
|
9668
9737
|
}
|
|
9669
9738
|
|
|
9670
9739
|
const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
|
|
@@ -9875,6 +9944,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9875
9944
|
}
|
|
9876
9945
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9877
9946
|
callSession.creationTime = new Date();
|
|
9947
|
+
this._updateCallSession(callSession);
|
|
9878
9948
|
|
|
9879
9949
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9880
9950
|
|
|
@@ -10016,7 +10086,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10016
10086
|
return this.client && this.client.isConference(callSession.sipCallId);
|
|
10017
10087
|
}
|
|
10018
10088
|
|
|
10019
|
-
async close() {
|
|
10089
|
+
async close(force = false) {
|
|
10020
10090
|
logger$7.info('WebRTC close');
|
|
10021
10091
|
|
|
10022
10092
|
try {
|
|
@@ -10028,7 +10098,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10028
10098
|
logger$7.error('WebRTC close, unregister error', e);
|
|
10029
10099
|
}
|
|
10030
10100
|
|
|
10031
|
-
this.client.close();
|
|
10101
|
+
this.client.close(force);
|
|
10032
10102
|
this.unbind();
|
|
10033
10103
|
|
|
10034
10104
|
this.incomingSessions = [];
|
|
@@ -10154,6 +10224,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10154
10224
|
}
|
|
10155
10225
|
|
|
10156
10226
|
callSession.creationTime = new Date();
|
|
10227
|
+
this._updateCallSession(callSession);
|
|
10228
|
+
|
|
10157
10229
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10158
10230
|
});
|
|
10159
10231
|
|
|
@@ -10197,6 +10269,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10197
10269
|
logger$7.info('WebRTC call rejected', session.id);
|
|
10198
10270
|
const callSession = this._createCallSession(session);
|
|
10199
10271
|
callSession.endTime = new Date();
|
|
10272
|
+
this._updateCallSession(callSession);
|
|
10273
|
+
|
|
10200
10274
|
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10201
10275
|
});
|
|
10202
10276
|
|
|
@@ -10421,6 +10495,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10421
10495
|
displayName: identity ? identity.displayName || number : number,
|
|
10422
10496
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10423
10497
|
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10498
|
+
answerTime: fromSession ? fromSession.answerTime : null,
|
|
10424
10499
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10425
10500
|
answered: state === SessionState.Established,
|
|
10426
10501
|
paused: this.client.isCallHeld(sipSession),
|
package/esm/web-rtc-client.js
CHANGED
|
@@ -4579,6 +4579,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4579
4579
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4580
4580
|
});
|
|
4581
4581
|
|
|
4582
|
+
//
|
|
4583
|
+
|
|
4584
|
+
|
|
4585
|
+
|
|
4586
|
+
|
|
4587
|
+
|
|
4588
|
+
class MeetingStatus {
|
|
4589
|
+
|
|
4590
|
+
|
|
4591
|
+
|
|
4592
|
+
|
|
4593
|
+
constructor({
|
|
4594
|
+
full,
|
|
4595
|
+
} = {}) {
|
|
4596
|
+
this.full = full;
|
|
4597
|
+
|
|
4598
|
+
// Useful to compare instead of instanceof with minified code
|
|
4599
|
+
this.type = 'MeetingStatus';
|
|
4600
|
+
}
|
|
4601
|
+
|
|
4602
|
+
static parse(plain ) {
|
|
4603
|
+
return new MeetingStatus({
|
|
4604
|
+
full: plain.full,
|
|
4605
|
+
});
|
|
4606
|
+
}
|
|
4607
|
+
|
|
4608
|
+
}
|
|
4609
|
+
|
|
4582
4610
|
/* */
|
|
4583
4611
|
|
|
4584
4612
|
|
|
@@ -4773,6 +4801,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4773
4801
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4774
4802
|
ApiRequester.successResponseParser),
|
|
4775
4803
|
|
|
4804
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4805
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4776
4806
|
});
|
|
4777
4807
|
|
|
4778
4808
|
//
|
|
@@ -5347,6 +5377,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
5347
5377
|
|
|
5348
5378
|
|
|
5349
5379
|
|
|
5380
|
+
|
|
5350
5381
|
|
|
5351
5382
|
|
|
5352
5383
|
|
|
@@ -5388,6 +5419,7 @@ class WebRTCClient extends Emitter {
|
|
|
5388
5419
|
|
|
5389
5420
|
|
|
5390
5421
|
|
|
5422
|
+
|
|
5391
5423
|
|
|
5392
5424
|
// sugar
|
|
5393
5425
|
|
|
@@ -5450,6 +5482,7 @@ class WebRTCClient extends Emitter {
|
|
|
5450
5482
|
this.conferences = {};
|
|
5451
5483
|
this.networkMonitoringInterval = {};
|
|
5452
5484
|
this.sessionNetworkStats = {};
|
|
5485
|
+
this.forceClosed = false;
|
|
5453
5486
|
|
|
5454
5487
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
5455
5488
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -5571,6 +5604,8 @@ class WebRTCClient extends Emitter {
|
|
|
5571
5604
|
skipRegister: this.skipRegister,
|
|
5572
5605
|
};
|
|
5573
5606
|
|
|
5607
|
+
this.forceClosed = false;
|
|
5608
|
+
|
|
5574
5609
|
if (this.skipRegister) {
|
|
5575
5610
|
logger.info('sdk webrtc skip register...', logInfo);
|
|
5576
5611
|
return Promise.resolve();
|
|
@@ -5595,7 +5630,15 @@ class WebRTCClient extends Emitter {
|
|
|
5595
5630
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
5596
5631
|
|
|
5597
5632
|
const onRegisterFailed = () => {
|
|
5598
|
-
logger.info('sdk webrtc registering failed', {
|
|
5633
|
+
logger.info('sdk webrtc registering failed', {
|
|
5634
|
+
tries,
|
|
5635
|
+
registerer: !!this.registerer,
|
|
5636
|
+
forceClosed: this.forceClosed,
|
|
5637
|
+
});
|
|
5638
|
+
if (this.forceClosed) {
|
|
5639
|
+
return;
|
|
5640
|
+
}
|
|
5641
|
+
|
|
5599
5642
|
this.connectionPromise = null;
|
|
5600
5643
|
if (this.registerer && this.registerer.waiting) {
|
|
5601
5644
|
this.registerer.waitingToggle(false);
|
|
@@ -5873,8 +5916,9 @@ class WebRTCClient extends Emitter {
|
|
|
5873
5916
|
}
|
|
5874
5917
|
}
|
|
5875
5918
|
|
|
5876
|
-
async close() {
|
|
5877
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5919
|
+
async close(force = false) {
|
|
5920
|
+
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
5921
|
+
this.forceClosed = force;
|
|
5878
5922
|
this._cleanupMedia();
|
|
5879
5923
|
this.connectionPromise = null;
|
|
5880
5924
|
|
|
@@ -5893,7 +5937,7 @@ class WebRTCClient extends Emitter {
|
|
|
5893
5937
|
this.userAgent.delegate = null;
|
|
5894
5938
|
this.userAgent.stateChange.removeAllListeners();
|
|
5895
5939
|
|
|
5896
|
-
await this._disconnectTransport();
|
|
5940
|
+
await this._disconnectTransport(force);
|
|
5897
5941
|
|
|
5898
5942
|
this._cleanupRegister();
|
|
5899
5943
|
|
|
@@ -6963,6 +7007,13 @@ class WebRTCClient extends Emitter {
|
|
|
6963
7007
|
}
|
|
6964
7008
|
|
|
6965
7009
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
7010
|
+
let { host } = this.config;
|
|
7011
|
+
let port = this.config.port || 443;
|
|
7012
|
+
|
|
7013
|
+
if (this.config.websocketSip) {
|
|
7014
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
7015
|
+
}
|
|
7016
|
+
|
|
6966
7017
|
const config = {
|
|
6967
7018
|
authorizationUsername: this.config.authorizationUser,
|
|
6968
7019
|
authorizationPassword: this.config.password,
|
|
@@ -6998,7 +7049,7 @@ class WebRTCClient extends Emitter {
|
|
|
6998
7049
|
},
|
|
6999
7050
|
transportOptions: {
|
|
7000
7051
|
traceSip: configOverrides.traceSip || false,
|
|
7001
|
-
wsServers: `wss://${
|
|
7052
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
7002
7053
|
},
|
|
7003
7054
|
sessionDescriptionHandlerFactoryOptions: {
|
|
7004
7055
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -7322,7 +7373,15 @@ class WebRTCClient extends Emitter {
|
|
|
7322
7373
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
7323
7374
|
}
|
|
7324
7375
|
|
|
7325
|
-
async _disconnectTransport() {
|
|
7376
|
+
async _disconnectTransport(force = false) {
|
|
7377
|
+
if (force) {
|
|
7378
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7379
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
7380
|
+
// eslint-disable-next-line
|
|
7381
|
+
this.userAgent.transport._ws.close(1000);
|
|
7382
|
+
return;
|
|
7383
|
+
}
|
|
7384
|
+
|
|
7326
7385
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
7327
7386
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
7328
7387
|
try {
|
|
@@ -4037,6 +4037,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4037
4037
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4038
4038
|
});
|
|
4039
4039
|
|
|
4040
|
+
//
|
|
4041
|
+
|
|
4042
|
+
|
|
4043
|
+
|
|
4044
|
+
|
|
4045
|
+
|
|
4046
|
+
class MeetingStatus {
|
|
4047
|
+
|
|
4048
|
+
|
|
4049
|
+
|
|
4050
|
+
|
|
4051
|
+
constructor({
|
|
4052
|
+
full,
|
|
4053
|
+
} = {}) {
|
|
4054
|
+
this.full = full;
|
|
4055
|
+
|
|
4056
|
+
// Useful to compare instead of instanceof with minified code
|
|
4057
|
+
this.type = 'MeetingStatus';
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
static parse(plain ) {
|
|
4061
|
+
return new MeetingStatus({
|
|
4062
|
+
full: plain.full,
|
|
4063
|
+
});
|
|
4064
|
+
}
|
|
4065
|
+
|
|
4066
|
+
}
|
|
4067
|
+
|
|
4040
4068
|
/* */
|
|
4041
4069
|
|
|
4042
4070
|
|
|
@@ -4231,6 +4259,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4231
4259
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4232
4260
|
ApiRequester.successResponseParser),
|
|
4233
4261
|
|
|
4262
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4263
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4234
4264
|
});
|
|
4235
4265
|
|
|
4236
4266
|
//
|
|
@@ -4588,6 +4588,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4588
4588
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4589
4589
|
});
|
|
4590
4590
|
|
|
4591
|
+
//
|
|
4592
|
+
|
|
4593
|
+
|
|
4594
|
+
|
|
4595
|
+
|
|
4596
|
+
|
|
4597
|
+
class MeetingStatus {
|
|
4598
|
+
|
|
4599
|
+
|
|
4600
|
+
|
|
4601
|
+
|
|
4602
|
+
constructor({
|
|
4603
|
+
full,
|
|
4604
|
+
} = {}) {
|
|
4605
|
+
this.full = full;
|
|
4606
|
+
|
|
4607
|
+
// Useful to compare instead of instanceof with minified code
|
|
4608
|
+
this.type = 'MeetingStatus';
|
|
4609
|
+
}
|
|
4610
|
+
|
|
4611
|
+
static parse(plain ) {
|
|
4612
|
+
return new MeetingStatus({
|
|
4613
|
+
full: plain.full,
|
|
4614
|
+
});
|
|
4615
|
+
}
|
|
4616
|
+
|
|
4617
|
+
}
|
|
4618
|
+
|
|
4591
4619
|
/* */
|
|
4592
4620
|
|
|
4593
4621
|
|
|
@@ -4782,6 +4810,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4782
4810
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4783
4811
|
ApiRequester.successResponseParser),
|
|
4784
4812
|
|
|
4813
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4814
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4785
4815
|
});
|
|
4786
4816
|
|
|
4787
4817
|
//
|
|
@@ -5353,6 +5383,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
5353
5383
|
|
|
5354
5384
|
|
|
5355
5385
|
|
|
5386
|
+
|
|
5356
5387
|
|
|
5357
5388
|
|
|
5358
5389
|
|
|
@@ -5394,6 +5425,7 @@ class WebRTCClient extends Emitter {
|
|
|
5394
5425
|
|
|
5395
5426
|
|
|
5396
5427
|
|
|
5428
|
+
|
|
5397
5429
|
|
|
5398
5430
|
// sugar
|
|
5399
5431
|
|
|
@@ -5456,6 +5488,7 @@ class WebRTCClient extends Emitter {
|
|
|
5456
5488
|
this.conferences = {};
|
|
5457
5489
|
this.networkMonitoringInterval = {};
|
|
5458
5490
|
this.sessionNetworkStats = {};
|
|
5491
|
+
this.forceClosed = false;
|
|
5459
5492
|
|
|
5460
5493
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
5461
5494
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -5577,6 +5610,8 @@ class WebRTCClient extends Emitter {
|
|
|
5577
5610
|
skipRegister: this.skipRegister,
|
|
5578
5611
|
};
|
|
5579
5612
|
|
|
5613
|
+
this.forceClosed = false;
|
|
5614
|
+
|
|
5580
5615
|
if (this.skipRegister) {
|
|
5581
5616
|
logger.info('sdk webrtc skip register...', logInfo);
|
|
5582
5617
|
return Promise.resolve();
|
|
@@ -5601,7 +5636,15 @@ class WebRTCClient extends Emitter {
|
|
|
5601
5636
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
5602
5637
|
|
|
5603
5638
|
const onRegisterFailed = () => {
|
|
5604
|
-
logger.info('sdk webrtc registering failed', {
|
|
5639
|
+
logger.info('sdk webrtc registering failed', {
|
|
5640
|
+
tries,
|
|
5641
|
+
registerer: !!this.registerer,
|
|
5642
|
+
forceClosed: this.forceClosed,
|
|
5643
|
+
});
|
|
5644
|
+
if (this.forceClosed) {
|
|
5645
|
+
return;
|
|
5646
|
+
}
|
|
5647
|
+
|
|
5605
5648
|
this.connectionPromise = null;
|
|
5606
5649
|
if (this.registerer && this.registerer.waiting) {
|
|
5607
5650
|
this.registerer.waitingToggle(false);
|
|
@@ -5879,8 +5922,9 @@ class WebRTCClient extends Emitter {
|
|
|
5879
5922
|
}
|
|
5880
5923
|
}
|
|
5881
5924
|
|
|
5882
|
-
async close() {
|
|
5883
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5925
|
+
async close(force = false) {
|
|
5926
|
+
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
5927
|
+
this.forceClosed = force;
|
|
5884
5928
|
this._cleanupMedia();
|
|
5885
5929
|
this.connectionPromise = null;
|
|
5886
5930
|
|
|
@@ -5899,7 +5943,7 @@ class WebRTCClient extends Emitter {
|
|
|
5899
5943
|
this.userAgent.delegate = null;
|
|
5900
5944
|
this.userAgent.stateChange.removeAllListeners();
|
|
5901
5945
|
|
|
5902
|
-
await this._disconnectTransport();
|
|
5946
|
+
await this._disconnectTransport(force);
|
|
5903
5947
|
|
|
5904
5948
|
this._cleanupRegister();
|
|
5905
5949
|
|
|
@@ -6969,6 +7013,13 @@ class WebRTCClient extends Emitter {
|
|
|
6969
7013
|
}
|
|
6970
7014
|
|
|
6971
7015
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
7016
|
+
let { host } = this.config;
|
|
7017
|
+
let port = this.config.port || 443;
|
|
7018
|
+
|
|
7019
|
+
if (this.config.websocketSip) {
|
|
7020
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
7021
|
+
}
|
|
7022
|
+
|
|
6972
7023
|
const config = {
|
|
6973
7024
|
authorizationUsername: this.config.authorizationUser,
|
|
6974
7025
|
authorizationPassword: this.config.password,
|
|
@@ -7004,7 +7055,7 @@ class WebRTCClient extends Emitter {
|
|
|
7004
7055
|
},
|
|
7005
7056
|
transportOptions: {
|
|
7006
7057
|
traceSip: configOverrides.traceSip || false,
|
|
7007
|
-
wsServers: `wss://${
|
|
7058
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
7008
7059
|
},
|
|
7009
7060
|
sessionDescriptionHandlerFactoryOptions: {
|
|
7010
7061
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -7328,7 +7379,15 @@ class WebRTCClient extends Emitter {
|
|
|
7328
7379
|
return userAgent.UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
7329
7380
|
}
|
|
7330
7381
|
|
|
7331
|
-
async _disconnectTransport() {
|
|
7382
|
+
async _disconnectTransport(force = false) {
|
|
7383
|
+
if (force) {
|
|
7384
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7385
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
7386
|
+
// eslint-disable-next-line
|
|
7387
|
+
this.userAgent.transport._ws.close(1000);
|
|
7388
|
+
return;
|
|
7389
|
+
}
|
|
7390
|
+
|
|
7332
7391
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
7333
7392
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
7334
7393
|
try {
|
package/lib/api/calld.js
CHANGED
|
@@ -1232,6 +1232,34 @@ class IndirectTransfer {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
}
|
|
1234
1234
|
|
|
1235
|
+
//
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
|
|
1241
|
+
class MeetingStatus {
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
constructor({
|
|
1247
|
+
full,
|
|
1248
|
+
} = {}) {
|
|
1249
|
+
this.full = full;
|
|
1250
|
+
|
|
1251
|
+
// Useful to compare instead of instanceof with minified code
|
|
1252
|
+
this.type = 'MeetingStatus';
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
static parse(plain ) {
|
|
1256
|
+
return new MeetingStatus({
|
|
1257
|
+
full: plain.full,
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1235
1263
|
/* */
|
|
1236
1264
|
|
|
1237
1265
|
|
|
@@ -1426,6 +1454,8 @@ var calld = (client , baseUrl ) => ({
|
|
|
1426
1454
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
1427
1455
|
ApiRequester.successResponseParser),
|
|
1428
1456
|
|
|
1457
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
1458
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
1429
1459
|
});
|
|
1430
1460
|
|
|
1431
1461
|
module.exports = calld;
|
package/lib/api-client.js
CHANGED
|
@@ -4037,6 +4037,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4037
4037
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4038
4038
|
});
|
|
4039
4039
|
|
|
4040
|
+
//
|
|
4041
|
+
|
|
4042
|
+
|
|
4043
|
+
|
|
4044
|
+
|
|
4045
|
+
|
|
4046
|
+
class MeetingStatus {
|
|
4047
|
+
|
|
4048
|
+
|
|
4049
|
+
|
|
4050
|
+
|
|
4051
|
+
constructor({
|
|
4052
|
+
full,
|
|
4053
|
+
} = {}) {
|
|
4054
|
+
this.full = full;
|
|
4055
|
+
|
|
4056
|
+
// Useful to compare instead of instanceof with minified code
|
|
4057
|
+
this.type = 'MeetingStatus';
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
static parse(plain ) {
|
|
4061
|
+
return new MeetingStatus({
|
|
4062
|
+
full: plain.full,
|
|
4063
|
+
});
|
|
4064
|
+
}
|
|
4065
|
+
|
|
4066
|
+
}
|
|
4067
|
+
|
|
4040
4068
|
/* */
|
|
4041
4069
|
|
|
4042
4070
|
|
|
@@ -4231,6 +4259,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4231
4259
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4232
4260
|
ApiRequester.successResponseParser),
|
|
4233
4261
|
|
|
4262
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4263
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4234
4264
|
});
|
|
4235
4265
|
|
|
4236
4266
|
//
|