@wazo/sdk 0.37.19 → 0.37.23
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 +70 -5
- package/esm/__tests__/web-rtc-client.test.js +111 -67
- package/esm/api/agentd.js +25 -2
- package/esm/api/amid.js +25 -2
- package/esm/api/application.js +25 -2
- package/esm/api/auth.js +25 -2
- package/esm/api/call-logd.js +32 -2
- package/esm/api/calld.js +35 -2
- package/esm/api/chatd.js +32 -2
- package/esm/api/confd.js +47 -5
- package/esm/api/ctid-ng.js +35 -2
- package/esm/api/dird.js +28 -2
- package/esm/api/webhookd.js +25 -2
- package/esm/api-client.js +70 -5
- package/esm/checker/Checker.js +113 -67
- package/esm/checker/checks/aor.js +70 -5
- package/esm/checker/checks/api.js +70 -5
- package/esm/checker/checks/index.js +113 -67
- package/esm/checker/checks/wazo-websocket.js +27 -2
- package/esm/checker/checks/webrtc-transport.js +111 -67
- package/esm/checker/checks/webrtc.js +111 -67
- package/esm/domain/AdHocAPIConference.js +70 -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 +70 -5
- package/esm/domain/Meeting.js +17 -1
- package/esm/domain/Phone/CTIPhone.js +74 -5
- package/esm/domain/Phone/WebRTCPhone.js +50 -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__/Voicemail.test.js +3 -0
- package/esm/index.js +147 -80
- package/esm/lib/WazoSessionDescriptionHandler.js +25 -40
- package/esm/service/CallApi.js +70 -5
- package/esm/service/IssueReporter.js +25 -2
- package/esm/service/__tests__/IssueReporter.test.js +25 -2
- package/esm/service/getApiClient.js +70 -5
- package/esm/simple/Auth.js +147 -80
- package/esm/simple/Configuration.js +147 -80
- package/esm/simple/Directory.js +70 -5
- package/esm/simple/Phone.js +147 -80
- package/esm/simple/Websocket.js +28 -2
- package/esm/simple/index.js +147 -80
- package/esm/simple/room/LocalParticipant.js +147 -80
- package/esm/simple/room/Participant.js +147 -80
- package/esm/simple/room/RemoteParticipant.js +147 -80
- package/esm/simple/room/Room.js +147 -80
- package/esm/simple/room/SipRoom.js +147 -80
- package/esm/simple/room/Stream.js +147 -80
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +147 -80
- package/esm/simple/utils.js +147 -80
- package/esm/utils/__tests__/api-requester.test.js +25 -2
- package/esm/utils/api-requester.js +25 -2
- package/esm/web-rtc-client.js +111 -67
- package/esm/websocket-client.js +28 -3
- package/lib/__tests__/api-client.test.js +70 -5
- package/lib/__tests__/web-rtc-client.test.js +111 -67
- package/lib/api/agentd.js +25 -2
- package/lib/api/amid.js +25 -2
- package/lib/api/application.js +25 -2
- package/lib/api/auth.js +25 -2
- package/lib/api/call-logd.js +32 -2
- package/lib/api/calld.js +35 -2
- package/lib/api/chatd.js +32 -2
- package/lib/api/confd.js +47 -5
- package/lib/api/ctid-ng.js +35 -2
- package/lib/api/dird.js +28 -2
- package/lib/api/webhookd.js +25 -2
- package/lib/api-client.js +70 -5
- package/lib/checker/Checker.js +113 -67
- package/lib/checker/checks/aor.js +70 -5
- package/lib/checker/checks/api.js +70 -5
- package/lib/checker/checks/index.js +113 -67
- package/lib/checker/checks/wazo-websocket.js +27 -2
- package/lib/checker/checks/webrtc-transport.js +111 -67
- package/lib/checker/checks/webrtc.js +111 -67
- package/lib/domain/AdHocAPIConference.js +70 -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 +70 -5
- package/lib/domain/Meeting.js +17 -1
- package/lib/domain/Phone/CTIPhone.js +74 -5
- package/lib/domain/Phone/WebRTCPhone.js +50 -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__/Voicemail.test.js +3 -0
- package/lib/index.js +147 -80
- package/lib/lib/WazoSessionDescriptionHandler.js +25 -40
- package/lib/service/CallApi.js +70 -5
- package/lib/service/IssueReporter.js +25 -2
- package/lib/service/__tests__/IssueReporter.test.js +25 -2
- package/lib/service/getApiClient.js +70 -5
- package/lib/simple/Auth.js +147 -80
- package/lib/simple/Configuration.js +147 -80
- package/lib/simple/Directory.js +70 -5
- package/lib/simple/Phone.js +147 -80
- package/lib/simple/Websocket.js +28 -2
- package/lib/simple/index.js +147 -80
- package/lib/simple/room/LocalParticipant.js +147 -80
- package/lib/simple/room/Participant.js +147 -80
- package/lib/simple/room/RemoteParticipant.js +147 -80
- package/lib/simple/room/Room.js +147 -80
- package/lib/simple/room/SipRoom.js +147 -80
- package/lib/simple/room/Stream.js +147 -80
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +147 -80
- package/lib/simple/utils.js +147 -80
- package/lib/utils/__tests__/api-requester.test.js +25 -2
- package/lib/utils/api-requester.js +25 -2
- package/lib/web-rtc-client.js +111 -67
- package/lib/websocket-client.js +28 -2
- package/package.json +2 -2
- package/src/api/confd.js +5 -2
- 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 +17 -1
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +25 -14
- package/src/domain/Recording.js +3 -0
- package/src/domain/Voicemail.js +3 -0
- package/src/lib/WazoSessionDescriptionHandler.js +1 -35
- package/src/service/IssueReporter.js +25 -2
- package/src/simple/Phone.js +5 -0
- package/src/types/WebSocketMessage.js +5 -1
- package/src/web-rtc-client.js +41 -24
- package/src/websocket-client.js +2 -0
package/esm/domain/Features.js
CHANGED
|
@@ -130,6 +130,7 @@ class IssueReporter {
|
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
|
|
133
|
+
|
|
133
134
|
|
|
134
135
|
constructor() {
|
|
135
136
|
addLevelsTo(this);
|
|
@@ -141,12 +142,17 @@ class IssueReporter {
|
|
|
141
142
|
this.bufferTimeout = null;
|
|
142
143
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
143
144
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
145
|
+
this._callback = null;
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
init() {
|
|
147
149
|
this._catchConsole();
|
|
148
150
|
}
|
|
149
151
|
|
|
152
|
+
setCallback(cb ) {
|
|
153
|
+
this._callback = cb;
|
|
154
|
+
}
|
|
155
|
+
|
|
150
156
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
151
157
|
this.remoteClientConfiguration = configuration;
|
|
152
158
|
}
|
|
@@ -182,6 +188,7 @@ class IssueReporter {
|
|
|
182
188
|
|
|
183
189
|
// Handle category label
|
|
184
190
|
let category = null;
|
|
191
|
+
let skipSendToRemote = false;
|
|
185
192
|
let extra = {};
|
|
186
193
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
187
194
|
category = args[0].split('=')[1];
|
|
@@ -197,6 +204,7 @@ class IssueReporter {
|
|
|
197
204
|
errorMessage: lastArg.message,
|
|
198
205
|
errorStack: lastArg.stack,
|
|
199
206
|
errorType: lastArg.constructor.name,
|
|
207
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
200
208
|
};
|
|
201
209
|
} else {
|
|
202
210
|
extra = lastArg;
|
|
@@ -205,6 +213,11 @@ class IssueReporter {
|
|
|
205
213
|
args.splice(1, 1);
|
|
206
214
|
}
|
|
207
215
|
|
|
216
|
+
if (extra.skipSendToRemote) {
|
|
217
|
+
skipSendToRemote = true;
|
|
218
|
+
delete extra.skipSendToRemote;
|
|
219
|
+
}
|
|
220
|
+
|
|
208
221
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
209
222
|
const message = args.join(', ');
|
|
210
223
|
let consoleMessage = message;
|
|
@@ -225,7 +238,13 @@ class IssueReporter {
|
|
|
225
238
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
226
239
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
227
240
|
|
|
228
|
-
this.
|
|
241
|
+
if (this._callback) {
|
|
242
|
+
this._callback(level, consoleMessage);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (!skipSendToRemote) {
|
|
246
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
247
|
+
}
|
|
229
248
|
}
|
|
230
249
|
|
|
231
250
|
logRequest(url , options , response , start ) {
|
|
@@ -370,7 +389,11 @@ class IssueReporter {
|
|
|
370
389
|
},
|
|
371
390
|
// $FlowFixMe
|
|
372
391
|
body,
|
|
373
|
-
}).catch(() => {
|
|
392
|
+
}).catch((e ) => {
|
|
393
|
+
// $FlowFixMe
|
|
394
|
+
e.skipSendToRemote = true;
|
|
395
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
396
|
+
|
|
374
397
|
setTimeout(() => {
|
|
375
398
|
if (isArray) {
|
|
376
399
|
payload = payload.map(message => {
|
|
@@ -1508,6 +1531,9 @@ class Contact {
|
|
|
1508
1531
|
}
|
|
1509
1532
|
|
|
1510
1533
|
static parseMany(response ) {
|
|
1534
|
+
if (!response || !response.results) {
|
|
1535
|
+
return [];
|
|
1536
|
+
}
|
|
1511
1537
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1512
1538
|
}
|
|
1513
1539
|
|
|
@@ -2614,11 +2640,27 @@ class Meeting {
|
|
|
2614
2640
|
});
|
|
2615
2641
|
}
|
|
2616
2642
|
|
|
2643
|
+
static parseMany(items ) {
|
|
2644
|
+
if (!items) {
|
|
2645
|
+
return [];
|
|
2646
|
+
}
|
|
2647
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2617
2650
|
static newFrom(meeting ) {
|
|
2618
2651
|
return newFrom(meeting, Meeting);
|
|
2619
2652
|
}
|
|
2620
2653
|
|
|
2621
|
-
constructor({
|
|
2654
|
+
constructor({
|
|
2655
|
+
uuid,
|
|
2656
|
+
name,
|
|
2657
|
+
guestSipAuthorization,
|
|
2658
|
+
ownerUuids,
|
|
2659
|
+
port,
|
|
2660
|
+
uri,
|
|
2661
|
+
number,
|
|
2662
|
+
persistent,
|
|
2663
|
+
} = {}) {
|
|
2622
2664
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2623
2665
|
this.uri = uri;
|
|
2624
2666
|
this.name = name;
|
|
@@ -2704,8 +2746,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2704
2746
|
}
|
|
2705
2747
|
},
|
|
2706
2748
|
|
|
2707
|
-
|
|
2708
|
-
client.
|
|
2749
|
+
getMyMeetings: () =>
|
|
2750
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2751
|
+
|
|
2752
|
+
createMyMeeting: (name , persistent ) =>
|
|
2753
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2709
2754
|
|
|
2710
2755
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2711
2756
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -2801,6 +2846,10 @@ class ChatMessage {
|
|
|
2801
2846
|
|
|
2802
2847
|
|
|
2803
2848
|
static parseMany(plain ) {
|
|
2849
|
+
if (!plain || !plain.items) {
|
|
2850
|
+
return [];
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2804
2853
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2805
2854
|
}
|
|
2806
2855
|
|
|
@@ -2910,6 +2959,9 @@ class Voicemail {
|
|
|
2910
2959
|
}
|
|
2911
2960
|
|
|
2912
2961
|
static parseMany(plain ) {
|
|
2962
|
+
if (!plain) {
|
|
2963
|
+
return [];
|
|
2964
|
+
}
|
|
2913
2965
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2914
2966
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2915
2967
|
|
|
@@ -3019,6 +3071,9 @@ class Call {
|
|
|
3019
3071
|
|
|
3020
3072
|
|
|
3021
3073
|
static parseMany(plain ) {
|
|
3074
|
+
if (!plain) {
|
|
3075
|
+
return [];
|
|
3076
|
+
}
|
|
3022
3077
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3023
3078
|
}
|
|
3024
3079
|
|
|
@@ -3191,6 +3246,9 @@ class Recording {
|
|
|
3191
3246
|
|
|
3192
3247
|
|
|
3193
3248
|
static parseMany(recordings = []) {
|
|
3249
|
+
if (!recordings) {
|
|
3250
|
+
return [];
|
|
3251
|
+
}
|
|
3194
3252
|
return recordings.map(item => Recording.parse(item));
|
|
3195
3253
|
}
|
|
3196
3254
|
|
|
@@ -3292,6 +3350,10 @@ class CallLog {
|
|
|
3292
3350
|
}
|
|
3293
3351
|
|
|
3294
3352
|
static parseMany(plain ) {
|
|
3353
|
+
if (!plain || !plain.items) {
|
|
3354
|
+
return [];
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3295
3357
|
return plain.items.map(item => CallLog.parse(item));
|
|
3296
3358
|
}
|
|
3297
3359
|
|
|
@@ -3849,6 +3911,9 @@ class ChatRoom {
|
|
|
3849
3911
|
|
|
3850
3912
|
|
|
3851
3913
|
static parseMany(plain ) {
|
|
3914
|
+
if (!plain || !plain.items) {
|
|
3915
|
+
return [];
|
|
3916
|
+
}
|
|
3852
3917
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3853
3918
|
}
|
|
3854
3919
|
|
package/esm/domain/Meeting.js
CHANGED
|
@@ -47,11 +47,27 @@ class Meeting {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
static parseMany(items ) {
|
|
51
|
+
if (!items) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
return items.map(plain => Meeting.parse(plain));
|
|
55
|
+
}
|
|
56
|
+
|
|
50
57
|
static newFrom(meeting ) {
|
|
51
58
|
return newFrom(meeting, Meeting);
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
constructor({
|
|
61
|
+
constructor({
|
|
62
|
+
uuid,
|
|
63
|
+
name,
|
|
64
|
+
guestSipAuthorization,
|
|
65
|
+
ownerUuids,
|
|
66
|
+
port,
|
|
67
|
+
uri,
|
|
68
|
+
number,
|
|
69
|
+
persistent,
|
|
70
|
+
} = {}) {
|
|
55
71
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
56
72
|
this.uri = uri;
|
|
57
73
|
this.name = name;
|
|
@@ -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
|
|
|
@@ -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
|
|
|
@@ -2510,6 +2523,7 @@ class IssueReporter {
|
|
|
2510
2523
|
|
|
2511
2524
|
|
|
2512
2525
|
|
|
2526
|
+
|
|
2513
2527
|
|
|
2514
2528
|
constructor() {
|
|
2515
2529
|
addLevelsTo(this);
|
|
@@ -2521,12 +2535,17 @@ class IssueReporter {
|
|
|
2521
2535
|
this.bufferTimeout = null;
|
|
2522
2536
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
2523
2537
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
2538
|
+
this._callback = null;
|
|
2524
2539
|
}
|
|
2525
2540
|
|
|
2526
2541
|
init() {
|
|
2527
2542
|
this._catchConsole();
|
|
2528
2543
|
}
|
|
2529
2544
|
|
|
2545
|
+
setCallback(cb ) {
|
|
2546
|
+
this._callback = cb;
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2530
2549
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
2531
2550
|
this.remoteClientConfiguration = configuration;
|
|
2532
2551
|
}
|
|
@@ -2562,6 +2581,7 @@ class IssueReporter {
|
|
|
2562
2581
|
|
|
2563
2582
|
// Handle category label
|
|
2564
2583
|
let category = null;
|
|
2584
|
+
let skipSendToRemote = false;
|
|
2565
2585
|
let extra = {};
|
|
2566
2586
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
2567
2587
|
category = args[0].split('=')[1];
|
|
@@ -2577,6 +2597,7 @@ class IssueReporter {
|
|
|
2577
2597
|
errorMessage: lastArg.message,
|
|
2578
2598
|
errorStack: lastArg.stack,
|
|
2579
2599
|
errorType: lastArg.constructor.name,
|
|
2600
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
2580
2601
|
};
|
|
2581
2602
|
} else {
|
|
2582
2603
|
extra = lastArg;
|
|
@@ -2585,6 +2606,11 @@ class IssueReporter {
|
|
|
2585
2606
|
args.splice(1, 1);
|
|
2586
2607
|
}
|
|
2587
2608
|
|
|
2609
|
+
if (extra.skipSendToRemote) {
|
|
2610
|
+
skipSendToRemote = true;
|
|
2611
|
+
delete extra.skipSendToRemote;
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2588
2614
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
2589
2615
|
const message = args.join(', ');
|
|
2590
2616
|
let consoleMessage = message;
|
|
@@ -2605,7 +2631,13 @@ class IssueReporter {
|
|
|
2605
2631
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
2606
2632
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
2607
2633
|
|
|
2608
|
-
this.
|
|
2634
|
+
if (this._callback) {
|
|
2635
|
+
this._callback(level, consoleMessage);
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
if (!skipSendToRemote) {
|
|
2639
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
2640
|
+
}
|
|
2609
2641
|
}
|
|
2610
2642
|
|
|
2611
2643
|
logRequest(url , options , response , start ) {
|
|
@@ -2750,7 +2782,11 @@ class IssueReporter {
|
|
|
2750
2782
|
},
|
|
2751
2783
|
// $FlowFixMe
|
|
2752
2784
|
body,
|
|
2753
|
-
}).catch(() => {
|
|
2785
|
+
}).catch((e ) => {
|
|
2786
|
+
// $FlowFixMe
|
|
2787
|
+
e.skipSendToRemote = true;
|
|
2788
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
2789
|
+
|
|
2754
2790
|
setTimeout(() => {
|
|
2755
2791
|
if (isArray) {
|
|
2756
2792
|
payload = payload.map(message => {
|
|
@@ -3509,11 +3545,27 @@ class Meeting {
|
|
|
3509
3545
|
});
|
|
3510
3546
|
}
|
|
3511
3547
|
|
|
3548
|
+
static parseMany(items ) {
|
|
3549
|
+
if (!items) {
|
|
3550
|
+
return [];
|
|
3551
|
+
}
|
|
3552
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3512
3555
|
static newFrom(meeting ) {
|
|
3513
3556
|
return newFrom(meeting, Meeting);
|
|
3514
3557
|
}
|
|
3515
3558
|
|
|
3516
|
-
constructor({
|
|
3559
|
+
constructor({
|
|
3560
|
+
uuid,
|
|
3561
|
+
name,
|
|
3562
|
+
guestSipAuthorization,
|
|
3563
|
+
ownerUuids,
|
|
3564
|
+
port,
|
|
3565
|
+
uri,
|
|
3566
|
+
number,
|
|
3567
|
+
persistent,
|
|
3568
|
+
} = {}) {
|
|
3517
3569
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3518
3570
|
this.uri = uri;
|
|
3519
3571
|
this.name = name;
|
|
@@ -3599,8 +3651,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3599
3651
|
}
|
|
3600
3652
|
},
|
|
3601
3653
|
|
|
3602
|
-
|
|
3603
|
-
client.
|
|
3654
|
+
getMyMeetings: () =>
|
|
3655
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3656
|
+
|
|
3657
|
+
createMyMeeting: (name , persistent ) =>
|
|
3658
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3604
3659
|
|
|
3605
3660
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3606
3661
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3653,6 +3708,10 @@ class ChatMessage {
|
|
|
3653
3708
|
|
|
3654
3709
|
|
|
3655
3710
|
static parseMany(plain ) {
|
|
3711
|
+
if (!plain || !plain.items) {
|
|
3712
|
+
return [];
|
|
3713
|
+
}
|
|
3714
|
+
|
|
3656
3715
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3657
3716
|
}
|
|
3658
3717
|
|
|
@@ -3762,6 +3821,9 @@ class Voicemail {
|
|
|
3762
3821
|
}
|
|
3763
3822
|
|
|
3764
3823
|
static parseMany(plain ) {
|
|
3824
|
+
if (!plain) {
|
|
3825
|
+
return [];
|
|
3826
|
+
}
|
|
3765
3827
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3766
3828
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3767
3829
|
|
|
@@ -4145,6 +4207,9 @@ class ChatRoom {
|
|
|
4145
4207
|
|
|
4146
4208
|
|
|
4147
4209
|
static parseMany(plain ) {
|
|
4210
|
+
if (!plain || !plain.items) {
|
|
4211
|
+
return [];
|
|
4212
|
+
}
|
|
4148
4213
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4149
4214
|
}
|
|
4150
4215
|
|
|
@@ -5329,6 +5394,10 @@ class CTIPhone extends Emitter {
|
|
|
5329
5394
|
return false;
|
|
5330
5395
|
}
|
|
5331
5396
|
|
|
5397
|
+
hasAVideoTrack() {
|
|
5398
|
+
return false;
|
|
5399
|
+
}
|
|
5400
|
+
|
|
5332
5401
|
getLocalStreamForCall() {
|
|
5333
5402
|
return null;
|
|
5334
5403
|
}
|
|
@@ -487,6 +487,7 @@ class IssueReporter {
|
|
|
487
487
|
|
|
488
488
|
|
|
489
489
|
|
|
490
|
+
|
|
490
491
|
|
|
491
492
|
constructor() {
|
|
492
493
|
addLevelsTo(this);
|
|
@@ -498,12 +499,17 @@ class IssueReporter {
|
|
|
498
499
|
this.bufferTimeout = null;
|
|
499
500
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
500
501
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
502
|
+
this._callback = null;
|
|
501
503
|
}
|
|
502
504
|
|
|
503
505
|
init() {
|
|
504
506
|
this._catchConsole();
|
|
505
507
|
}
|
|
506
508
|
|
|
509
|
+
setCallback(cb ) {
|
|
510
|
+
this._callback = cb;
|
|
511
|
+
}
|
|
512
|
+
|
|
507
513
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
508
514
|
this.remoteClientConfiguration = configuration;
|
|
509
515
|
}
|
|
@@ -539,6 +545,7 @@ class IssueReporter {
|
|
|
539
545
|
|
|
540
546
|
// Handle category label
|
|
541
547
|
let category = null;
|
|
548
|
+
let skipSendToRemote = false;
|
|
542
549
|
let extra = {};
|
|
543
550
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
544
551
|
category = args[0].split('=')[1];
|
|
@@ -554,6 +561,7 @@ class IssueReporter {
|
|
|
554
561
|
errorMessage: lastArg.message,
|
|
555
562
|
errorStack: lastArg.stack,
|
|
556
563
|
errorType: lastArg.constructor.name,
|
|
564
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
557
565
|
};
|
|
558
566
|
} else {
|
|
559
567
|
extra = lastArg;
|
|
@@ -562,6 +570,11 @@ class IssueReporter {
|
|
|
562
570
|
args.splice(1, 1);
|
|
563
571
|
}
|
|
564
572
|
|
|
573
|
+
if (extra.skipSendToRemote) {
|
|
574
|
+
skipSendToRemote = true;
|
|
575
|
+
delete extra.skipSendToRemote;
|
|
576
|
+
}
|
|
577
|
+
|
|
565
578
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
566
579
|
const message = args.join(', ');
|
|
567
580
|
let consoleMessage = message;
|
|
@@ -582,7 +595,13 @@ class IssueReporter {
|
|
|
582
595
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
583
596
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
584
597
|
|
|
585
|
-
this.
|
|
598
|
+
if (this._callback) {
|
|
599
|
+
this._callback(level, consoleMessage);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
if (!skipSendToRemote) {
|
|
603
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
604
|
+
}
|
|
586
605
|
}
|
|
587
606
|
|
|
588
607
|
logRequest(url , options , response , start ) {
|
|
@@ -727,7 +746,11 @@ class IssueReporter {
|
|
|
727
746
|
},
|
|
728
747
|
// $FlowFixMe
|
|
729
748
|
body,
|
|
730
|
-
}).catch(() => {
|
|
749
|
+
}).catch((e ) => {
|
|
750
|
+
// $FlowFixMe
|
|
751
|
+
e.skipSendToRemote = true;
|
|
752
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
753
|
+
|
|
731
754
|
setTimeout(() => {
|
|
732
755
|
if (isArray) {
|
|
733
756
|
payload = payload.map(message => {
|
|
@@ -1210,7 +1233,10 @@ class WebRTCPhone extends Emitter {
|
|
|
1210
1233
|
|
|
1211
1234
|
onCancel(message);
|
|
1212
1235
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
1213
|
-
|
|
1236
|
+
const callSession = this._createCallSession(sipSession);
|
|
1237
|
+
delete this.callSessions[callSession.getId()];
|
|
1238
|
+
|
|
1239
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
1214
1240
|
};
|
|
1215
1241
|
} else if (sipSession instanceof Invitation) {
|
|
1216
1242
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -1239,9 +1265,11 @@ class WebRTCPhone extends Emitter {
|
|
|
1239
1265
|
case SessionState.Terminated: {
|
|
1240
1266
|
logger.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
1241
1267
|
|
|
1268
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
1269
|
+
const callSession = this._createCallSession(sipSession);
|
|
1242
1270
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
1243
1271
|
|
|
1244
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
1272
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
1245
1273
|
}
|
|
1246
1274
|
}
|
|
1247
1275
|
});
|
|
@@ -1389,18 +1417,20 @@ class WebRTCPhone extends Emitter {
|
|
|
1389
1417
|
screenTrack,
|
|
1390
1418
|
});
|
|
1391
1419
|
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1420
|
+
if (screenTrack) {
|
|
1421
|
+
screenTrack.onended = () => {
|
|
1422
|
+
logger.info('WebRTC phone - on screenshare ended', {
|
|
1423
|
+
hadVideo,
|
|
1424
|
+
id: this.getSipSessionId(sipSession),
|
|
1425
|
+
screenTrack,
|
|
1426
|
+
});
|
|
1427
|
+
|
|
1428
|
+
this.eventEmitter.emit(
|
|
1429
|
+
ON_SHARE_SCREEN_ENDING,
|
|
1430
|
+
this._createCallSession(sipSession, callSession),
|
|
1431
|
+
);
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1404
1434
|
|
|
1405
1435
|
this.currentScreenShare = {
|
|
1406
1436
|
stream: screenStream,
|
|
@@ -2189,6 +2219,10 @@ class WebRTCPhone extends Emitter {
|
|
|
2189
2219
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
2190
2220
|
}
|
|
2191
2221
|
|
|
2222
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
2223
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2192
2226
|
hasRemoteVideo(callSession ) {
|
|
2193
2227
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
2194
2228
|
}
|
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
|
|
|
@@ -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
|
|
|
@@ -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
|
|