@wazo/sdk 0.37.22 → 0.37.23
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 +5 -5
- package/esm/__tests__/api-client.test.js +26 -0
- package/esm/__tests__/web-rtc-client.test.js +40 -52
- package/esm/api/call-logd.js +7 -0
- package/esm/api/calld.js +10 -0
- package/esm/api/chatd.js +7 -0
- package/esm/api/confd.js +3 -0
- package/esm/api/ctid-ng.js +10 -0
- package/esm/api/dird.js +3 -0
- package/esm/api-client.js +26 -0
- package/esm/checker/Checker.js +40 -52
- package/esm/checker/checks/aor.js +26 -0
- package/esm/checker/checks/api.js +26 -0
- package/esm/checker/checks/index.js +40 -52
- package/esm/checker/checks/webrtc-transport.js +40 -52
- package/esm/checker/checks/webrtc.js +40 -52
- package/esm/domain/AdHocAPIConference.js +26 -0
- package/esm/domain/Call.js +3 -0
- package/esm/domain/CallLog.js +7 -0
- package/esm/domain/ChatMessage.js +4 -0
- package/esm/domain/ChatRoom.js +3 -0
- package/esm/domain/Contact.js +3 -0
- package/esm/domain/Features.js +26 -0
- package/esm/domain/Meeting.js +3 -0
- package/esm/domain/Phone/CTIPhone.js +30 -0
- package/esm/domain/Phone/WebRTCPhone.js +14 -12
- package/esm/domain/Recording.js +3 -0
- package/esm/domain/Voicemail.js +3 -0
- package/esm/domain/__tests__/Call.test.js +3 -0
- package/esm/domain/__tests__/CallLog.test.js +7 -0
- package/esm/domain/__tests__/Contact.test.js +3 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +57 -63
- package/esm/lib/WazoSessionDescriptionHandler.js +0 -38
- package/esm/service/CallApi.js +26 -0
- package/esm/service/getApiClient.js +26 -0
- package/esm/simple/Auth.js +57 -63
- package/esm/simple/Configuration.js +57 -63
- package/esm/simple/Directory.js +26 -0
- package/esm/simple/Phone.js +57 -63
- package/esm/simple/index.js +57 -63
- package/esm/simple/room/LocalParticipant.js +57 -63
- package/esm/simple/room/Participant.js +57 -63
- package/esm/simple/room/RemoteParticipant.js +57 -63
- package/esm/simple/room/Room.js +57 -63
- package/esm/simple/room/SipRoom.js +57 -63
- package/esm/simple/room/Stream.js +57 -63
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +57 -63
- package/esm/simple/utils.js +57 -63
- package/esm/web-rtc-client.js +40 -52
- package/lib/__tests__/api-client.test.js +26 -0
- package/lib/__tests__/web-rtc-client.test.js +40 -52
- package/lib/api/call-logd.js +7 -0
- package/lib/api/calld.js +10 -0
- package/lib/api/chatd.js +7 -0
- package/lib/api/confd.js +3 -0
- package/lib/api/ctid-ng.js +10 -0
- package/lib/api/dird.js +3 -0
- package/lib/api-client.js +26 -0
- package/lib/checker/Checker.js +40 -52
- package/lib/checker/checks/aor.js +26 -0
- package/lib/checker/checks/api.js +26 -0
- package/lib/checker/checks/index.js +40 -52
- package/lib/checker/checks/webrtc-transport.js +40 -52
- package/lib/checker/checks/webrtc.js +40 -52
- package/lib/domain/AdHocAPIConference.js +26 -0
- package/lib/domain/Call.js +3 -0
- package/lib/domain/CallLog.js +7 -0
- package/lib/domain/ChatMessage.js +4 -0
- package/lib/domain/ChatRoom.js +3 -0
- package/lib/domain/Contact.js +3 -0
- package/lib/domain/Features.js +26 -0
- package/lib/domain/Meeting.js +3 -0
- package/lib/domain/Phone/CTIPhone.js +30 -0
- package/lib/domain/Phone/WebRTCPhone.js +14 -12
- package/lib/domain/Recording.js +3 -0
- package/lib/domain/Voicemail.js +3 -0
- package/lib/domain/__tests__/Call.test.js +3 -0
- package/lib/domain/__tests__/CallLog.test.js +7 -0
- package/lib/domain/__tests__/Contact.test.js +3 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +57 -63
- package/lib/lib/WazoSessionDescriptionHandler.js +0 -38
- package/lib/service/CallApi.js +26 -0
- package/lib/service/getApiClient.js +26 -0
- package/lib/simple/Auth.js +57 -63
- package/lib/simple/Configuration.js +57 -63
- package/lib/simple/Directory.js +26 -0
- package/lib/simple/Phone.js +57 -63
- package/lib/simple/index.js +57 -63
- package/lib/simple/room/LocalParticipant.js +57 -63
- package/lib/simple/room/Participant.js +57 -63
- package/lib/simple/room/RemoteParticipant.js +57 -63
- package/lib/simple/room/Room.js +57 -63
- package/lib/simple/room/SipRoom.js +57 -63
- package/lib/simple/room/Stream.js +57 -63
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +57 -63
- package/lib/simple/utils.js +57 -63
- package/lib/web-rtc-client.js +40 -52
- package/package.json +1 -1
- package/src/domain/Call.js +3 -0
- package/src/domain/CallLog.js +4 -0
- package/src/domain/ChatMessage.js +4 -0
- package/src/domain/ChatRoom.js +3 -0
- package/src/domain/Contact.js +3 -0
- package/src/domain/Meeting.js +3 -0
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +14 -12
- package/src/domain/Recording.js +3 -0
- package/src/domain/Voicemail.js +3 -0
- package/src/lib/WazoSessionDescriptionHandler.js +1 -35
- package/src/web-rtc-client.js +14 -14
package/src/domain/CallLog.js
CHANGED
package/src/domain/ChatRoom.js
CHANGED
package/src/domain/Contact.js
CHANGED
|
@@ -281,6 +281,9 @@ export default class Contact {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
static parseMany(response: ContactsResponse): Array<Contact> {
|
|
284
|
+
if (!response || !response.results) {
|
|
285
|
+
return [];
|
|
286
|
+
}
|
|
284
287
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
285
288
|
}
|
|
286
289
|
|
package/src/domain/Meeting.js
CHANGED
|
@@ -571,18 +571,20 @@ export default class WebRTCPhone extends Emitter implements Phone {
|
|
|
571
571
|
screenTrack,
|
|
572
572
|
});
|
|
573
573
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
574
|
+
if (screenTrack) {
|
|
575
|
+
screenTrack.onended = () => {
|
|
576
|
+
logger.info('WebRTC phone - on screenshare ended', {
|
|
577
|
+
hadVideo,
|
|
578
|
+
id: this.getSipSessionId(sipSession),
|
|
579
|
+
screenTrack,
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
this.eventEmitter.emit(
|
|
583
|
+
ON_SHARE_SCREEN_ENDING,
|
|
584
|
+
this._createCallSession(sipSession, callSession),
|
|
585
|
+
);
|
|
586
|
+
};
|
|
587
|
+
}
|
|
586
588
|
|
|
587
589
|
this.currentScreenShare = {
|
|
588
590
|
stream: screenStream,
|
package/src/domain/Recording.js
CHANGED
package/src/domain/Voicemail.js
CHANGED
|
@@ -61,6 +61,9 @@ export default class Voicemail {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
static parseMany(plain: Response): Array<Voicemail> {
|
|
64
|
+
if (!plain) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
64
67
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
65
68
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
66
69
|
|
|
@@ -12,11 +12,9 @@ import { SessionDescriptionHandler }
|
|
|
12
12
|
import { SessionDescriptionHandlerOptions }
|
|
13
13
|
from 'sip.js/lib/platform/web/session-description-handler/session-description-handler-options';
|
|
14
14
|
import IssueReporter from '../service/IssueReporter';
|
|
15
|
-
import {
|
|
15
|
+
import { fixSdp, parseCandidate } from '../utils/sdp';
|
|
16
16
|
|
|
17
17
|
const wazoLogger = IssueReporter ? IssueReporter.loggerFor('webrtc-sdh') : console;
|
|
18
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
19
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
20
18
|
|
|
21
19
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
22
20
|
export const wazoMediaStreamFactory = (constraints: Object): Promise<MediaStream> => {
|
|
@@ -206,38 +204,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
206
204
|
this._peerConnection = undefined;
|
|
207
205
|
}
|
|
208
206
|
|
|
209
|
-
async _waitForValidGatheredIce(): Object {
|
|
210
|
-
let tries = 0;
|
|
211
|
-
|
|
212
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
213
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
214
|
-
tries,
|
|
215
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
tries++;
|
|
219
|
-
|
|
220
|
-
// eslint-disable-next-line no-await-in-loop
|
|
221
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
225
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
226
|
-
const error = new Error(errorMsg);
|
|
227
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
228
|
-
|
|
229
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
230
|
-
this.eventEmitter.emit('error', error);
|
|
231
|
-
|
|
232
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// eslint-disable-next-line
|
|
236
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
237
|
-
|
|
238
|
-
return this.getLocalSessionDescription();
|
|
239
|
-
}
|
|
240
|
-
|
|
241
207
|
// Overridden to send `inactive` in conference
|
|
242
208
|
updateDirection(options?: SessionDescriptionHandlerOptions, isConference: boolean = false,
|
|
243
209
|
audioOnly: boolean = false): Promise<void> {
|
package/src/web-rtc-client.js
CHANGED
|
@@ -2101,25 +2101,25 @@ export default class WebRTCClient extends Emitter {
|
|
|
2101
2101
|
|
|
2102
2102
|
stats.forEach(report => {
|
|
2103
2103
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
2104
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
2104
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
2105
2105
|
}
|
|
2106
2106
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
2107
|
-
audioBytesSent += report.bytesSent;
|
|
2107
|
+
audioBytesSent += Number(report.bytesSent);
|
|
2108
2108
|
}
|
|
2109
2109
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
2110
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
2110
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
2111
2111
|
}
|
|
2112
2112
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
2113
|
-
packetsLost += report.packetsLost;
|
|
2114
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
2115
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
2113
|
+
packetsLost += Number(report.packetsLost);
|
|
2114
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
2115
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
2116
2116
|
}
|
|
2117
2117
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
2118
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
2118
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
2119
2119
|
}
|
|
2120
2120
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
2121
2121
|
if ('framesPerSecond' in report) {
|
|
2122
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
2122
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
2123
2123
|
}
|
|
2124
2124
|
if ('framerateMean' in report) {
|
|
2125
2125
|
// framerateMean is only available in FF
|
|
@@ -2127,16 +2127,16 @@ export default class WebRTCClient extends Emitter {
|
|
|
2127
2127
|
}
|
|
2128
2128
|
}
|
|
2129
2129
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
2130
|
-
packetsLost += report.packetsLost;
|
|
2131
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
2132
|
-
networkStats.jitter = report.jitter;
|
|
2130
|
+
packetsLost += Number(report.packetsLost);
|
|
2131
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
2132
|
+
networkStats.jitter = Number(report.jitter);
|
|
2133
2133
|
}
|
|
2134
2134
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
2135
|
-
packetsLost += report.packetsLost;
|
|
2135
|
+
packetsLost += Number(report.packetsLost);
|
|
2136
2136
|
}
|
|
2137
2137
|
if (report.type === 'transport') {
|
|
2138
|
-
transportSent += report.bytesSent;
|
|
2139
|
-
transportReceived += report.bytesReceived;
|
|
2138
|
+
transportSent += Number(report.bytesSent);
|
|
2139
|
+
transportReceived += Number(report.bytesReceived);
|
|
2140
2140
|
}
|
|
2141
2141
|
});
|
|
2142
2142
|
|