@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
|
@@ -159,6 +159,7 @@ class IssueReporter {
|
|
|
159
159
|
|
|
160
160
|
|
|
161
161
|
|
|
162
|
+
|
|
162
163
|
|
|
163
164
|
constructor() {
|
|
164
165
|
addLevelsTo(this);
|
|
@@ -170,12 +171,17 @@ class IssueReporter {
|
|
|
170
171
|
this.bufferTimeout = null;
|
|
171
172
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
172
173
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
174
|
+
this._callback = null;
|
|
173
175
|
}
|
|
174
176
|
|
|
175
177
|
init() {
|
|
176
178
|
this._catchConsole();
|
|
177
179
|
}
|
|
178
180
|
|
|
181
|
+
setCallback(cb ) {
|
|
182
|
+
this._callback = cb;
|
|
183
|
+
}
|
|
184
|
+
|
|
179
185
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
180
186
|
this.remoteClientConfiguration = configuration;
|
|
181
187
|
}
|
|
@@ -211,6 +217,7 @@ class IssueReporter {
|
|
|
211
217
|
|
|
212
218
|
// Handle category label
|
|
213
219
|
let category = null;
|
|
220
|
+
let skipSendToRemote = false;
|
|
214
221
|
let extra = {};
|
|
215
222
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
216
223
|
category = args[0].split('=')[1];
|
|
@@ -226,6 +233,7 @@ class IssueReporter {
|
|
|
226
233
|
errorMessage: lastArg.message,
|
|
227
234
|
errorStack: lastArg.stack,
|
|
228
235
|
errorType: lastArg.constructor.name,
|
|
236
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
229
237
|
};
|
|
230
238
|
} else {
|
|
231
239
|
extra = lastArg;
|
|
@@ -234,7 +242,12 @@ class IssueReporter {
|
|
|
234
242
|
args.splice(1, 1);
|
|
235
243
|
}
|
|
236
244
|
|
|
237
|
-
|
|
245
|
+
if (extra.skipSendToRemote) {
|
|
246
|
+
skipSendToRemote = true;
|
|
247
|
+
delete extra.skipSendToRemote;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
238
251
|
const message = args.join(', ');
|
|
239
252
|
let consoleMessage = message;
|
|
240
253
|
|
|
@@ -254,7 +267,13 @@ class IssueReporter {
|
|
|
254
267
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
255
268
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
256
269
|
|
|
257
|
-
this.
|
|
270
|
+
if (this._callback) {
|
|
271
|
+
this._callback(level, consoleMessage);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (!skipSendToRemote) {
|
|
275
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
276
|
+
}
|
|
258
277
|
}
|
|
259
278
|
|
|
260
279
|
logRequest(url , options , response , start ) {
|
|
@@ -399,7 +418,11 @@ class IssueReporter {
|
|
|
399
418
|
},
|
|
400
419
|
// $FlowFixMe
|
|
401
420
|
body,
|
|
402
|
-
}).catch(() => {
|
|
421
|
+
}).catch((e ) => {
|
|
422
|
+
// $FlowFixMe
|
|
423
|
+
e.skipSendToRemote = true;
|
|
424
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
425
|
+
|
|
403
426
|
setTimeout(() => {
|
|
404
427
|
if (isArray) {
|
|
405
428
|
payload = payload.map(message => {
|
|
@@ -411,7 +434,7 @@ class IssueReporter {
|
|
|
411
434
|
payload._retry = retry + 1;
|
|
412
435
|
}
|
|
413
436
|
|
|
414
|
-
this._sendDebugToGrafana(
|
|
437
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
415
438
|
}, 5000 + retry * 1000);
|
|
416
439
|
});
|
|
417
440
|
}
|
|
@@ -2614,7 +2637,8 @@ class ExternalApp {
|
|
|
2614
2637
|
|
|
2615
2638
|
|
|
2616
2639
|
|
|
2617
|
-
|
|
2640
|
+
|
|
2641
|
+
|
|
2618
2642
|
|
|
2619
2643
|
|
|
2620
2644
|
class Meeting {
|
|
@@ -2626,6 +2650,7 @@ class Meeting {
|
|
|
2626
2650
|
|
|
2627
2651
|
|
|
2628
2652
|
|
|
2653
|
+
|
|
2629
2654
|
|
|
2630
2655
|
|
|
2631
2656
|
static parse(plain ) {
|
|
@@ -2637,14 +2662,28 @@ class Meeting {
|
|
|
2637
2662
|
port: plain.port,
|
|
2638
2663
|
uuid: plain.uuid,
|
|
2639
2664
|
number: plain.number,
|
|
2665
|
+
persistent: plain.persistent,
|
|
2640
2666
|
});
|
|
2641
2667
|
}
|
|
2642
2668
|
|
|
2669
|
+
static parseMany(items ) {
|
|
2670
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2643
2673
|
static newFrom(meeting ) {
|
|
2644
2674
|
return newFrom(meeting, Meeting);
|
|
2645
2675
|
}
|
|
2646
2676
|
|
|
2647
|
-
constructor({
|
|
2677
|
+
constructor({
|
|
2678
|
+
uuid,
|
|
2679
|
+
name,
|
|
2680
|
+
guestSipAuthorization,
|
|
2681
|
+
ownerUuids,
|
|
2682
|
+
port,
|
|
2683
|
+
uri,
|
|
2684
|
+
number,
|
|
2685
|
+
persistent,
|
|
2686
|
+
} = {}) {
|
|
2648
2687
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2649
2688
|
this.uri = uri;
|
|
2650
2689
|
this.name = name;
|
|
@@ -2652,6 +2691,7 @@ class Meeting {
|
|
|
2652
2691
|
this.port = port;
|
|
2653
2692
|
this.uuid = uuid;
|
|
2654
2693
|
this.number = number;
|
|
2694
|
+
this.persistent = persistent;
|
|
2655
2695
|
|
|
2656
2696
|
// Useful to compare instead of instanceof with minified code
|
|
2657
2697
|
this.type = 'Meeting';
|
|
@@ -2729,8 +2769,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2729
2769
|
}
|
|
2730
2770
|
},
|
|
2731
2771
|
|
|
2732
|
-
|
|
2733
|
-
client.
|
|
2772
|
+
getMyMeetings: () =>
|
|
2773
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2774
|
+
|
|
2775
|
+
createMyMeeting: (name , persistent ) =>
|
|
2776
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2734
2777
|
|
|
2735
2778
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2736
2779
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -2832,7 +2875,7 @@ class ChatMessage {
|
|
|
2832
2875
|
static parse(plain ) {
|
|
2833
2876
|
return new ChatMessage({
|
|
2834
2877
|
uuid: plain.uuid,
|
|
2835
|
-
date: moment__default[
|
|
2878
|
+
date: moment__default['default'](plain.created_at).toDate(),
|
|
2836
2879
|
content: plain.content,
|
|
2837
2880
|
alias: plain.alias,
|
|
2838
2881
|
userUuid: plain.user_uuid,
|
|
@@ -2924,7 +2967,7 @@ class Voicemail {
|
|
|
2924
2967
|
static parse(plain ) {
|
|
2925
2968
|
return new Voicemail({
|
|
2926
2969
|
id: plain.id,
|
|
2927
|
-
date: moment__default[
|
|
2970
|
+
date: moment__default['default'](plain.timestamp * 1000).toDate(),
|
|
2928
2971
|
duration: plain.duration * 1000,
|
|
2929
2972
|
caller: {
|
|
2930
2973
|
name: plain.caller_id_name,
|
|
@@ -3061,7 +3104,7 @@ class Call {
|
|
|
3061
3104
|
onHold: plain.on_hold,
|
|
3062
3105
|
status: plain.status,
|
|
3063
3106
|
lineId: plain.line_id,
|
|
3064
|
-
startingTime: moment__default[
|
|
3107
|
+
startingTime: moment__default['default'](plain.creation_time).toDate(),
|
|
3065
3108
|
talkingToIds: Object.keys(plain.talking_to || {}),
|
|
3066
3109
|
recording: plain.record_state === RECORD_STATE_ACTIVE,
|
|
3067
3110
|
});
|
|
@@ -3541,7 +3584,7 @@ class Emitter {
|
|
|
3541
3584
|
|
|
3542
3585
|
|
|
3543
3586
|
constructor() {
|
|
3544
|
-
this.eventEmitter = new EventEmitter__default[
|
|
3587
|
+
this.eventEmitter = new EventEmitter__default['default']();
|
|
3545
3588
|
}
|
|
3546
3589
|
|
|
3547
3590
|
on(event , callback ) {
|
|
@@ -3586,7 +3629,7 @@ class Recording {
|
|
|
3586
3629
|
|
|
3587
3630
|
|
|
3588
3631
|
|
|
3589
|
-
static parseMany(recordings
|
|
3632
|
+
static parseMany(recordings = []) {
|
|
3590
3633
|
return recordings.map(item => Recording.parse(item));
|
|
3591
3634
|
}
|
|
3592
3635
|
|
|
@@ -3594,8 +3637,8 @@ class Recording {
|
|
|
3594
3637
|
return new Recording({
|
|
3595
3638
|
deleted: plain.deleted,
|
|
3596
3639
|
fileName: plain.filename,
|
|
3597
|
-
end: plain.end_time ? moment__default[
|
|
3598
|
-
start: moment__default[
|
|
3640
|
+
end: plain.end_time ? moment__default['default'](plain.end_time).toDate() : null,
|
|
3641
|
+
start: moment__default['default'](plain.start_time).toDate(),
|
|
3599
3642
|
uuid: plain.uuid,
|
|
3600
3643
|
});
|
|
3601
3644
|
}
|
|
@@ -3693,7 +3736,7 @@ class CallLog {
|
|
|
3693
3736
|
|
|
3694
3737
|
static parse(plain ) {
|
|
3695
3738
|
return new CallLog({
|
|
3696
|
-
answer: plain.answer ? moment__default[
|
|
3739
|
+
answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
|
|
3697
3740
|
answered: plain.answered,
|
|
3698
3741
|
callDirection: plain.call_direction,
|
|
3699
3742
|
destination: {
|
|
@@ -3710,9 +3753,9 @@ class CallLog {
|
|
|
3710
3753
|
},
|
|
3711
3754
|
id: plain.id,
|
|
3712
3755
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3713
|
-
start: moment__default[
|
|
3714
|
-
end: plain.end ? moment__default[
|
|
3715
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3756
|
+
start: moment__default['default'](plain.start).toDate(),
|
|
3757
|
+
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3758
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3716
3759
|
});
|
|
3717
3760
|
}
|
|
3718
3761
|
|
|
@@ -5886,7 +5929,7 @@ const parseCandidate$1 = (candidate ) => {
|
|
|
5886
5929
|
if (!candidate) {
|
|
5887
5930
|
return null;
|
|
5888
5931
|
}
|
|
5889
|
-
const result = sdpParser__default[
|
|
5932
|
+
const result = sdpParser__default['default'].parse(candidate.indexOf('a=') === 0 ? candidate : `a=${candidate}`);
|
|
5890
5933
|
|
|
5891
5934
|
return result.candidates ? result.candidates[0] : null;
|
|
5892
5935
|
};
|
|
@@ -5900,7 +5943,7 @@ const areCandidateValid = (candidates ) =>
|
|
|
5900
5943
|
.length > 0;
|
|
5901
5944
|
|
|
5902
5945
|
const getVideoDirection = (sdp ) => {
|
|
5903
|
-
const parsedSdp = sdpParser__default[
|
|
5946
|
+
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5904
5947
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
5905
5948
|
if (!videoMedia) {
|
|
5906
5949
|
return null;
|
|
@@ -5914,14 +5957,14 @@ const hasAnActiveVideo = (sdp ) => {
|
|
|
5914
5957
|
return false;
|
|
5915
5958
|
}
|
|
5916
5959
|
|
|
5917
|
-
const parsedSdp = sdpParser__default[
|
|
5960
|
+
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5918
5961
|
|
|
5919
5962
|
return !!parsedSdp.media.find(media =>
|
|
5920
5963
|
media.type === 'video' && media.port > 10 && (!media.direction || media.direction !== 'inactive'));
|
|
5921
5964
|
};
|
|
5922
5965
|
|
|
5923
5966
|
const fixSdp = (sdp , candidates , forcePort = true) => {
|
|
5924
|
-
const parsedSdp = sdpParser__default[
|
|
5967
|
+
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5925
5968
|
const mainCandidate = getSrflxOrRelay(candidates)[0];
|
|
5926
5969
|
const ip = mainCandidate ? mainCandidate.ip : null;
|
|
5927
5970
|
|
|
@@ -5939,7 +5982,7 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5939
5982
|
};
|
|
5940
5983
|
});
|
|
5941
5984
|
|
|
5942
|
-
let fixed = sdpParser__default[
|
|
5985
|
+
let fixed = sdpParser__default['default'].write(parsedSdp);
|
|
5943
5986
|
|
|
5944
5987
|
if (ip) {
|
|
5945
5988
|
fixed = fixed.replace(/IN IP4 0.0.0.0/g, `IN IP4 ${ip}`);
|
|
@@ -5985,7 +6028,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5985
6028
|
) {
|
|
5986
6029
|
super(logger, mediaStreamFactory, sessionDescriptionHandlerConfiguration);
|
|
5987
6030
|
|
|
5988
|
-
this.eventEmitter = new EventEmitter__default[
|
|
6031
|
+
this.eventEmitter = new EventEmitter__default['default']();
|
|
5989
6032
|
this.isWeb = isWeb;
|
|
5990
6033
|
this.session = session;
|
|
5991
6034
|
}
|
|
@@ -6966,7 +7009,9 @@ class WebRTCClient extends Emitter {
|
|
|
6966
7009
|
const inviteOptions = {
|
|
6967
7010
|
requestDelegate: {
|
|
6968
7011
|
onAccept: (response ) => {
|
|
6969
|
-
session.sessionDescriptionHandler.peerConnection
|
|
7012
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
7013
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
7014
|
+
}
|
|
6970
7015
|
this._onAccepted(session, response.session, true);
|
|
6971
7016
|
},
|
|
6972
7017
|
onReject: (response ) => {
|
|
@@ -7302,7 +7347,7 @@ class WebRTCClient extends Emitter {
|
|
|
7302
7347
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
7303
7348
|
const transceivers = pc.getTransceivers();
|
|
7304
7349
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
7305
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
7350
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
7306
7351
|
|
|
7307
7352
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
7308
7353
|
} else {
|
|
@@ -7838,6 +7883,16 @@ class WebRTCClient extends Emitter {
|
|
|
7838
7883
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7839
7884
|
}
|
|
7840
7885
|
|
|
7886
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7887
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7888
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7889
|
+
if (!pc) {
|
|
7890
|
+
return null;
|
|
7891
|
+
}
|
|
7892
|
+
|
|
7893
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7894
|
+
}
|
|
7895
|
+
|
|
7841
7896
|
hasVideo(sessionId ) {
|
|
7842
7897
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7843
7898
|
}
|
|
@@ -8348,6 +8403,7 @@ class WebRTCClient extends Emitter {
|
|
|
8348
8403
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8349
8404
|
|
|
8350
8405
|
pc.oniceconnectionstatechange = () => {
|
|
8406
|
+
logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8351
8407
|
if (pc.iceConnectionState === 'disconnected') {
|
|
8352
8408
|
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8353
8409
|
}
|
|
@@ -8507,7 +8563,7 @@ class WebRTCClient extends Emitter {
|
|
|
8507
8563
|
}
|
|
8508
8564
|
const sessionId = this.getSipSessionId(session);
|
|
8509
8565
|
|
|
8510
|
-
getStats__default[
|
|
8566
|
+
getStats__default['default'](pc, (result ) => {
|
|
8511
8567
|
const { results, internal, nomore, ...stats } = result;
|
|
8512
8568
|
this.statsIntervals[sessionId] = nomore;
|
|
8513
8569
|
|
|
@@ -8616,18 +8672,22 @@ class WebRTCClient extends Emitter {
|
|
|
8616
8672
|
});
|
|
8617
8673
|
|
|
8618
8674
|
networkStats.packetsLost = packetsLost;
|
|
8619
|
-
networkStats.
|
|
8675
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8676
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8677
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8620
8678
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8621
|
-
networkStats.
|
|
8622
|
-
networkStats.
|
|
8679
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8680
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8681
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8682
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8683
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8623
8684
|
networkStats.transportSent = transportSent;
|
|
8624
|
-
networkStats.
|
|
8685
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8686
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8625
8687
|
|
|
8626
|
-
|
|
8627
|
-
+
|
|
8628
|
-
+
|
|
8629
|
-
|
|
8630
|
-
networkStats.bandwidth = bandwidth;
|
|
8688
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8689
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8690
|
+
+ networkStats.transportSent;
|
|
8631
8691
|
|
|
8632
8692
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8633
8693
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -9009,7 +9069,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9009
9069
|
|
|
9010
9070
|
onCancel(message);
|
|
9011
9071
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
9012
|
-
|
|
9072
|
+
const callSession = this._createCallSession(sipSession);
|
|
9073
|
+
delete this.callSessions[callSession.getId()];
|
|
9074
|
+
|
|
9075
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
9013
9076
|
};
|
|
9014
9077
|
} else if (sipSession instanceof invitation.Invitation) {
|
|
9015
9078
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -9038,9 +9101,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9038
9101
|
case sessionState.SessionState.Terminated: {
|
|
9039
9102
|
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9040
9103
|
|
|
9104
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9105
|
+
const callSession = this._createCallSession(sipSession);
|
|
9041
9106
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9042
9107
|
|
|
9043
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
9108
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
9044
9109
|
}
|
|
9045
9110
|
}
|
|
9046
9111
|
});
|
|
@@ -9988,6 +10053,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9988
10053
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
9989
10054
|
}
|
|
9990
10055
|
|
|
10056
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10057
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
10058
|
+
}
|
|
10059
|
+
|
|
9991
10060
|
hasRemoteVideo(callSession ) {
|
|
9992
10061
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
9993
10062
|
}
|
|
@@ -10671,6 +10740,11 @@ class Phone extends Emitter {
|
|
|
10671
10740
|
return this.getRemoteVideoStream(callSession);
|
|
10672
10741
|
}
|
|
10673
10742
|
|
|
10743
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
10744
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10745
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
10746
|
+
}
|
|
10747
|
+
|
|
10674
10748
|
hasVideo(callSession ) {
|
|
10675
10749
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
10676
10750
|
}
|
|
@@ -10830,6 +10904,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
10830
10904
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
10831
10905
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
10832
10906
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
10907
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
10833
10908
|
|
|
10834
10909
|
const BLACKLIST_EVENTS = [
|
|
10835
10910
|
CHAT_MESSAGE_SENT,
|
|
@@ -10889,7 +10964,7 @@ class WebSocketClient extends Emitter {
|
|
|
10889
10964
|
|
|
10890
10965
|
connect() {
|
|
10891
10966
|
logger$5.info('connect method started', { host: this.host, token: this.token });
|
|
10892
|
-
this.socket = new ReconnectingWebSocket__default[
|
|
10967
|
+
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
10893
10968
|
if (this.options.binaryType) {
|
|
10894
10969
|
this.socket.binaryType = this.options.binaryType;
|
|
10895
10970
|
}
|
|
@@ -11180,6 +11255,7 @@ WebSocketClient.eventLists = [
|
|
|
11180
11255
|
AGENT_UNPAUSED,
|
|
11181
11256
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11182
11257
|
CONFERENCE_ADHOC_DELETED,
|
|
11258
|
+
MEETING_USER_PROGRESS,
|
|
11183
11259
|
];
|
|
11184
11260
|
|
|
11185
11261
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -11250,6 +11326,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11250
11326
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
11251
11327
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
11252
11328
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
11329
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
11253
11330
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
11254
11331
|
'default': WebSocketClient
|
|
11255
11332
|
});
|
|
@@ -11341,7 +11418,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11341
11418
|
|
|
11342
11419
|
const logger$3 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
11343
11420
|
|
|
11344
|
-
class SipRoom extends Room
|
|
11421
|
+
class SipRoom extends Room {
|
|
11345
11422
|
|
|
11346
11423
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
11347
11424
|
logger$3.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
@@ -11955,7 +12032,7 @@ class NotificationOptions {
|
|
|
11955
12032
|
|
|
11956
12033
|
|
|
11957
12034
|
// Represents a conference room, like `9000`.
|
|
11958
|
-
class Room$
|
|
12035
|
+
class Room$1 {
|
|
11959
12036
|
|
|
11960
12037
|
|
|
11961
12038
|
|
|
@@ -11976,7 +12053,7 @@ class Room$2 {
|
|
|
11976
12053
|
}
|
|
11977
12054
|
|
|
11978
12055
|
connect(callSession ) {
|
|
11979
|
-
return new Room$
|
|
12056
|
+
return new Room$1({ ...this, connectedCallSession: callSession });
|
|
11980
12057
|
}
|
|
11981
12058
|
|
|
11982
12059
|
has(callSession ) {
|
|
@@ -11985,7 +12062,7 @@ class Room$2 {
|
|
|
11985
12062
|
|
|
11986
12063
|
addParticipant(uuid , extension , talking = null) {
|
|
11987
12064
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
11988
|
-
return new Room$
|
|
12065
|
+
return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
11989
12066
|
}
|
|
11990
12067
|
|
|
11991
12068
|
return this;
|
|
@@ -12004,7 +12081,7 @@ class Room$2 {
|
|
|
12004
12081
|
updatedParticipants.push(participant);
|
|
12005
12082
|
}
|
|
12006
12083
|
|
|
12007
|
-
return new Room$
|
|
12084
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12008
12085
|
}
|
|
12009
12086
|
|
|
12010
12087
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12020,7 +12097,7 @@ class Room$2 {
|
|
|
12020
12097
|
updatedParticipants.push(participant);
|
|
12021
12098
|
}
|
|
12022
12099
|
|
|
12023
|
-
return new Room$
|
|
12100
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12024
12101
|
}
|
|
12025
12102
|
|
|
12026
12103
|
hasCallWithId(id ) {
|
|
@@ -12028,18 +12105,18 @@ class Room$2 {
|
|
|
12028
12105
|
}
|
|
12029
12106
|
|
|
12030
12107
|
disconnect() {
|
|
12031
|
-
return new Room$
|
|
12108
|
+
return new Room$1({ ...this, connectedCallSession: null });
|
|
12032
12109
|
}
|
|
12033
12110
|
|
|
12034
12111
|
removeParticipantWithUUID(uuid ) {
|
|
12035
|
-
return new Room$
|
|
12112
|
+
return new Room$1({
|
|
12036
12113
|
...this,
|
|
12037
12114
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12038
12115
|
});
|
|
12039
12116
|
}
|
|
12040
12117
|
|
|
12041
12118
|
removeParticipantWithExtension(extension ) {
|
|
12042
|
-
return new Room$
|
|
12119
|
+
return new Room$1({
|
|
12043
12120
|
...this,
|
|
12044
12121
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12045
12122
|
});
|
|
@@ -12050,7 +12127,7 @@ class Room$2 {
|
|
|
12050
12127
|
}
|
|
12051
12128
|
|
|
12052
12129
|
static newFrom(room ) {
|
|
12053
|
-
return newFrom(room, Room$
|
|
12130
|
+
return newFrom(room, Room$1);
|
|
12054
12131
|
}
|
|
12055
12132
|
}
|
|
12056
12133
|
|
|
@@ -12721,9 +12798,9 @@ const Wazo = {
|
|
|
12721
12798
|
Auth: Auth$1,
|
|
12722
12799
|
Phone: Phone$1,
|
|
12723
12800
|
Websocket: Websocket$1,
|
|
12724
|
-
Room
|
|
12801
|
+
Room,
|
|
12725
12802
|
SipRoom,
|
|
12726
|
-
RemoteParticipant
|
|
12803
|
+
RemoteParticipant,
|
|
12727
12804
|
LocalParticipant,
|
|
12728
12805
|
Stream,
|
|
12729
12806
|
createLocalVideoStream,
|
|
@@ -12754,7 +12831,7 @@ const Wazo = {
|
|
|
12754
12831
|
Session,
|
|
12755
12832
|
Voicemail,
|
|
12756
12833
|
Relocation,
|
|
12757
|
-
ConferenceRoom: Room$
|
|
12834
|
+
ConferenceRoom: Room$1,
|
|
12758
12835
|
CallSession,
|
|
12759
12836
|
IndirectTransfer,
|
|
12760
12837
|
SwitchboardCall,
|
|
@@ -13287,7 +13364,7 @@ class Room extends Emitter {
|
|
|
13287
13364
|
}
|
|
13288
13365
|
|
|
13289
13366
|
_mapMsid(rawSdp ) {
|
|
13290
|
-
const sdp = sdpParser__default[
|
|
13367
|
+
const sdp = sdpParser__default['default'].parse(rawSdp);
|
|
13291
13368
|
const labelMsidArray = sdp.media.filter(media => !!media.label).map(({ label, msid }) => ({
|
|
13292
13369
|
label: String(label),
|
|
13293
13370
|
streamId: msid.split(' ')[0],
|
|
@@ -13495,7 +13572,7 @@ class Room extends Emitter {
|
|
|
13495
13572
|
_isParticipantJoining(participant ) {
|
|
13496
13573
|
this.__associateStreams(participant);
|
|
13497
13574
|
// @VALIDATE: no need to publicize ourselves, no?
|
|
13498
|
-
if (participant instanceof RemoteParticipant
|
|
13575
|
+
if (participant instanceof RemoteParticipant) {
|
|
13499
13576
|
this.eventEmitter.emit(this.CONFERENCE_USER_PARTICIPANT_JOINED, participant);
|
|
13500
13577
|
}
|
|
13501
13578
|
}
|
|
@@ -13624,8 +13701,6 @@ class Room extends Emitter {
|
|
|
13624
13701
|
}
|
|
13625
13702
|
}
|
|
13626
13703
|
|
|
13627
|
-
var Room$1 = Room;
|
|
13628
|
-
|
|
13629
13704
|
//
|
|
13630
13705
|
|
|
13631
13706
|
class RemoteParticipant extends Participant {
|
|
@@ -13637,6 +13712,4 @@ class RemoteParticipant extends Participant {
|
|
|
13637
13712
|
}
|
|
13638
13713
|
}
|
|
13639
13714
|
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
module.exports = RemoteParticipant$1;
|
|
13715
|
+
module.exports = RemoteParticipant;
|