@wazo/sdk 0.37.17 → 0.37.21
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 +3 -3
- package/esm/__tests__/api-client.test.js +52 -9
- package/esm/__tests__/web-rtc-client.test.js +96 -21
- package/esm/api/agentd.js +26 -3
- package/esm/api/amid.js +26 -3
- package/esm/api/application.js +26 -3
- package/esm/api/auth.js +26 -3
- package/esm/api/call-logd.js +28 -5
- package/esm/api/calld.js +26 -3
- package/esm/api/chatd.js +26 -3
- package/esm/api/confd.js +50 -7
- package/esm/api/ctid-ng.js +26 -3
- package/esm/api/dird.js +26 -3
- package/esm/api/webhookd.js +26 -3
- package/esm/api-client.js +52 -9
- package/esm/checker/Checker.js +98 -21
- package/esm/checker/checks/aor.js +52 -9
- package/esm/checker/checks/api.js +52 -9
- package/esm/checker/checks/index.js +98 -21
- package/esm/checker/checks/wazo-websocket.js +28 -3
- package/esm/checker/checks/webrtc-transport.js +96 -21
- package/esm/checker/checks/webrtc.js +96 -21
- package/esm/domain/AdHocAPIConference.js +52 -9
- package/esm/domain/CallLog.js +2 -2
- package/esm/domain/Features.js +52 -9
- package/esm/domain/Meeting.js +19 -2
- package/esm/domain/Phone/CTIPhone.js +52 -9
- package/esm/domain/Phone/WebRTCPhone.js +41 -5
- package/esm/domain/Recording.js +1 -1
- package/esm/domain/__tests__/CallLog.test.js +2 -2
- package/esm/index.js +119 -22
- package/esm/lib/WazoSessionDescriptionHandler.js +26 -3
- package/esm/service/CallApi.js +52 -9
- package/esm/service/IssueReporter.js +26 -3
- package/esm/service/__tests__/IssueReporter.test.js +26 -3
- package/esm/service/getApiClient.js +52 -9
- package/esm/simple/Auth.js +119 -22
- package/esm/simple/Configuration.js +119 -22
- package/esm/simple/Directory.js +52 -9
- package/esm/simple/Phone.js +119 -22
- package/esm/simple/Websocket.js +29 -3
- package/esm/simple/index.js +119 -22
- package/esm/simple/room/LocalParticipant.js +119 -22
- package/esm/simple/room/Participant.js +119 -22
- package/esm/simple/room/RemoteParticipant.js +119 -22
- package/esm/simple/room/Room.js +119 -22
- package/esm/simple/room/SipRoom.js +119 -22
- package/esm/simple/room/Stream.js +119 -22
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +119 -22
- package/esm/simple/utils.js +119 -22
- package/esm/utils/__tests__/api-requester.test.js +26 -3
- package/esm/utils/api-requester.js +26 -3
- package/esm/web-rtc-client.js +96 -21
- package/esm/websocket-client.js +29 -4
- package/lib/__tests__/api-client.test.js +52 -9
- package/lib/__tests__/web-rtc-client.test.js +96 -21
- package/lib/api/agentd.js +26 -3
- package/lib/api/amid.js +26 -3
- package/lib/api/application.js +26 -3
- package/lib/api/auth.js +26 -3
- package/lib/api/call-logd.js +28 -5
- package/lib/api/calld.js +26 -3
- package/lib/api/chatd.js +26 -3
- package/lib/api/confd.js +50 -7
- package/lib/api/ctid-ng.js +26 -3
- package/lib/api/dird.js +26 -3
- package/lib/api/webhookd.js +26 -3
- package/lib/api-client.js +52 -9
- package/lib/checker/Checker.js +98 -21
- package/lib/checker/checks/aor.js +52 -9
- package/lib/checker/checks/api.js +52 -9
- package/lib/checker/checks/index.js +98 -21
- package/lib/checker/checks/wazo-websocket.js +28 -3
- package/lib/checker/checks/webrtc-transport.js +96 -21
- package/lib/checker/checks/webrtc.js +96 -21
- package/lib/domain/AdHocAPIConference.js +52 -9
- package/lib/domain/CallLog.js +2 -2
- package/lib/domain/Features.js +52 -9
- package/lib/domain/Meeting.js +19 -2
- package/lib/domain/Phone/CTIPhone.js +52 -9
- package/lib/domain/Phone/WebRTCPhone.js +41 -4
- package/lib/domain/Recording.js +1 -1
- package/lib/domain/__tests__/CallLog.test.js +2 -2
- package/lib/index.js +119 -22
- package/lib/lib/WazoSessionDescriptionHandler.js +26 -3
- package/lib/service/CallApi.js +52 -9
- package/lib/service/IssueReporter.js +26 -3
- package/lib/service/__tests__/IssueReporter.test.js +26 -3
- package/lib/service/getApiClient.js +52 -9
- package/lib/simple/Auth.js +119 -22
- package/lib/simple/Configuration.js +119 -22
- package/lib/simple/Directory.js +52 -9
- package/lib/simple/Phone.js +119 -22
- package/lib/simple/Websocket.js +29 -3
- package/lib/simple/index.js +119 -22
- package/lib/simple/room/LocalParticipant.js +119 -22
- package/lib/simple/room/Participant.js +119 -22
- package/lib/simple/room/RemoteParticipant.js +119 -22
- package/lib/simple/room/Room.js +119 -22
- package/lib/simple/room/SipRoom.js +119 -22
- package/lib/simple/room/Stream.js +119 -22
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +119 -22
- package/lib/simple/utils.js +119 -22
- package/lib/utils/__tests__/api-requester.test.js +26 -3
- package/lib/utils/api-requester.js +26 -3
- package/lib/web-rtc-client.js +96 -21
- package/lib/websocket-client.js +29 -3
- 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 +14 -1
- 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 +44 -12
- package/src/websocket-client.js +2 -0
package/lib/service/CallApi.js
CHANGED
|
@@ -1711,7 +1711,7 @@ class Recording {
|
|
|
1711
1711
|
|
|
1712
1712
|
|
|
1713
1713
|
|
|
1714
|
-
static parseMany(recordings
|
|
1714
|
+
static parseMany(recordings = []) {
|
|
1715
1715
|
return recordings.map(item => Recording.parse(item));
|
|
1716
1716
|
}
|
|
1717
1717
|
|
|
@@ -1837,7 +1837,7 @@ class CallLog {
|
|
|
1837
1837
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
1838
1838
|
start: moment__default['default'](plain.start).toDate(),
|
|
1839
1839
|
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
1840
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
1840
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
1841
1841
|
});
|
|
1842
1842
|
}
|
|
1843
1843
|
|
|
@@ -2145,6 +2145,7 @@ class IssueReporter {
|
|
|
2145
2145
|
|
|
2146
2146
|
|
|
2147
2147
|
|
|
2148
|
+
|
|
2148
2149
|
|
|
2149
2150
|
constructor() {
|
|
2150
2151
|
addLevelsTo(this);
|
|
@@ -2156,12 +2157,17 @@ class IssueReporter {
|
|
|
2156
2157
|
this.bufferTimeout = null;
|
|
2157
2158
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
2158
2159
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
2160
|
+
this._callback = null;
|
|
2159
2161
|
}
|
|
2160
2162
|
|
|
2161
2163
|
init() {
|
|
2162
2164
|
this._catchConsole();
|
|
2163
2165
|
}
|
|
2164
2166
|
|
|
2167
|
+
setCallback(cb ) {
|
|
2168
|
+
this._callback = cb;
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2165
2171
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
2166
2172
|
this.remoteClientConfiguration = configuration;
|
|
2167
2173
|
}
|
|
@@ -2197,6 +2203,7 @@ class IssueReporter {
|
|
|
2197
2203
|
|
|
2198
2204
|
// Handle category label
|
|
2199
2205
|
let category = null;
|
|
2206
|
+
let skipSendToRemote = false;
|
|
2200
2207
|
let extra = {};
|
|
2201
2208
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
2202
2209
|
category = args[0].split('=')[1];
|
|
@@ -2212,6 +2219,7 @@ class IssueReporter {
|
|
|
2212
2219
|
errorMessage: lastArg.message,
|
|
2213
2220
|
errorStack: lastArg.stack,
|
|
2214
2221
|
errorType: lastArg.constructor.name,
|
|
2222
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
2215
2223
|
};
|
|
2216
2224
|
} else {
|
|
2217
2225
|
extra = lastArg;
|
|
@@ -2220,6 +2228,11 @@ class IssueReporter {
|
|
|
2220
2228
|
args.splice(1, 1);
|
|
2221
2229
|
}
|
|
2222
2230
|
|
|
2231
|
+
if (extra.skipSendToRemote) {
|
|
2232
|
+
skipSendToRemote = true;
|
|
2233
|
+
delete extra.skipSendToRemote;
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2223
2236
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
2224
2237
|
const message = args.join(', ');
|
|
2225
2238
|
let consoleMessage = message;
|
|
@@ -2240,7 +2253,13 @@ class IssueReporter {
|
|
|
2240
2253
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
2241
2254
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
2242
2255
|
|
|
2243
|
-
this.
|
|
2256
|
+
if (this._callback) {
|
|
2257
|
+
this._callback(level, consoleMessage);
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
if (!skipSendToRemote) {
|
|
2261
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
2262
|
+
}
|
|
2244
2263
|
}
|
|
2245
2264
|
|
|
2246
2265
|
logRequest(url , options , response , start ) {
|
|
@@ -2385,7 +2404,11 @@ class IssueReporter {
|
|
|
2385
2404
|
},
|
|
2386
2405
|
// $FlowFixMe
|
|
2387
2406
|
body,
|
|
2388
|
-
}).catch(() => {
|
|
2407
|
+
}).catch((e ) => {
|
|
2408
|
+
// $FlowFixMe
|
|
2409
|
+
e.skipSendToRemote = true;
|
|
2410
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
2411
|
+
|
|
2389
2412
|
setTimeout(() => {
|
|
2390
2413
|
if (isArray) {
|
|
2391
2414
|
payload = payload.map(message => {
|
|
@@ -2397,7 +2420,7 @@ class IssueReporter {
|
|
|
2397
2420
|
payload._retry = retry + 1;
|
|
2398
2421
|
}
|
|
2399
2422
|
|
|
2400
|
-
this._sendDebugToGrafana(
|
|
2423
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
2401
2424
|
}, 5000 + retry * 1000);
|
|
2402
2425
|
});
|
|
2403
2426
|
}
|
|
@@ -3115,7 +3138,8 @@ class ExternalApp {
|
|
|
3115
3138
|
|
|
3116
3139
|
|
|
3117
3140
|
|
|
3118
|
-
|
|
3141
|
+
|
|
3142
|
+
|
|
3119
3143
|
|
|
3120
3144
|
|
|
3121
3145
|
class Meeting {
|
|
@@ -3127,6 +3151,7 @@ class Meeting {
|
|
|
3127
3151
|
|
|
3128
3152
|
|
|
3129
3153
|
|
|
3154
|
+
|
|
3130
3155
|
|
|
3131
3156
|
|
|
3132
3157
|
static parse(plain ) {
|
|
@@ -3138,14 +3163,28 @@ class Meeting {
|
|
|
3138
3163
|
port: plain.port,
|
|
3139
3164
|
uuid: plain.uuid,
|
|
3140
3165
|
number: plain.number,
|
|
3166
|
+
persistent: plain.persistent,
|
|
3141
3167
|
});
|
|
3142
3168
|
}
|
|
3143
3169
|
|
|
3170
|
+
static parseMany(items ) {
|
|
3171
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3144
3174
|
static newFrom(meeting ) {
|
|
3145
3175
|
return newFrom(meeting, Meeting);
|
|
3146
3176
|
}
|
|
3147
3177
|
|
|
3148
|
-
constructor({
|
|
3178
|
+
constructor({
|
|
3179
|
+
uuid,
|
|
3180
|
+
name,
|
|
3181
|
+
guestSipAuthorization,
|
|
3182
|
+
ownerUuids,
|
|
3183
|
+
port,
|
|
3184
|
+
uri,
|
|
3185
|
+
number,
|
|
3186
|
+
persistent,
|
|
3187
|
+
} = {}) {
|
|
3149
3188
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3150
3189
|
this.uri = uri;
|
|
3151
3190
|
this.name = name;
|
|
@@ -3153,6 +3192,7 @@ class Meeting {
|
|
|
3153
3192
|
this.port = port;
|
|
3154
3193
|
this.uuid = uuid;
|
|
3155
3194
|
this.number = number;
|
|
3195
|
+
this.persistent = persistent;
|
|
3156
3196
|
|
|
3157
3197
|
// Useful to compare instead of instanceof with minified code
|
|
3158
3198
|
this.type = 'Meeting';
|
|
@@ -3230,8 +3270,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3230
3270
|
}
|
|
3231
3271
|
},
|
|
3232
3272
|
|
|
3233
|
-
|
|
3234
|
-
client.
|
|
3273
|
+
getMyMeetings: () =>
|
|
3274
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3275
|
+
|
|
3276
|
+
createMyMeeting: (name , persistent ) =>
|
|
3277
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3235
3278
|
|
|
3236
3279
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3237
3280
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -99,6 +99,7 @@ class IssueReporter {
|
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
|
|
102
|
+
|
|
102
103
|
|
|
103
104
|
constructor() {
|
|
104
105
|
addLevelsTo(this);
|
|
@@ -110,12 +111,17 @@ class IssueReporter {
|
|
|
110
111
|
this.bufferTimeout = null;
|
|
111
112
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
112
113
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
114
|
+
this._callback = null;
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
init() {
|
|
116
118
|
this._catchConsole();
|
|
117
119
|
}
|
|
118
120
|
|
|
121
|
+
setCallback(cb ) {
|
|
122
|
+
this._callback = cb;
|
|
123
|
+
}
|
|
124
|
+
|
|
119
125
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
120
126
|
this.remoteClientConfiguration = configuration;
|
|
121
127
|
}
|
|
@@ -151,6 +157,7 @@ class IssueReporter {
|
|
|
151
157
|
|
|
152
158
|
// Handle category label
|
|
153
159
|
let category = null;
|
|
160
|
+
let skipSendToRemote = false;
|
|
154
161
|
let extra = {};
|
|
155
162
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
156
163
|
category = args[0].split('=')[1];
|
|
@@ -166,6 +173,7 @@ class IssueReporter {
|
|
|
166
173
|
errorMessage: lastArg.message,
|
|
167
174
|
errorStack: lastArg.stack,
|
|
168
175
|
errorType: lastArg.constructor.name,
|
|
176
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
169
177
|
};
|
|
170
178
|
} else {
|
|
171
179
|
extra = lastArg;
|
|
@@ -174,6 +182,11 @@ class IssueReporter {
|
|
|
174
182
|
args.splice(1, 1);
|
|
175
183
|
}
|
|
176
184
|
|
|
185
|
+
if (extra.skipSendToRemote) {
|
|
186
|
+
skipSendToRemote = true;
|
|
187
|
+
delete extra.skipSendToRemote;
|
|
188
|
+
}
|
|
189
|
+
|
|
177
190
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
178
191
|
const message = args.join(', ');
|
|
179
192
|
let consoleMessage = message;
|
|
@@ -194,7 +207,13 @@ class IssueReporter {
|
|
|
194
207
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
195
208
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
196
209
|
|
|
197
|
-
this.
|
|
210
|
+
if (this._callback) {
|
|
211
|
+
this._callback(level, consoleMessage);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (!skipSendToRemote) {
|
|
215
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
216
|
+
}
|
|
198
217
|
}
|
|
199
218
|
|
|
200
219
|
logRequest(url , options , response , start ) {
|
|
@@ -339,7 +358,11 @@ class IssueReporter {
|
|
|
339
358
|
},
|
|
340
359
|
// $FlowFixMe
|
|
341
360
|
body,
|
|
342
|
-
}).catch(() => {
|
|
361
|
+
}).catch((e ) => {
|
|
362
|
+
// $FlowFixMe
|
|
363
|
+
e.skipSendToRemote = true;
|
|
364
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
365
|
+
|
|
343
366
|
setTimeout(() => {
|
|
344
367
|
if (isArray) {
|
|
345
368
|
payload = payload.map(message => {
|
|
@@ -351,7 +374,7 @@ class IssueReporter {
|
|
|
351
374
|
payload._retry = retry + 1;
|
|
352
375
|
}
|
|
353
376
|
|
|
354
|
-
this._sendDebugToGrafana(
|
|
377
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
355
378
|
}, 5000 + retry * 1000);
|
|
356
379
|
});
|
|
357
380
|
}
|
|
@@ -99,6 +99,7 @@ class IssueReporter {
|
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
|
|
102
|
+
|
|
102
103
|
|
|
103
104
|
constructor() {
|
|
104
105
|
addLevelsTo(this);
|
|
@@ -110,12 +111,17 @@ class IssueReporter {
|
|
|
110
111
|
this.bufferTimeout = null;
|
|
111
112
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
112
113
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
114
|
+
this._callback = null;
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
init() {
|
|
116
118
|
this._catchConsole();
|
|
117
119
|
}
|
|
118
120
|
|
|
121
|
+
setCallback(cb ) {
|
|
122
|
+
this._callback = cb;
|
|
123
|
+
}
|
|
124
|
+
|
|
119
125
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
120
126
|
this.remoteClientConfiguration = configuration;
|
|
121
127
|
}
|
|
@@ -151,6 +157,7 @@ class IssueReporter {
|
|
|
151
157
|
|
|
152
158
|
// Handle category label
|
|
153
159
|
let category = null;
|
|
160
|
+
let skipSendToRemote = false;
|
|
154
161
|
let extra = {};
|
|
155
162
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
156
163
|
category = args[0].split('=')[1];
|
|
@@ -166,6 +173,7 @@ class IssueReporter {
|
|
|
166
173
|
errorMessage: lastArg.message,
|
|
167
174
|
errorStack: lastArg.stack,
|
|
168
175
|
errorType: lastArg.constructor.name,
|
|
176
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
169
177
|
};
|
|
170
178
|
} else {
|
|
171
179
|
extra = lastArg;
|
|
@@ -174,6 +182,11 @@ class IssueReporter {
|
|
|
174
182
|
args.splice(1, 1);
|
|
175
183
|
}
|
|
176
184
|
|
|
185
|
+
if (extra.skipSendToRemote) {
|
|
186
|
+
skipSendToRemote = true;
|
|
187
|
+
delete extra.skipSendToRemote;
|
|
188
|
+
}
|
|
189
|
+
|
|
177
190
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
178
191
|
const message = args.join(', ');
|
|
179
192
|
let consoleMessage = message;
|
|
@@ -194,7 +207,13 @@ class IssueReporter {
|
|
|
194
207
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
195
208
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
196
209
|
|
|
197
|
-
this.
|
|
210
|
+
if (this._callback) {
|
|
211
|
+
this._callback(level, consoleMessage);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (!skipSendToRemote) {
|
|
215
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
216
|
+
}
|
|
198
217
|
}
|
|
199
218
|
|
|
200
219
|
logRequest(url , options , response , start ) {
|
|
@@ -339,7 +358,11 @@ class IssueReporter {
|
|
|
339
358
|
},
|
|
340
359
|
// $FlowFixMe
|
|
341
360
|
body,
|
|
342
|
-
}).catch(() => {
|
|
361
|
+
}).catch((e ) => {
|
|
362
|
+
// $FlowFixMe
|
|
363
|
+
e.skipSendToRemote = true;
|
|
364
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
365
|
+
|
|
343
366
|
setTimeout(() => {
|
|
344
367
|
if (isArray) {
|
|
345
368
|
payload = payload.map(message => {
|
|
@@ -351,7 +374,7 @@ class IssueReporter {
|
|
|
351
374
|
payload._retry = retry + 1;
|
|
352
375
|
}
|
|
353
376
|
|
|
354
|
-
this._sendDebugToGrafana(
|
|
377
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
355
378
|
}, 5000 + retry * 1000);
|
|
356
379
|
});
|
|
357
380
|
}
|
|
@@ -138,6 +138,7 @@ class IssueReporter {
|
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
141
|
+
|
|
141
142
|
|
|
142
143
|
constructor() {
|
|
143
144
|
addLevelsTo(this);
|
|
@@ -149,12 +150,17 @@ class IssueReporter {
|
|
|
149
150
|
this.bufferTimeout = null;
|
|
150
151
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
151
152
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
153
|
+
this._callback = null;
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
init() {
|
|
155
157
|
this._catchConsole();
|
|
156
158
|
}
|
|
157
159
|
|
|
160
|
+
setCallback(cb ) {
|
|
161
|
+
this._callback = cb;
|
|
162
|
+
}
|
|
163
|
+
|
|
158
164
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
159
165
|
this.remoteClientConfiguration = configuration;
|
|
160
166
|
}
|
|
@@ -190,6 +196,7 @@ class IssueReporter {
|
|
|
190
196
|
|
|
191
197
|
// Handle category label
|
|
192
198
|
let category = null;
|
|
199
|
+
let skipSendToRemote = false;
|
|
193
200
|
let extra = {};
|
|
194
201
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
195
202
|
category = args[0].split('=')[1];
|
|
@@ -205,6 +212,7 @@ class IssueReporter {
|
|
|
205
212
|
errorMessage: lastArg.message,
|
|
206
213
|
errorStack: lastArg.stack,
|
|
207
214
|
errorType: lastArg.constructor.name,
|
|
215
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
208
216
|
};
|
|
209
217
|
} else {
|
|
210
218
|
extra = lastArg;
|
|
@@ -213,6 +221,11 @@ class IssueReporter {
|
|
|
213
221
|
args.splice(1, 1);
|
|
214
222
|
}
|
|
215
223
|
|
|
224
|
+
if (extra.skipSendToRemote) {
|
|
225
|
+
skipSendToRemote = true;
|
|
226
|
+
delete extra.skipSendToRemote;
|
|
227
|
+
}
|
|
228
|
+
|
|
216
229
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
217
230
|
const message = args.join(', ');
|
|
218
231
|
let consoleMessage = message;
|
|
@@ -233,7 +246,13 @@ class IssueReporter {
|
|
|
233
246
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
234
247
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
235
248
|
|
|
236
|
-
this.
|
|
249
|
+
if (this._callback) {
|
|
250
|
+
this._callback(level, consoleMessage);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (!skipSendToRemote) {
|
|
254
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
255
|
+
}
|
|
237
256
|
}
|
|
238
257
|
|
|
239
258
|
logRequest(url , options , response , start ) {
|
|
@@ -378,7 +397,11 @@ class IssueReporter {
|
|
|
378
397
|
},
|
|
379
398
|
// $FlowFixMe
|
|
380
399
|
body,
|
|
381
|
-
}).catch(() => {
|
|
400
|
+
}).catch((e ) => {
|
|
401
|
+
// $FlowFixMe
|
|
402
|
+
e.skipSendToRemote = true;
|
|
403
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
404
|
+
|
|
382
405
|
setTimeout(() => {
|
|
383
406
|
if (isArray) {
|
|
384
407
|
payload = payload.map(message => {
|
|
@@ -390,7 +413,7 @@ class IssueReporter {
|
|
|
390
413
|
payload._retry = retry + 1;
|
|
391
414
|
}
|
|
392
415
|
|
|
393
|
-
this._sendDebugToGrafana(
|
|
416
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
394
417
|
}, 5000 + retry * 1000);
|
|
395
418
|
});
|
|
396
419
|
}
|
|
@@ -2593,7 +2616,8 @@ class ExternalApp {
|
|
|
2593
2616
|
|
|
2594
2617
|
|
|
2595
2618
|
|
|
2596
|
-
|
|
2619
|
+
|
|
2620
|
+
|
|
2597
2621
|
|
|
2598
2622
|
|
|
2599
2623
|
class Meeting {
|
|
@@ -2605,6 +2629,7 @@ class Meeting {
|
|
|
2605
2629
|
|
|
2606
2630
|
|
|
2607
2631
|
|
|
2632
|
+
|
|
2608
2633
|
|
|
2609
2634
|
|
|
2610
2635
|
static parse(plain ) {
|
|
@@ -2616,14 +2641,28 @@ class Meeting {
|
|
|
2616
2641
|
port: plain.port,
|
|
2617
2642
|
uuid: plain.uuid,
|
|
2618
2643
|
number: plain.number,
|
|
2644
|
+
persistent: plain.persistent,
|
|
2619
2645
|
});
|
|
2620
2646
|
}
|
|
2621
2647
|
|
|
2648
|
+
static parseMany(items ) {
|
|
2649
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2622
2652
|
static newFrom(meeting ) {
|
|
2623
2653
|
return newFrom(meeting, Meeting);
|
|
2624
2654
|
}
|
|
2625
2655
|
|
|
2626
|
-
constructor({
|
|
2656
|
+
constructor({
|
|
2657
|
+
uuid,
|
|
2658
|
+
name,
|
|
2659
|
+
guestSipAuthorization,
|
|
2660
|
+
ownerUuids,
|
|
2661
|
+
port,
|
|
2662
|
+
uri,
|
|
2663
|
+
number,
|
|
2664
|
+
persistent,
|
|
2665
|
+
} = {}) {
|
|
2627
2666
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2628
2667
|
this.uri = uri;
|
|
2629
2668
|
this.name = name;
|
|
@@ -2631,6 +2670,7 @@ class Meeting {
|
|
|
2631
2670
|
this.port = port;
|
|
2632
2671
|
this.uuid = uuid;
|
|
2633
2672
|
this.number = number;
|
|
2673
|
+
this.persistent = persistent;
|
|
2634
2674
|
|
|
2635
2675
|
// Useful to compare instead of instanceof with minified code
|
|
2636
2676
|
this.type = 'Meeting';
|
|
@@ -2708,8 +2748,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2708
2748
|
}
|
|
2709
2749
|
},
|
|
2710
2750
|
|
|
2711
|
-
|
|
2712
|
-
client.
|
|
2751
|
+
getMyMeetings: () =>
|
|
2752
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2753
|
+
|
|
2754
|
+
createMyMeeting: (name , persistent ) =>
|
|
2755
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2713
2756
|
|
|
2714
2757
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2715
2758
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3194,7 +3237,7 @@ class Recording {
|
|
|
3194
3237
|
|
|
3195
3238
|
|
|
3196
3239
|
|
|
3197
|
-
static parseMany(recordings
|
|
3240
|
+
static parseMany(recordings = []) {
|
|
3198
3241
|
return recordings.map(item => Recording.parse(item));
|
|
3199
3242
|
}
|
|
3200
3243
|
|
|
@@ -3320,7 +3363,7 @@ class CallLog {
|
|
|
3320
3363
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3321
3364
|
start: moment__default['default'](plain.start).toDate(),
|
|
3322
3365
|
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3323
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3366
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3324
3367
|
});
|
|
3325
3368
|
}
|
|
3326
3369
|
|