@wazo/sdk 0.37.23 → 0.37.27
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/README.md +95 -57
- package/dist/wazo-sdk.js +3 -3
- package/esm/__tests__/api-client.test.js +12 -7
- package/esm/__tests__/web-rtc-client.test.js +47 -20
- package/esm/api/agentd.js +1 -1
- package/esm/api/amid.js +1 -1
- package/esm/api/application.js +1 -1
- package/esm/api/auth.js +1 -1
- package/esm/api/call-logd.js +1 -1
- package/esm/api/calld.js +1 -1
- package/esm/api/chatd.js +1 -1
- package/esm/api/confd.js +11 -6
- package/esm/api/ctid-ng.js +1 -1
- package/esm/api/dird.js +2 -2
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +12 -7
- package/esm/checker/Checker.js +47 -20
- package/esm/checker/checks/aor.js +12 -7
- package/esm/checker/checks/api.js +12 -7
- package/esm/checker/checks/index.js +47 -20
- package/esm/checker/checks/wazo-websocket.js +1 -1
- package/esm/checker/checks/webrtc-transport.js +47 -20
- package/esm/checker/checks/webrtc.js +47 -20
- package/esm/domain/AdHocAPIConference.js +12 -7
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +12 -7
- package/esm/domain/Meeting.js +12 -5
- package/esm/domain/Phone/CTIPhone.js +12 -7
- package/esm/domain/Phone/WebRTCPhone.js +34 -6
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/index.js +80 -25
- package/esm/lib/WazoSessionDescriptionHandler.js +9 -4
- package/esm/service/CallApi.js +12 -7
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +12 -7
- package/esm/simple/Auth.js +80 -25
- package/esm/simple/Configuration.js +80 -25
- package/esm/simple/Directory.js +12 -7
- package/esm/simple/Phone.js +80 -25
- package/esm/simple/Websocket.js +1 -1
- package/esm/simple/index.js +80 -25
- package/esm/simple/room/LocalParticipant.js +80 -25
- package/esm/simple/room/Participant.js +80 -25
- package/esm/simple/room/RemoteParticipant.js +80 -25
- package/esm/simple/room/Room.js +80 -25
- package/esm/simple/room/SipRoom.js +80 -25
- package/esm/simple/room/Stream.js +80 -25
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +80 -25
- package/esm/simple/utils.js +80 -25
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/utils/__tests__/api-requester.test.js +1 -1
- package/esm/utils/api-requester.js +1 -1
- package/esm/web-rtc-client.js +47 -20
- package/esm/websocket-client.js +1 -1
- package/lib/__tests__/api-client.test.js +12 -7
- package/lib/__tests__/web-rtc-client.test.js +47 -20
- package/lib/api/agentd.js +1 -1
- package/lib/api/amid.js +1 -1
- package/lib/api/application.js +1 -1
- package/lib/api/auth.js +1 -1
- package/lib/api/call-logd.js +1 -1
- package/lib/api/calld.js +1 -1
- package/lib/api/chatd.js +1 -1
- package/lib/api/confd.js +11 -6
- package/lib/api/ctid-ng.js +1 -1
- package/lib/api/dird.js +2 -2
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +12 -7
- package/lib/checker/Checker.js +47 -20
- package/lib/checker/checks/aor.js +12 -7
- package/lib/checker/checks/api.js +12 -7
- package/lib/checker/checks/index.js +47 -20
- package/lib/checker/checks/wazo-websocket.js +1 -1
- package/lib/checker/checks/webrtc-transport.js +47 -20
- package/lib/checker/checks/webrtc.js +47 -20
- package/lib/domain/AdHocAPIConference.js +12 -7
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +12 -7
- package/lib/domain/Meeting.js +16 -5
- package/lib/domain/Phone/CTIPhone.js +12 -7
- package/lib/domain/Phone/WebRTCPhone.js +34 -6
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/index.js +80 -25
- package/lib/lib/WazoSessionDescriptionHandler.js +9 -4
- package/lib/service/CallApi.js +12 -7
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +12 -7
- package/lib/simple/Auth.js +80 -25
- package/lib/simple/Configuration.js +80 -25
- package/lib/simple/Directory.js +12 -7
- package/lib/simple/Phone.js +80 -25
- package/lib/simple/Websocket.js +1 -1
- package/lib/simple/index.js +80 -25
- package/lib/simple/room/LocalParticipant.js +80 -25
- package/lib/simple/room/Participant.js +80 -25
- package/lib/simple/room/RemoteParticipant.js +80 -25
- package/lib/simple/room/Room.js +80 -25
- package/lib/simple/room/SipRoom.js +80 -25
- package/lib/simple/room/Stream.js +80 -25
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +80 -25
- package/lib/simple/utils.js +80 -25
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/utils/__tests__/api-requester.test.js +1 -1
- package/lib/utils/api-requester.js +1 -1
- package/lib/web-rtc-client.js +47 -20
- package/lib/websocket-client.js +1 -1
- package/package.json +1 -1
- package/src/domain/Contact.js +1 -1
- package/src/domain/Meeting.js +12 -5
- package/src/domain/Phone/WebRTCPhone.js +33 -5
- package/src/domain/__tests__/Meeting.test.js +50 -0
- package/src/lib/WazoSessionDescriptionHandler.js +8 -3
- package/src/utils/api-requester.js +1 -1
- package/src/web-rtc-client.js +27 -10
package/esm/web-rtc-client.js
CHANGED
|
@@ -104,7 +104,7 @@ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
104
104
|
|
|
105
105
|
// Use a function here to be able to mock it in tests
|
|
106
106
|
const realFetch = () => {
|
|
107
|
-
if (typeof document !== 'undefined') {
|
|
107
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
108
108
|
// Browser
|
|
109
109
|
return window.fetch;
|
|
110
110
|
}
|
|
@@ -823,11 +823,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
823
823
|
|
|
824
824
|
// $FlowFixMe
|
|
825
825
|
setRemoteSessionDescription(sessionDescription ) {
|
|
826
|
-
|
|
826
|
+
try {
|
|
827
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
827
828
|
|
|
828
|
-
|
|
829
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
829
830
|
|
|
830
|
-
|
|
831
|
+
return result;
|
|
832
|
+
} catch (error) {
|
|
833
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
834
|
+
throw error;
|
|
835
|
+
}
|
|
831
836
|
}
|
|
832
837
|
|
|
833
838
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -2447,7 +2452,7 @@ class Contact {
|
|
|
2447
2452
|
this[key] = old[key] || this[key];
|
|
2448
2453
|
});
|
|
2449
2454
|
|
|
2450
|
-
if (old.lineState
|
|
2455
|
+
if (old.lineState) {
|
|
2451
2456
|
this.lineState = old.lineState;
|
|
2452
2457
|
}
|
|
2453
2458
|
|
|
@@ -3154,8 +3159,9 @@ class ExternalApp {
|
|
|
3154
3159
|
|
|
3155
3160
|
|
|
3156
3161
|
|
|
3157
|
-
|
|
3162
|
+
|
|
3158
3163
|
|
|
3164
|
+
|
|
3159
3165
|
|
|
3160
3166
|
|
|
3161
3167
|
class Meeting {
|
|
@@ -3166,9 +3172,10 @@ class Meeting {
|
|
|
3166
3172
|
|
|
3167
3173
|
|
|
3168
3174
|
|
|
3169
|
-
|
|
3175
|
+
|
|
3170
3176
|
|
|
3171
3177
|
|
|
3178
|
+
|
|
3172
3179
|
|
|
3173
3180
|
static parse(plain ) {
|
|
3174
3181
|
return new Meeting({
|
|
@@ -3178,8 +3185,9 @@ class Meeting {
|
|
|
3178
3185
|
ownerUuids: plain.owner_uuids,
|
|
3179
3186
|
port: plain.port,
|
|
3180
3187
|
uuid: plain.uuid,
|
|
3181
|
-
|
|
3188
|
+
extension: plain.exten,
|
|
3182
3189
|
persistent: plain.persistent,
|
|
3190
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
3183
3191
|
});
|
|
3184
3192
|
}
|
|
3185
3193
|
|
|
@@ -3201,8 +3209,9 @@ class Meeting {
|
|
|
3201
3209
|
ownerUuids,
|
|
3202
3210
|
port,
|
|
3203
3211
|
uri,
|
|
3204
|
-
|
|
3212
|
+
extension,
|
|
3205
3213
|
persistent,
|
|
3214
|
+
creationTime,
|
|
3206
3215
|
} = {}) {
|
|
3207
3216
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3208
3217
|
this.uri = uri;
|
|
@@ -3210,8 +3219,9 @@ class Meeting {
|
|
|
3210
3219
|
this.ownerUuids = ownerUuids;
|
|
3211
3220
|
this.port = port;
|
|
3212
3221
|
this.uuid = uuid;
|
|
3213
|
-
this.
|
|
3222
|
+
this.extension = extension;
|
|
3214
3223
|
this.persistent = persistent;
|
|
3224
|
+
this.creationTime = creationTime;
|
|
3215
3225
|
|
|
3216
3226
|
// Useful to compare instead of instanceof with minified code
|
|
3217
3227
|
this.type = 'Meeting';
|
|
@@ -5703,7 +5713,7 @@ class WebRTCClient extends Emitter {
|
|
|
5703
5713
|
}
|
|
5704
5714
|
|
|
5705
5715
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
5706
|
-
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
5716
|
+
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
5707
5717
|
const inviterOptions = {
|
|
5708
5718
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
5709
5719
|
conference,
|
|
@@ -6779,6 +6789,7 @@ class WebRTCClient extends Emitter {
|
|
|
6779
6789
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
6780
6790
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
6781
6791
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
6792
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
6782
6793
|
|
|
6783
6794
|
logger.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
6784
6795
|
|
|
@@ -6786,7 +6797,8 @@ class WebRTCClient extends Emitter {
|
|
|
6786
6797
|
constraints: {
|
|
6787
6798
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
6788
6799
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
6789
|
-
video: screenSharing ? (isDesktop
|
|
6800
|
+
video: screenSharing ? (isDesktop
|
|
6801
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
6790
6802
|
: this._getVideoConstraints(enableVideo),
|
|
6791
6803
|
screen: screenSharing,
|
|
6792
6804
|
desktop: isDesktop,
|
|
@@ -7121,12 +7133,14 @@ class WebRTCClient extends Emitter {
|
|
|
7121
7133
|
|
|
7122
7134
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7123
7135
|
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7136
|
+
if (pc) {
|
|
7137
|
+
pc.oniceconnectionstatechange = () => {
|
|
7138
|
+
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7139
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7140
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7141
|
+
}
|
|
7142
|
+
};
|
|
7143
|
+
}
|
|
7130
7144
|
|
|
7131
7145
|
if (withEvent) {
|
|
7132
7146
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -7336,13 +7350,17 @@ class WebRTCClient extends Emitter {
|
|
|
7336
7350
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
7337
7351
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
7338
7352
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
7353
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
7339
7354
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
7340
7355
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
7356
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
7341
7357
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
7342
7358
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
7343
7359
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
7344
|
-
let audioBytesSent = 0;
|
|
7345
|
-
let audioBytesReceived = 0;
|
|
7360
|
+
let audioBytesSent = 0; // content + header
|
|
7361
|
+
let audioBytesReceived = 0; // content + header
|
|
7362
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
7363
|
+
let audioContentReceived = 0;
|
|
7346
7364
|
let videoBytesSent = 0;
|
|
7347
7365
|
let videoBytesReceived = 0;
|
|
7348
7366
|
let transportSent = 0;
|
|
@@ -7352,6 +7370,7 @@ class WebRTCClient extends Emitter {
|
|
|
7352
7370
|
stats.forEach(report => {
|
|
7353
7371
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7354
7372
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7373
|
+
audioContentSent += Number(report.bytesSent);
|
|
7355
7374
|
}
|
|
7356
7375
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7357
7376
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -7363,6 +7382,7 @@ class WebRTCClient extends Emitter {
|
|
|
7363
7382
|
packetsLost += Number(report.packetsLost);
|
|
7364
7383
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7365
7384
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7385
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
7366
7386
|
}
|
|
7367
7387
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7368
7388
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -7391,10 +7411,17 @@ class WebRTCClient extends Emitter {
|
|
|
7391
7411
|
});
|
|
7392
7412
|
|
|
7393
7413
|
networkStats.packetsLost = packetsLost;
|
|
7414
|
+
|
|
7394
7415
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7395
7416
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7396
7417
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7397
7418
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7419
|
+
|
|
7420
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
7421
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
7422
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
7423
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
7424
|
+
|
|
7398
7425
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7399
7426
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7400
7427
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
package/esm/websocket-client.js
CHANGED
|
@@ -39,7 +39,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
39
39
|
|
|
40
40
|
// Use a function here to be able to mock it in tests
|
|
41
41
|
const realFetch = () => {
|
|
42
|
-
if (typeof document !== 'undefined') {
|
|
42
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
43
43
|
// Browser
|
|
44
44
|
return window.fetch;
|
|
45
45
|
}
|
|
@@ -450,7 +450,7 @@ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
450
450
|
|
|
451
451
|
// Use a function here to be able to mock it in tests
|
|
452
452
|
const realFetch = () => {
|
|
453
|
-
if (typeof document !== 'undefined') {
|
|
453
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
454
454
|
// Browser
|
|
455
455
|
return window.fetch;
|
|
456
456
|
}
|
|
@@ -1910,7 +1910,7 @@ class Contact {
|
|
|
1910
1910
|
this[key] = old[key] || this[key];
|
|
1911
1911
|
});
|
|
1912
1912
|
|
|
1913
|
-
if (old.lineState
|
|
1913
|
+
if (old.lineState) {
|
|
1914
1914
|
this.lineState = old.lineState;
|
|
1915
1915
|
}
|
|
1916
1916
|
|
|
@@ -2617,8 +2617,9 @@ class ExternalApp {
|
|
|
2617
2617
|
|
|
2618
2618
|
|
|
2619
2619
|
|
|
2620
|
-
|
|
2620
|
+
|
|
2621
2621
|
|
|
2622
|
+
|
|
2622
2623
|
|
|
2623
2624
|
|
|
2624
2625
|
class Meeting {
|
|
@@ -2629,9 +2630,10 @@ class Meeting {
|
|
|
2629
2630
|
|
|
2630
2631
|
|
|
2631
2632
|
|
|
2632
|
-
|
|
2633
|
+
|
|
2633
2634
|
|
|
2634
2635
|
|
|
2636
|
+
|
|
2635
2637
|
|
|
2636
2638
|
static parse(plain ) {
|
|
2637
2639
|
return new Meeting({
|
|
@@ -2641,8 +2643,9 @@ class Meeting {
|
|
|
2641
2643
|
ownerUuids: plain.owner_uuids,
|
|
2642
2644
|
port: plain.port,
|
|
2643
2645
|
uuid: plain.uuid,
|
|
2644
|
-
|
|
2646
|
+
extension: plain.exten,
|
|
2645
2647
|
persistent: plain.persistent,
|
|
2648
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2646
2649
|
});
|
|
2647
2650
|
}
|
|
2648
2651
|
|
|
@@ -2664,8 +2667,9 @@ class Meeting {
|
|
|
2664
2667
|
ownerUuids,
|
|
2665
2668
|
port,
|
|
2666
2669
|
uri,
|
|
2667
|
-
|
|
2670
|
+
extension,
|
|
2668
2671
|
persistent,
|
|
2672
|
+
creationTime,
|
|
2669
2673
|
} = {}) {
|
|
2670
2674
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2671
2675
|
this.uri = uri;
|
|
@@ -2673,8 +2677,9 @@ class Meeting {
|
|
|
2673
2677
|
this.ownerUuids = ownerUuids;
|
|
2674
2678
|
this.port = port;
|
|
2675
2679
|
this.uuid = uuid;
|
|
2676
|
-
this.
|
|
2680
|
+
this.extension = extension;
|
|
2677
2681
|
this.persistent = persistent;
|
|
2682
|
+
this.creationTime = creationTime;
|
|
2678
2683
|
|
|
2679
2684
|
// Useful to compare instead of instanceof with minified code
|
|
2680
2685
|
this.type = 'Meeting';
|
|
@@ -113,7 +113,7 @@ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
113
113
|
|
|
114
114
|
// Use a function here to be able to mock it in tests
|
|
115
115
|
const realFetch = () => {
|
|
116
|
-
if (typeof document !== 'undefined') {
|
|
116
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
117
117
|
// Browser
|
|
118
118
|
return window.fetch;
|
|
119
119
|
}
|
|
@@ -832,11 +832,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
832
832
|
|
|
833
833
|
// $FlowFixMe
|
|
834
834
|
setRemoteSessionDescription(sessionDescription ) {
|
|
835
|
-
|
|
835
|
+
try {
|
|
836
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
836
837
|
|
|
837
|
-
|
|
838
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
838
839
|
|
|
839
|
-
|
|
840
|
+
return result;
|
|
841
|
+
} catch (error) {
|
|
842
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
843
|
+
throw error;
|
|
844
|
+
}
|
|
840
845
|
}
|
|
841
846
|
|
|
842
847
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -2456,7 +2461,7 @@ class Contact {
|
|
|
2456
2461
|
this[key] = old[key] || this[key];
|
|
2457
2462
|
});
|
|
2458
2463
|
|
|
2459
|
-
if (old.lineState
|
|
2464
|
+
if (old.lineState) {
|
|
2460
2465
|
this.lineState = old.lineState;
|
|
2461
2466
|
}
|
|
2462
2467
|
|
|
@@ -3163,8 +3168,9 @@ class ExternalApp {
|
|
|
3163
3168
|
|
|
3164
3169
|
|
|
3165
3170
|
|
|
3166
|
-
|
|
3171
|
+
|
|
3167
3172
|
|
|
3173
|
+
|
|
3168
3174
|
|
|
3169
3175
|
|
|
3170
3176
|
class Meeting {
|
|
@@ -3175,9 +3181,10 @@ class Meeting {
|
|
|
3175
3181
|
|
|
3176
3182
|
|
|
3177
3183
|
|
|
3178
|
-
|
|
3184
|
+
|
|
3179
3185
|
|
|
3180
3186
|
|
|
3187
|
+
|
|
3181
3188
|
|
|
3182
3189
|
static parse(plain ) {
|
|
3183
3190
|
return new Meeting({
|
|
@@ -3187,8 +3194,9 @@ class Meeting {
|
|
|
3187
3194
|
ownerUuids: plain.owner_uuids,
|
|
3188
3195
|
port: plain.port,
|
|
3189
3196
|
uuid: plain.uuid,
|
|
3190
|
-
|
|
3197
|
+
extension: plain.exten,
|
|
3191
3198
|
persistent: plain.persistent,
|
|
3199
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
3192
3200
|
});
|
|
3193
3201
|
}
|
|
3194
3202
|
|
|
@@ -3210,8 +3218,9 @@ class Meeting {
|
|
|
3210
3218
|
ownerUuids,
|
|
3211
3219
|
port,
|
|
3212
3220
|
uri,
|
|
3213
|
-
|
|
3221
|
+
extension,
|
|
3214
3222
|
persistent,
|
|
3223
|
+
creationTime,
|
|
3215
3224
|
} = {}) {
|
|
3216
3225
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3217
3226
|
this.uri = uri;
|
|
@@ -3219,8 +3228,9 @@ class Meeting {
|
|
|
3219
3228
|
this.ownerUuids = ownerUuids;
|
|
3220
3229
|
this.port = port;
|
|
3221
3230
|
this.uuid = uuid;
|
|
3222
|
-
this.
|
|
3231
|
+
this.extension = extension;
|
|
3223
3232
|
this.persistent = persistent;
|
|
3233
|
+
this.creationTime = creationTime;
|
|
3224
3234
|
|
|
3225
3235
|
// Useful to compare instead of instanceof with minified code
|
|
3226
3236
|
this.type = 'Meeting';
|
|
@@ -5709,7 +5719,7 @@ class WebRTCClient extends Emitter {
|
|
|
5709
5719
|
}
|
|
5710
5720
|
|
|
5711
5721
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
5712
|
-
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
5722
|
+
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
5713
5723
|
const inviterOptions = {
|
|
5714
5724
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
5715
5725
|
conference,
|
|
@@ -6785,6 +6795,7 @@ class WebRTCClient extends Emitter {
|
|
|
6785
6795
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
6786
6796
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
6787
6797
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
6798
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
6788
6799
|
|
|
6789
6800
|
logger.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
6790
6801
|
|
|
@@ -6792,7 +6803,8 @@ class WebRTCClient extends Emitter {
|
|
|
6792
6803
|
constraints: {
|
|
6793
6804
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
6794
6805
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
6795
|
-
video: screenSharing ? (isDesktop
|
|
6806
|
+
video: screenSharing ? (isDesktop
|
|
6807
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
6796
6808
|
: this._getVideoConstraints(enableVideo),
|
|
6797
6809
|
screen: screenSharing,
|
|
6798
6810
|
desktop: isDesktop,
|
|
@@ -7127,12 +7139,14 @@ class WebRTCClient extends Emitter {
|
|
|
7127
7139
|
|
|
7128
7140
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7129
7141
|
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7142
|
+
if (pc) {
|
|
7143
|
+
pc.oniceconnectionstatechange = () => {
|
|
7144
|
+
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7145
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7146
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7147
|
+
}
|
|
7148
|
+
};
|
|
7149
|
+
}
|
|
7136
7150
|
|
|
7137
7151
|
if (withEvent) {
|
|
7138
7152
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -7342,13 +7356,17 @@ class WebRTCClient extends Emitter {
|
|
|
7342
7356
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
7343
7357
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
7344
7358
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
7359
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
7345
7360
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
7346
7361
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
7362
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
7347
7363
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
7348
7364
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
7349
7365
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
7350
|
-
let audioBytesSent = 0;
|
|
7351
|
-
let audioBytesReceived = 0;
|
|
7366
|
+
let audioBytesSent = 0; // content + header
|
|
7367
|
+
let audioBytesReceived = 0; // content + header
|
|
7368
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
7369
|
+
let audioContentReceived = 0;
|
|
7352
7370
|
let videoBytesSent = 0;
|
|
7353
7371
|
let videoBytesReceived = 0;
|
|
7354
7372
|
let transportSent = 0;
|
|
@@ -7358,6 +7376,7 @@ class WebRTCClient extends Emitter {
|
|
|
7358
7376
|
stats.forEach(report => {
|
|
7359
7377
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7360
7378
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7379
|
+
audioContentSent += Number(report.bytesSent);
|
|
7361
7380
|
}
|
|
7362
7381
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7363
7382
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -7369,6 +7388,7 @@ class WebRTCClient extends Emitter {
|
|
|
7369
7388
|
packetsLost += Number(report.packetsLost);
|
|
7370
7389
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7371
7390
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7391
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
7372
7392
|
}
|
|
7373
7393
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7374
7394
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -7397,10 +7417,17 @@ class WebRTCClient extends Emitter {
|
|
|
7397
7417
|
});
|
|
7398
7418
|
|
|
7399
7419
|
networkStats.packetsLost = packetsLost;
|
|
7420
|
+
|
|
7400
7421
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7401
7422
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7402
7423
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7403
7424
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7425
|
+
|
|
7426
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
7427
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
7428
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
7429
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
7430
|
+
|
|
7404
7431
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7405
7432
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7406
7433
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
package/lib/api/agentd.js
CHANGED
|
@@ -446,7 +446,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
446
446
|
|
|
447
447
|
// Use a function here to be able to mock it in tests
|
|
448
448
|
const realFetch = () => {
|
|
449
|
-
if (typeof document !== 'undefined') {
|
|
449
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
450
450
|
// Browser
|
|
451
451
|
return window.fetch;
|
|
452
452
|
}
|
package/lib/api/amid.js
CHANGED
|
@@ -374,7 +374,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
374
374
|
|
|
375
375
|
// Use a function here to be able to mock it in tests
|
|
376
376
|
const realFetch = () => {
|
|
377
|
-
if (typeof document !== 'undefined') {
|
|
377
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
378
378
|
// Browser
|
|
379
379
|
return window.fetch;
|
|
380
380
|
}
|
package/lib/api/application.js
CHANGED
|
@@ -446,7 +446,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
446
446
|
|
|
447
447
|
// Use a function here to be able to mock it in tests
|
|
448
448
|
const realFetch = () => {
|
|
449
|
-
if (typeof document !== 'undefined') {
|
|
449
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
450
450
|
// Browser
|
|
451
451
|
return window.fetch;
|
|
452
452
|
}
|
package/lib/api/auth.js
CHANGED
|
@@ -449,7 +449,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
449
449
|
|
|
450
450
|
// Use a function here to be able to mock it in tests
|
|
451
451
|
const realFetch = () => {
|
|
452
|
-
if (typeof document !== 'undefined') {
|
|
452
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
453
453
|
// Browser
|
|
454
454
|
return window.fetch;
|
|
455
455
|
}
|
package/lib/api/call-logd.js
CHANGED
|
@@ -375,7 +375,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
375
375
|
|
|
376
376
|
// Use a function here to be able to mock it in tests
|
|
377
377
|
const realFetch = () => {
|
|
378
|
-
if (typeof document !== 'undefined') {
|
|
378
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
379
379
|
// Browser
|
|
380
380
|
return window.fetch;
|
|
381
381
|
}
|
package/lib/api/calld.js
CHANGED
|
@@ -447,7 +447,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
447
447
|
|
|
448
448
|
// Use a function here to be able to mock it in tests
|
|
449
449
|
const realFetch = () => {
|
|
450
|
-
if (typeof document !== 'undefined') {
|
|
450
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
451
451
|
// Browser
|
|
452
452
|
return window.fetch;
|
|
453
453
|
}
|
package/lib/api/chatd.js
CHANGED
|
@@ -446,7 +446,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
446
446
|
|
|
447
447
|
// Use a function here to be able to mock it in tests
|
|
448
448
|
const realFetch = () => {
|
|
449
|
-
if (typeof document !== 'undefined') {
|
|
449
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
450
450
|
// Browser
|
|
451
451
|
return window.fetch;
|
|
452
452
|
}
|
package/lib/api/confd.js
CHANGED
|
@@ -446,7 +446,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
446
446
|
|
|
447
447
|
// Use a function here to be able to mock it in tests
|
|
448
448
|
const realFetch = () => {
|
|
449
|
-
if (typeof document !== 'undefined') {
|
|
449
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
450
450
|
// Browser
|
|
451
451
|
return window.fetch;
|
|
452
452
|
}
|
|
@@ -1288,8 +1288,9 @@ class ExternalApp {
|
|
|
1288
1288
|
|
|
1289
1289
|
|
|
1290
1290
|
|
|
1291
|
-
|
|
1291
|
+
|
|
1292
1292
|
|
|
1293
|
+
|
|
1293
1294
|
|
|
1294
1295
|
|
|
1295
1296
|
class Meeting {
|
|
@@ -1300,9 +1301,10 @@ class Meeting {
|
|
|
1300
1301
|
|
|
1301
1302
|
|
|
1302
1303
|
|
|
1303
|
-
|
|
1304
|
+
|
|
1304
1305
|
|
|
1305
1306
|
|
|
1307
|
+
|
|
1306
1308
|
|
|
1307
1309
|
static parse(plain ) {
|
|
1308
1310
|
return new Meeting({
|
|
@@ -1312,8 +1314,9 @@ class Meeting {
|
|
|
1312
1314
|
ownerUuids: plain.owner_uuids,
|
|
1313
1315
|
port: plain.port,
|
|
1314
1316
|
uuid: plain.uuid,
|
|
1315
|
-
|
|
1317
|
+
extension: plain.exten,
|
|
1316
1318
|
persistent: plain.persistent,
|
|
1319
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
1317
1320
|
});
|
|
1318
1321
|
}
|
|
1319
1322
|
|
|
@@ -1335,8 +1338,9 @@ class Meeting {
|
|
|
1335
1338
|
ownerUuids,
|
|
1336
1339
|
port,
|
|
1337
1340
|
uri,
|
|
1338
|
-
|
|
1341
|
+
extension,
|
|
1339
1342
|
persistent,
|
|
1343
|
+
creationTime,
|
|
1340
1344
|
} = {}) {
|
|
1341
1345
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
1342
1346
|
this.uri = uri;
|
|
@@ -1344,8 +1348,9 @@ class Meeting {
|
|
|
1344
1348
|
this.ownerUuids = ownerUuids;
|
|
1345
1349
|
this.port = port;
|
|
1346
1350
|
this.uuid = uuid;
|
|
1347
|
-
this.
|
|
1351
|
+
this.extension = extension;
|
|
1348
1352
|
this.persistent = persistent;
|
|
1353
|
+
this.creationTime = creationTime;
|
|
1349
1354
|
|
|
1350
1355
|
// Useful to compare instead of instanceof with minified code
|
|
1351
1356
|
this.type = 'Meeting';
|
package/lib/api/ctid-ng.js
CHANGED
|
@@ -450,7 +450,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
450
450
|
|
|
451
451
|
// Use a function here to be able to mock it in tests
|
|
452
452
|
const realFetch = () => {
|
|
453
|
-
if (typeof document !== 'undefined') {
|
|
453
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
454
454
|
// Browser
|
|
455
455
|
return window.fetch;
|
|
456
456
|
}
|
package/lib/api/dird.js
CHANGED
|
@@ -448,7 +448,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
448
448
|
|
|
449
449
|
// Use a function here to be able to mock it in tests
|
|
450
450
|
const realFetch = () => {
|
|
451
|
-
if (typeof document !== 'undefined') {
|
|
451
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
452
452
|
// Browser
|
|
453
453
|
return window.fetch;
|
|
454
454
|
}
|
|
@@ -1394,7 +1394,7 @@ class Contact {
|
|
|
1394
1394
|
this[key] = old[key] || this[key];
|
|
1395
1395
|
});
|
|
1396
1396
|
|
|
1397
|
-
if (old.lineState
|
|
1397
|
+
if (old.lineState) {
|
|
1398
1398
|
this.lineState = old.lineState;
|
|
1399
1399
|
}
|
|
1400
1400
|
|
package/lib/api/webhookd.js
CHANGED
|
@@ -374,7 +374,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
374
374
|
|
|
375
375
|
// Use a function here to be able to mock it in tests
|
|
376
376
|
const realFetch = () => {
|
|
377
|
-
if (typeof document !== 'undefined') {
|
|
377
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
378
378
|
// Browser
|
|
379
379
|
return window.fetch;
|
|
380
380
|
}
|