@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
|
@@ -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
|
|
|
@@ -6283,6 +6326,7 @@ const ON_REINVITE$1 = 'reinvite';
|
|
|
6283
6326
|
const ON_ERROR = 'onError';
|
|
6284
6327
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6285
6328
|
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6329
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6286
6330
|
|
|
6287
6331
|
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6288
6332
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
@@ -6359,6 +6403,7 @@ class WebRTCClient extends Emitter {
|
|
|
6359
6403
|
|
|
6360
6404
|
|
|
6361
6405
|
|
|
6406
|
+
|
|
6362
6407
|
|
|
6363
6408
|
static isAPrivateIp(ip ) {
|
|
6364
6409
|
const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
|
|
@@ -6424,6 +6469,7 @@ class WebRTCClient extends Emitter {
|
|
|
6424
6469
|
this.ON_ERROR = ON_ERROR;
|
|
6425
6470
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6426
6471
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6472
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6427
6473
|
}
|
|
6428
6474
|
|
|
6429
6475
|
configureMedia(media ) {
|
|
@@ -6689,7 +6735,9 @@ class WebRTCClient extends Emitter {
|
|
|
6689
6735
|
const inviteOptions = {
|
|
6690
6736
|
requestDelegate: {
|
|
6691
6737
|
onAccept: (response ) => {
|
|
6692
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6738
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6739
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6740
|
+
}
|
|
6693
6741
|
this._onAccepted(session, response.session, true);
|
|
6694
6742
|
},
|
|
6695
6743
|
onReject: (response ) => {
|
|
@@ -7025,7 +7073,7 @@ class WebRTCClient extends Emitter {
|
|
|
7025
7073
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
7026
7074
|
const transceivers = pc.getTransceivers();
|
|
7027
7075
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
7028
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
7076
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
7029
7077
|
|
|
7030
7078
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
7031
7079
|
} else {
|
|
@@ -7561,6 +7609,16 @@ class WebRTCClient extends Emitter {
|
|
|
7561
7609
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7562
7610
|
}
|
|
7563
7611
|
|
|
7612
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7613
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7614
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7615
|
+
if (!pc) {
|
|
7616
|
+
return null;
|
|
7617
|
+
}
|
|
7618
|
+
|
|
7619
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7620
|
+
}
|
|
7621
|
+
|
|
7564
7622
|
hasVideo(sessionId ) {
|
|
7565
7623
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7566
7624
|
}
|
|
@@ -8050,6 +8108,7 @@ class WebRTCClient extends Emitter {
|
|
|
8050
8108
|
|
|
8051
8109
|
this.updateRemoteStream(this.getSipSessionId(session));
|
|
8052
8110
|
|
|
8111
|
+
const pc = session.sessionDescriptionHandler.peerConnection;
|
|
8053
8112
|
const onTrack = (event ) => {
|
|
8054
8113
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8055
8114
|
const { kind, label, readyState, id, muted } = event.track;
|
|
@@ -8069,6 +8128,12 @@ class WebRTCClient extends Emitter {
|
|
|
8069
8128
|
|
|
8070
8129
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8071
8130
|
|
|
8131
|
+
pc.oniceconnectionstatechange = () => {
|
|
8132
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8133
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8134
|
+
}
|
|
8135
|
+
};
|
|
8136
|
+
|
|
8072
8137
|
if (withEvent) {
|
|
8073
8138
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
8074
8139
|
}
|
|
@@ -8288,6 +8353,7 @@ class WebRTCClient extends Emitter {
|
|
|
8288
8353
|
let videoBytesReceived = 0;
|
|
8289
8354
|
let transportSent = 0;
|
|
8290
8355
|
let transportReceived = 0;
|
|
8356
|
+
let packetsLost = 0;
|
|
8291
8357
|
|
|
8292
8358
|
stats.forEach(report => {
|
|
8293
8359
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
@@ -8300,7 +8366,7 @@ class WebRTCClient extends Emitter {
|
|
|
8300
8366
|
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8301
8367
|
}
|
|
8302
8368
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8303
|
-
|
|
8369
|
+
packetsLost += report.packetsLost;
|
|
8304
8370
|
networkStats.packetsReceived = report.packetsReceived;
|
|
8305
8371
|
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8306
8372
|
}
|
|
@@ -8317,27 +8383,36 @@ class WebRTCClient extends Emitter {
|
|
|
8317
8383
|
}
|
|
8318
8384
|
}
|
|
8319
8385
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8386
|
+
packetsLost += report.packetsLost;
|
|
8320
8387
|
networkStats.roundTripTime = report.roundTripTime;
|
|
8321
8388
|
networkStats.jitter = report.jitter;
|
|
8322
8389
|
}
|
|
8390
|
+
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8391
|
+
packetsLost += report.packetsLost;
|
|
8392
|
+
}
|
|
8323
8393
|
if (report.type === 'transport') {
|
|
8324
8394
|
transportSent += report.bytesSent;
|
|
8325
8395
|
transportReceived += report.bytesReceived;
|
|
8326
8396
|
}
|
|
8327
8397
|
});
|
|
8328
8398
|
|
|
8329
|
-
networkStats.
|
|
8399
|
+
networkStats.packetsLost = packetsLost;
|
|
8400
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8401
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8402
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8330
8403
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8331
|
-
networkStats.
|
|
8332
|
-
networkStats.
|
|
8404
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8405
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8406
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8407
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8408
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8333
8409
|
networkStats.transportSent = transportSent;
|
|
8334
|
-
networkStats.
|
|
8410
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8411
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8335
8412
|
|
|
8336
|
-
|
|
8337
|
-
+
|
|
8338
|
-
+
|
|
8339
|
-
|
|
8340
|
-
networkStats.bandwidth = bandwidth;
|
|
8413
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8414
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8415
|
+
+ networkStats.transportSent;
|
|
8341
8416
|
|
|
8342
8417
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8343
8418
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -8386,6 +8461,7 @@ const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
|
8386
8461
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8387
8462
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8388
8463
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8464
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8389
8465
|
|
|
8390
8466
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8391
8467
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -8425,6 +8501,7 @@ const events = [
|
|
|
8425
8501
|
ON_CHAT,
|
|
8426
8502
|
ON_SIGNAL,
|
|
8427
8503
|
ON_NETWORK_STATS,
|
|
8504
|
+
ON_DISCONNECTED,
|
|
8428
8505
|
];
|
|
8429
8506
|
|
|
8430
8507
|
const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -8746,9 +8823,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8746
8823
|
case SessionState.Terminated: {
|
|
8747
8824
|
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8748
8825
|
|
|
8826
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8827
|
+
const callSession = this._createCallSession(sipSession);
|
|
8749
8828
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8750
8829
|
|
|
8751
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
8830
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
8752
8831
|
}
|
|
8753
8832
|
}
|
|
8754
8833
|
});
|
|
@@ -9696,6 +9775,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9696
9775
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9697
9776
|
}
|
|
9698
9777
|
|
|
9778
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
9779
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
9780
|
+
}
|
|
9781
|
+
|
|
9699
9782
|
hasRemoteVideo(callSession ) {
|
|
9700
9783
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9701
9784
|
}
|
|
@@ -9777,6 +9860,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9777
9860
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9778
9861
|
});
|
|
9779
9862
|
|
|
9863
|
+
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
9864
|
+
logger$8.info('WebRTC disconnected');
|
|
9865
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
9866
|
+
});
|
|
9867
|
+
|
|
9780
9868
|
this.client.on(this.client.REGISTERED, () => {
|
|
9781
9869
|
logger$8.info('WebRTC registered', {
|
|
9782
9870
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
@@ -10033,6 +10121,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10033
10121
|
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10034
10122
|
ON_CHAT: ON_CHAT,
|
|
10035
10123
|
ON_SIGNAL: ON_SIGNAL,
|
|
10124
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10036
10125
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10037
10126
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10038
10127
|
events: events,
|
|
@@ -10373,6 +10462,11 @@ class Phone extends Emitter {
|
|
|
10373
10462
|
return this.getRemoteVideoStream(callSession);
|
|
10374
10463
|
}
|
|
10375
10464
|
|
|
10465
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
10466
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10467
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
10468
|
+
}
|
|
10469
|
+
|
|
10376
10470
|
hasVideo(callSession ) {
|
|
10377
10471
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
10378
10472
|
}
|
|
@@ -10532,6 +10626,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10532
10626
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10533
10627
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10534
10628
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10629
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10535
10630
|
|
|
10536
10631
|
const BLACKLIST_EVENTS = [
|
|
10537
10632
|
CHAT_MESSAGE_SENT,
|
|
@@ -10882,6 +10977,7 @@ WebSocketClient.eventLists = [
|
|
|
10882
10977
|
AGENT_UNPAUSED,
|
|
10883
10978
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10884
10979
|
CONFERENCE_ADHOC_DELETED,
|
|
10980
|
+
MEETING_USER_PROGRESS,
|
|
10885
10981
|
];
|
|
10886
10982
|
|
|
10887
10983
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -10952,6 +11048,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
10952
11048
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
10953
11049
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10954
11050
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
11051
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
10955
11052
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
10956
11053
|
'default': WebSocketClient
|
|
10957
11054
|
});
|
package/esm/simple/Directory.js
CHANGED
|
@@ -130,6 +130,7 @@ class IssueReporter {
|
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
|
|
133
|
+
|
|
133
134
|
|
|
134
135
|
constructor() {
|
|
135
136
|
addLevelsTo(this);
|
|
@@ -141,12 +142,17 @@ class IssueReporter {
|
|
|
141
142
|
this.bufferTimeout = null;
|
|
142
143
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
143
144
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
145
|
+
this._callback = null;
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
init() {
|
|
147
149
|
this._catchConsole();
|
|
148
150
|
}
|
|
149
151
|
|
|
152
|
+
setCallback(cb ) {
|
|
153
|
+
this._callback = cb;
|
|
154
|
+
}
|
|
155
|
+
|
|
150
156
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
151
157
|
this.remoteClientConfiguration = configuration;
|
|
152
158
|
}
|
|
@@ -182,6 +188,7 @@ class IssueReporter {
|
|
|
182
188
|
|
|
183
189
|
// Handle category label
|
|
184
190
|
let category = null;
|
|
191
|
+
let skipSendToRemote = false;
|
|
185
192
|
let extra = {};
|
|
186
193
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
187
194
|
category = args[0].split('=')[1];
|
|
@@ -197,6 +204,7 @@ class IssueReporter {
|
|
|
197
204
|
errorMessage: lastArg.message,
|
|
198
205
|
errorStack: lastArg.stack,
|
|
199
206
|
errorType: lastArg.constructor.name,
|
|
207
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
200
208
|
};
|
|
201
209
|
} else {
|
|
202
210
|
extra = lastArg;
|
|
@@ -205,6 +213,11 @@ class IssueReporter {
|
|
|
205
213
|
args.splice(1, 1);
|
|
206
214
|
}
|
|
207
215
|
|
|
216
|
+
if (extra.skipSendToRemote) {
|
|
217
|
+
skipSendToRemote = true;
|
|
218
|
+
delete extra.skipSendToRemote;
|
|
219
|
+
}
|
|
220
|
+
|
|
208
221
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
209
222
|
const message = args.join(', ');
|
|
210
223
|
let consoleMessage = message;
|
|
@@ -225,7 +238,13 @@ class IssueReporter {
|
|
|
225
238
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
226
239
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
227
240
|
|
|
228
|
-
this.
|
|
241
|
+
if (this._callback) {
|
|
242
|
+
this._callback(level, consoleMessage);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (!skipSendToRemote) {
|
|
246
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
247
|
+
}
|
|
229
248
|
}
|
|
230
249
|
|
|
231
250
|
logRequest(url , options , response , start ) {
|
|
@@ -370,7 +389,11 @@ class IssueReporter {
|
|
|
370
389
|
},
|
|
371
390
|
// $FlowFixMe
|
|
372
391
|
body,
|
|
373
|
-
}).catch(() => {
|
|
392
|
+
}).catch((e ) => {
|
|
393
|
+
// $FlowFixMe
|
|
394
|
+
e.skipSendToRemote = true;
|
|
395
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
396
|
+
|
|
374
397
|
setTimeout(() => {
|
|
375
398
|
if (isArray) {
|
|
376
399
|
payload = payload.map(message => {
|
|
@@ -382,7 +405,7 @@ class IssueReporter {
|
|
|
382
405
|
payload._retry = retry + 1;
|
|
383
406
|
}
|
|
384
407
|
|
|
385
|
-
this._sendDebugToGrafana(
|
|
408
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
386
409
|
}, 5000 + retry * 1000);
|
|
387
410
|
});
|
|
388
411
|
}
|
|
@@ -2585,7 +2608,8 @@ class ExternalApp {
|
|
|
2585
2608
|
|
|
2586
2609
|
|
|
2587
2610
|
|
|
2588
|
-
|
|
2611
|
+
|
|
2612
|
+
|
|
2589
2613
|
|
|
2590
2614
|
|
|
2591
2615
|
class Meeting {
|
|
@@ -2597,6 +2621,7 @@ class Meeting {
|
|
|
2597
2621
|
|
|
2598
2622
|
|
|
2599
2623
|
|
|
2624
|
+
|
|
2600
2625
|
|
|
2601
2626
|
|
|
2602
2627
|
static parse(plain ) {
|
|
@@ -2608,14 +2633,28 @@ class Meeting {
|
|
|
2608
2633
|
port: plain.port,
|
|
2609
2634
|
uuid: plain.uuid,
|
|
2610
2635
|
number: plain.number,
|
|
2636
|
+
persistent: plain.persistent,
|
|
2611
2637
|
});
|
|
2612
2638
|
}
|
|
2613
2639
|
|
|
2640
|
+
static parseMany(items ) {
|
|
2641
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2614
2644
|
static newFrom(meeting ) {
|
|
2615
2645
|
return newFrom(meeting, Meeting);
|
|
2616
2646
|
}
|
|
2617
2647
|
|
|
2618
|
-
constructor({
|
|
2648
|
+
constructor({
|
|
2649
|
+
uuid,
|
|
2650
|
+
name,
|
|
2651
|
+
guestSipAuthorization,
|
|
2652
|
+
ownerUuids,
|
|
2653
|
+
port,
|
|
2654
|
+
uri,
|
|
2655
|
+
number,
|
|
2656
|
+
persistent,
|
|
2657
|
+
} = {}) {
|
|
2619
2658
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2620
2659
|
this.uri = uri;
|
|
2621
2660
|
this.name = name;
|
|
@@ -2623,6 +2662,7 @@ class Meeting {
|
|
|
2623
2662
|
this.port = port;
|
|
2624
2663
|
this.uuid = uuid;
|
|
2625
2664
|
this.number = number;
|
|
2665
|
+
this.persistent = persistent;
|
|
2626
2666
|
|
|
2627
2667
|
// Useful to compare instead of instanceof with minified code
|
|
2628
2668
|
this.type = 'Meeting';
|
|
@@ -2700,8 +2740,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2700
2740
|
}
|
|
2701
2741
|
},
|
|
2702
2742
|
|
|
2703
|
-
|
|
2704
|
-
client.
|
|
2743
|
+
getMyMeetings: () =>
|
|
2744
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2745
|
+
|
|
2746
|
+
createMyMeeting: (name , persistent ) =>
|
|
2747
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2705
2748
|
|
|
2706
2749
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2707
2750
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3186,7 +3229,7 @@ class Recording {
|
|
|
3186
3229
|
|
|
3187
3230
|
|
|
3188
3231
|
|
|
3189
|
-
static parseMany(recordings
|
|
3232
|
+
static parseMany(recordings = []) {
|
|
3190
3233
|
return recordings.map(item => Recording.parse(item));
|
|
3191
3234
|
}
|
|
3192
3235
|
|
|
@@ -3312,7 +3355,7 @@ class CallLog {
|
|
|
3312
3355
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3313
3356
|
start: moment(plain.start).toDate(),
|
|
3314
3357
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
3315
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3358
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3316
3359
|
});
|
|
3317
3360
|
}
|
|
3318
3361
|
|