@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
|
@@ -1560,6 +1560,9 @@ class Contact {
|
|
|
1560
1560
|
}
|
|
1561
1561
|
|
|
1562
1562
|
static parseMany(response ) {
|
|
1563
|
+
if (!response || !response.results) {
|
|
1564
|
+
return [];
|
|
1565
|
+
}
|
|
1563
1566
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1564
1567
|
}
|
|
1565
1568
|
|
|
@@ -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,
|
|
@@ -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,
|