@wazo/sdk 0.37.0 → 0.37.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wazo-sdk.js +5 -5
- package/esm/__tests__/api-client.test.js +91 -23
- package/esm/__tests__/web-rtc-client.test.js +165 -56
- package/esm/api/agentd.js +7 -1
- package/esm/api/amid.js +7 -1
- package/esm/api/application.js +7 -1
- package/esm/api/auth.js +7 -1
- package/esm/api/call-logd.js +17 -23
- package/esm/api/calld.js +10 -18
- package/esm/api/chatd.js +7 -1
- package/esm/api/confd.js +78 -1
- package/esm/api/ctid-ng.js +7 -1
- package/esm/api/dird.js +7 -1
- package/esm/api/webhookd.js +7 -1
- package/esm/api-client.js +91 -23
- package/esm/checker/Checker.js +169 -56
- package/esm/checker/checks/aor.js +91 -23
- package/esm/checker/checks/api.js +91 -23
- package/esm/checker/checks/index.js +169 -56
- package/esm/checker/checks/wazo-websocket.js +11 -1
- package/esm/checker/checks/webrtc-transport.js +165 -56
- package/esm/checker/checks/webrtc.js +165 -56
- package/esm/domain/AdHocAPIConference.js +1722 -1654
- package/esm/domain/CallLog.js +10 -22
- package/esm/domain/CallSession.js +1 -18
- package/esm/domain/Features.js +91 -23
- package/esm/domain/IndirectTransfer.js +0 -17
- package/esm/domain/Meeting.js +71 -0
- package/esm/domain/Phone/CTIPhone.js +98 -26
- package/esm/domain/Phone/Phone.js +0 -17
- package/esm/domain/Phone/WebRTCPhone.js +47 -27
- package/esm/domain/Room.js +0 -17
- package/esm/domain/SwitchboardCall.js +0 -17
- package/esm/domain/__tests__/CallLog.test.js +10 -22
- package/esm/domain/__tests__/CallSession.test.js +1 -18
- package/esm/domain/__tests__/IndirectTransfer.test.js +1 -18
- package/esm/domain/__tests__/Room.test.js +1 -18
- package/esm/index.js +3880 -3111
- package/esm/lib/WazoSessionDescriptionHandler.js +24 -10
- package/esm/service/CallApi.js +91 -23
- package/esm/service/IssueReporter.js +7 -1
- package/esm/service/__tests__/IssueReporter.test.js +9 -1
- package/esm/service/getApiClient.js +91 -23
- package/esm/simple/Auth.js +1126 -360
- package/esm/simple/Configuration.js +1126 -360
- package/esm/simple/Directory.js +91 -23
- package/esm/simple/Phone.js +3724 -2958
- package/esm/simple/Websocket.js +13 -1
- package/esm/simple/index.js +1128 -362
- package/esm/simple/room/LocalParticipant.js +1097 -331
- package/esm/simple/room/Participant.js +1097 -331
- package/esm/simple/room/RemoteParticipant.js +1097 -331
- package/esm/simple/room/Room.js +1097 -331
- package/esm/simple/room/SipRoom.js +12996 -0
- package/esm/simple/room/Stream.js +1128 -362
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +5157 -4389
- package/esm/simple/utils.js +1128 -362
- package/esm/utils/__tests__/api-requester.test.js +7 -1
- package/esm/utils/api-requester.js +7 -1
- package/esm/web-rtc-client.js +165 -56
- package/esm/websocket-client.js +12 -2
- package/lib/__tests__/api-client.test.js +91 -23
- package/lib/__tests__/web-rtc-client.test.js +165 -56
- package/lib/api/agentd.js +7 -1
- package/lib/api/amid.js +7 -1
- package/lib/api/application.js +7 -1
- package/lib/api/auth.js +7 -1
- package/lib/api/call-logd.js +17 -23
- package/lib/api/calld.js +10 -18
- package/lib/api/chatd.js +7 -1
- package/lib/api/confd.js +78 -1
- package/lib/api/ctid-ng.js +7 -1
- package/lib/api/dird.js +7 -1
- package/lib/api/webhookd.js +7 -1
- package/lib/api-client.js +91 -23
- package/lib/checker/Checker.js +169 -56
- package/lib/checker/checks/aor.js +91 -23
- package/lib/checker/checks/api.js +91 -23
- package/lib/checker/checks/index.js +169 -56
- package/lib/checker/checks/wazo-websocket.js +11 -1
- package/lib/checker/checks/webrtc-transport.js +165 -56
- package/lib/checker/checks/webrtc.js +165 -56
- package/lib/domain/AdHocAPIConference.js +1722 -1654
- package/lib/domain/CallLog.js +10 -22
- package/lib/domain/CallSession.js +1 -18
- package/lib/domain/Features.js +91 -23
- package/lib/domain/IndirectTransfer.js +0 -17
- package/lib/domain/Meeting.js +73 -0
- package/lib/domain/Phone/CTIPhone.js +98 -26
- package/lib/domain/Phone/Phone.js +0 -16
- package/lib/domain/Phone/WebRTCPhone.js +47 -27
- package/lib/domain/Room.js +0 -17
- package/lib/domain/SwitchboardCall.js +0 -17
- package/lib/domain/__tests__/CallLog.test.js +10 -22
- package/lib/domain/__tests__/CallSession.test.js +1 -18
- package/lib/domain/__tests__/IndirectTransfer.test.js +1 -18
- package/lib/domain/__tests__/Room.test.js +1 -18
- package/lib/index.js +3880 -3111
- package/lib/lib/WazoSessionDescriptionHandler.js +24 -10
- package/lib/service/CallApi.js +91 -23
- package/lib/service/IssueReporter.js +7 -1
- package/lib/service/__tests__/IssueReporter.test.js +9 -1
- package/lib/service/getApiClient.js +91 -23
- package/lib/simple/Auth.js +1126 -360
- package/lib/simple/Configuration.js +1126 -360
- package/lib/simple/Directory.js +91 -23
- package/lib/simple/Phone.js +3724 -2958
- package/lib/simple/Websocket.js +13 -1
- package/lib/simple/index.js +1128 -362
- package/lib/simple/room/LocalParticipant.js +1097 -331
- package/lib/simple/room/Participant.js +1097 -331
- package/lib/simple/room/RemoteParticipant.js +1097 -331
- package/lib/simple/room/Room.js +1097 -331
- package/lib/simple/room/SipRoom.js +13006 -0
- package/lib/simple/room/Stream.js +1128 -362
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +5157 -4389
- package/lib/simple/utils.js +1128 -362
- package/lib/utils/__tests__/api-requester.test.js +7 -1
- package/lib/utils/api-requester.js +7 -1
- package/lib/web-rtc-client.js +165 -56
- package/lib/websocket-client.js +13 -1
- package/package.json +1 -1
- package/src/api/calld.js +3 -0
- package/src/api/confd.js +13 -0
- package/src/domain/CallLog.js +10 -22
- package/src/domain/CallSession.js +1 -2
- package/src/domain/Meeting.js +59 -0
- package/src/domain/Phone/CTIPhone.js +6 -2
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +22 -8
- package/src/index.js +6 -0
- package/src/lib/WazoSessionDescriptionHandler.js +17 -9
- package/src/service/IssueReporter.js +7 -1
- package/src/service/__tests__/IssueReporter.test.js +2 -0
- package/src/simple/Phone.js +13 -4
- package/src/simple/index.js +8 -0
- package/src/simple/room/Participant.js +7 -0
- package/src/simple/room/Room.js +157 -79
- package/src/simple/room/SipRoom.js +147 -0
- package/src/simple/room/Stream.js +1 -3
- package/src/simple/room/__tests__/RemoteParticipant.test.js +3 -2
- package/src/types/WebSocketMessage.js +21 -0
- package/src/web-rtc-client.js +57 -24
- package/src/websocket-client.js +4 -0
|
@@ -591,7 +591,13 @@ class IssueReporter {
|
|
|
591
591
|
}
|
|
592
592
|
|
|
593
593
|
_isLevelAbove(level1 , level2 ) {
|
|
594
|
-
|
|
594
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
595
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
596
|
+
if (index1 === -1 || index2 === -1) {
|
|
597
|
+
return false;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
return index1 > index2;
|
|
595
601
|
}
|
|
596
602
|
|
|
597
603
|
_makeCategory(category ) {
|
|
@@ -763,7 +769,9 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
763
769
|
.then(() => {
|
|
764
770
|
if (isConference && (options.constraints && !options.constraints.video) && !('hold' in options) && !audioOnly) {
|
|
765
771
|
// Add a video an empty bundle to be able to replaceTrack when joining a conference without video
|
|
766
|
-
this.peerConnection.addTransceiver
|
|
772
|
+
if (this.peerConnection.addTransceiver) {
|
|
773
|
+
this.peerConnection.addTransceiver('video', { streams: [this._localMediaStream], direction: 'sendrecv' });
|
|
774
|
+
}
|
|
767
775
|
}
|
|
768
776
|
})
|
|
769
777
|
.then(() => this.createLocalOfferOrAnswer(options))
|
|
@@ -790,12 +798,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
790
798
|
};
|
|
791
799
|
})
|
|
792
800
|
.then((sessionDescription) => this.applyModifiers(sessionDescription, modifiers))
|
|
793
|
-
.then((sessionDescription) => {
|
|
794
|
-
// Set new constraints to avoid the constraints check issue in `sdh.getLocalMediaStream` later.
|
|
795
|
-
this.localMediaStreamConstraints = options.constraints;
|
|
796
|
-
|
|
797
|
-
return sessionDescription;
|
|
798
|
-
})
|
|
799
801
|
.then((sessionDescription) => ({ body: sessionDescription.sdp, contentType: 'application/sdp' }))
|
|
800
802
|
.catch((error) => {
|
|
801
803
|
wazoLogger.error('error when creating media', error);
|
|
@@ -990,6 +992,9 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
990
992
|
|
|
991
993
|
// set the transceiver direction to the answer direction
|
|
992
994
|
this._peerConnection.getTransceivers().forEach((transceiver) => {
|
|
995
|
+
if (transceiver.stopped) {
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
993
998
|
if (transceiver.direction /* guarding, but should always be true */) {
|
|
994
999
|
const { receiver } = transceiver;
|
|
995
1000
|
if (isConference && audioOnly && receiver.track && receiver.track.kind === 'video') {
|
|
@@ -1034,10 +1039,15 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
1034
1039
|
if (kind !== 'audio' && kind !== 'video') {
|
|
1035
1040
|
throw new Error(`Unknown new track kind ${kind}.`);
|
|
1036
1041
|
}
|
|
1037
|
-
const sender = pc.getSenders().find((otherSender) =>
|
|
1042
|
+
const sender = pc.getSenders && pc.getSenders().find((otherSender) =>
|
|
1043
|
+
otherSender.track && otherSender.track.kind === kind);
|
|
1038
1044
|
|
|
1039
1045
|
// Do not reuse sender video tracks in SFU
|
|
1040
1046
|
if (sender && (!sfu || newTrack.kind === 'audio')) {
|
|
1047
|
+
if (sender.track) {
|
|
1048
|
+
// eslint-disable-next-line no-param-reassign
|
|
1049
|
+
newTrack.enabled = sender.track.enabled;
|
|
1050
|
+
}
|
|
1041
1051
|
trackUpdates.push(
|
|
1042
1052
|
new Promise((resolve) => {
|
|
1043
1053
|
this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${kind} track`);
|
|
@@ -1071,7 +1081,11 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
1071
1081
|
// Review: could make streamless tracks a configurable option?
|
|
1072
1082
|
// https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addTrack#Usage_notes
|
|
1073
1083
|
try {
|
|
1074
|
-
pc.addTrack
|
|
1084
|
+
if (pc.addTrack) {
|
|
1085
|
+
pc.addTrack(newTrack, localStream);
|
|
1086
|
+
} else {
|
|
1087
|
+
pc.addStream(localStream);
|
|
1088
|
+
}
|
|
1075
1089
|
} catch (error) {
|
|
1076
1090
|
this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${kind} track`);
|
|
1077
1091
|
throw error;
|
|
@@ -3028,6 +3042,65 @@ class ExternalApp {
|
|
|
3028
3042
|
}
|
|
3029
3043
|
}
|
|
3030
3044
|
|
|
3045
|
+
//
|
|
3046
|
+
|
|
3047
|
+
|
|
3048
|
+
|
|
3049
|
+
|
|
3050
|
+
|
|
3051
|
+
|
|
3052
|
+
|
|
3053
|
+
|
|
3054
|
+
|
|
3055
|
+
|
|
3056
|
+
|
|
3057
|
+
class Meeting {
|
|
3058
|
+
|
|
3059
|
+
|
|
3060
|
+
|
|
3061
|
+
|
|
3062
|
+
|
|
3063
|
+
|
|
3064
|
+
|
|
3065
|
+
|
|
3066
|
+
|
|
3067
|
+
|
|
3068
|
+
static parse(plain ) {
|
|
3069
|
+
return new Meeting({
|
|
3070
|
+
guestSipAuthorization: plain.guest_sip_authorization,
|
|
3071
|
+
hostname: plain.hostname,
|
|
3072
|
+
name: plain.name,
|
|
3073
|
+
ownerUuids: plain.owner_uuids,
|
|
3074
|
+
port: plain.port,
|
|
3075
|
+
uuid: plain.uuid,
|
|
3076
|
+
number: plain.number,
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
static newFrom(meeting ) {
|
|
3081
|
+
return newFrom(meeting, Meeting);
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
|
|
3085
|
+
this.guestSipAuthorization = guestSipAuthorization;
|
|
3086
|
+
this.hostname = hostname;
|
|
3087
|
+
this.name = name;
|
|
3088
|
+
this.ownerUuids = ownerUuids;
|
|
3089
|
+
this.port = port;
|
|
3090
|
+
this.uuid = uuid;
|
|
3091
|
+
this.number = number;
|
|
3092
|
+
|
|
3093
|
+
// Useful to compare instead of instanceof with minified code
|
|
3094
|
+
this.type = 'Meeting';
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3097
|
+
getGuestSipCredentials() {
|
|
3098
|
+
// eslint-disable-next-line no-undef
|
|
3099
|
+
const [username, secret] = atob(this.guestSipAuthorization).split(':');
|
|
3100
|
+
return { username, secret };
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
|
|
3031
3104
|
/* */
|
|
3032
3105
|
|
|
3033
3106
|
var confdMethods = (client , baseUrl ) => ({
|
|
@@ -3092,6 +3165,18 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3092
3165
|
return null;
|
|
3093
3166
|
}
|
|
3094
3167
|
},
|
|
3168
|
+
|
|
3169
|
+
createMyMeeting: (name ) =>
|
|
3170
|
+
client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
|
|
3171
|
+
|
|
3172
|
+
deleteMyMeeting: (meetingUuid ) =>
|
|
3173
|
+
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
3174
|
+
|
|
3175
|
+
getMeeting: (meetingUuid ) =>
|
|
3176
|
+
client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
|
|
3177
|
+
|
|
3178
|
+
guestGetMeeting: (meetingUuid ) =>
|
|
3179
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
|
|
3095
3180
|
});
|
|
3096
3181
|
|
|
3097
3182
|
//
|
|
@@ -3676,7 +3761,11 @@ class CallLog {
|
|
|
3676
3761
|
answered: plain.answered,
|
|
3677
3762
|
callDirection: plain.call_direction,
|
|
3678
3763
|
destination: {
|
|
3679
|
-
|
|
3764
|
+
// @TEMP: Temporarily assuming empty numbers are meetings
|
|
3765
|
+
// which is admittedly a very dangerous assumption. Did i mention it was temporary?
|
|
3766
|
+
extension: plain.requested_extension
|
|
3767
|
+
|| plain.destination_extension
|
|
3768
|
+
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3680
3769
|
name: plain.requested_name || plain.destination_name || '',
|
|
3681
3770
|
},
|
|
3682
3771
|
source: {
|
|
@@ -3692,27 +3781,11 @@ class CallLog {
|
|
|
3692
3781
|
}
|
|
3693
3782
|
|
|
3694
3783
|
static parseNew(plain , session ) {
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
extension: plain.requested_extension || plain.destination_extension,
|
|
3701
|
-
name: plain.requested_name || plain.destination_name || '',
|
|
3702
|
-
},
|
|
3703
|
-
source: {
|
|
3704
|
-
extension: plain.source_extension,
|
|
3705
|
-
name: plain.source_name,
|
|
3706
|
-
},
|
|
3707
|
-
id: plain.id,
|
|
3708
|
-
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3709
|
-
start: moment(plain.start).toDate(),
|
|
3710
|
-
end: plain.end ? moment(plain.end).toDate() : null,
|
|
3711
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3712
|
-
// @TODO: FIXME add verification declined vs missed call
|
|
3713
|
-
newMissedCall: session
|
|
3714
|
-
&& session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
|
|
3715
|
-
});
|
|
3784
|
+
const callLog = CallLog.parse(plain);
|
|
3785
|
+
// @TODO: FIXME add verification declined vs missed call
|
|
3786
|
+
callLog.newMissedCall = session
|
|
3787
|
+
&& session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered;
|
|
3788
|
+
return callLog;
|
|
3716
3789
|
}
|
|
3717
3790
|
|
|
3718
3791
|
static newFrom(profile ) {
|
|
@@ -4469,6 +4542,9 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4469
4542
|
getConferenceParticipantsAsUser: async (conferenceId ) =>
|
|
4470
4543
|
client.get(`${baseUrl}/users/me/conferences/${conferenceId}/participants`),
|
|
4471
4544
|
|
|
4545
|
+
getMeetingParticipantsAsUser: async (meetingUuid ) =>
|
|
4546
|
+
client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
|
|
4547
|
+
|
|
4472
4548
|
listTrunks: () => client.get(`${baseUrl}/trunks`),
|
|
4473
4549
|
|
|
4474
4550
|
mute: (callId ) =>
|
|
@@ -5101,6 +5177,7 @@ const MAX_REGISTER_TRIES = 10;
|
|
|
5101
5177
|
|
|
5102
5178
|
|
|
5103
5179
|
|
|
5180
|
+
|
|
5104
5181
|
|
|
5105
5182
|
|
|
5106
5183
|
|
|
@@ -5127,6 +5204,7 @@ class WebRTCClient extends Emitter {
|
|
|
5127
5204
|
|
|
5128
5205
|
|
|
5129
5206
|
|
|
5207
|
+
|
|
5130
5208
|
|
|
5131
5209
|
// sugar
|
|
5132
5210
|
|
|
@@ -5165,6 +5243,8 @@ class WebRTCClient extends Emitter {
|
|
|
5165
5243
|
super();
|
|
5166
5244
|
this.uaConfigOverrides = uaConfigOverrides;
|
|
5167
5245
|
this.config = config;
|
|
5246
|
+
this.skipRegister = config.skipRegister;
|
|
5247
|
+
|
|
5168
5248
|
this._buildConfig(config, session).then((newConfig ) => {
|
|
5169
5249
|
this.config = newConfig;
|
|
5170
5250
|
this.userAgent = this.createUserAgent(uaConfigOverrides);
|
|
@@ -5292,14 +5372,22 @@ class WebRTCClient extends Emitter {
|
|
|
5292
5372
|
}
|
|
5293
5373
|
|
|
5294
5374
|
register(tries = 0) {
|
|
5295
|
-
|
|
5375
|
+
const logInfo = {
|
|
5296
5376
|
userAgent: !!this.userAgent,
|
|
5297
5377
|
registered: this.isRegistered(),
|
|
5298
5378
|
connectionPromise: !!this.connectionPromise,
|
|
5299
5379
|
registerer: !!this.registerer,
|
|
5300
5380
|
waiting: this.registerer && this.registerer.waiting,
|
|
5301
5381
|
tries,
|
|
5302
|
-
|
|
5382
|
+
skipRegister: this.skipRegister,
|
|
5383
|
+
};
|
|
5384
|
+
|
|
5385
|
+
if (this.skipRegister) {
|
|
5386
|
+
logger.info('sdk webrtc skip register...', logInfo);
|
|
5387
|
+
return Promise.resolve();
|
|
5388
|
+
}
|
|
5389
|
+
|
|
5390
|
+
logger.info('sdk webrtc registering...', logInfo);
|
|
5303
5391
|
|
|
5304
5392
|
if (!this.userAgent) {
|
|
5305
5393
|
logger.info('sdk webrtc recreating User Agent');
|
|
@@ -5630,12 +5718,18 @@ class WebRTCClient extends Emitter {
|
|
|
5630
5718
|
}
|
|
5631
5719
|
|
|
5632
5720
|
if (pc.getSenders) {
|
|
5721
|
+
if (!pc.getSenders().length) {
|
|
5722
|
+
return false;
|
|
5723
|
+
}
|
|
5633
5724
|
pc.getSenders().forEach(sender => {
|
|
5634
5725
|
if (sender && sender.track && sender.track.kind === 'audio') {
|
|
5635
5726
|
muted = muted && !sender.track.enabled;
|
|
5636
5727
|
}
|
|
5637
5728
|
});
|
|
5638
5729
|
} else {
|
|
5730
|
+
if (!pc.getLocalStreams().length) {
|
|
5731
|
+
return false;
|
|
5732
|
+
}
|
|
5639
5733
|
pc.getLocalStreams().forEach(stream => {
|
|
5640
5734
|
stream.getAudioTracks().forEach(track => {
|
|
5641
5735
|
muted = muted && !track.enabled;
|
|
@@ -5692,6 +5786,9 @@ class WebRTCClient extends Emitter {
|
|
|
5692
5786
|
if (!this._isWeb()) {
|
|
5693
5787
|
options.sessionDescriptionHandlerModifiers = [holdModifier];
|
|
5694
5788
|
}
|
|
5789
|
+
options.sessionDescriptionHandlerOptions = {
|
|
5790
|
+
constraints: options.constraints,
|
|
5791
|
+
};
|
|
5695
5792
|
|
|
5696
5793
|
// Send re-INVITE
|
|
5697
5794
|
return session.invite(options);
|
|
@@ -5731,6 +5828,9 @@ class WebRTCClient extends Emitter {
|
|
|
5731
5828
|
// (eg: holdModifier)
|
|
5732
5829
|
options.sessionDescriptionHandlerModifiers = [];
|
|
5733
5830
|
}
|
|
5831
|
+
options.sessionDescriptionHandlerOptions = {
|
|
5832
|
+
constraints: options.constraints,
|
|
5833
|
+
};
|
|
5734
5834
|
|
|
5735
5835
|
// Send re-INVITE
|
|
5736
5836
|
return session.invite(options);
|
|
@@ -5913,7 +6013,8 @@ class WebRTCClient extends Emitter {
|
|
|
5913
6013
|
}
|
|
5914
6014
|
const sdh = session.sessionDescriptionHandler;
|
|
5915
6015
|
const pc = sdh.peerConnection;
|
|
5916
|
-
const
|
|
6016
|
+
const sessionId = this.getSipSessionId(session);
|
|
6017
|
+
const localStream = this.getLocalStream(sessionId);
|
|
5917
6018
|
|
|
5918
6019
|
// Release old video stream
|
|
5919
6020
|
if (localStream) {
|
|
@@ -5939,11 +6040,8 @@ class WebRTCClient extends Emitter {
|
|
|
5939
6040
|
|
|
5940
6041
|
// let's update the local stream
|
|
5941
6042
|
this.eventEmitter.emit('onVideoInputChange', stream);
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
} catch (_) {
|
|
5945
|
-
// Nothing to do
|
|
5946
|
-
}
|
|
6043
|
+
this.setLocalMediaStream(sessionId, stream);
|
|
6044
|
+
|
|
5947
6045
|
return stream;
|
|
5948
6046
|
});
|
|
5949
6047
|
}
|
|
@@ -6245,9 +6343,11 @@ class WebRTCClient extends Emitter {
|
|
|
6245
6343
|
remoteStream.removeTrack(track);
|
|
6246
6344
|
});
|
|
6247
6345
|
|
|
6248
|
-
pc.getReceivers
|
|
6249
|
-
|
|
6250
|
-
|
|
6346
|
+
if (pc.getReceivers) {
|
|
6347
|
+
pc.getReceivers().forEach(receiver => {
|
|
6348
|
+
remoteStream.addTrack(receiver.track);
|
|
6349
|
+
});
|
|
6350
|
+
}
|
|
6251
6351
|
}
|
|
6252
6352
|
|
|
6253
6353
|
getMediaConfiguration(enableVideo , conference = false, constraints = null) {
|
|
@@ -6282,6 +6382,25 @@ class WebRTCClient extends Emitter {
|
|
|
6282
6382
|
return sessionId in this.conferences;
|
|
6283
6383
|
}
|
|
6284
6384
|
|
|
6385
|
+
createAudioElementFor(sessionId ) {
|
|
6386
|
+
const audio = document.createElement('audio');
|
|
6387
|
+
audio.setAttribute('id', `audio-${sessionId}`);
|
|
6388
|
+
|
|
6389
|
+
if (audio.setSinkId && this.audioOutputDeviceId) {
|
|
6390
|
+
audio.setSinkId(this.audioOutputDeviceId);
|
|
6391
|
+
}
|
|
6392
|
+
|
|
6393
|
+
if (document.body) {
|
|
6394
|
+
document.body.appendChild(audio);
|
|
6395
|
+
}
|
|
6396
|
+
this.audioElements[sessionId] = audio;
|
|
6397
|
+
|
|
6398
|
+
audio.volume = this.audioOutputVolume;
|
|
6399
|
+
audio.autoplay = true;
|
|
6400
|
+
|
|
6401
|
+
return audio;
|
|
6402
|
+
}
|
|
6403
|
+
|
|
6285
6404
|
_onTransportError() {
|
|
6286
6405
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
6287
6406
|
this.attemptReconnection();
|
|
@@ -6511,7 +6630,7 @@ class WebRTCClient extends Emitter {
|
|
|
6511
6630
|
let hadRemoteVideo = false;
|
|
6512
6631
|
|
|
6513
6632
|
// Monkey patch `onInviteRequest` to be able to know if there was a remote video stream before `onInvite` is called
|
|
6514
|
-
//
|
|
6633
|
+
// Because when `onInvite` is called we already got the video track
|
|
6515
6634
|
session.onInviteRequest = (request) => {
|
|
6516
6635
|
hadRemoteVideo = this.hasARemoteVideoTrack(sipSessionId);
|
|
6517
6636
|
|
|
@@ -6586,20 +6705,10 @@ class WebRTCClient extends Emitter {
|
|
|
6586
6705
|
const isConference = this.isConference(sessionId);
|
|
6587
6706
|
|
|
6588
6707
|
if (this._hasAudio() && this._isWeb() && !(sessionId in this.audioElements)) {
|
|
6589
|
-
|
|
6590
|
-
audio.setAttribute('id', `audio-${sessionId}`);
|
|
6591
|
-
|
|
6592
|
-
if (audio.setSinkId && this.audioOutputDeviceId) {
|
|
6593
|
-
audio.setSinkId(this.audioOutputDeviceId);
|
|
6594
|
-
}
|
|
6595
|
-
|
|
6596
|
-
if (document.body) {
|
|
6597
|
-
document.body.appendChild(audio);
|
|
6598
|
-
}
|
|
6599
|
-
this.audioElements[sessionId] = audio;
|
|
6708
|
+
this.createAudioElementFor(sessionId);
|
|
6600
6709
|
}
|
|
6601
6710
|
|
|
6602
|
-
const audioElement = this.audioElements[
|
|
6711
|
+
const audioElement = this.audioElements[sessionId];
|
|
6603
6712
|
const stream = newStream || this.getRemoteStream(sessionId);
|
|
6604
6713
|
|
|
6605
6714
|
if (!this._isWeb() || !stream) {
|