@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
|
@@ -1539,6 +1539,9 @@ class Contact {
|
|
|
1539
1539
|
}
|
|
1540
1540
|
|
|
1541
1541
|
static parseMany(response ) {
|
|
1542
|
+
if (!response || !response.results) {
|
|
1543
|
+
return [];
|
|
1544
|
+
}
|
|
1542
1545
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1543
1546
|
}
|
|
1544
1547
|
|
|
@@ -2616,8 +2619,9 @@ class ExternalApp {
|
|
|
2616
2619
|
|
|
2617
2620
|
|
|
2618
2621
|
|
|
2619
|
-
|
|
2622
|
+
|
|
2620
2623
|
|
|
2624
|
+
|
|
2621
2625
|
|
|
2622
2626
|
|
|
2623
2627
|
class Meeting {
|
|
@@ -2628,9 +2632,10 @@ class Meeting {
|
|
|
2628
2632
|
|
|
2629
2633
|
|
|
2630
2634
|
|
|
2631
|
-
|
|
2635
|
+
|
|
2632
2636
|
|
|
2633
2637
|
|
|
2638
|
+
|
|
2634
2639
|
|
|
2635
2640
|
static parse(plain ) {
|
|
2636
2641
|
return new Meeting({
|
|
@@ -2640,12 +2645,16 @@ class Meeting {
|
|
|
2640
2645
|
ownerUuids: plain.owner_uuids,
|
|
2641
2646
|
port: plain.port,
|
|
2642
2647
|
uuid: plain.uuid,
|
|
2643
|
-
|
|
2648
|
+
extension: plain.exten,
|
|
2644
2649
|
persistent: plain.persistent,
|
|
2650
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2645
2651
|
});
|
|
2646
2652
|
}
|
|
2647
2653
|
|
|
2648
2654
|
static parseMany(items ) {
|
|
2655
|
+
if (!items) {
|
|
2656
|
+
return [];
|
|
2657
|
+
}
|
|
2649
2658
|
return items.map(plain => Meeting.parse(plain));
|
|
2650
2659
|
}
|
|
2651
2660
|
|
|
@@ -2660,8 +2669,9 @@ class Meeting {
|
|
|
2660
2669
|
ownerUuids,
|
|
2661
2670
|
port,
|
|
2662
2671
|
uri,
|
|
2663
|
-
|
|
2672
|
+
extension,
|
|
2664
2673
|
persistent,
|
|
2674
|
+
creationTime,
|
|
2665
2675
|
} = {}) {
|
|
2666
2676
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2667
2677
|
this.uri = uri;
|
|
@@ -2669,8 +2679,9 @@ class Meeting {
|
|
|
2669
2679
|
this.ownerUuids = ownerUuids;
|
|
2670
2680
|
this.port = port;
|
|
2671
2681
|
this.uuid = uuid;
|
|
2672
|
-
this.
|
|
2682
|
+
this.extension = extension;
|
|
2673
2683
|
this.persistent = persistent;
|
|
2684
|
+
this.creationTime = creationTime;
|
|
2674
2685
|
|
|
2675
2686
|
// Useful to compare instead of instanceof with minified code
|
|
2676
2687
|
this.type = 'Meeting';
|
|
@@ -2848,6 +2859,10 @@ class ChatMessage {
|
|
|
2848
2859
|
|
|
2849
2860
|
|
|
2850
2861
|
static parseMany(plain ) {
|
|
2862
|
+
if (!plain || !plain.items) {
|
|
2863
|
+
return [];
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2851
2866
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2852
2867
|
}
|
|
2853
2868
|
|
|
@@ -2957,6 +2972,9 @@ class Voicemail {
|
|
|
2957
2972
|
}
|
|
2958
2973
|
|
|
2959
2974
|
static parseMany(plain ) {
|
|
2975
|
+
if (!plain) {
|
|
2976
|
+
return [];
|
|
2977
|
+
}
|
|
2960
2978
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2961
2979
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2962
2980
|
|
|
@@ -3066,6 +3084,9 @@ class Call {
|
|
|
3066
3084
|
|
|
3067
3085
|
|
|
3068
3086
|
static parseMany(plain ) {
|
|
3087
|
+
if (!plain) {
|
|
3088
|
+
return [];
|
|
3089
|
+
}
|
|
3069
3090
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3070
3091
|
}
|
|
3071
3092
|
|
|
@@ -3238,6 +3259,9 @@ class Recording {
|
|
|
3238
3259
|
|
|
3239
3260
|
|
|
3240
3261
|
static parseMany(recordings = []) {
|
|
3262
|
+
if (!recordings) {
|
|
3263
|
+
return [];
|
|
3264
|
+
}
|
|
3241
3265
|
return recordings.map(item => Recording.parse(item));
|
|
3242
3266
|
}
|
|
3243
3267
|
|
|
@@ -3339,6 +3363,10 @@ class CallLog {
|
|
|
3339
3363
|
}
|
|
3340
3364
|
|
|
3341
3365
|
static parseMany(plain ) {
|
|
3366
|
+
if (!plain || !plain.items) {
|
|
3367
|
+
return [];
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3342
3370
|
return plain.items.map(item => CallLog.parse(item));
|
|
3343
3371
|
}
|
|
3344
3372
|
|
|
@@ -3896,6 +3924,9 @@ class ChatRoom {
|
|
|
3896
3924
|
|
|
3897
3925
|
|
|
3898
3926
|
static parseMany(plain ) {
|
|
3927
|
+
if (!plain || !plain.items) {
|
|
3928
|
+
return [];
|
|
3929
|
+
}
|
|
3899
3930
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3900
3931
|
}
|
|
3901
3932
|
|
package/lib/simple/Auth.js
CHANGED
|
@@ -875,6 +875,9 @@ class Contact {
|
|
|
875
875
|
}
|
|
876
876
|
|
|
877
877
|
static parseMany(response ) {
|
|
878
|
+
if (!response || !response.results) {
|
|
879
|
+
return [];
|
|
880
|
+
}
|
|
878
881
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
879
882
|
}
|
|
880
883
|
|
|
@@ -2639,8 +2642,9 @@ class ExternalApp {
|
|
|
2639
2642
|
|
|
2640
2643
|
|
|
2641
2644
|
|
|
2642
|
-
|
|
2645
|
+
|
|
2643
2646
|
|
|
2647
|
+
|
|
2644
2648
|
|
|
2645
2649
|
|
|
2646
2650
|
class Meeting {
|
|
@@ -2651,9 +2655,10 @@ class Meeting {
|
|
|
2651
2655
|
|
|
2652
2656
|
|
|
2653
2657
|
|
|
2654
|
-
|
|
2658
|
+
|
|
2655
2659
|
|
|
2656
2660
|
|
|
2661
|
+
|
|
2657
2662
|
|
|
2658
2663
|
static parse(plain ) {
|
|
2659
2664
|
return new Meeting({
|
|
@@ -2663,12 +2668,16 @@ class Meeting {
|
|
|
2663
2668
|
ownerUuids: plain.owner_uuids,
|
|
2664
2669
|
port: plain.port,
|
|
2665
2670
|
uuid: plain.uuid,
|
|
2666
|
-
|
|
2671
|
+
extension: plain.exten,
|
|
2667
2672
|
persistent: plain.persistent,
|
|
2673
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2668
2674
|
});
|
|
2669
2675
|
}
|
|
2670
2676
|
|
|
2671
2677
|
static parseMany(items ) {
|
|
2678
|
+
if (!items) {
|
|
2679
|
+
return [];
|
|
2680
|
+
}
|
|
2672
2681
|
return items.map(plain => Meeting.parse(plain));
|
|
2673
2682
|
}
|
|
2674
2683
|
|
|
@@ -2683,8 +2692,9 @@ class Meeting {
|
|
|
2683
2692
|
ownerUuids,
|
|
2684
2693
|
port,
|
|
2685
2694
|
uri,
|
|
2686
|
-
|
|
2695
|
+
extension,
|
|
2687
2696
|
persistent,
|
|
2697
|
+
creationTime,
|
|
2688
2698
|
} = {}) {
|
|
2689
2699
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2690
2700
|
this.uri = uri;
|
|
@@ -2692,8 +2702,9 @@ class Meeting {
|
|
|
2692
2702
|
this.ownerUuids = ownerUuids;
|
|
2693
2703
|
this.port = port;
|
|
2694
2704
|
this.uuid = uuid;
|
|
2695
|
-
this.
|
|
2705
|
+
this.extension = extension;
|
|
2696
2706
|
this.persistent = persistent;
|
|
2707
|
+
this.creationTime = creationTime;
|
|
2697
2708
|
|
|
2698
2709
|
// Useful to compare instead of instanceof with minified code
|
|
2699
2710
|
this.type = 'Meeting';
|
|
@@ -2871,6 +2882,10 @@ class ChatMessage {
|
|
|
2871
2882
|
|
|
2872
2883
|
|
|
2873
2884
|
static parseMany(plain ) {
|
|
2885
|
+
if (!plain || !plain.items) {
|
|
2886
|
+
return [];
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2874
2889
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2875
2890
|
}
|
|
2876
2891
|
|
|
@@ -2980,6 +2995,9 @@ class Voicemail {
|
|
|
2980
2995
|
}
|
|
2981
2996
|
|
|
2982
2997
|
static parseMany(plain ) {
|
|
2998
|
+
if (!plain) {
|
|
2999
|
+
return [];
|
|
3000
|
+
}
|
|
2983
3001
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2984
3002
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2985
3003
|
|
|
@@ -3089,6 +3107,9 @@ class Call {
|
|
|
3089
3107
|
|
|
3090
3108
|
|
|
3091
3109
|
static parseMany(plain ) {
|
|
3110
|
+
if (!plain) {
|
|
3111
|
+
return [];
|
|
3112
|
+
}
|
|
3092
3113
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3093
3114
|
}
|
|
3094
3115
|
|
|
@@ -3632,6 +3653,9 @@ class Recording {
|
|
|
3632
3653
|
|
|
3633
3654
|
|
|
3634
3655
|
static parseMany(recordings = []) {
|
|
3656
|
+
if (!recordings) {
|
|
3657
|
+
return [];
|
|
3658
|
+
}
|
|
3635
3659
|
return recordings.map(item => Recording.parse(item));
|
|
3636
3660
|
}
|
|
3637
3661
|
|
|
@@ -3733,6 +3757,10 @@ class CallLog {
|
|
|
3733
3757
|
}
|
|
3734
3758
|
|
|
3735
3759
|
static parseMany(plain ) {
|
|
3760
|
+
if (!plain || !plain.items) {
|
|
3761
|
+
return [];
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3736
3764
|
return plain.items.map(item => CallLog.parse(item));
|
|
3737
3765
|
}
|
|
3738
3766
|
|
|
@@ -4302,6 +4330,10 @@ class CTIPhone extends Emitter {
|
|
|
4302
4330
|
return false;
|
|
4303
4331
|
}
|
|
4304
4332
|
|
|
4333
|
+
hasAVideoTrack() {
|
|
4334
|
+
return false;
|
|
4335
|
+
}
|
|
4336
|
+
|
|
4305
4337
|
getLocalStreamForCall() {
|
|
4306
4338
|
return null;
|
|
4307
4339
|
}
|
|
@@ -4695,6 +4727,9 @@ class ChatRoom {
|
|
|
4695
4727
|
|
|
4696
4728
|
|
|
4697
4729
|
static parseMany(plain ) {
|
|
4730
|
+
if (!plain || !plain.items) {
|
|
4731
|
+
return [];
|
|
4732
|
+
}
|
|
4698
4733
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4699
4734
|
}
|
|
4700
4735
|
|
|
@@ -5676,10 +5711,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5676
5711
|
candidates
|
|
5677
5712
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5678
5713
|
|
|
5679
|
-
const areCandidateValid = (candidates ) =>
|
|
5680
|
-
getSrflxOrRelay(candidates)
|
|
5681
|
-
.length > 0;
|
|
5682
|
-
|
|
5683
5714
|
const getVideoDirection = (sdp ) => {
|
|
5684
5715
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5685
5716
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5732,8 +5763,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5732
5763
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5733
5764
|
|
|
5734
5765
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5735
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5736
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5737
5766
|
|
|
5738
5767
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5739
5768
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -5923,38 +5952,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5923
5952
|
this._peerConnection = undefined;
|
|
5924
5953
|
}
|
|
5925
5954
|
|
|
5926
|
-
async _waitForValidGatheredIce() {
|
|
5927
|
-
let tries = 0;
|
|
5928
|
-
|
|
5929
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
5930
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
5931
|
-
tries,
|
|
5932
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
5933
|
-
});
|
|
5934
|
-
|
|
5935
|
-
tries++;
|
|
5936
|
-
|
|
5937
|
-
// eslint-disable-next-line no-await-in-loop
|
|
5938
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
5939
|
-
}
|
|
5940
|
-
|
|
5941
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
5942
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
5943
|
-
const error = new Error(errorMsg);
|
|
5944
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
5945
|
-
|
|
5946
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
5947
|
-
this.eventEmitter.emit('error', error);
|
|
5948
|
-
|
|
5949
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5950
|
-
}
|
|
5951
|
-
|
|
5952
|
-
// eslint-disable-next-line
|
|
5953
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5954
|
-
|
|
5955
|
-
return this.getLocalSessionDescription();
|
|
5956
|
-
}
|
|
5957
|
-
|
|
5958
5955
|
// Overridden to send `inactive` in conference
|
|
5959
5956
|
updateDirection(options , isConference = false,
|
|
5960
5957
|
audioOnly = false) {
|
|
@@ -6722,7 +6719,7 @@ class WebRTCClient extends Emitter {
|
|
|
6722
6719
|
}
|
|
6723
6720
|
|
|
6724
6721
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6725
|
-
logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6722
|
+
logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6726
6723
|
const inviterOptions = {
|
|
6727
6724
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6728
6725
|
conference,
|
|
@@ -7798,6 +7795,7 @@ class WebRTCClient extends Emitter {
|
|
|
7798
7795
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7799
7796
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7800
7797
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7798
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7801
7799
|
|
|
7802
7800
|
logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7803
7801
|
|
|
@@ -7805,7 +7803,8 @@ class WebRTCClient extends Emitter {
|
|
|
7805
7803
|
constraints: {
|
|
7806
7804
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7807
7805
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7808
|
-
video: screenSharing ? (isDesktop
|
|
7806
|
+
video: screenSharing ? (isDesktop
|
|
7807
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7809
7808
|
: this._getVideoConstraints(enableVideo),
|
|
7810
7809
|
screen: screenSharing,
|
|
7811
7810
|
desktop: isDesktop,
|
|
@@ -8140,11 +8139,14 @@ class WebRTCClient extends Emitter {
|
|
|
8140
8139
|
|
|
8141
8140
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8142
8141
|
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8142
|
+
if (pc) {
|
|
8143
|
+
pc.oniceconnectionstatechange = () => {
|
|
8144
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8145
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8146
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8147
|
+
}
|
|
8148
|
+
};
|
|
8149
|
+
}
|
|
8148
8150
|
|
|
8149
8151
|
if (withEvent) {
|
|
8150
8152
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8354,13 +8356,17 @@ class WebRTCClient extends Emitter {
|
|
|
8354
8356
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8355
8357
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8356
8358
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8359
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8357
8360
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8358
8361
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8362
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8359
8363
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8360
8364
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8361
8365
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8362
|
-
let audioBytesSent = 0;
|
|
8363
|
-
let audioBytesReceived = 0;
|
|
8366
|
+
let audioBytesSent = 0; // content + header
|
|
8367
|
+
let audioBytesReceived = 0; // content + header
|
|
8368
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8369
|
+
let audioContentReceived = 0;
|
|
8364
8370
|
let videoBytesSent = 0;
|
|
8365
8371
|
let videoBytesReceived = 0;
|
|
8366
8372
|
let transportSent = 0;
|
|
@@ -8369,25 +8375,27 @@ class WebRTCClient extends Emitter {
|
|
|
8369
8375
|
|
|
8370
8376
|
stats.forEach(report => {
|
|
8371
8377
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8372
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8378
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8379
|
+
audioContentSent += Number(report.bytesSent);
|
|
8373
8380
|
}
|
|
8374
8381
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8375
|
-
audioBytesSent += report.bytesSent;
|
|
8382
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8376
8383
|
}
|
|
8377
8384
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8378
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8385
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8379
8386
|
}
|
|
8380
8387
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8381
|
-
packetsLost += report.packetsLost;
|
|
8382
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8383
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8388
|
+
packetsLost += Number(report.packetsLost);
|
|
8389
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8390
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8391
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8384
8392
|
}
|
|
8385
8393
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8386
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8394
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8387
8395
|
}
|
|
8388
8396
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8389
8397
|
if ('framesPerSecond' in report) {
|
|
8390
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8398
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8391
8399
|
}
|
|
8392
8400
|
if ('framerateMean' in report) {
|
|
8393
8401
|
// framerateMean is only available in FF
|
|
@@ -8395,24 +8403,31 @@ class WebRTCClient extends Emitter {
|
|
|
8395
8403
|
}
|
|
8396
8404
|
}
|
|
8397
8405
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8398
|
-
packetsLost += report.packetsLost;
|
|
8399
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8400
|
-
networkStats.jitter = report.jitter;
|
|
8406
|
+
packetsLost += Number(report.packetsLost);
|
|
8407
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8408
|
+
networkStats.jitter = Number(report.jitter);
|
|
8401
8409
|
}
|
|
8402
8410
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8403
|
-
packetsLost += report.packetsLost;
|
|
8411
|
+
packetsLost += Number(report.packetsLost);
|
|
8404
8412
|
}
|
|
8405
8413
|
if (report.type === 'transport') {
|
|
8406
|
-
transportSent += report.bytesSent;
|
|
8407
|
-
transportReceived += report.bytesReceived;
|
|
8414
|
+
transportSent += Number(report.bytesSent);
|
|
8415
|
+
transportReceived += Number(report.bytesReceived);
|
|
8408
8416
|
}
|
|
8409
8417
|
});
|
|
8410
8418
|
|
|
8411
8419
|
networkStats.packetsLost = packetsLost;
|
|
8420
|
+
|
|
8412
8421
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8413
8422
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8414
8423
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8415
8424
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8425
|
+
|
|
8426
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8427
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8428
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8429
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8430
|
+
|
|
8416
8431
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8417
8432
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8418
8433
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8624,6 +8639,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8624
8639
|
constraints,
|
|
8625
8640
|
audioOnly,
|
|
8626
8641
|
conference,
|
|
8642
|
+
iceRestart,
|
|
8627
8643
|
});
|
|
8628
8644
|
|
|
8629
8645
|
if (!sipSession) {
|
|
@@ -8727,6 +8743,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8727
8743
|
|
|
8728
8744
|
this.client.downgradeToAudio(sipSession);
|
|
8729
8745
|
|
|
8746
|
+
if (callSession) {
|
|
8747
|
+
callSession.cameraEnabled = false;
|
|
8748
|
+
this._updateCallSession(callSession);
|
|
8749
|
+
}
|
|
8750
|
+
|
|
8730
8751
|
if (withMessage) {
|
|
8731
8752
|
this._sendReinviteMessage(callSession, false);
|
|
8732
8753
|
}
|
|
@@ -8754,6 +8775,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8754
8775
|
|
|
8755
8776
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
8756
8777
|
|
|
8778
|
+
if (callSession) {
|
|
8779
|
+
callSession.cameraEnabled = true;
|
|
8780
|
+
this._updateCallSession(callSession);
|
|
8781
|
+
}
|
|
8782
|
+
|
|
8757
8783
|
// If no stream is returned, it means we have to reinvite
|
|
8758
8784
|
if (!newStream) {
|
|
8759
8785
|
return true;
|
|
@@ -8806,7 +8832,10 @@ class WebRTCPhone extends Emitter {
|
|
|
8806
8832
|
|
|
8807
8833
|
onCancel(message);
|
|
8808
8834
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
8809
|
-
|
|
8835
|
+
const callSession = this._createCallSession(sipSession);
|
|
8836
|
+
delete this.callSessions[callSession.getId()];
|
|
8837
|
+
|
|
8838
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
8810
8839
|
};
|
|
8811
8840
|
} else if (sipSession instanceof invitation.Invitation) {
|
|
8812
8841
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -8987,18 +9016,20 @@ class WebRTCPhone extends Emitter {
|
|
|
8987
9016
|
screenTrack,
|
|
8988
9017
|
});
|
|
8989
9018
|
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
9019
|
+
if (screenTrack) {
|
|
9020
|
+
screenTrack.onended = () => {
|
|
9021
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
9022
|
+
hadVideo,
|
|
9023
|
+
id: this.getSipSessionId(sipSession),
|
|
9024
|
+
screenTrack,
|
|
9025
|
+
});
|
|
8996
9026
|
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9027
|
+
this.eventEmitter.emit(
|
|
9028
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9029
|
+
this._createCallSession(sipSession, callSession),
|
|
9030
|
+
);
|
|
9031
|
+
};
|
|
9032
|
+
}
|
|
9002
9033
|
|
|
9003
9034
|
this.currentScreenShare = {
|
|
9004
9035
|
stream: screenStream,
|
|
@@ -9018,7 +9049,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9018
9049
|
}
|
|
9019
9050
|
|
|
9020
9051
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9021
|
-
logger$8.info('WebRTC phone -
|
|
9052
|
+
logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9022
9053
|
|
|
9023
9054
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9024
9055
|
this.currentSipSession = sipSession;
|
|
@@ -9530,7 +9561,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9530
9561
|
// @TODO: line is not used here
|
|
9531
9562
|
async makeCall(number , line , cameraEnabled ,
|
|
9532
9563
|
audioOnly = false, conference = false) {
|
|
9533
|
-
logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
|
|
9564
|
+
logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9534
9565
|
if (!number) {
|
|
9535
9566
|
return Promise.resolve(null);
|
|
9536
9567
|
}
|
|
@@ -9891,9 +9922,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9891
9922
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
9892
9923
|
&& this.currentSipSession.state === sessionState.SessionState.Established) {
|
|
9893
9924
|
this.shouldSendReinvite = false;
|
|
9925
|
+
const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
9926
|
+
const isConference = pc ? pc.sfu : false;
|
|
9927
|
+
const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
|
|
9928
|
+
|
|
9894
9929
|
try {
|
|
9895
9930
|
// Send reinvite with iceRestart
|
|
9896
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
9931
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
9897
9932
|
} catch (e) {
|
|
9898
9933
|
logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
9899
9934
|
}
|
|
@@ -9977,6 +10012,15 @@ class WebRTCPhone extends Emitter {
|
|
|
9977
10012
|
return this.client.getSipSessionId(sipSession);
|
|
9978
10013
|
}
|
|
9979
10014
|
|
|
10015
|
+
_updateCallSession(callSession ) {
|
|
10016
|
+
const sipSession = this.findSipSession(callSession);
|
|
10017
|
+
const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
|
|
10018
|
+
|
|
10019
|
+
if (sipSessionId) {
|
|
10020
|
+
this.callSessions[sipSessionId] = callSession;
|
|
10021
|
+
}
|
|
10022
|
+
}
|
|
10023
|
+
|
|
9980
10024
|
_onMessage(message ) {
|
|
9981
10025
|
if (!message || message.method !== 'MESSAGE') {
|
|
9982
10026
|
return;
|