@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
|
@@ -1576,6 +1576,9 @@ class Contact {
|
|
|
1576
1576
|
}
|
|
1577
1577
|
|
|
1578
1578
|
static parseMany(response ) {
|
|
1579
|
+
if (!response || !response.results) {
|
|
1580
|
+
return [];
|
|
1581
|
+
}
|
|
1579
1582
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1580
1583
|
}
|
|
1581
1584
|
|
|
@@ -2683,6 +2686,9 @@ class Meeting {
|
|
|
2683
2686
|
}
|
|
2684
2687
|
|
|
2685
2688
|
static parseMany(items ) {
|
|
2689
|
+
if (!items) {
|
|
2690
|
+
return [];
|
|
2691
|
+
}
|
|
2686
2692
|
return items.map(plain => Meeting.parse(plain));
|
|
2687
2693
|
}
|
|
2688
2694
|
|
|
@@ -2885,6 +2891,10 @@ class ChatMessage {
|
|
|
2885
2891
|
|
|
2886
2892
|
|
|
2887
2893
|
static parseMany(plain ) {
|
|
2894
|
+
if (!plain || !plain.items) {
|
|
2895
|
+
return [];
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2888
2898
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2889
2899
|
}
|
|
2890
2900
|
|
|
@@ -2994,6 +3004,9 @@ class Voicemail {
|
|
|
2994
3004
|
}
|
|
2995
3005
|
|
|
2996
3006
|
static parseMany(plain ) {
|
|
3007
|
+
if (!plain) {
|
|
3008
|
+
return [];
|
|
3009
|
+
}
|
|
2997
3010
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2998
3011
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2999
3012
|
|
|
@@ -3103,6 +3116,9 @@ class Call {
|
|
|
3103
3116
|
|
|
3104
3117
|
|
|
3105
3118
|
static parseMany(plain ) {
|
|
3119
|
+
if (!plain) {
|
|
3120
|
+
return [];
|
|
3121
|
+
}
|
|
3106
3122
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3107
3123
|
}
|
|
3108
3124
|
|
|
@@ -3620,6 +3636,9 @@ class Recording {
|
|
|
3620
3636
|
|
|
3621
3637
|
|
|
3622
3638
|
static parseMany(recordings = []) {
|
|
3639
|
+
if (!recordings) {
|
|
3640
|
+
return [];
|
|
3641
|
+
}
|
|
3623
3642
|
return recordings.map(item => Recording.parse(item));
|
|
3624
3643
|
}
|
|
3625
3644
|
|
|
@@ -3721,6 +3740,10 @@ class CallLog {
|
|
|
3721
3740
|
}
|
|
3722
3741
|
|
|
3723
3742
|
static parseMany(plain ) {
|
|
3743
|
+
if (!plain || !plain.items) {
|
|
3744
|
+
return [];
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3724
3747
|
return plain.items.map(item => CallLog.parse(item));
|
|
3725
3748
|
}
|
|
3726
3749
|
|
|
@@ -4290,6 +4313,10 @@ class CTIPhone extends Emitter {
|
|
|
4290
4313
|
return false;
|
|
4291
4314
|
}
|
|
4292
4315
|
|
|
4316
|
+
hasAVideoTrack() {
|
|
4317
|
+
return false;
|
|
4318
|
+
}
|
|
4319
|
+
|
|
4293
4320
|
getLocalStreamForCall() {
|
|
4294
4321
|
return null;
|
|
4295
4322
|
}
|
|
@@ -4683,6 +4710,9 @@ class ChatRoom {
|
|
|
4683
4710
|
|
|
4684
4711
|
|
|
4685
4712
|
static parseMany(plain ) {
|
|
4713
|
+
if (!plain || !plain.items) {
|
|
4714
|
+
return [];
|
|
4715
|
+
}
|
|
4686
4716
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4687
4717
|
}
|
|
4688
4718
|
|
|
@@ -5928,10 +5958,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5928
5958
|
candidates
|
|
5929
5959
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5930
5960
|
|
|
5931
|
-
const areCandidateValid = (candidates ) =>
|
|
5932
|
-
getSrflxOrRelay(candidates)
|
|
5933
|
-
.length > 0;
|
|
5934
|
-
|
|
5935
5961
|
const getVideoDirection = (sdp ) => {
|
|
5936
5962
|
const parsedSdp = sdpParser.parse(sdp);
|
|
5937
5963
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5984,8 +6010,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5984
6010
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5985
6011
|
|
|
5986
6012
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5987
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5988
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5989
6013
|
|
|
5990
6014
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5991
6015
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -6175,38 +6199,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6175
6199
|
this._peerConnection = undefined;
|
|
6176
6200
|
}
|
|
6177
6201
|
|
|
6178
|
-
async _waitForValidGatheredIce() {
|
|
6179
|
-
let tries = 0;
|
|
6180
|
-
|
|
6181
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
6182
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
6183
|
-
tries,
|
|
6184
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
6185
|
-
});
|
|
6186
|
-
|
|
6187
|
-
tries++;
|
|
6188
|
-
|
|
6189
|
-
// eslint-disable-next-line no-await-in-loop
|
|
6190
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
6191
|
-
}
|
|
6192
|
-
|
|
6193
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
6194
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
6195
|
-
const error = new Error(errorMsg);
|
|
6196
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
6197
|
-
|
|
6198
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
6199
|
-
this.eventEmitter.emit('error', error);
|
|
6200
|
-
|
|
6201
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6202
|
-
}
|
|
6203
|
-
|
|
6204
|
-
// eslint-disable-next-line
|
|
6205
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6206
|
-
|
|
6207
|
-
return this.getLocalSessionDescription();
|
|
6208
|
-
}
|
|
6209
|
-
|
|
6210
6202
|
// Overridden to send `inactive` in conference
|
|
6211
6203
|
updateDirection(options , isConference = false,
|
|
6212
6204
|
audioOnly = false) {
|
|
@@ -8622,25 +8614,25 @@ class WebRTCClient extends Emitter {
|
|
|
8622
8614
|
|
|
8623
8615
|
stats.forEach(report => {
|
|
8624
8616
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8625
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8617
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8626
8618
|
}
|
|
8627
8619
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8628
|
-
audioBytesSent += report.bytesSent;
|
|
8620
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8629
8621
|
}
|
|
8630
8622
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8631
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8623
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8632
8624
|
}
|
|
8633
8625
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8634
|
-
packetsLost += report.packetsLost;
|
|
8635
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8636
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8626
|
+
packetsLost += Number(report.packetsLost);
|
|
8627
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8628
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8637
8629
|
}
|
|
8638
8630
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8639
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8631
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8640
8632
|
}
|
|
8641
8633
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8642
8634
|
if ('framesPerSecond' in report) {
|
|
8643
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8635
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8644
8636
|
}
|
|
8645
8637
|
if ('framerateMean' in report) {
|
|
8646
8638
|
// framerateMean is only available in FF
|
|
@@ -8648,16 +8640,16 @@ class WebRTCClient extends Emitter {
|
|
|
8648
8640
|
}
|
|
8649
8641
|
}
|
|
8650
8642
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8651
|
-
packetsLost += report.packetsLost;
|
|
8652
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8653
|
-
networkStats.jitter = report.jitter;
|
|
8643
|
+
packetsLost += Number(report.packetsLost);
|
|
8644
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8645
|
+
networkStats.jitter = Number(report.jitter);
|
|
8654
8646
|
}
|
|
8655
8647
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8656
|
-
packetsLost += report.packetsLost;
|
|
8648
|
+
packetsLost += Number(report.packetsLost);
|
|
8657
8649
|
}
|
|
8658
8650
|
if (report.type === 'transport') {
|
|
8659
|
-
transportSent += report.bytesSent;
|
|
8660
|
-
transportReceived += report.bytesReceived;
|
|
8651
|
+
transportSent += Number(report.bytesSent);
|
|
8652
|
+
transportReceived += Number(report.bytesReceived);
|
|
8661
8653
|
}
|
|
8662
8654
|
});
|
|
8663
8655
|
|
|
@@ -9243,18 +9235,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9243
9235
|
screenTrack,
|
|
9244
9236
|
});
|
|
9245
9237
|
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9238
|
+
if (screenTrack) {
|
|
9239
|
+
screenTrack.onended = () => {
|
|
9240
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9241
|
+
hadVideo,
|
|
9242
|
+
id: this.getSipSessionId(sipSession),
|
|
9243
|
+
screenTrack,
|
|
9244
|
+
});
|
|
9252
9245
|
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9246
|
+
this.eventEmitter.emit(
|
|
9247
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9248
|
+
this._createCallSession(sipSession, callSession),
|
|
9249
|
+
);
|
|
9250
|
+
};
|
|
9251
|
+
}
|
|
9258
9252
|
|
|
9259
9253
|
this.currentScreenShare = {
|
|
9260
9254
|
stream: screenStream,
|
|
@@ -1550,6 +1550,9 @@ class Contact {
|
|
|
1550
1550
|
}
|
|
1551
1551
|
|
|
1552
1552
|
static parseMany(response ) {
|
|
1553
|
+
if (!response || !response.results) {
|
|
1554
|
+
return [];
|
|
1555
|
+
}
|
|
1553
1556
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1554
1557
|
}
|
|
1555
1558
|
|
|
@@ -2657,6 +2660,9 @@ class Meeting {
|
|
|
2657
2660
|
}
|
|
2658
2661
|
|
|
2659
2662
|
static parseMany(items ) {
|
|
2663
|
+
if (!items) {
|
|
2664
|
+
return [];
|
|
2665
|
+
}
|
|
2660
2666
|
return items.map(plain => Meeting.parse(plain));
|
|
2661
2667
|
}
|
|
2662
2668
|
|
|
@@ -2859,6 +2865,10 @@ class ChatMessage {
|
|
|
2859
2865
|
|
|
2860
2866
|
|
|
2861
2867
|
static parseMany(plain ) {
|
|
2868
|
+
if (!plain || !plain.items) {
|
|
2869
|
+
return [];
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2862
2872
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2863
2873
|
}
|
|
2864
2874
|
|
|
@@ -2968,6 +2978,9 @@ class Voicemail {
|
|
|
2968
2978
|
}
|
|
2969
2979
|
|
|
2970
2980
|
static parseMany(plain ) {
|
|
2981
|
+
if (!plain) {
|
|
2982
|
+
return [];
|
|
2983
|
+
}
|
|
2971
2984
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2972
2985
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2973
2986
|
|
|
@@ -3077,6 +3090,9 @@ class Call {
|
|
|
3077
3090
|
|
|
3078
3091
|
|
|
3079
3092
|
static parseMany(plain ) {
|
|
3093
|
+
if (!plain) {
|
|
3094
|
+
return [];
|
|
3095
|
+
}
|
|
3080
3096
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3081
3097
|
}
|
|
3082
3098
|
|
|
@@ -3620,6 +3636,9 @@ class Recording {
|
|
|
3620
3636
|
|
|
3621
3637
|
|
|
3622
3638
|
static parseMany(recordings = []) {
|
|
3639
|
+
if (!recordings) {
|
|
3640
|
+
return [];
|
|
3641
|
+
}
|
|
3623
3642
|
return recordings.map(item => Recording.parse(item));
|
|
3624
3643
|
}
|
|
3625
3644
|
|
|
@@ -3721,6 +3740,10 @@ class CallLog {
|
|
|
3721
3740
|
}
|
|
3722
3741
|
|
|
3723
3742
|
static parseMany(plain ) {
|
|
3743
|
+
if (!plain || !plain.items) {
|
|
3744
|
+
return [];
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3724
3747
|
return plain.items.map(item => CallLog.parse(item));
|
|
3725
3748
|
}
|
|
3726
3749
|
|
|
@@ -4290,6 +4313,10 @@ class CTIPhone extends Emitter {
|
|
|
4290
4313
|
return false;
|
|
4291
4314
|
}
|
|
4292
4315
|
|
|
4316
|
+
hasAVideoTrack() {
|
|
4317
|
+
return false;
|
|
4318
|
+
}
|
|
4319
|
+
|
|
4293
4320
|
getLocalStreamForCall() {
|
|
4294
4321
|
return null;
|
|
4295
4322
|
}
|
|
@@ -4683,6 +4710,9 @@ class ChatRoom {
|
|
|
4683
4710
|
|
|
4684
4711
|
|
|
4685
4712
|
static parseMany(plain ) {
|
|
4713
|
+
if (!plain || !plain.items) {
|
|
4714
|
+
return [];
|
|
4715
|
+
}
|
|
4686
4716
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4687
4717
|
}
|
|
4688
4718
|
|
|
@@ -5928,10 +5958,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5928
5958
|
candidates
|
|
5929
5959
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5930
5960
|
|
|
5931
|
-
const areCandidateValid = (candidates ) =>
|
|
5932
|
-
getSrflxOrRelay(candidates)
|
|
5933
|
-
.length > 0;
|
|
5934
|
-
|
|
5935
5961
|
const getVideoDirection = (sdp ) => {
|
|
5936
5962
|
const parsedSdp = sdpParser.parse(sdp);
|
|
5937
5963
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5984,8 +6010,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5984
6010
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5985
6011
|
|
|
5986
6012
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5987
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5988
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5989
6013
|
|
|
5990
6014
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5991
6015
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -6175,38 +6199,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6175
6199
|
this._peerConnection = undefined;
|
|
6176
6200
|
}
|
|
6177
6201
|
|
|
6178
|
-
async _waitForValidGatheredIce() {
|
|
6179
|
-
let tries = 0;
|
|
6180
|
-
|
|
6181
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
6182
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
6183
|
-
tries,
|
|
6184
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
6185
|
-
});
|
|
6186
|
-
|
|
6187
|
-
tries++;
|
|
6188
|
-
|
|
6189
|
-
// eslint-disable-next-line no-await-in-loop
|
|
6190
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
6191
|
-
}
|
|
6192
|
-
|
|
6193
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
6194
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
6195
|
-
const error = new Error(errorMsg);
|
|
6196
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
6197
|
-
|
|
6198
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
6199
|
-
this.eventEmitter.emit('error', error);
|
|
6200
|
-
|
|
6201
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6202
|
-
}
|
|
6203
|
-
|
|
6204
|
-
// eslint-disable-next-line
|
|
6205
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6206
|
-
|
|
6207
|
-
return this.getLocalSessionDescription();
|
|
6208
|
-
}
|
|
6209
|
-
|
|
6210
6202
|
// Overridden to send `inactive` in conference
|
|
6211
6203
|
updateDirection(options , isConference = false,
|
|
6212
6204
|
audioOnly = false) {
|
|
@@ -8622,25 +8614,25 @@ class WebRTCClient extends Emitter {
|
|
|
8622
8614
|
|
|
8623
8615
|
stats.forEach(report => {
|
|
8624
8616
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8625
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8617
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8626
8618
|
}
|
|
8627
8619
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8628
|
-
audioBytesSent += report.bytesSent;
|
|
8620
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8629
8621
|
}
|
|
8630
8622
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8631
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8623
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8632
8624
|
}
|
|
8633
8625
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8634
|
-
packetsLost += report.packetsLost;
|
|
8635
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8636
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8626
|
+
packetsLost += Number(report.packetsLost);
|
|
8627
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8628
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8637
8629
|
}
|
|
8638
8630
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8639
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8631
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8640
8632
|
}
|
|
8641
8633
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8642
8634
|
if ('framesPerSecond' in report) {
|
|
8643
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8635
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8644
8636
|
}
|
|
8645
8637
|
if ('framerateMean' in report) {
|
|
8646
8638
|
// framerateMean is only available in FF
|
|
@@ -8648,16 +8640,16 @@ class WebRTCClient extends Emitter {
|
|
|
8648
8640
|
}
|
|
8649
8641
|
}
|
|
8650
8642
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8651
|
-
packetsLost += report.packetsLost;
|
|
8652
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8653
|
-
networkStats.jitter = report.jitter;
|
|
8643
|
+
packetsLost += Number(report.packetsLost);
|
|
8644
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8645
|
+
networkStats.jitter = Number(report.jitter);
|
|
8654
8646
|
}
|
|
8655
8647
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8656
|
-
packetsLost += report.packetsLost;
|
|
8648
|
+
packetsLost += Number(report.packetsLost);
|
|
8657
8649
|
}
|
|
8658
8650
|
if (report.type === 'transport') {
|
|
8659
|
-
transportSent += report.bytesSent;
|
|
8660
|
-
transportReceived += report.bytesReceived;
|
|
8651
|
+
transportSent += Number(report.bytesSent);
|
|
8652
|
+
transportReceived += Number(report.bytesReceived);
|
|
8661
8653
|
}
|
|
8662
8654
|
});
|
|
8663
8655
|
|
|
@@ -9243,18 +9235,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9243
9235
|
screenTrack,
|
|
9244
9236
|
});
|
|
9245
9237
|
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9238
|
+
if (screenTrack) {
|
|
9239
|
+
screenTrack.onended = () => {
|
|
9240
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9241
|
+
hadVideo,
|
|
9242
|
+
id: this.getSipSessionId(sipSession),
|
|
9243
|
+
screenTrack,
|
|
9244
|
+
});
|
|
9252
9245
|
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9246
|
+
this.eventEmitter.emit(
|
|
9247
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9248
|
+
this._createCallSession(sipSession, callSession),
|
|
9249
|
+
);
|
|
9250
|
+
};
|
|
9251
|
+
}
|
|
9258
9252
|
|
|
9259
9253
|
this.currentScreenShare = {
|
|
9260
9254
|
stream: screenStream,
|