@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/application.js
CHANGED
|
@@ -126,6 +126,7 @@ class IssueReporter {
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
|
|
129
130
|
|
|
130
131
|
constructor() {
|
|
131
132
|
addLevelsTo(this);
|
|
@@ -137,12 +138,17 @@ class IssueReporter {
|
|
|
137
138
|
this.bufferTimeout = null;
|
|
138
139
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
139
140
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
141
|
+
this._callback = null;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
init() {
|
|
143
145
|
this._catchConsole();
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
setCallback(cb ) {
|
|
149
|
+
this._callback = cb;
|
|
150
|
+
}
|
|
151
|
+
|
|
146
152
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
147
153
|
this.remoteClientConfiguration = configuration;
|
|
148
154
|
}
|
|
@@ -178,6 +184,7 @@ class IssueReporter {
|
|
|
178
184
|
|
|
179
185
|
// Handle category label
|
|
180
186
|
let category = null;
|
|
187
|
+
let skipSendToRemote = false;
|
|
181
188
|
let extra = {};
|
|
182
189
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
183
190
|
category = args[0].split('=')[1];
|
|
@@ -193,6 +200,7 @@ class IssueReporter {
|
|
|
193
200
|
errorMessage: lastArg.message,
|
|
194
201
|
errorStack: lastArg.stack,
|
|
195
202
|
errorType: lastArg.constructor.name,
|
|
203
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
196
204
|
};
|
|
197
205
|
} else {
|
|
198
206
|
extra = lastArg;
|
|
@@ -201,6 +209,11 @@ class IssueReporter {
|
|
|
201
209
|
args.splice(1, 1);
|
|
202
210
|
}
|
|
203
211
|
|
|
212
|
+
if (extra.skipSendToRemote) {
|
|
213
|
+
skipSendToRemote = true;
|
|
214
|
+
delete extra.skipSendToRemote;
|
|
215
|
+
}
|
|
216
|
+
|
|
204
217
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
205
218
|
const message = args.join(', ');
|
|
206
219
|
let consoleMessage = message;
|
|
@@ -221,7 +234,13 @@ class IssueReporter {
|
|
|
221
234
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
222
235
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
223
236
|
|
|
224
|
-
this.
|
|
237
|
+
if (this._callback) {
|
|
238
|
+
this._callback(level, consoleMessage);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!skipSendToRemote) {
|
|
242
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
243
|
+
}
|
|
225
244
|
}
|
|
226
245
|
|
|
227
246
|
logRequest(url , options , response , start ) {
|
|
@@ -366,7 +385,11 @@ class IssueReporter {
|
|
|
366
385
|
},
|
|
367
386
|
// $FlowFixMe
|
|
368
387
|
body,
|
|
369
|
-
}).catch(() => {
|
|
388
|
+
}).catch((e ) => {
|
|
389
|
+
// $FlowFixMe
|
|
390
|
+
e.skipSendToRemote = true;
|
|
391
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
392
|
+
|
|
370
393
|
setTimeout(() => {
|
|
371
394
|
if (isArray) {
|
|
372
395
|
payload = payload.map(message => {
|
|
@@ -378,7 +401,7 @@ class IssueReporter {
|
|
|
378
401
|
payload._retry = retry + 1;
|
|
379
402
|
}
|
|
380
403
|
|
|
381
|
-
this._sendDebugToGrafana(
|
|
404
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
382
405
|
}, 5000 + retry * 1000);
|
|
383
406
|
});
|
|
384
407
|
}
|
|
@@ -801,4 +824,4 @@ var application = (client , baseUrl ) => ({
|
|
|
801
824
|
ApiRequester.successResponseParser),
|
|
802
825
|
});
|
|
803
826
|
|
|
804
|
-
export
|
|
827
|
+
export default application;
|
package/esm/api/auth.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
|
|
|
5
5
|
/* */
|
|
6
6
|
|
|
@@ -127,6 +127,7 @@ class IssueReporter {
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
130
|
+
|
|
130
131
|
|
|
131
132
|
constructor() {
|
|
132
133
|
addLevelsTo(this);
|
|
@@ -138,12 +139,17 @@ class IssueReporter {
|
|
|
138
139
|
this.bufferTimeout = null;
|
|
139
140
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
140
141
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
142
|
+
this._callback = null;
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
init() {
|
|
144
146
|
this._catchConsole();
|
|
145
147
|
}
|
|
146
148
|
|
|
149
|
+
setCallback(cb ) {
|
|
150
|
+
this._callback = cb;
|
|
151
|
+
}
|
|
152
|
+
|
|
147
153
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
148
154
|
this.remoteClientConfiguration = configuration;
|
|
149
155
|
}
|
|
@@ -179,6 +185,7 @@ class IssueReporter {
|
|
|
179
185
|
|
|
180
186
|
// Handle category label
|
|
181
187
|
let category = null;
|
|
188
|
+
let skipSendToRemote = false;
|
|
182
189
|
let extra = {};
|
|
183
190
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
184
191
|
category = args[0].split('=')[1];
|
|
@@ -194,6 +201,7 @@ class IssueReporter {
|
|
|
194
201
|
errorMessage: lastArg.message,
|
|
195
202
|
errorStack: lastArg.stack,
|
|
196
203
|
errorType: lastArg.constructor.name,
|
|
204
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
197
205
|
};
|
|
198
206
|
} else {
|
|
199
207
|
extra = lastArg;
|
|
@@ -202,6 +210,11 @@ class IssueReporter {
|
|
|
202
210
|
args.splice(1, 1);
|
|
203
211
|
}
|
|
204
212
|
|
|
213
|
+
if (extra.skipSendToRemote) {
|
|
214
|
+
skipSendToRemote = true;
|
|
215
|
+
delete extra.skipSendToRemote;
|
|
216
|
+
}
|
|
217
|
+
|
|
205
218
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
206
219
|
const message = args.join(', ');
|
|
207
220
|
let consoleMessage = message;
|
|
@@ -222,7 +235,13 @@ class IssueReporter {
|
|
|
222
235
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
223
236
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
224
237
|
|
|
225
|
-
this.
|
|
238
|
+
if (this._callback) {
|
|
239
|
+
this._callback(level, consoleMessage);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (!skipSendToRemote) {
|
|
243
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
244
|
+
}
|
|
226
245
|
}
|
|
227
246
|
|
|
228
247
|
logRequest(url , options , response , start ) {
|
|
@@ -367,7 +386,11 @@ class IssueReporter {
|
|
|
367
386
|
},
|
|
368
387
|
// $FlowFixMe
|
|
369
388
|
body,
|
|
370
|
-
}).catch(() => {
|
|
389
|
+
}).catch((e ) => {
|
|
390
|
+
// $FlowFixMe
|
|
391
|
+
e.skipSendToRemote = true;
|
|
392
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
393
|
+
|
|
371
394
|
setTimeout(() => {
|
|
372
395
|
if (isArray) {
|
|
373
396
|
payload = payload.map(message => {
|
|
@@ -379,7 +402,7 @@ class IssueReporter {
|
|
|
379
402
|
payload._retry = retry + 1;
|
|
380
403
|
}
|
|
381
404
|
|
|
382
|
-
this._sendDebugToGrafana(
|
|
405
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
383
406
|
}, 5000 + retry * 1000);
|
|
384
407
|
});
|
|
385
408
|
}
|
|
@@ -1161,4 +1184,5 @@ var auth = (client , baseUrl ) => ({
|
|
|
1161
1184
|
client.delete(`${baseUrl}/users/${userUuid}/external/${provider}`),
|
|
1162
1185
|
});
|
|
1163
1186
|
|
|
1164
|
-
export
|
|
1187
|
+
export default auth;
|
|
1188
|
+
export { DETAULT_EXPIRATION };
|
package/esm/api/call-logd.js
CHANGED
|
@@ -66,6 +66,7 @@ class IssueReporter {
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
|
|
69
70
|
|
|
70
71
|
constructor() {
|
|
71
72
|
addLevelsTo(this);
|
|
@@ -77,12 +78,17 @@ class IssueReporter {
|
|
|
77
78
|
this.bufferTimeout = null;
|
|
78
79
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
79
80
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
81
|
+
this._callback = null;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
init() {
|
|
83
85
|
this._catchConsole();
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
setCallback(cb ) {
|
|
89
|
+
this._callback = cb;
|
|
90
|
+
}
|
|
91
|
+
|
|
86
92
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
87
93
|
this.remoteClientConfiguration = configuration;
|
|
88
94
|
}
|
|
@@ -118,6 +124,7 @@ class IssueReporter {
|
|
|
118
124
|
|
|
119
125
|
// Handle category label
|
|
120
126
|
let category = null;
|
|
127
|
+
let skipSendToRemote = false;
|
|
121
128
|
let extra = {};
|
|
122
129
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
123
130
|
category = args[0].split('=')[1];
|
|
@@ -133,6 +140,7 @@ class IssueReporter {
|
|
|
133
140
|
errorMessage: lastArg.message,
|
|
134
141
|
errorStack: lastArg.stack,
|
|
135
142
|
errorType: lastArg.constructor.name,
|
|
143
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
136
144
|
};
|
|
137
145
|
} else {
|
|
138
146
|
extra = lastArg;
|
|
@@ -141,6 +149,11 @@ class IssueReporter {
|
|
|
141
149
|
args.splice(1, 1);
|
|
142
150
|
}
|
|
143
151
|
|
|
152
|
+
if (extra.skipSendToRemote) {
|
|
153
|
+
skipSendToRemote = true;
|
|
154
|
+
delete extra.skipSendToRemote;
|
|
155
|
+
}
|
|
156
|
+
|
|
144
157
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
145
158
|
const message = args.join(', ');
|
|
146
159
|
let consoleMessage = message;
|
|
@@ -161,7 +174,13 @@ class IssueReporter {
|
|
|
161
174
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
162
175
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
163
176
|
|
|
164
|
-
this.
|
|
177
|
+
if (this._callback) {
|
|
178
|
+
this._callback(level, consoleMessage);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (!skipSendToRemote) {
|
|
182
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
183
|
+
}
|
|
165
184
|
}
|
|
166
185
|
|
|
167
186
|
logRequest(url , options , response , start ) {
|
|
@@ -306,7 +325,11 @@ class IssueReporter {
|
|
|
306
325
|
},
|
|
307
326
|
// $FlowFixMe
|
|
308
327
|
body,
|
|
309
|
-
}).catch(() => {
|
|
328
|
+
}).catch((e ) => {
|
|
329
|
+
// $FlowFixMe
|
|
330
|
+
e.skipSendToRemote = true;
|
|
331
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
332
|
+
|
|
310
333
|
setTimeout(() => {
|
|
311
334
|
if (isArray) {
|
|
312
335
|
payload = payload.map(message => {
|
|
@@ -318,7 +341,7 @@ class IssueReporter {
|
|
|
318
341
|
payload._retry = retry + 1;
|
|
319
342
|
}
|
|
320
343
|
|
|
321
|
-
this._sendDebugToGrafana(
|
|
344
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
322
345
|
}, 5000 + retry * 1000);
|
|
323
346
|
});
|
|
324
347
|
}
|
|
@@ -420,7 +443,7 @@ class Recording {
|
|
|
420
443
|
|
|
421
444
|
|
|
422
445
|
|
|
423
|
-
static parseMany(recordings
|
|
446
|
+
static parseMany(recordings = []) {
|
|
424
447
|
return recordings.map(item => Recording.parse(item));
|
|
425
448
|
}
|
|
426
449
|
|
|
@@ -546,7 +569,7 @@ class CallLog {
|
|
|
546
569
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
547
570
|
start: moment(plain.start).toDate(),
|
|
548
571
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
549
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
572
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
550
573
|
});
|
|
551
574
|
}
|
|
552
575
|
|
|
@@ -689,4 +712,4 @@ var callLogd = (client , baseUrl ) => ({
|
|
|
689
712
|
client.get(`${baseUrl}/users/me/cdr`, { from: from.toISOString(), number }).then(CallLog.parseMany),
|
|
690
713
|
});
|
|
691
714
|
|
|
692
|
-
export
|
|
715
|
+
export default callLogd;
|
package/esm/api/calld.js
CHANGED
|
@@ -127,6 +127,7 @@ class IssueReporter {
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
130
|
+
|
|
130
131
|
|
|
131
132
|
constructor() {
|
|
132
133
|
addLevelsTo(this);
|
|
@@ -138,12 +139,17 @@ class IssueReporter {
|
|
|
138
139
|
this.bufferTimeout = null;
|
|
139
140
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
140
141
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
142
|
+
this._callback = null;
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
init() {
|
|
144
146
|
this._catchConsole();
|
|
145
147
|
}
|
|
146
148
|
|
|
149
|
+
setCallback(cb ) {
|
|
150
|
+
this._callback = cb;
|
|
151
|
+
}
|
|
152
|
+
|
|
147
153
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
148
154
|
this.remoteClientConfiguration = configuration;
|
|
149
155
|
}
|
|
@@ -179,6 +185,7 @@ class IssueReporter {
|
|
|
179
185
|
|
|
180
186
|
// Handle category label
|
|
181
187
|
let category = null;
|
|
188
|
+
let skipSendToRemote = false;
|
|
182
189
|
let extra = {};
|
|
183
190
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
184
191
|
category = args[0].split('=')[1];
|
|
@@ -194,6 +201,7 @@ class IssueReporter {
|
|
|
194
201
|
errorMessage: lastArg.message,
|
|
195
202
|
errorStack: lastArg.stack,
|
|
196
203
|
errorType: lastArg.constructor.name,
|
|
204
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
197
205
|
};
|
|
198
206
|
} else {
|
|
199
207
|
extra = lastArg;
|
|
@@ -202,6 +210,11 @@ class IssueReporter {
|
|
|
202
210
|
args.splice(1, 1);
|
|
203
211
|
}
|
|
204
212
|
|
|
213
|
+
if (extra.skipSendToRemote) {
|
|
214
|
+
skipSendToRemote = true;
|
|
215
|
+
delete extra.skipSendToRemote;
|
|
216
|
+
}
|
|
217
|
+
|
|
205
218
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
206
219
|
const message = args.join(', ');
|
|
207
220
|
let consoleMessage = message;
|
|
@@ -222,7 +235,13 @@ class IssueReporter {
|
|
|
222
235
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
223
236
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
224
237
|
|
|
225
|
-
this.
|
|
238
|
+
if (this._callback) {
|
|
239
|
+
this._callback(level, consoleMessage);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (!skipSendToRemote) {
|
|
243
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
244
|
+
}
|
|
226
245
|
}
|
|
227
246
|
|
|
228
247
|
logRequest(url , options , response , start ) {
|
|
@@ -367,7 +386,11 @@ class IssueReporter {
|
|
|
367
386
|
},
|
|
368
387
|
// $FlowFixMe
|
|
369
388
|
body,
|
|
370
|
-
}).catch(() => {
|
|
389
|
+
}).catch((e ) => {
|
|
390
|
+
// $FlowFixMe
|
|
391
|
+
e.skipSendToRemote = true;
|
|
392
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
393
|
+
|
|
371
394
|
setTimeout(() => {
|
|
372
395
|
if (isArray) {
|
|
373
396
|
payload = payload.map(message => {
|
|
@@ -379,7 +402,7 @@ class IssueReporter {
|
|
|
379
402
|
payload._retry = retry + 1;
|
|
380
403
|
}
|
|
381
404
|
|
|
382
|
-
this._sendDebugToGrafana(
|
|
405
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
383
406
|
}, 5000 + retry * 1000);
|
|
384
407
|
});
|
|
385
408
|
}
|
|
@@ -1389,4 +1412,4 @@ var calld = (client , baseUrl ) => ({
|
|
|
1389
1412
|
|
|
1390
1413
|
});
|
|
1391
1414
|
|
|
1392
|
-
export
|
|
1415
|
+
export default calld;
|
package/esm/api/chatd.js
CHANGED
|
@@ -126,6 +126,7 @@ class IssueReporter {
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
|
|
129
130
|
|
|
130
131
|
constructor() {
|
|
131
132
|
addLevelsTo(this);
|
|
@@ -137,12 +138,17 @@ class IssueReporter {
|
|
|
137
138
|
this.bufferTimeout = null;
|
|
138
139
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
139
140
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
141
|
+
this._callback = null;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
init() {
|
|
143
145
|
this._catchConsole();
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
setCallback(cb ) {
|
|
149
|
+
this._callback = cb;
|
|
150
|
+
}
|
|
151
|
+
|
|
146
152
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
147
153
|
this.remoteClientConfiguration = configuration;
|
|
148
154
|
}
|
|
@@ -178,6 +184,7 @@ class IssueReporter {
|
|
|
178
184
|
|
|
179
185
|
// Handle category label
|
|
180
186
|
let category = null;
|
|
187
|
+
let skipSendToRemote = false;
|
|
181
188
|
let extra = {};
|
|
182
189
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
183
190
|
category = args[0].split('=')[1];
|
|
@@ -193,6 +200,7 @@ class IssueReporter {
|
|
|
193
200
|
errorMessage: lastArg.message,
|
|
194
201
|
errorStack: lastArg.stack,
|
|
195
202
|
errorType: lastArg.constructor.name,
|
|
203
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
196
204
|
};
|
|
197
205
|
} else {
|
|
198
206
|
extra = lastArg;
|
|
@@ -201,6 +209,11 @@ class IssueReporter {
|
|
|
201
209
|
args.splice(1, 1);
|
|
202
210
|
}
|
|
203
211
|
|
|
212
|
+
if (extra.skipSendToRemote) {
|
|
213
|
+
skipSendToRemote = true;
|
|
214
|
+
delete extra.skipSendToRemote;
|
|
215
|
+
}
|
|
216
|
+
|
|
204
217
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
205
218
|
const message = args.join(', ');
|
|
206
219
|
let consoleMessage = message;
|
|
@@ -221,7 +234,13 @@ class IssueReporter {
|
|
|
221
234
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
222
235
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
223
236
|
|
|
224
|
-
this.
|
|
237
|
+
if (this._callback) {
|
|
238
|
+
this._callback(level, consoleMessage);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!skipSendToRemote) {
|
|
242
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
243
|
+
}
|
|
225
244
|
}
|
|
226
245
|
|
|
227
246
|
logRequest(url , options , response , start ) {
|
|
@@ -366,7 +385,11 @@ class IssueReporter {
|
|
|
366
385
|
},
|
|
367
386
|
// $FlowFixMe
|
|
368
387
|
body,
|
|
369
|
-
}).catch(() => {
|
|
388
|
+
}).catch((e ) => {
|
|
389
|
+
// $FlowFixMe
|
|
390
|
+
e.skipSendToRemote = true;
|
|
391
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
392
|
+
|
|
370
393
|
setTimeout(() => {
|
|
371
394
|
if (isArray) {
|
|
372
395
|
payload = payload.map(message => {
|
|
@@ -378,7 +401,7 @@ class IssueReporter {
|
|
|
378
401
|
payload._retry = retry + 1;
|
|
379
402
|
}
|
|
380
403
|
|
|
381
|
-
this._sendDebugToGrafana(
|
|
404
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
382
405
|
}, 5000 + retry * 1000);
|
|
383
406
|
});
|
|
384
407
|
}
|
|
@@ -1267,4 +1290,4 @@ var chatd = (client , baseUrl ) => ({
|
|
|
1267
1290
|
client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
1268
1291
|
});
|
|
1269
1292
|
|
|
1270
|
-
export
|
|
1293
|
+
export default chatd;
|
package/esm/api/confd.js
CHANGED
|
@@ -126,6 +126,7 @@ class IssueReporter {
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
|
|
129
130
|
|
|
130
131
|
constructor() {
|
|
131
132
|
addLevelsTo(this);
|
|
@@ -137,12 +138,17 @@ class IssueReporter {
|
|
|
137
138
|
this.bufferTimeout = null;
|
|
138
139
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
139
140
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
141
|
+
this._callback = null;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
init() {
|
|
143
145
|
this._catchConsole();
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
setCallback(cb ) {
|
|
149
|
+
this._callback = cb;
|
|
150
|
+
}
|
|
151
|
+
|
|
146
152
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
147
153
|
this.remoteClientConfiguration = configuration;
|
|
148
154
|
}
|
|
@@ -178,6 +184,7 @@ class IssueReporter {
|
|
|
178
184
|
|
|
179
185
|
// Handle category label
|
|
180
186
|
let category = null;
|
|
187
|
+
let skipSendToRemote = false;
|
|
181
188
|
let extra = {};
|
|
182
189
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
183
190
|
category = args[0].split('=')[1];
|
|
@@ -193,6 +200,7 @@ class IssueReporter {
|
|
|
193
200
|
errorMessage: lastArg.message,
|
|
194
201
|
errorStack: lastArg.stack,
|
|
195
202
|
errorType: lastArg.constructor.name,
|
|
203
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
196
204
|
};
|
|
197
205
|
} else {
|
|
198
206
|
extra = lastArg;
|
|
@@ -201,6 +209,11 @@ class IssueReporter {
|
|
|
201
209
|
args.splice(1, 1);
|
|
202
210
|
}
|
|
203
211
|
|
|
212
|
+
if (extra.skipSendToRemote) {
|
|
213
|
+
skipSendToRemote = true;
|
|
214
|
+
delete extra.skipSendToRemote;
|
|
215
|
+
}
|
|
216
|
+
|
|
204
217
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
205
218
|
const message = args.join(', ');
|
|
206
219
|
let consoleMessage = message;
|
|
@@ -221,7 +234,13 @@ class IssueReporter {
|
|
|
221
234
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
222
235
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
223
236
|
|
|
224
|
-
this.
|
|
237
|
+
if (this._callback) {
|
|
238
|
+
this._callback(level, consoleMessage);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!skipSendToRemote) {
|
|
242
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
243
|
+
}
|
|
225
244
|
}
|
|
226
245
|
|
|
227
246
|
logRequest(url , options , response , start ) {
|
|
@@ -366,7 +385,11 @@ class IssueReporter {
|
|
|
366
385
|
},
|
|
367
386
|
// $FlowFixMe
|
|
368
387
|
body,
|
|
369
|
-
}).catch(() => {
|
|
388
|
+
}).catch((e ) => {
|
|
389
|
+
// $FlowFixMe
|
|
390
|
+
e.skipSendToRemote = true;
|
|
391
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
392
|
+
|
|
370
393
|
setTimeout(() => {
|
|
371
394
|
if (isArray) {
|
|
372
395
|
payload = payload.map(message => {
|
|
@@ -378,7 +401,7 @@ class IssueReporter {
|
|
|
378
401
|
payload._retry = retry + 1;
|
|
379
402
|
}
|
|
380
403
|
|
|
381
|
-
this._sendDebugToGrafana(
|
|
404
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
382
405
|
}, 5000 + retry * 1000);
|
|
383
406
|
});
|
|
384
407
|
}
|
|
@@ -1259,7 +1282,8 @@ class ExternalApp {
|
|
|
1259
1282
|
|
|
1260
1283
|
|
|
1261
1284
|
|
|
1262
|
-
|
|
1285
|
+
|
|
1286
|
+
|
|
1263
1287
|
|
|
1264
1288
|
|
|
1265
1289
|
class Meeting {
|
|
@@ -1271,6 +1295,7 @@ class Meeting {
|
|
|
1271
1295
|
|
|
1272
1296
|
|
|
1273
1297
|
|
|
1298
|
+
|
|
1274
1299
|
|
|
1275
1300
|
|
|
1276
1301
|
static parse(plain ) {
|
|
@@ -1282,14 +1307,28 @@ class Meeting {
|
|
|
1282
1307
|
port: plain.port,
|
|
1283
1308
|
uuid: plain.uuid,
|
|
1284
1309
|
number: plain.number,
|
|
1310
|
+
persistent: plain.persistent,
|
|
1285
1311
|
});
|
|
1286
1312
|
}
|
|
1287
1313
|
|
|
1314
|
+
static parseMany(items ) {
|
|
1315
|
+
return items.map(plain => Meeting.parse(plain));
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1288
1318
|
static newFrom(meeting ) {
|
|
1289
1319
|
return newFrom(meeting, Meeting);
|
|
1290
1320
|
}
|
|
1291
1321
|
|
|
1292
|
-
constructor({
|
|
1322
|
+
constructor({
|
|
1323
|
+
uuid,
|
|
1324
|
+
name,
|
|
1325
|
+
guestSipAuthorization,
|
|
1326
|
+
ownerUuids,
|
|
1327
|
+
port,
|
|
1328
|
+
uri,
|
|
1329
|
+
number,
|
|
1330
|
+
persistent,
|
|
1331
|
+
} = {}) {
|
|
1293
1332
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
1294
1333
|
this.uri = uri;
|
|
1295
1334
|
this.name = name;
|
|
@@ -1297,6 +1336,7 @@ class Meeting {
|
|
|
1297
1336
|
this.port = port;
|
|
1298
1337
|
this.uuid = uuid;
|
|
1299
1338
|
this.number = number;
|
|
1339
|
+
this.persistent = persistent;
|
|
1300
1340
|
|
|
1301
1341
|
// Useful to compare instead of instanceof with minified code
|
|
1302
1342
|
this.type = 'Meeting';
|
|
@@ -1374,8 +1414,11 @@ var confd = (client , baseUrl ) => ({
|
|
|
1374
1414
|
}
|
|
1375
1415
|
},
|
|
1376
1416
|
|
|
1377
|
-
|
|
1378
|
-
client.
|
|
1417
|
+
getMyMeetings: () =>
|
|
1418
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
1419
|
+
|
|
1420
|
+
createMyMeeting: (name , persistent ) =>
|
|
1421
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
1379
1422
|
|
|
1380
1423
|
deleteMyMeeting: (meetingUuid ) =>
|
|
1381
1424
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -1387,4 +1430,4 @@ var confd = (client , baseUrl ) => ({
|
|
|
1387
1430
|
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
|
|
1388
1431
|
});
|
|
1389
1432
|
|
|
1390
|
-
export
|
|
1433
|
+
export default confd;
|