@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
|
@@ -863,6 +863,9 @@ class Contact {
|
|
|
863
863
|
}
|
|
864
864
|
|
|
865
865
|
static parseMany(response ) {
|
|
866
|
+
if (!response || !response.results) {
|
|
867
|
+
return [];
|
|
868
|
+
}
|
|
866
869
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
867
870
|
}
|
|
868
871
|
|
|
@@ -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
|
|
|
@@ -5664,10 +5694,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5664
5694
|
candidates
|
|
5665
5695
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5666
5696
|
|
|
5667
|
-
const areCandidateValid = (candidates ) =>
|
|
5668
|
-
getSrflxOrRelay(candidates)
|
|
5669
|
-
.length > 0;
|
|
5670
|
-
|
|
5671
5697
|
const getVideoDirection = (sdp ) => {
|
|
5672
5698
|
const parsedSdp = sdpParser.parse(sdp);
|
|
5673
5699
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5720,8 +5746,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5720
5746
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5721
5747
|
|
|
5722
5748
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5723
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5724
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5725
5749
|
|
|
5726
5750
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5727
5751
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -5911,38 +5935,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5911
5935
|
this._peerConnection = undefined;
|
|
5912
5936
|
}
|
|
5913
5937
|
|
|
5914
|
-
async _waitForValidGatheredIce() {
|
|
5915
|
-
let tries = 0;
|
|
5916
|
-
|
|
5917
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
5918
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
5919
|
-
tries,
|
|
5920
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
5921
|
-
});
|
|
5922
|
-
|
|
5923
|
-
tries++;
|
|
5924
|
-
|
|
5925
|
-
// eslint-disable-next-line no-await-in-loop
|
|
5926
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
5927
|
-
}
|
|
5928
|
-
|
|
5929
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
5930
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
5931
|
-
const error = new Error(errorMsg);
|
|
5932
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
5933
|
-
|
|
5934
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
5935
|
-
this.eventEmitter.emit('error', error);
|
|
5936
|
-
|
|
5937
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5938
|
-
}
|
|
5939
|
-
|
|
5940
|
-
// eslint-disable-next-line
|
|
5941
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5942
|
-
|
|
5943
|
-
return this.getLocalSessionDescription();
|
|
5944
|
-
}
|
|
5945
|
-
|
|
5946
5938
|
// Overridden to send `inactive` in conference
|
|
5947
5939
|
updateDirection(options , isConference = false,
|
|
5948
5940
|
audioOnly = false) {
|
|
@@ -8358,25 +8350,25 @@ class WebRTCClient extends Emitter {
|
|
|
8358
8350
|
|
|
8359
8351
|
stats.forEach(report => {
|
|
8360
8352
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8361
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8353
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8362
8354
|
}
|
|
8363
8355
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8364
|
-
audioBytesSent += report.bytesSent;
|
|
8356
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8365
8357
|
}
|
|
8366
8358
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8367
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8359
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8368
8360
|
}
|
|
8369
8361
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8370
|
-
packetsLost += report.packetsLost;
|
|
8371
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8372
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8362
|
+
packetsLost += Number(report.packetsLost);
|
|
8363
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8364
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8373
8365
|
}
|
|
8374
8366
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8375
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8367
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8376
8368
|
}
|
|
8377
8369
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8378
8370
|
if ('framesPerSecond' in report) {
|
|
8379
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8371
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8380
8372
|
}
|
|
8381
8373
|
if ('framerateMean' in report) {
|
|
8382
8374
|
// framerateMean is only available in FF
|
|
@@ -8384,16 +8376,16 @@ class WebRTCClient extends Emitter {
|
|
|
8384
8376
|
}
|
|
8385
8377
|
}
|
|
8386
8378
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8387
|
-
packetsLost += report.packetsLost;
|
|
8388
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8389
|
-
networkStats.jitter = report.jitter;
|
|
8379
|
+
packetsLost += Number(report.packetsLost);
|
|
8380
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8381
|
+
networkStats.jitter = Number(report.jitter);
|
|
8390
8382
|
}
|
|
8391
8383
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8392
|
-
packetsLost += report.packetsLost;
|
|
8384
|
+
packetsLost += Number(report.packetsLost);
|
|
8393
8385
|
}
|
|
8394
8386
|
if (report.type === 'transport') {
|
|
8395
|
-
transportSent += report.bytesSent;
|
|
8396
|
-
transportReceived += report.bytesReceived;
|
|
8387
|
+
transportSent += Number(report.bytesSent);
|
|
8388
|
+
transportReceived += Number(report.bytesReceived);
|
|
8397
8389
|
}
|
|
8398
8390
|
});
|
|
8399
8391
|
|
|
@@ -8979,18 +8971,20 @@ class WebRTCPhone extends Emitter {
|
|
|
8979
8971
|
screenTrack,
|
|
8980
8972
|
});
|
|
8981
8973
|
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8974
|
+
if (screenTrack) {
|
|
8975
|
+
screenTrack.onended = () => {
|
|
8976
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
8977
|
+
hadVideo,
|
|
8978
|
+
id: this.getSipSessionId(sipSession),
|
|
8979
|
+
screenTrack,
|
|
8980
|
+
});
|
|
8988
8981
|
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8982
|
+
this.eventEmitter.emit(
|
|
8983
|
+
ON_SHARE_SCREEN_ENDING,
|
|
8984
|
+
this._createCallSession(sipSession, callSession),
|
|
8985
|
+
);
|
|
8986
|
+
};
|
|
8987
|
+
}
|
|
8994
8988
|
|
|
8995
8989
|
this.currentScreenShare = {
|
|
8996
8990
|
stream: screenStream,
|
package/esm/simple/Directory.js
CHANGED
|
@@ -1531,6 +1531,9 @@ class Contact {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
|
|
1533
1533
|
static parseMany(response ) {
|
|
1534
|
+
if (!response || !response.results) {
|
|
1535
|
+
return [];
|
|
1536
|
+
}
|
|
1534
1537
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1535
1538
|
}
|
|
1536
1539
|
|
|
@@ -2638,6 +2641,9 @@ class Meeting {
|
|
|
2638
2641
|
}
|
|
2639
2642
|
|
|
2640
2643
|
static parseMany(items ) {
|
|
2644
|
+
if (!items) {
|
|
2645
|
+
return [];
|
|
2646
|
+
}
|
|
2641
2647
|
return items.map(plain => Meeting.parse(plain));
|
|
2642
2648
|
}
|
|
2643
2649
|
|
|
@@ -2840,6 +2846,10 @@ class ChatMessage {
|
|
|
2840
2846
|
|
|
2841
2847
|
|
|
2842
2848
|
static parseMany(plain ) {
|
|
2849
|
+
if (!plain || !plain.items) {
|
|
2850
|
+
return [];
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2843
2853
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2844
2854
|
}
|
|
2845
2855
|
|
|
@@ -2949,6 +2959,9 @@ class Voicemail {
|
|
|
2949
2959
|
}
|
|
2950
2960
|
|
|
2951
2961
|
static parseMany(plain ) {
|
|
2962
|
+
if (!plain) {
|
|
2963
|
+
return [];
|
|
2964
|
+
}
|
|
2952
2965
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2953
2966
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2954
2967
|
|
|
@@ -3058,6 +3071,9 @@ class Call {
|
|
|
3058
3071
|
|
|
3059
3072
|
|
|
3060
3073
|
static parseMany(plain ) {
|
|
3074
|
+
if (!plain) {
|
|
3075
|
+
return [];
|
|
3076
|
+
}
|
|
3061
3077
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3062
3078
|
}
|
|
3063
3079
|
|
|
@@ -3230,6 +3246,9 @@ class Recording {
|
|
|
3230
3246
|
|
|
3231
3247
|
|
|
3232
3248
|
static parseMany(recordings = []) {
|
|
3249
|
+
if (!recordings) {
|
|
3250
|
+
return [];
|
|
3251
|
+
}
|
|
3233
3252
|
return recordings.map(item => Recording.parse(item));
|
|
3234
3253
|
}
|
|
3235
3254
|
|
|
@@ -3331,6 +3350,10 @@ class CallLog {
|
|
|
3331
3350
|
}
|
|
3332
3351
|
|
|
3333
3352
|
static parseMany(plain ) {
|
|
3353
|
+
if (!plain || !plain.items) {
|
|
3354
|
+
return [];
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3334
3357
|
return plain.items.map(item => CallLog.parse(item));
|
|
3335
3358
|
}
|
|
3336
3359
|
|
|
@@ -3888,6 +3911,9 @@ class ChatRoom {
|
|
|
3888
3911
|
|
|
3889
3912
|
|
|
3890
3913
|
static parseMany(plain ) {
|
|
3914
|
+
if (!plain || !plain.items) {
|
|
3915
|
+
return [];
|
|
3916
|
+
}
|
|
3891
3917
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3892
3918
|
}
|
|
3893
3919
|
|
package/esm/simple/Phone.js
CHANGED
|
@@ -95,6 +95,9 @@ class Call {
|
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
static parseMany(plain ) {
|
|
98
|
+
if (!plain) {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
98
101
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
99
102
|
}
|
|
100
103
|
|
|
@@ -2101,6 +2104,9 @@ class Contact {
|
|
|
2101
2104
|
}
|
|
2102
2105
|
|
|
2103
2106
|
static parseMany(response ) {
|
|
2107
|
+
if (!response || !response.results) {
|
|
2108
|
+
return [];
|
|
2109
|
+
}
|
|
2104
2110
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
2105
2111
|
}
|
|
2106
2112
|
|
|
@@ -3208,6 +3214,9 @@ class Meeting {
|
|
|
3208
3214
|
}
|
|
3209
3215
|
|
|
3210
3216
|
static parseMany(items ) {
|
|
3217
|
+
if (!items) {
|
|
3218
|
+
return [];
|
|
3219
|
+
}
|
|
3211
3220
|
return items.map(plain => Meeting.parse(plain));
|
|
3212
3221
|
}
|
|
3213
3222
|
|
|
@@ -3410,6 +3419,10 @@ class ChatMessage {
|
|
|
3410
3419
|
|
|
3411
3420
|
|
|
3412
3421
|
static parseMany(plain ) {
|
|
3422
|
+
if (!plain || !plain.items) {
|
|
3423
|
+
return [];
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3413
3426
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3414
3427
|
}
|
|
3415
3428
|
|
|
@@ -3519,6 +3532,9 @@ class Voicemail {
|
|
|
3519
3532
|
}
|
|
3520
3533
|
|
|
3521
3534
|
static parseMany(plain ) {
|
|
3535
|
+
if (!plain) {
|
|
3536
|
+
return [];
|
|
3537
|
+
}
|
|
3522
3538
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3523
3539
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3524
3540
|
|
|
@@ -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
|
|
|
@@ -5664,10 +5694,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5664
5694
|
candidates
|
|
5665
5695
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5666
5696
|
|
|
5667
|
-
const areCandidateValid = (candidates ) =>
|
|
5668
|
-
getSrflxOrRelay(candidates)
|
|
5669
|
-
.length > 0;
|
|
5670
|
-
|
|
5671
5697
|
const getVideoDirection = (sdp ) => {
|
|
5672
5698
|
const parsedSdp = sdpParser.parse(sdp);
|
|
5673
5699
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5720,8 +5746,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5720
5746
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5721
5747
|
|
|
5722
5748
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5723
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5724
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5725
5749
|
|
|
5726
5750
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5727
5751
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -5911,38 +5935,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5911
5935
|
this._peerConnection = undefined;
|
|
5912
5936
|
}
|
|
5913
5937
|
|
|
5914
|
-
async _waitForValidGatheredIce() {
|
|
5915
|
-
let tries = 0;
|
|
5916
|
-
|
|
5917
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
5918
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
5919
|
-
tries,
|
|
5920
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
5921
|
-
});
|
|
5922
|
-
|
|
5923
|
-
tries++;
|
|
5924
|
-
|
|
5925
|
-
// eslint-disable-next-line no-await-in-loop
|
|
5926
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
5927
|
-
}
|
|
5928
|
-
|
|
5929
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
5930
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
5931
|
-
const error = new Error(errorMsg);
|
|
5932
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
5933
|
-
|
|
5934
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
5935
|
-
this.eventEmitter.emit('error', error);
|
|
5936
|
-
|
|
5937
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5938
|
-
}
|
|
5939
|
-
|
|
5940
|
-
// eslint-disable-next-line
|
|
5941
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5942
|
-
|
|
5943
|
-
return this.getLocalSessionDescription();
|
|
5944
|
-
}
|
|
5945
|
-
|
|
5946
5938
|
// Overridden to send `inactive` in conference
|
|
5947
5939
|
updateDirection(options , isConference = false,
|
|
5948
5940
|
audioOnly = false) {
|
|
@@ -8358,25 +8350,25 @@ class WebRTCClient extends Emitter {
|
|
|
8358
8350
|
|
|
8359
8351
|
stats.forEach(report => {
|
|
8360
8352
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8361
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8353
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8362
8354
|
}
|
|
8363
8355
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8364
|
-
audioBytesSent += report.bytesSent;
|
|
8356
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8365
8357
|
}
|
|
8366
8358
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8367
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8359
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8368
8360
|
}
|
|
8369
8361
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8370
|
-
packetsLost += report.packetsLost;
|
|
8371
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8372
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8362
|
+
packetsLost += Number(report.packetsLost);
|
|
8363
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8364
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8373
8365
|
}
|
|
8374
8366
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8375
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8367
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8376
8368
|
}
|
|
8377
8369
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8378
8370
|
if ('framesPerSecond' in report) {
|
|
8379
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8371
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8380
8372
|
}
|
|
8381
8373
|
if ('framerateMean' in report) {
|
|
8382
8374
|
// framerateMean is only available in FF
|
|
@@ -8384,16 +8376,16 @@ class WebRTCClient extends Emitter {
|
|
|
8384
8376
|
}
|
|
8385
8377
|
}
|
|
8386
8378
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8387
|
-
packetsLost += report.packetsLost;
|
|
8388
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8389
|
-
networkStats.jitter = report.jitter;
|
|
8379
|
+
packetsLost += Number(report.packetsLost);
|
|
8380
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8381
|
+
networkStats.jitter = Number(report.jitter);
|
|
8390
8382
|
}
|
|
8391
8383
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8392
|
-
packetsLost += report.packetsLost;
|
|
8384
|
+
packetsLost += Number(report.packetsLost);
|
|
8393
8385
|
}
|
|
8394
8386
|
if (report.type === 'transport') {
|
|
8395
|
-
transportSent += report.bytesSent;
|
|
8396
|
-
transportReceived += report.bytesReceived;
|
|
8387
|
+
transportSent += Number(report.bytesSent);
|
|
8388
|
+
transportReceived += Number(report.bytesReceived);
|
|
8397
8389
|
}
|
|
8398
8390
|
});
|
|
8399
8391
|
|
|
@@ -8979,18 +8971,20 @@ class WebRTCPhone extends Emitter {
|
|
|
8979
8971
|
screenTrack,
|
|
8980
8972
|
});
|
|
8981
8973
|
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8974
|
+
if (screenTrack) {
|
|
8975
|
+
screenTrack.onended = () => {
|
|
8976
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
8977
|
+
hadVideo,
|
|
8978
|
+
id: this.getSipSessionId(sipSession),
|
|
8979
|
+
screenTrack,
|
|
8980
|
+
});
|
|
8988
8981
|
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8982
|
+
this.eventEmitter.emit(
|
|
8983
|
+
ON_SHARE_SCREEN_ENDING,
|
|
8984
|
+
this._createCallSession(sipSession, callSession),
|
|
8985
|
+
);
|
|
8986
|
+
};
|
|
8987
|
+
}
|
|
8994
8988
|
|
|
8995
8989
|
this.currentScreenShare = {
|
|
8996
8990
|
stream: screenStream,
|