@wazo/sdk 0.37.22 → 0.37.26
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 +37 -6
- package/esm/__tests__/web-rtc-client.test.js +78 -68
- 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 +4 -1
- package/esm/api-client.js +37 -6
- package/esm/checker/Checker.js +78 -68
- package/esm/checker/checks/aor.js +37 -6
- package/esm/checker/checks/api.js +37 -6
- package/esm/checker/checks/index.js +78 -68
- package/esm/checker/checks/webrtc-transport.js +78 -68
- package/esm/checker/checks/webrtc.js +78 -68
- package/esm/domain/AdHocAPIConference.js +37 -6
- 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 +4 -1
- package/esm/domain/Features.js +37 -6
- package/esm/domain/Meeting.js +15 -5
- package/esm/domain/Phone/CTIPhone.js +41 -6
- package/esm/domain/Phone/WebRTCPhone.js +41 -15
- 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 +4 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +122 -82
- package/esm/lib/WazoSessionDescriptionHandler.js +0 -38
- package/esm/service/CallApi.js +37 -6
- package/esm/service/getApiClient.js +37 -6
- package/esm/simple/Auth.js +122 -82
- package/esm/simple/Configuration.js +122 -82
- package/esm/simple/Directory.js +37 -6
- package/esm/simple/Phone.js +122 -82
- package/esm/simple/index.js +122 -82
- package/esm/simple/room/LocalParticipant.js +122 -82
- package/esm/simple/room/Participant.js +122 -82
- package/esm/simple/room/RemoteParticipant.js +122 -82
- package/esm/simple/room/Room.js +122 -82
- package/esm/simple/room/SipRoom.js +122 -82
- package/esm/simple/room/Stream.js +122 -82
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +122 -82
- package/esm/simple/utils.js +122 -82
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +78 -68
- package/lib/__tests__/api-client.test.js +37 -6
- package/lib/__tests__/web-rtc-client.test.js +78 -68
- 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 +4 -1
- package/lib/api-client.js +37 -6
- package/lib/checker/Checker.js +78 -68
- package/lib/checker/checks/aor.js +37 -6
- package/lib/checker/checks/api.js +37 -6
- package/lib/checker/checks/index.js +78 -68
- package/lib/checker/checks/webrtc-transport.js +78 -68
- package/lib/checker/checks/webrtc.js +78 -68
- package/lib/domain/AdHocAPIConference.js +37 -6
- 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 +4 -1
- package/lib/domain/Features.js +37 -6
- package/lib/domain/Meeting.js +19 -5
- package/lib/domain/Phone/CTIPhone.js +41 -6
- package/lib/domain/Phone/WebRTCPhone.js +41 -15
- 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 +4 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +122 -82
- package/lib/lib/WazoSessionDescriptionHandler.js +0 -38
- package/lib/service/CallApi.js +37 -6
- package/lib/service/getApiClient.js +37 -6
- package/lib/simple/Auth.js +122 -82
- package/lib/simple/Configuration.js +122 -82
- package/lib/simple/Directory.js +37 -6
- package/lib/simple/Phone.js +122 -82
- package/lib/simple/index.js +122 -82
- package/lib/simple/room/LocalParticipant.js +122 -82
- package/lib/simple/room/Participant.js +122 -82
- package/lib/simple/room/RemoteParticipant.js +122 -82
- package/lib/simple/room/Room.js +122 -82
- package/lib/simple/room/SipRoom.js +122 -82
- package/lib/simple/room/Stream.js +122 -82
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +122 -82
- package/lib/simple/utils.js +122 -82
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +78 -68
- 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 +4 -1
- 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 +41 -15
- 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 -24
package/lib/simple/index.js
CHANGED
|
@@ -873,6 +873,9 @@ class Contact {
|
|
|
873
873
|
}
|
|
874
874
|
|
|
875
875
|
static parseMany(response ) {
|
|
876
|
+
if (!response || !response.results) {
|
|
877
|
+
return [];
|
|
878
|
+
}
|
|
876
879
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
877
880
|
}
|
|
878
881
|
|
|
@@ -1243,7 +1246,7 @@ class Contact {
|
|
|
1243
1246
|
this[key] = old[key] || this[key];
|
|
1244
1247
|
});
|
|
1245
1248
|
|
|
1246
|
-
if (old.lineState
|
|
1249
|
+
if (old.lineState) {
|
|
1247
1250
|
this.lineState = old.lineState;
|
|
1248
1251
|
}
|
|
1249
1252
|
|
|
@@ -2637,8 +2640,9 @@ class ExternalApp {
|
|
|
2637
2640
|
|
|
2638
2641
|
|
|
2639
2642
|
|
|
2640
|
-
|
|
2643
|
+
|
|
2641
2644
|
|
|
2645
|
+
|
|
2642
2646
|
|
|
2643
2647
|
|
|
2644
2648
|
class Meeting {
|
|
@@ -2649,9 +2653,10 @@ class Meeting {
|
|
|
2649
2653
|
|
|
2650
2654
|
|
|
2651
2655
|
|
|
2652
|
-
|
|
2656
|
+
|
|
2653
2657
|
|
|
2654
2658
|
|
|
2659
|
+
|
|
2655
2660
|
|
|
2656
2661
|
static parse(plain ) {
|
|
2657
2662
|
return new Meeting({
|
|
@@ -2661,12 +2666,16 @@ class Meeting {
|
|
|
2661
2666
|
ownerUuids: plain.owner_uuids,
|
|
2662
2667
|
port: plain.port,
|
|
2663
2668
|
uuid: plain.uuid,
|
|
2664
|
-
|
|
2669
|
+
extension: plain.exten,
|
|
2665
2670
|
persistent: plain.persistent,
|
|
2671
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2666
2672
|
});
|
|
2667
2673
|
}
|
|
2668
2674
|
|
|
2669
2675
|
static parseMany(items ) {
|
|
2676
|
+
if (!items) {
|
|
2677
|
+
return [];
|
|
2678
|
+
}
|
|
2670
2679
|
return items.map(plain => Meeting.parse(plain));
|
|
2671
2680
|
}
|
|
2672
2681
|
|
|
@@ -2681,8 +2690,9 @@ class Meeting {
|
|
|
2681
2690
|
ownerUuids,
|
|
2682
2691
|
port,
|
|
2683
2692
|
uri,
|
|
2684
|
-
|
|
2693
|
+
extension,
|
|
2685
2694
|
persistent,
|
|
2695
|
+
creationTime,
|
|
2686
2696
|
} = {}) {
|
|
2687
2697
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2688
2698
|
this.uri = uri;
|
|
@@ -2690,8 +2700,9 @@ class Meeting {
|
|
|
2690
2700
|
this.ownerUuids = ownerUuids;
|
|
2691
2701
|
this.port = port;
|
|
2692
2702
|
this.uuid = uuid;
|
|
2693
|
-
this.
|
|
2703
|
+
this.extension = extension;
|
|
2694
2704
|
this.persistent = persistent;
|
|
2705
|
+
this.creationTime = creationTime;
|
|
2695
2706
|
|
|
2696
2707
|
// Useful to compare instead of instanceof with minified code
|
|
2697
2708
|
this.type = 'Meeting';
|
|
@@ -2869,6 +2880,10 @@ class ChatMessage {
|
|
|
2869
2880
|
|
|
2870
2881
|
|
|
2871
2882
|
static parseMany(plain ) {
|
|
2883
|
+
if (!plain || !plain.items) {
|
|
2884
|
+
return [];
|
|
2885
|
+
}
|
|
2886
|
+
|
|
2872
2887
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2873
2888
|
}
|
|
2874
2889
|
|
|
@@ -2978,6 +2993,9 @@ class Voicemail {
|
|
|
2978
2993
|
}
|
|
2979
2994
|
|
|
2980
2995
|
static parseMany(plain ) {
|
|
2996
|
+
if (!plain) {
|
|
2997
|
+
return [];
|
|
2998
|
+
}
|
|
2981
2999
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2982
3000
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2983
3001
|
|
|
@@ -3087,6 +3105,9 @@ class Call {
|
|
|
3087
3105
|
|
|
3088
3106
|
|
|
3089
3107
|
static parseMany(plain ) {
|
|
3108
|
+
if (!plain) {
|
|
3109
|
+
return [];
|
|
3110
|
+
}
|
|
3090
3111
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3091
3112
|
}
|
|
3092
3113
|
|
|
@@ -3630,6 +3651,9 @@ class Recording {
|
|
|
3630
3651
|
|
|
3631
3652
|
|
|
3632
3653
|
static parseMany(recordings = []) {
|
|
3654
|
+
if (!recordings) {
|
|
3655
|
+
return [];
|
|
3656
|
+
}
|
|
3633
3657
|
return recordings.map(item => Recording.parse(item));
|
|
3634
3658
|
}
|
|
3635
3659
|
|
|
@@ -3731,6 +3755,10 @@ class CallLog {
|
|
|
3731
3755
|
}
|
|
3732
3756
|
|
|
3733
3757
|
static parseMany(plain ) {
|
|
3758
|
+
if (!plain || !plain.items) {
|
|
3759
|
+
return [];
|
|
3760
|
+
}
|
|
3761
|
+
|
|
3734
3762
|
return plain.items.map(item => CallLog.parse(item));
|
|
3735
3763
|
}
|
|
3736
3764
|
|
|
@@ -4300,6 +4328,10 @@ class CTIPhone extends Emitter {
|
|
|
4300
4328
|
return false;
|
|
4301
4329
|
}
|
|
4302
4330
|
|
|
4331
|
+
hasAVideoTrack() {
|
|
4332
|
+
return false;
|
|
4333
|
+
}
|
|
4334
|
+
|
|
4303
4335
|
getLocalStreamForCall() {
|
|
4304
4336
|
return null;
|
|
4305
4337
|
}
|
|
@@ -4693,6 +4725,9 @@ class ChatRoom {
|
|
|
4693
4725
|
|
|
4694
4726
|
|
|
4695
4727
|
static parseMany(plain ) {
|
|
4728
|
+
if (!plain || !plain.items) {
|
|
4729
|
+
return [];
|
|
4730
|
+
}
|
|
4696
4731
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4697
4732
|
}
|
|
4698
4733
|
|
|
@@ -5938,10 +5973,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5938
5973
|
candidates
|
|
5939
5974
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5940
5975
|
|
|
5941
|
-
const areCandidateValid = (candidates ) =>
|
|
5942
|
-
getSrflxOrRelay(candidates)
|
|
5943
|
-
.length > 0;
|
|
5944
|
-
|
|
5945
5976
|
const getVideoDirection = (sdp ) => {
|
|
5946
5977
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5947
5978
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5994,8 +6025,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5994
6025
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5995
6026
|
|
|
5996
6027
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5997
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5998
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5999
6028
|
|
|
6000
6029
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
6001
6030
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -6185,38 +6214,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6185
6214
|
this._peerConnection = undefined;
|
|
6186
6215
|
}
|
|
6187
6216
|
|
|
6188
|
-
async _waitForValidGatheredIce() {
|
|
6189
|
-
let tries = 0;
|
|
6190
|
-
|
|
6191
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
6192
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
6193
|
-
tries,
|
|
6194
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
6195
|
-
});
|
|
6196
|
-
|
|
6197
|
-
tries++;
|
|
6198
|
-
|
|
6199
|
-
// eslint-disable-next-line no-await-in-loop
|
|
6200
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
6201
|
-
}
|
|
6202
|
-
|
|
6203
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
6204
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
6205
|
-
const error = new Error(errorMsg);
|
|
6206
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
6207
|
-
|
|
6208
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
6209
|
-
this.eventEmitter.emit('error', error);
|
|
6210
|
-
|
|
6211
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6212
|
-
}
|
|
6213
|
-
|
|
6214
|
-
// eslint-disable-next-line
|
|
6215
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6216
|
-
|
|
6217
|
-
return this.getLocalSessionDescription();
|
|
6218
|
-
}
|
|
6219
|
-
|
|
6220
6217
|
// Overridden to send `inactive` in conference
|
|
6221
6218
|
updateDirection(options , isConference = false,
|
|
6222
6219
|
audioOnly = false) {
|
|
@@ -6984,7 +6981,7 @@ class WebRTCClient extends Emitter {
|
|
|
6984
6981
|
}
|
|
6985
6982
|
|
|
6986
6983
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6987
|
-
logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6984
|
+
logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6988
6985
|
const inviterOptions = {
|
|
6989
6986
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6990
6987
|
conference,
|
|
@@ -8060,6 +8057,7 @@ class WebRTCClient extends Emitter {
|
|
|
8060
8057
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
8061
8058
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8062
8059
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8060
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
8063
8061
|
|
|
8064
8062
|
logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8065
8063
|
|
|
@@ -8067,7 +8065,8 @@ class WebRTCClient extends Emitter {
|
|
|
8067
8065
|
constraints: {
|
|
8068
8066
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
8069
8067
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
8070
|
-
video: screenSharing ? (isDesktop
|
|
8068
|
+
video: screenSharing ? (isDesktop
|
|
8069
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
8071
8070
|
: this._getVideoConstraints(enableVideo),
|
|
8072
8071
|
screen: screenSharing,
|
|
8073
8072
|
desktop: isDesktop,
|
|
@@ -8402,12 +8401,14 @@ class WebRTCClient extends Emitter {
|
|
|
8402
8401
|
|
|
8403
8402
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8404
8403
|
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8404
|
+
if (pc) {
|
|
8405
|
+
pc.oniceconnectionstatechange = () => {
|
|
8406
|
+
logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8407
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8408
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8409
|
+
}
|
|
8410
|
+
};
|
|
8411
|
+
}
|
|
8411
8412
|
|
|
8412
8413
|
if (withEvent) {
|
|
8413
8414
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8617,13 +8618,17 @@ class WebRTCClient extends Emitter {
|
|
|
8617
8618
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8618
8619
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8619
8620
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8621
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8620
8622
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8621
8623
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8624
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8622
8625
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8623
8626
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8624
8627
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8625
|
-
let audioBytesSent = 0;
|
|
8626
|
-
let audioBytesReceived = 0;
|
|
8628
|
+
let audioBytesSent = 0; // content + header
|
|
8629
|
+
let audioBytesReceived = 0; // content + header
|
|
8630
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8631
|
+
let audioContentReceived = 0;
|
|
8627
8632
|
let videoBytesSent = 0;
|
|
8628
8633
|
let videoBytesReceived = 0;
|
|
8629
8634
|
let transportSent = 0;
|
|
@@ -8632,25 +8637,27 @@ class WebRTCClient extends Emitter {
|
|
|
8632
8637
|
|
|
8633
8638
|
stats.forEach(report => {
|
|
8634
8639
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8635
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8640
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8641
|
+
audioContentSent += Number(report.bytesSent);
|
|
8636
8642
|
}
|
|
8637
8643
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8638
|
-
audioBytesSent += report.bytesSent;
|
|
8644
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8639
8645
|
}
|
|
8640
8646
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8641
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8647
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8642
8648
|
}
|
|
8643
8649
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8644
|
-
packetsLost += report.packetsLost;
|
|
8645
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8646
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8650
|
+
packetsLost += Number(report.packetsLost);
|
|
8651
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8652
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8653
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8647
8654
|
}
|
|
8648
8655
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8649
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8656
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8650
8657
|
}
|
|
8651
8658
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8652
8659
|
if ('framesPerSecond' in report) {
|
|
8653
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8660
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8654
8661
|
}
|
|
8655
8662
|
if ('framerateMean' in report) {
|
|
8656
8663
|
// framerateMean is only available in FF
|
|
@@ -8658,24 +8665,31 @@ class WebRTCClient extends Emitter {
|
|
|
8658
8665
|
}
|
|
8659
8666
|
}
|
|
8660
8667
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8661
|
-
packetsLost += report.packetsLost;
|
|
8662
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8663
|
-
networkStats.jitter = report.jitter;
|
|
8668
|
+
packetsLost += Number(report.packetsLost);
|
|
8669
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8670
|
+
networkStats.jitter = Number(report.jitter);
|
|
8664
8671
|
}
|
|
8665
8672
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8666
|
-
packetsLost += report.packetsLost;
|
|
8673
|
+
packetsLost += Number(report.packetsLost);
|
|
8667
8674
|
}
|
|
8668
8675
|
if (report.type === 'transport') {
|
|
8669
|
-
transportSent += report.bytesSent;
|
|
8670
|
-
transportReceived += report.bytesReceived;
|
|
8676
|
+
transportSent += Number(report.bytesSent);
|
|
8677
|
+
transportReceived += Number(report.bytesReceived);
|
|
8671
8678
|
}
|
|
8672
8679
|
});
|
|
8673
8680
|
|
|
8674
8681
|
networkStats.packetsLost = packetsLost;
|
|
8682
|
+
|
|
8675
8683
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8676
8684
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8677
8685
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8678
8686
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8687
|
+
|
|
8688
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8689
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8690
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8691
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8692
|
+
|
|
8679
8693
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8680
8694
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8681
8695
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8887,6 +8901,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8887
8901
|
constraints,
|
|
8888
8902
|
audioOnly,
|
|
8889
8903
|
conference,
|
|
8904
|
+
iceRestart,
|
|
8890
8905
|
});
|
|
8891
8906
|
|
|
8892
8907
|
if (!sipSession) {
|
|
@@ -8990,6 +9005,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8990
9005
|
|
|
8991
9006
|
this.client.downgradeToAudio(sipSession);
|
|
8992
9007
|
|
|
9008
|
+
if (callSession) {
|
|
9009
|
+
callSession.cameraEnabled = false;
|
|
9010
|
+
this._updateCallSession(callSession);
|
|
9011
|
+
}
|
|
9012
|
+
|
|
8993
9013
|
if (withMessage) {
|
|
8994
9014
|
this._sendReinviteMessage(callSession, false);
|
|
8995
9015
|
}
|
|
@@ -9017,6 +9037,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9017
9037
|
|
|
9018
9038
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
9019
9039
|
|
|
9040
|
+
if (callSession) {
|
|
9041
|
+
callSession.cameraEnabled = true;
|
|
9042
|
+
this._updateCallSession(callSession);
|
|
9043
|
+
}
|
|
9044
|
+
|
|
9020
9045
|
// If no stream is returned, it means we have to reinvite
|
|
9021
9046
|
if (!newStream) {
|
|
9022
9047
|
return true;
|
|
@@ -9253,18 +9278,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9253
9278
|
screenTrack,
|
|
9254
9279
|
});
|
|
9255
9280
|
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9281
|
+
if (screenTrack) {
|
|
9282
|
+
screenTrack.onended = () => {
|
|
9283
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9284
|
+
hadVideo,
|
|
9285
|
+
id: this.getSipSessionId(sipSession),
|
|
9286
|
+
screenTrack,
|
|
9287
|
+
});
|
|
9262
9288
|
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9289
|
+
this.eventEmitter.emit(
|
|
9290
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9291
|
+
this._createCallSession(sipSession, callSession),
|
|
9292
|
+
);
|
|
9293
|
+
};
|
|
9294
|
+
}
|
|
9268
9295
|
|
|
9269
9296
|
this.currentScreenShare = {
|
|
9270
9297
|
stream: screenStream,
|
|
@@ -9284,7 +9311,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9284
9311
|
}
|
|
9285
9312
|
|
|
9286
9313
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9287
|
-
logger$7.info('WebRTC phone -
|
|
9314
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9288
9315
|
|
|
9289
9316
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9290
9317
|
this.currentSipSession = sipSession;
|
|
@@ -9796,7 +9823,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9796
9823
|
// @TODO: line is not used here
|
|
9797
9824
|
async makeCall(number , line , cameraEnabled ,
|
|
9798
9825
|
audioOnly = false, conference = false) {
|
|
9799
|
-
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
|
|
9826
|
+
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9800
9827
|
if (!number) {
|
|
9801
9828
|
return Promise.resolve(null);
|
|
9802
9829
|
}
|
|
@@ -10157,9 +10184,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10157
10184
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
10158
10185
|
&& this.currentSipSession.state === sessionState.SessionState.Established) {
|
|
10159
10186
|
this.shouldSendReinvite = false;
|
|
10187
|
+
const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
10188
|
+
const isConference = pc ? pc.sfu : false;
|
|
10189
|
+
const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
|
|
10190
|
+
|
|
10160
10191
|
try {
|
|
10161
10192
|
// Send reinvite with iceRestart
|
|
10162
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
10193
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10163
10194
|
} catch (e) {
|
|
10164
10195
|
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10165
10196
|
}
|
|
@@ -10243,6 +10274,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10243
10274
|
return this.client.getSipSessionId(sipSession);
|
|
10244
10275
|
}
|
|
10245
10276
|
|
|
10277
|
+
_updateCallSession(callSession ) {
|
|
10278
|
+
const sipSession = this.findSipSession(callSession);
|
|
10279
|
+
const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
|
|
10280
|
+
|
|
10281
|
+
if (sipSessionId) {
|
|
10282
|
+
this.callSessions[sipSessionId] = callSession;
|
|
10283
|
+
}
|
|
10284
|
+
}
|
|
10285
|
+
|
|
10246
10286
|
_onMessage(message ) {
|
|
10247
10287
|
if (!message || message.method !== 'MESSAGE') {
|
|
10248
10288
|
return;
|