@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
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -665,4 +688,5 @@ class ApiRequester {
|
|
|
665
688
|
}
|
|
666
689
|
}
|
|
667
690
|
|
|
668
|
-
export
|
|
691
|
+
export default ApiRequester;
|
|
692
|
+
export { realFetch };
|
package/esm/utils/isMobile.js
CHANGED
package/esm/utils/new-from.js
CHANGED
package/esm/utils/once.js
CHANGED
package/esm/utils/update-from.js
CHANGED
package/esm/web-rtc-client.js
CHANGED
|
@@ -19,7 +19,7 @@ import 'sip.js/lib/platform/web/session-description-handler/session-description-
|
|
|
19
19
|
import moment from 'moment';
|
|
20
20
|
import { Base64 } from 'js-base64';
|
|
21
21
|
import sdpParser from 'sdp-transform';
|
|
22
|
-
import {
|
|
22
|
+
import { jws, b64utoutf8, KEYUTIL } from 'jsrsasign';
|
|
23
23
|
import { jsonToGraphQLQuery } from 'json-to-graphql-query/lib/jsonToGraphQLQuery';
|
|
24
24
|
|
|
25
25
|
/* */
|
|
@@ -412,6 +412,7 @@ class IssueReporter {
|
|
|
412
412
|
|
|
413
413
|
|
|
414
414
|
|
|
415
|
+
|
|
415
416
|
|
|
416
417
|
constructor() {
|
|
417
418
|
addLevelsTo(this);
|
|
@@ -423,12 +424,17 @@ class IssueReporter {
|
|
|
423
424
|
this.bufferTimeout = null;
|
|
424
425
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
425
426
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
427
|
+
this._callback = null;
|
|
426
428
|
}
|
|
427
429
|
|
|
428
430
|
init() {
|
|
429
431
|
this._catchConsole();
|
|
430
432
|
}
|
|
431
433
|
|
|
434
|
+
setCallback(cb ) {
|
|
435
|
+
this._callback = cb;
|
|
436
|
+
}
|
|
437
|
+
|
|
432
438
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
433
439
|
this.remoteClientConfiguration = configuration;
|
|
434
440
|
}
|
|
@@ -464,6 +470,7 @@ class IssueReporter {
|
|
|
464
470
|
|
|
465
471
|
// Handle category label
|
|
466
472
|
let category = null;
|
|
473
|
+
let skipSendToRemote = false;
|
|
467
474
|
let extra = {};
|
|
468
475
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
469
476
|
category = args[0].split('=')[1];
|
|
@@ -479,6 +486,7 @@ class IssueReporter {
|
|
|
479
486
|
errorMessage: lastArg.message,
|
|
480
487
|
errorStack: lastArg.stack,
|
|
481
488
|
errorType: lastArg.constructor.name,
|
|
489
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
482
490
|
};
|
|
483
491
|
} else {
|
|
484
492
|
extra = lastArg;
|
|
@@ -487,6 +495,11 @@ class IssueReporter {
|
|
|
487
495
|
args.splice(1, 1);
|
|
488
496
|
}
|
|
489
497
|
|
|
498
|
+
if (extra.skipSendToRemote) {
|
|
499
|
+
skipSendToRemote = true;
|
|
500
|
+
delete extra.skipSendToRemote;
|
|
501
|
+
}
|
|
502
|
+
|
|
490
503
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
491
504
|
const message = args.join(', ');
|
|
492
505
|
let consoleMessage = message;
|
|
@@ -507,7 +520,13 @@ class IssueReporter {
|
|
|
507
520
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
508
521
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
509
522
|
|
|
510
|
-
this.
|
|
523
|
+
if (this._callback) {
|
|
524
|
+
this._callback(level, consoleMessage);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (!skipSendToRemote) {
|
|
528
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
529
|
+
}
|
|
511
530
|
}
|
|
512
531
|
|
|
513
532
|
logRequest(url , options , response , start ) {
|
|
@@ -652,7 +671,11 @@ class IssueReporter {
|
|
|
652
671
|
},
|
|
653
672
|
// $FlowFixMe
|
|
654
673
|
body,
|
|
655
|
-
}).catch(() => {
|
|
674
|
+
}).catch((e ) => {
|
|
675
|
+
// $FlowFixMe
|
|
676
|
+
e.skipSendToRemote = true;
|
|
677
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
678
|
+
|
|
656
679
|
setTimeout(() => {
|
|
657
680
|
if (isArray) {
|
|
658
681
|
payload = payload.map(message => {
|
|
@@ -664,7 +687,7 @@ class IssueReporter {
|
|
|
664
687
|
payload._retry = retry + 1;
|
|
665
688
|
}
|
|
666
689
|
|
|
667
|
-
this._sendDebugToGrafana(
|
|
690
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
668
691
|
}, 5000 + retry * 1000);
|
|
669
692
|
});
|
|
670
693
|
}
|
|
@@ -3166,7 +3189,8 @@ class ExternalApp {
|
|
|
3166
3189
|
|
|
3167
3190
|
|
|
3168
3191
|
|
|
3169
|
-
|
|
3192
|
+
|
|
3193
|
+
|
|
3170
3194
|
|
|
3171
3195
|
|
|
3172
3196
|
class Meeting {
|
|
@@ -3178,6 +3202,7 @@ class Meeting {
|
|
|
3178
3202
|
|
|
3179
3203
|
|
|
3180
3204
|
|
|
3205
|
+
|
|
3181
3206
|
|
|
3182
3207
|
|
|
3183
3208
|
static parse(plain ) {
|
|
@@ -3189,14 +3214,28 @@ class Meeting {
|
|
|
3189
3214
|
port: plain.port,
|
|
3190
3215
|
uuid: plain.uuid,
|
|
3191
3216
|
number: plain.number,
|
|
3217
|
+
persistent: plain.persistent,
|
|
3192
3218
|
});
|
|
3193
3219
|
}
|
|
3194
3220
|
|
|
3221
|
+
static parseMany(items ) {
|
|
3222
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3195
3225
|
static newFrom(meeting ) {
|
|
3196
3226
|
return newFrom(meeting, Meeting);
|
|
3197
3227
|
}
|
|
3198
3228
|
|
|
3199
|
-
constructor({
|
|
3229
|
+
constructor({
|
|
3230
|
+
uuid,
|
|
3231
|
+
name,
|
|
3232
|
+
guestSipAuthorization,
|
|
3233
|
+
ownerUuids,
|
|
3234
|
+
port,
|
|
3235
|
+
uri,
|
|
3236
|
+
number,
|
|
3237
|
+
persistent,
|
|
3238
|
+
} = {}) {
|
|
3200
3239
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3201
3240
|
this.uri = uri;
|
|
3202
3241
|
this.name = name;
|
|
@@ -3204,6 +3243,7 @@ class Meeting {
|
|
|
3204
3243
|
this.port = port;
|
|
3205
3244
|
this.uuid = uuid;
|
|
3206
3245
|
this.number = number;
|
|
3246
|
+
this.persistent = persistent;
|
|
3207
3247
|
|
|
3208
3248
|
// Useful to compare instead of instanceof with minified code
|
|
3209
3249
|
this.type = 'Meeting';
|
|
@@ -3281,8 +3321,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3281
3321
|
}
|
|
3282
3322
|
},
|
|
3283
3323
|
|
|
3284
|
-
|
|
3285
|
-
client.
|
|
3324
|
+
getMyMeetings: () =>
|
|
3325
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3326
|
+
|
|
3327
|
+
createMyMeeting: (name , persistent ) =>
|
|
3328
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3286
3329
|
|
|
3287
3330
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3288
3331
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3767,7 +3810,7 @@ class Recording {
|
|
|
3767
3810
|
|
|
3768
3811
|
|
|
3769
3812
|
|
|
3770
|
-
static parseMany(recordings
|
|
3813
|
+
static parseMany(recordings = []) {
|
|
3771
3814
|
return recordings.map(item => Recording.parse(item));
|
|
3772
3815
|
}
|
|
3773
3816
|
|
|
@@ -3893,7 +3936,7 @@ class CallLog {
|
|
|
3893
3936
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3894
3937
|
start: moment(plain.start).toDate(),
|
|
3895
3938
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
3896
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3939
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3897
3940
|
});
|
|
3898
3941
|
}
|
|
3899
3942
|
|
|
@@ -5697,7 +5740,9 @@ class WebRTCClient extends Emitter {
|
|
|
5697
5740
|
const inviteOptions = {
|
|
5698
5741
|
requestDelegate: {
|
|
5699
5742
|
onAccept: (response ) => {
|
|
5700
|
-
session.sessionDescriptionHandler.peerConnection
|
|
5743
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
5744
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
5745
|
+
}
|
|
5701
5746
|
this._onAccepted(session, response.session, true);
|
|
5702
5747
|
},
|
|
5703
5748
|
onReject: (response ) => {
|
|
@@ -6033,7 +6078,7 @@ class WebRTCClient extends Emitter {
|
|
|
6033
6078
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
6034
6079
|
const transceivers = pc.getTransceivers();
|
|
6035
6080
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
6036
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
6081
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
6037
6082
|
|
|
6038
6083
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
6039
6084
|
} else {
|
|
@@ -6569,6 +6614,16 @@ class WebRTCClient extends Emitter {
|
|
|
6569
6614
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
6570
6615
|
}
|
|
6571
6616
|
|
|
6617
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
6618
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
6619
|
+
const pc = this.getPeerConnection(sessionId);
|
|
6620
|
+
if (!pc) {
|
|
6621
|
+
return null;
|
|
6622
|
+
}
|
|
6623
|
+
|
|
6624
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
6625
|
+
}
|
|
6626
|
+
|
|
6572
6627
|
hasVideo(sessionId ) {
|
|
6573
6628
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
6574
6629
|
}
|
|
@@ -7079,6 +7134,7 @@ class WebRTCClient extends Emitter {
|
|
|
7079
7134
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7080
7135
|
|
|
7081
7136
|
pc.oniceconnectionstatechange = () => {
|
|
7137
|
+
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7082
7138
|
if (pc.iceConnectionState === 'disconnected') {
|
|
7083
7139
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7084
7140
|
}
|
|
@@ -7347,18 +7403,22 @@ class WebRTCClient extends Emitter {
|
|
|
7347
7403
|
});
|
|
7348
7404
|
|
|
7349
7405
|
networkStats.packetsLost = packetsLost;
|
|
7350
|
-
networkStats.
|
|
7406
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7407
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7408
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7351
7409
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7352
|
-
networkStats.
|
|
7353
|
-
networkStats.
|
|
7410
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7411
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7412
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
7413
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
7414
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7354
7415
|
networkStats.transportSent = transportSent;
|
|
7355
|
-
networkStats.
|
|
7356
|
-
|
|
7357
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7358
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7359
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
7416
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
7417
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7360
7418
|
|
|
7361
|
-
networkStats.bandwidth =
|
|
7419
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
7420
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
7421
|
+
+ networkStats.transportSent;
|
|
7362
7422
|
|
|
7363
7423
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7364
7424
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -7366,4 +7426,5 @@ class WebRTCClient extends Emitter {
|
|
|
7366
7426
|
|
|
7367
7427
|
}
|
|
7368
7428
|
|
|
7369
|
-
export
|
|
7429
|
+
export default WebRTCClient;
|
|
7430
|
+
export { CanceledCallError, events, replaceLocalIpModifier, transportEvents };
|
package/esm/websocket-client.js
CHANGED
|
@@ -121,6 +121,7 @@ class IssueReporter {
|
|
|
121
121
|
|
|
122
122
|
|
|
123
123
|
|
|
124
|
+
|
|
124
125
|
|
|
125
126
|
constructor() {
|
|
126
127
|
addLevelsTo(this);
|
|
@@ -132,12 +133,17 @@ class IssueReporter {
|
|
|
132
133
|
this.bufferTimeout = null;
|
|
133
134
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
134
135
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
136
|
+
this._callback = null;
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
init() {
|
|
138
140
|
this._catchConsole();
|
|
139
141
|
}
|
|
140
142
|
|
|
143
|
+
setCallback(cb ) {
|
|
144
|
+
this._callback = cb;
|
|
145
|
+
}
|
|
146
|
+
|
|
141
147
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
142
148
|
this.remoteClientConfiguration = configuration;
|
|
143
149
|
}
|
|
@@ -173,6 +179,7 @@ class IssueReporter {
|
|
|
173
179
|
|
|
174
180
|
// Handle category label
|
|
175
181
|
let category = null;
|
|
182
|
+
let skipSendToRemote = false;
|
|
176
183
|
let extra = {};
|
|
177
184
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
178
185
|
category = args[0].split('=')[1];
|
|
@@ -188,6 +195,7 @@ class IssueReporter {
|
|
|
188
195
|
errorMessage: lastArg.message,
|
|
189
196
|
errorStack: lastArg.stack,
|
|
190
197
|
errorType: lastArg.constructor.name,
|
|
198
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
191
199
|
};
|
|
192
200
|
} else {
|
|
193
201
|
extra = lastArg;
|
|
@@ -196,6 +204,11 @@ class IssueReporter {
|
|
|
196
204
|
args.splice(1, 1);
|
|
197
205
|
}
|
|
198
206
|
|
|
207
|
+
if (extra.skipSendToRemote) {
|
|
208
|
+
skipSendToRemote = true;
|
|
209
|
+
delete extra.skipSendToRemote;
|
|
210
|
+
}
|
|
211
|
+
|
|
199
212
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
200
213
|
const message = args.join(', ');
|
|
201
214
|
let consoleMessage = message;
|
|
@@ -216,7 +229,13 @@ class IssueReporter {
|
|
|
216
229
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
217
230
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
218
231
|
|
|
219
|
-
this.
|
|
232
|
+
if (this._callback) {
|
|
233
|
+
this._callback(level, consoleMessage);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (!skipSendToRemote) {
|
|
237
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
238
|
+
}
|
|
220
239
|
}
|
|
221
240
|
|
|
222
241
|
logRequest(url , options , response , start ) {
|
|
@@ -361,7 +380,11 @@ class IssueReporter {
|
|
|
361
380
|
},
|
|
362
381
|
// $FlowFixMe
|
|
363
382
|
body,
|
|
364
|
-
}).catch(() => {
|
|
383
|
+
}).catch((e ) => {
|
|
384
|
+
// $FlowFixMe
|
|
385
|
+
e.skipSendToRemote = true;
|
|
386
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
387
|
+
|
|
365
388
|
setTimeout(() => {
|
|
366
389
|
if (isArray) {
|
|
367
390
|
payload = payload.map(message => {
|
|
@@ -373,7 +396,7 @@ class IssueReporter {
|
|
|
373
396
|
payload._retry = retry + 1;
|
|
374
397
|
}
|
|
375
398
|
|
|
376
|
-
this._sendDebugToGrafana(
|
|
399
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
377
400
|
}, 5000 + retry * 1000);
|
|
378
401
|
});
|
|
379
402
|
}
|
|
@@ -578,6 +601,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
578
601
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
579
602
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
580
603
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
604
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
581
605
|
|
|
582
606
|
const BLACKLIST_EVENTS = [
|
|
583
607
|
CHAT_MESSAGE_SENT,
|
|
@@ -928,6 +952,8 @@ WebSocketClient.eventLists = [
|
|
|
928
952
|
AGENT_UNPAUSED,
|
|
929
953
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
930
954
|
CONFERENCE_ADHOC_DELETED,
|
|
955
|
+
MEETING_USER_PROGRESS,
|
|
931
956
|
];
|
|
932
957
|
|
|
933
|
-
export
|
|
958
|
+
export default WebSocketClient;
|
|
959
|
+
export { AGENT_PAUSED, AGENT_STATUS_UPDATE, AGENT_UNPAUSED, APPLICATION_CALL_ANSWERED, APPLICATION_CALL_DELETED, APPLICATION_CALL_DTMF_RECEIVED, APPLICATION_CALL_ENTERED, APPLICATION_CALL_INITIATED, APPLICATION_CALL_UPDATED, APPLICATION_DESTINATION_NODE_CREATED, APPLICATION_NODE_CREATED, APPLICATION_NODE_DELETED, APPLICATION_NODE_UPDATED, APPLICATION_PLAYBACK_CREATED, APPLICATION_PLAYBACK_DELETED, APPLICATION_PROGRESS_STARTED, APPLICATION_PROGRESS_STOPPED, APPLICATION_SNOOP_CREATED, APPLICATION_SNOOP_DELETED, APPLICATION_SNOOP_UPDATED, APPLICATION_USER_OUTGOING_CALL_CREATED, AUTH_SESSION_EXPIRE_SOON, AUTH_USER_EXTERNAL_AUTH_ADDED, AUTH_USER_EXTERNAL_AUTH_DELETED, CALL_ANSWERED, CALL_CREATED, CALL_DTMF_CREATED, CALL_ENDED, CALL_HELD, CALL_LOG_USER_CREATED, CALL_RESUMED, CALL_UPDATED, CHATD_PRESENCE_UPDATED, CHATD_USER_ROOM_CREATED, CHATD_USER_ROOM_MESSAGE_CREATED, CHAT_MESSAGE_RECEIVED, CHAT_MESSAGE_SENT, CONFERENCE_ADHOC_DELETED, CONFERENCE_ADHOC_PARTICIPANT_LEFT, CONFERENCE_USER_PARTICIPANT_JOINED, CONFERENCE_USER_PARTICIPANT_LEFT, CONFERENCE_USER_PARTICIPANT_TALK_STARTED, CONFERENCE_USER_PARTICIPANT_TALK_STOPPED, ENDPOINT_STATUS_UPDATE, FAVORITE_ADDED, FAVORITE_DELETED, FAX_OUTBOUND_USER_CREATED, FAX_OUTBOUND_USER_FAILED, FAX_OUTBOUND_USER_SUCCEEDED, HEARTBEAT_ENGINE_VERSION, LINE_STATUS_UPDATED, MEETING_USER_PARTICIPANT_JOINED, MEETING_USER_PARTICIPANT_LEFT, MEETING_USER_PROGRESS, SOCKET_EVENTS, SWITCHBOARD_HELD_CALLS_UPDATED, SWITCHBOARD_HELD_CALL_ANSWERED, SWITCHBOARD_QUEUED_CALLS_UPDATED, SWITCHBOARD_QUEUED_CALL_ANSWERED, TRUNK_STATUS_UPDATED, USERS_FORWARDS_BUSY_UPDATED, USERS_FORWARDS_NOANSWER_UPDATED, USERS_FORWARDS_UNCONDITIONAL_UPDATED, USERS_SERVICES_DND_UPDATED, USER_STATUS_UPDATE, USER_VOICEMAIL_MESSAGE_CREATED, USER_VOICEMAIL_MESSAGE_DELETED, USER_VOICEMAIL_MESSAGE_UPDATED };
|