@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/utils.js
CHANGED
|
@@ -875,6 +875,9 @@ class Contact {
|
|
|
875
875
|
}
|
|
876
876
|
|
|
877
877
|
static parseMany(response ) {
|
|
878
|
+
if (!response || !response.results) {
|
|
879
|
+
return [];
|
|
880
|
+
}
|
|
878
881
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
879
882
|
}
|
|
880
883
|
|
|
@@ -1646,6 +1649,7 @@ class IssueReporter {
|
|
|
1646
1649
|
|
|
1647
1650
|
|
|
1648
1651
|
|
|
1652
|
+
|
|
1649
1653
|
|
|
1650
1654
|
constructor() {
|
|
1651
1655
|
addLevelsTo(this);
|
|
@@ -1657,12 +1661,17 @@ class IssueReporter {
|
|
|
1657
1661
|
this.bufferTimeout = null;
|
|
1658
1662
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
1659
1663
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
1664
|
+
this._callback = null;
|
|
1660
1665
|
}
|
|
1661
1666
|
|
|
1662
1667
|
init() {
|
|
1663
1668
|
this._catchConsole();
|
|
1664
1669
|
}
|
|
1665
1670
|
|
|
1671
|
+
setCallback(cb ) {
|
|
1672
|
+
this._callback = cb;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1666
1675
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
1667
1676
|
this.remoteClientConfiguration = configuration;
|
|
1668
1677
|
}
|
|
@@ -1698,6 +1707,7 @@ class IssueReporter {
|
|
|
1698
1707
|
|
|
1699
1708
|
// Handle category label
|
|
1700
1709
|
let category = null;
|
|
1710
|
+
let skipSendToRemote = false;
|
|
1701
1711
|
let extra = {};
|
|
1702
1712
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
1703
1713
|
category = args[0].split('=')[1];
|
|
@@ -1713,6 +1723,7 @@ class IssueReporter {
|
|
|
1713
1723
|
errorMessage: lastArg.message,
|
|
1714
1724
|
errorStack: lastArg.stack,
|
|
1715
1725
|
errorType: lastArg.constructor.name,
|
|
1726
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
1716
1727
|
};
|
|
1717
1728
|
} else {
|
|
1718
1729
|
extra = lastArg;
|
|
@@ -1721,6 +1732,11 @@ class IssueReporter {
|
|
|
1721
1732
|
args.splice(1, 1);
|
|
1722
1733
|
}
|
|
1723
1734
|
|
|
1735
|
+
if (extra.skipSendToRemote) {
|
|
1736
|
+
skipSendToRemote = true;
|
|
1737
|
+
delete extra.skipSendToRemote;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1724
1740
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
1725
1741
|
const message = args.join(', ');
|
|
1726
1742
|
let consoleMessage = message;
|
|
@@ -1741,7 +1757,13 @@ class IssueReporter {
|
|
|
1741
1757
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
1742
1758
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
1743
1759
|
|
|
1744
|
-
this.
|
|
1760
|
+
if (this._callback) {
|
|
1761
|
+
this._callback(level, consoleMessage);
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
if (!skipSendToRemote) {
|
|
1765
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
1766
|
+
}
|
|
1745
1767
|
}
|
|
1746
1768
|
|
|
1747
1769
|
logRequest(url , options , response , start ) {
|
|
@@ -1886,7 +1908,11 @@ class IssueReporter {
|
|
|
1886
1908
|
},
|
|
1887
1909
|
// $FlowFixMe
|
|
1888
1910
|
body,
|
|
1889
|
-
}).catch(() => {
|
|
1911
|
+
}).catch((e ) => {
|
|
1912
|
+
// $FlowFixMe
|
|
1913
|
+
e.skipSendToRemote = true;
|
|
1914
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
1915
|
+
|
|
1890
1916
|
setTimeout(() => {
|
|
1891
1917
|
if (isArray) {
|
|
1892
1918
|
payload = payload.map(message => {
|
|
@@ -2645,11 +2671,27 @@ class Meeting {
|
|
|
2645
2671
|
});
|
|
2646
2672
|
}
|
|
2647
2673
|
|
|
2674
|
+
static parseMany(items ) {
|
|
2675
|
+
if (!items) {
|
|
2676
|
+
return [];
|
|
2677
|
+
}
|
|
2678
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2648
2681
|
static newFrom(meeting ) {
|
|
2649
2682
|
return newFrom(meeting, Meeting);
|
|
2650
2683
|
}
|
|
2651
2684
|
|
|
2652
|
-
constructor({
|
|
2685
|
+
constructor({
|
|
2686
|
+
uuid,
|
|
2687
|
+
name,
|
|
2688
|
+
guestSipAuthorization,
|
|
2689
|
+
ownerUuids,
|
|
2690
|
+
port,
|
|
2691
|
+
uri,
|
|
2692
|
+
number,
|
|
2693
|
+
persistent,
|
|
2694
|
+
} = {}) {
|
|
2653
2695
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2654
2696
|
this.uri = uri;
|
|
2655
2697
|
this.name = name;
|
|
@@ -2735,8 +2777,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2735
2777
|
}
|
|
2736
2778
|
},
|
|
2737
2779
|
|
|
2738
|
-
|
|
2739
|
-
client.
|
|
2780
|
+
getMyMeetings: () =>
|
|
2781
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2782
|
+
|
|
2783
|
+
createMyMeeting: (name , persistent ) =>
|
|
2784
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2740
2785
|
|
|
2741
2786
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2742
2787
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -2832,6 +2877,10 @@ class ChatMessage {
|
|
|
2832
2877
|
|
|
2833
2878
|
|
|
2834
2879
|
static parseMany(plain ) {
|
|
2880
|
+
if (!plain || !plain.items) {
|
|
2881
|
+
return [];
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2835
2884
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2836
2885
|
}
|
|
2837
2886
|
|
|
@@ -2941,6 +2990,9 @@ class Voicemail {
|
|
|
2941
2990
|
}
|
|
2942
2991
|
|
|
2943
2992
|
static parseMany(plain ) {
|
|
2993
|
+
if (!plain) {
|
|
2994
|
+
return [];
|
|
2995
|
+
}
|
|
2944
2996
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2945
2997
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2946
2998
|
|
|
@@ -3050,6 +3102,9 @@ class Call {
|
|
|
3050
3102
|
|
|
3051
3103
|
|
|
3052
3104
|
static parseMany(plain ) {
|
|
3105
|
+
if (!plain) {
|
|
3106
|
+
return [];
|
|
3107
|
+
}
|
|
3053
3108
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3054
3109
|
}
|
|
3055
3110
|
|
|
@@ -3593,6 +3648,9 @@ class Recording {
|
|
|
3593
3648
|
|
|
3594
3649
|
|
|
3595
3650
|
static parseMany(recordings = []) {
|
|
3651
|
+
if (!recordings) {
|
|
3652
|
+
return [];
|
|
3653
|
+
}
|
|
3596
3654
|
return recordings.map(item => Recording.parse(item));
|
|
3597
3655
|
}
|
|
3598
3656
|
|
|
@@ -3694,6 +3752,10 @@ class CallLog {
|
|
|
3694
3752
|
}
|
|
3695
3753
|
|
|
3696
3754
|
static parseMany(plain ) {
|
|
3755
|
+
if (!plain || !plain.items) {
|
|
3756
|
+
return [];
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3697
3759
|
return plain.items.map(item => CallLog.parse(item));
|
|
3698
3760
|
}
|
|
3699
3761
|
|
|
@@ -4263,6 +4325,10 @@ class CTIPhone extends Emitter {
|
|
|
4263
4325
|
return false;
|
|
4264
4326
|
}
|
|
4265
4327
|
|
|
4328
|
+
hasAVideoTrack() {
|
|
4329
|
+
return false;
|
|
4330
|
+
}
|
|
4331
|
+
|
|
4266
4332
|
getLocalStreamForCall() {
|
|
4267
4333
|
return null;
|
|
4268
4334
|
}
|
|
@@ -4656,6 +4722,9 @@ class ChatRoom {
|
|
|
4656
4722
|
|
|
4657
4723
|
|
|
4658
4724
|
static parseMany(plain ) {
|
|
4725
|
+
if (!plain || !plain.items) {
|
|
4726
|
+
return [];
|
|
4727
|
+
}
|
|
4659
4728
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4660
4729
|
}
|
|
4661
4730
|
|
|
@@ -5901,10 +5970,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5901
5970
|
candidates
|
|
5902
5971
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5903
5972
|
|
|
5904
|
-
const areCandidateValid = (candidates ) =>
|
|
5905
|
-
getSrflxOrRelay(candidates)
|
|
5906
|
-
.length > 0;
|
|
5907
|
-
|
|
5908
5973
|
const getVideoDirection = (sdp ) => {
|
|
5909
5974
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5910
5975
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5957,8 +6022,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5957
6022
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5958
6023
|
|
|
5959
6024
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5960
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5961
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5962
6025
|
|
|
5963
6026
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5964
6027
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -6148,38 +6211,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6148
6211
|
this._peerConnection = undefined;
|
|
6149
6212
|
}
|
|
6150
6213
|
|
|
6151
|
-
async _waitForValidGatheredIce() {
|
|
6152
|
-
let tries = 0;
|
|
6153
|
-
|
|
6154
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
6155
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
6156
|
-
tries,
|
|
6157
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
6158
|
-
});
|
|
6159
|
-
|
|
6160
|
-
tries++;
|
|
6161
|
-
|
|
6162
|
-
// eslint-disable-next-line no-await-in-loop
|
|
6163
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
6164
|
-
}
|
|
6165
|
-
|
|
6166
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
6167
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
6168
|
-
const error = new Error(errorMsg);
|
|
6169
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
6170
|
-
|
|
6171
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
6172
|
-
this.eventEmitter.emit('error', error);
|
|
6173
|
-
|
|
6174
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6175
|
-
}
|
|
6176
|
-
|
|
6177
|
-
// eslint-disable-next-line
|
|
6178
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6179
|
-
|
|
6180
|
-
return this.getLocalSessionDescription();
|
|
6181
|
-
}
|
|
6182
|
-
|
|
6183
6214
|
// Overridden to send `inactive` in conference
|
|
6184
6215
|
updateDirection(options , isConference = false,
|
|
6185
6216
|
audioOnly = false) {
|
|
@@ -6972,7 +7003,9 @@ class WebRTCClient extends Emitter {
|
|
|
6972
7003
|
const inviteOptions = {
|
|
6973
7004
|
requestDelegate: {
|
|
6974
7005
|
onAccept: (response ) => {
|
|
6975
|
-
session.sessionDescriptionHandler.peerConnection
|
|
7006
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
7007
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
7008
|
+
}
|
|
6976
7009
|
this._onAccepted(session, response.session, true);
|
|
6977
7010
|
},
|
|
6978
7011
|
onReject: (response ) => {
|
|
@@ -7844,6 +7877,16 @@ class WebRTCClient extends Emitter {
|
|
|
7844
7877
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7845
7878
|
}
|
|
7846
7879
|
|
|
7880
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7881
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7882
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7883
|
+
if (!pc) {
|
|
7884
|
+
return null;
|
|
7885
|
+
}
|
|
7886
|
+
|
|
7887
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7888
|
+
}
|
|
7889
|
+
|
|
7847
7890
|
hasVideo(sessionId ) {
|
|
7848
7891
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7849
7892
|
}
|
|
@@ -8354,6 +8397,7 @@ class WebRTCClient extends Emitter {
|
|
|
8354
8397
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8355
8398
|
|
|
8356
8399
|
pc.oniceconnectionstatechange = () => {
|
|
8400
|
+
logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8357
8401
|
if (pc.iceConnectionState === 'disconnected') {
|
|
8358
8402
|
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8359
8403
|
}
|
|
@@ -8582,25 +8626,25 @@ class WebRTCClient extends Emitter {
|
|
|
8582
8626
|
|
|
8583
8627
|
stats.forEach(report => {
|
|
8584
8628
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8585
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8629
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8586
8630
|
}
|
|
8587
8631
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8588
|
-
audioBytesSent += report.bytesSent;
|
|
8632
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8589
8633
|
}
|
|
8590
8634
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8591
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8635
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8592
8636
|
}
|
|
8593
8637
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8594
|
-
packetsLost += report.packetsLost;
|
|
8595
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8596
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8638
|
+
packetsLost += Number(report.packetsLost);
|
|
8639
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8640
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8597
8641
|
}
|
|
8598
8642
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8599
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8643
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8600
8644
|
}
|
|
8601
8645
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8602
8646
|
if ('framesPerSecond' in report) {
|
|
8603
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8647
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8604
8648
|
}
|
|
8605
8649
|
if ('framerateMean' in report) {
|
|
8606
8650
|
// framerateMean is only available in FF
|
|
@@ -8608,32 +8652,36 @@ class WebRTCClient extends Emitter {
|
|
|
8608
8652
|
}
|
|
8609
8653
|
}
|
|
8610
8654
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8611
|
-
packetsLost += report.packetsLost;
|
|
8612
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8613
|
-
networkStats.jitter = report.jitter;
|
|
8655
|
+
packetsLost += Number(report.packetsLost);
|
|
8656
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8657
|
+
networkStats.jitter = Number(report.jitter);
|
|
8614
8658
|
}
|
|
8615
8659
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8616
|
-
packetsLost += report.packetsLost;
|
|
8660
|
+
packetsLost += Number(report.packetsLost);
|
|
8617
8661
|
}
|
|
8618
8662
|
if (report.type === 'transport') {
|
|
8619
|
-
transportSent += report.bytesSent;
|
|
8620
|
-
transportReceived += report.bytesReceived;
|
|
8663
|
+
transportSent += Number(report.bytesSent);
|
|
8664
|
+
transportReceived += Number(report.bytesReceived);
|
|
8621
8665
|
}
|
|
8622
8666
|
});
|
|
8623
8667
|
|
|
8624
8668
|
networkStats.packetsLost = packetsLost;
|
|
8625
|
-
networkStats.
|
|
8669
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8670
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8671
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8626
8672
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8627
|
-
networkStats.
|
|
8628
|
-
networkStats.
|
|
8673
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8674
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8675
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8676
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8677
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8629
8678
|
networkStats.transportSent = transportSent;
|
|
8630
|
-
networkStats.
|
|
8679
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8680
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8631
8681
|
|
|
8632
|
-
|
|
8633
|
-
+
|
|
8634
|
-
+
|
|
8635
|
-
|
|
8636
|
-
networkStats.bandwidth = bandwidth;
|
|
8682
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8683
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8684
|
+
+ networkStats.transportSent;
|
|
8637
8685
|
|
|
8638
8686
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8639
8687
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -9015,7 +9063,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9015
9063
|
|
|
9016
9064
|
onCancel(message);
|
|
9017
9065
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
9018
|
-
|
|
9066
|
+
const callSession = this._createCallSession(sipSession);
|
|
9067
|
+
delete this.callSessions[callSession.getId()];
|
|
9068
|
+
|
|
9069
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
9019
9070
|
};
|
|
9020
9071
|
} else if (sipSession instanceof invitation.Invitation) {
|
|
9021
9072
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -9044,9 +9095,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9044
9095
|
case sessionState.SessionState.Terminated: {
|
|
9045
9096
|
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9046
9097
|
|
|
9098
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9099
|
+
const callSession = this._createCallSession(sipSession);
|
|
9047
9100
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9048
9101
|
|
|
9049
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
9102
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
9050
9103
|
}
|
|
9051
9104
|
}
|
|
9052
9105
|
});
|
|
@@ -9194,18 +9247,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9194
9247
|
screenTrack,
|
|
9195
9248
|
});
|
|
9196
9249
|
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9250
|
+
if (screenTrack) {
|
|
9251
|
+
screenTrack.onended = () => {
|
|
9252
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9253
|
+
hadVideo,
|
|
9254
|
+
id: this.getSipSessionId(sipSession),
|
|
9255
|
+
screenTrack,
|
|
9256
|
+
});
|
|
9203
9257
|
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
|
|
9258
|
+
this.eventEmitter.emit(
|
|
9259
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9260
|
+
this._createCallSession(sipSession, callSession),
|
|
9261
|
+
);
|
|
9262
|
+
};
|
|
9263
|
+
}
|
|
9209
9264
|
|
|
9210
9265
|
this.currentScreenShare = {
|
|
9211
9266
|
stream: screenStream,
|
|
@@ -9994,6 +10049,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9994
10049
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9995
10050
|
}
|
|
9996
10051
|
|
|
10052
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10053
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
10054
|
+
}
|
|
10055
|
+
|
|
9997
10056
|
hasRemoteVideo(callSession ) {
|
|
9998
10057
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9999
10058
|
}
|
|
@@ -10677,6 +10736,11 @@ class Phone extends Emitter {
|
|
|
10677
10736
|
return this.getRemoteVideoStream(callSession);
|
|
10678
10737
|
}
|
|
10679
10738
|
|
|
10739
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
10740
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10741
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
10742
|
+
}
|
|
10743
|
+
|
|
10680
10744
|
hasVideo(callSession ) {
|
|
10681
10745
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
10682
10746
|
}
|
|
@@ -10836,6 +10900,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10836
10900
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10837
10901
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10838
10902
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10903
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10839
10904
|
|
|
10840
10905
|
const BLACKLIST_EVENTS = [
|
|
10841
10906
|
CHAT_MESSAGE_SENT,
|
|
@@ -11186,6 +11251,7 @@ WebSocketClient.eventLists = [
|
|
|
11186
11251
|
AGENT_UNPAUSED,
|
|
11187
11252
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11188
11253
|
CONFERENCE_ADHOC_DELETED,
|
|
11254
|
+
MEETING_USER_PROGRESS,
|
|
11189
11255
|
];
|
|
11190
11256
|
|
|
11191
11257
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -11256,6 +11322,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11256
11322
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
11257
11323
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11258
11324
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
11325
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
11259
11326
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
11260
11327
|
'default': WebSocketClient
|
|
11261
11328
|
});
|
|
@@ -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 => {
|