@wazo/sdk 0.37.19 → 0.37.23
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 +70 -5
- package/esm/__tests__/web-rtc-client.test.js +111 -67
- 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 +32 -2
- package/esm/api/calld.js +35 -2
- package/esm/api/chatd.js +32 -2
- package/esm/api/confd.js +47 -5
- package/esm/api/ctid-ng.js +35 -2
- package/esm/api/dird.js +28 -2
- package/esm/api/webhookd.js +25 -2
- package/esm/api-client.js +70 -5
- package/esm/checker/Checker.js +113 -67
- package/esm/checker/checks/aor.js +70 -5
- package/esm/checker/checks/api.js +70 -5
- package/esm/checker/checks/index.js +113 -67
- package/esm/checker/checks/wazo-websocket.js +27 -2
- package/esm/checker/checks/webrtc-transport.js +111 -67
- package/esm/checker/checks/webrtc.js +111 -67
- package/esm/domain/AdHocAPIConference.js +70 -5
- package/esm/domain/Call.js +3 -0
- package/esm/domain/CallLog.js +7 -0
- package/esm/domain/ChatMessage.js +4 -0
- package/esm/domain/ChatRoom.js +3 -0
- package/esm/domain/Contact.js +3 -0
- package/esm/domain/Features.js +70 -5
- package/esm/domain/Meeting.js +17 -1
- package/esm/domain/Phone/CTIPhone.js +74 -5
- package/esm/domain/Phone/WebRTCPhone.js +50 -16
- package/esm/domain/Recording.js +3 -0
- package/esm/domain/Voicemail.js +3 -0
- package/esm/domain/__tests__/Call.test.js +3 -0
- package/esm/domain/__tests__/CallLog.test.js +7 -0
- package/esm/domain/__tests__/Contact.test.js +3 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +147 -80
- package/esm/lib/WazoSessionDescriptionHandler.js +25 -40
- package/esm/service/CallApi.js +70 -5
- package/esm/service/IssueReporter.js +25 -2
- package/esm/service/__tests__/IssueReporter.test.js +25 -2
- package/esm/service/getApiClient.js +70 -5
- package/esm/simple/Auth.js +147 -80
- package/esm/simple/Configuration.js +147 -80
- package/esm/simple/Directory.js +70 -5
- package/esm/simple/Phone.js +147 -80
- package/esm/simple/Websocket.js +28 -2
- package/esm/simple/index.js +147 -80
- package/esm/simple/room/LocalParticipant.js +147 -80
- package/esm/simple/room/Participant.js +147 -80
- package/esm/simple/room/RemoteParticipant.js +147 -80
- package/esm/simple/room/Room.js +147 -80
- package/esm/simple/room/SipRoom.js +147 -80
- package/esm/simple/room/Stream.js +147 -80
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +147 -80
- package/esm/simple/utils.js +147 -80
- package/esm/utils/__tests__/api-requester.test.js +25 -2
- package/esm/utils/api-requester.js +25 -2
- package/esm/web-rtc-client.js +111 -67
- package/esm/websocket-client.js +28 -3
- package/lib/__tests__/api-client.test.js +70 -5
- package/lib/__tests__/web-rtc-client.test.js +111 -67
- 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 +32 -2
- package/lib/api/calld.js +35 -2
- package/lib/api/chatd.js +32 -2
- package/lib/api/confd.js +47 -5
- package/lib/api/ctid-ng.js +35 -2
- package/lib/api/dird.js +28 -2
- package/lib/api/webhookd.js +25 -2
- package/lib/api-client.js +70 -5
- package/lib/checker/Checker.js +113 -67
- package/lib/checker/checks/aor.js +70 -5
- package/lib/checker/checks/api.js +70 -5
- package/lib/checker/checks/index.js +113 -67
- package/lib/checker/checks/wazo-websocket.js +27 -2
- package/lib/checker/checks/webrtc-transport.js +111 -67
- package/lib/checker/checks/webrtc.js +111 -67
- package/lib/domain/AdHocAPIConference.js +70 -5
- package/lib/domain/Call.js +3 -0
- package/lib/domain/CallLog.js +7 -0
- package/lib/domain/ChatMessage.js +4 -0
- package/lib/domain/ChatRoom.js +3 -0
- package/lib/domain/Contact.js +3 -0
- package/lib/domain/Features.js +70 -5
- package/lib/domain/Meeting.js +17 -1
- package/lib/domain/Phone/CTIPhone.js +74 -5
- package/lib/domain/Phone/WebRTCPhone.js +50 -16
- package/lib/domain/Recording.js +3 -0
- package/lib/domain/Voicemail.js +3 -0
- package/lib/domain/__tests__/Call.test.js +3 -0
- package/lib/domain/__tests__/CallLog.test.js +7 -0
- package/lib/domain/__tests__/Contact.test.js +3 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +147 -80
- package/lib/lib/WazoSessionDescriptionHandler.js +25 -40
- package/lib/service/CallApi.js +70 -5
- package/lib/service/IssueReporter.js +25 -2
- package/lib/service/__tests__/IssueReporter.test.js +25 -2
- package/lib/service/getApiClient.js +70 -5
- package/lib/simple/Auth.js +147 -80
- package/lib/simple/Configuration.js +147 -80
- package/lib/simple/Directory.js +70 -5
- package/lib/simple/Phone.js +147 -80
- package/lib/simple/Websocket.js +28 -2
- package/lib/simple/index.js +147 -80
- package/lib/simple/room/LocalParticipant.js +147 -80
- package/lib/simple/room/Participant.js +147 -80
- package/lib/simple/room/RemoteParticipant.js +147 -80
- package/lib/simple/room/Room.js +147 -80
- package/lib/simple/room/SipRoom.js +147 -80
- package/lib/simple/room/Stream.js +147 -80
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +147 -80
- package/lib/simple/utils.js +147 -80
- package/lib/utils/__tests__/api-requester.test.js +25 -2
- package/lib/utils/api-requester.js +25 -2
- package/lib/web-rtc-client.js +111 -67
- package/lib/websocket-client.js +28 -2
- package/package.json +2 -2
- package/src/api/confd.js +5 -2
- package/src/domain/Call.js +3 -0
- package/src/domain/CallLog.js +4 -0
- package/src/domain/ChatMessage.js +4 -0
- package/src/domain/ChatRoom.js +3 -0
- package/src/domain/Contact.js +3 -0
- package/src/domain/Meeting.js +17 -1
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +25 -14
- package/src/domain/Recording.js +3 -0
- package/src/domain/Voicemail.js +3 -0
- package/src/lib/WazoSessionDescriptionHandler.js +1 -35
- 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 +41 -24
- package/src/websocket-client.js +2 -0
package/esm/simple/Phone.js
CHANGED
|
@@ -95,6 +95,9 @@ class Call {
|
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
static parseMany(plain ) {
|
|
98
|
+
if (!plain) {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
98
101
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
99
102
|
}
|
|
100
103
|
|
|
@@ -711,6 +714,7 @@ class IssueReporter {
|
|
|
711
714
|
|
|
712
715
|
|
|
713
716
|
|
|
717
|
+
|
|
714
718
|
|
|
715
719
|
constructor() {
|
|
716
720
|
addLevelsTo(this);
|
|
@@ -722,12 +726,17 @@ class IssueReporter {
|
|
|
722
726
|
this.bufferTimeout = null;
|
|
723
727
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
724
728
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
729
|
+
this._callback = null;
|
|
725
730
|
}
|
|
726
731
|
|
|
727
732
|
init() {
|
|
728
733
|
this._catchConsole();
|
|
729
734
|
}
|
|
730
735
|
|
|
736
|
+
setCallback(cb ) {
|
|
737
|
+
this._callback = cb;
|
|
738
|
+
}
|
|
739
|
+
|
|
731
740
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
732
741
|
this.remoteClientConfiguration = configuration;
|
|
733
742
|
}
|
|
@@ -763,6 +772,7 @@ class IssueReporter {
|
|
|
763
772
|
|
|
764
773
|
// Handle category label
|
|
765
774
|
let category = null;
|
|
775
|
+
let skipSendToRemote = false;
|
|
766
776
|
let extra = {};
|
|
767
777
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
768
778
|
category = args[0].split('=')[1];
|
|
@@ -778,6 +788,7 @@ class IssueReporter {
|
|
|
778
788
|
errorMessage: lastArg.message,
|
|
779
789
|
errorStack: lastArg.stack,
|
|
780
790
|
errorType: lastArg.constructor.name,
|
|
791
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
781
792
|
};
|
|
782
793
|
} else {
|
|
783
794
|
extra = lastArg;
|
|
@@ -786,6 +797,11 @@ class IssueReporter {
|
|
|
786
797
|
args.splice(1, 1);
|
|
787
798
|
}
|
|
788
799
|
|
|
800
|
+
if (extra.skipSendToRemote) {
|
|
801
|
+
skipSendToRemote = true;
|
|
802
|
+
delete extra.skipSendToRemote;
|
|
803
|
+
}
|
|
804
|
+
|
|
789
805
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
790
806
|
const message = args.join(', ');
|
|
791
807
|
let consoleMessage = message;
|
|
@@ -806,7 +822,13 @@ class IssueReporter {
|
|
|
806
822
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
807
823
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
808
824
|
|
|
809
|
-
this.
|
|
825
|
+
if (this._callback) {
|
|
826
|
+
this._callback(level, consoleMessage);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
if (!skipSendToRemote) {
|
|
830
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
831
|
+
}
|
|
810
832
|
}
|
|
811
833
|
|
|
812
834
|
logRequest(url , options , response , start ) {
|
|
@@ -951,7 +973,11 @@ class IssueReporter {
|
|
|
951
973
|
},
|
|
952
974
|
// $FlowFixMe
|
|
953
975
|
body,
|
|
954
|
-
}).catch(() => {
|
|
976
|
+
}).catch((e ) => {
|
|
977
|
+
// $FlowFixMe
|
|
978
|
+
e.skipSendToRemote = true;
|
|
979
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
980
|
+
|
|
955
981
|
setTimeout(() => {
|
|
956
982
|
if (isArray) {
|
|
957
983
|
payload = payload.map(message => {
|
|
@@ -2078,6 +2104,9 @@ class Contact {
|
|
|
2078
2104
|
}
|
|
2079
2105
|
|
|
2080
2106
|
static parseMany(response ) {
|
|
2107
|
+
if (!response || !response.results) {
|
|
2108
|
+
return [];
|
|
2109
|
+
}
|
|
2081
2110
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
2082
2111
|
}
|
|
2083
2112
|
|
|
@@ -3184,11 +3213,27 @@ class Meeting {
|
|
|
3184
3213
|
});
|
|
3185
3214
|
}
|
|
3186
3215
|
|
|
3216
|
+
static parseMany(items ) {
|
|
3217
|
+
if (!items) {
|
|
3218
|
+
return [];
|
|
3219
|
+
}
|
|
3220
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3187
3223
|
static newFrom(meeting ) {
|
|
3188
3224
|
return newFrom(meeting, Meeting);
|
|
3189
3225
|
}
|
|
3190
3226
|
|
|
3191
|
-
constructor({
|
|
3227
|
+
constructor({
|
|
3228
|
+
uuid,
|
|
3229
|
+
name,
|
|
3230
|
+
guestSipAuthorization,
|
|
3231
|
+
ownerUuids,
|
|
3232
|
+
port,
|
|
3233
|
+
uri,
|
|
3234
|
+
number,
|
|
3235
|
+
persistent,
|
|
3236
|
+
} = {}) {
|
|
3192
3237
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3193
3238
|
this.uri = uri;
|
|
3194
3239
|
this.name = name;
|
|
@@ -3274,8 +3319,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3274
3319
|
}
|
|
3275
3320
|
},
|
|
3276
3321
|
|
|
3277
|
-
|
|
3278
|
-
client.
|
|
3322
|
+
getMyMeetings: () =>
|
|
3323
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3324
|
+
|
|
3325
|
+
createMyMeeting: (name , persistent ) =>
|
|
3326
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3279
3327
|
|
|
3280
3328
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3281
3329
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3371,6 +3419,10 @@ class ChatMessage {
|
|
|
3371
3419
|
|
|
3372
3420
|
|
|
3373
3421
|
static parseMany(plain ) {
|
|
3422
|
+
if (!plain || !plain.items) {
|
|
3423
|
+
return [];
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3374
3426
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3375
3427
|
}
|
|
3376
3428
|
|
|
@@ -3480,6 +3532,9 @@ class Voicemail {
|
|
|
3480
3532
|
}
|
|
3481
3533
|
|
|
3482
3534
|
static parseMany(plain ) {
|
|
3535
|
+
if (!plain) {
|
|
3536
|
+
return [];
|
|
3537
|
+
}
|
|
3483
3538
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3484
3539
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3485
3540
|
|
|
@@ -3581,6 +3636,9 @@ class Recording {
|
|
|
3581
3636
|
|
|
3582
3637
|
|
|
3583
3638
|
static parseMany(recordings = []) {
|
|
3639
|
+
if (!recordings) {
|
|
3640
|
+
return [];
|
|
3641
|
+
}
|
|
3584
3642
|
return recordings.map(item => Recording.parse(item));
|
|
3585
3643
|
}
|
|
3586
3644
|
|
|
@@ -3682,6 +3740,10 @@ class CallLog {
|
|
|
3682
3740
|
}
|
|
3683
3741
|
|
|
3684
3742
|
static parseMany(plain ) {
|
|
3743
|
+
if (!plain || !plain.items) {
|
|
3744
|
+
return [];
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3685
3747
|
return plain.items.map(item => CallLog.parse(item));
|
|
3686
3748
|
}
|
|
3687
3749
|
|
|
@@ -4251,6 +4313,10 @@ class CTIPhone extends Emitter {
|
|
|
4251
4313
|
return false;
|
|
4252
4314
|
}
|
|
4253
4315
|
|
|
4316
|
+
hasAVideoTrack() {
|
|
4317
|
+
return false;
|
|
4318
|
+
}
|
|
4319
|
+
|
|
4254
4320
|
getLocalStreamForCall() {
|
|
4255
4321
|
return null;
|
|
4256
4322
|
}
|
|
@@ -4644,6 +4710,9 @@ class ChatRoom {
|
|
|
4644
4710
|
|
|
4645
4711
|
|
|
4646
4712
|
static parseMany(plain ) {
|
|
4713
|
+
if (!plain || !plain.items) {
|
|
4714
|
+
return [];
|
|
4715
|
+
}
|
|
4647
4716
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4648
4717
|
}
|
|
4649
4718
|
|
|
@@ -5625,10 +5694,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5625
5694
|
candidates
|
|
5626
5695
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5627
5696
|
|
|
5628
|
-
const areCandidateValid = (candidates ) =>
|
|
5629
|
-
getSrflxOrRelay(candidates)
|
|
5630
|
-
.length > 0;
|
|
5631
|
-
|
|
5632
5697
|
const getVideoDirection = (sdp ) => {
|
|
5633
5698
|
const parsedSdp = sdpParser.parse(sdp);
|
|
5634
5699
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5681,8 +5746,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5681
5746
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5682
5747
|
|
|
5683
5748
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5684
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5685
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5686
5749
|
|
|
5687
5750
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5688
5751
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -5872,38 +5935,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5872
5935
|
this._peerConnection = undefined;
|
|
5873
5936
|
}
|
|
5874
5937
|
|
|
5875
|
-
async _waitForValidGatheredIce() {
|
|
5876
|
-
let tries = 0;
|
|
5877
|
-
|
|
5878
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
5879
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
5880
|
-
tries,
|
|
5881
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
5882
|
-
});
|
|
5883
|
-
|
|
5884
|
-
tries++;
|
|
5885
|
-
|
|
5886
|
-
// eslint-disable-next-line no-await-in-loop
|
|
5887
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
5888
|
-
}
|
|
5889
|
-
|
|
5890
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
5891
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
5892
|
-
const error = new Error(errorMsg);
|
|
5893
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
5894
|
-
|
|
5895
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
5896
|
-
this.eventEmitter.emit('error', error);
|
|
5897
|
-
|
|
5898
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5899
|
-
}
|
|
5900
|
-
|
|
5901
|
-
// eslint-disable-next-line
|
|
5902
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5903
|
-
|
|
5904
|
-
return this.getLocalSessionDescription();
|
|
5905
|
-
}
|
|
5906
|
-
|
|
5907
5938
|
// Overridden to send `inactive` in conference
|
|
5908
5939
|
updateDirection(options , isConference = false,
|
|
5909
5940
|
audioOnly = false) {
|
|
@@ -6696,7 +6727,9 @@ class WebRTCClient extends Emitter {
|
|
|
6696
6727
|
const inviteOptions = {
|
|
6697
6728
|
requestDelegate: {
|
|
6698
6729
|
onAccept: (response ) => {
|
|
6699
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6730
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6731
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6732
|
+
}
|
|
6700
6733
|
this._onAccepted(session, response.session, true);
|
|
6701
6734
|
},
|
|
6702
6735
|
onReject: (response ) => {
|
|
@@ -7568,6 +7601,16 @@ class WebRTCClient extends Emitter {
|
|
|
7568
7601
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7569
7602
|
}
|
|
7570
7603
|
|
|
7604
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7605
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7606
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7607
|
+
if (!pc) {
|
|
7608
|
+
return null;
|
|
7609
|
+
}
|
|
7610
|
+
|
|
7611
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7612
|
+
}
|
|
7613
|
+
|
|
7571
7614
|
hasVideo(sessionId ) {
|
|
7572
7615
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7573
7616
|
}
|
|
@@ -8078,6 +8121,7 @@ class WebRTCClient extends Emitter {
|
|
|
8078
8121
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8079
8122
|
|
|
8080
8123
|
pc.oniceconnectionstatechange = () => {
|
|
8124
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8081
8125
|
if (pc.iceConnectionState === 'disconnected') {
|
|
8082
8126
|
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8083
8127
|
}
|
|
@@ -8306,25 +8350,25 @@ class WebRTCClient extends Emitter {
|
|
|
8306
8350
|
|
|
8307
8351
|
stats.forEach(report => {
|
|
8308
8352
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8309
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8353
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8310
8354
|
}
|
|
8311
8355
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8312
|
-
audioBytesSent += report.bytesSent;
|
|
8356
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8313
8357
|
}
|
|
8314
8358
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8315
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8359
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8316
8360
|
}
|
|
8317
8361
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8318
|
-
packetsLost += report.packetsLost;
|
|
8319
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8320
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8362
|
+
packetsLost += Number(report.packetsLost);
|
|
8363
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8364
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8321
8365
|
}
|
|
8322
8366
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8323
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8367
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8324
8368
|
}
|
|
8325
8369
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8326
8370
|
if ('framesPerSecond' in report) {
|
|
8327
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8371
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8328
8372
|
}
|
|
8329
8373
|
if ('framerateMean' in report) {
|
|
8330
8374
|
// framerateMean is only available in FF
|
|
@@ -8332,32 +8376,36 @@ class WebRTCClient extends Emitter {
|
|
|
8332
8376
|
}
|
|
8333
8377
|
}
|
|
8334
8378
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8335
|
-
packetsLost += report.packetsLost;
|
|
8336
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8337
|
-
networkStats.jitter = report.jitter;
|
|
8379
|
+
packetsLost += Number(report.packetsLost);
|
|
8380
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8381
|
+
networkStats.jitter = Number(report.jitter);
|
|
8338
8382
|
}
|
|
8339
8383
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8340
|
-
packetsLost += report.packetsLost;
|
|
8384
|
+
packetsLost += Number(report.packetsLost);
|
|
8341
8385
|
}
|
|
8342
8386
|
if (report.type === 'transport') {
|
|
8343
|
-
transportSent += report.bytesSent;
|
|
8344
|
-
transportReceived += report.bytesReceived;
|
|
8387
|
+
transportSent += Number(report.bytesSent);
|
|
8388
|
+
transportReceived += Number(report.bytesReceived);
|
|
8345
8389
|
}
|
|
8346
8390
|
});
|
|
8347
8391
|
|
|
8348
8392
|
networkStats.packetsLost = packetsLost;
|
|
8349
|
-
networkStats.
|
|
8393
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8394
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8395
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8350
8396
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8351
|
-
networkStats.
|
|
8352
|
-
networkStats.
|
|
8397
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8398
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8399
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8400
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8401
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8353
8402
|
networkStats.transportSent = transportSent;
|
|
8354
|
-
networkStats.
|
|
8403
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8404
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8355
8405
|
|
|
8356
|
-
|
|
8357
|
-
+
|
|
8358
|
-
+
|
|
8359
|
-
|
|
8360
|
-
networkStats.bandwidth = bandwidth;
|
|
8406
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8407
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8408
|
+
+ networkStats.transportSent;
|
|
8361
8409
|
|
|
8362
8410
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8363
8411
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -8739,7 +8787,10 @@ class WebRTCPhone extends Emitter {
|
|
|
8739
8787
|
|
|
8740
8788
|
onCancel(message);
|
|
8741
8789
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
8742
|
-
|
|
8790
|
+
const callSession = this._createCallSession(sipSession);
|
|
8791
|
+
delete this.callSessions[callSession.getId()];
|
|
8792
|
+
|
|
8793
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
8743
8794
|
};
|
|
8744
8795
|
} else if (sipSession instanceof Invitation) {
|
|
8745
8796
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -8768,9 +8819,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8768
8819
|
case SessionState.Terminated: {
|
|
8769
8820
|
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8770
8821
|
|
|
8822
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8823
|
+
const callSession = this._createCallSession(sipSession);
|
|
8771
8824
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8772
8825
|
|
|
8773
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
8826
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
8774
8827
|
}
|
|
8775
8828
|
}
|
|
8776
8829
|
});
|
|
@@ -8918,18 +8971,20 @@ class WebRTCPhone extends Emitter {
|
|
|
8918
8971
|
screenTrack,
|
|
8919
8972
|
});
|
|
8920
8973
|
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8974
|
+
if (screenTrack) {
|
|
8975
|
+
screenTrack.onended = () => {
|
|
8976
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
8977
|
+
hadVideo,
|
|
8978
|
+
id: this.getSipSessionId(sipSession),
|
|
8979
|
+
screenTrack,
|
|
8980
|
+
});
|
|
8927
8981
|
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8982
|
+
this.eventEmitter.emit(
|
|
8983
|
+
ON_SHARE_SCREEN_ENDING,
|
|
8984
|
+
this._createCallSession(sipSession, callSession),
|
|
8985
|
+
);
|
|
8986
|
+
};
|
|
8987
|
+
}
|
|
8933
8988
|
|
|
8934
8989
|
this.currentScreenShare = {
|
|
8935
8990
|
stream: screenStream,
|
|
@@ -9718,6 +9773,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9718
9773
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9719
9774
|
}
|
|
9720
9775
|
|
|
9776
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
9777
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
9778
|
+
}
|
|
9779
|
+
|
|
9721
9780
|
hasRemoteVideo(callSession ) {
|
|
9722
9781
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9723
9782
|
}
|
|
@@ -10419,6 +10478,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10419
10478
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10420
10479
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10421
10480
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10481
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10422
10482
|
|
|
10423
10483
|
const BLACKLIST_EVENTS = [
|
|
10424
10484
|
CHAT_MESSAGE_SENT,
|
|
@@ -10769,6 +10829,7 @@ WebSocketClient.eventLists = [
|
|
|
10769
10829
|
AGENT_UNPAUSED,
|
|
10770
10830
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10771
10831
|
CONFERENCE_ADHOC_DELETED,
|
|
10832
|
+
MEETING_USER_PROGRESS,
|
|
10772
10833
|
];
|
|
10773
10834
|
|
|
10774
10835
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -10839,6 +10900,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
10839
10900
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
10840
10901
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10841
10902
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
10903
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
10842
10904
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
10843
10905
|
'default': WebSocketClient
|
|
10844
10906
|
});
|
|
@@ -13558,6 +13620,11 @@ class Phone extends Emitter {
|
|
|
13558
13620
|
return this.getRemoteVideoStream(callSession);
|
|
13559
13621
|
}
|
|
13560
13622
|
|
|
13623
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
13624
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
13625
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
13626
|
+
}
|
|
13627
|
+
|
|
13561
13628
|
hasVideo(callSession ) {
|
|
13562
13629
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
13563
13630
|
}
|
package/esm/simple/Websocket.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 => {
|
|
@@ -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,7 @@ 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
958
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -998,6 +1023,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
998
1023
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
999
1024
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
1000
1025
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
1026
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
1001
1027
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
1002
1028
|
'default': WebSocketClient
|
|
1003
1029
|
});
|