@wazo/sdk 0.37.20 → 0.37.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wazo-sdk.js +5 -5
- package/esm/__tests__/api-client.test.js +44 -5
- package/esm/__tests__/web-rtc-client.test.js +70 -15
- package/esm/api/agentd.js +25 -2
- package/esm/api/amid.js +25 -2
- package/esm/api/application.js +25 -2
- package/esm/api/auth.js +25 -2
- package/esm/api/call-logd.js +25 -2
- package/esm/api/calld.js +25 -2
- package/esm/api/chatd.js +25 -2
- package/esm/api/confd.js +44 -5
- package/esm/api/ctid-ng.js +25 -2
- package/esm/api/dird.js +25 -2
- package/esm/api/webhookd.js +25 -2
- package/esm/api-client.js +44 -5
- package/esm/checker/Checker.js +72 -15
- package/esm/checker/checks/aor.js +44 -5
- package/esm/checker/checks/api.js +44 -5
- package/esm/checker/checks/index.js +72 -15
- package/esm/checker/checks/wazo-websocket.js +27 -2
- package/esm/checker/checks/webrtc-transport.js +70 -15
- package/esm/checker/checks/webrtc.js +70 -15
- package/esm/domain/AdHocAPIConference.js +44 -5
- package/esm/domain/Features.js +44 -5
- package/esm/domain/Meeting.js +14 -1
- package/esm/domain/Phone/CTIPhone.js +44 -5
- package/esm/domain/Phone/WebRTCPhone.js +32 -3
- package/esm/index.js +85 -16
- package/esm/lib/WazoSessionDescriptionHandler.js +25 -2
- package/esm/service/CallApi.js +44 -5
- package/esm/service/IssueReporter.js +25 -2
- package/esm/service/__tests__/IssueReporter.test.js +25 -2
- package/esm/service/getApiClient.js +44 -5
- package/esm/simple/Auth.js +85 -16
- package/esm/simple/Configuration.js +85 -16
- package/esm/simple/Directory.js +44 -5
- package/esm/simple/Phone.js +85 -16
- package/esm/simple/Websocket.js +28 -2
- package/esm/simple/index.js +85 -16
- package/esm/simple/room/LocalParticipant.js +85 -16
- package/esm/simple/room/Participant.js +85 -16
- package/esm/simple/room/RemoteParticipant.js +85 -16
- package/esm/simple/room/Room.js +85 -16
- package/esm/simple/room/SipRoom.js +85 -16
- package/esm/simple/room/Stream.js +85 -16
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +85 -16
- package/esm/simple/utils.js +85 -16
- package/esm/utils/__tests__/api-requester.test.js +25 -2
- package/esm/utils/api-requester.js +25 -2
- package/esm/web-rtc-client.js +70 -15
- package/esm/websocket-client.js +28 -3
- package/lib/__tests__/api-client.test.js +44 -5
- package/lib/__tests__/web-rtc-client.test.js +70 -15
- package/lib/api/agentd.js +25 -2
- package/lib/api/amid.js +25 -2
- package/lib/api/application.js +25 -2
- package/lib/api/auth.js +25 -2
- package/lib/api/call-logd.js +25 -2
- package/lib/api/calld.js +25 -2
- package/lib/api/chatd.js +25 -2
- package/lib/api/confd.js +44 -5
- package/lib/api/ctid-ng.js +25 -2
- package/lib/api/dird.js +25 -2
- package/lib/api/webhookd.js +25 -2
- package/lib/api-client.js +44 -5
- package/lib/checker/Checker.js +72 -15
- package/lib/checker/checks/aor.js +44 -5
- package/lib/checker/checks/api.js +44 -5
- package/lib/checker/checks/index.js +72 -15
- package/lib/checker/checks/wazo-websocket.js +27 -2
- package/lib/checker/checks/webrtc-transport.js +70 -15
- package/lib/checker/checks/webrtc.js +70 -15
- package/lib/domain/AdHocAPIConference.js +44 -5
- package/lib/domain/Features.js +44 -5
- package/lib/domain/Meeting.js +14 -1
- package/lib/domain/Phone/CTIPhone.js +44 -5
- package/lib/domain/Phone/WebRTCPhone.js +32 -3
- package/lib/index.js +85 -16
- package/lib/lib/WazoSessionDescriptionHandler.js +25 -2
- package/lib/service/CallApi.js +44 -5
- package/lib/service/IssueReporter.js +25 -2
- package/lib/service/__tests__/IssueReporter.test.js +25 -2
- package/lib/service/getApiClient.js +44 -5
- package/lib/simple/Auth.js +85 -16
- package/lib/simple/Configuration.js +85 -16
- package/lib/simple/Directory.js +44 -5
- package/lib/simple/Phone.js +85 -16
- package/lib/simple/Websocket.js +28 -2
- package/lib/simple/index.js +85 -16
- package/lib/simple/room/LocalParticipant.js +85 -16
- package/lib/simple/room/Participant.js +85 -16
- package/lib/simple/room/RemoteParticipant.js +85 -16
- package/lib/simple/room/Room.js +85 -16
- package/lib/simple/room/SipRoom.js +85 -16
- package/lib/simple/room/Stream.js +85 -16
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +85 -16
- package/lib/simple/utils.js +85 -16
- package/lib/utils/__tests__/api-requester.test.js +25 -2
- package/lib/utils/api-requester.js +25 -2
- package/lib/web-rtc-client.js +70 -15
- package/lib/websocket-client.js +28 -2
- package/package.json +1 -1
- package/src/api/confd.js +5 -2
- package/src/domain/Meeting.js +14 -1
- package/src/domain/Phone/WebRTCPhone.js +7 -1
- package/src/service/IssueReporter.js +25 -2
- package/src/simple/Phone.js +5 -0
- package/src/types/WebSocketMessage.js +5 -1
- package/src/web-rtc-client.js +26 -10
- package/src/websocket-client.js +2 -0
package/lib/simple/utils.js
CHANGED
|
@@ -1646,6 +1646,7 @@ class IssueReporter {
|
|
|
1646
1646
|
|
|
1647
1647
|
|
|
1648
1648
|
|
|
1649
|
+
|
|
1649
1650
|
|
|
1650
1651
|
constructor() {
|
|
1651
1652
|
addLevelsTo(this);
|
|
@@ -1657,12 +1658,17 @@ class IssueReporter {
|
|
|
1657
1658
|
this.bufferTimeout = null;
|
|
1658
1659
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
1659
1660
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
1661
|
+
this._callback = null;
|
|
1660
1662
|
}
|
|
1661
1663
|
|
|
1662
1664
|
init() {
|
|
1663
1665
|
this._catchConsole();
|
|
1664
1666
|
}
|
|
1665
1667
|
|
|
1668
|
+
setCallback(cb ) {
|
|
1669
|
+
this._callback = cb;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1666
1672
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
1667
1673
|
this.remoteClientConfiguration = configuration;
|
|
1668
1674
|
}
|
|
@@ -1698,6 +1704,7 @@ class IssueReporter {
|
|
|
1698
1704
|
|
|
1699
1705
|
// Handle category label
|
|
1700
1706
|
let category = null;
|
|
1707
|
+
let skipSendToRemote = false;
|
|
1701
1708
|
let extra = {};
|
|
1702
1709
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
1703
1710
|
category = args[0].split('=')[1];
|
|
@@ -1713,6 +1720,7 @@ class IssueReporter {
|
|
|
1713
1720
|
errorMessage: lastArg.message,
|
|
1714
1721
|
errorStack: lastArg.stack,
|
|
1715
1722
|
errorType: lastArg.constructor.name,
|
|
1723
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
1716
1724
|
};
|
|
1717
1725
|
} else {
|
|
1718
1726
|
extra = lastArg;
|
|
@@ -1721,6 +1729,11 @@ class IssueReporter {
|
|
|
1721
1729
|
args.splice(1, 1);
|
|
1722
1730
|
}
|
|
1723
1731
|
|
|
1732
|
+
if (extra.skipSendToRemote) {
|
|
1733
|
+
skipSendToRemote = true;
|
|
1734
|
+
delete extra.skipSendToRemote;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1724
1737
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
1725
1738
|
const message = args.join(', ');
|
|
1726
1739
|
let consoleMessage = message;
|
|
@@ -1741,7 +1754,13 @@ class IssueReporter {
|
|
|
1741
1754
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
1742
1755
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
1743
1756
|
|
|
1744
|
-
this.
|
|
1757
|
+
if (this._callback) {
|
|
1758
|
+
this._callback(level, consoleMessage);
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
if (!skipSendToRemote) {
|
|
1762
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
1763
|
+
}
|
|
1745
1764
|
}
|
|
1746
1765
|
|
|
1747
1766
|
logRequest(url , options , response , start ) {
|
|
@@ -1886,7 +1905,11 @@ class IssueReporter {
|
|
|
1886
1905
|
},
|
|
1887
1906
|
// $FlowFixMe
|
|
1888
1907
|
body,
|
|
1889
|
-
}).catch(() => {
|
|
1908
|
+
}).catch((e ) => {
|
|
1909
|
+
// $FlowFixMe
|
|
1910
|
+
e.skipSendToRemote = true;
|
|
1911
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
1912
|
+
|
|
1890
1913
|
setTimeout(() => {
|
|
1891
1914
|
if (isArray) {
|
|
1892
1915
|
payload = payload.map(message => {
|
|
@@ -2645,11 +2668,24 @@ class Meeting {
|
|
|
2645
2668
|
});
|
|
2646
2669
|
}
|
|
2647
2670
|
|
|
2671
|
+
static parseMany(items ) {
|
|
2672
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2648
2675
|
static newFrom(meeting ) {
|
|
2649
2676
|
return newFrom(meeting, Meeting);
|
|
2650
2677
|
}
|
|
2651
2678
|
|
|
2652
|
-
constructor({
|
|
2679
|
+
constructor({
|
|
2680
|
+
uuid,
|
|
2681
|
+
name,
|
|
2682
|
+
guestSipAuthorization,
|
|
2683
|
+
ownerUuids,
|
|
2684
|
+
port,
|
|
2685
|
+
uri,
|
|
2686
|
+
number,
|
|
2687
|
+
persistent,
|
|
2688
|
+
} = {}) {
|
|
2653
2689
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2654
2690
|
this.uri = uri;
|
|
2655
2691
|
this.name = name;
|
|
@@ -2735,8 +2771,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2735
2771
|
}
|
|
2736
2772
|
},
|
|
2737
2773
|
|
|
2738
|
-
|
|
2739
|
-
client.
|
|
2774
|
+
getMyMeetings: () =>
|
|
2775
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2776
|
+
|
|
2777
|
+
createMyMeeting: (name , persistent ) =>
|
|
2778
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2740
2779
|
|
|
2741
2780
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2742
2781
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -6972,7 +7011,9 @@ class WebRTCClient extends Emitter {
|
|
|
6972
7011
|
const inviteOptions = {
|
|
6973
7012
|
requestDelegate: {
|
|
6974
7013
|
onAccept: (response ) => {
|
|
6975
|
-
session.sessionDescriptionHandler.peerConnection
|
|
7014
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
7015
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
7016
|
+
}
|
|
6976
7017
|
this._onAccepted(session, response.session, true);
|
|
6977
7018
|
},
|
|
6978
7019
|
onReject: (response ) => {
|
|
@@ -7844,6 +7885,16 @@ class WebRTCClient extends Emitter {
|
|
|
7844
7885
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7845
7886
|
}
|
|
7846
7887
|
|
|
7888
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7889
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7890
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7891
|
+
if (!pc) {
|
|
7892
|
+
return null;
|
|
7893
|
+
}
|
|
7894
|
+
|
|
7895
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7896
|
+
}
|
|
7897
|
+
|
|
7847
7898
|
hasVideo(sessionId ) {
|
|
7848
7899
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7849
7900
|
}
|
|
@@ -8622,18 +8673,22 @@ class WebRTCClient extends Emitter {
|
|
|
8622
8673
|
});
|
|
8623
8674
|
|
|
8624
8675
|
networkStats.packetsLost = packetsLost;
|
|
8625
|
-
networkStats.
|
|
8676
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8677
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8678
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8626
8679
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8627
|
-
networkStats.
|
|
8628
|
-
networkStats.
|
|
8680
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8681
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8682
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8683
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8684
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8629
8685
|
networkStats.transportSent = transportSent;
|
|
8630
|
-
networkStats.
|
|
8686
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8687
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8631
8688
|
|
|
8632
|
-
|
|
8633
|
-
+
|
|
8634
|
-
+
|
|
8635
|
-
|
|
8636
|
-
networkStats.bandwidth = bandwidth;
|
|
8689
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8690
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8691
|
+
+ networkStats.transportSent;
|
|
8637
8692
|
|
|
8638
8693
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8639
8694
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -9044,9 +9099,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9044
9099
|
case sessionState.SessionState.Terminated: {
|
|
9045
9100
|
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9046
9101
|
|
|
9102
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9103
|
+
const callSession = this._createCallSession(sipSession);
|
|
9047
9104
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9048
9105
|
|
|
9049
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
9106
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
9050
9107
|
}
|
|
9051
9108
|
}
|
|
9052
9109
|
});
|
|
@@ -9994,6 +10051,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9994
10051
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9995
10052
|
}
|
|
9996
10053
|
|
|
10054
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10055
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
10056
|
+
}
|
|
10057
|
+
|
|
9997
10058
|
hasRemoteVideo(callSession ) {
|
|
9998
10059
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9999
10060
|
}
|
|
@@ -10677,6 +10738,11 @@ class Phone extends Emitter {
|
|
|
10677
10738
|
return this.getRemoteVideoStream(callSession);
|
|
10678
10739
|
}
|
|
10679
10740
|
|
|
10741
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
10742
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10743
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
10744
|
+
}
|
|
10745
|
+
|
|
10680
10746
|
hasVideo(callSession ) {
|
|
10681
10747
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
10682
10748
|
}
|
|
@@ -10836,6 +10902,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10836
10902
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10837
10903
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10838
10904
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10905
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10839
10906
|
|
|
10840
10907
|
const BLACKLIST_EVENTS = [
|
|
10841
10908
|
CHAT_MESSAGE_SENT,
|
|
@@ -11186,6 +11253,7 @@ WebSocketClient.eventLists = [
|
|
|
11186
11253
|
AGENT_UNPAUSED,
|
|
11187
11254
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11188
11255
|
CONFERENCE_ADHOC_DELETED,
|
|
11256
|
+
MEETING_USER_PROGRESS,
|
|
11189
11257
|
];
|
|
11190
11258
|
|
|
11191
11259
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -11256,6 +11324,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11256
11324
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
11257
11325
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11258
11326
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
11327
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
11259
11328
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
11260
11329
|
'default': WebSocketClient
|
|
11261
11330
|
});
|
|
@@ -132,6 +132,7 @@ class IssueReporter {
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
|
|
135
|
+
|
|
135
136
|
|
|
136
137
|
constructor() {
|
|
137
138
|
addLevelsTo(this);
|
|
@@ -143,12 +144,17 @@ class IssueReporter {
|
|
|
143
144
|
this.bufferTimeout = null;
|
|
144
145
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
145
146
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
147
|
+
this._callback = null;
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
init() {
|
|
149
151
|
this._catchConsole();
|
|
150
152
|
}
|
|
151
153
|
|
|
154
|
+
setCallback(cb ) {
|
|
155
|
+
this._callback = cb;
|
|
156
|
+
}
|
|
157
|
+
|
|
152
158
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
153
159
|
this.remoteClientConfiguration = configuration;
|
|
154
160
|
}
|
|
@@ -184,6 +190,7 @@ class IssueReporter {
|
|
|
184
190
|
|
|
185
191
|
// Handle category label
|
|
186
192
|
let category = null;
|
|
193
|
+
let skipSendToRemote = false;
|
|
187
194
|
let extra = {};
|
|
188
195
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
189
196
|
category = args[0].split('=')[1];
|
|
@@ -199,6 +206,7 @@ class IssueReporter {
|
|
|
199
206
|
errorMessage: lastArg.message,
|
|
200
207
|
errorStack: lastArg.stack,
|
|
201
208
|
errorType: lastArg.constructor.name,
|
|
209
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
202
210
|
};
|
|
203
211
|
} else {
|
|
204
212
|
extra = lastArg;
|
|
@@ -207,6 +215,11 @@ class IssueReporter {
|
|
|
207
215
|
args.splice(1, 1);
|
|
208
216
|
}
|
|
209
217
|
|
|
218
|
+
if (extra.skipSendToRemote) {
|
|
219
|
+
skipSendToRemote = true;
|
|
220
|
+
delete extra.skipSendToRemote;
|
|
221
|
+
}
|
|
222
|
+
|
|
210
223
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
211
224
|
const message = args.join(', ');
|
|
212
225
|
let consoleMessage = message;
|
|
@@ -227,7 +240,13 @@ class IssueReporter {
|
|
|
227
240
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
228
241
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
229
242
|
|
|
230
|
-
this.
|
|
243
|
+
if (this._callback) {
|
|
244
|
+
this._callback(level, consoleMessage);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (!skipSendToRemote) {
|
|
248
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
249
|
+
}
|
|
231
250
|
}
|
|
232
251
|
|
|
233
252
|
logRequest(url , options , response , start ) {
|
|
@@ -372,7 +391,11 @@ class IssueReporter {
|
|
|
372
391
|
},
|
|
373
392
|
// $FlowFixMe
|
|
374
393
|
body,
|
|
375
|
-
}).catch(() => {
|
|
394
|
+
}).catch((e ) => {
|
|
395
|
+
// $FlowFixMe
|
|
396
|
+
e.skipSendToRemote = true;
|
|
397
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
398
|
+
|
|
376
399
|
setTimeout(() => {
|
|
377
400
|
if (isArray) {
|
|
378
401
|
payload = payload.map(message => {
|
|
@@ -134,6 +134,7 @@ class IssueReporter {
|
|
|
134
134
|
|
|
135
135
|
|
|
136
136
|
|
|
137
|
+
|
|
137
138
|
|
|
138
139
|
constructor() {
|
|
139
140
|
addLevelsTo(this);
|
|
@@ -145,12 +146,17 @@ class IssueReporter {
|
|
|
145
146
|
this.bufferTimeout = null;
|
|
146
147
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
147
148
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
149
|
+
this._callback = null;
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
init() {
|
|
151
153
|
this._catchConsole();
|
|
152
154
|
}
|
|
153
155
|
|
|
156
|
+
setCallback(cb ) {
|
|
157
|
+
this._callback = cb;
|
|
158
|
+
}
|
|
159
|
+
|
|
154
160
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
155
161
|
this.remoteClientConfiguration = configuration;
|
|
156
162
|
}
|
|
@@ -186,6 +192,7 @@ class IssueReporter {
|
|
|
186
192
|
|
|
187
193
|
// Handle category label
|
|
188
194
|
let category = null;
|
|
195
|
+
let skipSendToRemote = false;
|
|
189
196
|
let extra = {};
|
|
190
197
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
191
198
|
category = args[0].split('=')[1];
|
|
@@ -201,6 +208,7 @@ class IssueReporter {
|
|
|
201
208
|
errorMessage: lastArg.message,
|
|
202
209
|
errorStack: lastArg.stack,
|
|
203
210
|
errorType: lastArg.constructor.name,
|
|
211
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
204
212
|
};
|
|
205
213
|
} else {
|
|
206
214
|
extra = lastArg;
|
|
@@ -209,6 +217,11 @@ class IssueReporter {
|
|
|
209
217
|
args.splice(1, 1);
|
|
210
218
|
}
|
|
211
219
|
|
|
220
|
+
if (extra.skipSendToRemote) {
|
|
221
|
+
skipSendToRemote = true;
|
|
222
|
+
delete extra.skipSendToRemote;
|
|
223
|
+
}
|
|
224
|
+
|
|
212
225
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
213
226
|
const message = args.join(', ');
|
|
214
227
|
let consoleMessage = message;
|
|
@@ -229,7 +242,13 @@ class IssueReporter {
|
|
|
229
242
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
230
243
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
231
244
|
|
|
232
|
-
this.
|
|
245
|
+
if (this._callback) {
|
|
246
|
+
this._callback(level, consoleMessage);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (!skipSendToRemote) {
|
|
250
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
251
|
+
}
|
|
233
252
|
}
|
|
234
253
|
|
|
235
254
|
logRequest(url , options , response , start ) {
|
|
@@ -374,7 +393,11 @@ class IssueReporter {
|
|
|
374
393
|
},
|
|
375
394
|
// $FlowFixMe
|
|
376
395
|
body,
|
|
377
|
-
}).catch(() => {
|
|
396
|
+
}).catch((e ) => {
|
|
397
|
+
// $FlowFixMe
|
|
398
|
+
e.skipSendToRemote = true;
|
|
399
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
400
|
+
|
|
378
401
|
setTimeout(() => {
|
|
379
402
|
if (isArray) {
|
|
380
403
|
payload = payload.map(message => {
|
package/lib/web-rtc-client.js
CHANGED
|
@@ -423,6 +423,7 @@ class IssueReporter {
|
|
|
423
423
|
|
|
424
424
|
|
|
425
425
|
|
|
426
|
+
|
|
426
427
|
|
|
427
428
|
constructor() {
|
|
428
429
|
addLevelsTo(this);
|
|
@@ -434,12 +435,17 @@ class IssueReporter {
|
|
|
434
435
|
this.bufferTimeout = null;
|
|
435
436
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
436
437
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
438
|
+
this._callback = null;
|
|
437
439
|
}
|
|
438
440
|
|
|
439
441
|
init() {
|
|
440
442
|
this._catchConsole();
|
|
441
443
|
}
|
|
442
444
|
|
|
445
|
+
setCallback(cb ) {
|
|
446
|
+
this._callback = cb;
|
|
447
|
+
}
|
|
448
|
+
|
|
443
449
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
444
450
|
this.remoteClientConfiguration = configuration;
|
|
445
451
|
}
|
|
@@ -475,6 +481,7 @@ class IssueReporter {
|
|
|
475
481
|
|
|
476
482
|
// Handle category label
|
|
477
483
|
let category = null;
|
|
484
|
+
let skipSendToRemote = false;
|
|
478
485
|
let extra = {};
|
|
479
486
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
480
487
|
category = args[0].split('=')[1];
|
|
@@ -490,6 +497,7 @@ class IssueReporter {
|
|
|
490
497
|
errorMessage: lastArg.message,
|
|
491
498
|
errorStack: lastArg.stack,
|
|
492
499
|
errorType: lastArg.constructor.name,
|
|
500
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
493
501
|
};
|
|
494
502
|
} else {
|
|
495
503
|
extra = lastArg;
|
|
@@ -498,6 +506,11 @@ class IssueReporter {
|
|
|
498
506
|
args.splice(1, 1);
|
|
499
507
|
}
|
|
500
508
|
|
|
509
|
+
if (extra.skipSendToRemote) {
|
|
510
|
+
skipSendToRemote = true;
|
|
511
|
+
delete extra.skipSendToRemote;
|
|
512
|
+
}
|
|
513
|
+
|
|
501
514
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
502
515
|
const message = args.join(', ');
|
|
503
516
|
let consoleMessage = message;
|
|
@@ -518,7 +531,13 @@ class IssueReporter {
|
|
|
518
531
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
519
532
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
520
533
|
|
|
521
|
-
this.
|
|
534
|
+
if (this._callback) {
|
|
535
|
+
this._callback(level, consoleMessage);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if (!skipSendToRemote) {
|
|
539
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
540
|
+
}
|
|
522
541
|
}
|
|
523
542
|
|
|
524
543
|
logRequest(url , options , response , start ) {
|
|
@@ -663,7 +682,11 @@ class IssueReporter {
|
|
|
663
682
|
},
|
|
664
683
|
// $FlowFixMe
|
|
665
684
|
body,
|
|
666
|
-
}).catch(() => {
|
|
685
|
+
}).catch((e ) => {
|
|
686
|
+
// $FlowFixMe
|
|
687
|
+
e.skipSendToRemote = true;
|
|
688
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
689
|
+
|
|
667
690
|
setTimeout(() => {
|
|
668
691
|
if (isArray) {
|
|
669
692
|
payload = payload.map(message => {
|
|
@@ -3206,11 +3229,24 @@ class Meeting {
|
|
|
3206
3229
|
});
|
|
3207
3230
|
}
|
|
3208
3231
|
|
|
3232
|
+
static parseMany(items ) {
|
|
3233
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3234
|
+
}
|
|
3235
|
+
|
|
3209
3236
|
static newFrom(meeting ) {
|
|
3210
3237
|
return newFrom(meeting, Meeting);
|
|
3211
3238
|
}
|
|
3212
3239
|
|
|
3213
|
-
constructor({
|
|
3240
|
+
constructor({
|
|
3241
|
+
uuid,
|
|
3242
|
+
name,
|
|
3243
|
+
guestSipAuthorization,
|
|
3244
|
+
ownerUuids,
|
|
3245
|
+
port,
|
|
3246
|
+
uri,
|
|
3247
|
+
number,
|
|
3248
|
+
persistent,
|
|
3249
|
+
} = {}) {
|
|
3214
3250
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3215
3251
|
this.uri = uri;
|
|
3216
3252
|
this.name = name;
|
|
@@ -3296,8 +3332,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3296
3332
|
}
|
|
3297
3333
|
},
|
|
3298
3334
|
|
|
3299
|
-
|
|
3300
|
-
client.
|
|
3335
|
+
getMyMeetings: () =>
|
|
3336
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3337
|
+
|
|
3338
|
+
createMyMeeting: (name , persistent ) =>
|
|
3339
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3301
3340
|
|
|
3302
3341
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3303
3342
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -5712,7 +5751,9 @@ class WebRTCClient extends Emitter {
|
|
|
5712
5751
|
const inviteOptions = {
|
|
5713
5752
|
requestDelegate: {
|
|
5714
5753
|
onAccept: (response ) => {
|
|
5715
|
-
session.sessionDescriptionHandler.peerConnection
|
|
5754
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
5755
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
5756
|
+
}
|
|
5716
5757
|
this._onAccepted(session, response.session, true);
|
|
5717
5758
|
},
|
|
5718
5759
|
onReject: (response ) => {
|
|
@@ -6584,6 +6625,16 @@ class WebRTCClient extends Emitter {
|
|
|
6584
6625
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
6585
6626
|
}
|
|
6586
6627
|
|
|
6628
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
6629
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
6630
|
+
const pc = this.getPeerConnection(sessionId);
|
|
6631
|
+
if (!pc) {
|
|
6632
|
+
return null;
|
|
6633
|
+
}
|
|
6634
|
+
|
|
6635
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
6636
|
+
}
|
|
6637
|
+
|
|
6587
6638
|
hasVideo(sessionId ) {
|
|
6588
6639
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
6589
6640
|
}
|
|
@@ -7362,18 +7413,22 @@ class WebRTCClient extends Emitter {
|
|
|
7362
7413
|
});
|
|
7363
7414
|
|
|
7364
7415
|
networkStats.packetsLost = packetsLost;
|
|
7365
|
-
networkStats.
|
|
7416
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7417
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7418
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7366
7419
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7367
|
-
networkStats.
|
|
7368
|
-
networkStats.
|
|
7420
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7421
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7422
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
7423
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
7424
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7369
7425
|
networkStats.transportSent = transportSent;
|
|
7370
|
-
networkStats.
|
|
7371
|
-
|
|
7372
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7373
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7374
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
7426
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
7427
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7375
7428
|
|
|
7376
|
-
networkStats.bandwidth =
|
|
7429
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
7430
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
7431
|
+
+ networkStats.transportSent;
|
|
7377
7432
|
|
|
7378
7433
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7379
7434
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
package/lib/websocket-client.js
CHANGED
|
@@ -131,6 +131,7 @@ class IssueReporter {
|
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
|
|
134
|
+
|
|
134
135
|
|
|
135
136
|
constructor() {
|
|
136
137
|
addLevelsTo(this);
|
|
@@ -142,12 +143,17 @@ class IssueReporter {
|
|
|
142
143
|
this.bufferTimeout = null;
|
|
143
144
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
144
145
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
146
|
+
this._callback = null;
|
|
145
147
|
}
|
|
146
148
|
|
|
147
149
|
init() {
|
|
148
150
|
this._catchConsole();
|
|
149
151
|
}
|
|
150
152
|
|
|
153
|
+
setCallback(cb ) {
|
|
154
|
+
this._callback = cb;
|
|
155
|
+
}
|
|
156
|
+
|
|
151
157
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
152
158
|
this.remoteClientConfiguration = configuration;
|
|
153
159
|
}
|
|
@@ -183,6 +189,7 @@ class IssueReporter {
|
|
|
183
189
|
|
|
184
190
|
// Handle category label
|
|
185
191
|
let category = null;
|
|
192
|
+
let skipSendToRemote = false;
|
|
186
193
|
let extra = {};
|
|
187
194
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
188
195
|
category = args[0].split('=')[1];
|
|
@@ -198,6 +205,7 @@ class IssueReporter {
|
|
|
198
205
|
errorMessage: lastArg.message,
|
|
199
206
|
errorStack: lastArg.stack,
|
|
200
207
|
errorType: lastArg.constructor.name,
|
|
208
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
201
209
|
};
|
|
202
210
|
} else {
|
|
203
211
|
extra = lastArg;
|
|
@@ -206,6 +214,11 @@ class IssueReporter {
|
|
|
206
214
|
args.splice(1, 1);
|
|
207
215
|
}
|
|
208
216
|
|
|
217
|
+
if (extra.skipSendToRemote) {
|
|
218
|
+
skipSendToRemote = true;
|
|
219
|
+
delete extra.skipSendToRemote;
|
|
220
|
+
}
|
|
221
|
+
|
|
209
222
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
210
223
|
const message = args.join(', ');
|
|
211
224
|
let consoleMessage = message;
|
|
@@ -226,7 +239,13 @@ class IssueReporter {
|
|
|
226
239
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
227
240
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
228
241
|
|
|
229
|
-
this.
|
|
242
|
+
if (this._callback) {
|
|
243
|
+
this._callback(level, consoleMessage);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (!skipSendToRemote) {
|
|
247
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
248
|
+
}
|
|
230
249
|
}
|
|
231
250
|
|
|
232
251
|
logRequest(url , options , response , start ) {
|
|
@@ -371,7 +390,11 @@ class IssueReporter {
|
|
|
371
390
|
},
|
|
372
391
|
// $FlowFixMe
|
|
373
392
|
body,
|
|
374
|
-
}).catch(() => {
|
|
393
|
+
}).catch((e ) => {
|
|
394
|
+
// $FlowFixMe
|
|
395
|
+
e.skipSendToRemote = true;
|
|
396
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
397
|
+
|
|
375
398
|
setTimeout(() => {
|
|
376
399
|
if (isArray) {
|
|
377
400
|
payload = payload.map(message => {
|
|
@@ -588,6 +611,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
588
611
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
589
612
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
590
613
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
614
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
591
615
|
|
|
592
616
|
const BLACKLIST_EVENTS = [
|
|
593
617
|
CHAT_MESSAGE_SENT,
|
|
@@ -938,6 +962,7 @@ WebSocketClient.eventLists = [
|
|
|
938
962
|
AGENT_UNPAUSED,
|
|
939
963
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
940
964
|
CONFERENCE_ADHOC_DELETED,
|
|
965
|
+
MEETING_USER_PROGRESS,
|
|
941
966
|
];
|
|
942
967
|
|
|
943
968
|
exports.AGENT_PAUSED = AGENT_PAUSED;
|
|
@@ -993,6 +1018,7 @@ exports.HEARTBEAT_ENGINE_VERSION = HEARTBEAT_ENGINE_VERSION;
|
|
|
993
1018
|
exports.LINE_STATUS_UPDATED = LINE_STATUS_UPDATED;
|
|
994
1019
|
exports.MEETING_USER_PARTICIPANT_JOINED = MEETING_USER_PARTICIPANT_JOINED;
|
|
995
1020
|
exports.MEETING_USER_PARTICIPANT_LEFT = MEETING_USER_PARTICIPANT_LEFT;
|
|
1021
|
+
exports.MEETING_USER_PROGRESS = MEETING_USER_PROGRESS;
|
|
996
1022
|
exports.SOCKET_EVENTS = SOCKET_EVENTS;
|
|
997
1023
|
exports.SWITCHBOARD_HELD_CALLS_UPDATED = SWITCHBOARD_HELD_CALLS_UPDATED;
|
|
998
1024
|
exports.SWITCHBOARD_HELD_CALL_ANSWERED = SWITCHBOARD_HELD_CALL_ANSWERED;
|