@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
package/lib/simple/room/Room.js
CHANGED
|
@@ -1562,6 +1562,9 @@ class Contact {
|
|
|
1562
1562
|
}
|
|
1563
1563
|
|
|
1564
1564
|
static parseMany(response ) {
|
|
1565
|
+
if (!response || !response.results) {
|
|
1566
|
+
return [];
|
|
1567
|
+
}
|
|
1565
1568
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1566
1569
|
}
|
|
1567
1570
|
|
|
@@ -2639,8 +2642,9 @@ class ExternalApp {
|
|
|
2639
2642
|
|
|
2640
2643
|
|
|
2641
2644
|
|
|
2642
|
-
|
|
2645
|
+
|
|
2643
2646
|
|
|
2647
|
+
|
|
2644
2648
|
|
|
2645
2649
|
|
|
2646
2650
|
class Meeting {
|
|
@@ -2651,9 +2655,10 @@ class Meeting {
|
|
|
2651
2655
|
|
|
2652
2656
|
|
|
2653
2657
|
|
|
2654
|
-
|
|
2658
|
+
|
|
2655
2659
|
|
|
2656
2660
|
|
|
2661
|
+
|
|
2657
2662
|
|
|
2658
2663
|
static parse(plain ) {
|
|
2659
2664
|
return new Meeting({
|
|
@@ -2663,12 +2668,16 @@ class Meeting {
|
|
|
2663
2668
|
ownerUuids: plain.owner_uuids,
|
|
2664
2669
|
port: plain.port,
|
|
2665
2670
|
uuid: plain.uuid,
|
|
2666
|
-
|
|
2671
|
+
extension: plain.exten,
|
|
2667
2672
|
persistent: plain.persistent,
|
|
2673
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2668
2674
|
});
|
|
2669
2675
|
}
|
|
2670
2676
|
|
|
2671
2677
|
static parseMany(items ) {
|
|
2678
|
+
if (!items) {
|
|
2679
|
+
return [];
|
|
2680
|
+
}
|
|
2672
2681
|
return items.map(plain => Meeting.parse(plain));
|
|
2673
2682
|
}
|
|
2674
2683
|
|
|
@@ -2683,8 +2692,9 @@ class Meeting {
|
|
|
2683
2692
|
ownerUuids,
|
|
2684
2693
|
port,
|
|
2685
2694
|
uri,
|
|
2686
|
-
|
|
2695
|
+
extension,
|
|
2687
2696
|
persistent,
|
|
2697
|
+
creationTime,
|
|
2688
2698
|
} = {}) {
|
|
2689
2699
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2690
2700
|
this.uri = uri;
|
|
@@ -2692,8 +2702,9 @@ class Meeting {
|
|
|
2692
2702
|
this.ownerUuids = ownerUuids;
|
|
2693
2703
|
this.port = port;
|
|
2694
2704
|
this.uuid = uuid;
|
|
2695
|
-
this.
|
|
2705
|
+
this.extension = extension;
|
|
2696
2706
|
this.persistent = persistent;
|
|
2707
|
+
this.creationTime = creationTime;
|
|
2697
2708
|
|
|
2698
2709
|
// Useful to compare instead of instanceof with minified code
|
|
2699
2710
|
this.type = 'Meeting';
|
|
@@ -2871,6 +2882,10 @@ class ChatMessage {
|
|
|
2871
2882
|
|
|
2872
2883
|
|
|
2873
2884
|
static parseMany(plain ) {
|
|
2885
|
+
if (!plain || !plain.items) {
|
|
2886
|
+
return [];
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2874
2889
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2875
2890
|
}
|
|
2876
2891
|
|
|
@@ -2980,6 +2995,9 @@ class Voicemail {
|
|
|
2980
2995
|
}
|
|
2981
2996
|
|
|
2982
2997
|
static parseMany(plain ) {
|
|
2998
|
+
if (!plain) {
|
|
2999
|
+
return [];
|
|
3000
|
+
}
|
|
2983
3001
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2984
3002
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2985
3003
|
|
|
@@ -3089,6 +3107,9 @@ class Call {
|
|
|
3089
3107
|
|
|
3090
3108
|
|
|
3091
3109
|
static parseMany(plain ) {
|
|
3110
|
+
if (!plain) {
|
|
3111
|
+
return [];
|
|
3112
|
+
}
|
|
3092
3113
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3093
3114
|
}
|
|
3094
3115
|
|
|
@@ -3632,6 +3653,9 @@ class Recording {
|
|
|
3632
3653
|
|
|
3633
3654
|
|
|
3634
3655
|
static parseMany(recordings = []) {
|
|
3656
|
+
if (!recordings) {
|
|
3657
|
+
return [];
|
|
3658
|
+
}
|
|
3635
3659
|
return recordings.map(item => Recording.parse(item));
|
|
3636
3660
|
}
|
|
3637
3661
|
|
|
@@ -3733,6 +3757,10 @@ class CallLog {
|
|
|
3733
3757
|
}
|
|
3734
3758
|
|
|
3735
3759
|
static parseMany(plain ) {
|
|
3760
|
+
if (!plain || !plain.items) {
|
|
3761
|
+
return [];
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3736
3764
|
return plain.items.map(item => CallLog.parse(item));
|
|
3737
3765
|
}
|
|
3738
3766
|
|
|
@@ -4302,6 +4330,10 @@ class CTIPhone extends Emitter {
|
|
|
4302
4330
|
return false;
|
|
4303
4331
|
}
|
|
4304
4332
|
|
|
4333
|
+
hasAVideoTrack() {
|
|
4334
|
+
return false;
|
|
4335
|
+
}
|
|
4336
|
+
|
|
4305
4337
|
getLocalStreamForCall() {
|
|
4306
4338
|
return null;
|
|
4307
4339
|
}
|
|
@@ -4695,6 +4727,9 @@ class ChatRoom {
|
|
|
4695
4727
|
|
|
4696
4728
|
|
|
4697
4729
|
static parseMany(plain ) {
|
|
4730
|
+
if (!plain || !plain.items) {
|
|
4731
|
+
return [];
|
|
4732
|
+
}
|
|
4698
4733
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4699
4734
|
}
|
|
4700
4735
|
|
|
@@ -5940,10 +5975,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5940
5975
|
candidates
|
|
5941
5976
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5942
5977
|
|
|
5943
|
-
const areCandidateValid = (candidates ) =>
|
|
5944
|
-
getSrflxOrRelay(candidates)
|
|
5945
|
-
.length > 0;
|
|
5946
|
-
|
|
5947
5978
|
const getVideoDirection = (sdp ) => {
|
|
5948
5979
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5949
5980
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5996,8 +6027,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5996
6027
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5997
6028
|
|
|
5998
6029
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5999
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
6000
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
6001
6030
|
|
|
6002
6031
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
6003
6032
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -6187,38 +6216,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6187
6216
|
this._peerConnection = undefined;
|
|
6188
6217
|
}
|
|
6189
6218
|
|
|
6190
|
-
async _waitForValidGatheredIce() {
|
|
6191
|
-
let tries = 0;
|
|
6192
|
-
|
|
6193
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
6194
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
6195
|
-
tries,
|
|
6196
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
6197
|
-
});
|
|
6198
|
-
|
|
6199
|
-
tries++;
|
|
6200
|
-
|
|
6201
|
-
// eslint-disable-next-line no-await-in-loop
|
|
6202
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
6203
|
-
}
|
|
6204
|
-
|
|
6205
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
6206
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
6207
|
-
const error = new Error(errorMsg);
|
|
6208
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
6209
|
-
|
|
6210
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
6211
|
-
this.eventEmitter.emit('error', error);
|
|
6212
|
-
|
|
6213
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6214
|
-
}
|
|
6215
|
-
|
|
6216
|
-
// eslint-disable-next-line
|
|
6217
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6218
|
-
|
|
6219
|
-
return this.getLocalSessionDescription();
|
|
6220
|
-
}
|
|
6221
|
-
|
|
6222
6219
|
// Overridden to send `inactive` in conference
|
|
6223
6220
|
updateDirection(options , isConference = false,
|
|
6224
6221
|
audioOnly = false) {
|
|
@@ -6986,7 +6983,7 @@ class WebRTCClient extends Emitter {
|
|
|
6986
6983
|
}
|
|
6987
6984
|
|
|
6988
6985
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6989
|
-
logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6986
|
+
logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6990
6987
|
const inviterOptions = {
|
|
6991
6988
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6992
6989
|
conference,
|
|
@@ -8062,6 +8059,7 @@ class WebRTCClient extends Emitter {
|
|
|
8062
8059
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
8063
8060
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8064
8061
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8062
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
8065
8063
|
|
|
8066
8064
|
logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8067
8065
|
|
|
@@ -8069,7 +8067,8 @@ class WebRTCClient extends Emitter {
|
|
|
8069
8067
|
constraints: {
|
|
8070
8068
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
8071
8069
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
8072
|
-
video: screenSharing ? (isDesktop
|
|
8070
|
+
video: screenSharing ? (isDesktop
|
|
8071
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
8073
8072
|
: this._getVideoConstraints(enableVideo),
|
|
8074
8073
|
screen: screenSharing,
|
|
8075
8074
|
desktop: isDesktop,
|
|
@@ -8404,11 +8403,14 @@ class WebRTCClient extends Emitter {
|
|
|
8404
8403
|
|
|
8405
8404
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8406
8405
|
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8406
|
+
if (pc) {
|
|
8407
|
+
pc.oniceconnectionstatechange = () => {
|
|
8408
|
+
logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8409
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8410
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8411
|
+
}
|
|
8412
|
+
};
|
|
8413
|
+
}
|
|
8412
8414
|
|
|
8413
8415
|
if (withEvent) {
|
|
8414
8416
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8618,13 +8620,17 @@ class WebRTCClient extends Emitter {
|
|
|
8618
8620
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8619
8621
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8620
8622
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8623
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8621
8624
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8622
8625
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8626
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8623
8627
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8624
8628
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8625
8629
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8626
|
-
let audioBytesSent = 0;
|
|
8627
|
-
let audioBytesReceived = 0;
|
|
8630
|
+
let audioBytesSent = 0; // content + header
|
|
8631
|
+
let audioBytesReceived = 0; // content + header
|
|
8632
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8633
|
+
let audioContentReceived = 0;
|
|
8628
8634
|
let videoBytesSent = 0;
|
|
8629
8635
|
let videoBytesReceived = 0;
|
|
8630
8636
|
let transportSent = 0;
|
|
@@ -8633,25 +8639,27 @@ class WebRTCClient extends Emitter {
|
|
|
8633
8639
|
|
|
8634
8640
|
stats.forEach(report => {
|
|
8635
8641
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8636
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8642
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8643
|
+
audioContentSent += Number(report.bytesSent);
|
|
8637
8644
|
}
|
|
8638
8645
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8639
|
-
audioBytesSent += report.bytesSent;
|
|
8646
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8640
8647
|
}
|
|
8641
8648
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8642
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8649
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8643
8650
|
}
|
|
8644
8651
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8645
|
-
packetsLost += report.packetsLost;
|
|
8646
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8647
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8652
|
+
packetsLost += Number(report.packetsLost);
|
|
8653
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8654
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8655
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8648
8656
|
}
|
|
8649
8657
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8650
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8658
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8651
8659
|
}
|
|
8652
8660
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8653
8661
|
if ('framesPerSecond' in report) {
|
|
8654
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8662
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8655
8663
|
}
|
|
8656
8664
|
if ('framerateMean' in report) {
|
|
8657
8665
|
// framerateMean is only available in FF
|
|
@@ -8659,24 +8667,31 @@ class WebRTCClient extends Emitter {
|
|
|
8659
8667
|
}
|
|
8660
8668
|
}
|
|
8661
8669
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8662
|
-
packetsLost += report.packetsLost;
|
|
8663
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8664
|
-
networkStats.jitter = report.jitter;
|
|
8670
|
+
packetsLost += Number(report.packetsLost);
|
|
8671
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8672
|
+
networkStats.jitter = Number(report.jitter);
|
|
8665
8673
|
}
|
|
8666
8674
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8667
|
-
packetsLost += report.packetsLost;
|
|
8675
|
+
packetsLost += Number(report.packetsLost);
|
|
8668
8676
|
}
|
|
8669
8677
|
if (report.type === 'transport') {
|
|
8670
|
-
transportSent += report.bytesSent;
|
|
8671
|
-
transportReceived += report.bytesReceived;
|
|
8678
|
+
transportSent += Number(report.bytesSent);
|
|
8679
|
+
transportReceived += Number(report.bytesReceived);
|
|
8672
8680
|
}
|
|
8673
8681
|
});
|
|
8674
8682
|
|
|
8675
8683
|
networkStats.packetsLost = packetsLost;
|
|
8684
|
+
|
|
8676
8685
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8677
8686
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8678
8687
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8679
8688
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8689
|
+
|
|
8690
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8691
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8692
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8693
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8694
|
+
|
|
8680
8695
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8681
8696
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8682
8697
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8888,6 +8903,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8888
8903
|
constraints,
|
|
8889
8904
|
audioOnly,
|
|
8890
8905
|
conference,
|
|
8906
|
+
iceRestart,
|
|
8891
8907
|
});
|
|
8892
8908
|
|
|
8893
8909
|
if (!sipSession) {
|
|
@@ -8991,6 +9007,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8991
9007
|
|
|
8992
9008
|
this.client.downgradeToAudio(sipSession);
|
|
8993
9009
|
|
|
9010
|
+
if (callSession) {
|
|
9011
|
+
callSession.cameraEnabled = false;
|
|
9012
|
+
this._updateCallSession(callSession);
|
|
9013
|
+
}
|
|
9014
|
+
|
|
8994
9015
|
if (withMessage) {
|
|
8995
9016
|
this._sendReinviteMessage(callSession, false);
|
|
8996
9017
|
}
|
|
@@ -9018,6 +9039,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9018
9039
|
|
|
9019
9040
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
9020
9041
|
|
|
9042
|
+
if (callSession) {
|
|
9043
|
+
callSession.cameraEnabled = true;
|
|
9044
|
+
this._updateCallSession(callSession);
|
|
9045
|
+
}
|
|
9046
|
+
|
|
9021
9047
|
// If no stream is returned, it means we have to reinvite
|
|
9022
9048
|
if (!newStream) {
|
|
9023
9049
|
return true;
|
|
@@ -9070,7 +9096,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9070
9096
|
|
|
9071
9097
|
onCancel(message);
|
|
9072
9098
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
9073
|
-
|
|
9099
|
+
const callSession = this._createCallSession(sipSession);
|
|
9100
|
+
delete this.callSessions[callSession.getId()];
|
|
9101
|
+
|
|
9102
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
9074
9103
|
};
|
|
9075
9104
|
} else if (sipSession instanceof invitation.Invitation) {
|
|
9076
9105
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -9251,18 +9280,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9251
9280
|
screenTrack,
|
|
9252
9281
|
});
|
|
9253
9282
|
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9283
|
+
if (screenTrack) {
|
|
9284
|
+
screenTrack.onended = () => {
|
|
9285
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9286
|
+
hadVideo,
|
|
9287
|
+
id: this.getSipSessionId(sipSession),
|
|
9288
|
+
screenTrack,
|
|
9289
|
+
});
|
|
9260
9290
|
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9291
|
+
this.eventEmitter.emit(
|
|
9292
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9293
|
+
this._createCallSession(sipSession, callSession),
|
|
9294
|
+
);
|
|
9295
|
+
};
|
|
9296
|
+
}
|
|
9266
9297
|
|
|
9267
9298
|
this.currentScreenShare = {
|
|
9268
9299
|
stream: screenStream,
|
|
@@ -9282,7 +9313,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9282
9313
|
}
|
|
9283
9314
|
|
|
9284
9315
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9285
|
-
logger$7.info('WebRTC phone -
|
|
9316
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9286
9317
|
|
|
9287
9318
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9288
9319
|
this.currentSipSession = sipSession;
|
|
@@ -9794,7 +9825,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9794
9825
|
// @TODO: line is not used here
|
|
9795
9826
|
async makeCall(number , line , cameraEnabled ,
|
|
9796
9827
|
audioOnly = false, conference = false) {
|
|
9797
|
-
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
|
|
9828
|
+
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9798
9829
|
if (!number) {
|
|
9799
9830
|
return Promise.resolve(null);
|
|
9800
9831
|
}
|
|
@@ -10155,9 +10186,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10155
10186
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
10156
10187
|
&& this.currentSipSession.state === sessionState.SessionState.Established) {
|
|
10157
10188
|
this.shouldSendReinvite = false;
|
|
10189
|
+
const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
10190
|
+
const isConference = pc ? pc.sfu : false;
|
|
10191
|
+
const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
|
|
10192
|
+
|
|
10158
10193
|
try {
|
|
10159
10194
|
// Send reinvite with iceRestart
|
|
10160
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
10195
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10161
10196
|
} catch (e) {
|
|
10162
10197
|
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10163
10198
|
}
|
|
@@ -10241,6 +10276,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10241
10276
|
return this.client.getSipSessionId(sipSession);
|
|
10242
10277
|
}
|
|
10243
10278
|
|
|
10279
|
+
_updateCallSession(callSession ) {
|
|
10280
|
+
const sipSession = this.findSipSession(callSession);
|
|
10281
|
+
const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
|
|
10282
|
+
|
|
10283
|
+
if (sipSessionId) {
|
|
10284
|
+
this.callSessions[sipSessionId] = callSession;
|
|
10285
|
+
}
|
|
10286
|
+
}
|
|
10287
|
+
|
|
10244
10288
|
_onMessage(message ) {
|
|
10245
10289
|
if (!message || message.method !== 'MESSAGE') {
|
|
10246
10290
|
return;
|