@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
|
@@ -40,7 +40,7 @@ class Emitter {
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
constructor() {
|
|
43
|
-
this.eventEmitter = new EventEmitter__default[
|
|
43
|
+
this.eventEmitter = new EventEmitter__default['default']();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
on(event , callback ) {
|
|
@@ -450,6 +450,7 @@ class IssueReporter {
|
|
|
450
450
|
|
|
451
451
|
|
|
452
452
|
|
|
453
|
+
|
|
453
454
|
|
|
454
455
|
constructor() {
|
|
455
456
|
addLevelsTo(this);
|
|
@@ -461,12 +462,17 @@ class IssueReporter {
|
|
|
461
462
|
this.bufferTimeout = null;
|
|
462
463
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
463
464
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
465
|
+
this._callback = null;
|
|
464
466
|
}
|
|
465
467
|
|
|
466
468
|
init() {
|
|
467
469
|
this._catchConsole();
|
|
468
470
|
}
|
|
469
471
|
|
|
472
|
+
setCallback(cb ) {
|
|
473
|
+
this._callback = cb;
|
|
474
|
+
}
|
|
475
|
+
|
|
470
476
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
471
477
|
this.remoteClientConfiguration = configuration;
|
|
472
478
|
}
|
|
@@ -502,6 +508,7 @@ class IssueReporter {
|
|
|
502
508
|
|
|
503
509
|
// Handle category label
|
|
504
510
|
let category = null;
|
|
511
|
+
let skipSendToRemote = false;
|
|
505
512
|
let extra = {};
|
|
506
513
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
507
514
|
category = args[0].split('=')[1];
|
|
@@ -517,6 +524,7 @@ class IssueReporter {
|
|
|
517
524
|
errorMessage: lastArg.message,
|
|
518
525
|
errorStack: lastArg.stack,
|
|
519
526
|
errorType: lastArg.constructor.name,
|
|
527
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
520
528
|
};
|
|
521
529
|
} else {
|
|
522
530
|
extra = lastArg;
|
|
@@ -525,7 +533,12 @@ class IssueReporter {
|
|
|
525
533
|
args.splice(1, 1);
|
|
526
534
|
}
|
|
527
535
|
|
|
528
|
-
|
|
536
|
+
if (extra.skipSendToRemote) {
|
|
537
|
+
skipSendToRemote = true;
|
|
538
|
+
delete extra.skipSendToRemote;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
529
542
|
const message = args.join(', ');
|
|
530
543
|
let consoleMessage = message;
|
|
531
544
|
|
|
@@ -545,7 +558,13 @@ class IssueReporter {
|
|
|
545
558
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
546
559
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
547
560
|
|
|
548
|
-
this.
|
|
561
|
+
if (this._callback) {
|
|
562
|
+
this._callback(level, consoleMessage);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
if (!skipSendToRemote) {
|
|
566
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
567
|
+
}
|
|
549
568
|
}
|
|
550
569
|
|
|
551
570
|
logRequest(url , options , response , start ) {
|
|
@@ -690,7 +709,11 @@ class IssueReporter {
|
|
|
690
709
|
},
|
|
691
710
|
// $FlowFixMe
|
|
692
711
|
body,
|
|
693
|
-
}).catch(() => {
|
|
712
|
+
}).catch((e ) => {
|
|
713
|
+
// $FlowFixMe
|
|
714
|
+
e.skipSendToRemote = true;
|
|
715
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
716
|
+
|
|
694
717
|
setTimeout(() => {
|
|
695
718
|
if (isArray) {
|
|
696
719
|
payload = payload.map(message => {
|
|
@@ -702,7 +725,7 @@ class IssueReporter {
|
|
|
702
725
|
payload._retry = retry + 1;
|
|
703
726
|
}
|
|
704
727
|
|
|
705
|
-
this._sendDebugToGrafana(
|
|
728
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
706
729
|
}, 5000 + retry * 1000);
|
|
707
730
|
});
|
|
708
731
|
}
|
|
@@ -2640,7 +2663,8 @@ class ExternalApp {
|
|
|
2640
2663
|
|
|
2641
2664
|
|
|
2642
2665
|
|
|
2643
|
-
|
|
2666
|
+
|
|
2667
|
+
|
|
2644
2668
|
|
|
2645
2669
|
|
|
2646
2670
|
class Meeting {
|
|
@@ -2652,6 +2676,7 @@ class Meeting {
|
|
|
2652
2676
|
|
|
2653
2677
|
|
|
2654
2678
|
|
|
2679
|
+
|
|
2655
2680
|
|
|
2656
2681
|
|
|
2657
2682
|
static parse(plain ) {
|
|
@@ -2663,14 +2688,28 @@ class Meeting {
|
|
|
2663
2688
|
port: plain.port,
|
|
2664
2689
|
uuid: plain.uuid,
|
|
2665
2690
|
number: plain.number,
|
|
2691
|
+
persistent: plain.persistent,
|
|
2666
2692
|
});
|
|
2667
2693
|
}
|
|
2668
2694
|
|
|
2695
|
+
static parseMany(items ) {
|
|
2696
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2669
2699
|
static newFrom(meeting ) {
|
|
2670
2700
|
return newFrom(meeting, Meeting);
|
|
2671
2701
|
}
|
|
2672
2702
|
|
|
2673
|
-
constructor({
|
|
2703
|
+
constructor({
|
|
2704
|
+
uuid,
|
|
2705
|
+
name,
|
|
2706
|
+
guestSipAuthorization,
|
|
2707
|
+
ownerUuids,
|
|
2708
|
+
port,
|
|
2709
|
+
uri,
|
|
2710
|
+
number,
|
|
2711
|
+
persistent,
|
|
2712
|
+
} = {}) {
|
|
2674
2713
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2675
2714
|
this.uri = uri;
|
|
2676
2715
|
this.name = name;
|
|
@@ -2678,6 +2717,7 @@ class Meeting {
|
|
|
2678
2717
|
this.port = port;
|
|
2679
2718
|
this.uuid = uuid;
|
|
2680
2719
|
this.number = number;
|
|
2720
|
+
this.persistent = persistent;
|
|
2681
2721
|
|
|
2682
2722
|
// Useful to compare instead of instanceof with minified code
|
|
2683
2723
|
this.type = 'Meeting';
|
|
@@ -2755,8 +2795,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2755
2795
|
}
|
|
2756
2796
|
},
|
|
2757
2797
|
|
|
2758
|
-
|
|
2759
|
-
client.
|
|
2798
|
+
getMyMeetings: () =>
|
|
2799
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2800
|
+
|
|
2801
|
+
createMyMeeting: (name , persistent ) =>
|
|
2802
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2760
2803
|
|
|
2761
2804
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2762
2805
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -2858,7 +2901,7 @@ class ChatMessage {
|
|
|
2858
2901
|
static parse(plain ) {
|
|
2859
2902
|
return new ChatMessage({
|
|
2860
2903
|
uuid: plain.uuid,
|
|
2861
|
-
date: moment__default[
|
|
2904
|
+
date: moment__default['default'](plain.created_at).toDate(),
|
|
2862
2905
|
content: plain.content,
|
|
2863
2906
|
alias: plain.alias,
|
|
2864
2907
|
userUuid: plain.user_uuid,
|
|
@@ -2950,7 +2993,7 @@ class Voicemail {
|
|
|
2950
2993
|
static parse(plain ) {
|
|
2951
2994
|
return new Voicemail({
|
|
2952
2995
|
id: plain.id,
|
|
2953
|
-
date: moment__default[
|
|
2996
|
+
date: moment__default['default'](plain.timestamp * 1000).toDate(),
|
|
2954
2997
|
duration: plain.duration * 1000,
|
|
2955
2998
|
caller: {
|
|
2956
2999
|
name: plain.caller_id_name,
|
|
@@ -3087,7 +3130,7 @@ class Call {
|
|
|
3087
3130
|
onHold: plain.on_hold,
|
|
3088
3131
|
status: plain.status,
|
|
3089
3132
|
lineId: plain.line_id,
|
|
3090
|
-
startingTime: moment__default[
|
|
3133
|
+
startingTime: moment__default['default'](plain.creation_time).toDate(),
|
|
3091
3134
|
talkingToIds: Object.keys(plain.talking_to || {}),
|
|
3092
3135
|
recording: plain.record_state === RECORD_STATE_ACTIVE,
|
|
3093
3136
|
});
|
|
@@ -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 });
|
|
@@ -11671,7 +11748,7 @@ class NotificationOptions {
|
|
|
11671
11748
|
|
|
11672
11749
|
|
|
11673
11750
|
// Represents a conference room, like `9000`.
|
|
11674
|
-
class Room$
|
|
11751
|
+
class Room$1 {
|
|
11675
11752
|
|
|
11676
11753
|
|
|
11677
11754
|
|
|
@@ -11692,7 +11769,7 @@ class Room$2 {
|
|
|
11692
11769
|
}
|
|
11693
11770
|
|
|
11694
11771
|
connect(callSession ) {
|
|
11695
|
-
return new Room$
|
|
11772
|
+
return new Room$1({ ...this, connectedCallSession: callSession });
|
|
11696
11773
|
}
|
|
11697
11774
|
|
|
11698
11775
|
has(callSession ) {
|
|
@@ -11701,7 +11778,7 @@ class Room$2 {
|
|
|
11701
11778
|
|
|
11702
11779
|
addParticipant(uuid , extension , talking = null) {
|
|
11703
11780
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
11704
|
-
return new Room$
|
|
11781
|
+
return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
11705
11782
|
}
|
|
11706
11783
|
|
|
11707
11784
|
return this;
|
|
@@ -11720,7 +11797,7 @@ class Room$2 {
|
|
|
11720
11797
|
updatedParticipants.push(participant);
|
|
11721
11798
|
}
|
|
11722
11799
|
|
|
11723
|
-
return new Room$
|
|
11800
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
11724
11801
|
}
|
|
11725
11802
|
|
|
11726
11803
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -11736,7 +11813,7 @@ class Room$2 {
|
|
|
11736
11813
|
updatedParticipants.push(participant);
|
|
11737
11814
|
}
|
|
11738
11815
|
|
|
11739
|
-
return new Room$
|
|
11816
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
11740
11817
|
}
|
|
11741
11818
|
|
|
11742
11819
|
hasCallWithId(id ) {
|
|
@@ -11744,18 +11821,18 @@ class Room$2 {
|
|
|
11744
11821
|
}
|
|
11745
11822
|
|
|
11746
11823
|
disconnect() {
|
|
11747
|
-
return new Room$
|
|
11824
|
+
return new Room$1({ ...this, connectedCallSession: null });
|
|
11748
11825
|
}
|
|
11749
11826
|
|
|
11750
11827
|
removeParticipantWithUUID(uuid ) {
|
|
11751
|
-
return new Room$
|
|
11828
|
+
return new Room$1({
|
|
11752
11829
|
...this,
|
|
11753
11830
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
11754
11831
|
});
|
|
11755
11832
|
}
|
|
11756
11833
|
|
|
11757
11834
|
removeParticipantWithExtension(extension ) {
|
|
11758
|
-
return new Room$
|
|
11835
|
+
return new Room$1({
|
|
11759
11836
|
...this,
|
|
11760
11837
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
11761
11838
|
});
|
|
@@ -11766,7 +11843,7 @@ class Room$2 {
|
|
|
11766
11843
|
}
|
|
11767
11844
|
|
|
11768
11845
|
static newFrom(room ) {
|
|
11769
|
-
return newFrom(room, Room$
|
|
11846
|
+
return newFrom(room, Room$1);
|
|
11770
11847
|
}
|
|
11771
11848
|
}
|
|
11772
11849
|
|
|
@@ -12437,10 +12514,10 @@ const Wazo = {
|
|
|
12437
12514
|
Auth: Auth$1,
|
|
12438
12515
|
Phone: Phone$1,
|
|
12439
12516
|
Websocket: Websocket$1,
|
|
12440
|
-
Room
|
|
12517
|
+
Room,
|
|
12441
12518
|
SipRoom,
|
|
12442
12519
|
RemoteParticipant,
|
|
12443
|
-
LocalParticipant
|
|
12520
|
+
LocalParticipant,
|
|
12444
12521
|
Stream,
|
|
12445
12522
|
createLocalVideoStream,
|
|
12446
12523
|
createLocalAudioStream,
|
|
@@ -12470,7 +12547,7 @@ const Wazo = {
|
|
|
12470
12547
|
Session,
|
|
12471
12548
|
Voicemail,
|
|
12472
12549
|
Relocation,
|
|
12473
|
-
ConferenceRoom: Room$
|
|
12550
|
+
ConferenceRoom: Room$1,
|
|
12474
12551
|
CallSession,
|
|
12475
12552
|
IndirectTransfer,
|
|
12476
12553
|
SwitchboardCall,
|
|
@@ -13003,7 +13080,7 @@ class Room extends Emitter {
|
|
|
13003
13080
|
}
|
|
13004
13081
|
|
|
13005
13082
|
_mapMsid(rawSdp ) {
|
|
13006
|
-
const sdp = sdpParser__default[
|
|
13083
|
+
const sdp = sdpParser__default['default'].parse(rawSdp);
|
|
13007
13084
|
const labelMsidArray = sdp.media.filter(media => !!media.label).map(({ label, msid }) => ({
|
|
13008
13085
|
label: String(label),
|
|
13009
13086
|
streamId: msid.split(' ')[0],
|
|
@@ -13340,8 +13417,6 @@ class Room extends Emitter {
|
|
|
13340
13417
|
}
|
|
13341
13418
|
}
|
|
13342
13419
|
|
|
13343
|
-
var Room$1 = Room;
|
|
13344
|
-
|
|
13345
13420
|
//
|
|
13346
13421
|
|
|
13347
13422
|
const logger = IssueReporter$1.loggerFor('room');
|
|
@@ -13637,6 +13712,4 @@ class Participant extends Emitter {
|
|
|
13637
13712
|
class LocalParticipant extends Participant {
|
|
13638
13713
|
}
|
|
13639
13714
|
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
module.exports = LocalParticipant$1;
|
|
13715
|
+
module.exports = LocalParticipant;
|