@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/esm/simple/utils.js
CHANGED
|
@@ -863,6 +863,9 @@ class Contact {
|
|
|
863
863
|
}
|
|
864
864
|
|
|
865
865
|
static parseMany(response ) {
|
|
866
|
+
if (!response || !response.results) {
|
|
867
|
+
return [];
|
|
868
|
+
}
|
|
866
869
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
867
870
|
}
|
|
868
871
|
|
|
@@ -1233,7 +1236,7 @@ class Contact {
|
|
|
1233
1236
|
this[key] = old[key] || this[key];
|
|
1234
1237
|
});
|
|
1235
1238
|
|
|
1236
|
-
if (old.lineState
|
|
1239
|
+
if (old.lineState) {
|
|
1237
1240
|
this.lineState = old.lineState;
|
|
1238
1241
|
}
|
|
1239
1242
|
|
|
@@ -2627,8 +2630,9 @@ class ExternalApp {
|
|
|
2627
2630
|
|
|
2628
2631
|
|
|
2629
2632
|
|
|
2630
|
-
|
|
2633
|
+
|
|
2631
2634
|
|
|
2635
|
+
|
|
2632
2636
|
|
|
2633
2637
|
|
|
2634
2638
|
class Meeting {
|
|
@@ -2639,9 +2643,10 @@ class Meeting {
|
|
|
2639
2643
|
|
|
2640
2644
|
|
|
2641
2645
|
|
|
2642
|
-
|
|
2646
|
+
|
|
2643
2647
|
|
|
2644
2648
|
|
|
2649
|
+
|
|
2645
2650
|
|
|
2646
2651
|
static parse(plain ) {
|
|
2647
2652
|
return new Meeting({
|
|
@@ -2651,12 +2656,16 @@ class Meeting {
|
|
|
2651
2656
|
ownerUuids: plain.owner_uuids,
|
|
2652
2657
|
port: plain.port,
|
|
2653
2658
|
uuid: plain.uuid,
|
|
2654
|
-
|
|
2659
|
+
extension: plain.exten,
|
|
2655
2660
|
persistent: plain.persistent,
|
|
2661
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
2656
2662
|
});
|
|
2657
2663
|
}
|
|
2658
2664
|
|
|
2659
2665
|
static parseMany(items ) {
|
|
2666
|
+
if (!items) {
|
|
2667
|
+
return [];
|
|
2668
|
+
}
|
|
2660
2669
|
return items.map(plain => Meeting.parse(plain));
|
|
2661
2670
|
}
|
|
2662
2671
|
|
|
@@ -2671,8 +2680,9 @@ class Meeting {
|
|
|
2671
2680
|
ownerUuids,
|
|
2672
2681
|
port,
|
|
2673
2682
|
uri,
|
|
2674
|
-
|
|
2683
|
+
extension,
|
|
2675
2684
|
persistent,
|
|
2685
|
+
creationTime,
|
|
2676
2686
|
} = {}) {
|
|
2677
2687
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2678
2688
|
this.uri = uri;
|
|
@@ -2680,8 +2690,9 @@ class Meeting {
|
|
|
2680
2690
|
this.ownerUuids = ownerUuids;
|
|
2681
2691
|
this.port = port;
|
|
2682
2692
|
this.uuid = uuid;
|
|
2683
|
-
this.
|
|
2693
|
+
this.extension = extension;
|
|
2684
2694
|
this.persistent = persistent;
|
|
2695
|
+
this.creationTime = creationTime;
|
|
2685
2696
|
|
|
2686
2697
|
// Useful to compare instead of instanceof with minified code
|
|
2687
2698
|
this.type = 'Meeting';
|
|
@@ -2859,6 +2870,10 @@ class ChatMessage {
|
|
|
2859
2870
|
|
|
2860
2871
|
|
|
2861
2872
|
static parseMany(plain ) {
|
|
2873
|
+
if (!plain || !plain.items) {
|
|
2874
|
+
return [];
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2862
2877
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2863
2878
|
}
|
|
2864
2879
|
|
|
@@ -2968,6 +2983,9 @@ class Voicemail {
|
|
|
2968
2983
|
}
|
|
2969
2984
|
|
|
2970
2985
|
static parseMany(plain ) {
|
|
2986
|
+
if (!plain) {
|
|
2987
|
+
return [];
|
|
2988
|
+
}
|
|
2971
2989
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2972
2990
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2973
2991
|
|
|
@@ -3077,6 +3095,9 @@ class Call {
|
|
|
3077
3095
|
|
|
3078
3096
|
|
|
3079
3097
|
static parseMany(plain ) {
|
|
3098
|
+
if (!plain) {
|
|
3099
|
+
return [];
|
|
3100
|
+
}
|
|
3080
3101
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3081
3102
|
}
|
|
3082
3103
|
|
|
@@ -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,12 +8391,14 @@ class WebRTCClient extends Emitter {
|
|
|
8392
8391
|
|
|
8393
8392
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8394
8393
|
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
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
|
+
}
|
|
8401
8402
|
|
|
8402
8403
|
if (withEvent) {
|
|
8403
8404
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8607,13 +8608,17 @@ class WebRTCClient extends Emitter {
|
|
|
8607
8608
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8608
8609
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8609
8610
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8611
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8610
8612
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8611
8613
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8614
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8612
8615
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8613
8616
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8614
8617
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8615
|
-
let audioBytesSent = 0;
|
|
8616
|
-
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;
|
|
8617
8622
|
let videoBytesSent = 0;
|
|
8618
8623
|
let videoBytesReceived = 0;
|
|
8619
8624
|
let transportSent = 0;
|
|
@@ -8622,25 +8627,27 @@ class WebRTCClient extends Emitter {
|
|
|
8622
8627
|
|
|
8623
8628
|
stats.forEach(report => {
|
|
8624
8629
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8625
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8630
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8631
|
+
audioContentSent += Number(report.bytesSent);
|
|
8626
8632
|
}
|
|
8627
8633
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8628
|
-
audioBytesSent += report.bytesSent;
|
|
8634
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8629
8635
|
}
|
|
8630
8636
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8631
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8637
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8632
8638
|
}
|
|
8633
8639
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8634
|
-
packetsLost += report.packetsLost;
|
|
8635
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8636
|
-
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);
|
|
8637
8644
|
}
|
|
8638
8645
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8639
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8646
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8640
8647
|
}
|
|
8641
8648
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8642
8649
|
if ('framesPerSecond' in report) {
|
|
8643
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8650
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8644
8651
|
}
|
|
8645
8652
|
if ('framerateMean' in report) {
|
|
8646
8653
|
// framerateMean is only available in FF
|
|
@@ -8648,24 +8655,31 @@ class WebRTCClient extends Emitter {
|
|
|
8648
8655
|
}
|
|
8649
8656
|
}
|
|
8650
8657
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8651
|
-
packetsLost += report.packetsLost;
|
|
8652
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8653
|
-
networkStats.jitter = report.jitter;
|
|
8658
|
+
packetsLost += Number(report.packetsLost);
|
|
8659
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8660
|
+
networkStats.jitter = Number(report.jitter);
|
|
8654
8661
|
}
|
|
8655
8662
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8656
|
-
packetsLost += report.packetsLost;
|
|
8663
|
+
packetsLost += Number(report.packetsLost);
|
|
8657
8664
|
}
|
|
8658
8665
|
if (report.type === 'transport') {
|
|
8659
|
-
transportSent += report.bytesSent;
|
|
8660
|
-
transportReceived += report.bytesReceived;
|
|
8666
|
+
transportSent += Number(report.bytesSent);
|
|
8667
|
+
transportReceived += Number(report.bytesReceived);
|
|
8661
8668
|
}
|
|
8662
8669
|
});
|
|
8663
8670
|
|
|
8664
8671
|
networkStats.packetsLost = packetsLost;
|
|
8672
|
+
|
|
8665
8673
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8666
8674
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8667
8675
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8668
8676
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8677
|
+
|
|
8678
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8679
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8680
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8681
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8682
|
+
|
|
8669
8683
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8670
8684
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8671
8685
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8877,6 +8891,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8877
8891
|
constraints,
|
|
8878
8892
|
audioOnly,
|
|
8879
8893
|
conference,
|
|
8894
|
+
iceRestart,
|
|
8880
8895
|
});
|
|
8881
8896
|
|
|
8882
8897
|
if (!sipSession) {
|
|
@@ -8980,6 +8995,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8980
8995
|
|
|
8981
8996
|
this.client.downgradeToAudio(sipSession);
|
|
8982
8997
|
|
|
8998
|
+
if (callSession) {
|
|
8999
|
+
callSession.cameraEnabled = false;
|
|
9000
|
+
this._updateCallSession(callSession);
|
|
9001
|
+
}
|
|
9002
|
+
|
|
8983
9003
|
if (withMessage) {
|
|
8984
9004
|
this._sendReinviteMessage(callSession, false);
|
|
8985
9005
|
}
|
|
@@ -9007,6 +9027,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9007
9027
|
|
|
9008
9028
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
9009
9029
|
|
|
9030
|
+
if (callSession) {
|
|
9031
|
+
callSession.cameraEnabled = true;
|
|
9032
|
+
this._updateCallSession(callSession);
|
|
9033
|
+
}
|
|
9034
|
+
|
|
9010
9035
|
// If no stream is returned, it means we have to reinvite
|
|
9011
9036
|
if (!newStream) {
|
|
9012
9037
|
return true;
|
|
@@ -9243,18 +9268,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9243
9268
|
screenTrack,
|
|
9244
9269
|
});
|
|
9245
9270
|
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
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
|
+
});
|
|
9252
9278
|
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9279
|
+
this.eventEmitter.emit(
|
|
9280
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9281
|
+
this._createCallSession(sipSession, callSession),
|
|
9282
|
+
);
|
|
9283
|
+
};
|
|
9284
|
+
}
|
|
9258
9285
|
|
|
9259
9286
|
this.currentScreenShare = {
|
|
9260
9287
|
stream: screenStream,
|
|
@@ -9274,7 +9301,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9274
9301
|
}
|
|
9275
9302
|
|
|
9276
9303
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9277
|
-
logger$7.info('WebRTC phone -
|
|
9304
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9278
9305
|
|
|
9279
9306
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9280
9307
|
this.currentSipSession = sipSession;
|
|
@@ -9786,7 +9813,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9786
9813
|
// @TODO: line is not used here
|
|
9787
9814
|
async makeCall(number , line , cameraEnabled ,
|
|
9788
9815
|
audioOnly = false, conference = false) {
|
|
9789
|
-
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 });
|
|
9790
9817
|
if (!number) {
|
|
9791
9818
|
return Promise.resolve(null);
|
|
9792
9819
|
}
|
|
@@ -10147,9 +10174,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10147
10174
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
10148
10175
|
&& this.currentSipSession.state === SessionState.Established) {
|
|
10149
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
|
+
|
|
10150
10181
|
try {
|
|
10151
10182
|
// Send reinvite with iceRestart
|
|
10152
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
10183
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10153
10184
|
} catch (e) {
|
|
10154
10185
|
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10155
10186
|
}
|
|
@@ -10233,6 +10264,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10233
10264
|
return this.client.getSipSessionId(sipSession);
|
|
10234
10265
|
}
|
|
10235
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
|
+
|
|
10236
10276
|
_onMessage(message ) {
|
|
10237
10277
|
if (!message || message.method !== 'MESSAGE') {
|
|
10238
10278
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import 'moment';
|