@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
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
} from '../domain/SwitchboardCall';
|
|
8
8
|
import type { ChatMessageResponse } from '../domain/ChatMessage';
|
|
9
9
|
import ChatRoom from '../domain/ChatRoom';
|
|
10
|
+
import Meeting from '../domain/Meeting';
|
|
10
11
|
|
|
11
12
|
type WebSocketBaseMessage = {
|
|
12
13
|
op: string,
|
|
@@ -187,6 +188,8 @@ type AgentStatusUpdate = WebSocketBaseMessage & { data: AgentStatusUpdateEvent,
|
|
|
187
188
|
type AgentPaused = WebSocketBaseMessage & { data: any, name: 'agent_paused' };
|
|
188
189
|
type AgentUnpaused = WebSocketBaseMessage & { data: any, name: 'agent_unpaused' };
|
|
189
190
|
|
|
191
|
+
type MeetingUserProgress = WebSocketBaseMessage & { data: Meeting, name: 'meeting_user_progress' };
|
|
192
|
+
|
|
190
193
|
export type WebSocketMessage =
|
|
191
194
|
| CallCreated
|
|
192
195
|
| CallUpdated
|
|
@@ -219,4 +222,5 @@ export type WebSocketMessage =
|
|
|
219
222
|
| FaxOutboundSucceeded
|
|
220
223
|
| AgentStatusUpdate
|
|
221
224
|
| AgentPaused
|
|
222
|
-
| AgentUnpaused
|
|
225
|
+
| AgentUnpaused
|
|
226
|
+
| MeetingUserProgress;
|
package/src/web-rtc-client.js
CHANGED
|
@@ -69,6 +69,7 @@ const ON_REINVITE = 'reinvite';
|
|
|
69
69
|
const ON_ERROR = 'onError';
|
|
70
70
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
71
71
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
72
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
72
73
|
|
|
73
74
|
export const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
74
75
|
export const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
@@ -145,6 +146,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
145
146
|
ON_ERROR: string;
|
|
146
147
|
ON_SCREEN_SHARING_REINVITE: string;
|
|
147
148
|
ON_NETWORK_STATS: string;
|
|
149
|
+
ON_DISCONNECTED: string;
|
|
148
150
|
|
|
149
151
|
static isAPrivateIp(ip: string): boolean {
|
|
150
152
|
const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
|
|
@@ -210,6 +212,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
210
212
|
this.ON_ERROR = ON_ERROR;
|
|
211
213
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
212
214
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
215
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
213
216
|
}
|
|
214
217
|
|
|
215
218
|
configureMedia(media: MediaConfig) {
|
|
@@ -475,7 +478,9 @@ export default class WebRTCClient extends Emitter {
|
|
|
475
478
|
const inviteOptions: InviterInviteOptions = {
|
|
476
479
|
requestDelegate: {
|
|
477
480
|
onAccept: (response: IncomingResponse) => {
|
|
478
|
-
session.sessionDescriptionHandler.peerConnection
|
|
481
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
482
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
483
|
+
}
|
|
479
484
|
this._onAccepted(session, response.session, true);
|
|
480
485
|
},
|
|
481
486
|
onReject: (response: IncomingResponse) => {
|
|
@@ -811,7 +816,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
811
816
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
812
817
|
const transceivers = pc.getTransceivers();
|
|
813
818
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
814
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
819
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
815
820
|
|
|
816
821
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
817
822
|
} else {
|
|
@@ -1347,6 +1352,16 @@ export default class WebRTCClient extends Emitter {
|
|
|
1347
1352
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
1348
1353
|
}
|
|
1349
1354
|
|
|
1355
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
1356
|
+
getRemoteVideoStreamFromPc(sessionId: string): ?MediaStream {
|
|
1357
|
+
const pc = this.getPeerConnection(sessionId);
|
|
1358
|
+
if (!pc) {
|
|
1359
|
+
return null;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1350
1365
|
hasVideo(sessionId: string): boolean {
|
|
1351
1366
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
1352
1367
|
}
|
|
@@ -1836,6 +1851,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1836
1851
|
|
|
1837
1852
|
this.updateRemoteStream(this.getSipSessionId(session));
|
|
1838
1853
|
|
|
1854
|
+
const pc = session.sessionDescriptionHandler.peerConnection;
|
|
1839
1855
|
const onTrack = (event: any) => {
|
|
1840
1856
|
const isAudioOnly = this._isAudioOnly(session);
|
|
1841
1857
|
const { kind, label, readyState, id, muted } = event.track;
|
|
@@ -1855,6 +1871,12 @@ export default class WebRTCClient extends Emitter {
|
|
|
1855
1871
|
|
|
1856
1872
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
1857
1873
|
|
|
1874
|
+
pc.oniceconnectionstatechange = () => {
|
|
1875
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
1876
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
1877
|
+
}
|
|
1878
|
+
};
|
|
1879
|
+
|
|
1858
1880
|
if (withEvent) {
|
|
1859
1881
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
1860
1882
|
}
|
|
@@ -2074,6 +2096,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
2074
2096
|
let videoBytesReceived = 0;
|
|
2075
2097
|
let transportSent = 0;
|
|
2076
2098
|
let transportReceived = 0;
|
|
2099
|
+
let packetsLost = 0;
|
|
2077
2100
|
|
|
2078
2101
|
stats.forEach(report => {
|
|
2079
2102
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
@@ -2086,7 +2109,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
2086
2109
|
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
2087
2110
|
}
|
|
2088
2111
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
2089
|
-
|
|
2112
|
+
packetsLost += report.packetsLost;
|
|
2090
2113
|
networkStats.packetsReceived = report.packetsReceived;
|
|
2091
2114
|
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
2092
2115
|
}
|
|
@@ -2103,27 +2126,36 @@ export default class WebRTCClient extends Emitter {
|
|
|
2103
2126
|
}
|
|
2104
2127
|
}
|
|
2105
2128
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
2129
|
+
packetsLost += report.packetsLost;
|
|
2106
2130
|
networkStats.roundTripTime = report.roundTripTime;
|
|
2107
2131
|
networkStats.jitter = report.jitter;
|
|
2108
2132
|
}
|
|
2133
|
+
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
2134
|
+
packetsLost += report.packetsLost;
|
|
2135
|
+
}
|
|
2109
2136
|
if (report.type === 'transport') {
|
|
2110
2137
|
transportSent += report.bytesSent;
|
|
2111
2138
|
transportReceived += report.bytesReceived;
|
|
2112
2139
|
}
|
|
2113
2140
|
});
|
|
2114
2141
|
|
|
2115
|
-
networkStats.
|
|
2142
|
+
networkStats.packetsLost = packetsLost;
|
|
2143
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
2144
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
2145
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
2116
2146
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
2117
|
-
networkStats.
|
|
2118
|
-
networkStats.
|
|
2147
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
2148
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
2149
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
2150
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
2151
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
2119
2152
|
networkStats.transportSent = transportSent;
|
|
2120
|
-
networkStats.
|
|
2121
|
-
|
|
2122
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
2123
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
2124
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
2153
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
2154
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
2125
2155
|
|
|
2126
|
-
networkStats.bandwidth =
|
|
2156
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
2157
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
2158
|
+
+ networkStats.transportSent;
|
|
2127
2159
|
|
|
2128
2160
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
2129
2161
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
package/src/websocket-client.js
CHANGED
|
@@ -93,6 +93,7 @@ export const AGENT_PAUSED = 'agent_paused';
|
|
|
93
93
|
export const AGENT_UNPAUSED = 'agent_unpaused';
|
|
94
94
|
export const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
95
95
|
export const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
96
|
+
export const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
96
97
|
|
|
97
98
|
const BLACKLIST_EVENTS = [
|
|
98
99
|
CHAT_MESSAGE_SENT,
|
|
@@ -446,6 +447,7 @@ WebSocketClient.eventLists = [
|
|
|
446
447
|
AGENT_UNPAUSED,
|
|
447
448
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
448
449
|
CONFERENCE_ADHOC_DELETED,
|
|
450
|
+
MEETING_USER_PROGRESS,
|
|
449
451
|
];
|
|
450
452
|
|
|
451
453
|
export default WebSocketClient;
|