@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/esm/simple/utils.js
CHANGED
|
@@ -1634,6 +1634,7 @@ class IssueReporter {
|
|
|
1634
1634
|
|
|
1635
1635
|
|
|
1636
1636
|
|
|
1637
|
+
|
|
1637
1638
|
|
|
1638
1639
|
constructor() {
|
|
1639
1640
|
addLevelsTo(this);
|
|
@@ -1645,12 +1646,17 @@ class IssueReporter {
|
|
|
1645
1646
|
this.bufferTimeout = null;
|
|
1646
1647
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
1647
1648
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
1649
|
+
this._callback = null;
|
|
1648
1650
|
}
|
|
1649
1651
|
|
|
1650
1652
|
init() {
|
|
1651
1653
|
this._catchConsole();
|
|
1652
1654
|
}
|
|
1653
1655
|
|
|
1656
|
+
setCallback(cb ) {
|
|
1657
|
+
this._callback = cb;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1654
1660
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
1655
1661
|
this.remoteClientConfiguration = configuration;
|
|
1656
1662
|
}
|
|
@@ -1686,6 +1692,7 @@ class IssueReporter {
|
|
|
1686
1692
|
|
|
1687
1693
|
// Handle category label
|
|
1688
1694
|
let category = null;
|
|
1695
|
+
let skipSendToRemote = false;
|
|
1689
1696
|
let extra = {};
|
|
1690
1697
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
1691
1698
|
category = args[0].split('=')[1];
|
|
@@ -1701,6 +1708,7 @@ class IssueReporter {
|
|
|
1701
1708
|
errorMessage: lastArg.message,
|
|
1702
1709
|
errorStack: lastArg.stack,
|
|
1703
1710
|
errorType: lastArg.constructor.name,
|
|
1711
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
1704
1712
|
};
|
|
1705
1713
|
} else {
|
|
1706
1714
|
extra = lastArg;
|
|
@@ -1709,6 +1717,11 @@ class IssueReporter {
|
|
|
1709
1717
|
args.splice(1, 1);
|
|
1710
1718
|
}
|
|
1711
1719
|
|
|
1720
|
+
if (extra.skipSendToRemote) {
|
|
1721
|
+
skipSendToRemote = true;
|
|
1722
|
+
delete extra.skipSendToRemote;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1712
1725
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
1713
1726
|
const message = args.join(', ');
|
|
1714
1727
|
let consoleMessage = message;
|
|
@@ -1729,7 +1742,13 @@ class IssueReporter {
|
|
|
1729
1742
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
1730
1743
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
1731
1744
|
|
|
1732
|
-
this.
|
|
1745
|
+
if (this._callback) {
|
|
1746
|
+
this._callback(level, consoleMessage);
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
if (!skipSendToRemote) {
|
|
1750
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
1751
|
+
}
|
|
1733
1752
|
}
|
|
1734
1753
|
|
|
1735
1754
|
logRequest(url , options , response , start ) {
|
|
@@ -1874,7 +1893,11 @@ class IssueReporter {
|
|
|
1874
1893
|
},
|
|
1875
1894
|
// $FlowFixMe
|
|
1876
1895
|
body,
|
|
1877
|
-
}).catch(() => {
|
|
1896
|
+
}).catch((e ) => {
|
|
1897
|
+
// $FlowFixMe
|
|
1898
|
+
e.skipSendToRemote = true;
|
|
1899
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
1900
|
+
|
|
1878
1901
|
setTimeout(() => {
|
|
1879
1902
|
if (isArray) {
|
|
1880
1903
|
payload = payload.map(message => {
|
|
@@ -1886,7 +1909,7 @@ class IssueReporter {
|
|
|
1886
1909
|
payload._retry = retry + 1;
|
|
1887
1910
|
}
|
|
1888
1911
|
|
|
1889
|
-
this._sendDebugToGrafana(
|
|
1912
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
1890
1913
|
}, 5000 + retry * 1000);
|
|
1891
1914
|
});
|
|
1892
1915
|
}
|
|
@@ -2604,7 +2627,8 @@ class ExternalApp {
|
|
|
2604
2627
|
|
|
2605
2628
|
|
|
2606
2629
|
|
|
2607
|
-
|
|
2630
|
+
|
|
2631
|
+
|
|
2608
2632
|
|
|
2609
2633
|
|
|
2610
2634
|
class Meeting {
|
|
@@ -2616,6 +2640,7 @@ class Meeting {
|
|
|
2616
2640
|
|
|
2617
2641
|
|
|
2618
2642
|
|
|
2643
|
+
|
|
2619
2644
|
|
|
2620
2645
|
|
|
2621
2646
|
static parse(plain ) {
|
|
@@ -2627,14 +2652,28 @@ class Meeting {
|
|
|
2627
2652
|
port: plain.port,
|
|
2628
2653
|
uuid: plain.uuid,
|
|
2629
2654
|
number: plain.number,
|
|
2655
|
+
persistent: plain.persistent,
|
|
2630
2656
|
});
|
|
2631
2657
|
}
|
|
2632
2658
|
|
|
2659
|
+
static parseMany(items ) {
|
|
2660
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2633
2663
|
static newFrom(meeting ) {
|
|
2634
2664
|
return newFrom(meeting, Meeting);
|
|
2635
2665
|
}
|
|
2636
2666
|
|
|
2637
|
-
constructor({
|
|
2667
|
+
constructor({
|
|
2668
|
+
uuid,
|
|
2669
|
+
name,
|
|
2670
|
+
guestSipAuthorization,
|
|
2671
|
+
ownerUuids,
|
|
2672
|
+
port,
|
|
2673
|
+
uri,
|
|
2674
|
+
number,
|
|
2675
|
+
persistent,
|
|
2676
|
+
} = {}) {
|
|
2638
2677
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2639
2678
|
this.uri = uri;
|
|
2640
2679
|
this.name = name;
|
|
@@ -2642,6 +2681,7 @@ class Meeting {
|
|
|
2642
2681
|
this.port = port;
|
|
2643
2682
|
this.uuid = uuid;
|
|
2644
2683
|
this.number = number;
|
|
2684
|
+
this.persistent = persistent;
|
|
2645
2685
|
|
|
2646
2686
|
// Useful to compare instead of instanceof with minified code
|
|
2647
2687
|
this.type = 'Meeting';
|
|
@@ -2719,8 +2759,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2719
2759
|
}
|
|
2720
2760
|
},
|
|
2721
2761
|
|
|
2722
|
-
|
|
2723
|
-
client.
|
|
2762
|
+
getMyMeetings: () =>
|
|
2763
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2764
|
+
|
|
2765
|
+
createMyMeeting: (name , persistent ) =>
|
|
2766
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2724
2767
|
|
|
2725
2768
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2726
2769
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3576,7 +3619,7 @@ class Recording {
|
|
|
3576
3619
|
|
|
3577
3620
|
|
|
3578
3621
|
|
|
3579
|
-
static parseMany(recordings
|
|
3622
|
+
static parseMany(recordings = []) {
|
|
3580
3623
|
return recordings.map(item => Recording.parse(item));
|
|
3581
3624
|
}
|
|
3582
3625
|
|
|
@@ -3702,7 +3745,7 @@ class CallLog {
|
|
|
3702
3745
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3703
3746
|
start: moment(plain.start).toDate(),
|
|
3704
3747
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
3705
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3748
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3706
3749
|
});
|
|
3707
3750
|
}
|
|
3708
3751
|
|
|
@@ -6547,6 +6590,7 @@ const ON_REINVITE$1 = 'reinvite';
|
|
|
6547
6590
|
const ON_ERROR = 'onError';
|
|
6548
6591
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6549
6592
|
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6593
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6550
6594
|
|
|
6551
6595
|
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6552
6596
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
@@ -6623,6 +6667,7 @@ class WebRTCClient extends Emitter {
|
|
|
6623
6667
|
|
|
6624
6668
|
|
|
6625
6669
|
|
|
6670
|
+
|
|
6626
6671
|
|
|
6627
6672
|
static isAPrivateIp(ip ) {
|
|
6628
6673
|
const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
|
|
@@ -6688,6 +6733,7 @@ class WebRTCClient extends Emitter {
|
|
|
6688
6733
|
this.ON_ERROR = ON_ERROR;
|
|
6689
6734
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6690
6735
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6736
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6691
6737
|
}
|
|
6692
6738
|
|
|
6693
6739
|
configureMedia(media ) {
|
|
@@ -6953,7 +6999,9 @@ class WebRTCClient extends Emitter {
|
|
|
6953
6999
|
const inviteOptions = {
|
|
6954
7000
|
requestDelegate: {
|
|
6955
7001
|
onAccept: (response ) => {
|
|
6956
|
-
session.sessionDescriptionHandler.peerConnection
|
|
7002
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
7003
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
7004
|
+
}
|
|
6957
7005
|
this._onAccepted(session, response.session, true);
|
|
6958
7006
|
},
|
|
6959
7007
|
onReject: (response ) => {
|
|
@@ -7289,7 +7337,7 @@ class WebRTCClient extends Emitter {
|
|
|
7289
7337
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
7290
7338
|
const transceivers = pc.getTransceivers();
|
|
7291
7339
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
7292
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
7340
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
7293
7341
|
|
|
7294
7342
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
7295
7343
|
} else {
|
|
@@ -7825,6 +7873,16 @@ class WebRTCClient extends Emitter {
|
|
|
7825
7873
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7826
7874
|
}
|
|
7827
7875
|
|
|
7876
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7877
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7878
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7879
|
+
if (!pc) {
|
|
7880
|
+
return null;
|
|
7881
|
+
}
|
|
7882
|
+
|
|
7883
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7884
|
+
}
|
|
7885
|
+
|
|
7828
7886
|
hasVideo(sessionId ) {
|
|
7829
7887
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7830
7888
|
}
|
|
@@ -8314,6 +8372,7 @@ class WebRTCClient extends Emitter {
|
|
|
8314
8372
|
|
|
8315
8373
|
this.updateRemoteStream(this.getSipSessionId(session));
|
|
8316
8374
|
|
|
8375
|
+
const pc = session.sessionDescriptionHandler.peerConnection;
|
|
8317
8376
|
const onTrack = (event ) => {
|
|
8318
8377
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8319
8378
|
const { kind, label, readyState, id, muted } = event.track;
|
|
@@ -8333,6 +8392,12 @@ class WebRTCClient extends Emitter {
|
|
|
8333
8392
|
|
|
8334
8393
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8335
8394
|
|
|
8395
|
+
pc.oniceconnectionstatechange = () => {
|
|
8396
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8397
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8398
|
+
}
|
|
8399
|
+
};
|
|
8400
|
+
|
|
8336
8401
|
if (withEvent) {
|
|
8337
8402
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
8338
8403
|
}
|
|
@@ -8552,6 +8617,7 @@ class WebRTCClient extends Emitter {
|
|
|
8552
8617
|
let videoBytesReceived = 0;
|
|
8553
8618
|
let transportSent = 0;
|
|
8554
8619
|
let transportReceived = 0;
|
|
8620
|
+
let packetsLost = 0;
|
|
8555
8621
|
|
|
8556
8622
|
stats.forEach(report => {
|
|
8557
8623
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
@@ -8564,7 +8630,7 @@ class WebRTCClient extends Emitter {
|
|
|
8564
8630
|
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8565
8631
|
}
|
|
8566
8632
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8567
|
-
|
|
8633
|
+
packetsLost += report.packetsLost;
|
|
8568
8634
|
networkStats.packetsReceived = report.packetsReceived;
|
|
8569
8635
|
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8570
8636
|
}
|
|
@@ -8581,27 +8647,36 @@ class WebRTCClient extends Emitter {
|
|
|
8581
8647
|
}
|
|
8582
8648
|
}
|
|
8583
8649
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8650
|
+
packetsLost += report.packetsLost;
|
|
8584
8651
|
networkStats.roundTripTime = report.roundTripTime;
|
|
8585
8652
|
networkStats.jitter = report.jitter;
|
|
8586
8653
|
}
|
|
8654
|
+
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8655
|
+
packetsLost += report.packetsLost;
|
|
8656
|
+
}
|
|
8587
8657
|
if (report.type === 'transport') {
|
|
8588
8658
|
transportSent += report.bytesSent;
|
|
8589
8659
|
transportReceived += report.bytesReceived;
|
|
8590
8660
|
}
|
|
8591
8661
|
});
|
|
8592
8662
|
|
|
8593
|
-
networkStats.
|
|
8663
|
+
networkStats.packetsLost = packetsLost;
|
|
8664
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8665
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8666
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8594
8667
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8595
|
-
networkStats.
|
|
8596
|
-
networkStats.
|
|
8668
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8669
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8670
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8671
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8672
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8597
8673
|
networkStats.transportSent = transportSent;
|
|
8598
|
-
networkStats.
|
|
8674
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8675
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8599
8676
|
|
|
8600
|
-
|
|
8601
|
-
+
|
|
8602
|
-
+
|
|
8603
|
-
|
|
8604
|
-
networkStats.bandwidth = bandwidth;
|
|
8677
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8678
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8679
|
+
+ networkStats.transportSent;
|
|
8605
8680
|
|
|
8606
8681
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8607
8682
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -8650,6 +8725,7 @@ const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
|
8650
8725
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8651
8726
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8652
8727
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8728
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8653
8729
|
|
|
8654
8730
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8655
8731
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -8689,6 +8765,7 @@ const events = [
|
|
|
8689
8765
|
ON_CHAT,
|
|
8690
8766
|
ON_SIGNAL,
|
|
8691
8767
|
ON_NETWORK_STATS,
|
|
8768
|
+
ON_DISCONNECTED,
|
|
8692
8769
|
];
|
|
8693
8770
|
|
|
8694
8771
|
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -9010,9 +9087,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9010
9087
|
case SessionState.Terminated: {
|
|
9011
9088
|
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9012
9089
|
|
|
9090
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9091
|
+
const callSession = this._createCallSession(sipSession);
|
|
9013
9092
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9014
9093
|
|
|
9015
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
9094
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
9016
9095
|
}
|
|
9017
9096
|
}
|
|
9018
9097
|
});
|
|
@@ -9960,6 +10039,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9960
10039
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9961
10040
|
}
|
|
9962
10041
|
|
|
10042
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10043
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
10044
|
+
}
|
|
10045
|
+
|
|
9963
10046
|
hasRemoteVideo(callSession ) {
|
|
9964
10047
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9965
10048
|
}
|
|
@@ -10041,6 +10124,11 @@ class WebRTCPhone extends Emitter {
|
|
|
10041
10124
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10042
10125
|
});
|
|
10043
10126
|
|
|
10127
|
+
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10128
|
+
logger$7.info('WebRTC disconnected');
|
|
10129
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10130
|
+
});
|
|
10131
|
+
|
|
10044
10132
|
this.client.on(this.client.REGISTERED, () => {
|
|
10045
10133
|
logger$7.info('WebRTC registered', {
|
|
10046
10134
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
@@ -10297,6 +10385,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10297
10385
|
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10298
10386
|
ON_CHAT: ON_CHAT,
|
|
10299
10387
|
ON_SIGNAL: ON_SIGNAL,
|
|
10388
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10300
10389
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10301
10390
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10302
10391
|
events: events,
|
|
@@ -10637,6 +10726,11 @@ class Phone extends Emitter {
|
|
|
10637
10726
|
return this.getRemoteVideoStream(callSession);
|
|
10638
10727
|
}
|
|
10639
10728
|
|
|
10729
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
10730
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10731
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
10732
|
+
}
|
|
10733
|
+
|
|
10640
10734
|
hasVideo(callSession ) {
|
|
10641
10735
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
10642
10736
|
}
|
|
@@ -10796,6 +10890,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10796
10890
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10797
10891
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10798
10892
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10893
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10799
10894
|
|
|
10800
10895
|
const BLACKLIST_EVENTS = [
|
|
10801
10896
|
CHAT_MESSAGE_SENT,
|
|
@@ -11146,6 +11241,7 @@ WebSocketClient.eventLists = [
|
|
|
11146
11241
|
AGENT_UNPAUSED,
|
|
11147
11242
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11148
11243
|
CONFERENCE_ADHOC_DELETED,
|
|
11244
|
+
MEETING_USER_PROGRESS,
|
|
11149
11245
|
];
|
|
11150
11246
|
|
|
11151
11247
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -11216,6 +11312,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11216
11312
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
11217
11313
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11218
11314
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
11315
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
11219
11316
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
11220
11317
|
'default': WebSocketClient
|
|
11221
11318
|
});
|
|
@@ -126,6 +126,7 @@ class IssueReporter {
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
|
|
129
130
|
|
|
130
131
|
constructor() {
|
|
131
132
|
addLevelsTo(this);
|
|
@@ -137,12 +138,17 @@ class IssueReporter {
|
|
|
137
138
|
this.bufferTimeout = null;
|
|
138
139
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
139
140
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
141
|
+
this._callback = null;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
init() {
|
|
143
145
|
this._catchConsole();
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
setCallback(cb ) {
|
|
149
|
+
this._callback = cb;
|
|
150
|
+
}
|
|
151
|
+
|
|
146
152
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
147
153
|
this.remoteClientConfiguration = configuration;
|
|
148
154
|
}
|
|
@@ -178,6 +184,7 @@ class IssueReporter {
|
|
|
178
184
|
|
|
179
185
|
// Handle category label
|
|
180
186
|
let category = null;
|
|
187
|
+
let skipSendToRemote = false;
|
|
181
188
|
let extra = {};
|
|
182
189
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
183
190
|
category = args[0].split('=')[1];
|
|
@@ -193,6 +200,7 @@ class IssueReporter {
|
|
|
193
200
|
errorMessage: lastArg.message,
|
|
194
201
|
errorStack: lastArg.stack,
|
|
195
202
|
errorType: lastArg.constructor.name,
|
|
203
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
196
204
|
};
|
|
197
205
|
} else {
|
|
198
206
|
extra = lastArg;
|
|
@@ -201,6 +209,11 @@ class IssueReporter {
|
|
|
201
209
|
args.splice(1, 1);
|
|
202
210
|
}
|
|
203
211
|
|
|
212
|
+
if (extra.skipSendToRemote) {
|
|
213
|
+
skipSendToRemote = true;
|
|
214
|
+
delete extra.skipSendToRemote;
|
|
215
|
+
}
|
|
216
|
+
|
|
204
217
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
205
218
|
const message = args.join(', ');
|
|
206
219
|
let consoleMessage = message;
|
|
@@ -221,7 +234,13 @@ class IssueReporter {
|
|
|
221
234
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
222
235
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
223
236
|
|
|
224
|
-
this.
|
|
237
|
+
if (this._callback) {
|
|
238
|
+
this._callback(level, consoleMessage);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!skipSendToRemote) {
|
|
242
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
243
|
+
}
|
|
225
244
|
}
|
|
226
245
|
|
|
227
246
|
logRequest(url , options , response , start ) {
|
|
@@ -366,7 +385,11 @@ class IssueReporter {
|
|
|
366
385
|
},
|
|
367
386
|
// $FlowFixMe
|
|
368
387
|
body,
|
|
369
|
-
}).catch(() => {
|
|
388
|
+
}).catch((e ) => {
|
|
389
|
+
// $FlowFixMe
|
|
390
|
+
e.skipSendToRemote = true;
|
|
391
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
392
|
+
|
|
370
393
|
setTimeout(() => {
|
|
371
394
|
if (isArray) {
|
|
372
395
|
payload = payload.map(message => {
|
|
@@ -378,7 +401,7 @@ class IssueReporter {
|
|
|
378
401
|
payload._retry = retry + 1;
|
|
379
402
|
}
|
|
380
403
|
|
|
381
|
-
this._sendDebugToGrafana(
|
|
404
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
382
405
|
}, 5000 + retry * 1000);
|
|
383
406
|
});
|
|
384
407
|
}
|
|
@@ -126,6 +126,7 @@ class IssueReporter {
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
|
|
129
130
|
|
|
130
131
|
constructor() {
|
|
131
132
|
addLevelsTo(this);
|
|
@@ -137,12 +138,17 @@ class IssueReporter {
|
|
|
137
138
|
this.bufferTimeout = null;
|
|
138
139
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
139
140
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
141
|
+
this._callback = null;
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
init() {
|
|
143
145
|
this._catchConsole();
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
setCallback(cb ) {
|
|
149
|
+
this._callback = cb;
|
|
150
|
+
}
|
|
151
|
+
|
|
146
152
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
147
153
|
this.remoteClientConfiguration = configuration;
|
|
148
154
|
}
|
|
@@ -178,6 +184,7 @@ class IssueReporter {
|
|
|
178
184
|
|
|
179
185
|
// Handle category label
|
|
180
186
|
let category = null;
|
|
187
|
+
let skipSendToRemote = false;
|
|
181
188
|
let extra = {};
|
|
182
189
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
183
190
|
category = args[0].split('=')[1];
|
|
@@ -193,6 +200,7 @@ class IssueReporter {
|
|
|
193
200
|
errorMessage: lastArg.message,
|
|
194
201
|
errorStack: lastArg.stack,
|
|
195
202
|
errorType: lastArg.constructor.name,
|
|
203
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
196
204
|
};
|
|
197
205
|
} else {
|
|
198
206
|
extra = lastArg;
|
|
@@ -201,6 +209,11 @@ class IssueReporter {
|
|
|
201
209
|
args.splice(1, 1);
|
|
202
210
|
}
|
|
203
211
|
|
|
212
|
+
if (extra.skipSendToRemote) {
|
|
213
|
+
skipSendToRemote = true;
|
|
214
|
+
delete extra.skipSendToRemote;
|
|
215
|
+
}
|
|
216
|
+
|
|
204
217
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
205
218
|
const message = args.join(', ');
|
|
206
219
|
let consoleMessage = message;
|
|
@@ -221,7 +234,13 @@ class IssueReporter {
|
|
|
221
234
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
222
235
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
223
236
|
|
|
224
|
-
this.
|
|
237
|
+
if (this._callback) {
|
|
238
|
+
this._callback(level, consoleMessage);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!skipSendToRemote) {
|
|
242
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
243
|
+
}
|
|
225
244
|
}
|
|
226
245
|
|
|
227
246
|
logRequest(url , options , response , start ) {
|
|
@@ -366,7 +385,11 @@ class IssueReporter {
|
|
|
366
385
|
},
|
|
367
386
|
// $FlowFixMe
|
|
368
387
|
body,
|
|
369
|
-
}).catch(() => {
|
|
388
|
+
}).catch((e ) => {
|
|
389
|
+
// $FlowFixMe
|
|
390
|
+
e.skipSendToRemote = true;
|
|
391
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
392
|
+
|
|
370
393
|
setTimeout(() => {
|
|
371
394
|
if (isArray) {
|
|
372
395
|
payload = payload.map(message => {
|
|
@@ -378,7 +401,7 @@ class IssueReporter {
|
|
|
378
401
|
payload._retry = retry + 1;
|
|
379
402
|
}
|
|
380
403
|
|
|
381
|
-
this._sendDebugToGrafana(
|
|
404
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
382
405
|
}, 5000 + retry * 1000);
|
|
383
406
|
});
|
|
384
407
|
}
|