@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
|
@@ -1586,6 +1586,9 @@ class Contact {
|
|
|
1586
1586
|
}
|
|
1587
1587
|
|
|
1588
1588
|
static parseMany(response ) {
|
|
1589
|
+
if (!response || !response.results) {
|
|
1590
|
+
return [];
|
|
1591
|
+
}
|
|
1589
1592
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1590
1593
|
}
|
|
1591
1594
|
|
|
@@ -2693,6 +2696,9 @@ class Meeting {
|
|
|
2693
2696
|
}
|
|
2694
2697
|
|
|
2695
2698
|
static parseMany(items ) {
|
|
2699
|
+
if (!items) {
|
|
2700
|
+
return [];
|
|
2701
|
+
}
|
|
2696
2702
|
return items.map(plain => Meeting.parse(plain));
|
|
2697
2703
|
}
|
|
2698
2704
|
|
|
@@ -2895,6 +2901,10 @@ class ChatMessage {
|
|
|
2895
2901
|
|
|
2896
2902
|
|
|
2897
2903
|
static parseMany(plain ) {
|
|
2904
|
+
if (!plain || !plain.items) {
|
|
2905
|
+
return [];
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2898
2908
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2899
2909
|
}
|
|
2900
2910
|
|
|
@@ -3004,6 +3014,9 @@ class Voicemail {
|
|
|
3004
3014
|
}
|
|
3005
3015
|
|
|
3006
3016
|
static parseMany(plain ) {
|
|
3017
|
+
if (!plain) {
|
|
3018
|
+
return [];
|
|
3019
|
+
}
|
|
3007
3020
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3008
3021
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3009
3022
|
|
|
@@ -3113,6 +3126,9 @@ class Call {
|
|
|
3113
3126
|
|
|
3114
3127
|
|
|
3115
3128
|
static parseMany(plain ) {
|
|
3129
|
+
if (!plain) {
|
|
3130
|
+
return [];
|
|
3131
|
+
}
|
|
3116
3132
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3117
3133
|
}
|
|
3118
3134
|
|
|
@@ -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,
|
|
@@ -1586,6 +1586,9 @@ class Contact {
|
|
|
1586
1586
|
}
|
|
1587
1587
|
|
|
1588
1588
|
static parseMany(response ) {
|
|
1589
|
+
if (!response || !response.results) {
|
|
1590
|
+
return [];
|
|
1591
|
+
}
|
|
1589
1592
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1590
1593
|
}
|
|
1591
1594
|
|
|
@@ -2693,6 +2696,9 @@ class Meeting {
|
|
|
2693
2696
|
}
|
|
2694
2697
|
|
|
2695
2698
|
static parseMany(items ) {
|
|
2699
|
+
if (!items) {
|
|
2700
|
+
return [];
|
|
2701
|
+
}
|
|
2696
2702
|
return items.map(plain => Meeting.parse(plain));
|
|
2697
2703
|
}
|
|
2698
2704
|
|
|
@@ -2895,6 +2901,10 @@ class ChatMessage {
|
|
|
2895
2901
|
|
|
2896
2902
|
|
|
2897
2903
|
static parseMany(plain ) {
|
|
2904
|
+
if (!plain || !plain.items) {
|
|
2905
|
+
return [];
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2898
2908
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2899
2909
|
}
|
|
2900
2910
|
|
|
@@ -3004,6 +3014,9 @@ class Voicemail {
|
|
|
3004
3014
|
}
|
|
3005
3015
|
|
|
3006
3016
|
static parseMany(plain ) {
|
|
3017
|
+
if (!plain) {
|
|
3018
|
+
return [];
|
|
3019
|
+
}
|
|
3007
3020
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3008
3021
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3009
3022
|
|
|
@@ -3113,6 +3126,9 @@ class Call {
|
|
|
3113
3126
|
|
|
3114
3127
|
|
|
3115
3128
|
static parseMany(plain ) {
|
|
3129
|
+
if (!plain) {
|
|
3130
|
+
return [];
|
|
3131
|
+
}
|
|
3116
3132
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3117
3133
|
}
|
|
3118
3134
|
|
|
@@ -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,
|