@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
|
@@ -1644,6 +1644,7 @@ class IssueReporter {
|
|
|
1644
1644
|
|
|
1645
1645
|
|
|
1646
1646
|
|
|
1647
|
+
|
|
1647
1648
|
|
|
1648
1649
|
constructor() {
|
|
1649
1650
|
addLevelsTo(this);
|
|
@@ -1655,12 +1656,17 @@ class IssueReporter {
|
|
|
1655
1656
|
this.bufferTimeout = null;
|
|
1656
1657
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
1657
1658
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
1659
|
+
this._callback = null;
|
|
1658
1660
|
}
|
|
1659
1661
|
|
|
1660
1662
|
init() {
|
|
1661
1663
|
this._catchConsole();
|
|
1662
1664
|
}
|
|
1663
1665
|
|
|
1666
|
+
setCallback(cb ) {
|
|
1667
|
+
this._callback = cb;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1664
1670
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
1665
1671
|
this.remoteClientConfiguration = configuration;
|
|
1666
1672
|
}
|
|
@@ -1696,6 +1702,7 @@ class IssueReporter {
|
|
|
1696
1702
|
|
|
1697
1703
|
// Handle category label
|
|
1698
1704
|
let category = null;
|
|
1705
|
+
let skipSendToRemote = false;
|
|
1699
1706
|
let extra = {};
|
|
1700
1707
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
1701
1708
|
category = args[0].split('=')[1];
|
|
@@ -1711,6 +1718,7 @@ class IssueReporter {
|
|
|
1711
1718
|
errorMessage: lastArg.message,
|
|
1712
1719
|
errorStack: lastArg.stack,
|
|
1713
1720
|
errorType: lastArg.constructor.name,
|
|
1721
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
1714
1722
|
};
|
|
1715
1723
|
} else {
|
|
1716
1724
|
extra = lastArg;
|
|
@@ -1719,6 +1727,11 @@ class IssueReporter {
|
|
|
1719
1727
|
args.splice(1, 1);
|
|
1720
1728
|
}
|
|
1721
1729
|
|
|
1730
|
+
if (extra.skipSendToRemote) {
|
|
1731
|
+
skipSendToRemote = true;
|
|
1732
|
+
delete extra.skipSendToRemote;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1722
1735
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
1723
1736
|
const message = args.join(', ');
|
|
1724
1737
|
let consoleMessage = message;
|
|
@@ -1739,7 +1752,13 @@ class IssueReporter {
|
|
|
1739
1752
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
1740
1753
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
1741
1754
|
|
|
1742
|
-
this.
|
|
1755
|
+
if (this._callback) {
|
|
1756
|
+
this._callback(level, consoleMessage);
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
if (!skipSendToRemote) {
|
|
1760
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
1761
|
+
}
|
|
1743
1762
|
}
|
|
1744
1763
|
|
|
1745
1764
|
logRequest(url , options , response , start ) {
|
|
@@ -1884,7 +1903,11 @@ class IssueReporter {
|
|
|
1884
1903
|
},
|
|
1885
1904
|
// $FlowFixMe
|
|
1886
1905
|
body,
|
|
1887
|
-
}).catch(() => {
|
|
1906
|
+
}).catch((e ) => {
|
|
1907
|
+
// $FlowFixMe
|
|
1908
|
+
e.skipSendToRemote = true;
|
|
1909
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
1910
|
+
|
|
1888
1911
|
setTimeout(() => {
|
|
1889
1912
|
if (isArray) {
|
|
1890
1913
|
payload = payload.map(message => {
|
|
@@ -1896,7 +1919,7 @@ class IssueReporter {
|
|
|
1896
1919
|
payload._retry = retry + 1;
|
|
1897
1920
|
}
|
|
1898
1921
|
|
|
1899
|
-
this._sendDebugToGrafana(
|
|
1922
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
1900
1923
|
}, 5000 + retry * 1000);
|
|
1901
1924
|
});
|
|
1902
1925
|
}
|
|
@@ -2614,7 +2637,8 @@ class ExternalApp {
|
|
|
2614
2637
|
|
|
2615
2638
|
|
|
2616
2639
|
|
|
2617
|
-
|
|
2640
|
+
|
|
2641
|
+
|
|
2618
2642
|
|
|
2619
2643
|
|
|
2620
2644
|
class Meeting {
|
|
@@ -2626,6 +2650,7 @@ class Meeting {
|
|
|
2626
2650
|
|
|
2627
2651
|
|
|
2628
2652
|
|
|
2653
|
+
|
|
2629
2654
|
|
|
2630
2655
|
|
|
2631
2656
|
static parse(plain ) {
|
|
@@ -2637,14 +2662,28 @@ class Meeting {
|
|
|
2637
2662
|
port: plain.port,
|
|
2638
2663
|
uuid: plain.uuid,
|
|
2639
2664
|
number: plain.number,
|
|
2665
|
+
persistent: plain.persistent,
|
|
2640
2666
|
});
|
|
2641
2667
|
}
|
|
2642
2668
|
|
|
2669
|
+
static parseMany(items ) {
|
|
2670
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2643
2673
|
static newFrom(meeting ) {
|
|
2644
2674
|
return newFrom(meeting, Meeting);
|
|
2645
2675
|
}
|
|
2646
2676
|
|
|
2647
|
-
constructor({
|
|
2677
|
+
constructor({
|
|
2678
|
+
uuid,
|
|
2679
|
+
name,
|
|
2680
|
+
guestSipAuthorization,
|
|
2681
|
+
ownerUuids,
|
|
2682
|
+
port,
|
|
2683
|
+
uri,
|
|
2684
|
+
number,
|
|
2685
|
+
persistent,
|
|
2686
|
+
} = {}) {
|
|
2648
2687
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2649
2688
|
this.uri = uri;
|
|
2650
2689
|
this.name = name;
|
|
@@ -2652,6 +2691,7 @@ class Meeting {
|
|
|
2652
2691
|
this.port = port;
|
|
2653
2692
|
this.uuid = uuid;
|
|
2654
2693
|
this.number = number;
|
|
2694
|
+
this.persistent = persistent;
|
|
2655
2695
|
|
|
2656
2696
|
// Useful to compare instead of instanceof with minified code
|
|
2657
2697
|
this.type = 'Meeting';
|
|
@@ -2729,8 +2769,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2729
2769
|
}
|
|
2730
2770
|
},
|
|
2731
2771
|
|
|
2732
|
-
|
|
2733
|
-
client.
|
|
2772
|
+
getMyMeetings: () =>
|
|
2773
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2774
|
+
|
|
2775
|
+
createMyMeeting: (name , persistent ) =>
|
|
2776
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2734
2777
|
|
|
2735
2778
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2736
2779
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3586,7 +3629,7 @@ class Recording {
|
|
|
3586
3629
|
|
|
3587
3630
|
|
|
3588
3631
|
|
|
3589
|
-
static parseMany(recordings
|
|
3632
|
+
static parseMany(recordings = []) {
|
|
3590
3633
|
return recordings.map(item => Recording.parse(item));
|
|
3591
3634
|
}
|
|
3592
3635
|
|
|
@@ -3712,7 +3755,7 @@ class CallLog {
|
|
|
3712
3755
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3713
3756
|
start: moment__default['default'](plain.start).toDate(),
|
|
3714
3757
|
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3715
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3758
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3716
3759
|
});
|
|
3717
3760
|
}
|
|
3718
3761
|
|
|
@@ -6293,6 +6336,7 @@ const ON_REINVITE$1 = 'reinvite';
|
|
|
6293
6336
|
const ON_ERROR = 'onError';
|
|
6294
6337
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6295
6338
|
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6339
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6296
6340
|
|
|
6297
6341
|
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6298
6342
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
@@ -6369,6 +6413,7 @@ class WebRTCClient extends Emitter {
|
|
|
6369
6413
|
|
|
6370
6414
|
|
|
6371
6415
|
|
|
6416
|
+
|
|
6372
6417
|
|
|
6373
6418
|
static isAPrivateIp(ip ) {
|
|
6374
6419
|
const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
|
|
@@ -6434,6 +6479,7 @@ class WebRTCClient extends Emitter {
|
|
|
6434
6479
|
this.ON_ERROR = ON_ERROR;
|
|
6435
6480
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6436
6481
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6482
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6437
6483
|
}
|
|
6438
6484
|
|
|
6439
6485
|
configureMedia(media ) {
|
|
@@ -6699,7 +6745,9 @@ class WebRTCClient extends Emitter {
|
|
|
6699
6745
|
const inviteOptions = {
|
|
6700
6746
|
requestDelegate: {
|
|
6701
6747
|
onAccept: (response ) => {
|
|
6702
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6748
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6749
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6750
|
+
}
|
|
6703
6751
|
this._onAccepted(session, response.session, true);
|
|
6704
6752
|
},
|
|
6705
6753
|
onReject: (response ) => {
|
|
@@ -7035,7 +7083,7 @@ class WebRTCClient extends Emitter {
|
|
|
7035
7083
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
7036
7084
|
const transceivers = pc.getTransceivers();
|
|
7037
7085
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
7038
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
7086
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
7039
7087
|
|
|
7040
7088
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
7041
7089
|
} else {
|
|
@@ -7571,6 +7619,16 @@ class WebRTCClient extends Emitter {
|
|
|
7571
7619
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7572
7620
|
}
|
|
7573
7621
|
|
|
7622
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7623
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7624
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7625
|
+
if (!pc) {
|
|
7626
|
+
return null;
|
|
7627
|
+
}
|
|
7628
|
+
|
|
7629
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7630
|
+
}
|
|
7631
|
+
|
|
7574
7632
|
hasVideo(sessionId ) {
|
|
7575
7633
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7576
7634
|
}
|
|
@@ -8060,6 +8118,7 @@ class WebRTCClient extends Emitter {
|
|
|
8060
8118
|
|
|
8061
8119
|
this.updateRemoteStream(this.getSipSessionId(session));
|
|
8062
8120
|
|
|
8121
|
+
const pc = session.sessionDescriptionHandler.peerConnection;
|
|
8063
8122
|
const onTrack = (event ) => {
|
|
8064
8123
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8065
8124
|
const { kind, label, readyState, id, muted } = event.track;
|
|
@@ -8079,6 +8138,12 @@ class WebRTCClient extends Emitter {
|
|
|
8079
8138
|
|
|
8080
8139
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8081
8140
|
|
|
8141
|
+
pc.oniceconnectionstatechange = () => {
|
|
8142
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8143
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8144
|
+
}
|
|
8145
|
+
};
|
|
8146
|
+
|
|
8082
8147
|
if (withEvent) {
|
|
8083
8148
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
8084
8149
|
}
|
|
@@ -8298,6 +8363,7 @@ class WebRTCClient extends Emitter {
|
|
|
8298
8363
|
let videoBytesReceived = 0;
|
|
8299
8364
|
let transportSent = 0;
|
|
8300
8365
|
let transportReceived = 0;
|
|
8366
|
+
let packetsLost = 0;
|
|
8301
8367
|
|
|
8302
8368
|
stats.forEach(report => {
|
|
8303
8369
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
@@ -8310,7 +8376,7 @@ class WebRTCClient extends Emitter {
|
|
|
8310
8376
|
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8311
8377
|
}
|
|
8312
8378
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8313
|
-
|
|
8379
|
+
packetsLost += report.packetsLost;
|
|
8314
8380
|
networkStats.packetsReceived = report.packetsReceived;
|
|
8315
8381
|
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8316
8382
|
}
|
|
@@ -8327,27 +8393,36 @@ class WebRTCClient extends Emitter {
|
|
|
8327
8393
|
}
|
|
8328
8394
|
}
|
|
8329
8395
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8396
|
+
packetsLost += report.packetsLost;
|
|
8330
8397
|
networkStats.roundTripTime = report.roundTripTime;
|
|
8331
8398
|
networkStats.jitter = report.jitter;
|
|
8332
8399
|
}
|
|
8400
|
+
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8401
|
+
packetsLost += report.packetsLost;
|
|
8402
|
+
}
|
|
8333
8403
|
if (report.type === 'transport') {
|
|
8334
8404
|
transportSent += report.bytesSent;
|
|
8335
8405
|
transportReceived += report.bytesReceived;
|
|
8336
8406
|
}
|
|
8337
8407
|
});
|
|
8338
8408
|
|
|
8339
|
-
networkStats.
|
|
8409
|
+
networkStats.packetsLost = packetsLost;
|
|
8410
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8411
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8412
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8340
8413
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8341
|
-
networkStats.
|
|
8342
|
-
networkStats.
|
|
8414
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8415
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8416
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8417
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8418
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8343
8419
|
networkStats.transportSent = transportSent;
|
|
8344
|
-
networkStats.
|
|
8420
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8421
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8345
8422
|
|
|
8346
|
-
|
|
8347
|
-
+
|
|
8348
|
-
+
|
|
8349
|
-
|
|
8350
|
-
networkStats.bandwidth = bandwidth;
|
|
8423
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8424
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8425
|
+
+ networkStats.transportSent;
|
|
8351
8426
|
|
|
8352
8427
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8353
8428
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -8396,6 +8471,7 @@ const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
|
8396
8471
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8397
8472
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8398
8473
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8474
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8399
8475
|
|
|
8400
8476
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8401
8477
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -8435,6 +8511,7 @@ const events = [
|
|
|
8435
8511
|
ON_CHAT,
|
|
8436
8512
|
ON_SIGNAL,
|
|
8437
8513
|
ON_NETWORK_STATS,
|
|
8514
|
+
ON_DISCONNECTED,
|
|
8438
8515
|
];
|
|
8439
8516
|
|
|
8440
8517
|
const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -8756,9 +8833,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8756
8833
|
case sessionState.SessionState.Terminated: {
|
|
8757
8834
|
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8758
8835
|
|
|
8836
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8837
|
+
const callSession = this._createCallSession(sipSession);
|
|
8759
8838
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8760
8839
|
|
|
8761
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
8840
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
8762
8841
|
}
|
|
8763
8842
|
}
|
|
8764
8843
|
});
|
|
@@ -9706,6 +9785,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9706
9785
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9707
9786
|
}
|
|
9708
9787
|
|
|
9788
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
9789
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
9790
|
+
}
|
|
9791
|
+
|
|
9709
9792
|
hasRemoteVideo(callSession ) {
|
|
9710
9793
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9711
9794
|
}
|
|
@@ -9787,6 +9870,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9787
9870
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9788
9871
|
});
|
|
9789
9872
|
|
|
9873
|
+
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
9874
|
+
logger$8.info('WebRTC disconnected');
|
|
9875
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
9876
|
+
});
|
|
9877
|
+
|
|
9790
9878
|
this.client.on(this.client.REGISTERED, () => {
|
|
9791
9879
|
logger$8.info('WebRTC registered', {
|
|
9792
9880
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
@@ -10043,6 +10131,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10043
10131
|
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10044
10132
|
ON_CHAT: ON_CHAT,
|
|
10045
10133
|
ON_SIGNAL: ON_SIGNAL,
|
|
10134
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10046
10135
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10047
10136
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10048
10137
|
events: events,
|
|
@@ -10383,6 +10472,11 @@ class Phone extends Emitter {
|
|
|
10383
10472
|
return this.getRemoteVideoStream(callSession);
|
|
10384
10473
|
}
|
|
10385
10474
|
|
|
10475
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
10476
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10477
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
10478
|
+
}
|
|
10479
|
+
|
|
10386
10480
|
hasVideo(callSession ) {
|
|
10387
10481
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
10388
10482
|
}
|
|
@@ -10542,6 +10636,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10542
10636
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10543
10637
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10544
10638
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10639
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10545
10640
|
|
|
10546
10641
|
const BLACKLIST_EVENTS = [
|
|
10547
10642
|
CHAT_MESSAGE_SENT,
|
|
@@ -10892,6 +10987,7 @@ WebSocketClient.eventLists = [
|
|
|
10892
10987
|
AGENT_UNPAUSED,
|
|
10893
10988
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10894
10989
|
CONFERENCE_ADHOC_DELETED,
|
|
10990
|
+
MEETING_USER_PROGRESS,
|
|
10895
10991
|
];
|
|
10896
10992
|
|
|
10897
10993
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -10962,6 +11058,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
10962
11058
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
10963
11059
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
10964
11060
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
11061
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
10965
11062
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
10966
11063
|
'default': WebSocketClient
|
|
10967
11064
|
});
|
package/lib/simple/Directory.js
CHANGED
|
@@ -136,6 +136,7 @@ class IssueReporter {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
|
|
139
|
+
|
|
139
140
|
|
|
140
141
|
constructor() {
|
|
141
142
|
addLevelsTo(this);
|
|
@@ -147,12 +148,17 @@ class IssueReporter {
|
|
|
147
148
|
this.bufferTimeout = null;
|
|
148
149
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
149
150
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
151
|
+
this._callback = null;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
init() {
|
|
153
155
|
this._catchConsole();
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
setCallback(cb ) {
|
|
159
|
+
this._callback = cb;
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
157
163
|
this.remoteClientConfiguration = configuration;
|
|
158
164
|
}
|
|
@@ -188,6 +194,7 @@ class IssueReporter {
|
|
|
188
194
|
|
|
189
195
|
// Handle category label
|
|
190
196
|
let category = null;
|
|
197
|
+
let skipSendToRemote = false;
|
|
191
198
|
let extra = {};
|
|
192
199
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
193
200
|
category = args[0].split('=')[1];
|
|
@@ -203,6 +210,7 @@ class IssueReporter {
|
|
|
203
210
|
errorMessage: lastArg.message,
|
|
204
211
|
errorStack: lastArg.stack,
|
|
205
212
|
errorType: lastArg.constructor.name,
|
|
213
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
206
214
|
};
|
|
207
215
|
} else {
|
|
208
216
|
extra = lastArg;
|
|
@@ -211,6 +219,11 @@ class IssueReporter {
|
|
|
211
219
|
args.splice(1, 1);
|
|
212
220
|
}
|
|
213
221
|
|
|
222
|
+
if (extra.skipSendToRemote) {
|
|
223
|
+
skipSendToRemote = true;
|
|
224
|
+
delete extra.skipSendToRemote;
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
215
228
|
const message = args.join(', ');
|
|
216
229
|
let consoleMessage = message;
|
|
@@ -231,7 +244,13 @@ class IssueReporter {
|
|
|
231
244
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
232
245
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
233
246
|
|
|
234
|
-
this.
|
|
247
|
+
if (this._callback) {
|
|
248
|
+
this._callback(level, consoleMessage);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!skipSendToRemote) {
|
|
252
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
253
|
+
}
|
|
235
254
|
}
|
|
236
255
|
|
|
237
256
|
logRequest(url , options , response , start ) {
|
|
@@ -376,7 +395,11 @@ class IssueReporter {
|
|
|
376
395
|
},
|
|
377
396
|
// $FlowFixMe
|
|
378
397
|
body,
|
|
379
|
-
}).catch(() => {
|
|
398
|
+
}).catch((e ) => {
|
|
399
|
+
// $FlowFixMe
|
|
400
|
+
e.skipSendToRemote = true;
|
|
401
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
402
|
+
|
|
380
403
|
setTimeout(() => {
|
|
381
404
|
if (isArray) {
|
|
382
405
|
payload = payload.map(message => {
|
|
@@ -388,7 +411,7 @@ class IssueReporter {
|
|
|
388
411
|
payload._retry = retry + 1;
|
|
389
412
|
}
|
|
390
413
|
|
|
391
|
-
this._sendDebugToGrafana(
|
|
414
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
392
415
|
}, 5000 + retry * 1000);
|
|
393
416
|
});
|
|
394
417
|
}
|
|
@@ -2591,7 +2614,8 @@ class ExternalApp {
|
|
|
2591
2614
|
|
|
2592
2615
|
|
|
2593
2616
|
|
|
2594
|
-
|
|
2617
|
+
|
|
2618
|
+
|
|
2595
2619
|
|
|
2596
2620
|
|
|
2597
2621
|
class Meeting {
|
|
@@ -2603,6 +2627,7 @@ class Meeting {
|
|
|
2603
2627
|
|
|
2604
2628
|
|
|
2605
2629
|
|
|
2630
|
+
|
|
2606
2631
|
|
|
2607
2632
|
|
|
2608
2633
|
static parse(plain ) {
|
|
@@ -2614,14 +2639,28 @@ class Meeting {
|
|
|
2614
2639
|
port: plain.port,
|
|
2615
2640
|
uuid: plain.uuid,
|
|
2616
2641
|
number: plain.number,
|
|
2642
|
+
persistent: plain.persistent,
|
|
2617
2643
|
});
|
|
2618
2644
|
}
|
|
2619
2645
|
|
|
2646
|
+
static parseMany(items ) {
|
|
2647
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2620
2650
|
static newFrom(meeting ) {
|
|
2621
2651
|
return newFrom(meeting, Meeting);
|
|
2622
2652
|
}
|
|
2623
2653
|
|
|
2624
|
-
constructor({
|
|
2654
|
+
constructor({
|
|
2655
|
+
uuid,
|
|
2656
|
+
name,
|
|
2657
|
+
guestSipAuthorization,
|
|
2658
|
+
ownerUuids,
|
|
2659
|
+
port,
|
|
2660
|
+
uri,
|
|
2661
|
+
number,
|
|
2662
|
+
persistent,
|
|
2663
|
+
} = {}) {
|
|
2625
2664
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2626
2665
|
this.uri = uri;
|
|
2627
2666
|
this.name = name;
|
|
@@ -2629,6 +2668,7 @@ class Meeting {
|
|
|
2629
2668
|
this.port = port;
|
|
2630
2669
|
this.uuid = uuid;
|
|
2631
2670
|
this.number = number;
|
|
2671
|
+
this.persistent = persistent;
|
|
2632
2672
|
|
|
2633
2673
|
// Useful to compare instead of instanceof with minified code
|
|
2634
2674
|
this.type = 'Meeting';
|
|
@@ -2706,8 +2746,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2706
2746
|
}
|
|
2707
2747
|
},
|
|
2708
2748
|
|
|
2709
|
-
|
|
2710
|
-
client.
|
|
2749
|
+
getMyMeetings: () =>
|
|
2750
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2751
|
+
|
|
2752
|
+
createMyMeeting: (name , persistent ) =>
|
|
2753
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2711
2754
|
|
|
2712
2755
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2713
2756
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3192,7 +3235,7 @@ class Recording {
|
|
|
3192
3235
|
|
|
3193
3236
|
|
|
3194
3237
|
|
|
3195
|
-
static parseMany(recordings
|
|
3238
|
+
static parseMany(recordings = []) {
|
|
3196
3239
|
return recordings.map(item => Recording.parse(item));
|
|
3197
3240
|
}
|
|
3198
3241
|
|
|
@@ -3318,7 +3361,7 @@ class CallLog {
|
|
|
3318
3361
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3319
3362
|
start: moment__default['default'](plain.start).toDate(),
|
|
3320
3363
|
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3321
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3364
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3322
3365
|
});
|
|
3323
3366
|
}
|
|
3324
3367
|
|