@wazo/sdk 0.37.17 → 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 +3 -3
- package/esm/__tests__/api-client.test.js +52 -9
- package/esm/__tests__/web-rtc-client.test.js +96 -21
- package/esm/api/agentd.js +26 -3
- package/esm/api/amid.js +26 -3
- package/esm/api/application.js +26 -3
- package/esm/api/auth.js +26 -3
- package/esm/api/call-logd.js +28 -5
- package/esm/api/calld.js +26 -3
- package/esm/api/chatd.js +26 -3
- package/esm/api/confd.js +50 -7
- package/esm/api/ctid-ng.js +26 -3
- package/esm/api/dird.js +26 -3
- package/esm/api/webhookd.js +26 -3
- package/esm/api-client.js +52 -9
- package/esm/checker/Checker.js +98 -21
- package/esm/checker/checks/aor.js +52 -9
- package/esm/checker/checks/api.js +52 -9
- package/esm/checker/checks/index.js +98 -21
- package/esm/checker/checks/wazo-websocket.js +28 -3
- package/esm/checker/checks/webrtc-transport.js +96 -21
- package/esm/checker/checks/webrtc.js +96 -21
- package/esm/domain/AdHocAPIConference.js +52 -9
- package/esm/domain/CallLog.js +2 -2
- package/esm/domain/Features.js +52 -9
- package/esm/domain/Meeting.js +19 -2
- package/esm/domain/Phone/CTIPhone.js +52 -9
- package/esm/domain/Phone/WebRTCPhone.js +41 -5
- package/esm/domain/Recording.js +1 -1
- package/esm/domain/__tests__/CallLog.test.js +2 -2
- package/esm/index.js +119 -22
- package/esm/lib/WazoSessionDescriptionHandler.js +26 -3
- package/esm/service/CallApi.js +52 -9
- package/esm/service/IssueReporter.js +26 -3
- package/esm/service/__tests__/IssueReporter.test.js +26 -3
- package/esm/service/getApiClient.js +52 -9
- package/esm/simple/Auth.js +119 -22
- package/esm/simple/Configuration.js +119 -22
- package/esm/simple/Directory.js +52 -9
- package/esm/simple/Phone.js +119 -22
- package/esm/simple/Websocket.js +29 -3
- package/esm/simple/index.js +119 -22
- package/esm/simple/room/LocalParticipant.js +119 -22
- package/esm/simple/room/Participant.js +119 -22
- package/esm/simple/room/RemoteParticipant.js +119 -22
- package/esm/simple/room/Room.js +119 -22
- package/esm/simple/room/SipRoom.js +119 -22
- package/esm/simple/room/Stream.js +119 -22
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +119 -22
- package/esm/simple/utils.js +119 -22
- package/esm/utils/__tests__/api-requester.test.js +26 -3
- package/esm/utils/api-requester.js +26 -3
- package/esm/web-rtc-client.js +96 -21
- package/esm/websocket-client.js +29 -4
- package/lib/__tests__/api-client.test.js +52 -9
- package/lib/__tests__/web-rtc-client.test.js +96 -21
- package/lib/api/agentd.js +26 -3
- package/lib/api/amid.js +26 -3
- package/lib/api/application.js +26 -3
- package/lib/api/auth.js +26 -3
- package/lib/api/call-logd.js +28 -5
- package/lib/api/calld.js +26 -3
- package/lib/api/chatd.js +26 -3
- package/lib/api/confd.js +50 -7
- package/lib/api/ctid-ng.js +26 -3
- package/lib/api/dird.js +26 -3
- package/lib/api/webhookd.js +26 -3
- package/lib/api-client.js +52 -9
- package/lib/checker/Checker.js +98 -21
- package/lib/checker/checks/aor.js +52 -9
- package/lib/checker/checks/api.js +52 -9
- package/lib/checker/checks/index.js +98 -21
- package/lib/checker/checks/wazo-websocket.js +28 -3
- package/lib/checker/checks/webrtc-transport.js +96 -21
- package/lib/checker/checks/webrtc.js +96 -21
- package/lib/domain/AdHocAPIConference.js +52 -9
- package/lib/domain/CallLog.js +2 -2
- package/lib/domain/Features.js +52 -9
- package/lib/domain/Meeting.js +19 -2
- package/lib/domain/Phone/CTIPhone.js +52 -9
- package/lib/domain/Phone/WebRTCPhone.js +41 -4
- package/lib/domain/Recording.js +1 -1
- package/lib/domain/__tests__/CallLog.test.js +2 -2
- package/lib/index.js +119 -22
- package/lib/lib/WazoSessionDescriptionHandler.js +26 -3
- package/lib/service/CallApi.js +52 -9
- package/lib/service/IssueReporter.js +26 -3
- package/lib/service/__tests__/IssueReporter.test.js +26 -3
- package/lib/service/getApiClient.js +52 -9
- package/lib/simple/Auth.js +119 -22
- package/lib/simple/Configuration.js +119 -22
- package/lib/simple/Directory.js +52 -9
- package/lib/simple/Phone.js +119 -22
- package/lib/simple/Websocket.js +29 -3
- package/lib/simple/index.js +119 -22
- package/lib/simple/room/LocalParticipant.js +119 -22
- package/lib/simple/room/Participant.js +119 -22
- package/lib/simple/room/RemoteParticipant.js +119 -22
- package/lib/simple/room/Room.js +119 -22
- package/lib/simple/room/SipRoom.js +119 -22
- package/lib/simple/room/Stream.js +119 -22
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +119 -22
- package/lib/simple/utils.js +119 -22
- package/lib/utils/__tests__/api-requester.test.js +26 -3
- package/lib/utils/api-requester.js +26 -3
- package/lib/web-rtc-client.js +96 -21
- package/lib/websocket-client.js +29 -3
- package/package.json +2 -2
- package/src/api/confd.js +5 -2
- package/src/domain/CallLog.js +1 -1
- package/src/domain/Meeting.js +19 -2
- package/src/domain/Phone/WebRTCPhone.js +14 -1
- package/src/domain/Recording.js +1 -1
- package/src/service/IssueReporter.js +26 -3
- package/src/simple/Phone.js +5 -0
- package/src/types/WebSocketMessage.js +5 -1
- package/src/web-rtc-client.js +44 -12
- 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 => {
|
|
@@ -1898,7 +1921,7 @@ class IssueReporter {
|
|
|
1898
1921
|
payload._retry = retry + 1;
|
|
1899
1922
|
}
|
|
1900
1923
|
|
|
1901
|
-
this._sendDebugToGrafana(
|
|
1924
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
1902
1925
|
}, 5000 + retry * 1000);
|
|
1903
1926
|
});
|
|
1904
1927
|
}
|
|
@@ -2616,7 +2639,8 @@ class ExternalApp {
|
|
|
2616
2639
|
|
|
2617
2640
|
|
|
2618
2641
|
|
|
2619
|
-
|
|
2642
|
+
|
|
2643
|
+
|
|
2620
2644
|
|
|
2621
2645
|
|
|
2622
2646
|
class Meeting {
|
|
@@ -2628,6 +2652,7 @@ class Meeting {
|
|
|
2628
2652
|
|
|
2629
2653
|
|
|
2630
2654
|
|
|
2655
|
+
|
|
2631
2656
|
|
|
2632
2657
|
|
|
2633
2658
|
static parse(plain ) {
|
|
@@ -2639,14 +2664,28 @@ class Meeting {
|
|
|
2639
2664
|
port: plain.port,
|
|
2640
2665
|
uuid: plain.uuid,
|
|
2641
2666
|
number: plain.number,
|
|
2667
|
+
persistent: plain.persistent,
|
|
2642
2668
|
});
|
|
2643
2669
|
}
|
|
2644
2670
|
|
|
2671
|
+
static parseMany(items ) {
|
|
2672
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2645
2675
|
static newFrom(meeting ) {
|
|
2646
2676
|
return newFrom(meeting, Meeting);
|
|
2647
2677
|
}
|
|
2648
2678
|
|
|
2649
|
-
constructor({
|
|
2679
|
+
constructor({
|
|
2680
|
+
uuid,
|
|
2681
|
+
name,
|
|
2682
|
+
guestSipAuthorization,
|
|
2683
|
+
ownerUuids,
|
|
2684
|
+
port,
|
|
2685
|
+
uri,
|
|
2686
|
+
number,
|
|
2687
|
+
persistent,
|
|
2688
|
+
} = {}) {
|
|
2650
2689
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2651
2690
|
this.uri = uri;
|
|
2652
2691
|
this.name = name;
|
|
@@ -2654,6 +2693,7 @@ class Meeting {
|
|
|
2654
2693
|
this.port = port;
|
|
2655
2694
|
this.uuid = uuid;
|
|
2656
2695
|
this.number = number;
|
|
2696
|
+
this.persistent = persistent;
|
|
2657
2697
|
|
|
2658
2698
|
// Useful to compare instead of instanceof with minified code
|
|
2659
2699
|
this.type = 'Meeting';
|
|
@@ -2731,8 +2771,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2731
2771
|
}
|
|
2732
2772
|
},
|
|
2733
2773
|
|
|
2734
|
-
|
|
2735
|
-
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),
|
|
2736
2779
|
|
|
2737
2780
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2738
2781
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3588,7 +3631,7 @@ class Recording {
|
|
|
3588
3631
|
|
|
3589
3632
|
|
|
3590
3633
|
|
|
3591
|
-
static parseMany(recordings
|
|
3634
|
+
static parseMany(recordings = []) {
|
|
3592
3635
|
return recordings.map(item => Recording.parse(item));
|
|
3593
3636
|
}
|
|
3594
3637
|
|
|
@@ -3714,7 +3757,7 @@ class CallLog {
|
|
|
3714
3757
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3715
3758
|
start: moment__default['default'](plain.start).toDate(),
|
|
3716
3759
|
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3717
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3760
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3718
3761
|
});
|
|
3719
3762
|
}
|
|
3720
3763
|
|
|
@@ -6559,6 +6602,7 @@ const ON_REINVITE$1 = 'reinvite';
|
|
|
6559
6602
|
const ON_ERROR = 'onError';
|
|
6560
6603
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6561
6604
|
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6605
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6562
6606
|
|
|
6563
6607
|
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6564
6608
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
@@ -6635,6 +6679,7 @@ class WebRTCClient extends Emitter {
|
|
|
6635
6679
|
|
|
6636
6680
|
|
|
6637
6681
|
|
|
6682
|
+
|
|
6638
6683
|
|
|
6639
6684
|
static isAPrivateIp(ip ) {
|
|
6640
6685
|
const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
|
|
@@ -6700,6 +6745,7 @@ class WebRTCClient extends Emitter {
|
|
|
6700
6745
|
this.ON_ERROR = ON_ERROR;
|
|
6701
6746
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6702
6747
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6748
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6703
6749
|
}
|
|
6704
6750
|
|
|
6705
6751
|
configureMedia(media ) {
|
|
@@ -6965,7 +7011,9 @@ class WebRTCClient extends Emitter {
|
|
|
6965
7011
|
const inviteOptions = {
|
|
6966
7012
|
requestDelegate: {
|
|
6967
7013
|
onAccept: (response ) => {
|
|
6968
|
-
session.sessionDescriptionHandler.peerConnection
|
|
7014
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
7015
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
7016
|
+
}
|
|
6969
7017
|
this._onAccepted(session, response.session, true);
|
|
6970
7018
|
},
|
|
6971
7019
|
onReject: (response ) => {
|
|
@@ -7301,7 +7349,7 @@ class WebRTCClient extends Emitter {
|
|
|
7301
7349
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
7302
7350
|
const transceivers = pc.getTransceivers();
|
|
7303
7351
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
7304
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
7352
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
7305
7353
|
|
|
7306
7354
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
7307
7355
|
} else {
|
|
@@ -7837,6 +7885,16 @@ class WebRTCClient extends Emitter {
|
|
|
7837
7885
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7838
7886
|
}
|
|
7839
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
|
+
|
|
7840
7898
|
hasVideo(sessionId ) {
|
|
7841
7899
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7842
7900
|
}
|
|
@@ -8326,6 +8384,7 @@ class WebRTCClient extends Emitter {
|
|
|
8326
8384
|
|
|
8327
8385
|
this.updateRemoteStream(this.getSipSessionId(session));
|
|
8328
8386
|
|
|
8387
|
+
const pc = session.sessionDescriptionHandler.peerConnection;
|
|
8329
8388
|
const onTrack = (event ) => {
|
|
8330
8389
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8331
8390
|
const { kind, label, readyState, id, muted } = event.track;
|
|
@@ -8345,6 +8404,12 @@ class WebRTCClient extends Emitter {
|
|
|
8345
8404
|
|
|
8346
8405
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8347
8406
|
|
|
8407
|
+
pc.oniceconnectionstatechange = () => {
|
|
8408
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8409
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8410
|
+
}
|
|
8411
|
+
};
|
|
8412
|
+
|
|
8348
8413
|
if (withEvent) {
|
|
8349
8414
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
8350
8415
|
}
|
|
@@ -8564,6 +8629,7 @@ class WebRTCClient extends Emitter {
|
|
|
8564
8629
|
let videoBytesReceived = 0;
|
|
8565
8630
|
let transportSent = 0;
|
|
8566
8631
|
let transportReceived = 0;
|
|
8632
|
+
let packetsLost = 0;
|
|
8567
8633
|
|
|
8568
8634
|
stats.forEach(report => {
|
|
8569
8635
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
@@ -8576,7 +8642,7 @@ class WebRTCClient extends Emitter {
|
|
|
8576
8642
|
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8577
8643
|
}
|
|
8578
8644
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8579
|
-
|
|
8645
|
+
packetsLost += report.packetsLost;
|
|
8580
8646
|
networkStats.packetsReceived = report.packetsReceived;
|
|
8581
8647
|
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8582
8648
|
}
|
|
@@ -8593,27 +8659,36 @@ class WebRTCClient extends Emitter {
|
|
|
8593
8659
|
}
|
|
8594
8660
|
}
|
|
8595
8661
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8662
|
+
packetsLost += report.packetsLost;
|
|
8596
8663
|
networkStats.roundTripTime = report.roundTripTime;
|
|
8597
8664
|
networkStats.jitter = report.jitter;
|
|
8598
8665
|
}
|
|
8666
|
+
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8667
|
+
packetsLost += report.packetsLost;
|
|
8668
|
+
}
|
|
8599
8669
|
if (report.type === 'transport') {
|
|
8600
8670
|
transportSent += report.bytesSent;
|
|
8601
8671
|
transportReceived += report.bytesReceived;
|
|
8602
8672
|
}
|
|
8603
8673
|
});
|
|
8604
8674
|
|
|
8605
|
-
networkStats.
|
|
8675
|
+
networkStats.packetsLost = packetsLost;
|
|
8676
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8677
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8678
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8606
8679
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8607
|
-
networkStats.
|
|
8608
|
-
networkStats.
|
|
8680
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8681
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8682
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8683
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8684
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8609
8685
|
networkStats.transportSent = transportSent;
|
|
8610
|
-
networkStats.
|
|
8686
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8687
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8611
8688
|
|
|
8612
|
-
|
|
8613
|
-
+
|
|
8614
|
-
+
|
|
8615
|
-
|
|
8616
|
-
networkStats.bandwidth = bandwidth;
|
|
8689
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8690
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8691
|
+
+ networkStats.transportSent;
|
|
8617
8692
|
|
|
8618
8693
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8619
8694
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -8662,6 +8737,7 @@ const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
|
8662
8737
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8663
8738
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8664
8739
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8740
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8665
8741
|
|
|
8666
8742
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8667
8743
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -8701,6 +8777,7 @@ const events = [
|
|
|
8701
8777
|
ON_CHAT,
|
|
8702
8778
|
ON_SIGNAL,
|
|
8703
8779
|
ON_NETWORK_STATS,
|
|
8780
|
+
ON_DISCONNECTED,
|
|
8704
8781
|
];
|
|
8705
8782
|
|
|
8706
8783
|
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -9022,9 +9099,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9022
9099
|
case sessionState.SessionState.Terminated: {
|
|
9023
9100
|
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9024
9101
|
|
|
9102
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9103
|
+
const callSession = this._createCallSession(sipSession);
|
|
9025
9104
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9026
9105
|
|
|
9027
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
9106
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
9028
9107
|
}
|
|
9029
9108
|
}
|
|
9030
9109
|
});
|
|
@@ -9972,6 +10051,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9972
10051
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9973
10052
|
}
|
|
9974
10053
|
|
|
10054
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10055
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
10056
|
+
}
|
|
10057
|
+
|
|
9975
10058
|
hasRemoteVideo(callSession ) {
|
|
9976
10059
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9977
10060
|
}
|
|
@@ -10053,6 +10136,11 @@ class WebRTCPhone extends Emitter {
|
|
|
10053
10136
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10054
10137
|
});
|
|
10055
10138
|
|
|
10139
|
+
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10140
|
+
logger$7.info('WebRTC disconnected');
|
|
10141
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10142
|
+
});
|
|
10143
|
+
|
|
10056
10144
|
this.client.on(this.client.REGISTERED, () => {
|
|
10057
10145
|
logger$7.info('WebRTC registered', {
|
|
10058
10146
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
@@ -10309,6 +10397,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10309
10397
|
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10310
10398
|
ON_CHAT: ON_CHAT,
|
|
10311
10399
|
ON_SIGNAL: ON_SIGNAL,
|
|
10400
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10312
10401
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10313
10402
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10314
10403
|
events: events,
|
|
@@ -10649,6 +10738,11 @@ class Phone extends Emitter {
|
|
|
10649
10738
|
return this.getRemoteVideoStream(callSession);
|
|
10650
10739
|
}
|
|
10651
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
|
+
|
|
10652
10746
|
hasVideo(callSession ) {
|
|
10653
10747
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
10654
10748
|
}
|
|
@@ -10808,6 +10902,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10808
10902
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10809
10903
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10810
10904
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10905
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10811
10906
|
|
|
10812
10907
|
const BLACKLIST_EVENTS = [
|
|
10813
10908
|
CHAT_MESSAGE_SENT,
|
|
@@ -11158,6 +11253,7 @@ WebSocketClient.eventLists = [
|
|
|
11158
11253
|
AGENT_UNPAUSED,
|
|
11159
11254
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11160
11255
|
CONFERENCE_ADHOC_DELETED,
|
|
11256
|
+
MEETING_USER_PROGRESS,
|
|
11161
11257
|
];
|
|
11162
11258
|
|
|
11163
11259
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -11228,6 +11324,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11228
11324
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
11229
11325
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11230
11326
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
11327
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
11231
11328
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
11232
11329
|
'default': WebSocketClient
|
|
11233
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 => {
|
|
@@ -384,7 +407,7 @@ class IssueReporter {
|
|
|
384
407
|
payload._retry = retry + 1;
|
|
385
408
|
}
|
|
386
409
|
|
|
387
|
-
this._sendDebugToGrafana(
|
|
410
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
388
411
|
}, 5000 + retry * 1000);
|
|
389
412
|
});
|
|
390
413
|
}
|
|
@@ -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 => {
|
|
@@ -386,7 +409,7 @@ class IssueReporter {
|
|
|
386
409
|
payload._retry = retry + 1;
|
|
387
410
|
}
|
|
388
411
|
|
|
389
|
-
this._sendDebugToGrafana(
|
|
412
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
390
413
|
}, 5000 + retry * 1000);
|
|
391
414
|
});
|
|
392
415
|
}
|