@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
|
@@ -4031,6 +4031,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4031
4031
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4032
4032
|
});
|
|
4033
4033
|
|
|
4034
|
+
//
|
|
4035
|
+
|
|
4036
|
+
|
|
4037
|
+
|
|
4038
|
+
|
|
4039
|
+
|
|
4040
|
+
class MeetingStatus {
|
|
4041
|
+
|
|
4042
|
+
|
|
4043
|
+
|
|
4044
|
+
|
|
4045
|
+
constructor({
|
|
4046
|
+
full,
|
|
4047
|
+
} = {}) {
|
|
4048
|
+
this.full = full;
|
|
4049
|
+
|
|
4050
|
+
// Useful to compare instead of instanceof with minified code
|
|
4051
|
+
this.type = 'MeetingStatus';
|
|
4052
|
+
}
|
|
4053
|
+
|
|
4054
|
+
static parse(plain ) {
|
|
4055
|
+
return new MeetingStatus({
|
|
4056
|
+
full: plain.full,
|
|
4057
|
+
});
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
}
|
|
4061
|
+
|
|
4034
4062
|
/* */
|
|
4035
4063
|
|
|
4036
4064
|
|
|
@@ -4225,6 +4253,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4225
4253
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4226
4254
|
ApiRequester.successResponseParser),
|
|
4227
4255
|
|
|
4256
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4257
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4228
4258
|
});
|
|
4229
4259
|
|
|
4230
4260
|
//
|
|
@@ -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
|
//
|
|
@@ -5344,6 +5374,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
5344
5374
|
|
|
5345
5375
|
|
|
5346
5376
|
|
|
5377
|
+
|
|
5347
5378
|
|
|
5348
5379
|
|
|
5349
5380
|
|
|
@@ -5385,6 +5416,7 @@ class WebRTCClient extends Emitter {
|
|
|
5385
5416
|
|
|
5386
5417
|
|
|
5387
5418
|
|
|
5419
|
+
|
|
5388
5420
|
|
|
5389
5421
|
// sugar
|
|
5390
5422
|
|
|
@@ -5447,6 +5479,7 @@ class WebRTCClient extends Emitter {
|
|
|
5447
5479
|
this.conferences = {};
|
|
5448
5480
|
this.networkMonitoringInterval = {};
|
|
5449
5481
|
this.sessionNetworkStats = {};
|
|
5482
|
+
this.forceClosed = false;
|
|
5450
5483
|
|
|
5451
5484
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
5452
5485
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -5568,6 +5601,8 @@ class WebRTCClient extends Emitter {
|
|
|
5568
5601
|
skipRegister: this.skipRegister,
|
|
5569
5602
|
};
|
|
5570
5603
|
|
|
5604
|
+
this.forceClosed = false;
|
|
5605
|
+
|
|
5571
5606
|
if (this.skipRegister) {
|
|
5572
5607
|
logger.info('sdk webrtc skip register...', logInfo);
|
|
5573
5608
|
return Promise.resolve();
|
|
@@ -5592,7 +5627,15 @@ class WebRTCClient extends Emitter {
|
|
|
5592
5627
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
5593
5628
|
|
|
5594
5629
|
const onRegisterFailed = () => {
|
|
5595
|
-
logger.info('sdk webrtc registering failed', {
|
|
5630
|
+
logger.info('sdk webrtc registering failed', {
|
|
5631
|
+
tries,
|
|
5632
|
+
registerer: !!this.registerer,
|
|
5633
|
+
forceClosed: this.forceClosed,
|
|
5634
|
+
});
|
|
5635
|
+
if (this.forceClosed) {
|
|
5636
|
+
return;
|
|
5637
|
+
}
|
|
5638
|
+
|
|
5596
5639
|
this.connectionPromise = null;
|
|
5597
5640
|
if (this.registerer && this.registerer.waiting) {
|
|
5598
5641
|
this.registerer.waitingToggle(false);
|
|
@@ -5870,8 +5913,9 @@ class WebRTCClient extends Emitter {
|
|
|
5870
5913
|
}
|
|
5871
5914
|
}
|
|
5872
5915
|
|
|
5873
|
-
async close() {
|
|
5874
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5916
|
+
async close(force = false) {
|
|
5917
|
+
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
5918
|
+
this.forceClosed = force;
|
|
5875
5919
|
this._cleanupMedia();
|
|
5876
5920
|
this.connectionPromise = null;
|
|
5877
5921
|
|
|
@@ -5890,7 +5934,7 @@ class WebRTCClient extends Emitter {
|
|
|
5890
5934
|
this.userAgent.delegate = null;
|
|
5891
5935
|
this.userAgent.stateChange.removeAllListeners();
|
|
5892
5936
|
|
|
5893
|
-
await this._disconnectTransport();
|
|
5937
|
+
await this._disconnectTransport(force);
|
|
5894
5938
|
|
|
5895
5939
|
this._cleanupRegister();
|
|
5896
5940
|
|
|
@@ -6960,6 +7004,13 @@ class WebRTCClient extends Emitter {
|
|
|
6960
7004
|
}
|
|
6961
7005
|
|
|
6962
7006
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
7007
|
+
let { host } = this.config;
|
|
7008
|
+
let port = this.config.port || 443;
|
|
7009
|
+
|
|
7010
|
+
if (this.config.websocketSip) {
|
|
7011
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
7012
|
+
}
|
|
7013
|
+
|
|
6963
7014
|
const config = {
|
|
6964
7015
|
authorizationUsername: this.config.authorizationUser,
|
|
6965
7016
|
authorizationPassword: this.config.password,
|
|
@@ -6995,7 +7046,7 @@ class WebRTCClient extends Emitter {
|
|
|
6995
7046
|
},
|
|
6996
7047
|
transportOptions: {
|
|
6997
7048
|
traceSip: configOverrides.traceSip || false,
|
|
6998
|
-
wsServers: `wss://${
|
|
7049
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
6999
7050
|
},
|
|
7000
7051
|
sessionDescriptionHandlerFactoryOptions: {
|
|
7001
7052
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -7319,7 +7370,15 @@ class WebRTCClient extends Emitter {
|
|
|
7319
7370
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
7320
7371
|
}
|
|
7321
7372
|
|
|
7322
|
-
async _disconnectTransport() {
|
|
7373
|
+
async _disconnectTransport(force = false) {
|
|
7374
|
+
if (force) {
|
|
7375
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7376
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
7377
|
+
// eslint-disable-next-line
|
|
7378
|
+
this.userAgent.transport._ws.close(1000);
|
|
7379
|
+
return;
|
|
7380
|
+
}
|
|
7381
|
+
|
|
7323
7382
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
7324
7383
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
7325
7384
|
try {
|
package/esm/api/calld.js
CHANGED
|
@@ -1226,6 +1226,34 @@ class IndirectTransfer {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
1228
1228
|
|
|
1229
|
+
//
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
class MeetingStatus {
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
constructor({
|
|
1241
|
+
full,
|
|
1242
|
+
} = {}) {
|
|
1243
|
+
this.full = full;
|
|
1244
|
+
|
|
1245
|
+
// Useful to compare instead of instanceof with minified code
|
|
1246
|
+
this.type = 'MeetingStatus';
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
static parse(plain ) {
|
|
1250
|
+
return new MeetingStatus({
|
|
1251
|
+
full: plain.full,
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1229
1257
|
/* */
|
|
1230
1258
|
|
|
1231
1259
|
|
|
@@ -1420,6 +1448,8 @@ var calld = (client , baseUrl ) => ({
|
|
|
1420
1448
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
1421
1449
|
ApiRequester.successResponseParser),
|
|
1422
1450
|
|
|
1451
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
1452
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
1423
1453
|
});
|
|
1424
1454
|
|
|
1425
1455
|
export default calld;
|
package/esm/api-client.js
CHANGED
|
@@ -4031,6 +4031,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4031
4031
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4032
4032
|
});
|
|
4033
4033
|
|
|
4034
|
+
//
|
|
4035
|
+
|
|
4036
|
+
|
|
4037
|
+
|
|
4038
|
+
|
|
4039
|
+
|
|
4040
|
+
class MeetingStatus {
|
|
4041
|
+
|
|
4042
|
+
|
|
4043
|
+
|
|
4044
|
+
|
|
4045
|
+
constructor({
|
|
4046
|
+
full,
|
|
4047
|
+
} = {}) {
|
|
4048
|
+
this.full = full;
|
|
4049
|
+
|
|
4050
|
+
// Useful to compare instead of instanceof with minified code
|
|
4051
|
+
this.type = 'MeetingStatus';
|
|
4052
|
+
}
|
|
4053
|
+
|
|
4054
|
+
static parse(plain ) {
|
|
4055
|
+
return new MeetingStatus({
|
|
4056
|
+
full: plain.full,
|
|
4057
|
+
});
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
}
|
|
4061
|
+
|
|
4034
4062
|
/* */
|
|
4035
4063
|
|
|
4036
4064
|
|
|
@@ -4225,6 +4253,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4225
4253
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4226
4254
|
ApiRequester.successResponseParser),
|
|
4227
4255
|
|
|
4256
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4257
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4228
4258
|
});
|
|
4229
4259
|
|
|
4230
4260
|
//
|
package/esm/checker/Checker.js
CHANGED
|
@@ -4075,6 +4075,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4075
4075
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4076
4076
|
});
|
|
4077
4077
|
|
|
4078
|
+
//
|
|
4079
|
+
|
|
4080
|
+
|
|
4081
|
+
|
|
4082
|
+
|
|
4083
|
+
|
|
4084
|
+
class MeetingStatus {
|
|
4085
|
+
|
|
4086
|
+
|
|
4087
|
+
|
|
4088
|
+
|
|
4089
|
+
constructor({
|
|
4090
|
+
full,
|
|
4091
|
+
} = {}) {
|
|
4092
|
+
this.full = full;
|
|
4093
|
+
|
|
4094
|
+
// Useful to compare instead of instanceof with minified code
|
|
4095
|
+
this.type = 'MeetingStatus';
|
|
4096
|
+
}
|
|
4097
|
+
|
|
4098
|
+
static parse(plain ) {
|
|
4099
|
+
return new MeetingStatus({
|
|
4100
|
+
full: plain.full,
|
|
4101
|
+
});
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
}
|
|
4105
|
+
|
|
4078
4106
|
/* */
|
|
4079
4107
|
|
|
4080
4108
|
|
|
@@ -4269,6 +4297,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4269
4297
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4270
4298
|
ApiRequester.successResponseParser),
|
|
4271
4299
|
|
|
4300
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4301
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4272
4302
|
});
|
|
4273
4303
|
|
|
4274
4304
|
//
|
|
@@ -5929,6 +5959,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
5929
5959
|
|
|
5930
5960
|
|
|
5931
5961
|
|
|
5962
|
+
|
|
5932
5963
|
|
|
5933
5964
|
|
|
5934
5965
|
|
|
@@ -5970,6 +6001,7 @@ class WebRTCClient extends Emitter {
|
|
|
5970
6001
|
|
|
5971
6002
|
|
|
5972
6003
|
|
|
6004
|
+
|
|
5973
6005
|
|
|
5974
6006
|
// sugar
|
|
5975
6007
|
|
|
@@ -6032,6 +6064,7 @@ class WebRTCClient extends Emitter {
|
|
|
6032
6064
|
this.conferences = {};
|
|
6033
6065
|
this.networkMonitoringInterval = {};
|
|
6034
6066
|
this.sessionNetworkStats = {};
|
|
6067
|
+
this.forceClosed = false;
|
|
6035
6068
|
|
|
6036
6069
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
6037
6070
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -6153,6 +6186,8 @@ class WebRTCClient extends Emitter {
|
|
|
6153
6186
|
skipRegister: this.skipRegister,
|
|
6154
6187
|
};
|
|
6155
6188
|
|
|
6189
|
+
this.forceClosed = false;
|
|
6190
|
+
|
|
6156
6191
|
if (this.skipRegister) {
|
|
6157
6192
|
logger$1.info('sdk webrtc skip register...', logInfo);
|
|
6158
6193
|
return Promise.resolve();
|
|
@@ -6177,7 +6212,15 @@ class WebRTCClient extends Emitter {
|
|
|
6177
6212
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6178
6213
|
|
|
6179
6214
|
const onRegisterFailed = () => {
|
|
6180
|
-
logger$1.info('sdk webrtc registering failed', {
|
|
6215
|
+
logger$1.info('sdk webrtc registering failed', {
|
|
6216
|
+
tries,
|
|
6217
|
+
registerer: !!this.registerer,
|
|
6218
|
+
forceClosed: this.forceClosed,
|
|
6219
|
+
});
|
|
6220
|
+
if (this.forceClosed) {
|
|
6221
|
+
return;
|
|
6222
|
+
}
|
|
6223
|
+
|
|
6181
6224
|
this.connectionPromise = null;
|
|
6182
6225
|
if (this.registerer && this.registerer.waiting) {
|
|
6183
6226
|
this.registerer.waitingToggle(false);
|
|
@@ -6455,8 +6498,9 @@ class WebRTCClient extends Emitter {
|
|
|
6455
6498
|
}
|
|
6456
6499
|
}
|
|
6457
6500
|
|
|
6458
|
-
async close() {
|
|
6459
|
-
logger$1.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6501
|
+
async close(force = false) {
|
|
6502
|
+
logger$1.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
6503
|
+
this.forceClosed = force;
|
|
6460
6504
|
this._cleanupMedia();
|
|
6461
6505
|
this.connectionPromise = null;
|
|
6462
6506
|
|
|
@@ -6475,7 +6519,7 @@ class WebRTCClient extends Emitter {
|
|
|
6475
6519
|
this.userAgent.delegate = null;
|
|
6476
6520
|
this.userAgent.stateChange.removeAllListeners();
|
|
6477
6521
|
|
|
6478
|
-
await this._disconnectTransport();
|
|
6522
|
+
await this._disconnectTransport(force);
|
|
6479
6523
|
|
|
6480
6524
|
this._cleanupRegister();
|
|
6481
6525
|
|
|
@@ -7545,6 +7589,13 @@ class WebRTCClient extends Emitter {
|
|
|
7545
7589
|
}
|
|
7546
7590
|
|
|
7547
7591
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
7592
|
+
let { host } = this.config;
|
|
7593
|
+
let port = this.config.port || 443;
|
|
7594
|
+
|
|
7595
|
+
if (this.config.websocketSip) {
|
|
7596
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
7597
|
+
}
|
|
7598
|
+
|
|
7548
7599
|
const config = {
|
|
7549
7600
|
authorizationUsername: this.config.authorizationUser,
|
|
7550
7601
|
authorizationPassword: this.config.password,
|
|
@@ -7580,7 +7631,7 @@ class WebRTCClient extends Emitter {
|
|
|
7580
7631
|
},
|
|
7581
7632
|
transportOptions: {
|
|
7582
7633
|
traceSip: configOverrides.traceSip || false,
|
|
7583
|
-
wsServers: `wss://${
|
|
7634
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
7584
7635
|
},
|
|
7585
7636
|
sessionDescriptionHandlerFactoryOptions: {
|
|
7586
7637
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -7904,7 +7955,15 @@ class WebRTCClient extends Emitter {
|
|
|
7904
7955
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
7905
7956
|
}
|
|
7906
7957
|
|
|
7907
|
-
async _disconnectTransport() {
|
|
7958
|
+
async _disconnectTransport(force = false) {
|
|
7959
|
+
if (force) {
|
|
7960
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7961
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
7962
|
+
// eslint-disable-next-line
|
|
7963
|
+
this.userAgent.transport._ws.close(1000);
|
|
7964
|
+
return;
|
|
7965
|
+
}
|
|
7966
|
+
|
|
7908
7967
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
7909
7968
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
7910
7969
|
try {
|
|
@@ -4031,6 +4031,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4031
4031
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4032
4032
|
});
|
|
4033
4033
|
|
|
4034
|
+
//
|
|
4035
|
+
|
|
4036
|
+
|
|
4037
|
+
|
|
4038
|
+
|
|
4039
|
+
|
|
4040
|
+
class MeetingStatus {
|
|
4041
|
+
|
|
4042
|
+
|
|
4043
|
+
|
|
4044
|
+
|
|
4045
|
+
constructor({
|
|
4046
|
+
full,
|
|
4047
|
+
} = {}) {
|
|
4048
|
+
this.full = full;
|
|
4049
|
+
|
|
4050
|
+
// Useful to compare instead of instanceof with minified code
|
|
4051
|
+
this.type = 'MeetingStatus';
|
|
4052
|
+
}
|
|
4053
|
+
|
|
4054
|
+
static parse(plain ) {
|
|
4055
|
+
return new MeetingStatus({
|
|
4056
|
+
full: plain.full,
|
|
4057
|
+
});
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
}
|
|
4061
|
+
|
|
4034
4062
|
/* */
|
|
4035
4063
|
|
|
4036
4064
|
|
|
@@ -4225,6 +4253,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4225
4253
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4226
4254
|
ApiRequester.successResponseParser),
|
|
4227
4255
|
|
|
4256
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4257
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4228
4258
|
});
|
|
4229
4259
|
|
|
4230
4260
|
//
|
|
@@ -4031,6 +4031,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4031
4031
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4032
4032
|
});
|
|
4033
4033
|
|
|
4034
|
+
//
|
|
4035
|
+
|
|
4036
|
+
|
|
4037
|
+
|
|
4038
|
+
|
|
4039
|
+
|
|
4040
|
+
class MeetingStatus {
|
|
4041
|
+
|
|
4042
|
+
|
|
4043
|
+
|
|
4044
|
+
|
|
4045
|
+
constructor({
|
|
4046
|
+
full,
|
|
4047
|
+
} = {}) {
|
|
4048
|
+
this.full = full;
|
|
4049
|
+
|
|
4050
|
+
// Useful to compare instead of instanceof with minified code
|
|
4051
|
+
this.type = 'MeetingStatus';
|
|
4052
|
+
}
|
|
4053
|
+
|
|
4054
|
+
static parse(plain ) {
|
|
4055
|
+
return new MeetingStatus({
|
|
4056
|
+
full: plain.full,
|
|
4057
|
+
});
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
}
|
|
4061
|
+
|
|
4034
4062
|
/* */
|
|
4035
4063
|
|
|
4036
4064
|
|
|
@@ -4225,6 +4253,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4225
4253
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4226
4254
|
ApiRequester.successResponseParser),
|
|
4227
4255
|
|
|
4256
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4257
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4228
4258
|
});
|
|
4229
4259
|
|
|
4230
4260
|
//
|
|
@@ -4075,6 +4075,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4075
4075
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4076
4076
|
});
|
|
4077
4077
|
|
|
4078
|
+
//
|
|
4079
|
+
|
|
4080
|
+
|
|
4081
|
+
|
|
4082
|
+
|
|
4083
|
+
|
|
4084
|
+
class MeetingStatus {
|
|
4085
|
+
|
|
4086
|
+
|
|
4087
|
+
|
|
4088
|
+
|
|
4089
|
+
constructor({
|
|
4090
|
+
full,
|
|
4091
|
+
} = {}) {
|
|
4092
|
+
this.full = full;
|
|
4093
|
+
|
|
4094
|
+
// Useful to compare instead of instanceof with minified code
|
|
4095
|
+
this.type = 'MeetingStatus';
|
|
4096
|
+
}
|
|
4097
|
+
|
|
4098
|
+
static parse(plain ) {
|
|
4099
|
+
return new MeetingStatus({
|
|
4100
|
+
full: plain.full,
|
|
4101
|
+
});
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
}
|
|
4105
|
+
|
|
4078
4106
|
/* */
|
|
4079
4107
|
|
|
4080
4108
|
|
|
@@ -4269,6 +4297,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4269
4297
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4270
4298
|
ApiRequester.successResponseParser),
|
|
4271
4299
|
|
|
4300
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4301
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4272
4302
|
});
|
|
4273
4303
|
|
|
4274
4304
|
//
|
|
@@ -5929,6 +5959,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
5929
5959
|
|
|
5930
5960
|
|
|
5931
5961
|
|
|
5962
|
+
|
|
5932
5963
|
|
|
5933
5964
|
|
|
5934
5965
|
|
|
@@ -5970,6 +6001,7 @@ class WebRTCClient extends Emitter {
|
|
|
5970
6001
|
|
|
5971
6002
|
|
|
5972
6003
|
|
|
6004
|
+
|
|
5973
6005
|
|
|
5974
6006
|
// sugar
|
|
5975
6007
|
|
|
@@ -6032,6 +6064,7 @@ class WebRTCClient extends Emitter {
|
|
|
6032
6064
|
this.conferences = {};
|
|
6033
6065
|
this.networkMonitoringInterval = {};
|
|
6034
6066
|
this.sessionNetworkStats = {};
|
|
6067
|
+
this.forceClosed = false;
|
|
6035
6068
|
|
|
6036
6069
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
6037
6070
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -6153,6 +6186,8 @@ class WebRTCClient extends Emitter {
|
|
|
6153
6186
|
skipRegister: this.skipRegister,
|
|
6154
6187
|
};
|
|
6155
6188
|
|
|
6189
|
+
this.forceClosed = false;
|
|
6190
|
+
|
|
6156
6191
|
if (this.skipRegister) {
|
|
6157
6192
|
logger.info('sdk webrtc skip register...', logInfo);
|
|
6158
6193
|
return Promise.resolve();
|
|
@@ -6177,7 +6212,15 @@ class WebRTCClient extends Emitter {
|
|
|
6177
6212
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6178
6213
|
|
|
6179
6214
|
const onRegisterFailed = () => {
|
|
6180
|
-
logger.info('sdk webrtc registering failed', {
|
|
6215
|
+
logger.info('sdk webrtc registering failed', {
|
|
6216
|
+
tries,
|
|
6217
|
+
registerer: !!this.registerer,
|
|
6218
|
+
forceClosed: this.forceClosed,
|
|
6219
|
+
});
|
|
6220
|
+
if (this.forceClosed) {
|
|
6221
|
+
return;
|
|
6222
|
+
}
|
|
6223
|
+
|
|
6181
6224
|
this.connectionPromise = null;
|
|
6182
6225
|
if (this.registerer && this.registerer.waiting) {
|
|
6183
6226
|
this.registerer.waitingToggle(false);
|
|
@@ -6455,8 +6498,9 @@ class WebRTCClient extends Emitter {
|
|
|
6455
6498
|
}
|
|
6456
6499
|
}
|
|
6457
6500
|
|
|
6458
|
-
async close() {
|
|
6459
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6501
|
+
async close(force = false) {
|
|
6502
|
+
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
6503
|
+
this.forceClosed = force;
|
|
6460
6504
|
this._cleanupMedia();
|
|
6461
6505
|
this.connectionPromise = null;
|
|
6462
6506
|
|
|
@@ -6475,7 +6519,7 @@ class WebRTCClient extends Emitter {
|
|
|
6475
6519
|
this.userAgent.delegate = null;
|
|
6476
6520
|
this.userAgent.stateChange.removeAllListeners();
|
|
6477
6521
|
|
|
6478
|
-
await this._disconnectTransport();
|
|
6522
|
+
await this._disconnectTransport(force);
|
|
6479
6523
|
|
|
6480
6524
|
this._cleanupRegister();
|
|
6481
6525
|
|
|
@@ -7545,6 +7589,13 @@ class WebRTCClient extends Emitter {
|
|
|
7545
7589
|
}
|
|
7546
7590
|
|
|
7547
7591
|
_createWebRTCConfiguration(configOverrides = {}) {
|
|
7592
|
+
let { host } = this.config;
|
|
7593
|
+
let port = this.config.port || 443;
|
|
7594
|
+
|
|
7595
|
+
if (this.config.websocketSip) {
|
|
7596
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
7597
|
+
}
|
|
7598
|
+
|
|
7548
7599
|
const config = {
|
|
7549
7600
|
authorizationUsername: this.config.authorizationUser,
|
|
7550
7601
|
authorizationPassword: this.config.password,
|
|
@@ -7580,7 +7631,7 @@ class WebRTCClient extends Emitter {
|
|
|
7580
7631
|
},
|
|
7581
7632
|
transportOptions: {
|
|
7582
7633
|
traceSip: configOverrides.traceSip || false,
|
|
7583
|
-
wsServers: `wss://${
|
|
7634
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
7584
7635
|
},
|
|
7585
7636
|
sessionDescriptionHandlerFactoryOptions: {
|
|
7586
7637
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -7904,7 +7955,15 @@ class WebRTCClient extends Emitter {
|
|
|
7904
7955
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
7905
7956
|
}
|
|
7906
7957
|
|
|
7907
|
-
async _disconnectTransport() {
|
|
7958
|
+
async _disconnectTransport(force = false) {
|
|
7959
|
+
if (force) {
|
|
7960
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7961
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
7962
|
+
// eslint-disable-next-line
|
|
7963
|
+
this.userAgent.transport._ws.close(1000);
|
|
7964
|
+
return;
|
|
7965
|
+
}
|
|
7966
|
+
|
|
7908
7967
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
7909
7968
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
7910
7969
|
try {
|