@wazo/sdk 0.37.22 → 0.37.23
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 +5 -5
- package/esm/__tests__/api-client.test.js +26 -0
- package/esm/__tests__/web-rtc-client.test.js +40 -52
- package/esm/api/call-logd.js +7 -0
- package/esm/api/calld.js +10 -0
- package/esm/api/chatd.js +7 -0
- package/esm/api/confd.js +3 -0
- package/esm/api/ctid-ng.js +10 -0
- package/esm/api/dird.js +3 -0
- package/esm/api-client.js +26 -0
- package/esm/checker/Checker.js +40 -52
- package/esm/checker/checks/aor.js +26 -0
- package/esm/checker/checks/api.js +26 -0
- package/esm/checker/checks/index.js +40 -52
- package/esm/checker/checks/webrtc-transport.js +40 -52
- package/esm/checker/checks/webrtc.js +40 -52
- package/esm/domain/AdHocAPIConference.js +26 -0
- package/esm/domain/Call.js +3 -0
- package/esm/domain/CallLog.js +7 -0
- package/esm/domain/ChatMessage.js +4 -0
- package/esm/domain/ChatRoom.js +3 -0
- package/esm/domain/Contact.js +3 -0
- package/esm/domain/Features.js +26 -0
- package/esm/domain/Meeting.js +3 -0
- package/esm/domain/Phone/CTIPhone.js +30 -0
- package/esm/domain/Phone/WebRTCPhone.js +14 -12
- package/esm/domain/Recording.js +3 -0
- package/esm/domain/Voicemail.js +3 -0
- package/esm/domain/__tests__/Call.test.js +3 -0
- package/esm/domain/__tests__/CallLog.test.js +7 -0
- package/esm/domain/__tests__/Contact.test.js +3 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +57 -63
- package/esm/lib/WazoSessionDescriptionHandler.js +0 -38
- package/esm/service/CallApi.js +26 -0
- package/esm/service/getApiClient.js +26 -0
- package/esm/simple/Auth.js +57 -63
- package/esm/simple/Configuration.js +57 -63
- package/esm/simple/Directory.js +26 -0
- package/esm/simple/Phone.js +57 -63
- package/esm/simple/index.js +57 -63
- package/esm/simple/room/LocalParticipant.js +57 -63
- package/esm/simple/room/Participant.js +57 -63
- package/esm/simple/room/RemoteParticipant.js +57 -63
- package/esm/simple/room/Room.js +57 -63
- package/esm/simple/room/SipRoom.js +57 -63
- package/esm/simple/room/Stream.js +57 -63
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +57 -63
- package/esm/simple/utils.js +57 -63
- package/esm/web-rtc-client.js +40 -52
- package/lib/__tests__/api-client.test.js +26 -0
- package/lib/__tests__/web-rtc-client.test.js +40 -52
- package/lib/api/call-logd.js +7 -0
- package/lib/api/calld.js +10 -0
- package/lib/api/chatd.js +7 -0
- package/lib/api/confd.js +3 -0
- package/lib/api/ctid-ng.js +10 -0
- package/lib/api/dird.js +3 -0
- package/lib/api-client.js +26 -0
- package/lib/checker/Checker.js +40 -52
- package/lib/checker/checks/aor.js +26 -0
- package/lib/checker/checks/api.js +26 -0
- package/lib/checker/checks/index.js +40 -52
- package/lib/checker/checks/webrtc-transport.js +40 -52
- package/lib/checker/checks/webrtc.js +40 -52
- package/lib/domain/AdHocAPIConference.js +26 -0
- package/lib/domain/Call.js +3 -0
- package/lib/domain/CallLog.js +7 -0
- package/lib/domain/ChatMessage.js +4 -0
- package/lib/domain/ChatRoom.js +3 -0
- package/lib/domain/Contact.js +3 -0
- package/lib/domain/Features.js +26 -0
- package/lib/domain/Meeting.js +3 -0
- package/lib/domain/Phone/CTIPhone.js +30 -0
- package/lib/domain/Phone/WebRTCPhone.js +14 -12
- package/lib/domain/Recording.js +3 -0
- package/lib/domain/Voicemail.js +3 -0
- package/lib/domain/__tests__/Call.test.js +3 -0
- package/lib/domain/__tests__/CallLog.test.js +7 -0
- package/lib/domain/__tests__/Contact.test.js +3 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +57 -63
- package/lib/lib/WazoSessionDescriptionHandler.js +0 -38
- package/lib/service/CallApi.js +26 -0
- package/lib/service/getApiClient.js +26 -0
- package/lib/simple/Auth.js +57 -63
- package/lib/simple/Configuration.js +57 -63
- package/lib/simple/Directory.js +26 -0
- package/lib/simple/Phone.js +57 -63
- package/lib/simple/index.js +57 -63
- package/lib/simple/room/LocalParticipant.js +57 -63
- package/lib/simple/room/Participant.js +57 -63
- package/lib/simple/room/RemoteParticipant.js +57 -63
- package/lib/simple/room/Room.js +57 -63
- package/lib/simple/room/SipRoom.js +57 -63
- package/lib/simple/room/Stream.js +57 -63
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +57 -63
- package/lib/simple/utils.js +57 -63
- package/lib/web-rtc-client.js +40 -52
- package/package.json +1 -1
- package/src/domain/Call.js +3 -0
- package/src/domain/CallLog.js +4 -0
- package/src/domain/ChatMessage.js +4 -0
- package/src/domain/ChatRoom.js +3 -0
- package/src/domain/Contact.js +3 -0
- package/src/domain/Meeting.js +3 -0
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +14 -12
- package/src/domain/Recording.js +3 -0
- package/src/domain/Voicemail.js +3 -0
- package/src/lib/WazoSessionDescriptionHandler.js +1 -35
- package/src/web-rtc-client.js +14 -14
|
@@ -873,6 +873,9 @@ class Contact {
|
|
|
873
873
|
}
|
|
874
874
|
|
|
875
875
|
static parseMany(response ) {
|
|
876
|
+
if (!response || !response.results) {
|
|
877
|
+
return [];
|
|
878
|
+
}
|
|
876
879
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
877
880
|
}
|
|
878
881
|
|
|
@@ -2667,6 +2670,9 @@ class Meeting {
|
|
|
2667
2670
|
}
|
|
2668
2671
|
|
|
2669
2672
|
static parseMany(items ) {
|
|
2673
|
+
if (!items) {
|
|
2674
|
+
return [];
|
|
2675
|
+
}
|
|
2670
2676
|
return items.map(plain => Meeting.parse(plain));
|
|
2671
2677
|
}
|
|
2672
2678
|
|
|
@@ -2869,6 +2875,10 @@ class ChatMessage {
|
|
|
2869
2875
|
|
|
2870
2876
|
|
|
2871
2877
|
static parseMany(plain ) {
|
|
2878
|
+
if (!plain || !plain.items) {
|
|
2879
|
+
return [];
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2872
2882
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2873
2883
|
}
|
|
2874
2884
|
|
|
@@ -2978,6 +2988,9 @@ class Voicemail {
|
|
|
2978
2988
|
}
|
|
2979
2989
|
|
|
2980
2990
|
static parseMany(plain ) {
|
|
2991
|
+
if (!plain) {
|
|
2992
|
+
return [];
|
|
2993
|
+
}
|
|
2981
2994
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2982
2995
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2983
2996
|
|
|
@@ -3087,6 +3100,9 @@ class Call {
|
|
|
3087
3100
|
|
|
3088
3101
|
|
|
3089
3102
|
static parseMany(plain ) {
|
|
3103
|
+
if (!plain) {
|
|
3104
|
+
return [];
|
|
3105
|
+
}
|
|
3090
3106
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3091
3107
|
}
|
|
3092
3108
|
|
|
@@ -3630,6 +3646,9 @@ class Recording {
|
|
|
3630
3646
|
|
|
3631
3647
|
|
|
3632
3648
|
static parseMany(recordings = []) {
|
|
3649
|
+
if (!recordings) {
|
|
3650
|
+
return [];
|
|
3651
|
+
}
|
|
3633
3652
|
return recordings.map(item => Recording.parse(item));
|
|
3634
3653
|
}
|
|
3635
3654
|
|
|
@@ -3731,6 +3750,10 @@ class CallLog {
|
|
|
3731
3750
|
}
|
|
3732
3751
|
|
|
3733
3752
|
static parseMany(plain ) {
|
|
3753
|
+
if (!plain || !plain.items) {
|
|
3754
|
+
return [];
|
|
3755
|
+
}
|
|
3756
|
+
|
|
3734
3757
|
return plain.items.map(item => CallLog.parse(item));
|
|
3735
3758
|
}
|
|
3736
3759
|
|
|
@@ -4300,6 +4323,10 @@ class CTIPhone extends Emitter {
|
|
|
4300
4323
|
return false;
|
|
4301
4324
|
}
|
|
4302
4325
|
|
|
4326
|
+
hasAVideoTrack() {
|
|
4327
|
+
return false;
|
|
4328
|
+
}
|
|
4329
|
+
|
|
4303
4330
|
getLocalStreamForCall() {
|
|
4304
4331
|
return null;
|
|
4305
4332
|
}
|
|
@@ -4693,6 +4720,9 @@ class ChatRoom {
|
|
|
4693
4720
|
|
|
4694
4721
|
|
|
4695
4722
|
static parseMany(plain ) {
|
|
4723
|
+
if (!plain || !plain.items) {
|
|
4724
|
+
return [];
|
|
4725
|
+
}
|
|
4696
4726
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4697
4727
|
}
|
|
4698
4728
|
|
|
@@ -5938,10 +5968,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5938
5968
|
candidates
|
|
5939
5969
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5940
5970
|
|
|
5941
|
-
const areCandidateValid = (candidates ) =>
|
|
5942
|
-
getSrflxOrRelay(candidates)
|
|
5943
|
-
.length > 0;
|
|
5944
|
-
|
|
5945
5971
|
const getVideoDirection = (sdp ) => {
|
|
5946
5972
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5947
5973
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5994,8 +6020,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5994
6020
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5995
6021
|
|
|
5996
6022
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5997
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5998
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5999
6023
|
|
|
6000
6024
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
6001
6025
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -6185,38 +6209,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6185
6209
|
this._peerConnection = undefined;
|
|
6186
6210
|
}
|
|
6187
6211
|
|
|
6188
|
-
async _waitForValidGatheredIce() {
|
|
6189
|
-
let tries = 0;
|
|
6190
|
-
|
|
6191
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
6192
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
6193
|
-
tries,
|
|
6194
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
6195
|
-
});
|
|
6196
|
-
|
|
6197
|
-
tries++;
|
|
6198
|
-
|
|
6199
|
-
// eslint-disable-next-line no-await-in-loop
|
|
6200
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
6201
|
-
}
|
|
6202
|
-
|
|
6203
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
6204
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
6205
|
-
const error = new Error(errorMsg);
|
|
6206
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
6207
|
-
|
|
6208
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
6209
|
-
this.eventEmitter.emit('error', error);
|
|
6210
|
-
|
|
6211
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6212
|
-
}
|
|
6213
|
-
|
|
6214
|
-
// eslint-disable-next-line
|
|
6215
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6216
|
-
|
|
6217
|
-
return this.getLocalSessionDescription();
|
|
6218
|
-
}
|
|
6219
|
-
|
|
6220
6212
|
// Overridden to send `inactive` in conference
|
|
6221
6213
|
updateDirection(options , isConference = false,
|
|
6222
6214
|
audioOnly = false) {
|
|
@@ -8632,25 +8624,25 @@ class WebRTCClient extends Emitter {
|
|
|
8632
8624
|
|
|
8633
8625
|
stats.forEach(report => {
|
|
8634
8626
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8635
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8627
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8636
8628
|
}
|
|
8637
8629
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8638
|
-
audioBytesSent += report.bytesSent;
|
|
8630
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8639
8631
|
}
|
|
8640
8632
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8641
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8633
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8642
8634
|
}
|
|
8643
8635
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8644
|
-
packetsLost += report.packetsLost;
|
|
8645
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8646
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8636
|
+
packetsLost += Number(report.packetsLost);
|
|
8637
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8638
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8647
8639
|
}
|
|
8648
8640
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8649
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8641
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8650
8642
|
}
|
|
8651
8643
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8652
8644
|
if ('framesPerSecond' in report) {
|
|
8653
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8645
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8654
8646
|
}
|
|
8655
8647
|
if ('framerateMean' in report) {
|
|
8656
8648
|
// framerateMean is only available in FF
|
|
@@ -8658,16 +8650,16 @@ class WebRTCClient extends Emitter {
|
|
|
8658
8650
|
}
|
|
8659
8651
|
}
|
|
8660
8652
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8661
|
-
packetsLost += report.packetsLost;
|
|
8662
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8663
|
-
networkStats.jitter = report.jitter;
|
|
8653
|
+
packetsLost += Number(report.packetsLost);
|
|
8654
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8655
|
+
networkStats.jitter = Number(report.jitter);
|
|
8664
8656
|
}
|
|
8665
8657
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8666
|
-
packetsLost += report.packetsLost;
|
|
8658
|
+
packetsLost += Number(report.packetsLost);
|
|
8667
8659
|
}
|
|
8668
8660
|
if (report.type === 'transport') {
|
|
8669
|
-
transportSent += report.bytesSent;
|
|
8670
|
-
transportReceived += report.bytesReceived;
|
|
8661
|
+
transportSent += Number(report.bytesSent);
|
|
8662
|
+
transportReceived += Number(report.bytesReceived);
|
|
8671
8663
|
}
|
|
8672
8664
|
});
|
|
8673
8665
|
|
|
@@ -9253,18 +9245,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9253
9245
|
screenTrack,
|
|
9254
9246
|
});
|
|
9255
9247
|
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9248
|
+
if (screenTrack) {
|
|
9249
|
+
screenTrack.onended = () => {
|
|
9250
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9251
|
+
hadVideo,
|
|
9252
|
+
id: this.getSipSessionId(sipSession),
|
|
9253
|
+
screenTrack,
|
|
9254
|
+
});
|
|
9262
9255
|
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9256
|
+
this.eventEmitter.emit(
|
|
9257
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9258
|
+
this._createCallSession(sipSession, callSession),
|
|
9259
|
+
);
|
|
9260
|
+
};
|
|
9261
|
+
}
|
|
9268
9262
|
|
|
9269
9263
|
this.currentScreenShare = {
|
|
9270
9264
|
stream: screenStream,
|
package/lib/simple/utils.js
CHANGED
|
@@ -875,6 +875,9 @@ class Contact {
|
|
|
875
875
|
}
|
|
876
876
|
|
|
877
877
|
static parseMany(response ) {
|
|
878
|
+
if (!response || !response.results) {
|
|
879
|
+
return [];
|
|
880
|
+
}
|
|
878
881
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
879
882
|
}
|
|
880
883
|
|
|
@@ -2669,6 +2672,9 @@ class Meeting {
|
|
|
2669
2672
|
}
|
|
2670
2673
|
|
|
2671
2674
|
static parseMany(items ) {
|
|
2675
|
+
if (!items) {
|
|
2676
|
+
return [];
|
|
2677
|
+
}
|
|
2672
2678
|
return items.map(plain => Meeting.parse(plain));
|
|
2673
2679
|
}
|
|
2674
2680
|
|
|
@@ -2871,6 +2877,10 @@ class ChatMessage {
|
|
|
2871
2877
|
|
|
2872
2878
|
|
|
2873
2879
|
static parseMany(plain ) {
|
|
2880
|
+
if (!plain || !plain.items) {
|
|
2881
|
+
return [];
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2874
2884
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2875
2885
|
}
|
|
2876
2886
|
|
|
@@ -2980,6 +2990,9 @@ class Voicemail {
|
|
|
2980
2990
|
}
|
|
2981
2991
|
|
|
2982
2992
|
static parseMany(plain ) {
|
|
2993
|
+
if (!plain) {
|
|
2994
|
+
return [];
|
|
2995
|
+
}
|
|
2983
2996
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2984
2997
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2985
2998
|
|
|
@@ -3089,6 +3102,9 @@ class Call {
|
|
|
3089
3102
|
|
|
3090
3103
|
|
|
3091
3104
|
static parseMany(plain ) {
|
|
3105
|
+
if (!plain) {
|
|
3106
|
+
return [];
|
|
3107
|
+
}
|
|
3092
3108
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3093
3109
|
}
|
|
3094
3110
|
|
|
@@ -3632,6 +3648,9 @@ class Recording {
|
|
|
3632
3648
|
|
|
3633
3649
|
|
|
3634
3650
|
static parseMany(recordings = []) {
|
|
3651
|
+
if (!recordings) {
|
|
3652
|
+
return [];
|
|
3653
|
+
}
|
|
3635
3654
|
return recordings.map(item => Recording.parse(item));
|
|
3636
3655
|
}
|
|
3637
3656
|
|
|
@@ -3733,6 +3752,10 @@ class CallLog {
|
|
|
3733
3752
|
}
|
|
3734
3753
|
|
|
3735
3754
|
static parseMany(plain ) {
|
|
3755
|
+
if (!plain || !plain.items) {
|
|
3756
|
+
return [];
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3736
3759
|
return plain.items.map(item => CallLog.parse(item));
|
|
3737
3760
|
}
|
|
3738
3761
|
|
|
@@ -4302,6 +4325,10 @@ class CTIPhone extends Emitter {
|
|
|
4302
4325
|
return false;
|
|
4303
4326
|
}
|
|
4304
4327
|
|
|
4328
|
+
hasAVideoTrack() {
|
|
4329
|
+
return false;
|
|
4330
|
+
}
|
|
4331
|
+
|
|
4305
4332
|
getLocalStreamForCall() {
|
|
4306
4333
|
return null;
|
|
4307
4334
|
}
|
|
@@ -4695,6 +4722,9 @@ class ChatRoom {
|
|
|
4695
4722
|
|
|
4696
4723
|
|
|
4697
4724
|
static parseMany(plain ) {
|
|
4725
|
+
if (!plain || !plain.items) {
|
|
4726
|
+
return [];
|
|
4727
|
+
}
|
|
4698
4728
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4699
4729
|
}
|
|
4700
4730
|
|
|
@@ -5940,10 +5970,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5940
5970
|
candidates
|
|
5941
5971
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5942
5972
|
|
|
5943
|
-
const areCandidateValid = (candidates ) =>
|
|
5944
|
-
getSrflxOrRelay(candidates)
|
|
5945
|
-
.length > 0;
|
|
5946
|
-
|
|
5947
5973
|
const getVideoDirection = (sdp ) => {
|
|
5948
5974
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5949
5975
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5996,8 +6022,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5996
6022
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5997
6023
|
|
|
5998
6024
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5999
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
6000
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
6001
6025
|
|
|
6002
6026
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
6003
6027
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -6187,38 +6211,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6187
6211
|
this._peerConnection = undefined;
|
|
6188
6212
|
}
|
|
6189
6213
|
|
|
6190
|
-
async _waitForValidGatheredIce() {
|
|
6191
|
-
let tries = 0;
|
|
6192
|
-
|
|
6193
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
6194
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
6195
|
-
tries,
|
|
6196
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
6197
|
-
});
|
|
6198
|
-
|
|
6199
|
-
tries++;
|
|
6200
|
-
|
|
6201
|
-
// eslint-disable-next-line no-await-in-loop
|
|
6202
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
6203
|
-
}
|
|
6204
|
-
|
|
6205
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
6206
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
6207
|
-
const error = new Error(errorMsg);
|
|
6208
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
6209
|
-
|
|
6210
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
6211
|
-
this.eventEmitter.emit('error', error);
|
|
6212
|
-
|
|
6213
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6214
|
-
}
|
|
6215
|
-
|
|
6216
|
-
// eslint-disable-next-line
|
|
6217
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6218
|
-
|
|
6219
|
-
return this.getLocalSessionDescription();
|
|
6220
|
-
}
|
|
6221
|
-
|
|
6222
6214
|
// Overridden to send `inactive` in conference
|
|
6223
6215
|
updateDirection(options , isConference = false,
|
|
6224
6216
|
audioOnly = false) {
|
|
@@ -8634,25 +8626,25 @@ class WebRTCClient extends Emitter {
|
|
|
8634
8626
|
|
|
8635
8627
|
stats.forEach(report => {
|
|
8636
8628
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8637
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8629
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8638
8630
|
}
|
|
8639
8631
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8640
|
-
audioBytesSent += report.bytesSent;
|
|
8632
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8641
8633
|
}
|
|
8642
8634
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8643
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8635
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8644
8636
|
}
|
|
8645
8637
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8646
|
-
packetsLost += report.packetsLost;
|
|
8647
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8648
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8638
|
+
packetsLost += Number(report.packetsLost);
|
|
8639
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8640
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8649
8641
|
}
|
|
8650
8642
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8651
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8643
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8652
8644
|
}
|
|
8653
8645
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8654
8646
|
if ('framesPerSecond' in report) {
|
|
8655
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8647
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8656
8648
|
}
|
|
8657
8649
|
if ('framerateMean' in report) {
|
|
8658
8650
|
// framerateMean is only available in FF
|
|
@@ -8660,16 +8652,16 @@ class WebRTCClient extends Emitter {
|
|
|
8660
8652
|
}
|
|
8661
8653
|
}
|
|
8662
8654
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8663
|
-
packetsLost += report.packetsLost;
|
|
8664
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8665
|
-
networkStats.jitter = report.jitter;
|
|
8655
|
+
packetsLost += Number(report.packetsLost);
|
|
8656
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8657
|
+
networkStats.jitter = Number(report.jitter);
|
|
8666
8658
|
}
|
|
8667
8659
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8668
|
-
packetsLost += report.packetsLost;
|
|
8660
|
+
packetsLost += Number(report.packetsLost);
|
|
8669
8661
|
}
|
|
8670
8662
|
if (report.type === 'transport') {
|
|
8671
|
-
transportSent += report.bytesSent;
|
|
8672
|
-
transportReceived += report.bytesReceived;
|
|
8663
|
+
transportSent += Number(report.bytesSent);
|
|
8664
|
+
transportReceived += Number(report.bytesReceived);
|
|
8673
8665
|
}
|
|
8674
8666
|
});
|
|
8675
8667
|
|
|
@@ -9255,18 +9247,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9255
9247
|
screenTrack,
|
|
9256
9248
|
});
|
|
9257
9249
|
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9250
|
+
if (screenTrack) {
|
|
9251
|
+
screenTrack.onended = () => {
|
|
9252
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9253
|
+
hadVideo,
|
|
9254
|
+
id: this.getSipSessionId(sipSession),
|
|
9255
|
+
screenTrack,
|
|
9256
|
+
});
|
|
9264
9257
|
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9258
|
+
this.eventEmitter.emit(
|
|
9259
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9260
|
+
this._createCallSession(sipSession, callSession),
|
|
9261
|
+
);
|
|
9262
|
+
};
|
|
9263
|
+
}
|
|
9270
9264
|
|
|
9271
9265
|
this.currentScreenShare = {
|
|
9272
9266
|
stream: screenStream,
|
package/lib/web-rtc-client.js
CHANGED
|
@@ -735,10 +735,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
735
735
|
candidates
|
|
736
736
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
737
737
|
|
|
738
|
-
const areCandidateValid = (candidates ) =>
|
|
739
|
-
getSrflxOrRelay(candidates)
|
|
740
|
-
.length > 0;
|
|
741
|
-
|
|
742
738
|
const getVideoDirection = (sdp ) => {
|
|
743
739
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
744
740
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -791,8 +787,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
791
787
|
/* global RTCSessionDescriptionInit, navigator */
|
|
792
788
|
|
|
793
789
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
794
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
795
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
796
790
|
|
|
797
791
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
798
792
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -982,38 +976,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
982
976
|
this._peerConnection = undefined;
|
|
983
977
|
}
|
|
984
978
|
|
|
985
|
-
async _waitForValidGatheredIce() {
|
|
986
|
-
let tries = 0;
|
|
987
|
-
|
|
988
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
989
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
990
|
-
tries,
|
|
991
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
992
|
-
});
|
|
993
|
-
|
|
994
|
-
tries++;
|
|
995
|
-
|
|
996
|
-
// eslint-disable-next-line no-await-in-loop
|
|
997
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
1001
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
1002
|
-
const error = new Error(errorMsg);
|
|
1003
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
1004
|
-
|
|
1005
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
1006
|
-
this.eventEmitter.emit('error', error);
|
|
1007
|
-
|
|
1008
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
// eslint-disable-next-line
|
|
1012
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
1013
|
-
|
|
1014
|
-
return this.getLocalSessionDescription();
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
979
|
// Overridden to send `inactive` in conference
|
|
1018
980
|
updateDirection(options , isConference = false,
|
|
1019
981
|
audioOnly = false) {
|
|
@@ -2123,6 +2085,9 @@ class Contact {
|
|
|
2123
2085
|
}
|
|
2124
2086
|
|
|
2125
2087
|
static parseMany(response ) {
|
|
2088
|
+
if (!response || !response.results) {
|
|
2089
|
+
return [];
|
|
2090
|
+
}
|
|
2126
2091
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
2127
2092
|
}
|
|
2128
2093
|
|
|
@@ -3230,6 +3195,9 @@ class Meeting {
|
|
|
3230
3195
|
}
|
|
3231
3196
|
|
|
3232
3197
|
static parseMany(items ) {
|
|
3198
|
+
if (!items) {
|
|
3199
|
+
return [];
|
|
3200
|
+
}
|
|
3233
3201
|
return items.map(plain => Meeting.parse(plain));
|
|
3234
3202
|
}
|
|
3235
3203
|
|
|
@@ -3432,6 +3400,10 @@ class ChatMessage {
|
|
|
3432
3400
|
|
|
3433
3401
|
|
|
3434
3402
|
static parseMany(plain ) {
|
|
3403
|
+
if (!plain || !plain.items) {
|
|
3404
|
+
return [];
|
|
3405
|
+
}
|
|
3406
|
+
|
|
3435
3407
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3436
3408
|
}
|
|
3437
3409
|
|
|
@@ -3541,6 +3513,9 @@ class Voicemail {
|
|
|
3541
3513
|
}
|
|
3542
3514
|
|
|
3543
3515
|
static parseMany(plain ) {
|
|
3516
|
+
if (!plain) {
|
|
3517
|
+
return [];
|
|
3518
|
+
}
|
|
3544
3519
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3545
3520
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3546
3521
|
|
|
@@ -3650,6 +3625,9 @@ class Call {
|
|
|
3650
3625
|
|
|
3651
3626
|
|
|
3652
3627
|
static parseMany(plain ) {
|
|
3628
|
+
if (!plain) {
|
|
3629
|
+
return [];
|
|
3630
|
+
}
|
|
3653
3631
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3654
3632
|
}
|
|
3655
3633
|
|
|
@@ -3822,6 +3800,9 @@ class Recording {
|
|
|
3822
3800
|
|
|
3823
3801
|
|
|
3824
3802
|
static parseMany(recordings = []) {
|
|
3803
|
+
if (!recordings) {
|
|
3804
|
+
return [];
|
|
3805
|
+
}
|
|
3825
3806
|
return recordings.map(item => Recording.parse(item));
|
|
3826
3807
|
}
|
|
3827
3808
|
|
|
@@ -3923,6 +3904,10 @@ class CallLog {
|
|
|
3923
3904
|
}
|
|
3924
3905
|
|
|
3925
3906
|
static parseMany(plain ) {
|
|
3907
|
+
if (!plain || !plain.items) {
|
|
3908
|
+
return [];
|
|
3909
|
+
}
|
|
3910
|
+
|
|
3926
3911
|
return plain.items.map(item => CallLog.parse(item));
|
|
3927
3912
|
}
|
|
3928
3913
|
|
|
@@ -4495,6 +4480,9 @@ class ChatRoom {
|
|
|
4495
4480
|
|
|
4496
4481
|
|
|
4497
4482
|
static parseMany(plain ) {
|
|
4483
|
+
if (!plain || !plain.items) {
|
|
4484
|
+
return [];
|
|
4485
|
+
}
|
|
4498
4486
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4499
4487
|
}
|
|
4500
4488
|
|
|
@@ -7374,25 +7362,25 @@ class WebRTCClient extends Emitter {
|
|
|
7374
7362
|
|
|
7375
7363
|
stats.forEach(report => {
|
|
7376
7364
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7377
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7365
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7378
7366
|
}
|
|
7379
7367
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7380
|
-
audioBytesSent += report.bytesSent;
|
|
7368
|
+
audioBytesSent += Number(report.bytesSent);
|
|
7381
7369
|
}
|
|
7382
7370
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7383
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7371
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7384
7372
|
}
|
|
7385
7373
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7386
|
-
packetsLost += report.packetsLost;
|
|
7387
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
7388
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7374
|
+
packetsLost += Number(report.packetsLost);
|
|
7375
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7376
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7389
7377
|
}
|
|
7390
7378
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7391
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7379
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7392
7380
|
}
|
|
7393
7381
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7394
7382
|
if ('framesPerSecond' in report) {
|
|
7395
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
7383
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
7396
7384
|
}
|
|
7397
7385
|
if ('framerateMean' in report) {
|
|
7398
7386
|
// framerateMean is only available in FF
|
|
@@ -7400,16 +7388,16 @@ class WebRTCClient extends Emitter {
|
|
|
7400
7388
|
}
|
|
7401
7389
|
}
|
|
7402
7390
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7403
|
-
packetsLost += report.packetsLost;
|
|
7404
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
7405
|
-
networkStats.jitter = report.jitter;
|
|
7391
|
+
packetsLost += Number(report.packetsLost);
|
|
7392
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
7393
|
+
networkStats.jitter = Number(report.jitter);
|
|
7406
7394
|
}
|
|
7407
7395
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7408
|
-
packetsLost += report.packetsLost;
|
|
7396
|
+
packetsLost += Number(report.packetsLost);
|
|
7409
7397
|
}
|
|
7410
7398
|
if (report.type === 'transport') {
|
|
7411
|
-
transportSent += report.bytesSent;
|
|
7412
|
-
transportReceived += report.bytesReceived;
|
|
7399
|
+
transportSent += Number(report.bytesSent);
|
|
7400
|
+
transportReceived += Number(report.bytesReceived);
|
|
7413
7401
|
}
|
|
7414
7402
|
});
|
|
7415
7403
|
|
package/package.json
CHANGED
package/src/domain/Call.js
CHANGED