@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
|
@@ -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
|
|
|
@@ -1909,7 +1912,7 @@ class Contact {
|
|
|
1909
1912
|
this[key] = old[key] || this[key];
|
|
1910
1913
|
});
|
|
1911
1914
|
|
|
1912
|
-
if (old.lineState
|
|
1915
|
+
if (old.lineState) {
|
|
1913
1916
|
this.lineState = old.lineState;
|
|
1914
1917
|
}
|
|
1915
1918
|
|
|
@@ -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
|
|
|
@@ -1245,7 +1248,7 @@ class Contact {
|
|
|
1245
1248
|
this[key] = old[key] || this[key];
|
|
1246
1249
|
});
|
|
1247
1250
|
|
|
1248
|
-
if (old.lineState
|
|
1251
|
+
if (old.lineState) {
|
|
1249
1252
|
this.lineState = old.lineState;
|
|
1250
1253
|
}
|
|
1251
1254
|
|
|
@@ -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,12 +8139,14 @@ class WebRTCClient extends Emitter {
|
|
|
8140
8139
|
|
|
8141
8140
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8142
8141
|
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
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
|
+
}
|
|
8149
8150
|
|
|
8150
8151
|
if (withEvent) {
|
|
8151
8152
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8355,13 +8356,17 @@ class WebRTCClient extends Emitter {
|
|
|
8355
8356
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8356
8357
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8357
8358
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8359
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8358
8360
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8359
8361
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8362
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8360
8363
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8361
8364
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8362
8365
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8363
|
-
let audioBytesSent = 0;
|
|
8364
|
-
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;
|
|
8365
8370
|
let videoBytesSent = 0;
|
|
8366
8371
|
let videoBytesReceived = 0;
|
|
8367
8372
|
let transportSent = 0;
|
|
@@ -8370,25 +8375,27 @@ class WebRTCClient extends Emitter {
|
|
|
8370
8375
|
|
|
8371
8376
|
stats.forEach(report => {
|
|
8372
8377
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8373
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8378
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8379
|
+
audioContentSent += Number(report.bytesSent);
|
|
8374
8380
|
}
|
|
8375
8381
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8376
|
-
audioBytesSent += report.bytesSent;
|
|
8382
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8377
8383
|
}
|
|
8378
8384
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8379
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8385
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8380
8386
|
}
|
|
8381
8387
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8382
|
-
packetsLost += report.packetsLost;
|
|
8383
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8384
|
-
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);
|
|
8385
8392
|
}
|
|
8386
8393
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8387
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8394
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8388
8395
|
}
|
|
8389
8396
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8390
8397
|
if ('framesPerSecond' in report) {
|
|
8391
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8398
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8392
8399
|
}
|
|
8393
8400
|
if ('framerateMean' in report) {
|
|
8394
8401
|
// framerateMean is only available in FF
|
|
@@ -8396,24 +8403,31 @@ class WebRTCClient extends Emitter {
|
|
|
8396
8403
|
}
|
|
8397
8404
|
}
|
|
8398
8405
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8399
|
-
packetsLost += report.packetsLost;
|
|
8400
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8401
|
-
networkStats.jitter = report.jitter;
|
|
8406
|
+
packetsLost += Number(report.packetsLost);
|
|
8407
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8408
|
+
networkStats.jitter = Number(report.jitter);
|
|
8402
8409
|
}
|
|
8403
8410
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8404
|
-
packetsLost += report.packetsLost;
|
|
8411
|
+
packetsLost += Number(report.packetsLost);
|
|
8405
8412
|
}
|
|
8406
8413
|
if (report.type === 'transport') {
|
|
8407
|
-
transportSent += report.bytesSent;
|
|
8408
|
-
transportReceived += report.bytesReceived;
|
|
8414
|
+
transportSent += Number(report.bytesSent);
|
|
8415
|
+
transportReceived += Number(report.bytesReceived);
|
|
8409
8416
|
}
|
|
8410
8417
|
});
|
|
8411
8418
|
|
|
8412
8419
|
networkStats.packetsLost = packetsLost;
|
|
8420
|
+
|
|
8413
8421
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8414
8422
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8415
8423
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8416
8424
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8425
|
+
|
|
8426
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8427
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8428
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8429
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8430
|
+
|
|
8417
8431
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8418
8432
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8419
8433
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8625,6 +8639,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8625
8639
|
constraints,
|
|
8626
8640
|
audioOnly,
|
|
8627
8641
|
conference,
|
|
8642
|
+
iceRestart,
|
|
8628
8643
|
});
|
|
8629
8644
|
|
|
8630
8645
|
if (!sipSession) {
|
|
@@ -8728,6 +8743,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8728
8743
|
|
|
8729
8744
|
this.client.downgradeToAudio(sipSession);
|
|
8730
8745
|
|
|
8746
|
+
if (callSession) {
|
|
8747
|
+
callSession.cameraEnabled = false;
|
|
8748
|
+
this._updateCallSession(callSession);
|
|
8749
|
+
}
|
|
8750
|
+
|
|
8731
8751
|
if (withMessage) {
|
|
8732
8752
|
this._sendReinviteMessage(callSession, false);
|
|
8733
8753
|
}
|
|
@@ -8755,6 +8775,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8755
8775
|
|
|
8756
8776
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
8757
8777
|
|
|
8778
|
+
if (callSession) {
|
|
8779
|
+
callSession.cameraEnabled = true;
|
|
8780
|
+
this._updateCallSession(callSession);
|
|
8781
|
+
}
|
|
8782
|
+
|
|
8758
8783
|
// If no stream is returned, it means we have to reinvite
|
|
8759
8784
|
if (!newStream) {
|
|
8760
8785
|
return true;
|
|
@@ -8991,18 +9016,20 @@ class WebRTCPhone extends Emitter {
|
|
|
8991
9016
|
screenTrack,
|
|
8992
9017
|
});
|
|
8993
9018
|
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
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
|
+
});
|
|
9000
9026
|
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9027
|
+
this.eventEmitter.emit(
|
|
9028
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9029
|
+
this._createCallSession(sipSession, callSession),
|
|
9030
|
+
);
|
|
9031
|
+
};
|
|
9032
|
+
}
|
|
9006
9033
|
|
|
9007
9034
|
this.currentScreenShare = {
|
|
9008
9035
|
stream: screenStream,
|
|
@@ -9022,7 +9049,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9022
9049
|
}
|
|
9023
9050
|
|
|
9024
9051
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9025
|
-
logger$8.info('WebRTC phone -
|
|
9052
|
+
logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9026
9053
|
|
|
9027
9054
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9028
9055
|
this.currentSipSession = sipSession;
|
|
@@ -9534,7 +9561,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9534
9561
|
// @TODO: line is not used here
|
|
9535
9562
|
async makeCall(number , line , cameraEnabled ,
|
|
9536
9563
|
audioOnly = false, conference = false) {
|
|
9537
|
-
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 });
|
|
9538
9565
|
if (!number) {
|
|
9539
9566
|
return Promise.resolve(null);
|
|
9540
9567
|
}
|
|
@@ -9895,9 +9922,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9895
9922
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
9896
9923
|
&& this.currentSipSession.state === sessionState.SessionState.Established) {
|
|
9897
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
|
+
|
|
9898
9929
|
try {
|
|
9899
9930
|
// Send reinvite with iceRestart
|
|
9900
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
9931
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
9901
9932
|
} catch (e) {
|
|
9902
9933
|
logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
9903
9934
|
}
|
|
@@ -9981,6 +10012,15 @@ class WebRTCPhone extends Emitter {
|
|
|
9981
10012
|
return this.client.getSipSessionId(sipSession);
|
|
9982
10013
|
}
|
|
9983
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
|
+
|
|
9984
10024
|
_onMessage(message ) {
|
|
9985
10025
|
if (!message || message.method !== 'MESSAGE') {
|
|
9986
10026
|
return;
|