@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/simple/Auth.js
CHANGED
|
@@ -2216,6 +2216,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2216
2216
|
|
|
2217
2217
|
|
|
2218
2218
|
|
|
2219
|
+
|
|
2219
2220
|
) {
|
|
2220
2221
|
const body = {
|
|
2221
2222
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2235,6 +2236,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2235
2236
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
2236
2237
|
}
|
|
2237
2238
|
|
|
2239
|
+
if (params.tenantId) {
|
|
2240
|
+
body.tenant_id = params.tenantId;
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2238
2243
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2239
2244
|
},
|
|
2240
2245
|
|
|
@@ -3591,6 +3596,14 @@ class CallSession {
|
|
|
3591
3596
|
return !!this.answerTime;
|
|
3592
3597
|
}
|
|
3593
3598
|
|
|
3599
|
+
toJSON() {
|
|
3600
|
+
const jsonObj = { ...this };
|
|
3601
|
+
// $FlowFixMe
|
|
3602
|
+
jsonObj.answered = this.answered;
|
|
3603
|
+
|
|
3604
|
+
return jsonObj;
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3594
3607
|
static parseCall(call ) {
|
|
3595
3608
|
return new CallSession({
|
|
3596
3609
|
callId: call.id,
|
|
@@ -3701,11 +3714,13 @@ class Recording {
|
|
|
3701
3714
|
|
|
3702
3715
|
|
|
3703
3716
|
|
|
3717
|
+
|
|
3704
3718
|
|
|
3705
3719
|
|
|
3706
3720
|
|
|
3707
3721
|
|
|
3708
3722
|
|
|
3723
|
+
|
|
3709
3724
|
|
|
3710
3725
|
|
|
3711
3726
|
|
|
@@ -3726,10 +3741,12 @@ class Recording {
|
|
|
3726
3741
|
|
|
3727
3742
|
|
|
3728
3743
|
|
|
3744
|
+
|
|
3729
3745
|
|
|
3730
3746
|
|
|
3731
3747
|
|
|
3732
3748
|
|
|
3749
|
+
|
|
3733
3750
|
|
|
3734
3751
|
|
|
3735
3752
|
|
|
@@ -3791,10 +3808,12 @@ class CallLog {
|
|
|
3791
3808
|
|| plain.destination_extension
|
|
3792
3809
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3793
3810
|
name: plain.requested_name || plain.destination_name || '',
|
|
3811
|
+
uuid: plain.destination_user_uuid,
|
|
3794
3812
|
},
|
|
3795
3813
|
source: {
|
|
3796
3814
|
extension: plain.source_extension,
|
|
3797
3815
|
name: plain.source_name,
|
|
3816
|
+
uuid: plain.source_user_uuid,
|
|
3798
3817
|
},
|
|
3799
3818
|
id: plain.id,
|
|
3800
3819
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -4842,6 +4861,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4842
4861
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4843
4862
|
});
|
|
4844
4863
|
|
|
4864
|
+
//
|
|
4865
|
+
|
|
4866
|
+
|
|
4867
|
+
|
|
4868
|
+
|
|
4869
|
+
|
|
4870
|
+
class MeetingStatus {
|
|
4871
|
+
|
|
4872
|
+
|
|
4873
|
+
|
|
4874
|
+
|
|
4875
|
+
constructor({
|
|
4876
|
+
full,
|
|
4877
|
+
} = {}) {
|
|
4878
|
+
this.full = full;
|
|
4879
|
+
|
|
4880
|
+
// Useful to compare instead of instanceof with minified code
|
|
4881
|
+
this.type = 'MeetingStatus';
|
|
4882
|
+
}
|
|
4883
|
+
|
|
4884
|
+
static parse(plain ) {
|
|
4885
|
+
return new MeetingStatus({
|
|
4886
|
+
full: plain.full,
|
|
4887
|
+
});
|
|
4888
|
+
}
|
|
4889
|
+
|
|
4890
|
+
}
|
|
4891
|
+
|
|
4845
4892
|
/* */
|
|
4846
4893
|
|
|
4847
4894
|
|
|
@@ -5036,6 +5083,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
5036
5083
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
5037
5084
|
ApiRequester.successResponseParser),
|
|
5038
5085
|
|
|
5086
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
5087
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
5039
5088
|
});
|
|
5040
5089
|
|
|
5041
5090
|
//
|
|
@@ -6361,7 +6410,7 @@ const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
|
6361
6410
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6362
6411
|
class CanceledCallError extends Error {}
|
|
6363
6412
|
|
|
6364
|
-
const MAX_REGISTER_TRIES =
|
|
6413
|
+
const MAX_REGISTER_TRIES = 5;
|
|
6365
6414
|
|
|
6366
6415
|
|
|
6367
6416
|
|
|
@@ -6415,6 +6464,7 @@ class WebRTCClient extends Emitter {
|
|
|
6415
6464
|
|
|
6416
6465
|
|
|
6417
6466
|
|
|
6467
|
+
|
|
6418
6468
|
|
|
6419
6469
|
// sugar
|
|
6420
6470
|
|
|
@@ -6477,6 +6527,7 @@ class WebRTCClient extends Emitter {
|
|
|
6477
6527
|
this.conferences = {};
|
|
6478
6528
|
this.networkMonitoringInterval = {};
|
|
6479
6529
|
this.sessionNetworkStats = {};
|
|
6530
|
+
this.forceClosed = false;
|
|
6480
6531
|
|
|
6481
6532
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
6482
6533
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -6598,6 +6649,8 @@ class WebRTCClient extends Emitter {
|
|
|
6598
6649
|
skipRegister: this.skipRegister,
|
|
6599
6650
|
};
|
|
6600
6651
|
|
|
6652
|
+
this.forceClosed = false;
|
|
6653
|
+
|
|
6601
6654
|
if (this.skipRegister) {
|
|
6602
6655
|
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6603
6656
|
return Promise.resolve();
|
|
@@ -6622,7 +6675,15 @@ class WebRTCClient extends Emitter {
|
|
|
6622
6675
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6623
6676
|
|
|
6624
6677
|
const onRegisterFailed = () => {
|
|
6625
|
-
logger$9.info('sdk webrtc registering failed', {
|
|
6678
|
+
logger$9.info('sdk webrtc registering failed', {
|
|
6679
|
+
tries,
|
|
6680
|
+
registerer: !!this.registerer,
|
|
6681
|
+
forceClosed: this.forceClosed,
|
|
6682
|
+
});
|
|
6683
|
+
if (this.forceClosed) {
|
|
6684
|
+
return;
|
|
6685
|
+
}
|
|
6686
|
+
|
|
6626
6687
|
this.connectionPromise = null;
|
|
6627
6688
|
if (this.registerer && this.registerer.waiting) {
|
|
6628
6689
|
this.registerer.waitingToggle(false);
|
|
@@ -6900,8 +6961,9 @@ class WebRTCClient extends Emitter {
|
|
|
6900
6961
|
}
|
|
6901
6962
|
}
|
|
6902
6963
|
|
|
6903
|
-
async close() {
|
|
6904
|
-
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6964
|
+
async close(force = false) {
|
|
6965
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
6966
|
+
this.forceClosed = force;
|
|
6905
6967
|
this._cleanupMedia();
|
|
6906
6968
|
this.connectionPromise = null;
|
|
6907
6969
|
|
|
@@ -6920,7 +6982,7 @@ class WebRTCClient extends Emitter {
|
|
|
6920
6982
|
this.userAgent.delegate = null;
|
|
6921
6983
|
this.userAgent.stateChange.removeAllListeners();
|
|
6922
6984
|
|
|
6923
|
-
await this._disconnectTransport();
|
|
6985
|
+
await this._disconnectTransport(force);
|
|
6924
6986
|
|
|
6925
6987
|
this._cleanupRegister();
|
|
6926
6988
|
|
|
@@ -8356,7 +8418,15 @@ class WebRTCClient extends Emitter {
|
|
|
8356
8418
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
8357
8419
|
}
|
|
8358
8420
|
|
|
8359
|
-
async _disconnectTransport() {
|
|
8421
|
+
async _disconnectTransport(force = false) {
|
|
8422
|
+
if (force) {
|
|
8423
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8424
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
8425
|
+
// eslint-disable-next-line
|
|
8426
|
+
this.userAgent.transport._ws.close(1000);
|
|
8427
|
+
return;
|
|
8428
|
+
}
|
|
8429
|
+
|
|
8360
8430
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
8361
8431
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
8362
8432
|
try {
|
|
@@ -9303,6 +9373,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9303
9373
|
return Promise.resolve(null);
|
|
9304
9374
|
}
|
|
9305
9375
|
|
|
9376
|
+
const sipSessionId = this.getSipSessionIdFromCallSession(callSession);
|
|
9377
|
+
if (sipSessionId && !(sipSessionId in this.callSessions)) {
|
|
9378
|
+
logger$8.warn('Call session already ended or not found, can\'t accept it.', { sipSessionId });
|
|
9379
|
+
return Promise.resolve(null);
|
|
9380
|
+
}
|
|
9381
|
+
|
|
9306
9382
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9307
9383
|
logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9308
9384
|
return Promise.resolve(callSession.sipCallId);
|
|
@@ -9763,7 +9839,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9763
9839
|
return this.client && this.client.isConference(callSession.sipCallId);
|
|
9764
9840
|
}
|
|
9765
9841
|
|
|
9766
|
-
async close() {
|
|
9842
|
+
async close(force = false) {
|
|
9767
9843
|
logger$8.info('WebRTC close');
|
|
9768
9844
|
|
|
9769
9845
|
try {
|
|
@@ -9775,7 +9851,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9775
9851
|
logger$8.error('WebRTC close, unregister error', e);
|
|
9776
9852
|
}
|
|
9777
9853
|
|
|
9778
|
-
this.client.close();
|
|
9854
|
+
this.client.close(force);
|
|
9779
9855
|
this.unbind();
|
|
9780
9856
|
|
|
9781
9857
|
this.incomingSessions = [];
|
|
@@ -9927,9 +10003,17 @@ class WebRTCPhone extends Emitter {
|
|
|
9927
10003
|
});
|
|
9928
10004
|
|
|
9929
10005
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
9930
|
-
|
|
10006
|
+
const sessionId = this.getSipSessionId(sipSession);
|
|
10007
|
+
const hasSession = sessionId in this.callSessions;
|
|
10008
|
+
|
|
10009
|
+
logger$8.info('WebRTC call accepted', { sipId: sessionId, hasSession });
|
|
10010
|
+
|
|
10011
|
+
if (!hasSession) {
|
|
10012
|
+
logger$8.warn('Call accepted ignored, session is no longer present in the WebRtcPhone', { sessionId });
|
|
10013
|
+
return;
|
|
10014
|
+
}
|
|
9931
10015
|
|
|
9932
|
-
this._onCallAccepted(sipSession, this.client.hasVideo(
|
|
10016
|
+
this._onCallAccepted(sipSession, this.client.hasVideo(sessionId));
|
|
9933
10017
|
|
|
9934
10018
|
if (this.audioOutputDeviceId) {
|
|
9935
10019
|
this.client.changeAudioOutputDevice(this.audioOutputDeviceId);
|
|
@@ -10065,9 +10149,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10065
10149
|
return this.client.getSipSessionId(sipSession);
|
|
10066
10150
|
}
|
|
10067
10151
|
|
|
10068
|
-
|
|
10152
|
+
getSipSessionIdFromCallSession(callSession ) {
|
|
10069
10153
|
const sipSession = this.findSipSession(callSession);
|
|
10070
|
-
|
|
10154
|
+
|
|
10155
|
+
return sipSession ? this.getSipSessionId(sipSession) : null;
|
|
10156
|
+
}
|
|
10157
|
+
|
|
10158
|
+
_updateCallSession(callSession ) {
|
|
10159
|
+
const sipSessionId = this.getSipSessionIdFromCallSession(callSession);
|
|
10071
10160
|
|
|
10072
10161
|
if (sipSessionId) {
|
|
10073
10162
|
this.callSessions[sipSessionId] = callSession;
|
|
@@ -2216,6 +2216,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2216
2216
|
|
|
2217
2217
|
|
|
2218
2218
|
|
|
2219
|
+
|
|
2219
2220
|
) {
|
|
2220
2221
|
const body = {
|
|
2221
2222
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2235,6 +2236,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2235
2236
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
2236
2237
|
}
|
|
2237
2238
|
|
|
2239
|
+
if (params.tenantId) {
|
|
2240
|
+
body.tenant_id = params.tenantId;
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2238
2243
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2239
2244
|
},
|
|
2240
2245
|
|
|
@@ -3591,6 +3596,14 @@ class CallSession {
|
|
|
3591
3596
|
return !!this.answerTime;
|
|
3592
3597
|
}
|
|
3593
3598
|
|
|
3599
|
+
toJSON() {
|
|
3600
|
+
const jsonObj = { ...this };
|
|
3601
|
+
// $FlowFixMe
|
|
3602
|
+
jsonObj.answered = this.answered;
|
|
3603
|
+
|
|
3604
|
+
return jsonObj;
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3594
3607
|
static parseCall(call ) {
|
|
3595
3608
|
return new CallSession({
|
|
3596
3609
|
callId: call.id,
|
|
@@ -3701,11 +3714,13 @@ class Recording {
|
|
|
3701
3714
|
|
|
3702
3715
|
|
|
3703
3716
|
|
|
3717
|
+
|
|
3704
3718
|
|
|
3705
3719
|
|
|
3706
3720
|
|
|
3707
3721
|
|
|
3708
3722
|
|
|
3723
|
+
|
|
3709
3724
|
|
|
3710
3725
|
|
|
3711
3726
|
|
|
@@ -3726,10 +3741,12 @@ class Recording {
|
|
|
3726
3741
|
|
|
3727
3742
|
|
|
3728
3743
|
|
|
3744
|
+
|
|
3729
3745
|
|
|
3730
3746
|
|
|
3731
3747
|
|
|
3732
3748
|
|
|
3749
|
+
|
|
3733
3750
|
|
|
3734
3751
|
|
|
3735
3752
|
|
|
@@ -3791,10 +3808,12 @@ class CallLog {
|
|
|
3791
3808
|
|| plain.destination_extension
|
|
3792
3809
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3793
3810
|
name: plain.requested_name || plain.destination_name || '',
|
|
3811
|
+
uuid: plain.destination_user_uuid,
|
|
3794
3812
|
},
|
|
3795
3813
|
source: {
|
|
3796
3814
|
extension: plain.source_extension,
|
|
3797
3815
|
name: plain.source_name,
|
|
3816
|
+
uuid: plain.source_user_uuid,
|
|
3798
3817
|
},
|
|
3799
3818
|
id: plain.id,
|
|
3800
3819
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -4842,6 +4861,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4842
4861
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4843
4862
|
});
|
|
4844
4863
|
|
|
4864
|
+
//
|
|
4865
|
+
|
|
4866
|
+
|
|
4867
|
+
|
|
4868
|
+
|
|
4869
|
+
|
|
4870
|
+
class MeetingStatus {
|
|
4871
|
+
|
|
4872
|
+
|
|
4873
|
+
|
|
4874
|
+
|
|
4875
|
+
constructor({
|
|
4876
|
+
full,
|
|
4877
|
+
} = {}) {
|
|
4878
|
+
this.full = full;
|
|
4879
|
+
|
|
4880
|
+
// Useful to compare instead of instanceof with minified code
|
|
4881
|
+
this.type = 'MeetingStatus';
|
|
4882
|
+
}
|
|
4883
|
+
|
|
4884
|
+
static parse(plain ) {
|
|
4885
|
+
return new MeetingStatus({
|
|
4886
|
+
full: plain.full,
|
|
4887
|
+
});
|
|
4888
|
+
}
|
|
4889
|
+
|
|
4890
|
+
}
|
|
4891
|
+
|
|
4845
4892
|
/* */
|
|
4846
4893
|
|
|
4847
4894
|
|
|
@@ -5036,6 +5083,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
5036
5083
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
5037
5084
|
ApiRequester.successResponseParser),
|
|
5038
5085
|
|
|
5086
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
5087
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
5039
5088
|
});
|
|
5040
5089
|
|
|
5041
5090
|
//
|
|
@@ -6361,7 +6410,7 @@ const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
|
6361
6410
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6362
6411
|
class CanceledCallError extends Error {}
|
|
6363
6412
|
|
|
6364
|
-
const MAX_REGISTER_TRIES =
|
|
6413
|
+
const MAX_REGISTER_TRIES = 5;
|
|
6365
6414
|
|
|
6366
6415
|
|
|
6367
6416
|
|
|
@@ -6415,6 +6464,7 @@ class WebRTCClient extends Emitter {
|
|
|
6415
6464
|
|
|
6416
6465
|
|
|
6417
6466
|
|
|
6467
|
+
|
|
6418
6468
|
|
|
6419
6469
|
// sugar
|
|
6420
6470
|
|
|
@@ -6477,6 +6527,7 @@ class WebRTCClient extends Emitter {
|
|
|
6477
6527
|
this.conferences = {};
|
|
6478
6528
|
this.networkMonitoringInterval = {};
|
|
6479
6529
|
this.sessionNetworkStats = {};
|
|
6530
|
+
this.forceClosed = false;
|
|
6480
6531
|
|
|
6481
6532
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
6482
6533
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -6598,6 +6649,8 @@ class WebRTCClient extends Emitter {
|
|
|
6598
6649
|
skipRegister: this.skipRegister,
|
|
6599
6650
|
};
|
|
6600
6651
|
|
|
6652
|
+
this.forceClosed = false;
|
|
6653
|
+
|
|
6601
6654
|
if (this.skipRegister) {
|
|
6602
6655
|
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6603
6656
|
return Promise.resolve();
|
|
@@ -6622,7 +6675,15 @@ class WebRTCClient extends Emitter {
|
|
|
6622
6675
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6623
6676
|
|
|
6624
6677
|
const onRegisterFailed = () => {
|
|
6625
|
-
logger$9.info('sdk webrtc registering failed', {
|
|
6678
|
+
logger$9.info('sdk webrtc registering failed', {
|
|
6679
|
+
tries,
|
|
6680
|
+
registerer: !!this.registerer,
|
|
6681
|
+
forceClosed: this.forceClosed,
|
|
6682
|
+
});
|
|
6683
|
+
if (this.forceClosed) {
|
|
6684
|
+
return;
|
|
6685
|
+
}
|
|
6686
|
+
|
|
6626
6687
|
this.connectionPromise = null;
|
|
6627
6688
|
if (this.registerer && this.registerer.waiting) {
|
|
6628
6689
|
this.registerer.waitingToggle(false);
|
|
@@ -6900,8 +6961,9 @@ class WebRTCClient extends Emitter {
|
|
|
6900
6961
|
}
|
|
6901
6962
|
}
|
|
6902
6963
|
|
|
6903
|
-
async close() {
|
|
6904
|
-
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6964
|
+
async close(force = false) {
|
|
6965
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
6966
|
+
this.forceClosed = force;
|
|
6905
6967
|
this._cleanupMedia();
|
|
6906
6968
|
this.connectionPromise = null;
|
|
6907
6969
|
|
|
@@ -6920,7 +6982,7 @@ class WebRTCClient extends Emitter {
|
|
|
6920
6982
|
this.userAgent.delegate = null;
|
|
6921
6983
|
this.userAgent.stateChange.removeAllListeners();
|
|
6922
6984
|
|
|
6923
|
-
await this._disconnectTransport();
|
|
6985
|
+
await this._disconnectTransport(force);
|
|
6924
6986
|
|
|
6925
6987
|
this._cleanupRegister();
|
|
6926
6988
|
|
|
@@ -8356,7 +8418,15 @@ class WebRTCClient extends Emitter {
|
|
|
8356
8418
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
8357
8419
|
}
|
|
8358
8420
|
|
|
8359
|
-
async _disconnectTransport() {
|
|
8421
|
+
async _disconnectTransport(force = false) {
|
|
8422
|
+
if (force) {
|
|
8423
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8424
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
8425
|
+
// eslint-disable-next-line
|
|
8426
|
+
this.userAgent.transport._ws.close(1000);
|
|
8427
|
+
return;
|
|
8428
|
+
}
|
|
8429
|
+
|
|
8360
8430
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
8361
8431
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
8362
8432
|
try {
|
|
@@ -9303,6 +9373,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9303
9373
|
return Promise.resolve(null);
|
|
9304
9374
|
}
|
|
9305
9375
|
|
|
9376
|
+
const sipSessionId = this.getSipSessionIdFromCallSession(callSession);
|
|
9377
|
+
if (sipSessionId && !(sipSessionId in this.callSessions)) {
|
|
9378
|
+
logger$8.warn('Call session already ended or not found, can\'t accept it.', { sipSessionId });
|
|
9379
|
+
return Promise.resolve(null);
|
|
9380
|
+
}
|
|
9381
|
+
|
|
9306
9382
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9307
9383
|
logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9308
9384
|
return Promise.resolve(callSession.sipCallId);
|
|
@@ -9763,7 +9839,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9763
9839
|
return this.client && this.client.isConference(callSession.sipCallId);
|
|
9764
9840
|
}
|
|
9765
9841
|
|
|
9766
|
-
async close() {
|
|
9842
|
+
async close(force = false) {
|
|
9767
9843
|
logger$8.info('WebRTC close');
|
|
9768
9844
|
|
|
9769
9845
|
try {
|
|
@@ -9775,7 +9851,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9775
9851
|
logger$8.error('WebRTC close, unregister error', e);
|
|
9776
9852
|
}
|
|
9777
9853
|
|
|
9778
|
-
this.client.close();
|
|
9854
|
+
this.client.close(force);
|
|
9779
9855
|
this.unbind();
|
|
9780
9856
|
|
|
9781
9857
|
this.incomingSessions = [];
|
|
@@ -9927,9 +10003,17 @@ class WebRTCPhone extends Emitter {
|
|
|
9927
10003
|
});
|
|
9928
10004
|
|
|
9929
10005
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
9930
|
-
|
|
10006
|
+
const sessionId = this.getSipSessionId(sipSession);
|
|
10007
|
+
const hasSession = sessionId in this.callSessions;
|
|
10008
|
+
|
|
10009
|
+
logger$8.info('WebRTC call accepted', { sipId: sessionId, hasSession });
|
|
10010
|
+
|
|
10011
|
+
if (!hasSession) {
|
|
10012
|
+
logger$8.warn('Call accepted ignored, session is no longer present in the WebRtcPhone', { sessionId });
|
|
10013
|
+
return;
|
|
10014
|
+
}
|
|
9931
10015
|
|
|
9932
|
-
this._onCallAccepted(sipSession, this.client.hasVideo(
|
|
10016
|
+
this._onCallAccepted(sipSession, this.client.hasVideo(sessionId));
|
|
9933
10017
|
|
|
9934
10018
|
if (this.audioOutputDeviceId) {
|
|
9935
10019
|
this.client.changeAudioOutputDevice(this.audioOutputDeviceId);
|
|
@@ -10065,9 +10149,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10065
10149
|
return this.client.getSipSessionId(sipSession);
|
|
10066
10150
|
}
|
|
10067
10151
|
|
|
10068
|
-
|
|
10152
|
+
getSipSessionIdFromCallSession(callSession ) {
|
|
10069
10153
|
const sipSession = this.findSipSession(callSession);
|
|
10070
|
-
|
|
10154
|
+
|
|
10155
|
+
return sipSession ? this.getSipSessionId(sipSession) : null;
|
|
10156
|
+
}
|
|
10157
|
+
|
|
10158
|
+
_updateCallSession(callSession ) {
|
|
10159
|
+
const sipSessionId = this.getSipSessionIdFromCallSession(callSession);
|
|
10071
10160
|
|
|
10072
10161
|
if (sipSessionId) {
|
|
10073
10162
|
this.callSessions[sipSessionId] = callSession;
|
package/esm/simple/Directory.js
CHANGED
|
@@ -2197,6 +2197,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2197
2197
|
|
|
2198
2198
|
|
|
2199
2199
|
|
|
2200
|
+
|
|
2200
2201
|
) {
|
|
2201
2202
|
const body = {
|
|
2202
2203
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2216,6 +2217,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2216
2217
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
2217
2218
|
}
|
|
2218
2219
|
|
|
2220
|
+
if (params.tenantId) {
|
|
2221
|
+
body.tenant_id = params.tenantId;
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2219
2224
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2220
2225
|
},
|
|
2221
2226
|
|
|
@@ -3284,11 +3289,13 @@ class Recording {
|
|
|
3284
3289
|
|
|
3285
3290
|
|
|
3286
3291
|
|
|
3292
|
+
|
|
3287
3293
|
|
|
3288
3294
|
|
|
3289
3295
|
|
|
3290
3296
|
|
|
3291
3297
|
|
|
3298
|
+
|
|
3292
3299
|
|
|
3293
3300
|
|
|
3294
3301
|
|
|
@@ -3309,10 +3316,12 @@ class Recording {
|
|
|
3309
3316
|
|
|
3310
3317
|
|
|
3311
3318
|
|
|
3319
|
+
|
|
3312
3320
|
|
|
3313
3321
|
|
|
3314
3322
|
|
|
3315
3323
|
|
|
3324
|
+
|
|
3316
3325
|
|
|
3317
3326
|
|
|
3318
3327
|
|
|
@@ -3374,10 +3383,12 @@ class CallLog {
|
|
|
3374
3383
|
|| plain.destination_extension
|
|
3375
3384
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3376
3385
|
name: plain.requested_name || plain.destination_name || '',
|
|
3386
|
+
uuid: plain.destination_user_uuid,
|
|
3377
3387
|
},
|
|
3378
3388
|
source: {
|
|
3379
3389
|
extension: plain.source_extension,
|
|
3380
3390
|
name: plain.source_name,
|
|
3391
|
+
uuid: plain.source_user_uuid,
|
|
3381
3392
|
},
|
|
3382
3393
|
id: plain.id,
|
|
3383
3394
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -4016,6 +4027,34 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
4016
4027
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
4017
4028
|
});
|
|
4018
4029
|
|
|
4030
|
+
//
|
|
4031
|
+
|
|
4032
|
+
|
|
4033
|
+
|
|
4034
|
+
|
|
4035
|
+
|
|
4036
|
+
class MeetingStatus {
|
|
4037
|
+
|
|
4038
|
+
|
|
4039
|
+
|
|
4040
|
+
|
|
4041
|
+
constructor({
|
|
4042
|
+
full,
|
|
4043
|
+
} = {}) {
|
|
4044
|
+
this.full = full;
|
|
4045
|
+
|
|
4046
|
+
// Useful to compare instead of instanceof with minified code
|
|
4047
|
+
this.type = 'MeetingStatus';
|
|
4048
|
+
}
|
|
4049
|
+
|
|
4050
|
+
static parse(plain ) {
|
|
4051
|
+
return new MeetingStatus({
|
|
4052
|
+
full: plain.full,
|
|
4053
|
+
});
|
|
4054
|
+
}
|
|
4055
|
+
|
|
4056
|
+
}
|
|
4057
|
+
|
|
4019
4058
|
/* */
|
|
4020
4059
|
|
|
4021
4060
|
|
|
@@ -4210,6 +4249,8 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4210
4249
|
client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
|
|
4211
4250
|
ApiRequester.successResponseParser),
|
|
4212
4251
|
|
|
4252
|
+
guestGetMeetingStatus: (meetingUuid ) =>
|
|
4253
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
|
|
4213
4254
|
});
|
|
4214
4255
|
|
|
4215
4256
|
//
|