@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/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
|
|
|
@@ -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,11 +8401,14 @@ class WebRTCClient extends Emitter {
|
|
|
8402
8401
|
|
|
8403
8402
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8404
8403
|
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
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
|
+
}
|
|
8410
8412
|
|
|
8411
8413
|
if (withEvent) {
|
|
8412
8414
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8616,13 +8618,17 @@ class WebRTCClient extends Emitter {
|
|
|
8616
8618
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8617
8619
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8618
8620
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8621
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8619
8622
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8620
8623
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8624
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8621
8625
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8622
8626
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8623
8627
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8624
|
-
let audioBytesSent = 0;
|
|
8625
|
-
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;
|
|
8626
8632
|
let videoBytesSent = 0;
|
|
8627
8633
|
let videoBytesReceived = 0;
|
|
8628
8634
|
let transportSent = 0;
|
|
@@ -8631,25 +8637,27 @@ class WebRTCClient extends Emitter {
|
|
|
8631
8637
|
|
|
8632
8638
|
stats.forEach(report => {
|
|
8633
8639
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8634
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8640
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8641
|
+
audioContentSent += Number(report.bytesSent);
|
|
8635
8642
|
}
|
|
8636
8643
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8637
|
-
audioBytesSent += report.bytesSent;
|
|
8644
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8638
8645
|
}
|
|
8639
8646
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8640
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8647
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8641
8648
|
}
|
|
8642
8649
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8643
|
-
packetsLost += report.packetsLost;
|
|
8644
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8645
|
-
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);
|
|
8646
8654
|
}
|
|
8647
8655
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8648
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8656
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8649
8657
|
}
|
|
8650
8658
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8651
8659
|
if ('framesPerSecond' in report) {
|
|
8652
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8660
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8653
8661
|
}
|
|
8654
8662
|
if ('framerateMean' in report) {
|
|
8655
8663
|
// framerateMean is only available in FF
|
|
@@ -8657,24 +8665,31 @@ class WebRTCClient extends Emitter {
|
|
|
8657
8665
|
}
|
|
8658
8666
|
}
|
|
8659
8667
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8660
|
-
packetsLost += report.packetsLost;
|
|
8661
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8662
|
-
networkStats.jitter = report.jitter;
|
|
8668
|
+
packetsLost += Number(report.packetsLost);
|
|
8669
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8670
|
+
networkStats.jitter = Number(report.jitter);
|
|
8663
8671
|
}
|
|
8664
8672
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8665
|
-
packetsLost += report.packetsLost;
|
|
8673
|
+
packetsLost += Number(report.packetsLost);
|
|
8666
8674
|
}
|
|
8667
8675
|
if (report.type === 'transport') {
|
|
8668
|
-
transportSent += report.bytesSent;
|
|
8669
|
-
transportReceived += report.bytesReceived;
|
|
8676
|
+
transportSent += Number(report.bytesSent);
|
|
8677
|
+
transportReceived += Number(report.bytesReceived);
|
|
8670
8678
|
}
|
|
8671
8679
|
});
|
|
8672
8680
|
|
|
8673
8681
|
networkStats.packetsLost = packetsLost;
|
|
8682
|
+
|
|
8674
8683
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8675
8684
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8676
8685
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8677
8686
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8687
|
+
|
|
8688
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8689
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8690
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8691
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8692
|
+
|
|
8678
8693
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8679
8694
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8680
8695
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8886,6 +8901,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8886
8901
|
constraints,
|
|
8887
8902
|
audioOnly,
|
|
8888
8903
|
conference,
|
|
8904
|
+
iceRestart,
|
|
8889
8905
|
});
|
|
8890
8906
|
|
|
8891
8907
|
if (!sipSession) {
|
|
@@ -8989,6 +9005,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8989
9005
|
|
|
8990
9006
|
this.client.downgradeToAudio(sipSession);
|
|
8991
9007
|
|
|
9008
|
+
if (callSession) {
|
|
9009
|
+
callSession.cameraEnabled = false;
|
|
9010
|
+
this._updateCallSession(callSession);
|
|
9011
|
+
}
|
|
9012
|
+
|
|
8992
9013
|
if (withMessage) {
|
|
8993
9014
|
this._sendReinviteMessage(callSession, false);
|
|
8994
9015
|
}
|
|
@@ -9016,6 +9037,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9016
9037
|
|
|
9017
9038
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
9018
9039
|
|
|
9040
|
+
if (callSession) {
|
|
9041
|
+
callSession.cameraEnabled = true;
|
|
9042
|
+
this._updateCallSession(callSession);
|
|
9043
|
+
}
|
|
9044
|
+
|
|
9019
9045
|
// If no stream is returned, it means we have to reinvite
|
|
9020
9046
|
if (!newStream) {
|
|
9021
9047
|
return true;
|
|
@@ -9068,7 +9094,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9068
9094
|
|
|
9069
9095
|
onCancel(message);
|
|
9070
9096
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
9071
|
-
|
|
9097
|
+
const callSession = this._createCallSession(sipSession);
|
|
9098
|
+
delete this.callSessions[callSession.getId()];
|
|
9099
|
+
|
|
9100
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
9072
9101
|
};
|
|
9073
9102
|
} else if (sipSession instanceof invitation.Invitation) {
|
|
9074
9103
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -9249,18 +9278,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9249
9278
|
screenTrack,
|
|
9250
9279
|
});
|
|
9251
9280
|
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
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
|
+
});
|
|
9258
9288
|
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9289
|
+
this.eventEmitter.emit(
|
|
9290
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9291
|
+
this._createCallSession(sipSession, callSession),
|
|
9292
|
+
);
|
|
9293
|
+
};
|
|
9294
|
+
}
|
|
9264
9295
|
|
|
9265
9296
|
this.currentScreenShare = {
|
|
9266
9297
|
stream: screenStream,
|
|
@@ -9280,7 +9311,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9280
9311
|
}
|
|
9281
9312
|
|
|
9282
9313
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9283
|
-
logger$7.info('WebRTC phone -
|
|
9314
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9284
9315
|
|
|
9285
9316
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9286
9317
|
this.currentSipSession = sipSession;
|
|
@@ -9792,7 +9823,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9792
9823
|
// @TODO: line is not used here
|
|
9793
9824
|
async makeCall(number , line , cameraEnabled ,
|
|
9794
9825
|
audioOnly = false, conference = false) {
|
|
9795
|
-
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 });
|
|
9796
9827
|
if (!number) {
|
|
9797
9828
|
return Promise.resolve(null);
|
|
9798
9829
|
}
|
|
@@ -10153,9 +10184,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10153
10184
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
10154
10185
|
&& this.currentSipSession.state === sessionState.SessionState.Established) {
|
|
10155
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
|
+
|
|
10156
10191
|
try {
|
|
10157
10192
|
// Send reinvite with iceRestart
|
|
10158
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
10193
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10159
10194
|
} catch (e) {
|
|
10160
10195
|
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10161
10196
|
}
|
|
@@ -10239,6 +10274,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10239
10274
|
return this.client.getSipSessionId(sipSession);
|
|
10240
10275
|
}
|
|
10241
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
|
+
|
|
10242
10286
|
_onMessage(message ) {
|
|
10243
10287
|
if (!message || message.method !== 'MESSAGE') {
|
|
10244
10288
|
return;
|