@wazo/sdk 0.37.20 → 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 +5 -5
- package/esm/__tests__/api-client.test.js +44 -5
- package/esm/__tests__/web-rtc-client.test.js +70 -15
- 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 +25 -2
- package/esm/api/calld.js +25 -2
- package/esm/api/chatd.js +25 -2
- package/esm/api/confd.js +44 -5
- package/esm/api/ctid-ng.js +25 -2
- package/esm/api/dird.js +25 -2
- package/esm/api/webhookd.js +25 -2
- package/esm/api-client.js +44 -5
- package/esm/checker/Checker.js +72 -15
- package/esm/checker/checks/aor.js +44 -5
- package/esm/checker/checks/api.js +44 -5
- package/esm/checker/checks/index.js +72 -15
- package/esm/checker/checks/wazo-websocket.js +27 -2
- package/esm/checker/checks/webrtc-transport.js +70 -15
- package/esm/checker/checks/webrtc.js +70 -15
- package/esm/domain/AdHocAPIConference.js +44 -5
- package/esm/domain/Features.js +44 -5
- package/esm/domain/Meeting.js +14 -1
- package/esm/domain/Phone/CTIPhone.js +44 -5
- package/esm/domain/Phone/WebRTCPhone.js +32 -3
- package/esm/index.js +85 -16
- package/esm/lib/WazoSessionDescriptionHandler.js +25 -2
- package/esm/service/CallApi.js +44 -5
- package/esm/service/IssueReporter.js +25 -2
- package/esm/service/__tests__/IssueReporter.test.js +25 -2
- package/esm/service/getApiClient.js +44 -5
- package/esm/simple/Auth.js +85 -16
- package/esm/simple/Configuration.js +85 -16
- package/esm/simple/Directory.js +44 -5
- package/esm/simple/Phone.js +85 -16
- package/esm/simple/Websocket.js +28 -2
- package/esm/simple/index.js +85 -16
- package/esm/simple/room/LocalParticipant.js +85 -16
- package/esm/simple/room/Participant.js +85 -16
- package/esm/simple/room/RemoteParticipant.js +85 -16
- package/esm/simple/room/Room.js +85 -16
- package/esm/simple/room/SipRoom.js +85 -16
- package/esm/simple/room/Stream.js +85 -16
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +85 -16
- package/esm/simple/utils.js +85 -16
- package/esm/utils/__tests__/api-requester.test.js +25 -2
- package/esm/utils/api-requester.js +25 -2
- package/esm/web-rtc-client.js +70 -15
- package/esm/websocket-client.js +28 -3
- package/lib/__tests__/api-client.test.js +44 -5
- package/lib/__tests__/web-rtc-client.test.js +70 -15
- 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 +25 -2
- package/lib/api/calld.js +25 -2
- package/lib/api/chatd.js +25 -2
- package/lib/api/confd.js +44 -5
- package/lib/api/ctid-ng.js +25 -2
- package/lib/api/dird.js +25 -2
- package/lib/api/webhookd.js +25 -2
- package/lib/api-client.js +44 -5
- package/lib/checker/Checker.js +72 -15
- package/lib/checker/checks/aor.js +44 -5
- package/lib/checker/checks/api.js +44 -5
- package/lib/checker/checks/index.js +72 -15
- package/lib/checker/checks/wazo-websocket.js +27 -2
- package/lib/checker/checks/webrtc-transport.js +70 -15
- package/lib/checker/checks/webrtc.js +70 -15
- package/lib/domain/AdHocAPIConference.js +44 -5
- package/lib/domain/Features.js +44 -5
- package/lib/domain/Meeting.js +14 -1
- package/lib/domain/Phone/CTIPhone.js +44 -5
- package/lib/domain/Phone/WebRTCPhone.js +32 -3
- package/lib/index.js +85 -16
- package/lib/lib/WazoSessionDescriptionHandler.js +25 -2
- package/lib/service/CallApi.js +44 -5
- package/lib/service/IssueReporter.js +25 -2
- package/lib/service/__tests__/IssueReporter.test.js +25 -2
- package/lib/service/getApiClient.js +44 -5
- package/lib/simple/Auth.js +85 -16
- package/lib/simple/Configuration.js +85 -16
- package/lib/simple/Directory.js +44 -5
- package/lib/simple/Phone.js +85 -16
- package/lib/simple/Websocket.js +28 -2
- package/lib/simple/index.js +85 -16
- package/lib/simple/room/LocalParticipant.js +85 -16
- package/lib/simple/room/Participant.js +85 -16
- package/lib/simple/room/RemoteParticipant.js +85 -16
- package/lib/simple/room/Room.js +85 -16
- package/lib/simple/room/SipRoom.js +85 -16
- package/lib/simple/room/Stream.js +85 -16
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +85 -16
- package/lib/simple/utils.js +85 -16
- package/lib/utils/__tests__/api-requester.test.js +25 -2
- package/lib/utils/api-requester.js +25 -2
- package/lib/web-rtc-client.js +70 -15
- package/lib/websocket-client.js +28 -2
- package/package.json +1 -1
- package/src/api/confd.js +5 -2
- package/src/domain/Meeting.js +14 -1
- package/src/domain/Phone/WebRTCPhone.js +7 -1
- 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 +26 -10
- package/src/websocket-client.js +2 -0
package/lib/checker/Checker.js
CHANGED
|
@@ -158,6 +158,7 @@ class IssueReporter {
|
|
|
158
158
|
|
|
159
159
|
|
|
160
160
|
|
|
161
|
+
|
|
161
162
|
|
|
162
163
|
constructor() {
|
|
163
164
|
addLevelsTo(this);
|
|
@@ -169,12 +170,17 @@ class IssueReporter {
|
|
|
169
170
|
this.bufferTimeout = null;
|
|
170
171
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
171
172
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
173
|
+
this._callback = null;
|
|
172
174
|
}
|
|
173
175
|
|
|
174
176
|
init() {
|
|
175
177
|
this._catchConsole();
|
|
176
178
|
}
|
|
177
179
|
|
|
180
|
+
setCallback(cb ) {
|
|
181
|
+
this._callback = cb;
|
|
182
|
+
}
|
|
183
|
+
|
|
178
184
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
179
185
|
this.remoteClientConfiguration = configuration;
|
|
180
186
|
}
|
|
@@ -210,6 +216,7 @@ class IssueReporter {
|
|
|
210
216
|
|
|
211
217
|
// Handle category label
|
|
212
218
|
let category = null;
|
|
219
|
+
let skipSendToRemote = false;
|
|
213
220
|
let extra = {};
|
|
214
221
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
215
222
|
category = args[0].split('=')[1];
|
|
@@ -225,6 +232,7 @@ class IssueReporter {
|
|
|
225
232
|
errorMessage: lastArg.message,
|
|
226
233
|
errorStack: lastArg.stack,
|
|
227
234
|
errorType: lastArg.constructor.name,
|
|
235
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
228
236
|
};
|
|
229
237
|
} else {
|
|
230
238
|
extra = lastArg;
|
|
@@ -233,6 +241,11 @@ class IssueReporter {
|
|
|
233
241
|
args.splice(1, 1);
|
|
234
242
|
}
|
|
235
243
|
|
|
244
|
+
if (extra.skipSendToRemote) {
|
|
245
|
+
skipSendToRemote = true;
|
|
246
|
+
delete extra.skipSendToRemote;
|
|
247
|
+
}
|
|
248
|
+
|
|
236
249
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
237
250
|
const message = args.join(', ');
|
|
238
251
|
let consoleMessage = message;
|
|
@@ -253,7 +266,13 @@ class IssueReporter {
|
|
|
253
266
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
254
267
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
255
268
|
|
|
256
|
-
this.
|
|
269
|
+
if (this._callback) {
|
|
270
|
+
this._callback(level, consoleMessage);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (!skipSendToRemote) {
|
|
274
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
275
|
+
}
|
|
257
276
|
}
|
|
258
277
|
|
|
259
278
|
logRequest(url , options , response , start ) {
|
|
@@ -398,7 +417,11 @@ class IssueReporter {
|
|
|
398
417
|
},
|
|
399
418
|
// $FlowFixMe
|
|
400
419
|
body,
|
|
401
|
-
}).catch(() => {
|
|
420
|
+
}).catch((e ) => {
|
|
421
|
+
// $FlowFixMe
|
|
422
|
+
e.skipSendToRemote = true;
|
|
423
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
424
|
+
|
|
402
425
|
setTimeout(() => {
|
|
403
426
|
if (isArray) {
|
|
404
427
|
payload = payload.map(message => {
|
|
@@ -2642,11 +2665,24 @@ class Meeting {
|
|
|
2642
2665
|
});
|
|
2643
2666
|
}
|
|
2644
2667
|
|
|
2668
|
+
static parseMany(items ) {
|
|
2669
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2645
2672
|
static newFrom(meeting ) {
|
|
2646
2673
|
return newFrom(meeting, Meeting);
|
|
2647
2674
|
}
|
|
2648
2675
|
|
|
2649
|
-
constructor({
|
|
2676
|
+
constructor({
|
|
2677
|
+
uuid,
|
|
2678
|
+
name,
|
|
2679
|
+
guestSipAuthorization,
|
|
2680
|
+
ownerUuids,
|
|
2681
|
+
port,
|
|
2682
|
+
uri,
|
|
2683
|
+
number,
|
|
2684
|
+
persistent,
|
|
2685
|
+
} = {}) {
|
|
2650
2686
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2651
2687
|
this.uri = uri;
|
|
2652
2688
|
this.name = name;
|
|
@@ -2732,8 +2768,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2732
2768
|
}
|
|
2733
2769
|
},
|
|
2734
2770
|
|
|
2735
|
-
|
|
2736
|
-
client.
|
|
2771
|
+
getMyMeetings: () =>
|
|
2772
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2773
|
+
|
|
2774
|
+
createMyMeeting: (name , persistent ) =>
|
|
2775
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2737
2776
|
|
|
2738
2777
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2739
2778
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -4913,6 +4952,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
4913
4952
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
4914
4953
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
4915
4954
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
4955
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
4916
4956
|
|
|
4917
4957
|
const BLACKLIST_EVENTS = [
|
|
4918
4958
|
CHAT_MESSAGE_SENT,
|
|
@@ -5263,6 +5303,7 @@ WebSocketClient.eventLists = [
|
|
|
5263
5303
|
AGENT_UNPAUSED,
|
|
5264
5304
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
5265
5305
|
CONFERENCE_ADHOC_DELETED,
|
|
5306
|
+
MEETING_USER_PROGRESS,
|
|
5266
5307
|
];
|
|
5267
5308
|
|
|
5268
5309
|
var wazoWebsocket = {
|
|
@@ -6291,7 +6332,9 @@ class WebRTCClient extends Emitter {
|
|
|
6291
6332
|
const inviteOptions = {
|
|
6292
6333
|
requestDelegate: {
|
|
6293
6334
|
onAccept: (response ) => {
|
|
6294
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6335
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6336
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6337
|
+
}
|
|
6295
6338
|
this._onAccepted(session, response.session, true);
|
|
6296
6339
|
},
|
|
6297
6340
|
onReject: (response ) => {
|
|
@@ -7163,6 +7206,16 @@ class WebRTCClient extends Emitter {
|
|
|
7163
7206
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7164
7207
|
}
|
|
7165
7208
|
|
|
7209
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7210
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7211
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7212
|
+
if (!pc) {
|
|
7213
|
+
return null;
|
|
7214
|
+
}
|
|
7215
|
+
|
|
7216
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7217
|
+
}
|
|
7218
|
+
|
|
7166
7219
|
hasVideo(sessionId ) {
|
|
7167
7220
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7168
7221
|
}
|
|
@@ -7941,18 +7994,22 @@ class WebRTCClient extends Emitter {
|
|
|
7941
7994
|
});
|
|
7942
7995
|
|
|
7943
7996
|
networkStats.packetsLost = packetsLost;
|
|
7944
|
-
networkStats.
|
|
7997
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7998
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7999
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7945
8000
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7946
|
-
networkStats.
|
|
7947
|
-
networkStats.
|
|
8001
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8002
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8003
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8004
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8005
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7948
8006
|
networkStats.transportSent = transportSent;
|
|
7949
|
-
networkStats.
|
|
7950
|
-
|
|
7951
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7952
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7953
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
8007
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8008
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7954
8009
|
|
|
7955
|
-
networkStats.bandwidth =
|
|
8010
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8011
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8012
|
+
+ networkStats.transportSent;
|
|
7956
8013
|
|
|
7957
8014
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7958
8015
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -136,6 +136,7 @@ class IssueReporter {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
|
|
139
|
+
|
|
139
140
|
|
|
140
141
|
constructor() {
|
|
141
142
|
addLevelsTo(this);
|
|
@@ -147,12 +148,17 @@ class IssueReporter {
|
|
|
147
148
|
this.bufferTimeout = null;
|
|
148
149
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
149
150
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
151
|
+
this._callback = null;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
init() {
|
|
153
155
|
this._catchConsole();
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
setCallback(cb ) {
|
|
159
|
+
this._callback = cb;
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
157
163
|
this.remoteClientConfiguration = configuration;
|
|
158
164
|
}
|
|
@@ -188,6 +194,7 @@ class IssueReporter {
|
|
|
188
194
|
|
|
189
195
|
// Handle category label
|
|
190
196
|
let category = null;
|
|
197
|
+
let skipSendToRemote = false;
|
|
191
198
|
let extra = {};
|
|
192
199
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
193
200
|
category = args[0].split('=')[1];
|
|
@@ -203,6 +210,7 @@ class IssueReporter {
|
|
|
203
210
|
errorMessage: lastArg.message,
|
|
204
211
|
errorStack: lastArg.stack,
|
|
205
212
|
errorType: lastArg.constructor.name,
|
|
213
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
206
214
|
};
|
|
207
215
|
} else {
|
|
208
216
|
extra = lastArg;
|
|
@@ -211,6 +219,11 @@ class IssueReporter {
|
|
|
211
219
|
args.splice(1, 1);
|
|
212
220
|
}
|
|
213
221
|
|
|
222
|
+
if (extra.skipSendToRemote) {
|
|
223
|
+
skipSendToRemote = true;
|
|
224
|
+
delete extra.skipSendToRemote;
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
215
228
|
const message = args.join(', ');
|
|
216
229
|
let consoleMessage = message;
|
|
@@ -231,7 +244,13 @@ class IssueReporter {
|
|
|
231
244
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
232
245
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
233
246
|
|
|
234
|
-
this.
|
|
247
|
+
if (this._callback) {
|
|
248
|
+
this._callback(level, consoleMessage);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!skipSendToRemote) {
|
|
252
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
253
|
+
}
|
|
235
254
|
}
|
|
236
255
|
|
|
237
256
|
logRequest(url , options , response , start ) {
|
|
@@ -376,7 +395,11 @@ class IssueReporter {
|
|
|
376
395
|
},
|
|
377
396
|
// $FlowFixMe
|
|
378
397
|
body,
|
|
379
|
-
}).catch(() => {
|
|
398
|
+
}).catch((e ) => {
|
|
399
|
+
// $FlowFixMe
|
|
400
|
+
e.skipSendToRemote = true;
|
|
401
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
402
|
+
|
|
380
403
|
setTimeout(() => {
|
|
381
404
|
if (isArray) {
|
|
382
405
|
payload = payload.map(message => {
|
|
@@ -2620,11 +2643,24 @@ class Meeting {
|
|
|
2620
2643
|
});
|
|
2621
2644
|
}
|
|
2622
2645
|
|
|
2646
|
+
static parseMany(items ) {
|
|
2647
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2623
2650
|
static newFrom(meeting ) {
|
|
2624
2651
|
return newFrom(meeting, Meeting);
|
|
2625
2652
|
}
|
|
2626
2653
|
|
|
2627
|
-
constructor({
|
|
2654
|
+
constructor({
|
|
2655
|
+
uuid,
|
|
2656
|
+
name,
|
|
2657
|
+
guestSipAuthorization,
|
|
2658
|
+
ownerUuids,
|
|
2659
|
+
port,
|
|
2660
|
+
uri,
|
|
2661
|
+
number,
|
|
2662
|
+
persistent,
|
|
2663
|
+
} = {}) {
|
|
2628
2664
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2629
2665
|
this.uri = uri;
|
|
2630
2666
|
this.name = name;
|
|
@@ -2710,8 +2746,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2710
2746
|
}
|
|
2711
2747
|
},
|
|
2712
2748
|
|
|
2713
|
-
|
|
2714
|
-
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),
|
|
2715
2754
|
|
|
2716
2755
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2717
2756
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -136,6 +136,7 @@ class IssueReporter {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
|
|
139
|
+
|
|
139
140
|
|
|
140
141
|
constructor() {
|
|
141
142
|
addLevelsTo(this);
|
|
@@ -147,12 +148,17 @@ class IssueReporter {
|
|
|
147
148
|
this.bufferTimeout = null;
|
|
148
149
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
149
150
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
151
|
+
this._callback = null;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
init() {
|
|
153
155
|
this._catchConsole();
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
setCallback(cb ) {
|
|
159
|
+
this._callback = cb;
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
157
163
|
this.remoteClientConfiguration = configuration;
|
|
158
164
|
}
|
|
@@ -188,6 +194,7 @@ class IssueReporter {
|
|
|
188
194
|
|
|
189
195
|
// Handle category label
|
|
190
196
|
let category = null;
|
|
197
|
+
let skipSendToRemote = false;
|
|
191
198
|
let extra = {};
|
|
192
199
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
193
200
|
category = args[0].split('=')[1];
|
|
@@ -203,6 +210,7 @@ class IssueReporter {
|
|
|
203
210
|
errorMessage: lastArg.message,
|
|
204
211
|
errorStack: lastArg.stack,
|
|
205
212
|
errorType: lastArg.constructor.name,
|
|
213
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
206
214
|
};
|
|
207
215
|
} else {
|
|
208
216
|
extra = lastArg;
|
|
@@ -211,6 +219,11 @@ class IssueReporter {
|
|
|
211
219
|
args.splice(1, 1);
|
|
212
220
|
}
|
|
213
221
|
|
|
222
|
+
if (extra.skipSendToRemote) {
|
|
223
|
+
skipSendToRemote = true;
|
|
224
|
+
delete extra.skipSendToRemote;
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
215
228
|
const message = args.join(', ');
|
|
216
229
|
let consoleMessage = message;
|
|
@@ -231,7 +244,13 @@ class IssueReporter {
|
|
|
231
244
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
232
245
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
233
246
|
|
|
234
|
-
this.
|
|
247
|
+
if (this._callback) {
|
|
248
|
+
this._callback(level, consoleMessage);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!skipSendToRemote) {
|
|
252
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
253
|
+
}
|
|
235
254
|
}
|
|
236
255
|
|
|
237
256
|
logRequest(url , options , response , start ) {
|
|
@@ -376,7 +395,11 @@ class IssueReporter {
|
|
|
376
395
|
},
|
|
377
396
|
// $FlowFixMe
|
|
378
397
|
body,
|
|
379
|
-
}).catch(() => {
|
|
398
|
+
}).catch((e ) => {
|
|
399
|
+
// $FlowFixMe
|
|
400
|
+
e.skipSendToRemote = true;
|
|
401
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
402
|
+
|
|
380
403
|
setTimeout(() => {
|
|
381
404
|
if (isArray) {
|
|
382
405
|
payload = payload.map(message => {
|
|
@@ -2620,11 +2643,24 @@ class Meeting {
|
|
|
2620
2643
|
});
|
|
2621
2644
|
}
|
|
2622
2645
|
|
|
2646
|
+
static parseMany(items ) {
|
|
2647
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2623
2650
|
static newFrom(meeting ) {
|
|
2624
2651
|
return newFrom(meeting, Meeting);
|
|
2625
2652
|
}
|
|
2626
2653
|
|
|
2627
|
-
constructor({
|
|
2654
|
+
constructor({
|
|
2655
|
+
uuid,
|
|
2656
|
+
name,
|
|
2657
|
+
guestSipAuthorization,
|
|
2658
|
+
ownerUuids,
|
|
2659
|
+
port,
|
|
2660
|
+
uri,
|
|
2661
|
+
number,
|
|
2662
|
+
persistent,
|
|
2663
|
+
} = {}) {
|
|
2628
2664
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2629
2665
|
this.uri = uri;
|
|
2630
2666
|
this.name = name;
|
|
@@ -2710,8 +2746,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2710
2746
|
}
|
|
2711
2747
|
},
|
|
2712
2748
|
|
|
2713
|
-
|
|
2714
|
-
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),
|
|
2715
2754
|
|
|
2716
2755
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2717
2756
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -158,6 +158,7 @@ class IssueReporter {
|
|
|
158
158
|
|
|
159
159
|
|
|
160
160
|
|
|
161
|
+
|
|
161
162
|
|
|
162
163
|
constructor() {
|
|
163
164
|
addLevelsTo(this);
|
|
@@ -169,12 +170,17 @@ class IssueReporter {
|
|
|
169
170
|
this.bufferTimeout = null;
|
|
170
171
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
171
172
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
173
|
+
this._callback = null;
|
|
172
174
|
}
|
|
173
175
|
|
|
174
176
|
init() {
|
|
175
177
|
this._catchConsole();
|
|
176
178
|
}
|
|
177
179
|
|
|
180
|
+
setCallback(cb ) {
|
|
181
|
+
this._callback = cb;
|
|
182
|
+
}
|
|
183
|
+
|
|
178
184
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
179
185
|
this.remoteClientConfiguration = configuration;
|
|
180
186
|
}
|
|
@@ -210,6 +216,7 @@ class IssueReporter {
|
|
|
210
216
|
|
|
211
217
|
// Handle category label
|
|
212
218
|
let category = null;
|
|
219
|
+
let skipSendToRemote = false;
|
|
213
220
|
let extra = {};
|
|
214
221
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
215
222
|
category = args[0].split('=')[1];
|
|
@@ -225,6 +232,7 @@ class IssueReporter {
|
|
|
225
232
|
errorMessage: lastArg.message,
|
|
226
233
|
errorStack: lastArg.stack,
|
|
227
234
|
errorType: lastArg.constructor.name,
|
|
235
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
228
236
|
};
|
|
229
237
|
} else {
|
|
230
238
|
extra = lastArg;
|
|
@@ -233,6 +241,11 @@ class IssueReporter {
|
|
|
233
241
|
args.splice(1, 1);
|
|
234
242
|
}
|
|
235
243
|
|
|
244
|
+
if (extra.skipSendToRemote) {
|
|
245
|
+
skipSendToRemote = true;
|
|
246
|
+
delete extra.skipSendToRemote;
|
|
247
|
+
}
|
|
248
|
+
|
|
236
249
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
237
250
|
const message = args.join(', ');
|
|
238
251
|
let consoleMessage = message;
|
|
@@ -253,7 +266,13 @@ class IssueReporter {
|
|
|
253
266
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
254
267
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
255
268
|
|
|
256
|
-
this.
|
|
269
|
+
if (this._callback) {
|
|
270
|
+
this._callback(level, consoleMessage);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (!skipSendToRemote) {
|
|
274
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
275
|
+
}
|
|
257
276
|
}
|
|
258
277
|
|
|
259
278
|
logRequest(url , options , response , start ) {
|
|
@@ -398,7 +417,11 @@ class IssueReporter {
|
|
|
398
417
|
},
|
|
399
418
|
// $FlowFixMe
|
|
400
419
|
body,
|
|
401
|
-
}).catch(() => {
|
|
420
|
+
}).catch((e ) => {
|
|
421
|
+
// $FlowFixMe
|
|
422
|
+
e.skipSendToRemote = true;
|
|
423
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
424
|
+
|
|
402
425
|
setTimeout(() => {
|
|
403
426
|
if (isArray) {
|
|
404
427
|
payload = payload.map(message => {
|
|
@@ -2642,11 +2665,24 @@ class Meeting {
|
|
|
2642
2665
|
});
|
|
2643
2666
|
}
|
|
2644
2667
|
|
|
2668
|
+
static parseMany(items ) {
|
|
2669
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2645
2672
|
static newFrom(meeting ) {
|
|
2646
2673
|
return newFrom(meeting, Meeting);
|
|
2647
2674
|
}
|
|
2648
2675
|
|
|
2649
|
-
constructor({
|
|
2676
|
+
constructor({
|
|
2677
|
+
uuid,
|
|
2678
|
+
name,
|
|
2679
|
+
guestSipAuthorization,
|
|
2680
|
+
ownerUuids,
|
|
2681
|
+
port,
|
|
2682
|
+
uri,
|
|
2683
|
+
number,
|
|
2684
|
+
persistent,
|
|
2685
|
+
} = {}) {
|
|
2650
2686
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2651
2687
|
this.uri = uri;
|
|
2652
2688
|
this.name = name;
|
|
@@ -2732,8 +2768,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2732
2768
|
}
|
|
2733
2769
|
},
|
|
2734
2770
|
|
|
2735
|
-
|
|
2736
|
-
client.
|
|
2771
|
+
getMyMeetings: () =>
|
|
2772
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2773
|
+
|
|
2774
|
+
createMyMeeting: (name , persistent ) =>
|
|
2775
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2737
2776
|
|
|
2738
2777
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2739
2778
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -4913,6 +4952,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
4913
4952
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
4914
4953
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
4915
4954
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
4955
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
4916
4956
|
|
|
4917
4957
|
const BLACKLIST_EVENTS = [
|
|
4918
4958
|
CHAT_MESSAGE_SENT,
|
|
@@ -5263,6 +5303,7 @@ WebSocketClient.eventLists = [
|
|
|
5263
5303
|
AGENT_UNPAUSED,
|
|
5264
5304
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
5265
5305
|
CONFERENCE_ADHOC_DELETED,
|
|
5306
|
+
MEETING_USER_PROGRESS,
|
|
5266
5307
|
];
|
|
5267
5308
|
|
|
5268
5309
|
var wazoWebsocket = {
|
|
@@ -6291,7 +6332,9 @@ class WebRTCClient extends Emitter {
|
|
|
6291
6332
|
const inviteOptions = {
|
|
6292
6333
|
requestDelegate: {
|
|
6293
6334
|
onAccept: (response ) => {
|
|
6294
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6335
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6336
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6337
|
+
}
|
|
6295
6338
|
this._onAccepted(session, response.session, true);
|
|
6296
6339
|
},
|
|
6297
6340
|
onReject: (response ) => {
|
|
@@ -7163,6 +7206,16 @@ class WebRTCClient extends Emitter {
|
|
|
7163
7206
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7164
7207
|
}
|
|
7165
7208
|
|
|
7209
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7210
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7211
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7212
|
+
if (!pc) {
|
|
7213
|
+
return null;
|
|
7214
|
+
}
|
|
7215
|
+
|
|
7216
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7217
|
+
}
|
|
7218
|
+
|
|
7166
7219
|
hasVideo(sessionId ) {
|
|
7167
7220
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7168
7221
|
}
|
|
@@ -7941,18 +7994,22 @@ class WebRTCClient extends Emitter {
|
|
|
7941
7994
|
});
|
|
7942
7995
|
|
|
7943
7996
|
networkStats.packetsLost = packetsLost;
|
|
7944
|
-
networkStats.
|
|
7997
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7998
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7999
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7945
8000
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7946
|
-
networkStats.
|
|
7947
|
-
networkStats.
|
|
8001
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8002
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8003
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8004
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8005
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7948
8006
|
networkStats.transportSent = transportSent;
|
|
7949
|
-
networkStats.
|
|
7950
|
-
|
|
7951
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7952
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7953
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
8007
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8008
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7954
8009
|
|
|
7955
|
-
networkStats.bandwidth =
|
|
8010
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8011
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8012
|
+
+ networkStats.transportSent;
|
|
7956
8013
|
|
|
7957
8014
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7958
8015
|
this.sessionNetworkStats[sessionId].push(networkStats);
|