@wazo/sdk 0.37.31 → 0.37.35
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/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/api-client.test.js +41 -0
- package/esm/__tests__/web-rtc-client.test.js +68 -6
- package/esm/api/auth.js +5 -0
- package/esm/api/call-logd.js +6 -0
- package/esm/api/calld.js +30 -0
- package/esm/api-client.js +41 -0
- package/esm/checker/Checker.js +68 -6
- package/esm/checker/checks/aor.js +41 -0
- package/esm/checker/checks/api.js +41 -0
- package/esm/checker/checks/index.js +68 -6
- package/esm/checker/checks/webrtc-transport.js +68 -6
- package/esm/checker/checks/webrtc.js +68 -6
- package/esm/domain/AdHocAPIConference.js +41 -0
- package/esm/domain/CallLog.js +6 -0
- package/esm/domain/CallSession.js +8 -0
- package/esm/domain/Features.js +41 -0
- package/esm/domain/MeetingStatus.js +29 -0
- package/esm/domain/Phone/CTIPhone.js +49 -0
- package/esm/domain/Phone/WebRTCPhone.js +33 -6
- package/esm/domain/__tests__/CallLog.test.js +6 -0
- package/esm/domain/__tests__/CallSession.test.js +40 -4
- package/esm/domain/__tests__/IndirectTransfer.test.js +8 -0
- package/esm/domain/__tests__/Room.test.js +8 -0
- package/esm/index.js +101 -12
- package/esm/service/CallApi.js +41 -0
- package/esm/service/getApiClient.js +41 -0
- package/esm/simple/Auth.js +101 -12
- package/esm/simple/Configuration.js +101 -12
- package/esm/simple/Directory.js +41 -0
- package/esm/simple/Phone.js +101 -12
- package/esm/simple/index.js +101 -12
- package/esm/simple/room/LocalParticipant.js +101 -12
- package/esm/simple/room/Participant.js +101 -12
- package/esm/simple/room/RemoteParticipant.js +101 -12
- package/esm/simple/room/Room.js +101 -12
- package/esm/simple/room/SipRoom.js +101 -12
- package/esm/simple/room/Stream.js +101 -12
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +101 -12
- package/esm/simple/utils.js +101 -12
- package/esm/web-rtc-client.js +68 -6
- package/lib/__tests__/api-client.test.js +41 -0
- package/lib/__tests__/web-rtc-client.test.js +68 -6
- package/lib/api/auth.js +5 -0
- package/lib/api/call-logd.js +6 -0
- package/lib/api/calld.js +30 -0
- package/lib/api-client.js +41 -0
- package/lib/checker/Checker.js +68 -6
- package/lib/checker/checks/aor.js +41 -0
- package/lib/checker/checks/api.js +41 -0
- package/lib/checker/checks/index.js +68 -6
- package/lib/checker/checks/webrtc-transport.js +68 -6
- package/lib/checker/checks/webrtc.js +68 -6
- package/lib/domain/AdHocAPIConference.js +41 -0
- package/lib/domain/CallLog.js +6 -0
- package/lib/domain/CallSession.js +8 -0
- package/lib/domain/Features.js +41 -0
- package/lib/domain/MeetingStatus.js +31 -0
- package/lib/domain/Phone/CTIPhone.js +49 -0
- package/lib/domain/Phone/WebRTCPhone.js +33 -6
- package/lib/domain/__tests__/CallLog.test.js +6 -0
- package/lib/domain/__tests__/CallSession.test.js +40 -4
- package/lib/domain/__tests__/IndirectTransfer.test.js +8 -0
- package/lib/domain/__tests__/Room.test.js +8 -0
- package/lib/index.js +101 -12
- package/lib/service/CallApi.js +41 -0
- package/lib/service/getApiClient.js +41 -0
- package/lib/simple/Auth.js +101 -12
- package/lib/simple/Configuration.js +101 -12
- package/lib/simple/Directory.js +41 -0
- package/lib/simple/Phone.js +101 -12
- package/lib/simple/index.js +101 -12
- package/lib/simple/room/LocalParticipant.js +101 -12
- package/lib/simple/room/Participant.js +101 -12
- package/lib/simple/room/RemoteParticipant.js +101 -12
- package/lib/simple/room/Room.js +101 -12
- package/lib/simple/room/SipRoom.js +101 -12
- package/lib/simple/room/Stream.js +101 -12
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +101 -12
- package/lib/simple/utils.js +101 -12
- package/lib/web-rtc-client.js +68 -6
- package/package.json +1 -1
- package/src/api/auth.js +5 -0
- package/src/api/calld.js +3 -0
- package/src/domain/CallLog.js +6 -0
- package/src/domain/CallSession.js +8 -0
- package/src/domain/MeetingStatus.js +27 -0
- package/src/domain/Phone/WebRTCPhone.js +25 -6
- package/src/domain/__tests__/CallSession.test.js +32 -4
- package/src/web-rtc-client.js +27 -6
package/esm/web-rtc-client.js
CHANGED
|
@@ -2745,6 +2745,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2745
2745
|
|
|
2746
2746
|
|
|
2747
2747
|
|
|
2748
|
+
|
|
2748
2749
|
) {
|
|
2749
2750
|
const body = {
|
|
2750
2751
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2764,6 +2765,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2764
2765
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
2765
2766
|
}
|
|
2766
2767
|
|
|
2768
|
+
if (params.tenantId) {
|
|
2769
|
+
body.tenant_id = params.tenantId;
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2767
2772
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2768
2773
|
},
|
|
2769
2774
|
|
|
@@ -3832,11 +3837,13 @@ class Recording {
|
|
|
3832
3837
|
|
|
3833
3838
|
|
|
3834
3839
|
|
|
3840
|
+
|
|
3835
3841
|
|
|
3836
3842
|
|
|
3837
3843
|
|
|
3838
3844
|
|
|
3839
3845
|
|
|
3846
|
+
|
|
3840
3847
|
|
|
3841
3848
|
|
|
3842
3849
|
|
|
@@ -3857,10 +3864,12 @@ class Recording {
|
|
|
3857
3864
|
|
|
3858
3865
|
|
|
3859
3866
|
|
|
3867
|
+
|
|
3860
3868
|
|
|
3861
3869
|
|
|
3862
3870
|
|
|
3863
3871
|
|
|
3872
|
+
|
|
3864
3873
|
|
|
3865
3874
|
|
|
3866
3875
|
|
|
@@ -3922,10 +3931,12 @@ class CallLog {
|
|
|
3922
3931
|
|| plain.destination_extension
|
|
3923
3932
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3924
3933
|
name: plain.requested_name || plain.destination_name || '',
|
|
3934
|
+
uuid: plain.destination_user_uuid,
|
|
3925
3935
|
},
|
|
3926
3936
|
source: {
|
|
3927
3937
|
extension: plain.source_extension,
|
|
3928
3938
|
name: plain.source_name,
|
|
3939
|
+
uuid: plain.source_user_uuid,
|
|
3929
3940
|
},
|
|
3930
3941
|
id: plain.id,
|
|
3931
3942
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -4579,6 +4590,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4579
4590
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4580
4591
|
});
|
|
4581
4592
|
|
|
4593
|
+
//
|
|
4594
|
+
|
|
4595
|
+
|
|
4596
|
+
|
|
4597
|
+
|
|
4598
|
+
|
|
4599
|
+
class MeetingStatus {
|
|
4600
|
+
|
|
4601
|
+
|
|
4602
|
+
|
|
4603
|
+
|
|
4604
|
+
constructor({
|
|
4605
|
+
full,
|
|
4606
|
+
} = {}) {
|
|
4607
|
+
this.full = full;
|
|
4608
|
+
|
|
4609
|
+
// Useful to compare instead of instanceof with minified code
|
|
4610
|
+
this.type = 'MeetingStatus';
|
|
4611
|
+
}
|
|
4612
|
+
|
|
4613
|
+
static parse(plain ) {
|
|
4614
|
+
return new MeetingStatus({
|
|
4615
|
+
full: plain.full,
|
|
4616
|
+
});
|
|
4617
|
+
}
|
|
4618
|
+
|
|
4619
|
+
}
|
|
4620
|
+
|
|
4582
4621
|
/* */
|
|
4583
4622
|
|
|
4584
4623
|
|
|
@@ -4773,6 +4812,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4773
4812
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4774
4813
|
ApiRequester.successResponseParser),
|
|
4775
4814
|
|
|
4815
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4816
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4776
4817
|
});
|
|
4777
4818
|
|
|
4778
4819
|
//
|
|
@@ -5335,7 +5376,7 @@ const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
|
5335
5376
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
5336
5377
|
class CanceledCallError extends Error {}
|
|
5337
5378
|
|
|
5338
|
-
const MAX_REGISTER_TRIES =
|
|
5379
|
+
const MAX_REGISTER_TRIES = 5;
|
|
5339
5380
|
|
|
5340
5381
|
|
|
5341
5382
|
|
|
@@ -5389,6 +5430,7 @@ class WebRTCClient extends Emitter {
|
|
|
5389
5430
|
|
|
5390
5431
|
|
|
5391
5432
|
|
|
5433
|
+
|
|
5392
5434
|
|
|
5393
5435
|
// sugar
|
|
5394
5436
|
|
|
@@ -5451,6 +5493,7 @@ class WebRTCClient extends Emitter {
|
|
|
5451
5493
|
this.conferences = {};
|
|
5452
5494
|
this.networkMonitoringInterval = {};
|
|
5453
5495
|
this.sessionNetworkStats = {};
|
|
5496
|
+
this.forceClosed = false;
|
|
5454
5497
|
|
|
5455
5498
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
5456
5499
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -5572,6 +5615,8 @@ class WebRTCClient extends Emitter {
|
|
|
5572
5615
|
skipRegister: this.skipRegister,
|
|
5573
5616
|
};
|
|
5574
5617
|
|
|
5618
|
+
this.forceClosed = false;
|
|
5619
|
+
|
|
5575
5620
|
if (this.skipRegister) {
|
|
5576
5621
|
logger.info('sdk webrtc skip register...', logInfo);
|
|
5577
5622
|
return Promise.resolve();
|
|
@@ -5596,7 +5641,15 @@ class WebRTCClient extends Emitter {
|
|
|
5596
5641
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
5597
5642
|
|
|
5598
5643
|
const onRegisterFailed = () => {
|
|
5599
|
-
logger.info('sdk webrtc registering failed', {
|
|
5644
|
+
logger.info('sdk webrtc registering failed', {
|
|
5645
|
+
tries,
|
|
5646
|
+
registerer: !!this.registerer,
|
|
5647
|
+
forceClosed: this.forceClosed,
|
|
5648
|
+
});
|
|
5649
|
+
if (this.forceClosed) {
|
|
5650
|
+
return;
|
|
5651
|
+
}
|
|
5652
|
+
|
|
5600
5653
|
this.connectionPromise = null;
|
|
5601
5654
|
if (this.registerer && this.registerer.waiting) {
|
|
5602
5655
|
this.registerer.waitingToggle(false);
|
|
@@ -5874,8 +5927,9 @@ class WebRTCClient extends Emitter {
|
|
|
5874
5927
|
}
|
|
5875
5928
|
}
|
|
5876
5929
|
|
|
5877
|
-
async close() {
|
|
5878
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5930
|
+
async close(force = false) {
|
|
5931
|
+
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
5932
|
+
this.forceClosed = force;
|
|
5879
5933
|
this._cleanupMedia();
|
|
5880
5934
|
this.connectionPromise = null;
|
|
5881
5935
|
|
|
@@ -5894,7 +5948,7 @@ class WebRTCClient extends Emitter {
|
|
|
5894
5948
|
this.userAgent.delegate = null;
|
|
5895
5949
|
this.userAgent.stateChange.removeAllListeners();
|
|
5896
5950
|
|
|
5897
|
-
await this._disconnectTransport();
|
|
5951
|
+
await this._disconnectTransport(force);
|
|
5898
5952
|
|
|
5899
5953
|
this._cleanupRegister();
|
|
5900
5954
|
|
|
@@ -7330,7 +7384,15 @@ class WebRTCClient extends Emitter {
|
|
|
7330
7384
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
7331
7385
|
}
|
|
7332
7386
|
|
|
7333
|
-
async _disconnectTransport() {
|
|
7387
|
+
async _disconnectTransport(force = false) {
|
|
7388
|
+
if (force) {
|
|
7389
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7390
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
7391
|
+
// eslint-disable-next-line
|
|
7392
|
+
this.userAgent.transport._ws.close(1000);
|
|
7393
|
+
return;
|
|
7394
|
+
}
|
|
7395
|
+
|
|
7334
7396
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
7335
7397
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
7336
7398
|
try {
|
|
@@ -2203,6 +2203,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2203
2203
|
|
|
2204
2204
|
|
|
2205
2205
|
|
|
2206
|
+
|
|
2206
2207
|
) {
|
|
2207
2208
|
const body = {
|
|
2208
2209
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2222,6 +2223,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2222
2223
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
2223
2224
|
}
|
|
2224
2225
|
|
|
2226
|
+
if (params.tenantId) {
|
|
2227
|
+
body.tenant_id = params.tenantId;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2225
2230
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2226
2231
|
},
|
|
2227
2232
|
|
|
@@ -3290,11 +3295,13 @@ class Recording {
|
|
|
3290
3295
|
|
|
3291
3296
|
|
|
3292
3297
|
|
|
3298
|
+
|
|
3293
3299
|
|
|
3294
3300
|
|
|
3295
3301
|
|
|
3296
3302
|
|
|
3297
3303
|
|
|
3304
|
+
|
|
3298
3305
|
|
|
3299
3306
|
|
|
3300
3307
|
|
|
@@ -3315,10 +3322,12 @@ class Recording {
|
|
|
3315
3322
|
|
|
3316
3323
|
|
|
3317
3324
|
|
|
3325
|
+
|
|
3318
3326
|
|
|
3319
3327
|
|
|
3320
3328
|
|
|
3321
3329
|
|
|
3330
|
+
|
|
3322
3331
|
|
|
3323
3332
|
|
|
3324
3333
|
|
|
@@ -3380,10 +3389,12 @@ class CallLog {
|
|
|
3380
3389
|
|| plain.destination_extension
|
|
3381
3390
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3382
3391
|
name: plain.requested_name || plain.destination_name || '',
|
|
3392
|
+
uuid: plain.destination_user_uuid,
|
|
3383
3393
|
},
|
|
3384
3394
|
source: {
|
|
3385
3395
|
extension: plain.source_extension,
|
|
3386
3396
|
name: plain.source_name,
|
|
3397
|
+
uuid: plain.source_user_uuid,
|
|
3387
3398
|
},
|
|
3388
3399
|
id: plain.id,
|
|
3389
3400
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -4037,6 +4048,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4037
4048
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4038
4049
|
});
|
|
4039
4050
|
|
|
4051
|
+
//
|
|
4052
|
+
|
|
4053
|
+
|
|
4054
|
+
|
|
4055
|
+
|
|
4056
|
+
|
|
4057
|
+
class MeetingStatus {
|
|
4058
|
+
|
|
4059
|
+
|
|
4060
|
+
|
|
4061
|
+
|
|
4062
|
+
constructor({
|
|
4063
|
+
full,
|
|
4064
|
+
} = {}) {
|
|
4065
|
+
this.full = full;
|
|
4066
|
+
|
|
4067
|
+
// Useful to compare instead of instanceof with minified code
|
|
4068
|
+
this.type = 'MeetingStatus';
|
|
4069
|
+
}
|
|
4070
|
+
|
|
4071
|
+
static parse(plain ) {
|
|
4072
|
+
return new MeetingStatus({
|
|
4073
|
+
full: plain.full,
|
|
4074
|
+
});
|
|
4075
|
+
}
|
|
4076
|
+
|
|
4077
|
+
}
|
|
4078
|
+
|
|
4040
4079
|
/* */
|
|
4041
4080
|
|
|
4042
4081
|
|
|
@@ -4231,6 +4270,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4231
4270
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4232
4271
|
ApiRequester.successResponseParser),
|
|
4233
4272
|
|
|
4273
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4274
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4234
4275
|
});
|
|
4235
4276
|
|
|
4236
4277
|
//
|
|
@@ -2754,6 +2754,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2754
2754
|
|
|
2755
2755
|
|
|
2756
2756
|
|
|
2757
|
+
|
|
2757
2758
|
) {
|
|
2758
2759
|
const body = {
|
|
2759
2760
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2773,6 +2774,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2773
2774
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
2774
2775
|
}
|
|
2775
2776
|
|
|
2777
|
+
if (params.tenantId) {
|
|
2778
|
+
body.tenant_id = params.tenantId;
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2776
2781
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2777
2782
|
},
|
|
2778
2783
|
|
|
@@ -3841,11 +3846,13 @@ class Recording {
|
|
|
3841
3846
|
|
|
3842
3847
|
|
|
3843
3848
|
|
|
3849
|
+
|
|
3844
3850
|
|
|
3845
3851
|
|
|
3846
3852
|
|
|
3847
3853
|
|
|
3848
3854
|
|
|
3855
|
+
|
|
3849
3856
|
|
|
3850
3857
|
|
|
3851
3858
|
|
|
@@ -3866,10 +3873,12 @@ class Recording {
|
|
|
3866
3873
|
|
|
3867
3874
|
|
|
3868
3875
|
|
|
3876
|
+
|
|
3869
3877
|
|
|
3870
3878
|
|
|
3871
3879
|
|
|
3872
3880
|
|
|
3881
|
+
|
|
3873
3882
|
|
|
3874
3883
|
|
|
3875
3884
|
|
|
@@ -3931,10 +3940,12 @@ class CallLog {
|
|
|
3931
3940
|
|| plain.destination_extension
|
|
3932
3941
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3933
3942
|
name: plain.requested_name || plain.destination_name || '',
|
|
3943
|
+
uuid: plain.destination_user_uuid,
|
|
3934
3944
|
},
|
|
3935
3945
|
source: {
|
|
3936
3946
|
extension: plain.source_extension,
|
|
3937
3947
|
name: plain.source_name,
|
|
3948
|
+
uuid: plain.source_user_uuid,
|
|
3938
3949
|
},
|
|
3939
3950
|
id: plain.id,
|
|
3940
3951
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -4588,6 +4599,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4588
4599
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4589
4600
|
});
|
|
4590
4601
|
|
|
4602
|
+
//
|
|
4603
|
+
|
|
4604
|
+
|
|
4605
|
+
|
|
4606
|
+
|
|
4607
|
+
|
|
4608
|
+
class MeetingStatus {
|
|
4609
|
+
|
|
4610
|
+
|
|
4611
|
+
|
|
4612
|
+
|
|
4613
|
+
constructor({
|
|
4614
|
+
full,
|
|
4615
|
+
} = {}) {
|
|
4616
|
+
this.full = full;
|
|
4617
|
+
|
|
4618
|
+
// Useful to compare instead of instanceof with minified code
|
|
4619
|
+
this.type = 'MeetingStatus';
|
|
4620
|
+
}
|
|
4621
|
+
|
|
4622
|
+
static parse(plain ) {
|
|
4623
|
+
return new MeetingStatus({
|
|
4624
|
+
full: plain.full,
|
|
4625
|
+
});
|
|
4626
|
+
}
|
|
4627
|
+
|
|
4628
|
+
}
|
|
4629
|
+
|
|
4591
4630
|
/* */
|
|
4592
4631
|
|
|
4593
4632
|
|
|
@@ -4782,6 +4821,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4782
4821
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4783
4822
|
ApiRequester.successResponseParser),
|
|
4784
4823
|
|
|
4824
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4825
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4785
4826
|
});
|
|
4786
4827
|
|
|
4787
4828
|
//
|
|
@@ -5341,7 +5382,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
|
|
|
5341
5382
|
const ON_DISCONNECTED = 'onDisconnected';
|
|
5342
5383
|
class CanceledCallError extends Error {}
|
|
5343
5384
|
|
|
5344
|
-
const MAX_REGISTER_TRIES =
|
|
5385
|
+
const MAX_REGISTER_TRIES = 5;
|
|
5345
5386
|
|
|
5346
5387
|
|
|
5347
5388
|
|
|
@@ -5395,6 +5436,7 @@ class WebRTCClient extends Emitter {
|
|
|
5395
5436
|
|
|
5396
5437
|
|
|
5397
5438
|
|
|
5439
|
+
|
|
5398
5440
|
|
|
5399
5441
|
// sugar
|
|
5400
5442
|
|
|
@@ -5457,6 +5499,7 @@ class WebRTCClient extends Emitter {
|
|
|
5457
5499
|
this.conferences = {};
|
|
5458
5500
|
this.networkMonitoringInterval = {};
|
|
5459
5501
|
this.sessionNetworkStats = {};
|
|
5502
|
+
this.forceClosed = false;
|
|
5460
5503
|
|
|
5461
5504
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
5462
5505
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -5578,6 +5621,8 @@ class WebRTCClient extends Emitter {
|
|
|
5578
5621
|
skipRegister: this.skipRegister,
|
|
5579
5622
|
};
|
|
5580
5623
|
|
|
5624
|
+
this.forceClosed = false;
|
|
5625
|
+
|
|
5581
5626
|
if (this.skipRegister) {
|
|
5582
5627
|
logger.info('sdk webrtc skip register...', logInfo);
|
|
5583
5628
|
return Promise.resolve();
|
|
@@ -5602,7 +5647,15 @@ class WebRTCClient extends Emitter {
|
|
|
5602
5647
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
5603
5648
|
|
|
5604
5649
|
const onRegisterFailed = () => {
|
|
5605
|
-
logger.info('sdk webrtc registering failed', {
|
|
5650
|
+
logger.info('sdk webrtc registering failed', {
|
|
5651
|
+
tries,
|
|
5652
|
+
registerer: !!this.registerer,
|
|
5653
|
+
forceClosed: this.forceClosed,
|
|
5654
|
+
});
|
|
5655
|
+
if (this.forceClosed) {
|
|
5656
|
+
return;
|
|
5657
|
+
}
|
|
5658
|
+
|
|
5606
5659
|
this.connectionPromise = null;
|
|
5607
5660
|
if (this.registerer && this.registerer.waiting) {
|
|
5608
5661
|
this.registerer.waitingToggle(false);
|
|
@@ -5880,8 +5933,9 @@ class WebRTCClient extends Emitter {
|
|
|
5880
5933
|
}
|
|
5881
5934
|
}
|
|
5882
5935
|
|
|
5883
|
-
async close() {
|
|
5884
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
5936
|
+
async close(force = false) {
|
|
5937
|
+
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
5938
|
+
this.forceClosed = force;
|
|
5885
5939
|
this._cleanupMedia();
|
|
5886
5940
|
this.connectionPromise = null;
|
|
5887
5941
|
|
|
@@ -5900,7 +5954,7 @@ class WebRTCClient extends Emitter {
|
|
|
5900
5954
|
this.userAgent.delegate = null;
|
|
5901
5955
|
this.userAgent.stateChange.removeAllListeners();
|
|
5902
5956
|
|
|
5903
|
-
await this._disconnectTransport();
|
|
5957
|
+
await this._disconnectTransport(force);
|
|
5904
5958
|
|
|
5905
5959
|
this._cleanupRegister();
|
|
5906
5960
|
|
|
@@ -7336,7 +7390,15 @@ class WebRTCClient extends Emitter {
|
|
|
7336
7390
|
return userAgent.UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
7337
7391
|
}
|
|
7338
7392
|
|
|
7339
|
-
async _disconnectTransport() {
|
|
7393
|
+
async _disconnectTransport(force = false) {
|
|
7394
|
+
if (force) {
|
|
7395
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7396
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
7397
|
+
// eslint-disable-next-line
|
|
7398
|
+
this.userAgent.transport._ws.close(1000);
|
|
7399
|
+
return;
|
|
7400
|
+
}
|
|
7401
|
+
|
|
7340
7402
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
7341
7403
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
7342
7404
|
try {
|
package/lib/api/auth.js
CHANGED
|
@@ -968,6 +968,7 @@ var auth = (client , baseUrl ) => ({
|
|
|
968
968
|
|
|
969
969
|
|
|
970
970
|
|
|
971
|
+
|
|
971
972
|
) {
|
|
972
973
|
const body = {
|
|
973
974
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -987,6 +988,10 @@ var auth = (client , baseUrl ) => ({
|
|
|
987
988
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
988
989
|
}
|
|
989
990
|
|
|
991
|
+
if (params.tenantId) {
|
|
992
|
+
body.tenant_id = params.tenantId;
|
|
993
|
+
}
|
|
994
|
+
|
|
990
995
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
991
996
|
},
|
|
992
997
|
|
package/lib/api/call-logd.js
CHANGED
|
@@ -483,11 +483,13 @@ class Recording {
|
|
|
483
483
|
|
|
484
484
|
|
|
485
485
|
|
|
486
|
+
|
|
486
487
|
|
|
487
488
|
|
|
488
489
|
|
|
489
490
|
|
|
490
491
|
|
|
492
|
+
|
|
491
493
|
|
|
492
494
|
|
|
493
495
|
|
|
@@ -508,10 +510,12 @@ class Recording {
|
|
|
508
510
|
|
|
509
511
|
|
|
510
512
|
|
|
513
|
+
|
|
511
514
|
|
|
512
515
|
|
|
513
516
|
|
|
514
517
|
|
|
518
|
+
|
|
515
519
|
|
|
516
520
|
|
|
517
521
|
|
|
@@ -573,10 +577,12 @@ class CallLog {
|
|
|
573
577
|
|| plain.destination_extension
|
|
574
578
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
575
579
|
name: plain.requested_name || plain.destination_name || '',
|
|
580
|
+
uuid: plain.destination_user_uuid,
|
|
576
581
|
},
|
|
577
582
|
source: {
|
|
578
583
|
extension: plain.source_extension,
|
|
579
584
|
name: plain.source_name,
|
|
585
|
+
uuid: plain.source_user_uuid,
|
|
580
586
|
},
|
|
581
587
|
id: plain.id,
|
|
582
588
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
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
|
@@ -2203,6 +2203,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2203
2203
|
|
|
2204
2204
|
|
|
2205
2205
|
|
|
2206
|
+
|
|
2206
2207
|
) {
|
|
2207
2208
|
const body = {
|
|
2208
2209
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2222,6 +2223,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2222
2223
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
2223
2224
|
}
|
|
2224
2225
|
|
|
2226
|
+
if (params.tenantId) {
|
|
2227
|
+
body.tenant_id = params.tenantId;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2225
2230
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2226
2231
|
},
|
|
2227
2232
|
|
|
@@ -3290,11 +3295,13 @@ class Recording {
|
|
|
3290
3295
|
|
|
3291
3296
|
|
|
3292
3297
|
|
|
3298
|
+
|
|
3293
3299
|
|
|
3294
3300
|
|
|
3295
3301
|
|
|
3296
3302
|
|
|
3297
3303
|
|
|
3304
|
+
|
|
3298
3305
|
|
|
3299
3306
|
|
|
3300
3307
|
|
|
@@ -3315,10 +3322,12 @@ class Recording {
|
|
|
3315
3322
|
|
|
3316
3323
|
|
|
3317
3324
|
|
|
3325
|
+
|
|
3318
3326
|
|
|
3319
3327
|
|
|
3320
3328
|
|
|
3321
3329
|
|
|
3330
|
+
|
|
3322
3331
|
|
|
3323
3332
|
|
|
3324
3333
|
|
|
@@ -3380,10 +3389,12 @@ class CallLog {
|
|
|
3380
3389
|
|| plain.destination_extension
|
|
3381
3390
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3382
3391
|
name: plain.requested_name || plain.destination_name || '',
|
|
3392
|
+
uuid: plain.destination_user_uuid,
|
|
3383
3393
|
},
|
|
3384
3394
|
source: {
|
|
3385
3395
|
extension: plain.source_extension,
|
|
3386
3396
|
name: plain.source_name,
|
|
3397
|
+
uuid: plain.source_user_uuid,
|
|
3387
3398
|
},
|
|
3388
3399
|
id: plain.id,
|
|
3389
3400
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -4037,6 +4048,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4037
4048
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4038
4049
|
});
|
|
4039
4050
|
|
|
4051
|
+
//
|
|
4052
|
+
|
|
4053
|
+
|
|
4054
|
+
|
|
4055
|
+
|
|
4056
|
+
|
|
4057
|
+
class MeetingStatus {
|
|
4058
|
+
|
|
4059
|
+
|
|
4060
|
+
|
|
4061
|
+
|
|
4062
|
+
constructor({
|
|
4063
|
+
full,
|
|
4064
|
+
} = {}) {
|
|
4065
|
+
this.full = full;
|
|
4066
|
+
|
|
4067
|
+
// Useful to compare instead of instanceof with minified code
|
|
4068
|
+
this.type = 'MeetingStatus';
|
|
4069
|
+
}
|
|
4070
|
+
|
|
4071
|
+
static parse(plain ) {
|
|
4072
|
+
return new MeetingStatus({
|
|
4073
|
+
full: plain.full,
|
|
4074
|
+
});
|
|
4075
|
+
}
|
|
4076
|
+
|
|
4077
|
+
}
|
|
4078
|
+
|
|
4040
4079
|
/* */
|
|
4041
4080
|
|
|
4042
4081
|
|
|
@@ -4231,6 +4270,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4231
4270
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4232
4271
|
ApiRequester.successResponseParser),
|
|
4233
4272
|
|
|
4273
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4274
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4234
4275
|
});
|
|
4235
4276
|
|
|
4236
4277
|
//
|