@wazo/sdk 0.37.18 → 0.37.22
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 +13 -5
- package/esm/__tests__/api-client.test.js +52 -9
- package/esm/__tests__/web-rtc-client.test.js +80 -20
- package/esm/api/agentd.js +27 -4
- package/esm/api/amid.js +27 -4
- package/esm/api/application.js +27 -4
- package/esm/api/auth.js +29 -5
- package/esm/api/call-logd.js +29 -6
- package/esm/api/calld.js +27 -4
- package/esm/api/chatd.js +27 -4
- package/esm/api/confd.js +51 -8
- package/esm/api/ctid-ng.js +27 -4
- package/esm/api/dird.js +27 -4
- package/esm/api/webhookd.js +27 -4
- package/esm/api-client.js +54 -11
- package/esm/checker/Checker.js +83 -21
- package/esm/checker/checks/aor.js +54 -11
- package/esm/checker/checks/api.js +54 -11
- package/esm/checker/checks/ice-ipv4.js +1 -1
- package/esm/checker/checks/index.js +84 -22
- package/esm/checker/checks/symmetric-nat.js +1 -1
- package/esm/checker/checks/wazo-websocket.js +29 -4
- package/esm/checker/checks/webrtc-transport.js +82 -22
- package/esm/checker/checks/webrtc.js +82 -22
- package/esm/domain/AdHocAPIConference.js +54 -11
- package/esm/domain/Agent.js +1 -1
- package/esm/domain/BadResponse.js +1 -1
- package/esm/domain/Call.js +1 -1
- package/esm/domain/CallLog.js +3 -3
- package/esm/domain/CallSession.js +1 -1
- package/esm/domain/ChatMessage.js +1 -1
- package/esm/domain/ChatRoom.js +1 -1
- package/esm/domain/Contact.js +2 -1
- package/esm/domain/Country.js +1 -1
- package/esm/domain/Device/DebugDevice.js +1 -1
- package/esm/domain/ExternalApp.js +1 -1
- package/esm/domain/Features.js +54 -10
- package/esm/domain/ForwardOption.js +2 -1
- package/esm/domain/IndirectTransfer.js +1 -1
- package/esm/domain/Line.js +1 -1
- package/esm/domain/Meeting.js +20 -3
- package/esm/domain/NotificationOptions.js +1 -1
- package/esm/domain/Phone/CTIPhone.js +55 -11
- package/esm/domain/Phone/WebRTCPhone.js +39 -6
- package/esm/domain/Profile.js +2 -1
- package/esm/domain/Recording.js +2 -2
- package/esm/domain/Relocation.js +1 -1
- package/esm/domain/Room.js +1 -1
- package/esm/domain/ServerError.js +1 -1
- package/esm/domain/Session.js +2 -2
- package/esm/domain/SipLine.js +1 -1
- package/esm/domain/Subscription.js +1 -1
- package/esm/domain/SwitchboardCall.js +1 -1
- package/esm/domain/Voicemail.js +1 -1
- package/esm/domain/__tests__/CallLog.test.js +2 -2
- package/esm/index.js +101 -24
- package/esm/lib/WazoSessionDescriptionHandler.js +28 -4
- package/esm/service/CallApi.js +54 -11
- package/esm/service/IssueReporter.js +27 -4
- package/esm/service/__tests__/IssueReporter.test.js +26 -3
- package/esm/service/getApiClient.js +55 -11
- package/esm/simple/Auth.js +101 -23
- package/esm/simple/Configuration.js +100 -23
- package/esm/simple/Directory.js +53 -10
- package/esm/simple/Phone.js +100 -23
- package/esm/simple/Websocket.js +30 -4
- package/esm/simple/index.js +100 -23
- package/esm/simple/room/LocalParticipant.js +113 -40
- package/esm/simple/room/Participant.js +112 -37
- package/esm/simple/room/RemoteParticipant.js +114 -41
- package/esm/simple/room/Room.js +113 -37
- package/esm/simple/room/SipRoom.js +101 -26
- package/esm/simple/room/Stream.js +101 -26
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +99 -22
- package/esm/simple/utils.js +99 -22
- package/esm/utils/Emitter.js +1 -1
- package/esm/utils/Heartbeat.js +1 -1
- package/esm/utils/__tests__/api-requester.test.js +26 -3
- package/esm/utils/api-requester.js +28 -4
- package/esm/utils/compare-version.js +1 -1
- package/esm/utils/isMobile.js +1 -1
- package/esm/utils/new-from.js +1 -1
- package/esm/utils/once.js +1 -1
- package/esm/utils/update-from.js +1 -1
- package/esm/web-rtc-client.js +83 -22
- package/esm/websocket-client.js +30 -4
- package/lib/__tests__/api-client.test.js +61 -18
- package/lib/__tests__/web-rtc-client.test.js +97 -37
- package/lib/api/agentd.js +27 -4
- package/lib/api/amid.js +27 -4
- package/lib/api/application.js +27 -4
- package/lib/api/auth.js +28 -5
- package/lib/api/call-logd.js +34 -11
- package/lib/api/calld.js +30 -7
- package/lib/api/chatd.js +28 -5
- package/lib/api/confd.js +51 -8
- package/lib/api/ctid-ng.js +30 -7
- package/lib/api/dird.js +27 -4
- package/lib/api/webhookd.js +27 -4
- package/lib/api-client.js +61 -18
- package/lib/checker/Checker.js +100 -38
- package/lib/checker/checks/aor.js +61 -18
- package/lib/checker/checks/api.js +61 -18
- package/lib/checker/checks/index.js +100 -38
- package/lib/checker/checks/wazo-websocket.js +31 -6
- package/lib/checker/checks/webrtc-transport.js +97 -37
- package/lib/checker/checks/webrtc.js +97 -37
- package/lib/domain/AdHocAPIConference.js +61 -18
- package/lib/domain/Call.js +1 -1
- package/lib/domain/CallLog.js +7 -7
- package/lib/domain/ChatMessage.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +62 -19
- package/lib/domain/ForwardOption.js +1 -1
- package/lib/domain/Meeting.js +19 -2
- package/lib/domain/Phone/CTIPhone.js +63 -20
- package/lib/domain/Phone/WebRTCPhone.js +40 -8
- package/lib/domain/Profile.js +1 -1
- package/lib/domain/Recording.js +3 -3
- package/lib/domain/Voicemail.js +1 -1
- package/lib/domain/__tests__/Call.test.js +1 -1
- package/lib/domain/__tests__/CallLog.test.js +13 -13
- package/lib/domain/__tests__/Voicemail.test.js +1 -1
- package/lib/index.js +120 -43
- package/lib/lib/WazoSessionDescriptionHandler.js +32 -9
- package/lib/service/CallApi.js +61 -18
- package/lib/service/IssueReporter.js +27 -4
- package/lib/service/__tests__/IssueReporter.test.js +27 -4
- package/lib/service/getApiClient.js +62 -19
- package/lib/simple/Auth.js +119 -42
- package/lib/simple/Configuration.js +118 -41
- package/lib/simple/Directory.js +61 -18
- package/lib/simple/Phone.js +118 -41
- package/lib/simple/Websocket.js +32 -6
- package/lib/simple/index.js +118 -41
- package/lib/simple/room/LocalParticipant.js +132 -59
- package/lib/simple/room/Participant.js +130 -55
- package/lib/simple/room/RemoteParticipant.js +133 -60
- package/lib/simple/room/Room.js +131 -56
- package/lib/simple/room/SipRoom.js +120 -45
- package/lib/simple/room/Stream.js +120 -45
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +118 -41
- package/lib/simple/utils.js +118 -41
- package/lib/utils/Emitter.js +1 -1
- package/lib/utils/PhoneNumberUtil.js +2 -2
- package/lib/utils/__tests__/PhoneNumberUtil.test.js +2 -2
- package/lib/utils/__tests__/api-requester.test.js +27 -4
- package/lib/utils/__tests__/sdp.test.js +12 -12
- package/lib/utils/api-requester.js +28 -5
- package/lib/utils/sdp.js +10 -10
- package/lib/web-rtc-client.js +98 -38
- package/lib/websocket-client.js +33 -7
- 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 +11 -2
- 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 +28 -11
- package/src/websocket-client.js +2 -0
package/lib/simple/room/Room.js
CHANGED
|
@@ -161,6 +161,7 @@ class IssueReporter {
|
|
|
161
161
|
|
|
162
162
|
|
|
163
163
|
|
|
164
|
+
|
|
164
165
|
|
|
165
166
|
constructor() {
|
|
166
167
|
addLevelsTo(this);
|
|
@@ -172,12 +173,17 @@ class IssueReporter {
|
|
|
172
173
|
this.bufferTimeout = null;
|
|
173
174
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
174
175
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
176
|
+
this._callback = null;
|
|
175
177
|
}
|
|
176
178
|
|
|
177
179
|
init() {
|
|
178
180
|
this._catchConsole();
|
|
179
181
|
}
|
|
180
182
|
|
|
183
|
+
setCallback(cb ) {
|
|
184
|
+
this._callback = cb;
|
|
185
|
+
}
|
|
186
|
+
|
|
181
187
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
182
188
|
this.remoteClientConfiguration = configuration;
|
|
183
189
|
}
|
|
@@ -213,6 +219,7 @@ class IssueReporter {
|
|
|
213
219
|
|
|
214
220
|
// Handle category label
|
|
215
221
|
let category = null;
|
|
222
|
+
let skipSendToRemote = false;
|
|
216
223
|
let extra = {};
|
|
217
224
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
218
225
|
category = args[0].split('=')[1];
|
|
@@ -228,6 +235,7 @@ class IssueReporter {
|
|
|
228
235
|
errorMessage: lastArg.message,
|
|
229
236
|
errorStack: lastArg.stack,
|
|
230
237
|
errorType: lastArg.constructor.name,
|
|
238
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
231
239
|
};
|
|
232
240
|
} else {
|
|
233
241
|
extra = lastArg;
|
|
@@ -236,7 +244,12 @@ class IssueReporter {
|
|
|
236
244
|
args.splice(1, 1);
|
|
237
245
|
}
|
|
238
246
|
|
|
239
|
-
|
|
247
|
+
if (extra.skipSendToRemote) {
|
|
248
|
+
skipSendToRemote = true;
|
|
249
|
+
delete extra.skipSendToRemote;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
240
253
|
const message = args.join(', ');
|
|
241
254
|
let consoleMessage = message;
|
|
242
255
|
|
|
@@ -256,7 +269,13 @@ class IssueReporter {
|
|
|
256
269
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
257
270
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
258
271
|
|
|
259
|
-
this.
|
|
272
|
+
if (this._callback) {
|
|
273
|
+
this._callback(level, consoleMessage);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (!skipSendToRemote) {
|
|
277
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
278
|
+
}
|
|
260
279
|
}
|
|
261
280
|
|
|
262
281
|
logRequest(url , options , response , start ) {
|
|
@@ -401,7 +420,11 @@ class IssueReporter {
|
|
|
401
420
|
},
|
|
402
421
|
// $FlowFixMe
|
|
403
422
|
body,
|
|
404
|
-
}).catch(() => {
|
|
423
|
+
}).catch((e ) => {
|
|
424
|
+
// $FlowFixMe
|
|
425
|
+
e.skipSendToRemote = true;
|
|
426
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
427
|
+
|
|
405
428
|
setTimeout(() => {
|
|
406
429
|
if (isArray) {
|
|
407
430
|
payload = payload.map(message => {
|
|
@@ -413,7 +436,7 @@ class IssueReporter {
|
|
|
413
436
|
payload._retry = retry + 1;
|
|
414
437
|
}
|
|
415
438
|
|
|
416
|
-
this._sendDebugToGrafana(
|
|
439
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
417
440
|
}, 5000 + retry * 1000);
|
|
418
441
|
});
|
|
419
442
|
}
|
|
@@ -2616,7 +2639,8 @@ class ExternalApp {
|
|
|
2616
2639
|
|
|
2617
2640
|
|
|
2618
2641
|
|
|
2619
|
-
|
|
2642
|
+
|
|
2643
|
+
|
|
2620
2644
|
|
|
2621
2645
|
|
|
2622
2646
|
class Meeting {
|
|
@@ -2628,6 +2652,7 @@ class Meeting {
|
|
|
2628
2652
|
|
|
2629
2653
|
|
|
2630
2654
|
|
|
2655
|
+
|
|
2631
2656
|
|
|
2632
2657
|
|
|
2633
2658
|
static parse(plain ) {
|
|
@@ -2639,14 +2664,28 @@ class Meeting {
|
|
|
2639
2664
|
port: plain.port,
|
|
2640
2665
|
uuid: plain.uuid,
|
|
2641
2666
|
number: plain.number,
|
|
2667
|
+
persistent: plain.persistent,
|
|
2642
2668
|
});
|
|
2643
2669
|
}
|
|
2644
2670
|
|
|
2671
|
+
static parseMany(items ) {
|
|
2672
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2645
2675
|
static newFrom(meeting ) {
|
|
2646
2676
|
return newFrom(meeting, Meeting);
|
|
2647
2677
|
}
|
|
2648
2678
|
|
|
2649
|
-
constructor({
|
|
2679
|
+
constructor({
|
|
2680
|
+
uuid,
|
|
2681
|
+
name,
|
|
2682
|
+
guestSipAuthorization,
|
|
2683
|
+
ownerUuids,
|
|
2684
|
+
port,
|
|
2685
|
+
uri,
|
|
2686
|
+
number,
|
|
2687
|
+
persistent,
|
|
2688
|
+
} = {}) {
|
|
2650
2689
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2651
2690
|
this.uri = uri;
|
|
2652
2691
|
this.name = name;
|
|
@@ -2654,6 +2693,7 @@ class Meeting {
|
|
|
2654
2693
|
this.port = port;
|
|
2655
2694
|
this.uuid = uuid;
|
|
2656
2695
|
this.number = number;
|
|
2696
|
+
this.persistent = persistent;
|
|
2657
2697
|
|
|
2658
2698
|
// Useful to compare instead of instanceof with minified code
|
|
2659
2699
|
this.type = 'Meeting';
|
|
@@ -2731,8 +2771,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2731
2771
|
}
|
|
2732
2772
|
},
|
|
2733
2773
|
|
|
2734
|
-
|
|
2735
|
-
client.
|
|
2774
|
+
getMyMeetings: () =>
|
|
2775
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2776
|
+
|
|
2777
|
+
createMyMeeting: (name , persistent ) =>
|
|
2778
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2736
2779
|
|
|
2737
2780
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2738
2781
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -2834,7 +2877,7 @@ class ChatMessage {
|
|
|
2834
2877
|
static parse(plain ) {
|
|
2835
2878
|
return new ChatMessage({
|
|
2836
2879
|
uuid: plain.uuid,
|
|
2837
|
-
date: moment__default[
|
|
2880
|
+
date: moment__default['default'](plain.created_at).toDate(),
|
|
2838
2881
|
content: plain.content,
|
|
2839
2882
|
alias: plain.alias,
|
|
2840
2883
|
userUuid: plain.user_uuid,
|
|
@@ -2926,7 +2969,7 @@ class Voicemail {
|
|
|
2926
2969
|
static parse(plain ) {
|
|
2927
2970
|
return new Voicemail({
|
|
2928
2971
|
id: plain.id,
|
|
2929
|
-
date: moment__default[
|
|
2972
|
+
date: moment__default['default'](plain.timestamp * 1000).toDate(),
|
|
2930
2973
|
duration: plain.duration * 1000,
|
|
2931
2974
|
caller: {
|
|
2932
2975
|
name: plain.caller_id_name,
|
|
@@ -3063,7 +3106,7 @@ class Call {
|
|
|
3063
3106
|
onHold: plain.on_hold,
|
|
3064
3107
|
status: plain.status,
|
|
3065
3108
|
lineId: plain.line_id,
|
|
3066
|
-
startingTime: moment__default[
|
|
3109
|
+
startingTime: moment__default['default'](plain.creation_time).toDate(),
|
|
3067
3110
|
talkingToIds: Object.keys(plain.talking_to || {}),
|
|
3068
3111
|
recording: plain.record_state === RECORD_STATE_ACTIVE,
|
|
3069
3112
|
});
|
|
@@ -3543,7 +3586,7 @@ class Emitter {
|
|
|
3543
3586
|
|
|
3544
3587
|
|
|
3545
3588
|
constructor() {
|
|
3546
|
-
this.eventEmitter = new EventEmitter__default[
|
|
3589
|
+
this.eventEmitter = new EventEmitter__default['default']();
|
|
3547
3590
|
}
|
|
3548
3591
|
|
|
3549
3592
|
on(event , callback ) {
|
|
@@ -3588,7 +3631,7 @@ class Recording {
|
|
|
3588
3631
|
|
|
3589
3632
|
|
|
3590
3633
|
|
|
3591
|
-
static parseMany(recordings
|
|
3634
|
+
static parseMany(recordings = []) {
|
|
3592
3635
|
return recordings.map(item => Recording.parse(item));
|
|
3593
3636
|
}
|
|
3594
3637
|
|
|
@@ -3596,8 +3639,8 @@ class Recording {
|
|
|
3596
3639
|
return new Recording({
|
|
3597
3640
|
deleted: plain.deleted,
|
|
3598
3641
|
fileName: plain.filename,
|
|
3599
|
-
end: plain.end_time ? moment__default[
|
|
3600
|
-
start: moment__default[
|
|
3642
|
+
end: plain.end_time ? moment__default['default'](plain.end_time).toDate() : null,
|
|
3643
|
+
start: moment__default['default'](plain.start_time).toDate(),
|
|
3601
3644
|
uuid: plain.uuid,
|
|
3602
3645
|
});
|
|
3603
3646
|
}
|
|
@@ -3695,7 +3738,7 @@ class CallLog {
|
|
|
3695
3738
|
|
|
3696
3739
|
static parse(plain ) {
|
|
3697
3740
|
return new CallLog({
|
|
3698
|
-
answer: plain.answer ? moment__default[
|
|
3741
|
+
answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
|
|
3699
3742
|
answered: plain.answered,
|
|
3700
3743
|
callDirection: plain.call_direction,
|
|
3701
3744
|
destination: {
|
|
@@ -3712,9 +3755,9 @@ class CallLog {
|
|
|
3712
3755
|
},
|
|
3713
3756
|
id: plain.id,
|
|
3714
3757
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3715
|
-
start: moment__default[
|
|
3716
|
-
end: plain.end ? moment__default[
|
|
3717
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3758
|
+
start: moment__default['default'](plain.start).toDate(),
|
|
3759
|
+
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3760
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3718
3761
|
});
|
|
3719
3762
|
}
|
|
3720
3763
|
|
|
@@ -5888,7 +5931,7 @@ const parseCandidate$1 = (candidate ) => {
|
|
|
5888
5931
|
if (!candidate) {
|
|
5889
5932
|
return null;
|
|
5890
5933
|
}
|
|
5891
|
-
const result = sdpParser__default[
|
|
5934
|
+
const result = sdpParser__default['default'].parse(candidate.indexOf('a=') === 0 ? candidate : `a=${candidate}`);
|
|
5892
5935
|
|
|
5893
5936
|
return result.candidates ? result.candidates[0] : null;
|
|
5894
5937
|
};
|
|
@@ -5902,7 +5945,7 @@ const areCandidateValid = (candidates ) =>
|
|
|
5902
5945
|
.length > 0;
|
|
5903
5946
|
|
|
5904
5947
|
const getVideoDirection = (sdp ) => {
|
|
5905
|
-
const parsedSdp = sdpParser__default[
|
|
5948
|
+
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5906
5949
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
5907
5950
|
if (!videoMedia) {
|
|
5908
5951
|
return null;
|
|
@@ -5916,14 +5959,14 @@ const hasAnActiveVideo = (sdp ) => {
|
|
|
5916
5959
|
return false;
|
|
5917
5960
|
}
|
|
5918
5961
|
|
|
5919
|
-
const parsedSdp = sdpParser__default[
|
|
5962
|
+
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5920
5963
|
|
|
5921
5964
|
return !!parsedSdp.media.find(media =>
|
|
5922
5965
|
media.type === 'video' && media.port > 10 && (!media.direction || media.direction !== 'inactive'));
|
|
5923
5966
|
};
|
|
5924
5967
|
|
|
5925
5968
|
const fixSdp = (sdp , candidates , forcePort = true) => {
|
|
5926
|
-
const parsedSdp = sdpParser__default[
|
|
5969
|
+
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5927
5970
|
const mainCandidate = getSrflxOrRelay(candidates)[0];
|
|
5928
5971
|
const ip = mainCandidate ? mainCandidate.ip : null;
|
|
5929
5972
|
|
|
@@ -5941,7 +5984,7 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5941
5984
|
};
|
|
5942
5985
|
});
|
|
5943
5986
|
|
|
5944
|
-
let fixed = sdpParser__default[
|
|
5987
|
+
let fixed = sdpParser__default['default'].write(parsedSdp);
|
|
5945
5988
|
|
|
5946
5989
|
if (ip) {
|
|
5947
5990
|
fixed = fixed.replace(/IN IP4 0.0.0.0/g, `IN IP4 ${ip}`);
|
|
@@ -5987,7 +6030,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5987
6030
|
) {
|
|
5988
6031
|
super(logger, mediaStreamFactory, sessionDescriptionHandlerConfiguration);
|
|
5989
6032
|
|
|
5990
|
-
this.eventEmitter = new EventEmitter__default[
|
|
6033
|
+
this.eventEmitter = new EventEmitter__default['default']();
|
|
5991
6034
|
this.isWeb = isWeb;
|
|
5992
6035
|
this.session = session;
|
|
5993
6036
|
}
|
|
@@ -6968,7 +7011,9 @@ class WebRTCClient extends Emitter {
|
|
|
6968
7011
|
const inviteOptions = {
|
|
6969
7012
|
requestDelegate: {
|
|
6970
7013
|
onAccept: (response ) => {
|
|
6971
|
-
session.sessionDescriptionHandler.peerConnection
|
|
7014
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
7015
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
7016
|
+
}
|
|
6972
7017
|
this._onAccepted(session, response.session, true);
|
|
6973
7018
|
},
|
|
6974
7019
|
onReject: (response ) => {
|
|
@@ -7304,7 +7349,7 @@ class WebRTCClient extends Emitter {
|
|
|
7304
7349
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
7305
7350
|
const transceivers = pc.getTransceivers();
|
|
7306
7351
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
7307
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
7352
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
7308
7353
|
|
|
7309
7354
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
7310
7355
|
} else {
|
|
@@ -7840,6 +7885,16 @@ class WebRTCClient extends Emitter {
|
|
|
7840
7885
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7841
7886
|
}
|
|
7842
7887
|
|
|
7888
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7889
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7890
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7891
|
+
if (!pc) {
|
|
7892
|
+
return null;
|
|
7893
|
+
}
|
|
7894
|
+
|
|
7895
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7896
|
+
}
|
|
7897
|
+
|
|
7843
7898
|
hasVideo(sessionId ) {
|
|
7844
7899
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7845
7900
|
}
|
|
@@ -8350,6 +8405,7 @@ class WebRTCClient extends Emitter {
|
|
|
8350
8405
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8351
8406
|
|
|
8352
8407
|
pc.oniceconnectionstatechange = () => {
|
|
8408
|
+
logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8353
8409
|
if (pc.iceConnectionState === 'disconnected') {
|
|
8354
8410
|
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8355
8411
|
}
|
|
@@ -8509,7 +8565,7 @@ class WebRTCClient extends Emitter {
|
|
|
8509
8565
|
}
|
|
8510
8566
|
const sessionId = this.getSipSessionId(session);
|
|
8511
8567
|
|
|
8512
|
-
getStats__default[
|
|
8568
|
+
getStats__default['default'](pc, (result ) => {
|
|
8513
8569
|
const { results, internal, nomore, ...stats } = result;
|
|
8514
8570
|
this.statsIntervals[sessionId] = nomore;
|
|
8515
8571
|
|
|
@@ -8618,18 +8674,22 @@ class WebRTCClient extends Emitter {
|
|
|
8618
8674
|
});
|
|
8619
8675
|
|
|
8620
8676
|
networkStats.packetsLost = packetsLost;
|
|
8621
|
-
networkStats.
|
|
8677
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8678
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8679
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8622
8680
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8623
|
-
networkStats.
|
|
8624
|
-
networkStats.
|
|
8681
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8682
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8683
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8684
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8685
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8625
8686
|
networkStats.transportSent = transportSent;
|
|
8626
|
-
networkStats.
|
|
8627
|
-
|
|
8628
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
8629
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
8630
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
8687
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8688
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8631
8689
|
|
|
8632
|
-
networkStats.bandwidth =
|
|
8690
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8691
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8692
|
+
+ networkStats.transportSent;
|
|
8633
8693
|
|
|
8634
8694
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8635
8695
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -9011,7 +9071,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9011
9071
|
|
|
9012
9072
|
onCancel(message);
|
|
9013
9073
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
9014
|
-
|
|
9074
|
+
const callSession = this._createCallSession(sipSession);
|
|
9075
|
+
delete this.callSessions[callSession.getId()];
|
|
9076
|
+
|
|
9077
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
9015
9078
|
};
|
|
9016
9079
|
} else if (sipSession instanceof invitation.Invitation) {
|
|
9017
9080
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -9040,9 +9103,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9040
9103
|
case sessionState.SessionState.Terminated: {
|
|
9041
9104
|
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9042
9105
|
|
|
9106
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9107
|
+
const callSession = this._createCallSession(sipSession);
|
|
9043
9108
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9044
9109
|
|
|
9045
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
9110
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
9046
9111
|
}
|
|
9047
9112
|
}
|
|
9048
9113
|
});
|
|
@@ -9990,6 +10055,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9990
10055
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9991
10056
|
}
|
|
9992
10057
|
|
|
10058
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10059
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
10060
|
+
}
|
|
10061
|
+
|
|
9993
10062
|
hasRemoteVideo(callSession ) {
|
|
9994
10063
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9995
10064
|
}
|
|
@@ -10673,6 +10742,11 @@ class Phone extends Emitter {
|
|
|
10673
10742
|
return this.getRemoteVideoStream(callSession);
|
|
10674
10743
|
}
|
|
10675
10744
|
|
|
10745
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
10746
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10747
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
10748
|
+
}
|
|
10749
|
+
|
|
10676
10750
|
hasVideo(callSession ) {
|
|
10677
10751
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
10678
10752
|
}
|
|
@@ -10832,6 +10906,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10832
10906
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10833
10907
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10834
10908
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10909
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10835
10910
|
|
|
10836
10911
|
const BLACKLIST_EVENTS = [
|
|
10837
10912
|
CHAT_MESSAGE_SENT,
|
|
@@ -10891,7 +10966,7 @@ class WebSocketClient extends Emitter {
|
|
|
10891
10966
|
|
|
10892
10967
|
connect() {
|
|
10893
10968
|
logger$5.info('connect method started', { host: this.host, token: this.token });
|
|
10894
|
-
this.socket = new ReconnectingWebSocket__default[
|
|
10969
|
+
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
10895
10970
|
if (this.options.binaryType) {
|
|
10896
10971
|
this.socket.binaryType = this.options.binaryType;
|
|
10897
10972
|
}
|
|
@@ -11182,6 +11257,7 @@ WebSocketClient.eventLists = [
|
|
|
11182
11257
|
AGENT_UNPAUSED,
|
|
11183
11258
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11184
11259
|
CONFERENCE_ADHOC_DELETED,
|
|
11260
|
+
MEETING_USER_PROGRESS,
|
|
11185
11261
|
];
|
|
11186
11262
|
|
|
11187
11263
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -11252,6 +11328,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11252
11328
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
11253
11329
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11254
11330
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
11331
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
11255
11332
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
11256
11333
|
'default': WebSocketClient
|
|
11257
11334
|
});
|
|
@@ -11343,7 +11420,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11343
11420
|
|
|
11344
11421
|
const logger$3 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
11345
11422
|
|
|
11346
|
-
class SipRoom extends Room
|
|
11423
|
+
class SipRoom extends Room {
|
|
11347
11424
|
|
|
11348
11425
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
11349
11426
|
logger$3.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
@@ -11968,7 +12045,7 @@ class NotificationOptions {
|
|
|
11968
12045
|
|
|
11969
12046
|
|
|
11970
12047
|
// Represents a conference room, like `9000`.
|
|
11971
|
-
class Room$
|
|
12048
|
+
class Room$1 {
|
|
11972
12049
|
|
|
11973
12050
|
|
|
11974
12051
|
|
|
@@ -11989,7 +12066,7 @@ class Room$2 {
|
|
|
11989
12066
|
}
|
|
11990
12067
|
|
|
11991
12068
|
connect(callSession ) {
|
|
11992
|
-
return new Room$
|
|
12069
|
+
return new Room$1({ ...this, connectedCallSession: callSession });
|
|
11993
12070
|
}
|
|
11994
12071
|
|
|
11995
12072
|
has(callSession ) {
|
|
@@ -11998,7 +12075,7 @@ class Room$2 {
|
|
|
11998
12075
|
|
|
11999
12076
|
addParticipant(uuid , extension , talking = null) {
|
|
12000
12077
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12001
|
-
return new Room$
|
|
12078
|
+
return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12002
12079
|
}
|
|
12003
12080
|
|
|
12004
12081
|
return this;
|
|
@@ -12017,7 +12094,7 @@ class Room$2 {
|
|
|
12017
12094
|
updatedParticipants.push(participant);
|
|
12018
12095
|
}
|
|
12019
12096
|
|
|
12020
|
-
return new Room$
|
|
12097
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12021
12098
|
}
|
|
12022
12099
|
|
|
12023
12100
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12033,7 +12110,7 @@ class Room$2 {
|
|
|
12033
12110
|
updatedParticipants.push(participant);
|
|
12034
12111
|
}
|
|
12035
12112
|
|
|
12036
|
-
return new Room$
|
|
12113
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12037
12114
|
}
|
|
12038
12115
|
|
|
12039
12116
|
hasCallWithId(id ) {
|
|
@@ -12041,18 +12118,18 @@ class Room$2 {
|
|
|
12041
12118
|
}
|
|
12042
12119
|
|
|
12043
12120
|
disconnect() {
|
|
12044
|
-
return new Room$
|
|
12121
|
+
return new Room$1({ ...this, connectedCallSession: null });
|
|
12045
12122
|
}
|
|
12046
12123
|
|
|
12047
12124
|
removeParticipantWithUUID(uuid ) {
|
|
12048
|
-
return new Room$
|
|
12125
|
+
return new Room$1({
|
|
12049
12126
|
...this,
|
|
12050
12127
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12051
12128
|
});
|
|
12052
12129
|
}
|
|
12053
12130
|
|
|
12054
12131
|
removeParticipantWithExtension(extension ) {
|
|
12055
|
-
return new Room$
|
|
12132
|
+
return new Room$1({
|
|
12056
12133
|
...this,
|
|
12057
12134
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12058
12135
|
});
|
|
@@ -12063,7 +12140,7 @@ class Room$2 {
|
|
|
12063
12140
|
}
|
|
12064
12141
|
|
|
12065
12142
|
static newFrom(room ) {
|
|
12066
|
-
return newFrom(room, Room$
|
|
12143
|
+
return newFrom(room, Room$1);
|
|
12067
12144
|
}
|
|
12068
12145
|
}
|
|
12069
12146
|
|
|
@@ -12734,7 +12811,7 @@ const Wazo = {
|
|
|
12734
12811
|
Auth: Auth$1,
|
|
12735
12812
|
Phone: Phone$1,
|
|
12736
12813
|
Websocket: Websocket$1,
|
|
12737
|
-
Room
|
|
12814
|
+
Room,
|
|
12738
12815
|
SipRoom,
|
|
12739
12816
|
RemoteParticipant,
|
|
12740
12817
|
LocalParticipant,
|
|
@@ -12767,7 +12844,7 @@ const Wazo = {
|
|
|
12767
12844
|
Session,
|
|
12768
12845
|
Voicemail,
|
|
12769
12846
|
Relocation,
|
|
12770
|
-
ConferenceRoom: Room$
|
|
12847
|
+
ConferenceRoom: Room$1,
|
|
12771
12848
|
CallSession,
|
|
12772
12849
|
IndirectTransfer,
|
|
12773
12850
|
SwitchboardCall,
|
|
@@ -13300,7 +13377,7 @@ class Room extends Emitter {
|
|
|
13300
13377
|
}
|
|
13301
13378
|
|
|
13302
13379
|
_mapMsid(rawSdp ) {
|
|
13303
|
-
const sdp = sdpParser__default[
|
|
13380
|
+
const sdp = sdpParser__default['default'].parse(rawSdp);
|
|
13304
13381
|
const labelMsidArray = sdp.media.filter(media => !!media.label).map(({ label, msid }) => ({
|
|
13305
13382
|
label: String(label),
|
|
13306
13383
|
streamId: msid.split(' ')[0],
|
|
@@ -13637,8 +13714,6 @@ class Room extends Emitter {
|
|
|
13637
13714
|
}
|
|
13638
13715
|
}
|
|
13639
13716
|
|
|
13640
|
-
var Room$1 = Room;
|
|
13641
|
-
|
|
13642
13717
|
exports.SIGNAL_TYPE_PARTICIPANT_REQUEST = SIGNAL_TYPE_PARTICIPANT_REQUEST;
|
|
13643
13718
|
exports.SIGNAL_TYPE_PARTICIPANT_UPDATE = SIGNAL_TYPE_PARTICIPANT_UPDATE;
|
|
13644
|
-
exports
|
|
13719
|
+
exports.default = Room;
|