@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
|
@@ -76,6 +76,9 @@ class Call {
|
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
static parseMany(plain ) {
|
|
79
|
+
if (!plain) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
79
82
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
80
83
|
}
|
|
81
84
|
|
|
@@ -1737,6 +1740,9 @@ class Contact {
|
|
|
1737
1740
|
}
|
|
1738
1741
|
|
|
1739
1742
|
static parseMany(response ) {
|
|
1743
|
+
if (!response || !response.results) {
|
|
1744
|
+
return [];
|
|
1745
|
+
}
|
|
1740
1746
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1741
1747
|
}
|
|
1742
1748
|
|
|
@@ -2107,7 +2113,7 @@ class Contact {
|
|
|
2107
2113
|
this[key] = old[key] || this[key];
|
|
2108
2114
|
});
|
|
2109
2115
|
|
|
2110
|
-
if (old.lineState
|
|
2116
|
+
if (old.lineState) {
|
|
2111
2117
|
this.lineState = old.lineState;
|
|
2112
2118
|
}
|
|
2113
2119
|
|
|
@@ -2814,8 +2820,9 @@ class ExternalApp {
|
|
|
2814
2820
|
|
|
2815
2821
|
|
|
2816
2822
|
|
|
2817
|
-
|
|
2823
|
+
|
|
2818
2824
|
|
|
2825
|
+
|
|
2819
2826
|
|
|
2820
2827
|
|
|
2821
2828
|
class Meeting {
|
|
@@ -2826,9 +2833,10 @@ class Meeting {
|
|
|
2826
2833
|
|
|
2827
2834
|
|
|
2828
2835
|
|
|
2829
|
-
|
|
2836
|
+
|
|
2830
2837
|
|
|
2831
2838
|
|
|
2839
|
+
|
|
2832
2840
|
|
|
2833
2841
|
static parse(plain ) {
|
|
2834
2842
|
return new Meeting({
|
|
@@ -2838,12 +2846,16 @@ class Meeting {
|
|
|
2838
2846
|
ownerUuids: plain.owner_uuids,
|
|
2839
2847
|
port: plain.port,
|
|
2840
2848
|
uuid: plain.uuid,
|
|
2841
|
-
|
|
2849
|
+
extension: plain.exten,
|
|
2842
2850
|
persistent: plain.persistent,
|
|
2851
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
2843
2852
|
});
|
|
2844
2853
|
}
|
|
2845
2854
|
|
|
2846
2855
|
static parseMany(items ) {
|
|
2856
|
+
if (!items) {
|
|
2857
|
+
return [];
|
|
2858
|
+
}
|
|
2847
2859
|
return items.map(plain => Meeting.parse(plain));
|
|
2848
2860
|
}
|
|
2849
2861
|
|
|
@@ -2858,8 +2870,9 @@ class Meeting {
|
|
|
2858
2870
|
ownerUuids,
|
|
2859
2871
|
port,
|
|
2860
2872
|
uri,
|
|
2861
|
-
|
|
2873
|
+
extension,
|
|
2862
2874
|
persistent,
|
|
2875
|
+
creationTime,
|
|
2863
2876
|
} = {}) {
|
|
2864
2877
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2865
2878
|
this.uri = uri;
|
|
@@ -2867,8 +2880,9 @@ class Meeting {
|
|
|
2867
2880
|
this.ownerUuids = ownerUuids;
|
|
2868
2881
|
this.port = port;
|
|
2869
2882
|
this.uuid = uuid;
|
|
2870
|
-
this.
|
|
2883
|
+
this.extension = extension;
|
|
2871
2884
|
this.persistent = persistent;
|
|
2885
|
+
this.creationTime = creationTime;
|
|
2872
2886
|
|
|
2873
2887
|
// Useful to compare instead of instanceof with minified code
|
|
2874
2888
|
this.type = 'Meeting';
|
|
@@ -3046,6 +3060,10 @@ class ChatMessage {
|
|
|
3046
3060
|
|
|
3047
3061
|
|
|
3048
3062
|
static parseMany(plain ) {
|
|
3063
|
+
if (!plain || !plain.items) {
|
|
3064
|
+
return [];
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3049
3067
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3050
3068
|
}
|
|
3051
3069
|
|
|
@@ -3155,6 +3173,9 @@ class Voicemail {
|
|
|
3155
3173
|
}
|
|
3156
3174
|
|
|
3157
3175
|
static parseMany(plain ) {
|
|
3176
|
+
if (!plain) {
|
|
3177
|
+
return [];
|
|
3178
|
+
}
|
|
3158
3179
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3159
3180
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3160
3181
|
|
|
@@ -3230,6 +3251,9 @@ class Recording {
|
|
|
3230
3251
|
|
|
3231
3252
|
|
|
3232
3253
|
static parseMany(recordings = []) {
|
|
3254
|
+
if (!recordings) {
|
|
3255
|
+
return [];
|
|
3256
|
+
}
|
|
3233
3257
|
return recordings.map(item => Recording.parse(item));
|
|
3234
3258
|
}
|
|
3235
3259
|
|
|
@@ -3331,6 +3355,10 @@ class CallLog {
|
|
|
3331
3355
|
}
|
|
3332
3356
|
|
|
3333
3357
|
static parseMany(plain ) {
|
|
3358
|
+
if (!plain || !plain.items) {
|
|
3359
|
+
return [];
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3334
3362
|
return plain.items.map(item => CallLog.parse(item));
|
|
3335
3363
|
}
|
|
3336
3364
|
|
|
@@ -3888,6 +3916,9 @@ class ChatRoom {
|
|
|
3888
3916
|
|
|
3889
3917
|
|
|
3890
3918
|
static parseMany(plain ) {
|
|
3919
|
+
if (!plain || !plain.items) {
|
|
3920
|
+
return [];
|
|
3921
|
+
}
|
|
3891
3922
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3892
3923
|
}
|
|
3893
3924
|
|
package/esm/domain/Call.js
CHANGED
package/esm/domain/CallLog.js
CHANGED
|
@@ -54,6 +54,9 @@ class Recording {
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
static parseMany(recordings = []) {
|
|
57
|
+
if (!recordings) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
57
60
|
return recordings.map(item => Recording.parse(item));
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -155,6 +158,10 @@ class CallLog {
|
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
static parseMany(plain ) {
|
|
161
|
+
if (!plain || !plain.items) {
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
|
|
158
165
|
return plain.items.map(item => CallLog.parse(item));
|
|
159
166
|
}
|
|
160
167
|
|
package/esm/domain/ChatRoom.js
CHANGED
package/esm/domain/Contact.js
CHANGED
|
@@ -325,6 +325,9 @@ class Contact {
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
static parseMany(response ) {
|
|
328
|
+
if (!response || !response.results) {
|
|
329
|
+
return [];
|
|
330
|
+
}
|
|
328
331
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
329
332
|
}
|
|
330
333
|
|
|
@@ -695,7 +698,7 @@ class Contact {
|
|
|
695
698
|
this[key] = old[key] || this[key];
|
|
696
699
|
});
|
|
697
700
|
|
|
698
|
-
if (old.lineState
|
|
701
|
+
if (old.lineState) {
|
|
699
702
|
this.lineState = old.lineState;
|
|
700
703
|
}
|
|
701
704
|
|
package/esm/domain/Features.js
CHANGED
|
@@ -1531,6 +1531,9 @@ class Contact {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
|
|
1533
1533
|
static parseMany(response ) {
|
|
1534
|
+
if (!response || !response.results) {
|
|
1535
|
+
return [];
|
|
1536
|
+
}
|
|
1534
1537
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1535
1538
|
}
|
|
1536
1539
|
|
|
@@ -1901,7 +1904,7 @@ class Contact {
|
|
|
1901
1904
|
this[key] = old[key] || this[key];
|
|
1902
1905
|
});
|
|
1903
1906
|
|
|
1904
|
-
if (old.lineState
|
|
1907
|
+
if (old.lineState) {
|
|
1905
1908
|
this.lineState = old.lineState;
|
|
1906
1909
|
}
|
|
1907
1910
|
|
|
@@ -2608,8 +2611,9 @@ class ExternalApp {
|
|
|
2608
2611
|
|
|
2609
2612
|
|
|
2610
2613
|
|
|
2611
|
-
|
|
2614
|
+
|
|
2612
2615
|
|
|
2616
|
+
|
|
2613
2617
|
|
|
2614
2618
|
|
|
2615
2619
|
class Meeting {
|
|
@@ -2620,9 +2624,10 @@ class Meeting {
|
|
|
2620
2624
|
|
|
2621
2625
|
|
|
2622
2626
|
|
|
2623
|
-
|
|
2627
|
+
|
|
2624
2628
|
|
|
2625
2629
|
|
|
2630
|
+
|
|
2626
2631
|
|
|
2627
2632
|
static parse(plain ) {
|
|
2628
2633
|
return new Meeting({
|
|
@@ -2632,12 +2637,16 @@ class Meeting {
|
|
|
2632
2637
|
ownerUuids: plain.owner_uuids,
|
|
2633
2638
|
port: plain.port,
|
|
2634
2639
|
uuid: plain.uuid,
|
|
2635
|
-
|
|
2640
|
+
extension: plain.exten,
|
|
2636
2641
|
persistent: plain.persistent,
|
|
2642
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
2637
2643
|
});
|
|
2638
2644
|
}
|
|
2639
2645
|
|
|
2640
2646
|
static parseMany(items ) {
|
|
2647
|
+
if (!items) {
|
|
2648
|
+
return [];
|
|
2649
|
+
}
|
|
2641
2650
|
return items.map(plain => Meeting.parse(plain));
|
|
2642
2651
|
}
|
|
2643
2652
|
|
|
@@ -2652,8 +2661,9 @@ class Meeting {
|
|
|
2652
2661
|
ownerUuids,
|
|
2653
2662
|
port,
|
|
2654
2663
|
uri,
|
|
2655
|
-
|
|
2664
|
+
extension,
|
|
2656
2665
|
persistent,
|
|
2666
|
+
creationTime,
|
|
2657
2667
|
} = {}) {
|
|
2658
2668
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2659
2669
|
this.uri = uri;
|
|
@@ -2661,8 +2671,9 @@ class Meeting {
|
|
|
2661
2671
|
this.ownerUuids = ownerUuids;
|
|
2662
2672
|
this.port = port;
|
|
2663
2673
|
this.uuid = uuid;
|
|
2664
|
-
this.
|
|
2674
|
+
this.extension = extension;
|
|
2665
2675
|
this.persistent = persistent;
|
|
2676
|
+
this.creationTime = creationTime;
|
|
2666
2677
|
|
|
2667
2678
|
// Useful to compare instead of instanceof with minified code
|
|
2668
2679
|
this.type = 'Meeting';
|
|
@@ -2840,6 +2851,10 @@ class ChatMessage {
|
|
|
2840
2851
|
|
|
2841
2852
|
|
|
2842
2853
|
static parseMany(plain ) {
|
|
2854
|
+
if (!plain || !plain.items) {
|
|
2855
|
+
return [];
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2843
2858
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2844
2859
|
}
|
|
2845
2860
|
|
|
@@ -2949,6 +2964,9 @@ class Voicemail {
|
|
|
2949
2964
|
}
|
|
2950
2965
|
|
|
2951
2966
|
static parseMany(plain ) {
|
|
2967
|
+
if (!plain) {
|
|
2968
|
+
return [];
|
|
2969
|
+
}
|
|
2952
2970
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2953
2971
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2954
2972
|
|
|
@@ -3058,6 +3076,9 @@ class Call {
|
|
|
3058
3076
|
|
|
3059
3077
|
|
|
3060
3078
|
static parseMany(plain ) {
|
|
3079
|
+
if (!plain) {
|
|
3080
|
+
return [];
|
|
3081
|
+
}
|
|
3061
3082
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3062
3083
|
}
|
|
3063
3084
|
|
|
@@ -3230,6 +3251,9 @@ class Recording {
|
|
|
3230
3251
|
|
|
3231
3252
|
|
|
3232
3253
|
static parseMany(recordings = []) {
|
|
3254
|
+
if (!recordings) {
|
|
3255
|
+
return [];
|
|
3256
|
+
}
|
|
3233
3257
|
return recordings.map(item => Recording.parse(item));
|
|
3234
3258
|
}
|
|
3235
3259
|
|
|
@@ -3331,6 +3355,10 @@ class CallLog {
|
|
|
3331
3355
|
}
|
|
3332
3356
|
|
|
3333
3357
|
static parseMany(plain ) {
|
|
3358
|
+
if (!plain || !plain.items) {
|
|
3359
|
+
return [];
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3334
3362
|
return plain.items.map(item => CallLog.parse(item));
|
|
3335
3363
|
}
|
|
3336
3364
|
|
|
@@ -3888,6 +3916,9 @@ class ChatRoom {
|
|
|
3888
3916
|
|
|
3889
3917
|
|
|
3890
3918
|
static parseMany(plain ) {
|
|
3919
|
+
if (!plain || !plain.items) {
|
|
3920
|
+
return [];
|
|
3921
|
+
}
|
|
3891
3922
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3892
3923
|
}
|
|
3893
3924
|
|
package/esm/domain/Meeting.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
|
|
1
3
|
//
|
|
2
4
|
|
|
3
5
|
var newFrom = (instance , ToClass ) => {
|
|
@@ -18,8 +20,9 @@ var newFrom = (instance , ToClass ) => {
|
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
|
|
22
24
|
|
|
25
|
+
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
class Meeting {
|
|
@@ -30,9 +33,10 @@ class Meeting {
|
|
|
30
33
|
|
|
31
34
|
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
|
|
34
37
|
|
|
35
38
|
|
|
39
|
+
|
|
36
40
|
|
|
37
41
|
static parse(plain ) {
|
|
38
42
|
return new Meeting({
|
|
@@ -42,12 +46,16 @@ class Meeting {
|
|
|
42
46
|
ownerUuids: plain.owner_uuids,
|
|
43
47
|
port: plain.port,
|
|
44
48
|
uuid: plain.uuid,
|
|
45
|
-
|
|
49
|
+
extension: plain.exten,
|
|
46
50
|
persistent: plain.persistent,
|
|
51
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
47
52
|
});
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
static parseMany(items ) {
|
|
56
|
+
if (!items) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
51
59
|
return items.map(plain => Meeting.parse(plain));
|
|
52
60
|
}
|
|
53
61
|
|
|
@@ -62,8 +70,9 @@ class Meeting {
|
|
|
62
70
|
ownerUuids,
|
|
63
71
|
port,
|
|
64
72
|
uri,
|
|
65
|
-
|
|
73
|
+
extension,
|
|
66
74
|
persistent,
|
|
75
|
+
creationTime,
|
|
67
76
|
} = {}) {
|
|
68
77
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
69
78
|
this.uri = uri;
|
|
@@ -71,8 +80,9 @@ class Meeting {
|
|
|
71
80
|
this.ownerUuids = ownerUuids;
|
|
72
81
|
this.port = port;
|
|
73
82
|
this.uuid = uuid;
|
|
74
|
-
this.
|
|
83
|
+
this.extension = extension;
|
|
75
84
|
this.persistent = persistent;
|
|
85
|
+
this.creationTime = creationTime;
|
|
76
86
|
|
|
77
87
|
// Useful to compare instead of instanceof with minified code
|
|
78
88
|
this.type = 'Meeting';
|
|
@@ -844,6 +844,9 @@ class Contact {
|
|
|
844
844
|
}
|
|
845
845
|
|
|
846
846
|
static parseMany(response ) {
|
|
847
|
+
if (!response || !response.results) {
|
|
848
|
+
return [];
|
|
849
|
+
}
|
|
847
850
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
848
851
|
}
|
|
849
852
|
|
|
@@ -1214,7 +1217,7 @@ class Contact {
|
|
|
1214
1217
|
this[key] = old[key] || this[key];
|
|
1215
1218
|
});
|
|
1216
1219
|
|
|
1217
|
-
if (old.lineState
|
|
1220
|
+
if (old.lineState) {
|
|
1218
1221
|
this.lineState = old.lineState;
|
|
1219
1222
|
}
|
|
1220
1223
|
|
|
@@ -1550,6 +1553,9 @@ class Call {
|
|
|
1550
1553
|
|
|
1551
1554
|
|
|
1552
1555
|
static parseMany(plain ) {
|
|
1556
|
+
if (!plain) {
|
|
1557
|
+
return [];
|
|
1558
|
+
}
|
|
1553
1559
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
1554
1560
|
}
|
|
1555
1561
|
|
|
@@ -2093,6 +2099,9 @@ class Recording {
|
|
|
2093
2099
|
|
|
2094
2100
|
|
|
2095
2101
|
static parseMany(recordings = []) {
|
|
2102
|
+
if (!recordings) {
|
|
2103
|
+
return [];
|
|
2104
|
+
}
|
|
2096
2105
|
return recordings.map(item => Recording.parse(item));
|
|
2097
2106
|
}
|
|
2098
2107
|
|
|
@@ -2194,6 +2203,10 @@ class CallLog {
|
|
|
2194
2203
|
}
|
|
2195
2204
|
|
|
2196
2205
|
static parseMany(plain ) {
|
|
2206
|
+
if (!plain || !plain.items) {
|
|
2207
|
+
return [];
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2197
2210
|
return plain.items.map(item => CallLog.parse(item));
|
|
2198
2211
|
}
|
|
2199
2212
|
|
|
@@ -3503,8 +3516,9 @@ class ExternalApp {
|
|
|
3503
3516
|
|
|
3504
3517
|
|
|
3505
3518
|
|
|
3506
|
-
|
|
3519
|
+
|
|
3507
3520
|
|
|
3521
|
+
|
|
3508
3522
|
|
|
3509
3523
|
|
|
3510
3524
|
class Meeting {
|
|
@@ -3515,9 +3529,10 @@ class Meeting {
|
|
|
3515
3529
|
|
|
3516
3530
|
|
|
3517
3531
|
|
|
3518
|
-
|
|
3532
|
+
|
|
3519
3533
|
|
|
3520
3534
|
|
|
3535
|
+
|
|
3521
3536
|
|
|
3522
3537
|
static parse(plain ) {
|
|
3523
3538
|
return new Meeting({
|
|
@@ -3527,12 +3542,16 @@ class Meeting {
|
|
|
3527
3542
|
ownerUuids: plain.owner_uuids,
|
|
3528
3543
|
port: plain.port,
|
|
3529
3544
|
uuid: plain.uuid,
|
|
3530
|
-
|
|
3545
|
+
extension: plain.exten,
|
|
3531
3546
|
persistent: plain.persistent,
|
|
3547
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
3532
3548
|
});
|
|
3533
3549
|
}
|
|
3534
3550
|
|
|
3535
3551
|
static parseMany(items ) {
|
|
3552
|
+
if (!items) {
|
|
3553
|
+
return [];
|
|
3554
|
+
}
|
|
3536
3555
|
return items.map(plain => Meeting.parse(plain));
|
|
3537
3556
|
}
|
|
3538
3557
|
|
|
@@ -3547,8 +3566,9 @@ class Meeting {
|
|
|
3547
3566
|
ownerUuids,
|
|
3548
3567
|
port,
|
|
3549
3568
|
uri,
|
|
3550
|
-
|
|
3569
|
+
extension,
|
|
3551
3570
|
persistent,
|
|
3571
|
+
creationTime,
|
|
3552
3572
|
} = {}) {
|
|
3553
3573
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3554
3574
|
this.uri = uri;
|
|
@@ -3556,8 +3576,9 @@ class Meeting {
|
|
|
3556
3576
|
this.ownerUuids = ownerUuids;
|
|
3557
3577
|
this.port = port;
|
|
3558
3578
|
this.uuid = uuid;
|
|
3559
|
-
this.
|
|
3579
|
+
this.extension = extension;
|
|
3560
3580
|
this.persistent = persistent;
|
|
3581
|
+
this.creationTime = creationTime;
|
|
3561
3582
|
|
|
3562
3583
|
// Useful to compare instead of instanceof with minified code
|
|
3563
3584
|
this.type = 'Meeting';
|
|
@@ -3692,6 +3713,10 @@ class ChatMessage {
|
|
|
3692
3713
|
|
|
3693
3714
|
|
|
3694
3715
|
static parseMany(plain ) {
|
|
3716
|
+
if (!plain || !plain.items) {
|
|
3717
|
+
return [];
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3695
3720
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3696
3721
|
}
|
|
3697
3722
|
|
|
@@ -3801,6 +3826,9 @@ class Voicemail {
|
|
|
3801
3826
|
}
|
|
3802
3827
|
|
|
3803
3828
|
static parseMany(plain ) {
|
|
3829
|
+
if (!plain) {
|
|
3830
|
+
return [];
|
|
3831
|
+
}
|
|
3804
3832
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3805
3833
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3806
3834
|
|
|
@@ -4184,6 +4212,9 @@ class ChatRoom {
|
|
|
4184
4212
|
|
|
4185
4213
|
|
|
4186
4214
|
static parseMany(plain ) {
|
|
4215
|
+
if (!plain || !plain.items) {
|
|
4216
|
+
return [];
|
|
4217
|
+
}
|
|
4187
4218
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4188
4219
|
}
|
|
4189
4220
|
|
|
@@ -5368,6 +5399,10 @@ class CTIPhone extends Emitter {
|
|
|
5368
5399
|
return false;
|
|
5369
5400
|
}
|
|
5370
5401
|
|
|
5402
|
+
hasAVideoTrack() {
|
|
5403
|
+
return false;
|
|
5404
|
+
}
|
|
5405
|
+
|
|
5371
5406
|
getLocalStreamForCall() {
|
|
5372
5407
|
return null;
|
|
5373
5408
|
}
|
|
@@ -1051,6 +1051,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1051
1051
|
constraints,
|
|
1052
1052
|
audioOnly,
|
|
1053
1053
|
conference,
|
|
1054
|
+
iceRestart,
|
|
1054
1055
|
});
|
|
1055
1056
|
|
|
1056
1057
|
if (!sipSession) {
|
|
@@ -1154,6 +1155,11 @@ class WebRTCPhone extends Emitter {
|
|
|
1154
1155
|
|
|
1155
1156
|
this.client.downgradeToAudio(sipSession);
|
|
1156
1157
|
|
|
1158
|
+
if (callSession) {
|
|
1159
|
+
callSession.cameraEnabled = false;
|
|
1160
|
+
this._updateCallSession(callSession);
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1157
1163
|
if (withMessage) {
|
|
1158
1164
|
this._sendReinviteMessage(callSession, false);
|
|
1159
1165
|
}
|
|
@@ -1181,6 +1187,11 @@ class WebRTCPhone extends Emitter {
|
|
|
1181
1187
|
|
|
1182
1188
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
1183
1189
|
|
|
1190
|
+
if (callSession) {
|
|
1191
|
+
callSession.cameraEnabled = true;
|
|
1192
|
+
this._updateCallSession(callSession);
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1184
1195
|
// If no stream is returned, it means we have to reinvite
|
|
1185
1196
|
if (!newStream) {
|
|
1186
1197
|
return true;
|
|
@@ -1417,18 +1428,20 @@ class WebRTCPhone extends Emitter {
|
|
|
1417
1428
|
screenTrack,
|
|
1418
1429
|
});
|
|
1419
1430
|
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1431
|
+
if (screenTrack) {
|
|
1432
|
+
screenTrack.onended = () => {
|
|
1433
|
+
logger.info('WebRTC phone - on screenshare ended', {
|
|
1434
|
+
hadVideo,
|
|
1435
|
+
id: this.getSipSessionId(sipSession),
|
|
1436
|
+
screenTrack,
|
|
1437
|
+
});
|
|
1438
|
+
|
|
1439
|
+
this.eventEmitter.emit(
|
|
1440
|
+
ON_SHARE_SCREEN_ENDING,
|
|
1441
|
+
this._createCallSession(sipSession, callSession),
|
|
1442
|
+
);
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1432
1445
|
|
|
1433
1446
|
this.currentScreenShare = {
|
|
1434
1447
|
stream: screenStream,
|
|
@@ -1448,7 +1461,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1448
1461
|
}
|
|
1449
1462
|
|
|
1450
1463
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
1451
|
-
logger.info('WebRTC phone -
|
|
1464
|
+
logger.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
1452
1465
|
|
|
1453
1466
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
1454
1467
|
this.currentSipSession = sipSession;
|
|
@@ -1960,7 +1973,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1960
1973
|
// @TODO: line is not used here
|
|
1961
1974
|
async makeCall(number , line , cameraEnabled ,
|
|
1962
1975
|
audioOnly = false, conference = false) {
|
|
1963
|
-
logger.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
|
|
1976
|
+
logger.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
1964
1977
|
if (!number) {
|
|
1965
1978
|
return Promise.resolve(null);
|
|
1966
1979
|
}
|
|
@@ -2321,9 +2334,13 @@ class WebRTCPhone extends Emitter {
|
|
|
2321
2334
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
2322
2335
|
&& this.currentSipSession.state === SessionState.Established) {
|
|
2323
2336
|
this.shouldSendReinvite = false;
|
|
2337
|
+
const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
2338
|
+
const isConference = pc ? pc.sfu : false;
|
|
2339
|
+
const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
|
|
2340
|
+
|
|
2324
2341
|
try {
|
|
2325
2342
|
// Send reinvite with iceRestart
|
|
2326
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
2343
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
2327
2344
|
} catch (e) {
|
|
2328
2345
|
logger.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
2329
2346
|
}
|
|
@@ -2407,6 +2424,15 @@ class WebRTCPhone extends Emitter {
|
|
|
2407
2424
|
return this.client.getSipSessionId(sipSession);
|
|
2408
2425
|
}
|
|
2409
2426
|
|
|
2427
|
+
_updateCallSession(callSession ) {
|
|
2428
|
+
const sipSession = this.findSipSession(callSession);
|
|
2429
|
+
const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
|
|
2430
|
+
|
|
2431
|
+
if (sipSessionId) {
|
|
2432
|
+
this.callSessions[sipSessionId] = callSession;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2410
2436
|
_onMessage(message ) {
|
|
2411
2437
|
if (!message || message.method !== 'MESSAGE') {
|
|
2412
2438
|
return;
|
package/esm/domain/Recording.js
CHANGED
package/esm/domain/Voicemail.js
CHANGED
|
@@ -71,6 +71,9 @@ class Voicemail {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
static parseMany(plain ) {
|
|
74
|
+
if (!plain) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
74
77
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
75
78
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
76
79
|
|