@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/lib/checker/Checker.js
CHANGED
|
@@ -2225,6 +2225,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2225
2225
|
|
|
2226
2226
|
|
|
2227
2227
|
|
|
2228
|
+
|
|
2228
2229
|
) {
|
|
2229
2230
|
const body = {
|
|
2230
2231
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2244,6 +2245,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2244
2245
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
2245
2246
|
}
|
|
2246
2247
|
|
|
2248
|
+
if (params.tenantId) {
|
|
2249
|
+
body.tenant_id = params.tenantId;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2247
2252
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2248
2253
|
},
|
|
2249
2254
|
|
|
@@ -3338,11 +3343,13 @@ class Recording {
|
|
|
3338
3343
|
|
|
3339
3344
|
|
|
3340
3345
|
|
|
3346
|
+
|
|
3341
3347
|
|
|
3342
3348
|
|
|
3343
3349
|
|
|
3344
3350
|
|
|
3345
3351
|
|
|
3352
|
+
|
|
3346
3353
|
|
|
3347
3354
|
|
|
3348
3355
|
|
|
@@ -3363,10 +3370,12 @@ class Recording {
|
|
|
3363
3370
|
|
|
3364
3371
|
|
|
3365
3372
|
|
|
3373
|
+
|
|
3366
3374
|
|
|
3367
3375
|
|
|
3368
3376
|
|
|
3369
3377
|
|
|
3378
|
+
|
|
3370
3379
|
|
|
3371
3380
|
|
|
3372
3381
|
|
|
@@ -3428,10 +3437,12 @@ class CallLog {
|
|
|
3428
3437
|
|| plain.destination_extension
|
|
3429
3438
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3430
3439
|
name: plain.requested_name || plain.destination_name || '',
|
|
3440
|
+
uuid: plain.destination_user_uuid,
|
|
3431
3441
|
},
|
|
3432
3442
|
source: {
|
|
3433
3443
|
extension: plain.source_extension,
|
|
3434
3444
|
name: plain.source_name,
|
|
3445
|
+
uuid: plain.source_user_uuid,
|
|
3435
3446
|
},
|
|
3436
3447
|
id: plain.id,
|
|
3437
3448
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -4085,6 +4096,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4085
4096
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4086
4097
|
});
|
|
4087
4098
|
|
|
4099
|
+
//
|
|
4100
|
+
|
|
4101
|
+
|
|
4102
|
+
|
|
4103
|
+
|
|
4104
|
+
|
|
4105
|
+
class MeetingStatus {
|
|
4106
|
+
|
|
4107
|
+
|
|
4108
|
+
|
|
4109
|
+
|
|
4110
|
+
constructor({
|
|
4111
|
+
full,
|
|
4112
|
+
} = {}) {
|
|
4113
|
+
this.full = full;
|
|
4114
|
+
|
|
4115
|
+
// Useful to compare instead of instanceof with minified code
|
|
4116
|
+
this.type = 'MeetingStatus';
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
static parse(plain ) {
|
|
4120
|
+
return new MeetingStatus({
|
|
4121
|
+
full: plain.full,
|
|
4122
|
+
});
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4125
|
+
}
|
|
4126
|
+
|
|
4088
4127
|
/* */
|
|
4089
4128
|
|
|
4090
4129
|
|
|
@@ -4279,6 +4318,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4279
4318
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4280
4319
|
ApiRequester.successResponseParser),
|
|
4281
4320
|
|
|
4321
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4322
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4282
4323
|
});
|
|
4283
4324
|
|
|
4284
4325
|
//
|
|
@@ -5927,7 +5968,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
|
|
|
5927
5968
|
const ON_DISCONNECTED = 'onDisconnected';
|
|
5928
5969
|
class CanceledCallError extends Error {}
|
|
5929
5970
|
|
|
5930
|
-
const MAX_REGISTER_TRIES =
|
|
5971
|
+
const MAX_REGISTER_TRIES = 5;
|
|
5931
5972
|
|
|
5932
5973
|
|
|
5933
5974
|
|
|
@@ -5981,6 +6022,7 @@ class WebRTCClient extends Emitter {
|
|
|
5981
6022
|
|
|
5982
6023
|
|
|
5983
6024
|
|
|
6025
|
+
|
|
5984
6026
|
|
|
5985
6027
|
// sugar
|
|
5986
6028
|
|
|
@@ -6043,6 +6085,7 @@ class WebRTCClient extends Emitter {
|
|
|
6043
6085
|
this.conferences = {};
|
|
6044
6086
|
this.networkMonitoringInterval = {};
|
|
6045
6087
|
this.sessionNetworkStats = {};
|
|
6088
|
+
this.forceClosed = false;
|
|
6046
6089
|
|
|
6047
6090
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
6048
6091
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -6164,6 +6207,8 @@ class WebRTCClient extends Emitter {
|
|
|
6164
6207
|
skipRegister: this.skipRegister,
|
|
6165
6208
|
};
|
|
6166
6209
|
|
|
6210
|
+
this.forceClosed = false;
|
|
6211
|
+
|
|
6167
6212
|
if (this.skipRegister) {
|
|
6168
6213
|
logger$1.info('sdk webrtc skip register...', logInfo);
|
|
6169
6214
|
return Promise.resolve();
|
|
@@ -6188,7 +6233,15 @@ class WebRTCClient extends Emitter {
|
|
|
6188
6233
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6189
6234
|
|
|
6190
6235
|
const onRegisterFailed = () => {
|
|
6191
|
-
logger$1.info('sdk webrtc registering failed', {
|
|
6236
|
+
logger$1.info('sdk webrtc registering failed', {
|
|
6237
|
+
tries,
|
|
6238
|
+
registerer: !!this.registerer,
|
|
6239
|
+
forceClosed: this.forceClosed,
|
|
6240
|
+
});
|
|
6241
|
+
if (this.forceClosed) {
|
|
6242
|
+
return;
|
|
6243
|
+
}
|
|
6244
|
+
|
|
6192
6245
|
this.connectionPromise = null;
|
|
6193
6246
|
if (this.registerer && this.registerer.waiting) {
|
|
6194
6247
|
this.registerer.waitingToggle(false);
|
|
@@ -6466,8 +6519,9 @@ class WebRTCClient extends Emitter {
|
|
|
6466
6519
|
}
|
|
6467
6520
|
}
|
|
6468
6521
|
|
|
6469
|
-
async close() {
|
|
6470
|
-
logger$1.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6522
|
+
async close(force = false) {
|
|
6523
|
+
logger$1.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
6524
|
+
this.forceClosed = force;
|
|
6471
6525
|
this._cleanupMedia();
|
|
6472
6526
|
this.connectionPromise = null;
|
|
6473
6527
|
|
|
@@ -6486,7 +6540,7 @@ class WebRTCClient extends Emitter {
|
|
|
6486
6540
|
this.userAgent.delegate = null;
|
|
6487
6541
|
this.userAgent.stateChange.removeAllListeners();
|
|
6488
6542
|
|
|
6489
|
-
await this._disconnectTransport();
|
|
6543
|
+
await this._disconnectTransport(force);
|
|
6490
6544
|
|
|
6491
6545
|
this._cleanupRegister();
|
|
6492
6546
|
|
|
@@ -7922,7 +7976,15 @@ class WebRTCClient extends Emitter {
|
|
|
7922
7976
|
return userAgent.UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
7923
7977
|
}
|
|
7924
7978
|
|
|
7925
|
-
async _disconnectTransport() {
|
|
7979
|
+
async _disconnectTransport(force = false) {
|
|
7980
|
+
if (force) {
|
|
7981
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7982
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
7983
|
+
// eslint-disable-next-line
|
|
7984
|
+
this.userAgent.transport._ws.close(1000);
|
|
7985
|
+
return;
|
|
7986
|
+
}
|
|
7987
|
+
|
|
7926
7988
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
7927
7989
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
7928
7990
|
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
|
//
|
|
@@ -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
|
//
|
|
@@ -2225,6 +2225,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2225
2225
|
|
|
2226
2226
|
|
|
2227
2227
|
|
|
2228
|
+
|
|
2228
2229
|
) {
|
|
2229
2230
|
const body = {
|
|
2230
2231
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2244,6 +2245,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2244
2245
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
2245
2246
|
}
|
|
2246
2247
|
|
|
2248
|
+
if (params.tenantId) {
|
|
2249
|
+
body.tenant_id = params.tenantId;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2247
2252
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2248
2253
|
},
|
|
2249
2254
|
|
|
@@ -3338,11 +3343,13 @@ class Recording {
|
|
|
3338
3343
|
|
|
3339
3344
|
|
|
3340
3345
|
|
|
3346
|
+
|
|
3341
3347
|
|
|
3342
3348
|
|
|
3343
3349
|
|
|
3344
3350
|
|
|
3345
3351
|
|
|
3352
|
+
|
|
3346
3353
|
|
|
3347
3354
|
|
|
3348
3355
|
|
|
@@ -3363,10 +3370,12 @@ class Recording {
|
|
|
3363
3370
|
|
|
3364
3371
|
|
|
3365
3372
|
|
|
3373
|
+
|
|
3366
3374
|
|
|
3367
3375
|
|
|
3368
3376
|
|
|
3369
3377
|
|
|
3378
|
+
|
|
3370
3379
|
|
|
3371
3380
|
|
|
3372
3381
|
|
|
@@ -3428,10 +3437,12 @@ class CallLog {
|
|
|
3428
3437
|
|| plain.destination_extension
|
|
3429
3438
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3430
3439
|
name: plain.requested_name || plain.destination_name || '',
|
|
3440
|
+
uuid: plain.destination_user_uuid,
|
|
3431
3441
|
},
|
|
3432
3442
|
source: {
|
|
3433
3443
|
extension: plain.source_extension,
|
|
3434
3444
|
name: plain.source_name,
|
|
3445
|
+
uuid: plain.source_user_uuid,
|
|
3435
3446
|
},
|
|
3436
3447
|
id: plain.id,
|
|
3437
3448
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -4085,6 +4096,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4085
4096
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4086
4097
|
});
|
|
4087
4098
|
|
|
4099
|
+
//
|
|
4100
|
+
|
|
4101
|
+
|
|
4102
|
+
|
|
4103
|
+
|
|
4104
|
+
|
|
4105
|
+
class MeetingStatus {
|
|
4106
|
+
|
|
4107
|
+
|
|
4108
|
+
|
|
4109
|
+
|
|
4110
|
+
constructor({
|
|
4111
|
+
full,
|
|
4112
|
+
} = {}) {
|
|
4113
|
+
this.full = full;
|
|
4114
|
+
|
|
4115
|
+
// Useful to compare instead of instanceof with minified code
|
|
4116
|
+
this.type = 'MeetingStatus';
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
static parse(plain ) {
|
|
4120
|
+
return new MeetingStatus({
|
|
4121
|
+
full: plain.full,
|
|
4122
|
+
});
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4125
|
+
}
|
|
4126
|
+
|
|
4088
4127
|
/* */
|
|
4089
4128
|
|
|
4090
4129
|
|
|
@@ -4279,6 +4318,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4279
4318
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4280
4319
|
ApiRequester.successResponseParser),
|
|
4281
4320
|
|
|
4321
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4322
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4282
4323
|
});
|
|
4283
4324
|
|
|
4284
4325
|
//
|
|
@@ -5927,7 +5968,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
|
|
|
5927
5968
|
const ON_DISCONNECTED = 'onDisconnected';
|
|
5928
5969
|
class CanceledCallError extends Error {}
|
|
5929
5970
|
|
|
5930
|
-
const MAX_REGISTER_TRIES =
|
|
5971
|
+
const MAX_REGISTER_TRIES = 5;
|
|
5931
5972
|
|
|
5932
5973
|
|
|
5933
5974
|
|
|
@@ -5981,6 +6022,7 @@ class WebRTCClient extends Emitter {
|
|
|
5981
6022
|
|
|
5982
6023
|
|
|
5983
6024
|
|
|
6025
|
+
|
|
5984
6026
|
|
|
5985
6027
|
// sugar
|
|
5986
6028
|
|
|
@@ -6043,6 +6085,7 @@ class WebRTCClient extends Emitter {
|
|
|
6043
6085
|
this.conferences = {};
|
|
6044
6086
|
this.networkMonitoringInterval = {};
|
|
6045
6087
|
this.sessionNetworkStats = {};
|
|
6088
|
+
this.forceClosed = false;
|
|
6046
6089
|
|
|
6047
6090
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
6048
6091
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -6164,6 +6207,8 @@ class WebRTCClient extends Emitter {
|
|
|
6164
6207
|
skipRegister: this.skipRegister,
|
|
6165
6208
|
};
|
|
6166
6209
|
|
|
6210
|
+
this.forceClosed = false;
|
|
6211
|
+
|
|
6167
6212
|
if (this.skipRegister) {
|
|
6168
6213
|
logger.info('sdk webrtc skip register...', logInfo);
|
|
6169
6214
|
return Promise.resolve();
|
|
@@ -6188,7 +6233,15 @@ class WebRTCClient extends Emitter {
|
|
|
6188
6233
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6189
6234
|
|
|
6190
6235
|
const onRegisterFailed = () => {
|
|
6191
|
-
logger.info('sdk webrtc registering failed', {
|
|
6236
|
+
logger.info('sdk webrtc registering failed', {
|
|
6237
|
+
tries,
|
|
6238
|
+
registerer: !!this.registerer,
|
|
6239
|
+
forceClosed: this.forceClosed,
|
|
6240
|
+
});
|
|
6241
|
+
if (this.forceClosed) {
|
|
6242
|
+
return;
|
|
6243
|
+
}
|
|
6244
|
+
|
|
6192
6245
|
this.connectionPromise = null;
|
|
6193
6246
|
if (this.registerer && this.registerer.waiting) {
|
|
6194
6247
|
this.registerer.waitingToggle(false);
|
|
@@ -6466,8 +6519,9 @@ class WebRTCClient extends Emitter {
|
|
|
6466
6519
|
}
|
|
6467
6520
|
}
|
|
6468
6521
|
|
|
6469
|
-
async close() {
|
|
6470
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6522
|
+
async close(force = false) {
|
|
6523
|
+
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
6524
|
+
this.forceClosed = force;
|
|
6471
6525
|
this._cleanupMedia();
|
|
6472
6526
|
this.connectionPromise = null;
|
|
6473
6527
|
|
|
@@ -6486,7 +6540,7 @@ class WebRTCClient extends Emitter {
|
|
|
6486
6540
|
this.userAgent.delegate = null;
|
|
6487
6541
|
this.userAgent.stateChange.removeAllListeners();
|
|
6488
6542
|
|
|
6489
|
-
await this._disconnectTransport();
|
|
6543
|
+
await this._disconnectTransport(force);
|
|
6490
6544
|
|
|
6491
6545
|
this._cleanupRegister();
|
|
6492
6546
|
|
|
@@ -7922,7 +7976,15 @@ class WebRTCClient extends Emitter {
|
|
|
7922
7976
|
return userAgent.UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
7923
7977
|
}
|
|
7924
7978
|
|
|
7925
|
-
async _disconnectTransport() {
|
|
7979
|
+
async _disconnectTransport(force = false) {
|
|
7980
|
+
if (force) {
|
|
7981
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7982
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
7983
|
+
// eslint-disable-next-line
|
|
7984
|
+
this.userAgent.transport._ws.close(1000);
|
|
7985
|
+
return;
|
|
7986
|
+
}
|
|
7987
|
+
|
|
7926
7988
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
7927
7989
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
7928
7990
|
try {
|