@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/lib/simple/Phone.js
CHANGED
|
@@ -105,6 +105,9 @@ class Call {
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
static parseMany(plain ) {
|
|
108
|
+
if (!plain) {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
108
111
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
109
112
|
}
|
|
110
113
|
|
|
@@ -721,6 +724,7 @@ class IssueReporter {
|
|
|
721
724
|
|
|
722
725
|
|
|
723
726
|
|
|
727
|
+
|
|
724
728
|
|
|
725
729
|
constructor() {
|
|
726
730
|
addLevelsTo(this);
|
|
@@ -732,12 +736,17 @@ class IssueReporter {
|
|
|
732
736
|
this.bufferTimeout = null;
|
|
733
737
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
734
738
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
739
|
+
this._callback = null;
|
|
735
740
|
}
|
|
736
741
|
|
|
737
742
|
init() {
|
|
738
743
|
this._catchConsole();
|
|
739
744
|
}
|
|
740
745
|
|
|
746
|
+
setCallback(cb ) {
|
|
747
|
+
this._callback = cb;
|
|
748
|
+
}
|
|
749
|
+
|
|
741
750
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
742
751
|
this.remoteClientConfiguration = configuration;
|
|
743
752
|
}
|
|
@@ -773,6 +782,7 @@ class IssueReporter {
|
|
|
773
782
|
|
|
774
783
|
// Handle category label
|
|
775
784
|
let category = null;
|
|
785
|
+
let skipSendToRemote = false;
|
|
776
786
|
let extra = {};
|
|
777
787
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
778
788
|
category = args[0].split('=')[1];
|
|
@@ -788,6 +798,7 @@ class IssueReporter {
|
|
|
788
798
|
errorMessage: lastArg.message,
|
|
789
799
|
errorStack: lastArg.stack,
|
|
790
800
|
errorType: lastArg.constructor.name,
|
|
801
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
791
802
|
};
|
|
792
803
|
} else {
|
|
793
804
|
extra = lastArg;
|
|
@@ -796,6 +807,11 @@ class IssueReporter {
|
|
|
796
807
|
args.splice(1, 1);
|
|
797
808
|
}
|
|
798
809
|
|
|
810
|
+
if (extra.skipSendToRemote) {
|
|
811
|
+
skipSendToRemote = true;
|
|
812
|
+
delete extra.skipSendToRemote;
|
|
813
|
+
}
|
|
814
|
+
|
|
799
815
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
800
816
|
const message = args.join(', ');
|
|
801
817
|
let consoleMessage = message;
|
|
@@ -816,7 +832,13 @@ class IssueReporter {
|
|
|
816
832
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
817
833
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
818
834
|
|
|
819
|
-
this.
|
|
835
|
+
if (this._callback) {
|
|
836
|
+
this._callback(level, consoleMessage);
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
if (!skipSendToRemote) {
|
|
840
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
841
|
+
}
|
|
820
842
|
}
|
|
821
843
|
|
|
822
844
|
logRequest(url , options , response , start ) {
|
|
@@ -961,7 +983,11 @@ class IssueReporter {
|
|
|
961
983
|
},
|
|
962
984
|
// $FlowFixMe
|
|
963
985
|
body,
|
|
964
|
-
}).catch(() => {
|
|
986
|
+
}).catch((e ) => {
|
|
987
|
+
// $FlowFixMe
|
|
988
|
+
e.skipSendToRemote = true;
|
|
989
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
990
|
+
|
|
965
991
|
setTimeout(() => {
|
|
966
992
|
if (isArray) {
|
|
967
993
|
payload = payload.map(message => {
|
|
@@ -2088,6 +2114,9 @@ class Contact {
|
|
|
2088
2114
|
}
|
|
2089
2115
|
|
|
2090
2116
|
static parseMany(response ) {
|
|
2117
|
+
if (!response || !response.results) {
|
|
2118
|
+
return [];
|
|
2119
|
+
}
|
|
2091
2120
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
2092
2121
|
}
|
|
2093
2122
|
|
|
@@ -3194,11 +3223,27 @@ class Meeting {
|
|
|
3194
3223
|
});
|
|
3195
3224
|
}
|
|
3196
3225
|
|
|
3226
|
+
static parseMany(items ) {
|
|
3227
|
+
if (!items) {
|
|
3228
|
+
return [];
|
|
3229
|
+
}
|
|
3230
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3197
3233
|
static newFrom(meeting ) {
|
|
3198
3234
|
return newFrom(meeting, Meeting);
|
|
3199
3235
|
}
|
|
3200
3236
|
|
|
3201
|
-
constructor({
|
|
3237
|
+
constructor({
|
|
3238
|
+
uuid,
|
|
3239
|
+
name,
|
|
3240
|
+
guestSipAuthorization,
|
|
3241
|
+
ownerUuids,
|
|
3242
|
+
port,
|
|
3243
|
+
uri,
|
|
3244
|
+
number,
|
|
3245
|
+
persistent,
|
|
3246
|
+
} = {}) {
|
|
3202
3247
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3203
3248
|
this.uri = uri;
|
|
3204
3249
|
this.name = name;
|
|
@@ -3284,8 +3329,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3284
3329
|
}
|
|
3285
3330
|
},
|
|
3286
3331
|
|
|
3287
|
-
|
|
3288
|
-
client.
|
|
3332
|
+
getMyMeetings: () =>
|
|
3333
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3334
|
+
|
|
3335
|
+
createMyMeeting: (name , persistent ) =>
|
|
3336
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3289
3337
|
|
|
3290
3338
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3291
3339
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3381,6 +3429,10 @@ class ChatMessage {
|
|
|
3381
3429
|
|
|
3382
3430
|
|
|
3383
3431
|
static parseMany(plain ) {
|
|
3432
|
+
if (!plain || !plain.items) {
|
|
3433
|
+
return [];
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3384
3436
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3385
3437
|
}
|
|
3386
3438
|
|
|
@@ -3490,6 +3542,9 @@ class Voicemail {
|
|
|
3490
3542
|
}
|
|
3491
3543
|
|
|
3492
3544
|
static parseMany(plain ) {
|
|
3545
|
+
if (!plain) {
|
|
3546
|
+
return [];
|
|
3547
|
+
}
|
|
3493
3548
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3494
3549
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3495
3550
|
|
|
@@ -3591,6 +3646,9 @@ class Recording {
|
|
|
3591
3646
|
|
|
3592
3647
|
|
|
3593
3648
|
static parseMany(recordings = []) {
|
|
3649
|
+
if (!recordings) {
|
|
3650
|
+
return [];
|
|
3651
|
+
}
|
|
3594
3652
|
return recordings.map(item => Recording.parse(item));
|
|
3595
3653
|
}
|
|
3596
3654
|
|
|
@@ -3692,6 +3750,10 @@ class CallLog {
|
|
|
3692
3750
|
}
|
|
3693
3751
|
|
|
3694
3752
|
static parseMany(plain ) {
|
|
3753
|
+
if (!plain || !plain.items) {
|
|
3754
|
+
return [];
|
|
3755
|
+
}
|
|
3756
|
+
|
|
3695
3757
|
return plain.items.map(item => CallLog.parse(item));
|
|
3696
3758
|
}
|
|
3697
3759
|
|
|
@@ -4261,6 +4323,10 @@ class CTIPhone extends Emitter {
|
|
|
4261
4323
|
return false;
|
|
4262
4324
|
}
|
|
4263
4325
|
|
|
4326
|
+
hasAVideoTrack() {
|
|
4327
|
+
return false;
|
|
4328
|
+
}
|
|
4329
|
+
|
|
4264
4330
|
getLocalStreamForCall() {
|
|
4265
4331
|
return null;
|
|
4266
4332
|
}
|
|
@@ -4654,6 +4720,9 @@ class ChatRoom {
|
|
|
4654
4720
|
|
|
4655
4721
|
|
|
4656
4722
|
static parseMany(plain ) {
|
|
4723
|
+
if (!plain || !plain.items) {
|
|
4724
|
+
return [];
|
|
4725
|
+
}
|
|
4657
4726
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4658
4727
|
}
|
|
4659
4728
|
|
|
@@ -5635,10 +5704,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5635
5704
|
candidates
|
|
5636
5705
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5637
5706
|
|
|
5638
|
-
const areCandidateValid = (candidates ) =>
|
|
5639
|
-
getSrflxOrRelay(candidates)
|
|
5640
|
-
.length > 0;
|
|
5641
|
-
|
|
5642
5707
|
const getVideoDirection = (sdp ) => {
|
|
5643
5708
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5644
5709
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5691,8 +5756,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5691
5756
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5692
5757
|
|
|
5693
5758
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5694
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5695
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5696
5759
|
|
|
5697
5760
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5698
5761
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -5882,38 +5945,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5882
5945
|
this._peerConnection = undefined;
|
|
5883
5946
|
}
|
|
5884
5947
|
|
|
5885
|
-
async _waitForValidGatheredIce() {
|
|
5886
|
-
let tries = 0;
|
|
5887
|
-
|
|
5888
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
5889
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
5890
|
-
tries,
|
|
5891
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
5892
|
-
});
|
|
5893
|
-
|
|
5894
|
-
tries++;
|
|
5895
|
-
|
|
5896
|
-
// eslint-disable-next-line no-await-in-loop
|
|
5897
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
5898
|
-
}
|
|
5899
|
-
|
|
5900
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
5901
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
5902
|
-
const error = new Error(errorMsg);
|
|
5903
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
5904
|
-
|
|
5905
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
5906
|
-
this.eventEmitter.emit('error', error);
|
|
5907
|
-
|
|
5908
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5909
|
-
}
|
|
5910
|
-
|
|
5911
|
-
// eslint-disable-next-line
|
|
5912
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5913
|
-
|
|
5914
|
-
return this.getLocalSessionDescription();
|
|
5915
|
-
}
|
|
5916
|
-
|
|
5917
5948
|
// Overridden to send `inactive` in conference
|
|
5918
5949
|
updateDirection(options , isConference = false,
|
|
5919
5950
|
audioOnly = false) {
|
|
@@ -6706,7 +6737,9 @@ class WebRTCClient extends Emitter {
|
|
|
6706
6737
|
const inviteOptions = {
|
|
6707
6738
|
requestDelegate: {
|
|
6708
6739
|
onAccept: (response ) => {
|
|
6709
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6740
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6741
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6742
|
+
}
|
|
6710
6743
|
this._onAccepted(session, response.session, true);
|
|
6711
6744
|
},
|
|
6712
6745
|
onReject: (response ) => {
|
|
@@ -7578,6 +7611,16 @@ class WebRTCClient extends Emitter {
|
|
|
7578
7611
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7579
7612
|
}
|
|
7580
7613
|
|
|
7614
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7615
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7616
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7617
|
+
if (!pc) {
|
|
7618
|
+
return null;
|
|
7619
|
+
}
|
|
7620
|
+
|
|
7621
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7622
|
+
}
|
|
7623
|
+
|
|
7581
7624
|
hasVideo(sessionId ) {
|
|
7582
7625
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7583
7626
|
}
|
|
@@ -8088,6 +8131,7 @@ class WebRTCClient extends Emitter {
|
|
|
8088
8131
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8089
8132
|
|
|
8090
8133
|
pc.oniceconnectionstatechange = () => {
|
|
8134
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8091
8135
|
if (pc.iceConnectionState === 'disconnected') {
|
|
8092
8136
|
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8093
8137
|
}
|
|
@@ -8316,25 +8360,25 @@ class WebRTCClient extends Emitter {
|
|
|
8316
8360
|
|
|
8317
8361
|
stats.forEach(report => {
|
|
8318
8362
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8319
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8363
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8320
8364
|
}
|
|
8321
8365
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8322
|
-
audioBytesSent += report.bytesSent;
|
|
8366
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8323
8367
|
}
|
|
8324
8368
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8325
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8369
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8326
8370
|
}
|
|
8327
8371
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8328
|
-
packetsLost += report.packetsLost;
|
|
8329
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8330
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8372
|
+
packetsLost += Number(report.packetsLost);
|
|
8373
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8374
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8331
8375
|
}
|
|
8332
8376
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8333
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8377
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8334
8378
|
}
|
|
8335
8379
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8336
8380
|
if ('framesPerSecond' in report) {
|
|
8337
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8381
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8338
8382
|
}
|
|
8339
8383
|
if ('framerateMean' in report) {
|
|
8340
8384
|
// framerateMean is only available in FF
|
|
@@ -8342,32 +8386,36 @@ class WebRTCClient extends Emitter {
|
|
|
8342
8386
|
}
|
|
8343
8387
|
}
|
|
8344
8388
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8345
|
-
packetsLost += report.packetsLost;
|
|
8346
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8347
|
-
networkStats.jitter = report.jitter;
|
|
8389
|
+
packetsLost += Number(report.packetsLost);
|
|
8390
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8391
|
+
networkStats.jitter = Number(report.jitter);
|
|
8348
8392
|
}
|
|
8349
8393
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8350
|
-
packetsLost += report.packetsLost;
|
|
8394
|
+
packetsLost += Number(report.packetsLost);
|
|
8351
8395
|
}
|
|
8352
8396
|
if (report.type === 'transport') {
|
|
8353
|
-
transportSent += report.bytesSent;
|
|
8354
|
-
transportReceived += report.bytesReceived;
|
|
8397
|
+
transportSent += Number(report.bytesSent);
|
|
8398
|
+
transportReceived += Number(report.bytesReceived);
|
|
8355
8399
|
}
|
|
8356
8400
|
});
|
|
8357
8401
|
|
|
8358
8402
|
networkStats.packetsLost = packetsLost;
|
|
8359
|
-
networkStats.
|
|
8403
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8404
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8405
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8360
8406
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8361
|
-
networkStats.
|
|
8362
|
-
networkStats.
|
|
8407
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8408
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8409
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8410
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8411
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8363
8412
|
networkStats.transportSent = transportSent;
|
|
8364
|
-
networkStats.
|
|
8413
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8414
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8365
8415
|
|
|
8366
|
-
|
|
8367
|
-
+
|
|
8368
|
-
+
|
|
8369
|
-
|
|
8370
|
-
networkStats.bandwidth = bandwidth;
|
|
8416
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8417
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8418
|
+
+ networkStats.transportSent;
|
|
8371
8419
|
|
|
8372
8420
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8373
8421
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -8749,7 +8797,10 @@ class WebRTCPhone extends Emitter {
|
|
|
8749
8797
|
|
|
8750
8798
|
onCancel(message);
|
|
8751
8799
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
8752
|
-
|
|
8800
|
+
const callSession = this._createCallSession(sipSession);
|
|
8801
|
+
delete this.callSessions[callSession.getId()];
|
|
8802
|
+
|
|
8803
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
8753
8804
|
};
|
|
8754
8805
|
} else if (sipSession instanceof invitation.Invitation) {
|
|
8755
8806
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -8778,9 +8829,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8778
8829
|
case sessionState.SessionState.Terminated: {
|
|
8779
8830
|
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8780
8831
|
|
|
8832
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8833
|
+
const callSession = this._createCallSession(sipSession);
|
|
8781
8834
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8782
8835
|
|
|
8783
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
8836
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
8784
8837
|
}
|
|
8785
8838
|
}
|
|
8786
8839
|
});
|
|
@@ -8928,18 +8981,20 @@ class WebRTCPhone extends Emitter {
|
|
|
8928
8981
|
screenTrack,
|
|
8929
8982
|
});
|
|
8930
8983
|
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8984
|
+
if (screenTrack) {
|
|
8985
|
+
screenTrack.onended = () => {
|
|
8986
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
8987
|
+
hadVideo,
|
|
8988
|
+
id: this.getSipSessionId(sipSession),
|
|
8989
|
+
screenTrack,
|
|
8990
|
+
});
|
|
8937
8991
|
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8992
|
+
this.eventEmitter.emit(
|
|
8993
|
+
ON_SHARE_SCREEN_ENDING,
|
|
8994
|
+
this._createCallSession(sipSession, callSession),
|
|
8995
|
+
);
|
|
8996
|
+
};
|
|
8997
|
+
}
|
|
8943
8998
|
|
|
8944
8999
|
this.currentScreenShare = {
|
|
8945
9000
|
stream: screenStream,
|
|
@@ -9728,6 +9783,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9728
9783
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9729
9784
|
}
|
|
9730
9785
|
|
|
9786
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
9787
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
9788
|
+
}
|
|
9789
|
+
|
|
9731
9790
|
hasRemoteVideo(callSession ) {
|
|
9732
9791
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9733
9792
|
}
|
|
@@ -10429,6 +10488,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10429
10488
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10430
10489
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10431
10490
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10491
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10432
10492
|
|
|
10433
10493
|
const BLACKLIST_EVENTS = [
|
|
10434
10494
|
CHAT_MESSAGE_SENT,
|
|
@@ -10779,6 +10839,7 @@ WebSocketClient.eventLists = [
|
|
|
10779
10839
|
AGENT_UNPAUSED,
|
|
10780
10840
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10781
10841
|
CONFERENCE_ADHOC_DELETED,
|
|
10842
|
+
MEETING_USER_PROGRESS,
|
|
10782
10843
|
];
|
|
10783
10844
|
|
|
10784
10845
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -10849,6 +10910,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
10849
10910
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
10850
10911
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10851
10912
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
10913
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
10852
10914
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
10853
10915
|
'default': WebSocketClient
|
|
10854
10916
|
});
|
|
@@ -13568,6 +13630,11 @@ class Phone extends Emitter {
|
|
|
13568
13630
|
return this.getRemoteVideoStream(callSession);
|
|
13569
13631
|
}
|
|
13570
13632
|
|
|
13633
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
13634
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
13635
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
13636
|
+
}
|
|
13637
|
+
|
|
13571
13638
|
hasVideo(callSession ) {
|
|
13572
13639
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
13573
13640
|
}
|
package/lib/simple/Websocket.js
CHANGED
|
@@ -129,6 +129,7 @@ class IssueReporter {
|
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
|
|
132
|
+
|
|
132
133
|
|
|
133
134
|
constructor() {
|
|
134
135
|
addLevelsTo(this);
|
|
@@ -140,12 +141,17 @@ class IssueReporter {
|
|
|
140
141
|
this.bufferTimeout = null;
|
|
141
142
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
142
143
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
144
|
+
this._callback = null;
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
init() {
|
|
146
148
|
this._catchConsole();
|
|
147
149
|
}
|
|
148
150
|
|
|
151
|
+
setCallback(cb ) {
|
|
152
|
+
this._callback = cb;
|
|
153
|
+
}
|
|
154
|
+
|
|
149
155
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
150
156
|
this.remoteClientConfiguration = configuration;
|
|
151
157
|
}
|
|
@@ -181,6 +187,7 @@ class IssueReporter {
|
|
|
181
187
|
|
|
182
188
|
// Handle category label
|
|
183
189
|
let category = null;
|
|
190
|
+
let skipSendToRemote = false;
|
|
184
191
|
let extra = {};
|
|
185
192
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
186
193
|
category = args[0].split('=')[1];
|
|
@@ -196,6 +203,7 @@ class IssueReporter {
|
|
|
196
203
|
errorMessage: lastArg.message,
|
|
197
204
|
errorStack: lastArg.stack,
|
|
198
205
|
errorType: lastArg.constructor.name,
|
|
206
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
199
207
|
};
|
|
200
208
|
} else {
|
|
201
209
|
extra = lastArg;
|
|
@@ -204,6 +212,11 @@ class IssueReporter {
|
|
|
204
212
|
args.splice(1, 1);
|
|
205
213
|
}
|
|
206
214
|
|
|
215
|
+
if (extra.skipSendToRemote) {
|
|
216
|
+
skipSendToRemote = true;
|
|
217
|
+
delete extra.skipSendToRemote;
|
|
218
|
+
}
|
|
219
|
+
|
|
207
220
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
208
221
|
const message = args.join(', ');
|
|
209
222
|
let consoleMessage = message;
|
|
@@ -224,7 +237,13 @@ class IssueReporter {
|
|
|
224
237
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
225
238
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
226
239
|
|
|
227
|
-
this.
|
|
240
|
+
if (this._callback) {
|
|
241
|
+
this._callback(level, consoleMessage);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (!skipSendToRemote) {
|
|
245
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
246
|
+
}
|
|
228
247
|
}
|
|
229
248
|
|
|
230
249
|
logRequest(url , options , response , start ) {
|
|
@@ -369,7 +388,11 @@ class IssueReporter {
|
|
|
369
388
|
},
|
|
370
389
|
// $FlowFixMe
|
|
371
390
|
body,
|
|
372
|
-
}).catch(() => {
|
|
391
|
+
}).catch((e ) => {
|
|
392
|
+
// $FlowFixMe
|
|
393
|
+
e.skipSendToRemote = true;
|
|
394
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
395
|
+
|
|
373
396
|
setTimeout(() => {
|
|
374
397
|
if (isArray) {
|
|
375
398
|
payload = payload.map(message => {
|
|
@@ -586,6 +609,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
586
609
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
587
610
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
588
611
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
612
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
589
613
|
|
|
590
614
|
const BLACKLIST_EVENTS = [
|
|
591
615
|
CHAT_MESSAGE_SENT,
|
|
@@ -936,6 +960,7 @@ WebSocketClient.eventLists = [
|
|
|
936
960
|
AGENT_UNPAUSED,
|
|
937
961
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
938
962
|
CONFERENCE_ADHOC_DELETED,
|
|
963
|
+
MEETING_USER_PROGRESS,
|
|
939
964
|
];
|
|
940
965
|
|
|
941
966
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -1006,6 +1031,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
1006
1031
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
1007
1032
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
1008
1033
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
1034
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
1009
1035
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
1010
1036
|
'default': WebSocketClient
|
|
1011
1037
|
});
|