@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
package/esm/index.js
CHANGED
|
@@ -1551,6 +1551,9 @@ class Contact {
|
|
|
1551
1551
|
}
|
|
1552
1552
|
|
|
1553
1553
|
static parseMany(response ) {
|
|
1554
|
+
if (!response || !response.results) {
|
|
1555
|
+
return [];
|
|
1556
|
+
}
|
|
1554
1557
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1555
1558
|
}
|
|
1556
1559
|
|
|
@@ -2658,6 +2661,9 @@ class Meeting {
|
|
|
2658
2661
|
}
|
|
2659
2662
|
|
|
2660
2663
|
static parseMany(items ) {
|
|
2664
|
+
if (!items) {
|
|
2665
|
+
return [];
|
|
2666
|
+
}
|
|
2661
2667
|
return items.map(plain => Meeting.parse(plain));
|
|
2662
2668
|
}
|
|
2663
2669
|
|
|
@@ -2860,6 +2866,10 @@ class ChatMessage {
|
|
|
2860
2866
|
|
|
2861
2867
|
|
|
2862
2868
|
static parseMany(plain ) {
|
|
2869
|
+
if (!plain || !plain.items) {
|
|
2870
|
+
return [];
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2863
2873
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2864
2874
|
}
|
|
2865
2875
|
|
|
@@ -2969,6 +2979,9 @@ class Voicemail {
|
|
|
2969
2979
|
}
|
|
2970
2980
|
|
|
2971
2981
|
static parseMany(plain ) {
|
|
2982
|
+
if (!plain) {
|
|
2983
|
+
return [];
|
|
2984
|
+
}
|
|
2972
2985
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2973
2986
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2974
2987
|
|
|
@@ -3078,6 +3091,9 @@ class Call {
|
|
|
3078
3091
|
|
|
3079
3092
|
|
|
3080
3093
|
static parseMany(plain ) {
|
|
3094
|
+
if (!plain) {
|
|
3095
|
+
return [];
|
|
3096
|
+
}
|
|
3081
3097
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3082
3098
|
}
|
|
3083
3099
|
|
|
@@ -3621,6 +3637,9 @@ class Recording {
|
|
|
3621
3637
|
|
|
3622
3638
|
|
|
3623
3639
|
static parseMany(recordings = []) {
|
|
3640
|
+
if (!recordings) {
|
|
3641
|
+
return [];
|
|
3642
|
+
}
|
|
3624
3643
|
return recordings.map(item => Recording.parse(item));
|
|
3625
3644
|
}
|
|
3626
3645
|
|
|
@@ -3722,6 +3741,10 @@ class CallLog {
|
|
|
3722
3741
|
}
|
|
3723
3742
|
|
|
3724
3743
|
static parseMany(plain ) {
|
|
3744
|
+
if (!plain || !plain.items) {
|
|
3745
|
+
return [];
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3725
3748
|
return plain.items.map(item => CallLog.parse(item));
|
|
3726
3749
|
}
|
|
3727
3750
|
|
|
@@ -4374,6 +4397,10 @@ class CTIPhone extends Emitter {
|
|
|
4374
4397
|
return false;
|
|
4375
4398
|
}
|
|
4376
4399
|
|
|
4400
|
+
hasAVideoTrack() {
|
|
4401
|
+
return false;
|
|
4402
|
+
}
|
|
4403
|
+
|
|
4377
4404
|
getLocalStreamForCall() {
|
|
4378
4405
|
return null;
|
|
4379
4406
|
}
|
|
@@ -4767,6 +4794,9 @@ class ChatRoom {
|
|
|
4767
4794
|
|
|
4768
4795
|
|
|
4769
4796
|
static parseMany(plain ) {
|
|
4797
|
+
if (!plain || !plain.items) {
|
|
4798
|
+
return [];
|
|
4799
|
+
}
|
|
4770
4800
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4771
4801
|
}
|
|
4772
4802
|
|
|
@@ -5490,10 +5520,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5490
5520
|
candidates
|
|
5491
5521
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5492
5522
|
|
|
5493
|
-
const areCandidateValid = (candidates ) =>
|
|
5494
|
-
getSrflxOrRelay(candidates)
|
|
5495
|
-
.length > 0;
|
|
5496
|
-
|
|
5497
5523
|
const getVideoDirection = (sdp ) => {
|
|
5498
5524
|
const parsedSdp = sdpParser.parse(sdp);
|
|
5499
5525
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5546,8 +5572,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5546
5572
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5547
5573
|
|
|
5548
5574
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5549
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5550
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5551
5575
|
|
|
5552
5576
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5553
5577
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -5737,38 +5761,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5737
5761
|
this._peerConnection = undefined;
|
|
5738
5762
|
}
|
|
5739
5763
|
|
|
5740
|
-
async _waitForValidGatheredIce() {
|
|
5741
|
-
let tries = 0;
|
|
5742
|
-
|
|
5743
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
5744
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
5745
|
-
tries,
|
|
5746
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
5747
|
-
});
|
|
5748
|
-
|
|
5749
|
-
tries++;
|
|
5750
|
-
|
|
5751
|
-
// eslint-disable-next-line no-await-in-loop
|
|
5752
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
5753
|
-
}
|
|
5754
|
-
|
|
5755
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
5756
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
5757
|
-
const error = new Error(errorMsg);
|
|
5758
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
5759
|
-
|
|
5760
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
5761
|
-
this.eventEmitter.emit('error', error);
|
|
5762
|
-
|
|
5763
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5764
|
-
}
|
|
5765
|
-
|
|
5766
|
-
// eslint-disable-next-line
|
|
5767
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5768
|
-
|
|
5769
|
-
return this.getLocalSessionDescription();
|
|
5770
|
-
}
|
|
5771
|
-
|
|
5772
5764
|
// Overridden to send `inactive` in conference
|
|
5773
5765
|
updateDirection(options , isConference = false,
|
|
5774
5766
|
audioOnly = false) {
|
|
@@ -8184,25 +8176,25 @@ class WebRTCClient extends Emitter {
|
|
|
8184
8176
|
|
|
8185
8177
|
stats.forEach(report => {
|
|
8186
8178
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8187
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8179
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8188
8180
|
}
|
|
8189
8181
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8190
|
-
audioBytesSent += report.bytesSent;
|
|
8182
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8191
8183
|
}
|
|
8192
8184
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8193
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8185
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8194
8186
|
}
|
|
8195
8187
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8196
|
-
packetsLost += report.packetsLost;
|
|
8197
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8198
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8188
|
+
packetsLost += Number(report.packetsLost);
|
|
8189
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8190
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8199
8191
|
}
|
|
8200
8192
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8201
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8193
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8202
8194
|
}
|
|
8203
8195
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8204
8196
|
if ('framesPerSecond' in report) {
|
|
8205
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8197
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8206
8198
|
}
|
|
8207
8199
|
if ('framerateMean' in report) {
|
|
8208
8200
|
// framerateMean is only available in FF
|
|
@@ -8210,16 +8202,16 @@ class WebRTCClient extends Emitter {
|
|
|
8210
8202
|
}
|
|
8211
8203
|
}
|
|
8212
8204
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8213
|
-
packetsLost += report.packetsLost;
|
|
8214
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8215
|
-
networkStats.jitter = report.jitter;
|
|
8205
|
+
packetsLost += Number(report.packetsLost);
|
|
8206
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8207
|
+
networkStats.jitter = Number(report.jitter);
|
|
8216
8208
|
}
|
|
8217
8209
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8218
|
-
packetsLost += report.packetsLost;
|
|
8210
|
+
packetsLost += Number(report.packetsLost);
|
|
8219
8211
|
}
|
|
8220
8212
|
if (report.type === 'transport') {
|
|
8221
|
-
transportSent += report.bytesSent;
|
|
8222
|
-
transportReceived += report.bytesReceived;
|
|
8213
|
+
transportSent += Number(report.bytesSent);
|
|
8214
|
+
transportReceived += Number(report.bytesReceived);
|
|
8223
8215
|
}
|
|
8224
8216
|
});
|
|
8225
8217
|
|
|
@@ -9698,18 +9690,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9698
9690
|
screenTrack,
|
|
9699
9691
|
});
|
|
9700
9692
|
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9693
|
+
if (screenTrack) {
|
|
9694
|
+
screenTrack.onended = () => {
|
|
9695
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9696
|
+
hadVideo,
|
|
9697
|
+
id: this.getSipSessionId(sipSession),
|
|
9698
|
+
screenTrack,
|
|
9699
|
+
});
|
|
9707
9700
|
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9701
|
+
this.eventEmitter.emit(
|
|
9702
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9703
|
+
this._createCallSession(sipSession, callSession),
|
|
9704
|
+
);
|
|
9705
|
+
};
|
|
9706
|
+
}
|
|
9713
9707
|
|
|
9714
9708
|
this.currentScreenShare = {
|
|
9715
9709
|
stream: screenStream,
|
|
@@ -409,10 +409,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
409
409
|
candidates
|
|
410
410
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
411
411
|
|
|
412
|
-
const areCandidateValid = (candidates ) =>
|
|
413
|
-
getSrflxOrRelay(candidates)
|
|
414
|
-
.length > 0;
|
|
415
|
-
|
|
416
412
|
const fixSdp = (sdp , candidates , forcePort = true) => {
|
|
417
413
|
const parsedSdp = sdpParser.parse(sdp);
|
|
418
414
|
const mainCandidate = getSrflxOrRelay(candidates)[0];
|
|
@@ -444,8 +440,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
444
440
|
/* global RTCSessionDescriptionInit, navigator */
|
|
445
441
|
|
|
446
442
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
447
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
448
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
449
443
|
|
|
450
444
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
451
445
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -635,38 +629,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
635
629
|
this._peerConnection = undefined;
|
|
636
630
|
}
|
|
637
631
|
|
|
638
|
-
async _waitForValidGatheredIce() {
|
|
639
|
-
let tries = 0;
|
|
640
|
-
|
|
641
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
642
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
643
|
-
tries,
|
|
644
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
645
|
-
});
|
|
646
|
-
|
|
647
|
-
tries++;
|
|
648
|
-
|
|
649
|
-
// eslint-disable-next-line no-await-in-loop
|
|
650
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
654
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
655
|
-
const error = new Error(errorMsg);
|
|
656
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
657
|
-
|
|
658
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
659
|
-
this.eventEmitter.emit('error', error);
|
|
660
|
-
|
|
661
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
// eslint-disable-next-line
|
|
665
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
666
|
-
|
|
667
|
-
return this.getLocalSessionDescription();
|
|
668
|
-
}
|
|
669
|
-
|
|
670
632
|
// Overridden to send `inactive` in conference
|
|
671
633
|
updateDirection(options , isConference = false,
|
|
672
634
|
audioOnly = false) {
|
package/esm/service/CallApi.js
CHANGED
|
@@ -76,6 +76,9 @@ class Call {
|
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
static parseMany(plain ) {
|
|
79
|
+
if (!plain) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
79
82
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
80
83
|
}
|
|
81
84
|
|
|
@@ -1034,6 +1037,9 @@ class Contact {
|
|
|
1034
1037
|
}
|
|
1035
1038
|
|
|
1036
1039
|
static parseMany(response ) {
|
|
1040
|
+
if (!response || !response.results) {
|
|
1041
|
+
return [];
|
|
1042
|
+
}
|
|
1037
1043
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1038
1044
|
}
|
|
1039
1045
|
|
|
@@ -1706,6 +1712,9 @@ class Recording {
|
|
|
1706
1712
|
|
|
1707
1713
|
|
|
1708
1714
|
static parseMany(recordings = []) {
|
|
1715
|
+
if (!recordings) {
|
|
1716
|
+
return [];
|
|
1717
|
+
}
|
|
1709
1718
|
return recordings.map(item => Recording.parse(item));
|
|
1710
1719
|
}
|
|
1711
1720
|
|
|
@@ -1807,6 +1816,10 @@ class CallLog {
|
|
|
1807
1816
|
}
|
|
1808
1817
|
|
|
1809
1818
|
static parseMany(plain ) {
|
|
1819
|
+
if (!plain || !plain.items) {
|
|
1820
|
+
return [];
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1810
1823
|
return plain.items.map(item => CallLog.parse(item));
|
|
1811
1824
|
}
|
|
1812
1825
|
|
|
@@ -3162,6 +3175,9 @@ class Meeting {
|
|
|
3162
3175
|
}
|
|
3163
3176
|
|
|
3164
3177
|
static parseMany(items ) {
|
|
3178
|
+
if (!items) {
|
|
3179
|
+
return [];
|
|
3180
|
+
}
|
|
3165
3181
|
return items.map(plain => Meeting.parse(plain));
|
|
3166
3182
|
}
|
|
3167
3183
|
|
|
@@ -3321,6 +3337,10 @@ class ChatMessage {
|
|
|
3321
3337
|
|
|
3322
3338
|
|
|
3323
3339
|
static parseMany(plain ) {
|
|
3340
|
+
if (!plain || !plain.items) {
|
|
3341
|
+
return [];
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3324
3344
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3325
3345
|
}
|
|
3326
3346
|
|
|
@@ -3430,6 +3450,9 @@ class Voicemail {
|
|
|
3430
3450
|
}
|
|
3431
3451
|
|
|
3432
3452
|
static parseMany(plain ) {
|
|
3453
|
+
if (!plain) {
|
|
3454
|
+
return [];
|
|
3455
|
+
}
|
|
3433
3456
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3434
3457
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3435
3458
|
|
|
@@ -3820,6 +3843,9 @@ class ChatRoom {
|
|
|
3820
3843
|
|
|
3821
3844
|
|
|
3822
3845
|
static parseMany(plain ) {
|
|
3846
|
+
if (!plain || !plain.items) {
|
|
3847
|
+
return [];
|
|
3848
|
+
}
|
|
3823
3849
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3824
3850
|
}
|
|
3825
3851
|
|
|
@@ -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/Auth.js
CHANGED
|
@@ -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,
|