@wazo/sdk 0.37.18 → 0.37.22
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 +13 -5
- package/esm/__tests__/api-client.test.js +52 -9
- package/esm/__tests__/web-rtc-client.test.js +80 -20
- package/esm/api/agentd.js +27 -4
- package/esm/api/amid.js +27 -4
- package/esm/api/application.js +27 -4
- package/esm/api/auth.js +29 -5
- package/esm/api/call-logd.js +29 -6
- package/esm/api/calld.js +27 -4
- package/esm/api/chatd.js +27 -4
- package/esm/api/confd.js +51 -8
- package/esm/api/ctid-ng.js +27 -4
- package/esm/api/dird.js +27 -4
- package/esm/api/webhookd.js +27 -4
- package/esm/api-client.js +54 -11
- package/esm/checker/Checker.js +83 -21
- package/esm/checker/checks/aor.js +54 -11
- package/esm/checker/checks/api.js +54 -11
- package/esm/checker/checks/ice-ipv4.js +1 -1
- package/esm/checker/checks/index.js +84 -22
- package/esm/checker/checks/symmetric-nat.js +1 -1
- package/esm/checker/checks/wazo-websocket.js +29 -4
- package/esm/checker/checks/webrtc-transport.js +82 -22
- package/esm/checker/checks/webrtc.js +82 -22
- package/esm/domain/AdHocAPIConference.js +54 -11
- package/esm/domain/Agent.js +1 -1
- package/esm/domain/BadResponse.js +1 -1
- package/esm/domain/Call.js +1 -1
- package/esm/domain/CallLog.js +3 -3
- package/esm/domain/CallSession.js +1 -1
- package/esm/domain/ChatMessage.js +1 -1
- package/esm/domain/ChatRoom.js +1 -1
- package/esm/domain/Contact.js +2 -1
- package/esm/domain/Country.js +1 -1
- package/esm/domain/Device/DebugDevice.js +1 -1
- package/esm/domain/ExternalApp.js +1 -1
- package/esm/domain/Features.js +54 -10
- package/esm/domain/ForwardOption.js +2 -1
- package/esm/domain/IndirectTransfer.js +1 -1
- package/esm/domain/Line.js +1 -1
- package/esm/domain/Meeting.js +20 -3
- package/esm/domain/NotificationOptions.js +1 -1
- package/esm/domain/Phone/CTIPhone.js +55 -11
- package/esm/domain/Phone/WebRTCPhone.js +39 -6
- package/esm/domain/Profile.js +2 -1
- package/esm/domain/Recording.js +2 -2
- package/esm/domain/Relocation.js +1 -1
- package/esm/domain/Room.js +1 -1
- package/esm/domain/ServerError.js +1 -1
- package/esm/domain/Session.js +2 -2
- package/esm/domain/SipLine.js +1 -1
- package/esm/domain/Subscription.js +1 -1
- package/esm/domain/SwitchboardCall.js +1 -1
- package/esm/domain/Voicemail.js +1 -1
- package/esm/domain/__tests__/CallLog.test.js +2 -2
- package/esm/index.js +101 -24
- package/esm/lib/WazoSessionDescriptionHandler.js +28 -4
- package/esm/service/CallApi.js +54 -11
- package/esm/service/IssueReporter.js +27 -4
- package/esm/service/__tests__/IssueReporter.test.js +26 -3
- package/esm/service/getApiClient.js +55 -11
- package/esm/simple/Auth.js +101 -23
- package/esm/simple/Configuration.js +100 -23
- package/esm/simple/Directory.js +53 -10
- package/esm/simple/Phone.js +100 -23
- package/esm/simple/Websocket.js +30 -4
- package/esm/simple/index.js +100 -23
- package/esm/simple/room/LocalParticipant.js +113 -40
- package/esm/simple/room/Participant.js +112 -37
- package/esm/simple/room/RemoteParticipant.js +114 -41
- package/esm/simple/room/Room.js +113 -37
- package/esm/simple/room/SipRoom.js +101 -26
- package/esm/simple/room/Stream.js +101 -26
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +99 -22
- package/esm/simple/utils.js +99 -22
- package/esm/utils/Emitter.js +1 -1
- package/esm/utils/Heartbeat.js +1 -1
- package/esm/utils/__tests__/api-requester.test.js +26 -3
- package/esm/utils/api-requester.js +28 -4
- package/esm/utils/compare-version.js +1 -1
- package/esm/utils/isMobile.js +1 -1
- package/esm/utils/new-from.js +1 -1
- package/esm/utils/once.js +1 -1
- package/esm/utils/update-from.js +1 -1
- package/esm/web-rtc-client.js +83 -22
- package/esm/websocket-client.js +30 -4
- package/lib/__tests__/api-client.test.js +61 -18
- package/lib/__tests__/web-rtc-client.test.js +97 -37
- package/lib/api/agentd.js +27 -4
- package/lib/api/amid.js +27 -4
- package/lib/api/application.js +27 -4
- package/lib/api/auth.js +28 -5
- package/lib/api/call-logd.js +34 -11
- package/lib/api/calld.js +30 -7
- package/lib/api/chatd.js +28 -5
- package/lib/api/confd.js +51 -8
- package/lib/api/ctid-ng.js +30 -7
- package/lib/api/dird.js +27 -4
- package/lib/api/webhookd.js +27 -4
- package/lib/api-client.js +61 -18
- package/lib/checker/Checker.js +100 -38
- package/lib/checker/checks/aor.js +61 -18
- package/lib/checker/checks/api.js +61 -18
- package/lib/checker/checks/index.js +100 -38
- package/lib/checker/checks/wazo-websocket.js +31 -6
- package/lib/checker/checks/webrtc-transport.js +97 -37
- package/lib/checker/checks/webrtc.js +97 -37
- package/lib/domain/AdHocAPIConference.js +61 -18
- package/lib/domain/Call.js +1 -1
- package/lib/domain/CallLog.js +7 -7
- package/lib/domain/ChatMessage.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +62 -19
- package/lib/domain/ForwardOption.js +1 -1
- package/lib/domain/Meeting.js +19 -2
- package/lib/domain/Phone/CTIPhone.js +63 -20
- package/lib/domain/Phone/WebRTCPhone.js +40 -8
- package/lib/domain/Profile.js +1 -1
- package/lib/domain/Recording.js +3 -3
- package/lib/domain/Voicemail.js +1 -1
- package/lib/domain/__tests__/Call.test.js +1 -1
- package/lib/domain/__tests__/CallLog.test.js +13 -13
- package/lib/domain/__tests__/Voicemail.test.js +1 -1
- package/lib/index.js +120 -43
- package/lib/lib/WazoSessionDescriptionHandler.js +32 -9
- package/lib/service/CallApi.js +61 -18
- package/lib/service/IssueReporter.js +27 -4
- package/lib/service/__tests__/IssueReporter.test.js +27 -4
- package/lib/service/getApiClient.js +62 -19
- package/lib/simple/Auth.js +119 -42
- package/lib/simple/Configuration.js +118 -41
- package/lib/simple/Directory.js +61 -18
- package/lib/simple/Phone.js +118 -41
- package/lib/simple/Websocket.js +32 -6
- package/lib/simple/index.js +118 -41
- package/lib/simple/room/LocalParticipant.js +132 -59
- package/lib/simple/room/Participant.js +130 -55
- package/lib/simple/room/RemoteParticipant.js +133 -60
- package/lib/simple/room/Room.js +131 -56
- package/lib/simple/room/SipRoom.js +120 -45
- package/lib/simple/room/Stream.js +120 -45
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +118 -41
- package/lib/simple/utils.js +118 -41
- package/lib/utils/Emitter.js +1 -1
- package/lib/utils/PhoneNumberUtil.js +2 -2
- package/lib/utils/__tests__/PhoneNumberUtil.test.js +2 -2
- package/lib/utils/__tests__/api-requester.test.js +27 -4
- package/lib/utils/__tests__/sdp.test.js +12 -12
- package/lib/utils/api-requester.js +28 -5
- package/lib/utils/sdp.js +10 -10
- package/lib/web-rtc-client.js +98 -38
- package/lib/websocket-client.js +33 -7
- package/package.json +2 -2
- package/src/api/confd.js +5 -2
- package/src/domain/CallLog.js +1 -1
- package/src/domain/Meeting.js +19 -2
- package/src/domain/Phone/WebRTCPhone.js +11 -2
- package/src/domain/Recording.js +1 -1
- package/src/service/IssueReporter.js +26 -3
- package/src/simple/Phone.js +5 -0
- package/src/types/WebSocketMessage.js +5 -1
- package/src/web-rtc-client.js +28 -11
- package/src/websocket-client.js +2 -0
package/esm/api/ctid-ng.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 => {
|
|
@@ -382,7 +405,7 @@ class IssueReporter {
|
|
|
382
405
|
payload._retry = retry + 1;
|
|
383
406
|
}
|
|
384
407
|
|
|
385
|
-
this._sendDebugToGrafana(
|
|
408
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
386
409
|
}, 5000 + retry * 1000);
|
|
387
410
|
});
|
|
388
411
|
}
|
|
@@ -1297,4 +1320,4 @@ var ctidNgMethods = (client , baseUrl ) => ({
|
|
|
1297
1320
|
|
|
1298
1321
|
});
|
|
1299
1322
|
|
|
1300
|
-
export
|
|
1323
|
+
export default ctidNgMethods;
|
package/esm/api/dird.js
CHANGED
|
@@ -128,6 +128,7 @@ class IssueReporter {
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
|
|
131
|
+
|
|
131
132
|
|
|
132
133
|
constructor() {
|
|
133
134
|
addLevelsTo(this);
|
|
@@ -139,12 +140,17 @@ class IssueReporter {
|
|
|
139
140
|
this.bufferTimeout = null;
|
|
140
141
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
141
142
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
143
|
+
this._callback = null;
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
init() {
|
|
145
147
|
this._catchConsole();
|
|
146
148
|
}
|
|
147
149
|
|
|
150
|
+
setCallback(cb ) {
|
|
151
|
+
this._callback = cb;
|
|
152
|
+
}
|
|
153
|
+
|
|
148
154
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
149
155
|
this.remoteClientConfiguration = configuration;
|
|
150
156
|
}
|
|
@@ -180,6 +186,7 @@ class IssueReporter {
|
|
|
180
186
|
|
|
181
187
|
// Handle category label
|
|
182
188
|
let category = null;
|
|
189
|
+
let skipSendToRemote = false;
|
|
183
190
|
let extra = {};
|
|
184
191
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
185
192
|
category = args[0].split('=')[1];
|
|
@@ -195,6 +202,7 @@ class IssueReporter {
|
|
|
195
202
|
errorMessage: lastArg.message,
|
|
196
203
|
errorStack: lastArg.stack,
|
|
197
204
|
errorType: lastArg.constructor.name,
|
|
205
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
198
206
|
};
|
|
199
207
|
} else {
|
|
200
208
|
extra = lastArg;
|
|
@@ -203,6 +211,11 @@ class IssueReporter {
|
|
|
203
211
|
args.splice(1, 1);
|
|
204
212
|
}
|
|
205
213
|
|
|
214
|
+
if (extra.skipSendToRemote) {
|
|
215
|
+
skipSendToRemote = true;
|
|
216
|
+
delete extra.skipSendToRemote;
|
|
217
|
+
}
|
|
218
|
+
|
|
206
219
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
207
220
|
const message = args.join(', ');
|
|
208
221
|
let consoleMessage = message;
|
|
@@ -223,7 +236,13 @@ class IssueReporter {
|
|
|
223
236
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
224
237
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
225
238
|
|
|
226
|
-
this.
|
|
239
|
+
if (this._callback) {
|
|
240
|
+
this._callback(level, consoleMessage);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (!skipSendToRemote) {
|
|
244
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
245
|
+
}
|
|
227
246
|
}
|
|
228
247
|
|
|
229
248
|
logRequest(url , options , response , start ) {
|
|
@@ -368,7 +387,11 @@ class IssueReporter {
|
|
|
368
387
|
},
|
|
369
388
|
// $FlowFixMe
|
|
370
389
|
body,
|
|
371
|
-
}).catch(() => {
|
|
390
|
+
}).catch((e ) => {
|
|
391
|
+
// $FlowFixMe
|
|
392
|
+
e.skipSendToRemote = true;
|
|
393
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
394
|
+
|
|
372
395
|
setTimeout(() => {
|
|
373
396
|
if (isArray) {
|
|
374
397
|
payload = payload.map(message => {
|
|
@@ -380,7 +403,7 @@ class IssueReporter {
|
|
|
380
403
|
payload._retry = retry + 1;
|
|
381
404
|
}
|
|
382
405
|
|
|
383
|
-
this._sendDebugToGrafana(
|
|
406
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
384
407
|
}, 5000 + retry * 1000);
|
|
385
408
|
});
|
|
386
409
|
}
|
|
@@ -1557,4 +1580,4 @@ var dird = (client , baseUrl ) => ({
|
|
|
1557
1580
|
|
|
1558
1581
|
});
|
|
1559
1582
|
|
|
1560
|
-
export
|
|
1583
|
+
export default dird;
|
package/esm/api/webhookd.js
CHANGED
|
@@ -65,6 +65,7 @@ class IssueReporter {
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
|
|
68
69
|
|
|
69
70
|
constructor() {
|
|
70
71
|
addLevelsTo(this);
|
|
@@ -76,12 +77,17 @@ class IssueReporter {
|
|
|
76
77
|
this.bufferTimeout = null;
|
|
77
78
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
78
79
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
80
|
+
this._callback = null;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
init() {
|
|
82
84
|
this._catchConsole();
|
|
83
85
|
}
|
|
84
86
|
|
|
87
|
+
setCallback(cb ) {
|
|
88
|
+
this._callback = cb;
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
86
92
|
this.remoteClientConfiguration = configuration;
|
|
87
93
|
}
|
|
@@ -117,6 +123,7 @@ class IssueReporter {
|
|
|
117
123
|
|
|
118
124
|
// Handle category label
|
|
119
125
|
let category = null;
|
|
126
|
+
let skipSendToRemote = false;
|
|
120
127
|
let extra = {};
|
|
121
128
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
122
129
|
category = args[0].split('=')[1];
|
|
@@ -132,6 +139,7 @@ class IssueReporter {
|
|
|
132
139
|
errorMessage: lastArg.message,
|
|
133
140
|
errorStack: lastArg.stack,
|
|
134
141
|
errorType: lastArg.constructor.name,
|
|
142
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
135
143
|
};
|
|
136
144
|
} else {
|
|
137
145
|
extra = lastArg;
|
|
@@ -140,6 +148,11 @@ class IssueReporter {
|
|
|
140
148
|
args.splice(1, 1);
|
|
141
149
|
}
|
|
142
150
|
|
|
151
|
+
if (extra.skipSendToRemote) {
|
|
152
|
+
skipSendToRemote = true;
|
|
153
|
+
delete extra.skipSendToRemote;
|
|
154
|
+
}
|
|
155
|
+
|
|
143
156
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
144
157
|
const message = args.join(', ');
|
|
145
158
|
let consoleMessage = message;
|
|
@@ -160,7 +173,13 @@ class IssueReporter {
|
|
|
160
173
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
161
174
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
162
175
|
|
|
163
|
-
this.
|
|
176
|
+
if (this._callback) {
|
|
177
|
+
this._callback(level, consoleMessage);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (!skipSendToRemote) {
|
|
181
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
182
|
+
}
|
|
164
183
|
}
|
|
165
184
|
|
|
166
185
|
logRequest(url , options , response , start ) {
|
|
@@ -305,7 +324,11 @@ class IssueReporter {
|
|
|
305
324
|
},
|
|
306
325
|
// $FlowFixMe
|
|
307
326
|
body,
|
|
308
|
-
}).catch(() => {
|
|
327
|
+
}).catch((e ) => {
|
|
328
|
+
// $FlowFixMe
|
|
329
|
+
e.skipSendToRemote = true;
|
|
330
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
331
|
+
|
|
309
332
|
setTimeout(() => {
|
|
310
333
|
if (isArray) {
|
|
311
334
|
payload = payload.map(message => {
|
|
@@ -317,7 +340,7 @@ class IssueReporter {
|
|
|
317
340
|
payload._retry = retry + 1;
|
|
318
341
|
}
|
|
319
342
|
|
|
320
|
-
this._sendDebugToGrafana(
|
|
343
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
321
344
|
}, 5000 + retry * 1000);
|
|
322
345
|
});
|
|
323
346
|
}
|
|
@@ -482,4 +505,4 @@ var webhookd = (client , baseUrl ) => ({
|
|
|
482
505
|
client.delete(`${baseUrl}/users/me/subscriptions/${uuid}`),
|
|
483
506
|
});
|
|
484
507
|
|
|
485
|
-
export
|
|
508
|
+
export default webhookd;
|
package/esm/api-client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Base64 } from 'js-base64';
|
|
2
2
|
import moment from 'moment';
|
|
3
|
-
import {
|
|
3
|
+
import { jws, b64utoutf8, KEYUTIL } from 'jsrsasign';
|
|
4
4
|
import 'sip.js/lib/api/session-state';
|
|
5
5
|
import 'events';
|
|
6
6
|
import { jsonToGraphQLQuery } from 'json-to-graphql-query/lib/jsonToGraphQLQuery';
|
|
@@ -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 => {
|
|
@@ -382,7 +405,7 @@ class IssueReporter {
|
|
|
382
405
|
payload._retry = retry + 1;
|
|
383
406
|
}
|
|
384
407
|
|
|
385
|
-
this._sendDebugToGrafana(
|
|
408
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
386
409
|
}, 5000 + retry * 1000);
|
|
387
410
|
});
|
|
388
411
|
}
|
|
@@ -2585,7 +2608,8 @@ class ExternalApp {
|
|
|
2585
2608
|
|
|
2586
2609
|
|
|
2587
2610
|
|
|
2588
|
-
|
|
2611
|
+
|
|
2612
|
+
|
|
2589
2613
|
|
|
2590
2614
|
|
|
2591
2615
|
class Meeting {
|
|
@@ -2597,6 +2621,7 @@ class Meeting {
|
|
|
2597
2621
|
|
|
2598
2622
|
|
|
2599
2623
|
|
|
2624
|
+
|
|
2600
2625
|
|
|
2601
2626
|
|
|
2602
2627
|
static parse(plain ) {
|
|
@@ -2608,14 +2633,28 @@ class Meeting {
|
|
|
2608
2633
|
port: plain.port,
|
|
2609
2634
|
uuid: plain.uuid,
|
|
2610
2635
|
number: plain.number,
|
|
2636
|
+
persistent: plain.persistent,
|
|
2611
2637
|
});
|
|
2612
2638
|
}
|
|
2613
2639
|
|
|
2640
|
+
static parseMany(items ) {
|
|
2641
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2614
2644
|
static newFrom(meeting ) {
|
|
2615
2645
|
return newFrom(meeting, Meeting);
|
|
2616
2646
|
}
|
|
2617
2647
|
|
|
2618
|
-
constructor({
|
|
2648
|
+
constructor({
|
|
2649
|
+
uuid,
|
|
2650
|
+
name,
|
|
2651
|
+
guestSipAuthorization,
|
|
2652
|
+
ownerUuids,
|
|
2653
|
+
port,
|
|
2654
|
+
uri,
|
|
2655
|
+
number,
|
|
2656
|
+
persistent,
|
|
2657
|
+
} = {}) {
|
|
2619
2658
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2620
2659
|
this.uri = uri;
|
|
2621
2660
|
this.name = name;
|
|
@@ -2623,6 +2662,7 @@ class Meeting {
|
|
|
2623
2662
|
this.port = port;
|
|
2624
2663
|
this.uuid = uuid;
|
|
2625
2664
|
this.number = number;
|
|
2665
|
+
this.persistent = persistent;
|
|
2626
2666
|
|
|
2627
2667
|
// Useful to compare instead of instanceof with minified code
|
|
2628
2668
|
this.type = 'Meeting';
|
|
@@ -2700,8 +2740,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2700
2740
|
}
|
|
2701
2741
|
},
|
|
2702
2742
|
|
|
2703
|
-
|
|
2704
|
-
client.
|
|
2743
|
+
getMyMeetings: () =>
|
|
2744
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2745
|
+
|
|
2746
|
+
createMyMeeting: (name , persistent ) =>
|
|
2747
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2705
2748
|
|
|
2706
2749
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2707
2750
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3186,7 +3229,7 @@ class Recording {
|
|
|
3186
3229
|
|
|
3187
3230
|
|
|
3188
3231
|
|
|
3189
|
-
static parseMany(recordings
|
|
3232
|
+
static parseMany(recordings = []) {
|
|
3190
3233
|
return recordings.map(item => Recording.parse(item));
|
|
3191
3234
|
}
|
|
3192
3235
|
|
|
@@ -3312,7 +3355,7 @@ class CallLog {
|
|
|
3312
3355
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3313
3356
|
start: moment(plain.start).toDate(),
|
|
3314
3357
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
3315
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3358
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3316
3359
|
});
|
|
3317
3360
|
}
|
|
3318
3361
|
|
|
@@ -4568,4 +4611,4 @@ class ApiClient {
|
|
|
4568
4611
|
}
|
|
4569
4612
|
}
|
|
4570
4613
|
|
|
4571
|
-
export
|
|
4614
|
+
export default ApiClient;
|