@wazo/sdk 0.37.21 → 0.37.25
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 +36 -5
- package/esm/__tests__/web-rtc-client.test.js +77 -66
- 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 +13 -5
- package/esm/api/ctid-ng.js +10 -0
- package/esm/api/dird.js +3 -0
- package/esm/api-client.js +36 -5
- package/esm/checker/Checker.js +77 -66
- package/esm/checker/checks/aor.js +36 -5
- package/esm/checker/checks/api.js +36 -5
- package/esm/checker/checks/index.js +77 -66
- package/esm/checker/checks/webrtc-transport.js +77 -66
- package/esm/checker/checks/webrtc.js +77 -66
- package/esm/domain/AdHocAPIConference.js +36 -5
- 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 +36 -5
- package/esm/domain/Meeting.js +15 -5
- package/esm/domain/Phone/CTIPhone.js +40 -5
- package/esm/domain/Phone/WebRTCPhone.js +45 -16
- 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__/Meeting.test.js +144 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +125 -81
- package/esm/lib/WazoSessionDescriptionHandler.js +0 -38
- package/esm/service/CallApi.js +36 -5
- package/esm/service/getApiClient.js +36 -5
- package/esm/simple/Auth.js +125 -81
- package/esm/simple/Configuration.js +125 -81
- package/esm/simple/Directory.js +36 -5
- package/esm/simple/Phone.js +125 -81
- package/esm/simple/index.js +125 -81
- package/esm/simple/room/LocalParticipant.js +125 -81
- package/esm/simple/room/Participant.js +125 -81
- package/esm/simple/room/RemoteParticipant.js +125 -81
- package/esm/simple/room/Room.js +125 -81
- package/esm/simple/room/SipRoom.js +125 -81
- package/esm/simple/room/Stream.js +125 -81
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +125 -81
- package/esm/simple/utils.js +125 -81
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +77 -66
- package/lib/__tests__/api-client.test.js +36 -5
- package/lib/__tests__/web-rtc-client.test.js +77 -66
- 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 +13 -5
- package/lib/api/ctid-ng.js +10 -0
- package/lib/api/dird.js +3 -0
- package/lib/api-client.js +36 -5
- package/lib/checker/Checker.js +77 -66
- package/lib/checker/checks/aor.js +36 -5
- package/lib/checker/checks/api.js +36 -5
- package/lib/checker/checks/index.js +77 -66
- package/lib/checker/checks/webrtc-transport.js +77 -66
- package/lib/checker/checks/webrtc.js +77 -66
- package/lib/domain/AdHocAPIConference.js +36 -5
- 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 +36 -5
- package/lib/domain/Meeting.js +19 -5
- package/lib/domain/Phone/CTIPhone.js +40 -5
- package/lib/domain/Phone/WebRTCPhone.js +45 -16
- 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__/Meeting.test.js +150 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +125 -81
- package/lib/lib/WazoSessionDescriptionHandler.js +0 -38
- package/lib/service/CallApi.js +36 -5
- package/lib/service/getApiClient.js +36 -5
- package/lib/simple/Auth.js +125 -81
- package/lib/simple/Configuration.js +125 -81
- package/lib/simple/Directory.js +36 -5
- package/lib/simple/Phone.js +125 -81
- package/lib/simple/index.js +125 -81
- package/lib/simple/room/LocalParticipant.js +125 -81
- package/lib/simple/room/Participant.js +125 -81
- package/lib/simple/room/RemoteParticipant.js +125 -81
- package/lib/simple/room/Room.js +125 -81
- package/lib/simple/room/SipRoom.js +125 -81
- package/lib/simple/room/Stream.js +125 -81
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +125 -81
- package/lib/simple/utils.js +125 -81
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +77 -66
- 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 +15 -5
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +45 -16
- package/src/domain/Recording.js +3 -0
- package/src/domain/Voicemail.js +3 -0
- package/src/domain/__tests__/Meeting.test.js +50 -0
- package/src/lib/WazoSessionDescriptionHandler.js +1 -35
- package/src/web-rtc-client.js +41 -23
|
@@ -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
|
|
|
@@ -2653,8 +2656,9 @@ class ExternalApp {
|
|
|
2653
2656
|
|
|
2654
2657
|
|
|
2655
2658
|
|
|
2656
|
-
|
|
2659
|
+
|
|
2657
2660
|
|
|
2661
|
+
|
|
2658
2662
|
|
|
2659
2663
|
|
|
2660
2664
|
class Meeting {
|
|
@@ -2665,9 +2669,10 @@ class Meeting {
|
|
|
2665
2669
|
|
|
2666
2670
|
|
|
2667
2671
|
|
|
2668
|
-
|
|
2672
|
+
|
|
2669
2673
|
|
|
2670
2674
|
|
|
2675
|
+
|
|
2671
2676
|
|
|
2672
2677
|
static parse(plain ) {
|
|
2673
2678
|
return new Meeting({
|
|
@@ -2677,12 +2682,16 @@ class Meeting {
|
|
|
2677
2682
|
ownerUuids: plain.owner_uuids,
|
|
2678
2683
|
port: plain.port,
|
|
2679
2684
|
uuid: plain.uuid,
|
|
2680
|
-
|
|
2685
|
+
extension: plain.exten,
|
|
2681
2686
|
persistent: plain.persistent,
|
|
2687
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
2682
2688
|
});
|
|
2683
2689
|
}
|
|
2684
2690
|
|
|
2685
2691
|
static parseMany(items ) {
|
|
2692
|
+
if (!items) {
|
|
2693
|
+
return [];
|
|
2694
|
+
}
|
|
2686
2695
|
return items.map(plain => Meeting.parse(plain));
|
|
2687
2696
|
}
|
|
2688
2697
|
|
|
@@ -2697,8 +2706,9 @@ class Meeting {
|
|
|
2697
2706
|
ownerUuids,
|
|
2698
2707
|
port,
|
|
2699
2708
|
uri,
|
|
2700
|
-
|
|
2709
|
+
extension,
|
|
2701
2710
|
persistent,
|
|
2711
|
+
creationTime,
|
|
2702
2712
|
} = {}) {
|
|
2703
2713
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2704
2714
|
this.uri = uri;
|
|
@@ -2706,8 +2716,9 @@ class Meeting {
|
|
|
2706
2716
|
this.ownerUuids = ownerUuids;
|
|
2707
2717
|
this.port = port;
|
|
2708
2718
|
this.uuid = uuid;
|
|
2709
|
-
this.
|
|
2719
|
+
this.extension = extension;
|
|
2710
2720
|
this.persistent = persistent;
|
|
2721
|
+
this.creationTime = creationTime;
|
|
2711
2722
|
|
|
2712
2723
|
// Useful to compare instead of instanceof with minified code
|
|
2713
2724
|
this.type = 'Meeting';
|
|
@@ -2885,6 +2896,10 @@ class ChatMessage {
|
|
|
2885
2896
|
|
|
2886
2897
|
|
|
2887
2898
|
static parseMany(plain ) {
|
|
2899
|
+
if (!plain || !plain.items) {
|
|
2900
|
+
return [];
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2888
2903
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2889
2904
|
}
|
|
2890
2905
|
|
|
@@ -2994,6 +3009,9 @@ class Voicemail {
|
|
|
2994
3009
|
}
|
|
2995
3010
|
|
|
2996
3011
|
static parseMany(plain ) {
|
|
3012
|
+
if (!plain) {
|
|
3013
|
+
return [];
|
|
3014
|
+
}
|
|
2997
3015
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2998
3016
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2999
3017
|
|
|
@@ -3103,6 +3121,9 @@ class Call {
|
|
|
3103
3121
|
|
|
3104
3122
|
|
|
3105
3123
|
static parseMany(plain ) {
|
|
3124
|
+
if (!plain) {
|
|
3125
|
+
return [];
|
|
3126
|
+
}
|
|
3106
3127
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3107
3128
|
}
|
|
3108
3129
|
|
|
@@ -3620,6 +3641,9 @@ class Recording {
|
|
|
3620
3641
|
|
|
3621
3642
|
|
|
3622
3643
|
static parseMany(recordings = []) {
|
|
3644
|
+
if (!recordings) {
|
|
3645
|
+
return [];
|
|
3646
|
+
}
|
|
3623
3647
|
return recordings.map(item => Recording.parse(item));
|
|
3624
3648
|
}
|
|
3625
3649
|
|
|
@@ -3721,6 +3745,10 @@ class CallLog {
|
|
|
3721
3745
|
}
|
|
3722
3746
|
|
|
3723
3747
|
static parseMany(plain ) {
|
|
3748
|
+
if (!plain || !plain.items) {
|
|
3749
|
+
return [];
|
|
3750
|
+
}
|
|
3751
|
+
|
|
3724
3752
|
return plain.items.map(item => CallLog.parse(item));
|
|
3725
3753
|
}
|
|
3726
3754
|
|
|
@@ -4290,6 +4318,10 @@ class CTIPhone extends Emitter {
|
|
|
4290
4318
|
return false;
|
|
4291
4319
|
}
|
|
4292
4320
|
|
|
4321
|
+
hasAVideoTrack() {
|
|
4322
|
+
return false;
|
|
4323
|
+
}
|
|
4324
|
+
|
|
4293
4325
|
getLocalStreamForCall() {
|
|
4294
4326
|
return null;
|
|
4295
4327
|
}
|
|
@@ -4683,6 +4715,9 @@ class ChatRoom {
|
|
|
4683
4715
|
|
|
4684
4716
|
|
|
4685
4717
|
static parseMany(plain ) {
|
|
4718
|
+
if (!plain || !plain.items) {
|
|
4719
|
+
return [];
|
|
4720
|
+
}
|
|
4686
4721
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4687
4722
|
}
|
|
4688
4723
|
|
|
@@ -5928,10 +5963,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5928
5963
|
candidates
|
|
5929
5964
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5930
5965
|
|
|
5931
|
-
const areCandidateValid = (candidates ) =>
|
|
5932
|
-
getSrflxOrRelay(candidates)
|
|
5933
|
-
.length > 0;
|
|
5934
|
-
|
|
5935
5966
|
const getVideoDirection = (sdp ) => {
|
|
5936
5967
|
const parsedSdp = sdpParser.parse(sdp);
|
|
5937
5968
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5984,8 +6015,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5984
6015
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5985
6016
|
|
|
5986
6017
|
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
6018
|
|
|
5990
6019
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5991
6020
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -6175,38 +6204,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6175
6204
|
this._peerConnection = undefined;
|
|
6176
6205
|
}
|
|
6177
6206
|
|
|
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
6207
|
// Overridden to send `inactive` in conference
|
|
6211
6208
|
updateDirection(options , isConference = false,
|
|
6212
6209
|
audioOnly = false) {
|
|
@@ -6974,7 +6971,7 @@ class WebRTCClient extends Emitter {
|
|
|
6974
6971
|
}
|
|
6975
6972
|
|
|
6976
6973
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6977
|
-
logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6974
|
+
logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6978
6975
|
const inviterOptions = {
|
|
6979
6976
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6980
6977
|
conference,
|
|
@@ -8050,6 +8047,7 @@ class WebRTCClient extends Emitter {
|
|
|
8050
8047
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
8051
8048
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8052
8049
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8050
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
8053
8051
|
|
|
8054
8052
|
logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8055
8053
|
|
|
@@ -8057,7 +8055,8 @@ class WebRTCClient extends Emitter {
|
|
|
8057
8055
|
constraints: {
|
|
8058
8056
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
8059
8057
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
8060
|
-
video: screenSharing ? (isDesktop
|
|
8058
|
+
video: screenSharing ? (isDesktop
|
|
8059
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
8061
8060
|
: this._getVideoConstraints(enableVideo),
|
|
8062
8061
|
screen: screenSharing,
|
|
8063
8062
|
desktop: isDesktop,
|
|
@@ -8392,11 +8391,14 @@ class WebRTCClient extends Emitter {
|
|
|
8392
8391
|
|
|
8393
8392
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8394
8393
|
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8394
|
+
if (pc) {
|
|
8395
|
+
pc.oniceconnectionstatechange = () => {
|
|
8396
|
+
logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8397
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8398
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8399
|
+
}
|
|
8400
|
+
};
|
|
8401
|
+
}
|
|
8400
8402
|
|
|
8401
8403
|
if (withEvent) {
|
|
8402
8404
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8606,13 +8608,17 @@ class WebRTCClient extends Emitter {
|
|
|
8606
8608
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8607
8609
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8608
8610
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8611
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8609
8612
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8610
8613
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8614
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8611
8615
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8612
8616
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8613
8617
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8614
|
-
let audioBytesSent = 0;
|
|
8615
|
-
let audioBytesReceived = 0;
|
|
8618
|
+
let audioBytesSent = 0; // content + header
|
|
8619
|
+
let audioBytesReceived = 0; // content + header
|
|
8620
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8621
|
+
let audioContentReceived = 0;
|
|
8616
8622
|
let videoBytesSent = 0;
|
|
8617
8623
|
let videoBytesReceived = 0;
|
|
8618
8624
|
let transportSent = 0;
|
|
@@ -8621,25 +8627,27 @@ class WebRTCClient extends Emitter {
|
|
|
8621
8627
|
|
|
8622
8628
|
stats.forEach(report => {
|
|
8623
8629
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8624
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8630
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8631
|
+
audioContentSent += Number(report.bytesSent);
|
|
8625
8632
|
}
|
|
8626
8633
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8627
|
-
audioBytesSent += report.bytesSent;
|
|
8634
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8628
8635
|
}
|
|
8629
8636
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8630
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8637
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8631
8638
|
}
|
|
8632
8639
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8633
|
-
packetsLost += report.packetsLost;
|
|
8634
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8635
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8640
|
+
packetsLost += Number(report.packetsLost);
|
|
8641
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8642
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8643
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8636
8644
|
}
|
|
8637
8645
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8638
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8646
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8639
8647
|
}
|
|
8640
8648
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8641
8649
|
if ('framesPerSecond' in report) {
|
|
8642
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8650
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8643
8651
|
}
|
|
8644
8652
|
if ('framerateMean' in report) {
|
|
8645
8653
|
// framerateMean is only available in FF
|
|
@@ -8647,24 +8655,31 @@ class WebRTCClient extends Emitter {
|
|
|
8647
8655
|
}
|
|
8648
8656
|
}
|
|
8649
8657
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8650
|
-
packetsLost += report.packetsLost;
|
|
8651
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8652
|
-
networkStats.jitter = report.jitter;
|
|
8658
|
+
packetsLost += Number(report.packetsLost);
|
|
8659
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8660
|
+
networkStats.jitter = Number(report.jitter);
|
|
8653
8661
|
}
|
|
8654
8662
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8655
|
-
packetsLost += report.packetsLost;
|
|
8663
|
+
packetsLost += Number(report.packetsLost);
|
|
8656
8664
|
}
|
|
8657
8665
|
if (report.type === 'transport') {
|
|
8658
|
-
transportSent += report.bytesSent;
|
|
8659
|
-
transportReceived += report.bytesReceived;
|
|
8666
|
+
transportSent += Number(report.bytesSent);
|
|
8667
|
+
transportReceived += Number(report.bytesReceived);
|
|
8660
8668
|
}
|
|
8661
8669
|
});
|
|
8662
8670
|
|
|
8663
8671
|
networkStats.packetsLost = packetsLost;
|
|
8672
|
+
|
|
8664
8673
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8665
8674
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8666
8675
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8667
8676
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8677
|
+
|
|
8678
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8679
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8680
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8681
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8682
|
+
|
|
8668
8683
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8669
8684
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8670
8685
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8876,6 +8891,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8876
8891
|
constraints,
|
|
8877
8892
|
audioOnly,
|
|
8878
8893
|
conference,
|
|
8894
|
+
iceRestart,
|
|
8879
8895
|
});
|
|
8880
8896
|
|
|
8881
8897
|
if (!sipSession) {
|
|
@@ -8979,6 +8995,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8979
8995
|
|
|
8980
8996
|
this.client.downgradeToAudio(sipSession);
|
|
8981
8997
|
|
|
8998
|
+
if (callSession) {
|
|
8999
|
+
callSession.cameraEnabled = false;
|
|
9000
|
+
this._updateCallSession(callSession);
|
|
9001
|
+
}
|
|
9002
|
+
|
|
8982
9003
|
if (withMessage) {
|
|
8983
9004
|
this._sendReinviteMessage(callSession, false);
|
|
8984
9005
|
}
|
|
@@ -9006,6 +9027,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9006
9027
|
|
|
9007
9028
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
9008
9029
|
|
|
9030
|
+
if (callSession) {
|
|
9031
|
+
callSession.cameraEnabled = true;
|
|
9032
|
+
this._updateCallSession(callSession);
|
|
9033
|
+
}
|
|
9034
|
+
|
|
9009
9035
|
// If no stream is returned, it means we have to reinvite
|
|
9010
9036
|
if (!newStream) {
|
|
9011
9037
|
return true;
|
|
@@ -9058,7 +9084,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9058
9084
|
|
|
9059
9085
|
onCancel(message);
|
|
9060
9086
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
9061
|
-
|
|
9087
|
+
const callSession = this._createCallSession(sipSession);
|
|
9088
|
+
delete this.callSessions[callSession.getId()];
|
|
9089
|
+
|
|
9090
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
9062
9091
|
};
|
|
9063
9092
|
} else if (sipSession instanceof Invitation) {
|
|
9064
9093
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -9239,18 +9268,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9239
9268
|
screenTrack,
|
|
9240
9269
|
});
|
|
9241
9270
|
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9271
|
+
if (screenTrack) {
|
|
9272
|
+
screenTrack.onended = () => {
|
|
9273
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9274
|
+
hadVideo,
|
|
9275
|
+
id: this.getSipSessionId(sipSession),
|
|
9276
|
+
screenTrack,
|
|
9277
|
+
});
|
|
9248
9278
|
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9279
|
+
this.eventEmitter.emit(
|
|
9280
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9281
|
+
this._createCallSession(sipSession, callSession),
|
|
9282
|
+
);
|
|
9283
|
+
};
|
|
9284
|
+
}
|
|
9254
9285
|
|
|
9255
9286
|
this.currentScreenShare = {
|
|
9256
9287
|
stream: screenStream,
|
|
@@ -9270,7 +9301,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9270
9301
|
}
|
|
9271
9302
|
|
|
9272
9303
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9273
|
-
logger$7.info('WebRTC phone -
|
|
9304
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9274
9305
|
|
|
9275
9306
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9276
9307
|
this.currentSipSession = sipSession;
|
|
@@ -9782,7 +9813,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9782
9813
|
// @TODO: line is not used here
|
|
9783
9814
|
async makeCall(number , line , cameraEnabled ,
|
|
9784
9815
|
audioOnly = false, conference = false) {
|
|
9785
|
-
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
|
|
9816
|
+
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9786
9817
|
if (!number) {
|
|
9787
9818
|
return Promise.resolve(null);
|
|
9788
9819
|
}
|
|
@@ -10143,9 +10174,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10143
10174
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
10144
10175
|
&& this.currentSipSession.state === SessionState.Established) {
|
|
10145
10176
|
this.shouldSendReinvite = false;
|
|
10177
|
+
const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
10178
|
+
const isConference = pc ? pc.sfu : false;
|
|
10179
|
+
const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
|
|
10180
|
+
|
|
10146
10181
|
try {
|
|
10147
10182
|
// Send reinvite with iceRestart
|
|
10148
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
10183
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10149
10184
|
} catch (e) {
|
|
10150
10185
|
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10151
10186
|
}
|
|
@@ -10229,6 +10264,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10229
10264
|
return this.client.getSipSessionId(sipSession);
|
|
10230
10265
|
}
|
|
10231
10266
|
|
|
10267
|
+
_updateCallSession(callSession ) {
|
|
10268
|
+
const sipSession = this.findSipSession(callSession);
|
|
10269
|
+
const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
|
|
10270
|
+
|
|
10271
|
+
if (sipSessionId) {
|
|
10272
|
+
this.callSessions[sipSessionId] = callSession;
|
|
10273
|
+
}
|
|
10274
|
+
}
|
|
10275
|
+
|
|
10232
10276
|
_onMessage(message ) {
|
|
10233
10277
|
if (!message || message.method !== 'MESSAGE') {
|
|
10234
10278
|
return;
|