@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
|
@@ -1644,6 +1644,7 @@ class IssueReporter {
|
|
|
1644
1644
|
|
|
1645
1645
|
|
|
1646
1646
|
|
|
1647
|
+
|
|
1647
1648
|
|
|
1648
1649
|
constructor() {
|
|
1649
1650
|
addLevelsTo(this);
|
|
@@ -1655,12 +1656,17 @@ class IssueReporter {
|
|
|
1655
1656
|
this.bufferTimeout = null;
|
|
1656
1657
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
1657
1658
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
1659
|
+
this._callback = null;
|
|
1658
1660
|
}
|
|
1659
1661
|
|
|
1660
1662
|
init() {
|
|
1661
1663
|
this._catchConsole();
|
|
1662
1664
|
}
|
|
1663
1665
|
|
|
1666
|
+
setCallback(cb ) {
|
|
1667
|
+
this._callback = cb;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1664
1670
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
1665
1671
|
this.remoteClientConfiguration = configuration;
|
|
1666
1672
|
}
|
|
@@ -1696,6 +1702,7 @@ class IssueReporter {
|
|
|
1696
1702
|
|
|
1697
1703
|
// Handle category label
|
|
1698
1704
|
let category = null;
|
|
1705
|
+
let skipSendToRemote = false;
|
|
1699
1706
|
let extra = {};
|
|
1700
1707
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
1701
1708
|
category = args[0].split('=')[1];
|
|
@@ -1711,6 +1718,7 @@ class IssueReporter {
|
|
|
1711
1718
|
errorMessage: lastArg.message,
|
|
1712
1719
|
errorStack: lastArg.stack,
|
|
1713
1720
|
errorType: lastArg.constructor.name,
|
|
1721
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
1714
1722
|
};
|
|
1715
1723
|
} else {
|
|
1716
1724
|
extra = lastArg;
|
|
@@ -1719,6 +1727,11 @@ class IssueReporter {
|
|
|
1719
1727
|
args.splice(1, 1);
|
|
1720
1728
|
}
|
|
1721
1729
|
|
|
1730
|
+
if (extra.skipSendToRemote) {
|
|
1731
|
+
skipSendToRemote = true;
|
|
1732
|
+
delete extra.skipSendToRemote;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1722
1735
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
1723
1736
|
const message = args.join(', ');
|
|
1724
1737
|
let consoleMessage = message;
|
|
@@ -1739,7 +1752,13 @@ class IssueReporter {
|
|
|
1739
1752
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
1740
1753
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
1741
1754
|
|
|
1742
|
-
this.
|
|
1755
|
+
if (this._callback) {
|
|
1756
|
+
this._callback(level, consoleMessage);
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
if (!skipSendToRemote) {
|
|
1760
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
1761
|
+
}
|
|
1743
1762
|
}
|
|
1744
1763
|
|
|
1745
1764
|
logRequest(url , options , response , start ) {
|
|
@@ -1884,7 +1903,11 @@ class IssueReporter {
|
|
|
1884
1903
|
},
|
|
1885
1904
|
// $FlowFixMe
|
|
1886
1905
|
body,
|
|
1887
|
-
}).catch(() => {
|
|
1906
|
+
}).catch((e ) => {
|
|
1907
|
+
// $FlowFixMe
|
|
1908
|
+
e.skipSendToRemote = true;
|
|
1909
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
1910
|
+
|
|
1888
1911
|
setTimeout(() => {
|
|
1889
1912
|
if (isArray) {
|
|
1890
1913
|
payload = payload.map(message => {
|
|
@@ -2643,11 +2666,24 @@ class Meeting {
|
|
|
2643
2666
|
});
|
|
2644
2667
|
}
|
|
2645
2668
|
|
|
2669
|
+
static parseMany(items ) {
|
|
2670
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2646
2673
|
static newFrom(meeting ) {
|
|
2647
2674
|
return newFrom(meeting, Meeting);
|
|
2648
2675
|
}
|
|
2649
2676
|
|
|
2650
|
-
constructor({
|
|
2677
|
+
constructor({
|
|
2678
|
+
uuid,
|
|
2679
|
+
name,
|
|
2680
|
+
guestSipAuthorization,
|
|
2681
|
+
ownerUuids,
|
|
2682
|
+
port,
|
|
2683
|
+
uri,
|
|
2684
|
+
number,
|
|
2685
|
+
persistent,
|
|
2686
|
+
} = {}) {
|
|
2651
2687
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2652
2688
|
this.uri = uri;
|
|
2653
2689
|
this.name = name;
|
|
@@ -2733,8 +2769,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2733
2769
|
}
|
|
2734
2770
|
},
|
|
2735
2771
|
|
|
2736
|
-
|
|
2737
|
-
client.
|
|
2772
|
+
getMyMeetings: () =>
|
|
2773
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2774
|
+
|
|
2775
|
+
createMyMeeting: (name , persistent ) =>
|
|
2776
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2738
2777
|
|
|
2739
2778
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2740
2779
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -6706,7 +6745,9 @@ class WebRTCClient extends Emitter {
|
|
|
6706
6745
|
const inviteOptions = {
|
|
6707
6746
|
requestDelegate: {
|
|
6708
6747
|
onAccept: (response ) => {
|
|
6709
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6748
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6749
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6750
|
+
}
|
|
6710
6751
|
this._onAccepted(session, response.session, true);
|
|
6711
6752
|
},
|
|
6712
6753
|
onReject: (response ) => {
|
|
@@ -7578,6 +7619,16 @@ class WebRTCClient extends Emitter {
|
|
|
7578
7619
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7579
7620
|
}
|
|
7580
7621
|
|
|
7622
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7623
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7624
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7625
|
+
if (!pc) {
|
|
7626
|
+
return null;
|
|
7627
|
+
}
|
|
7628
|
+
|
|
7629
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7630
|
+
}
|
|
7631
|
+
|
|
7581
7632
|
hasVideo(sessionId ) {
|
|
7582
7633
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7583
7634
|
}
|
|
@@ -8356,18 +8407,22 @@ class WebRTCClient extends Emitter {
|
|
|
8356
8407
|
});
|
|
8357
8408
|
|
|
8358
8409
|
networkStats.packetsLost = packetsLost;
|
|
8359
|
-
networkStats.
|
|
8410
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8411
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8412
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8360
8413
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8361
|
-
networkStats.
|
|
8362
|
-
networkStats.
|
|
8414
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8415
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8416
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8417
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8418
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8363
8419
|
networkStats.transportSent = transportSent;
|
|
8364
|
-
networkStats.
|
|
8420
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8421
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8365
8422
|
|
|
8366
|
-
|
|
8367
|
-
+
|
|
8368
|
-
+
|
|
8369
|
-
|
|
8370
|
-
networkStats.bandwidth = bandwidth;
|
|
8423
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8424
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8425
|
+
+ networkStats.transportSent;
|
|
8371
8426
|
|
|
8372
8427
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8373
8428
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -8778,9 +8833,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8778
8833
|
case sessionState.SessionState.Terminated: {
|
|
8779
8834
|
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8780
8835
|
|
|
8836
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8837
|
+
const callSession = this._createCallSession(sipSession);
|
|
8781
8838
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8782
8839
|
|
|
8783
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
8840
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
8784
8841
|
}
|
|
8785
8842
|
}
|
|
8786
8843
|
});
|
|
@@ -9728,6 +9785,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9728
9785
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9729
9786
|
}
|
|
9730
9787
|
|
|
9788
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
9789
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
9790
|
+
}
|
|
9791
|
+
|
|
9731
9792
|
hasRemoteVideo(callSession ) {
|
|
9732
9793
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9733
9794
|
}
|
|
@@ -10411,6 +10472,11 @@ class Phone extends Emitter {
|
|
|
10411
10472
|
return this.getRemoteVideoStream(callSession);
|
|
10412
10473
|
}
|
|
10413
10474
|
|
|
10475
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
10476
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10477
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
10478
|
+
}
|
|
10479
|
+
|
|
10414
10480
|
hasVideo(callSession ) {
|
|
10415
10481
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
10416
10482
|
}
|
|
@@ -10570,6 +10636,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10570
10636
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10571
10637
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10572
10638
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10639
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10573
10640
|
|
|
10574
10641
|
const BLACKLIST_EVENTS = [
|
|
10575
10642
|
CHAT_MESSAGE_SENT,
|
|
@@ -10920,6 +10987,7 @@ WebSocketClient.eventLists = [
|
|
|
10920
10987
|
AGENT_UNPAUSED,
|
|
10921
10988
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10922
10989
|
CONFERENCE_ADHOC_DELETED,
|
|
10990
|
+
MEETING_USER_PROGRESS,
|
|
10923
10991
|
];
|
|
10924
10992
|
|
|
10925
10993
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -10990,6 +11058,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
10990
11058
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
10991
11059
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10992
11060
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
11061
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
10993
11062
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
10994
11063
|
'default': WebSocketClient
|
|
10995
11064
|
});
|
package/lib/simple/Directory.js
CHANGED
|
@@ -136,6 +136,7 @@ class IssueReporter {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
|
|
139
|
+
|
|
139
140
|
|
|
140
141
|
constructor() {
|
|
141
142
|
addLevelsTo(this);
|
|
@@ -147,12 +148,17 @@ class IssueReporter {
|
|
|
147
148
|
this.bufferTimeout = null;
|
|
148
149
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
149
150
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
151
|
+
this._callback = null;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
init() {
|
|
153
155
|
this._catchConsole();
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
setCallback(cb ) {
|
|
159
|
+
this._callback = cb;
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
157
163
|
this.remoteClientConfiguration = configuration;
|
|
158
164
|
}
|
|
@@ -188,6 +194,7 @@ class IssueReporter {
|
|
|
188
194
|
|
|
189
195
|
// Handle category label
|
|
190
196
|
let category = null;
|
|
197
|
+
let skipSendToRemote = false;
|
|
191
198
|
let extra = {};
|
|
192
199
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
193
200
|
category = args[0].split('=')[1];
|
|
@@ -203,6 +210,7 @@ class IssueReporter {
|
|
|
203
210
|
errorMessage: lastArg.message,
|
|
204
211
|
errorStack: lastArg.stack,
|
|
205
212
|
errorType: lastArg.constructor.name,
|
|
213
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
206
214
|
};
|
|
207
215
|
} else {
|
|
208
216
|
extra = lastArg;
|
|
@@ -211,6 +219,11 @@ class IssueReporter {
|
|
|
211
219
|
args.splice(1, 1);
|
|
212
220
|
}
|
|
213
221
|
|
|
222
|
+
if (extra.skipSendToRemote) {
|
|
223
|
+
skipSendToRemote = true;
|
|
224
|
+
delete extra.skipSendToRemote;
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
215
228
|
const message = args.join(', ');
|
|
216
229
|
let consoleMessage = message;
|
|
@@ -231,7 +244,13 @@ class IssueReporter {
|
|
|
231
244
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
232
245
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
233
246
|
|
|
234
|
-
this.
|
|
247
|
+
if (this._callback) {
|
|
248
|
+
this._callback(level, consoleMessage);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!skipSendToRemote) {
|
|
252
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
253
|
+
}
|
|
235
254
|
}
|
|
236
255
|
|
|
237
256
|
logRequest(url , options , response , start ) {
|
|
@@ -376,7 +395,11 @@ class IssueReporter {
|
|
|
376
395
|
},
|
|
377
396
|
// $FlowFixMe
|
|
378
397
|
body,
|
|
379
|
-
}).catch(() => {
|
|
398
|
+
}).catch((e ) => {
|
|
399
|
+
// $FlowFixMe
|
|
400
|
+
e.skipSendToRemote = true;
|
|
401
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
402
|
+
|
|
380
403
|
setTimeout(() => {
|
|
381
404
|
if (isArray) {
|
|
382
405
|
payload = payload.map(message => {
|
|
@@ -2620,11 +2643,24 @@ class Meeting {
|
|
|
2620
2643
|
});
|
|
2621
2644
|
}
|
|
2622
2645
|
|
|
2646
|
+
static parseMany(items ) {
|
|
2647
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2623
2650
|
static newFrom(meeting ) {
|
|
2624
2651
|
return newFrom(meeting, Meeting);
|
|
2625
2652
|
}
|
|
2626
2653
|
|
|
2627
|
-
constructor({
|
|
2654
|
+
constructor({
|
|
2655
|
+
uuid,
|
|
2656
|
+
name,
|
|
2657
|
+
guestSipAuthorization,
|
|
2658
|
+
ownerUuids,
|
|
2659
|
+
port,
|
|
2660
|
+
uri,
|
|
2661
|
+
number,
|
|
2662
|
+
persistent,
|
|
2663
|
+
} = {}) {
|
|
2628
2664
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2629
2665
|
this.uri = uri;
|
|
2630
2666
|
this.name = name;
|
|
@@ -2710,8 +2746,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2710
2746
|
}
|
|
2711
2747
|
},
|
|
2712
2748
|
|
|
2713
|
-
|
|
2714
|
-
client.
|
|
2749
|
+
getMyMeetings: () =>
|
|
2750
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2751
|
+
|
|
2752
|
+
createMyMeeting: (name , persistent ) =>
|
|
2753
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2715
2754
|
|
|
2716
2755
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2717
2756
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
package/lib/simple/Phone.js
CHANGED
|
@@ -721,6 +721,7 @@ class IssueReporter {
|
|
|
721
721
|
|
|
722
722
|
|
|
723
723
|
|
|
724
|
+
|
|
724
725
|
|
|
725
726
|
constructor() {
|
|
726
727
|
addLevelsTo(this);
|
|
@@ -732,12 +733,17 @@ class IssueReporter {
|
|
|
732
733
|
this.bufferTimeout = null;
|
|
733
734
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
734
735
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
736
|
+
this._callback = null;
|
|
735
737
|
}
|
|
736
738
|
|
|
737
739
|
init() {
|
|
738
740
|
this._catchConsole();
|
|
739
741
|
}
|
|
740
742
|
|
|
743
|
+
setCallback(cb ) {
|
|
744
|
+
this._callback = cb;
|
|
745
|
+
}
|
|
746
|
+
|
|
741
747
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
742
748
|
this.remoteClientConfiguration = configuration;
|
|
743
749
|
}
|
|
@@ -773,6 +779,7 @@ class IssueReporter {
|
|
|
773
779
|
|
|
774
780
|
// Handle category label
|
|
775
781
|
let category = null;
|
|
782
|
+
let skipSendToRemote = false;
|
|
776
783
|
let extra = {};
|
|
777
784
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
778
785
|
category = args[0].split('=')[1];
|
|
@@ -788,6 +795,7 @@ class IssueReporter {
|
|
|
788
795
|
errorMessage: lastArg.message,
|
|
789
796
|
errorStack: lastArg.stack,
|
|
790
797
|
errorType: lastArg.constructor.name,
|
|
798
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
791
799
|
};
|
|
792
800
|
} else {
|
|
793
801
|
extra = lastArg;
|
|
@@ -796,6 +804,11 @@ class IssueReporter {
|
|
|
796
804
|
args.splice(1, 1);
|
|
797
805
|
}
|
|
798
806
|
|
|
807
|
+
if (extra.skipSendToRemote) {
|
|
808
|
+
skipSendToRemote = true;
|
|
809
|
+
delete extra.skipSendToRemote;
|
|
810
|
+
}
|
|
811
|
+
|
|
799
812
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
800
813
|
const message = args.join(', ');
|
|
801
814
|
let consoleMessage = message;
|
|
@@ -816,7 +829,13 @@ class IssueReporter {
|
|
|
816
829
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
817
830
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
818
831
|
|
|
819
|
-
this.
|
|
832
|
+
if (this._callback) {
|
|
833
|
+
this._callback(level, consoleMessage);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
if (!skipSendToRemote) {
|
|
837
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
838
|
+
}
|
|
820
839
|
}
|
|
821
840
|
|
|
822
841
|
logRequest(url , options , response , start ) {
|
|
@@ -961,7 +980,11 @@ class IssueReporter {
|
|
|
961
980
|
},
|
|
962
981
|
// $FlowFixMe
|
|
963
982
|
body,
|
|
964
|
-
}).catch(() => {
|
|
983
|
+
}).catch((e ) => {
|
|
984
|
+
// $FlowFixMe
|
|
985
|
+
e.skipSendToRemote = true;
|
|
986
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
987
|
+
|
|
965
988
|
setTimeout(() => {
|
|
966
989
|
if (isArray) {
|
|
967
990
|
payload = payload.map(message => {
|
|
@@ -3194,11 +3217,24 @@ class Meeting {
|
|
|
3194
3217
|
});
|
|
3195
3218
|
}
|
|
3196
3219
|
|
|
3220
|
+
static parseMany(items ) {
|
|
3221
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3197
3224
|
static newFrom(meeting ) {
|
|
3198
3225
|
return newFrom(meeting, Meeting);
|
|
3199
3226
|
}
|
|
3200
3227
|
|
|
3201
|
-
constructor({
|
|
3228
|
+
constructor({
|
|
3229
|
+
uuid,
|
|
3230
|
+
name,
|
|
3231
|
+
guestSipAuthorization,
|
|
3232
|
+
ownerUuids,
|
|
3233
|
+
port,
|
|
3234
|
+
uri,
|
|
3235
|
+
number,
|
|
3236
|
+
persistent,
|
|
3237
|
+
} = {}) {
|
|
3202
3238
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3203
3239
|
this.uri = uri;
|
|
3204
3240
|
this.name = name;
|
|
@@ -3284,8 +3320,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3284
3320
|
}
|
|
3285
3321
|
},
|
|
3286
3322
|
|
|
3287
|
-
|
|
3288
|
-
client.
|
|
3323
|
+
getMyMeetings: () =>
|
|
3324
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3325
|
+
|
|
3326
|
+
createMyMeeting: (name , persistent ) =>
|
|
3327
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3289
3328
|
|
|
3290
3329
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3291
3330
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -6706,7 +6745,9 @@ class WebRTCClient extends Emitter {
|
|
|
6706
6745
|
const inviteOptions = {
|
|
6707
6746
|
requestDelegate: {
|
|
6708
6747
|
onAccept: (response ) => {
|
|
6709
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6748
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6749
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6750
|
+
}
|
|
6710
6751
|
this._onAccepted(session, response.session, true);
|
|
6711
6752
|
},
|
|
6712
6753
|
onReject: (response ) => {
|
|
@@ -7578,6 +7619,16 @@ class WebRTCClient extends Emitter {
|
|
|
7578
7619
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7579
7620
|
}
|
|
7580
7621
|
|
|
7622
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7623
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7624
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7625
|
+
if (!pc) {
|
|
7626
|
+
return null;
|
|
7627
|
+
}
|
|
7628
|
+
|
|
7629
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7630
|
+
}
|
|
7631
|
+
|
|
7581
7632
|
hasVideo(sessionId ) {
|
|
7582
7633
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7583
7634
|
}
|
|
@@ -8356,18 +8407,22 @@ class WebRTCClient extends Emitter {
|
|
|
8356
8407
|
});
|
|
8357
8408
|
|
|
8358
8409
|
networkStats.packetsLost = packetsLost;
|
|
8359
|
-
networkStats.
|
|
8410
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8411
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8412
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8360
8413
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8361
|
-
networkStats.
|
|
8362
|
-
networkStats.
|
|
8414
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8415
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8416
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8417
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8418
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8363
8419
|
networkStats.transportSent = transportSent;
|
|
8364
|
-
networkStats.
|
|
8420
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8421
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8365
8422
|
|
|
8366
|
-
|
|
8367
|
-
+
|
|
8368
|
-
+
|
|
8369
|
-
|
|
8370
|
-
networkStats.bandwidth = bandwidth;
|
|
8423
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8424
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8425
|
+
+ networkStats.transportSent;
|
|
8371
8426
|
|
|
8372
8427
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8373
8428
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -8778,9 +8833,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8778
8833
|
case sessionState.SessionState.Terminated: {
|
|
8779
8834
|
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8780
8835
|
|
|
8836
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8837
|
+
const callSession = this._createCallSession(sipSession);
|
|
8781
8838
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8782
8839
|
|
|
8783
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
8840
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
8784
8841
|
}
|
|
8785
8842
|
}
|
|
8786
8843
|
});
|
|
@@ -9728,6 +9785,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9728
9785
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9729
9786
|
}
|
|
9730
9787
|
|
|
9788
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
9789
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
9790
|
+
}
|
|
9791
|
+
|
|
9731
9792
|
hasRemoteVideo(callSession ) {
|
|
9732
9793
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9733
9794
|
}
|
|
@@ -10429,6 +10490,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10429
10490
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10430
10491
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10431
10492
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10493
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10432
10494
|
|
|
10433
10495
|
const BLACKLIST_EVENTS = [
|
|
10434
10496
|
CHAT_MESSAGE_SENT,
|
|
@@ -10779,6 +10841,7 @@ WebSocketClient.eventLists = [
|
|
|
10779
10841
|
AGENT_UNPAUSED,
|
|
10780
10842
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10781
10843
|
CONFERENCE_ADHOC_DELETED,
|
|
10844
|
+
MEETING_USER_PROGRESS,
|
|
10782
10845
|
];
|
|
10783
10846
|
|
|
10784
10847
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -10849,6 +10912,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
10849
10912
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
10850
10913
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10851
10914
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
10915
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
10852
10916
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
10853
10917
|
'default': WebSocketClient
|
|
10854
10918
|
});
|
|
@@ -13568,6 +13632,11 @@ class Phone extends Emitter {
|
|
|
13568
13632
|
return this.getRemoteVideoStream(callSession);
|
|
13569
13633
|
}
|
|
13570
13634
|
|
|
13635
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
13636
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
13637
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
13638
|
+
}
|
|
13639
|
+
|
|
13571
13640
|
hasVideo(callSession ) {
|
|
13572
13641
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
13573
13642
|
}
|
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
|
});
|