@wazo/sdk 0.37.23 → 0.37.27
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/README.md +95 -57
- package/dist/wazo-sdk.js +3 -3
- package/esm/__tests__/api-client.test.js +12 -7
- package/esm/__tests__/web-rtc-client.test.js +47 -20
- package/esm/api/agentd.js +1 -1
- package/esm/api/amid.js +1 -1
- package/esm/api/application.js +1 -1
- package/esm/api/auth.js +1 -1
- package/esm/api/call-logd.js +1 -1
- package/esm/api/calld.js +1 -1
- package/esm/api/chatd.js +1 -1
- package/esm/api/confd.js +11 -6
- package/esm/api/ctid-ng.js +1 -1
- package/esm/api/dird.js +2 -2
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +12 -7
- package/esm/checker/Checker.js +47 -20
- package/esm/checker/checks/aor.js +12 -7
- package/esm/checker/checks/api.js +12 -7
- package/esm/checker/checks/index.js +47 -20
- package/esm/checker/checks/wazo-websocket.js +1 -1
- package/esm/checker/checks/webrtc-transport.js +47 -20
- package/esm/checker/checks/webrtc.js +47 -20
- package/esm/domain/AdHocAPIConference.js +12 -7
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +12 -7
- package/esm/domain/Meeting.js +12 -5
- package/esm/domain/Phone/CTIPhone.js +12 -7
- package/esm/domain/Phone/WebRTCPhone.js +34 -6
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/index.js +80 -25
- package/esm/lib/WazoSessionDescriptionHandler.js +9 -4
- package/esm/service/CallApi.js +12 -7
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +12 -7
- package/esm/simple/Auth.js +80 -25
- package/esm/simple/Configuration.js +80 -25
- package/esm/simple/Directory.js +12 -7
- package/esm/simple/Phone.js +80 -25
- package/esm/simple/Websocket.js +1 -1
- package/esm/simple/index.js +80 -25
- package/esm/simple/room/LocalParticipant.js +80 -25
- package/esm/simple/room/Participant.js +80 -25
- package/esm/simple/room/RemoteParticipant.js +80 -25
- package/esm/simple/room/Room.js +80 -25
- package/esm/simple/room/SipRoom.js +80 -25
- package/esm/simple/room/Stream.js +80 -25
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +80 -25
- package/esm/simple/utils.js +80 -25
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/utils/__tests__/api-requester.test.js +1 -1
- package/esm/utils/api-requester.js +1 -1
- package/esm/web-rtc-client.js +47 -20
- package/esm/websocket-client.js +1 -1
- package/lib/__tests__/api-client.test.js +12 -7
- package/lib/__tests__/web-rtc-client.test.js +47 -20
- package/lib/api/agentd.js +1 -1
- package/lib/api/amid.js +1 -1
- package/lib/api/application.js +1 -1
- package/lib/api/auth.js +1 -1
- package/lib/api/call-logd.js +1 -1
- package/lib/api/calld.js +1 -1
- package/lib/api/chatd.js +1 -1
- package/lib/api/confd.js +11 -6
- package/lib/api/ctid-ng.js +1 -1
- package/lib/api/dird.js +2 -2
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +12 -7
- package/lib/checker/Checker.js +47 -20
- package/lib/checker/checks/aor.js +12 -7
- package/lib/checker/checks/api.js +12 -7
- package/lib/checker/checks/index.js +47 -20
- package/lib/checker/checks/wazo-websocket.js +1 -1
- package/lib/checker/checks/webrtc-transport.js +47 -20
- package/lib/checker/checks/webrtc.js +47 -20
- package/lib/domain/AdHocAPIConference.js +12 -7
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +12 -7
- package/lib/domain/Meeting.js +16 -5
- package/lib/domain/Phone/CTIPhone.js +12 -7
- package/lib/domain/Phone/WebRTCPhone.js +34 -6
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/index.js +80 -25
- package/lib/lib/WazoSessionDescriptionHandler.js +9 -4
- package/lib/service/CallApi.js +12 -7
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +12 -7
- package/lib/simple/Auth.js +80 -25
- package/lib/simple/Configuration.js +80 -25
- package/lib/simple/Directory.js +12 -7
- package/lib/simple/Phone.js +80 -25
- package/lib/simple/Websocket.js +1 -1
- package/lib/simple/index.js +80 -25
- package/lib/simple/room/LocalParticipant.js +80 -25
- package/lib/simple/room/Participant.js +80 -25
- package/lib/simple/room/RemoteParticipant.js +80 -25
- package/lib/simple/room/Room.js +80 -25
- package/lib/simple/room/SipRoom.js +80 -25
- package/lib/simple/room/Stream.js +80 -25
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +80 -25
- package/lib/simple/utils.js +80 -25
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/utils/__tests__/api-requester.test.js +1 -1
- package/lib/utils/api-requester.js +1 -1
- package/lib/web-rtc-client.js +47 -20
- package/lib/websocket-client.js +1 -1
- package/package.json +1 -1
- package/src/domain/Contact.js +1 -1
- package/src/domain/Meeting.js +12 -5
- package/src/domain/Phone/WebRTCPhone.js +33 -5
- package/src/domain/__tests__/Meeting.test.js +50 -0
- package/src/lib/WazoSessionDescriptionHandler.js +8 -3
- package/src/utils/api-requester.js +1 -1
- package/src/web-rtc-client.js +27 -10
package/lib/api-client.js
CHANGED
|
@@ -450,7 +450,7 @@ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
450
450
|
|
|
451
451
|
// Use a function here to be able to mock it in tests
|
|
452
452
|
const realFetch = () => {
|
|
453
|
-
if (typeof document !== 'undefined') {
|
|
453
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
454
454
|
// Browser
|
|
455
455
|
return window.fetch;
|
|
456
456
|
}
|
|
@@ -1910,7 +1910,7 @@ class Contact {
|
|
|
1910
1910
|
this[key] = old[key] || this[key];
|
|
1911
1911
|
});
|
|
1912
1912
|
|
|
1913
|
-
if (old.lineState
|
|
1913
|
+
if (old.lineState) {
|
|
1914
1914
|
this.lineState = old.lineState;
|
|
1915
1915
|
}
|
|
1916
1916
|
|
|
@@ -2617,8 +2617,9 @@ class ExternalApp {
|
|
|
2617
2617
|
|
|
2618
2618
|
|
|
2619
2619
|
|
|
2620
|
-
|
|
2620
|
+
|
|
2621
2621
|
|
|
2622
|
+
|
|
2622
2623
|
|
|
2623
2624
|
|
|
2624
2625
|
class Meeting {
|
|
@@ -2629,9 +2630,10 @@ class Meeting {
|
|
|
2629
2630
|
|
|
2630
2631
|
|
|
2631
2632
|
|
|
2632
|
-
|
|
2633
|
+
|
|
2633
2634
|
|
|
2634
2635
|
|
|
2636
|
+
|
|
2635
2637
|
|
|
2636
2638
|
static parse(plain ) {
|
|
2637
2639
|
return new Meeting({
|
|
@@ -2641,8 +2643,9 @@ class Meeting {
|
|
|
2641
2643
|
ownerUuids: plain.owner_uuids,
|
|
2642
2644
|
port: plain.port,
|
|
2643
2645
|
uuid: plain.uuid,
|
|
2644
|
-
|
|
2646
|
+
extension: plain.exten,
|
|
2645
2647
|
persistent: plain.persistent,
|
|
2648
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2646
2649
|
});
|
|
2647
2650
|
}
|
|
2648
2651
|
|
|
@@ -2664,8 +2667,9 @@ class Meeting {
|
|
|
2664
2667
|
ownerUuids,
|
|
2665
2668
|
port,
|
|
2666
2669
|
uri,
|
|
2667
|
-
|
|
2670
|
+
extension,
|
|
2668
2671
|
persistent,
|
|
2672
|
+
creationTime,
|
|
2669
2673
|
} = {}) {
|
|
2670
2674
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2671
2675
|
this.uri = uri;
|
|
@@ -2673,8 +2677,9 @@ class Meeting {
|
|
|
2673
2677
|
this.ownerUuids = ownerUuids;
|
|
2674
2678
|
this.port = port;
|
|
2675
2679
|
this.uuid = uuid;
|
|
2676
|
-
this.
|
|
2680
|
+
this.extension = extension;
|
|
2677
2681
|
this.persistent = persistent;
|
|
2682
|
+
this.creationTime = creationTime;
|
|
2678
2683
|
|
|
2679
2684
|
// Useful to compare instead of instanceof with minified code
|
|
2680
2685
|
this.type = 'Meeting';
|
package/lib/checker/Checker.js
CHANGED
|
@@ -472,7 +472,7 @@ const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
472
472
|
|
|
473
473
|
// Use a function here to be able to mock it in tests
|
|
474
474
|
const realFetch = () => {
|
|
475
|
-
if (typeof document !== 'undefined') {
|
|
475
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
476
476
|
// Browser
|
|
477
477
|
return window.fetch;
|
|
478
478
|
}
|
|
@@ -1932,7 +1932,7 @@ class Contact {
|
|
|
1932
1932
|
this[key] = old[key] || this[key];
|
|
1933
1933
|
});
|
|
1934
1934
|
|
|
1935
|
-
if (old.lineState
|
|
1935
|
+
if (old.lineState) {
|
|
1936
1936
|
this.lineState = old.lineState;
|
|
1937
1937
|
}
|
|
1938
1938
|
|
|
@@ -2639,8 +2639,9 @@ class ExternalApp {
|
|
|
2639
2639
|
|
|
2640
2640
|
|
|
2641
2641
|
|
|
2642
|
-
|
|
2642
|
+
|
|
2643
2643
|
|
|
2644
|
+
|
|
2644
2645
|
|
|
2645
2646
|
|
|
2646
2647
|
class Meeting {
|
|
@@ -2651,9 +2652,10 @@ class Meeting {
|
|
|
2651
2652
|
|
|
2652
2653
|
|
|
2653
2654
|
|
|
2654
|
-
|
|
2655
|
+
|
|
2655
2656
|
|
|
2656
2657
|
|
|
2658
|
+
|
|
2657
2659
|
|
|
2658
2660
|
static parse(plain ) {
|
|
2659
2661
|
return new Meeting({
|
|
@@ -2663,8 +2665,9 @@ class Meeting {
|
|
|
2663
2665
|
ownerUuids: plain.owner_uuids,
|
|
2664
2666
|
port: plain.port,
|
|
2665
2667
|
uuid: plain.uuid,
|
|
2666
|
-
|
|
2668
|
+
extension: plain.exten,
|
|
2667
2669
|
persistent: plain.persistent,
|
|
2670
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2668
2671
|
});
|
|
2669
2672
|
}
|
|
2670
2673
|
|
|
@@ -2686,8 +2689,9 @@ class Meeting {
|
|
|
2686
2689
|
ownerUuids,
|
|
2687
2690
|
port,
|
|
2688
2691
|
uri,
|
|
2689
|
-
|
|
2692
|
+
extension,
|
|
2690
2693
|
persistent,
|
|
2694
|
+
creationTime,
|
|
2691
2695
|
} = {}) {
|
|
2692
2696
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2693
2697
|
this.uri = uri;
|
|
@@ -2695,8 +2699,9 @@ class Meeting {
|
|
|
2695
2699
|
this.ownerUuids = ownerUuids;
|
|
2696
2700
|
this.port = port;
|
|
2697
2701
|
this.uuid = uuid;
|
|
2698
|
-
this.
|
|
2702
|
+
this.extension = extension;
|
|
2699
2703
|
this.persistent = persistent;
|
|
2704
|
+
this.creationTime = creationTime;
|
|
2700
2705
|
|
|
2701
2706
|
// Useful to compare instead of instanceof with minified code
|
|
2702
2707
|
this.type = 'Meeting';
|
|
@@ -5484,11 +5489,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5484
5489
|
|
|
5485
5490
|
// $FlowFixMe
|
|
5486
5491
|
setRemoteSessionDescription(sessionDescription ) {
|
|
5487
|
-
|
|
5492
|
+
try {
|
|
5493
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
5488
5494
|
|
|
5489
|
-
|
|
5495
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
5490
5496
|
|
|
5491
|
-
|
|
5497
|
+
return result;
|
|
5498
|
+
} catch (error) {
|
|
5499
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
5500
|
+
throw error;
|
|
5501
|
+
}
|
|
5492
5502
|
}
|
|
5493
5503
|
|
|
5494
5504
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -6295,7 +6305,7 @@ class WebRTCClient extends Emitter {
|
|
|
6295
6305
|
}
|
|
6296
6306
|
|
|
6297
6307
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6298
|
-
logger$1.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6308
|
+
logger$1.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6299
6309
|
const inviterOptions = {
|
|
6300
6310
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6301
6311
|
conference,
|
|
@@ -7371,6 +7381,7 @@ class WebRTCClient extends Emitter {
|
|
|
7371
7381
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7372
7382
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7373
7383
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7384
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7374
7385
|
|
|
7375
7386
|
logger$1.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7376
7387
|
|
|
@@ -7378,7 +7389,8 @@ class WebRTCClient extends Emitter {
|
|
|
7378
7389
|
constraints: {
|
|
7379
7390
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7380
7391
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7381
|
-
video: screenSharing ? (isDesktop
|
|
7392
|
+
video: screenSharing ? (isDesktop
|
|
7393
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7382
7394
|
: this._getVideoConstraints(enableVideo),
|
|
7383
7395
|
screen: screenSharing,
|
|
7384
7396
|
desktop: isDesktop,
|
|
@@ -7713,12 +7725,14 @@ class WebRTCClient extends Emitter {
|
|
|
7713
7725
|
|
|
7714
7726
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7715
7727
|
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7728
|
+
if (pc) {
|
|
7729
|
+
pc.oniceconnectionstatechange = () => {
|
|
7730
|
+
logger$1.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7731
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7732
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7733
|
+
}
|
|
7734
|
+
};
|
|
7735
|
+
}
|
|
7722
7736
|
|
|
7723
7737
|
if (withEvent) {
|
|
7724
7738
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -7928,13 +7942,17 @@ class WebRTCClient extends Emitter {
|
|
|
7928
7942
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
7929
7943
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
7930
7944
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
7945
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
7931
7946
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
7932
7947
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
7948
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
7933
7949
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
7934
7950
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
7935
7951
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
7936
|
-
let audioBytesSent = 0;
|
|
7937
|
-
let audioBytesReceived = 0;
|
|
7952
|
+
let audioBytesSent = 0; // content + header
|
|
7953
|
+
let audioBytesReceived = 0; // content + header
|
|
7954
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
7955
|
+
let audioContentReceived = 0;
|
|
7938
7956
|
let videoBytesSent = 0;
|
|
7939
7957
|
let videoBytesReceived = 0;
|
|
7940
7958
|
let transportSent = 0;
|
|
@@ -7944,6 +7962,7 @@ class WebRTCClient extends Emitter {
|
|
|
7944
7962
|
stats.forEach(report => {
|
|
7945
7963
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7946
7964
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7965
|
+
audioContentSent += Number(report.bytesSent);
|
|
7947
7966
|
}
|
|
7948
7967
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7949
7968
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -7955,6 +7974,7 @@ class WebRTCClient extends Emitter {
|
|
|
7955
7974
|
packetsLost += Number(report.packetsLost);
|
|
7956
7975
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7957
7976
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7977
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
7958
7978
|
}
|
|
7959
7979
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7960
7980
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -7983,10 +8003,17 @@ class WebRTCClient extends Emitter {
|
|
|
7983
8003
|
});
|
|
7984
8004
|
|
|
7985
8005
|
networkStats.packetsLost = packetsLost;
|
|
8006
|
+
|
|
7986
8007
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7987
8008
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7988
8009
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7989
8010
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8011
|
+
|
|
8012
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8013
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8014
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8015
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8016
|
+
|
|
7990
8017
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7991
8018
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7992
8019
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -450,7 +450,7 @@ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
450
450
|
|
|
451
451
|
// Use a function here to be able to mock it in tests
|
|
452
452
|
const realFetch = () => {
|
|
453
|
-
if (typeof document !== 'undefined') {
|
|
453
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
454
454
|
// Browser
|
|
455
455
|
return window.fetch;
|
|
456
456
|
}
|
|
@@ -1910,7 +1910,7 @@ class Contact {
|
|
|
1910
1910
|
this[key] = old[key] || this[key];
|
|
1911
1911
|
});
|
|
1912
1912
|
|
|
1913
|
-
if (old.lineState
|
|
1913
|
+
if (old.lineState) {
|
|
1914
1914
|
this.lineState = old.lineState;
|
|
1915
1915
|
}
|
|
1916
1916
|
|
|
@@ -2617,8 +2617,9 @@ class ExternalApp {
|
|
|
2617
2617
|
|
|
2618
2618
|
|
|
2619
2619
|
|
|
2620
|
-
|
|
2620
|
+
|
|
2621
2621
|
|
|
2622
|
+
|
|
2622
2623
|
|
|
2623
2624
|
|
|
2624
2625
|
class Meeting {
|
|
@@ -2629,9 +2630,10 @@ class Meeting {
|
|
|
2629
2630
|
|
|
2630
2631
|
|
|
2631
2632
|
|
|
2632
|
-
|
|
2633
|
+
|
|
2633
2634
|
|
|
2634
2635
|
|
|
2636
|
+
|
|
2635
2637
|
|
|
2636
2638
|
static parse(plain ) {
|
|
2637
2639
|
return new Meeting({
|
|
@@ -2641,8 +2643,9 @@ class Meeting {
|
|
|
2641
2643
|
ownerUuids: plain.owner_uuids,
|
|
2642
2644
|
port: plain.port,
|
|
2643
2645
|
uuid: plain.uuid,
|
|
2644
|
-
|
|
2646
|
+
extension: plain.exten,
|
|
2645
2647
|
persistent: plain.persistent,
|
|
2648
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2646
2649
|
});
|
|
2647
2650
|
}
|
|
2648
2651
|
|
|
@@ -2664,8 +2667,9 @@ class Meeting {
|
|
|
2664
2667
|
ownerUuids,
|
|
2665
2668
|
port,
|
|
2666
2669
|
uri,
|
|
2667
|
-
|
|
2670
|
+
extension,
|
|
2668
2671
|
persistent,
|
|
2672
|
+
creationTime,
|
|
2669
2673
|
} = {}) {
|
|
2670
2674
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2671
2675
|
this.uri = uri;
|
|
@@ -2673,8 +2677,9 @@ class Meeting {
|
|
|
2673
2677
|
this.ownerUuids = ownerUuids;
|
|
2674
2678
|
this.port = port;
|
|
2675
2679
|
this.uuid = uuid;
|
|
2676
|
-
this.
|
|
2680
|
+
this.extension = extension;
|
|
2677
2681
|
this.persistent = persistent;
|
|
2682
|
+
this.creationTime = creationTime;
|
|
2678
2683
|
|
|
2679
2684
|
// Useful to compare instead of instanceof with minified code
|
|
2680
2685
|
this.type = 'Meeting';
|
|
@@ -450,7 +450,7 @@ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
450
450
|
|
|
451
451
|
// Use a function here to be able to mock it in tests
|
|
452
452
|
const realFetch = () => {
|
|
453
|
-
if (typeof document !== 'undefined') {
|
|
453
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
454
454
|
// Browser
|
|
455
455
|
return window.fetch;
|
|
456
456
|
}
|
|
@@ -1910,7 +1910,7 @@ class Contact {
|
|
|
1910
1910
|
this[key] = old[key] || this[key];
|
|
1911
1911
|
});
|
|
1912
1912
|
|
|
1913
|
-
if (old.lineState
|
|
1913
|
+
if (old.lineState) {
|
|
1914
1914
|
this.lineState = old.lineState;
|
|
1915
1915
|
}
|
|
1916
1916
|
|
|
@@ -2617,8 +2617,9 @@ class ExternalApp {
|
|
|
2617
2617
|
|
|
2618
2618
|
|
|
2619
2619
|
|
|
2620
|
-
|
|
2620
|
+
|
|
2621
2621
|
|
|
2622
|
+
|
|
2622
2623
|
|
|
2623
2624
|
|
|
2624
2625
|
class Meeting {
|
|
@@ -2629,9 +2630,10 @@ class Meeting {
|
|
|
2629
2630
|
|
|
2630
2631
|
|
|
2631
2632
|
|
|
2632
|
-
|
|
2633
|
+
|
|
2633
2634
|
|
|
2634
2635
|
|
|
2636
|
+
|
|
2635
2637
|
|
|
2636
2638
|
static parse(plain ) {
|
|
2637
2639
|
return new Meeting({
|
|
@@ -2641,8 +2643,9 @@ class Meeting {
|
|
|
2641
2643
|
ownerUuids: plain.owner_uuids,
|
|
2642
2644
|
port: plain.port,
|
|
2643
2645
|
uuid: plain.uuid,
|
|
2644
|
-
|
|
2646
|
+
extension: plain.exten,
|
|
2645
2647
|
persistent: plain.persistent,
|
|
2648
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2646
2649
|
});
|
|
2647
2650
|
}
|
|
2648
2651
|
|
|
@@ -2664,8 +2667,9 @@ class Meeting {
|
|
|
2664
2667
|
ownerUuids,
|
|
2665
2668
|
port,
|
|
2666
2669
|
uri,
|
|
2667
|
-
|
|
2670
|
+
extension,
|
|
2668
2671
|
persistent,
|
|
2672
|
+
creationTime,
|
|
2669
2673
|
} = {}) {
|
|
2670
2674
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2671
2675
|
this.uri = uri;
|
|
@@ -2673,8 +2677,9 @@ class Meeting {
|
|
|
2673
2677
|
this.ownerUuids = ownerUuids;
|
|
2674
2678
|
this.port = port;
|
|
2675
2679
|
this.uuid = uuid;
|
|
2676
|
-
this.
|
|
2680
|
+
this.extension = extension;
|
|
2677
2681
|
this.persistent = persistent;
|
|
2682
|
+
this.creationTime = creationTime;
|
|
2678
2683
|
|
|
2679
2684
|
// Useful to compare instead of instanceof with minified code
|
|
2680
2685
|
this.type = 'Meeting';
|
|
@@ -472,7 +472,7 @@ const logger$3 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
472
472
|
|
|
473
473
|
// Use a function here to be able to mock it in tests
|
|
474
474
|
const realFetch = () => {
|
|
475
|
-
if (typeof document !== 'undefined') {
|
|
475
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
476
476
|
// Browser
|
|
477
477
|
return window.fetch;
|
|
478
478
|
}
|
|
@@ -1932,7 +1932,7 @@ class Contact {
|
|
|
1932
1932
|
this[key] = old[key] || this[key];
|
|
1933
1933
|
});
|
|
1934
1934
|
|
|
1935
|
-
if (old.lineState
|
|
1935
|
+
if (old.lineState) {
|
|
1936
1936
|
this.lineState = old.lineState;
|
|
1937
1937
|
}
|
|
1938
1938
|
|
|
@@ -2639,8 +2639,9 @@ class ExternalApp {
|
|
|
2639
2639
|
|
|
2640
2640
|
|
|
2641
2641
|
|
|
2642
|
-
|
|
2642
|
+
|
|
2643
2643
|
|
|
2644
|
+
|
|
2644
2645
|
|
|
2645
2646
|
|
|
2646
2647
|
class Meeting {
|
|
@@ -2651,9 +2652,10 @@ class Meeting {
|
|
|
2651
2652
|
|
|
2652
2653
|
|
|
2653
2654
|
|
|
2654
|
-
|
|
2655
|
+
|
|
2655
2656
|
|
|
2656
2657
|
|
|
2658
|
+
|
|
2657
2659
|
|
|
2658
2660
|
static parse(plain ) {
|
|
2659
2661
|
return new Meeting({
|
|
@@ -2663,8 +2665,9 @@ class Meeting {
|
|
|
2663
2665
|
ownerUuids: plain.owner_uuids,
|
|
2664
2666
|
port: plain.port,
|
|
2665
2667
|
uuid: plain.uuid,
|
|
2666
|
-
|
|
2668
|
+
extension: plain.exten,
|
|
2667
2669
|
persistent: plain.persistent,
|
|
2670
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2668
2671
|
});
|
|
2669
2672
|
}
|
|
2670
2673
|
|
|
@@ -2686,8 +2689,9 @@ class Meeting {
|
|
|
2686
2689
|
ownerUuids,
|
|
2687
2690
|
port,
|
|
2688
2691
|
uri,
|
|
2689
|
-
|
|
2692
|
+
extension,
|
|
2690
2693
|
persistent,
|
|
2694
|
+
creationTime,
|
|
2691
2695
|
} = {}) {
|
|
2692
2696
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2693
2697
|
this.uri = uri;
|
|
@@ -2695,8 +2699,9 @@ class Meeting {
|
|
|
2695
2699
|
this.ownerUuids = ownerUuids;
|
|
2696
2700
|
this.port = port;
|
|
2697
2701
|
this.uuid = uuid;
|
|
2698
|
-
this.
|
|
2702
|
+
this.extension = extension;
|
|
2699
2703
|
this.persistent = persistent;
|
|
2704
|
+
this.creationTime = creationTime;
|
|
2700
2705
|
|
|
2701
2706
|
// Useful to compare instead of instanceof with minified code
|
|
2702
2707
|
this.type = 'Meeting';
|
|
@@ -5484,11 +5489,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5484
5489
|
|
|
5485
5490
|
// $FlowFixMe
|
|
5486
5491
|
setRemoteSessionDescription(sessionDescription ) {
|
|
5487
|
-
|
|
5492
|
+
try {
|
|
5493
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
5488
5494
|
|
|
5489
|
-
|
|
5495
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
5490
5496
|
|
|
5491
|
-
|
|
5497
|
+
return result;
|
|
5498
|
+
} catch (error) {
|
|
5499
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
5500
|
+
throw error;
|
|
5501
|
+
}
|
|
5492
5502
|
}
|
|
5493
5503
|
|
|
5494
5504
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -6295,7 +6305,7 @@ class WebRTCClient extends Emitter {
|
|
|
6295
6305
|
}
|
|
6296
6306
|
|
|
6297
6307
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6298
|
-
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6308
|
+
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6299
6309
|
const inviterOptions = {
|
|
6300
6310
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6301
6311
|
conference,
|
|
@@ -7371,6 +7381,7 @@ class WebRTCClient extends Emitter {
|
|
|
7371
7381
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7372
7382
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7373
7383
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7384
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7374
7385
|
|
|
7375
7386
|
logger.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7376
7387
|
|
|
@@ -7378,7 +7389,8 @@ class WebRTCClient extends Emitter {
|
|
|
7378
7389
|
constraints: {
|
|
7379
7390
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7380
7391
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7381
|
-
video: screenSharing ? (isDesktop
|
|
7392
|
+
video: screenSharing ? (isDesktop
|
|
7393
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7382
7394
|
: this._getVideoConstraints(enableVideo),
|
|
7383
7395
|
screen: screenSharing,
|
|
7384
7396
|
desktop: isDesktop,
|
|
@@ -7713,12 +7725,14 @@ class WebRTCClient extends Emitter {
|
|
|
7713
7725
|
|
|
7714
7726
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7715
7727
|
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7728
|
+
if (pc) {
|
|
7729
|
+
pc.oniceconnectionstatechange = () => {
|
|
7730
|
+
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7731
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7732
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7733
|
+
}
|
|
7734
|
+
};
|
|
7735
|
+
}
|
|
7722
7736
|
|
|
7723
7737
|
if (withEvent) {
|
|
7724
7738
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -7928,13 +7942,17 @@ class WebRTCClient extends Emitter {
|
|
|
7928
7942
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
7929
7943
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
7930
7944
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
7945
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
7931
7946
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
7932
7947
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
7948
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
7933
7949
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
7934
7950
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
7935
7951
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
7936
|
-
let audioBytesSent = 0;
|
|
7937
|
-
let audioBytesReceived = 0;
|
|
7952
|
+
let audioBytesSent = 0; // content + header
|
|
7953
|
+
let audioBytesReceived = 0; // content + header
|
|
7954
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
7955
|
+
let audioContentReceived = 0;
|
|
7938
7956
|
let videoBytesSent = 0;
|
|
7939
7957
|
let videoBytesReceived = 0;
|
|
7940
7958
|
let transportSent = 0;
|
|
@@ -7944,6 +7962,7 @@ class WebRTCClient extends Emitter {
|
|
|
7944
7962
|
stats.forEach(report => {
|
|
7945
7963
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7946
7964
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7965
|
+
audioContentSent += Number(report.bytesSent);
|
|
7947
7966
|
}
|
|
7948
7967
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7949
7968
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -7955,6 +7974,7 @@ class WebRTCClient extends Emitter {
|
|
|
7955
7974
|
packetsLost += Number(report.packetsLost);
|
|
7956
7975
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7957
7976
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7977
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
7958
7978
|
}
|
|
7959
7979
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7960
7980
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -7983,10 +8003,17 @@ class WebRTCClient extends Emitter {
|
|
|
7983
8003
|
});
|
|
7984
8004
|
|
|
7985
8005
|
networkStats.packetsLost = packetsLost;
|
|
8006
|
+
|
|
7986
8007
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7987
8008
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7988
8009
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7989
8010
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8011
|
+
|
|
8012
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8013
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8014
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8015
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8016
|
+
|
|
7990
8017
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7991
8018
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7992
8019
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -47,7 +47,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
47
47
|
|
|
48
48
|
// Use a function here to be able to mock it in tests
|
|
49
49
|
const realFetch = () => {
|
|
50
|
-
if (typeof document !== 'undefined') {
|
|
50
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
51
51
|
// Browser
|
|
52
52
|
return window.fetch;
|
|
53
53
|
}
|