@wazo/sdk 0.38.4 → 0.38.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/api-client.test.js +6 -0
- package/esm/__tests__/web-rtc-client.test.js +88 -3
- package/esm/api/calld.js +6 -0
- package/esm/api/ctid-ng.js +6 -0
- package/esm/api-client.js +6 -0
- package/esm/checker/Checker.js +38 -3
- package/esm/checker/checks/aor.js +6 -0
- package/esm/checker/checks/api.js +6 -0
- package/esm/checker/checks/index.js +38 -3
- package/esm/checker/checks/webrtc-transport.js +38 -3
- package/esm/checker/checks/webrtc.js +38 -3
- package/esm/domain/AdHocAPIConference.js +6 -0
- package/esm/domain/Call.js +6 -0
- package/esm/domain/CallSession.js +1 -1
- package/esm/domain/Features.js +6 -0
- package/esm/domain/Phone/CTIPhone.js +7 -1
- package/esm/domain/Phone/WebRTCPhone.js +3 -3
- package/esm/domain/__tests__/Call.test.js +6 -0
- package/esm/domain/__tests__/CallSession.test.js +1 -1
- package/esm/domain/__tests__/IndirectTransfer.test.js +1 -1
- package/esm/domain/__tests__/Line.test.js +5 -5
- package/esm/domain/__tests__/Room.test.js +1 -1
- package/esm/index.js +42 -8
- package/esm/lib/WazoSessionDescriptionHandler.js +30 -1
- package/esm/service/CallApi.js +6 -0
- package/esm/service/getApiClient.js +6 -0
- package/esm/simple/Auth.js +42 -8
- package/esm/simple/Configuration.js +42 -8
- package/esm/simple/Directory.js +6 -0
- package/esm/simple/Phone.js +42 -8
- package/esm/simple/Softphone.js +1 -2
- package/esm/simple/index.js +42 -8
- package/esm/simple/room/LocalParticipant.js +42 -8
- package/esm/simple/room/Participant.js +42 -8
- package/esm/simple/room/RemoteParticipant.js +42 -8
- package/esm/simple/room/Room.js +42 -8
- package/esm/simple/room/SipRoom.js +42 -8
- package/esm/simple/room/Stream.js +42 -8
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +42 -8
- package/esm/simple/utils.js +42 -8
- package/esm/utils/__tests__/sdp.test.js +50 -0
- package/esm/utils/sdp.js +19 -1
- package/esm/web-rtc-client.js +38 -3
- package/lib/__tests__/api-client.test.js +6 -0
- package/lib/__tests__/web-rtc-client.test.js +88 -3
- package/lib/api/calld.js +6 -0
- package/lib/api/ctid-ng.js +6 -0
- package/lib/api-client.js +6 -0
- package/lib/checker/Checker.js +38 -3
- package/lib/checker/checks/aor.js +6 -0
- package/lib/checker/checks/api.js +6 -0
- package/lib/checker/checks/index.js +38 -3
- package/lib/checker/checks/webrtc-transport.js +38 -3
- package/lib/checker/checks/webrtc.js +38 -3
- package/lib/domain/AdHocAPIConference.js +6 -0
- package/lib/domain/Call.js +6 -0
- package/lib/domain/CallSession.js +1 -1
- package/lib/domain/Features.js +6 -0
- package/lib/domain/Phone/CTIPhone.js +7 -1
- package/lib/domain/Phone/WebRTCPhone.js +3 -3
- package/lib/domain/__tests__/Call.test.js +6 -0
- package/lib/domain/__tests__/CallSession.test.js +1 -1
- package/lib/domain/__tests__/IndirectTransfer.test.js +1 -1
- package/lib/domain/__tests__/Line.test.js +5 -5
- package/lib/domain/__tests__/Room.test.js +1 -1
- package/lib/index.js +42 -8
- package/lib/lib/WazoSessionDescriptionHandler.js +30 -1
- package/lib/service/CallApi.js +6 -0
- package/lib/service/getApiClient.js +6 -0
- package/lib/simple/Auth.js +42 -8
- package/lib/simple/Configuration.js +42 -8
- package/lib/simple/Directory.js +6 -0
- package/lib/simple/Phone.js +42 -8
- package/lib/simple/Softphone.js +1 -2
- package/lib/simple/index.js +42 -8
- package/lib/simple/room/LocalParticipant.js +42 -8
- package/lib/simple/room/Participant.js +42 -8
- package/lib/simple/room/RemoteParticipant.js +42 -8
- package/lib/simple/room/Room.js +42 -8
- package/lib/simple/room/SipRoom.js +42 -8
- package/lib/simple/room/Stream.js +42 -8
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +42 -8
- package/lib/simple/utils.js +42 -8
- package/lib/utils/__tests__/sdp.test.js +50 -0
- package/lib/utils/sdp.js +19 -0
- package/lib/web-rtc-client.js +38 -3
- package/package.json +1 -1
- package/src/__tests__/web-rtc-client.test.js +50 -0
- package/src/domain/Call.js +6 -0
- package/src/domain/CallSession.js +1 -1
- package/src/domain/Phone/WebRTCPhone.js +2 -2
- package/src/domain/__tests__/Line.test.js +5 -5
- package/src/lib/WazoSessionDescriptionHandler.js +13 -2
- package/src/simple/Softphone.js +1 -2
- package/src/utils/__tests__/sdp.test.js +33 -1
- package/src/utils/sdp.js +18 -0
- package/src/web-rtc-client.js +2 -2
|
@@ -3071,6 +3071,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3071
3071
|
|
|
3072
3072
|
|
|
3073
3073
|
|
|
3074
|
+
|
|
3074
3075
|
|
|
3075
3076
|
|
|
3076
3077
|
|
|
@@ -3081,6 +3082,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3081
3082
|
|
|
3082
3083
|
|
|
3083
3084
|
|
|
3085
|
+
|
|
3084
3086
|
|
|
3085
3087
|
|
|
3086
3088
|
|
|
@@ -3109,6 +3111,7 @@ class Call {
|
|
|
3109
3111
|
|
|
3110
3112
|
|
|
3111
3113
|
|
|
3114
|
+
|
|
3112
3115
|
|
|
3113
3116
|
|
|
3114
3117
|
|
|
@@ -3133,6 +3136,7 @@ class Call {
|
|
|
3133
3136
|
calleeNumber: plain.peer_caller_id_number,
|
|
3134
3137
|
dialedExtension: plain.dialed_extension,
|
|
3135
3138
|
isCaller: plain.is_caller,
|
|
3139
|
+
isVideo: plain.is_video,
|
|
3136
3140
|
muted: plain.muted,
|
|
3137
3141
|
onHold: plain.on_hold,
|
|
3138
3142
|
status: plain.status,
|
|
@@ -3156,6 +3160,7 @@ class Call {
|
|
|
3156
3160
|
calleeNumber,
|
|
3157
3161
|
dialedExtension,
|
|
3158
3162
|
isCaller,
|
|
3163
|
+
isVideo,
|
|
3159
3164
|
lineId,
|
|
3160
3165
|
muted,
|
|
3161
3166
|
onHold,
|
|
@@ -3179,6 +3184,7 @@ class Call {
|
|
|
3179
3184
|
this.startingTime = startingTime;
|
|
3180
3185
|
this.talkingToIds = talkingToIds || [];
|
|
3181
3186
|
this.recording = recording;
|
|
3187
|
+
this.isVideo = !!isVideo;
|
|
3182
3188
|
|
|
3183
3189
|
// Useful to compare instead of instanceof with minified code
|
|
3184
3190
|
this.type = 'Call';
|
|
@@ -3652,7 +3658,7 @@ class CallSession {
|
|
|
3652
3658
|
ringing: call.isRinging(),
|
|
3653
3659
|
answered: call.isUp(),
|
|
3654
3660
|
answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
|
|
3655
|
-
cameraEnabled:
|
|
3661
|
+
cameraEnabled: call.isVideo,
|
|
3656
3662
|
dialedExtension: call.dialedExtension,
|
|
3657
3663
|
call,
|
|
3658
3664
|
conference: false, // @FIXME?
|
|
@@ -6198,6 +6204,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
6198
6204
|
return fixed;
|
|
6199
6205
|
};
|
|
6200
6206
|
|
|
6207
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
6208
|
+
const parsedSdp = sdpParser.parse(sdp);
|
|
6209
|
+
|
|
6210
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
6211
|
+
if (!mediaWithCandidate) {
|
|
6212
|
+
return sdp;
|
|
6213
|
+
}
|
|
6214
|
+
|
|
6215
|
+
const { candidates } = mediaWithCandidate;
|
|
6216
|
+
|
|
6217
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
6218
|
+
...media,
|
|
6219
|
+
candidates: media.candidates || candidates,
|
|
6220
|
+
}));
|
|
6221
|
+
|
|
6222
|
+
return sdpParser.write(parsedSdp);
|
|
6223
|
+
};
|
|
6224
|
+
|
|
6201
6225
|
/* global RTCSessionDescriptionInit, navigator */
|
|
6202
6226
|
|
|
6203
6227
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -6296,6 +6320,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6296
6320
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6297
6321
|
if (event.candidate) {
|
|
6298
6322
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6323
|
+
|
|
6324
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6325
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6326
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6327
|
+
ice: event.candidate.candidate,
|
|
6328
|
+
});
|
|
6329
|
+
this.iceGatheringComplete();
|
|
6330
|
+
}
|
|
6299
6331
|
}
|
|
6300
6332
|
};
|
|
6301
6333
|
|
|
@@ -6319,7 +6351,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6319
6351
|
|
|
6320
6352
|
// Check if we got ICEs
|
|
6321
6353
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
6322
|
-
return
|
|
6354
|
+
return {
|
|
6355
|
+
type: description.type,
|
|
6356
|
+
sdp: addIcesInAllBundles(sdp),
|
|
6357
|
+
};
|
|
6323
6358
|
}
|
|
6324
6359
|
|
|
6325
6360
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
@@ -7779,11 +7814,11 @@ class WebRTCClient extends Emitter {
|
|
|
7779
7814
|
});
|
|
7780
7815
|
}
|
|
7781
7816
|
|
|
7782
|
-
changeAudioInputDevice(id , session ) {
|
|
7817
|
+
changeAudioInputDevice(id , session , force ) {
|
|
7783
7818
|
const currentId = this.getAudioDeviceId();
|
|
7784
7819
|
logger$8.info('setting audio input device', { id, currentId, session: !!session });
|
|
7785
7820
|
|
|
7786
|
-
if (id === currentId) {
|
|
7821
|
+
if (!force && id === currentId) {
|
|
7787
7822
|
return null;
|
|
7788
7823
|
}
|
|
7789
7824
|
|
|
@@ -9579,10 +9614,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9579
9614
|
this.audioRingVolume = volume;
|
|
9580
9615
|
}
|
|
9581
9616
|
|
|
9582
|
-
changeAudioInputDevice(id ) {
|
|
9617
|
+
changeAudioInputDevice(id , force ) {
|
|
9583
9618
|
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9584
9619
|
|
|
9585
|
-
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9620
|
+
return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
|
|
9586
9621
|
}
|
|
9587
9622
|
|
|
9588
9623
|
changeVideoInputDevice(id ) {
|
|
@@ -13244,8 +13279,7 @@ class Softphone {
|
|
|
13244
13279
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13245
13280
|
|
|
13246
13281
|
if (!server) {
|
|
13247
|
-
|
|
13248
|
-
server = 'stack.dev.wazo.io';
|
|
13282
|
+
throw new Error('`server` is not set');
|
|
13249
13283
|
}
|
|
13250
13284
|
|
|
13251
13285
|
const config = { server };
|
package/esm/simple/room/Room.js
CHANGED
|
@@ -3071,6 +3071,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3071
3071
|
|
|
3072
3072
|
|
|
3073
3073
|
|
|
3074
|
+
|
|
3074
3075
|
|
|
3075
3076
|
|
|
3076
3077
|
|
|
@@ -3081,6 +3082,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3081
3082
|
|
|
3082
3083
|
|
|
3083
3084
|
|
|
3085
|
+
|
|
3084
3086
|
|
|
3085
3087
|
|
|
3086
3088
|
|
|
@@ -3109,6 +3111,7 @@ class Call {
|
|
|
3109
3111
|
|
|
3110
3112
|
|
|
3111
3113
|
|
|
3114
|
+
|
|
3112
3115
|
|
|
3113
3116
|
|
|
3114
3117
|
|
|
@@ -3133,6 +3136,7 @@ class Call {
|
|
|
3133
3136
|
calleeNumber: plain.peer_caller_id_number,
|
|
3134
3137
|
dialedExtension: plain.dialed_extension,
|
|
3135
3138
|
isCaller: plain.is_caller,
|
|
3139
|
+
isVideo: plain.is_video,
|
|
3136
3140
|
muted: plain.muted,
|
|
3137
3141
|
onHold: plain.on_hold,
|
|
3138
3142
|
status: plain.status,
|
|
@@ -3156,6 +3160,7 @@ class Call {
|
|
|
3156
3160
|
calleeNumber,
|
|
3157
3161
|
dialedExtension,
|
|
3158
3162
|
isCaller,
|
|
3163
|
+
isVideo,
|
|
3159
3164
|
lineId,
|
|
3160
3165
|
muted,
|
|
3161
3166
|
onHold,
|
|
@@ -3179,6 +3184,7 @@ class Call {
|
|
|
3179
3184
|
this.startingTime = startingTime;
|
|
3180
3185
|
this.talkingToIds = talkingToIds || [];
|
|
3181
3186
|
this.recording = recording;
|
|
3187
|
+
this.isVideo = !!isVideo;
|
|
3182
3188
|
|
|
3183
3189
|
// Useful to compare instead of instanceof with minified code
|
|
3184
3190
|
this.type = 'Call';
|
|
@@ -3652,7 +3658,7 @@ class CallSession {
|
|
|
3652
3658
|
ringing: call.isRinging(),
|
|
3653
3659
|
answered: call.isUp(),
|
|
3654
3660
|
answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
|
|
3655
|
-
cameraEnabled:
|
|
3661
|
+
cameraEnabled: call.isVideo,
|
|
3656
3662
|
dialedExtension: call.dialedExtension,
|
|
3657
3663
|
call,
|
|
3658
3664
|
conference: false, // @FIXME?
|
|
@@ -6198,6 +6204,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
6198
6204
|
return fixed;
|
|
6199
6205
|
};
|
|
6200
6206
|
|
|
6207
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
6208
|
+
const parsedSdp = sdpParser.parse(sdp);
|
|
6209
|
+
|
|
6210
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
6211
|
+
if (!mediaWithCandidate) {
|
|
6212
|
+
return sdp;
|
|
6213
|
+
}
|
|
6214
|
+
|
|
6215
|
+
const { candidates } = mediaWithCandidate;
|
|
6216
|
+
|
|
6217
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
6218
|
+
...media,
|
|
6219
|
+
candidates: media.candidates || candidates,
|
|
6220
|
+
}));
|
|
6221
|
+
|
|
6222
|
+
return sdpParser.write(parsedSdp);
|
|
6223
|
+
};
|
|
6224
|
+
|
|
6201
6225
|
/* global RTCSessionDescriptionInit, navigator */
|
|
6202
6226
|
|
|
6203
6227
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -6296,6 +6320,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6296
6320
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6297
6321
|
if (event.candidate) {
|
|
6298
6322
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6323
|
+
|
|
6324
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6325
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6326
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6327
|
+
ice: event.candidate.candidate,
|
|
6328
|
+
});
|
|
6329
|
+
this.iceGatheringComplete();
|
|
6330
|
+
}
|
|
6299
6331
|
}
|
|
6300
6332
|
};
|
|
6301
6333
|
|
|
@@ -6319,7 +6351,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6319
6351
|
|
|
6320
6352
|
// Check if we got ICEs
|
|
6321
6353
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
6322
|
-
return
|
|
6354
|
+
return {
|
|
6355
|
+
type: description.type,
|
|
6356
|
+
sdp: addIcesInAllBundles(sdp),
|
|
6357
|
+
};
|
|
6323
6358
|
}
|
|
6324
6359
|
|
|
6325
6360
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
@@ -7779,11 +7814,11 @@ class WebRTCClient extends Emitter {
|
|
|
7779
7814
|
});
|
|
7780
7815
|
}
|
|
7781
7816
|
|
|
7782
|
-
changeAudioInputDevice(id , session ) {
|
|
7817
|
+
changeAudioInputDevice(id , session , force ) {
|
|
7783
7818
|
const currentId = this.getAudioDeviceId();
|
|
7784
7819
|
logger$8.info('setting audio input device', { id, currentId, session: !!session });
|
|
7785
7820
|
|
|
7786
|
-
if (id === currentId) {
|
|
7821
|
+
if (!force && id === currentId) {
|
|
7787
7822
|
return null;
|
|
7788
7823
|
}
|
|
7789
7824
|
|
|
@@ -9579,10 +9614,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9579
9614
|
this.audioRingVolume = volume;
|
|
9580
9615
|
}
|
|
9581
9616
|
|
|
9582
|
-
changeAudioInputDevice(id ) {
|
|
9617
|
+
changeAudioInputDevice(id , force ) {
|
|
9583
9618
|
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9584
9619
|
|
|
9585
|
-
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9620
|
+
return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
|
|
9586
9621
|
}
|
|
9587
9622
|
|
|
9588
9623
|
changeVideoInputDevice(id ) {
|
|
@@ -13255,8 +13290,7 @@ class Softphone {
|
|
|
13255
13290
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13256
13291
|
|
|
13257
13292
|
if (!server) {
|
|
13258
|
-
|
|
13259
|
-
server = 'stack.dev.wazo.io';
|
|
13293
|
+
throw new Error('`server` is not set');
|
|
13260
13294
|
}
|
|
13261
13295
|
|
|
13262
13296
|
const config = { server };
|
|
@@ -3071,6 +3071,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3071
3071
|
|
|
3072
3072
|
|
|
3073
3073
|
|
|
3074
|
+
|
|
3074
3075
|
|
|
3075
3076
|
|
|
3076
3077
|
|
|
@@ -3081,6 +3082,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3081
3082
|
|
|
3082
3083
|
|
|
3083
3084
|
|
|
3085
|
+
|
|
3084
3086
|
|
|
3085
3087
|
|
|
3086
3088
|
|
|
@@ -3109,6 +3111,7 @@ class Call {
|
|
|
3109
3111
|
|
|
3110
3112
|
|
|
3111
3113
|
|
|
3114
|
+
|
|
3112
3115
|
|
|
3113
3116
|
|
|
3114
3117
|
|
|
@@ -3133,6 +3136,7 @@ class Call {
|
|
|
3133
3136
|
calleeNumber: plain.peer_caller_id_number,
|
|
3134
3137
|
dialedExtension: plain.dialed_extension,
|
|
3135
3138
|
isCaller: plain.is_caller,
|
|
3139
|
+
isVideo: plain.is_video,
|
|
3136
3140
|
muted: plain.muted,
|
|
3137
3141
|
onHold: plain.on_hold,
|
|
3138
3142
|
status: plain.status,
|
|
@@ -3156,6 +3160,7 @@ class Call {
|
|
|
3156
3160
|
calleeNumber,
|
|
3157
3161
|
dialedExtension,
|
|
3158
3162
|
isCaller,
|
|
3163
|
+
isVideo,
|
|
3159
3164
|
lineId,
|
|
3160
3165
|
muted,
|
|
3161
3166
|
onHold,
|
|
@@ -3179,6 +3184,7 @@ class Call {
|
|
|
3179
3184
|
this.startingTime = startingTime;
|
|
3180
3185
|
this.talkingToIds = talkingToIds || [];
|
|
3181
3186
|
this.recording = recording;
|
|
3187
|
+
this.isVideo = !!isVideo;
|
|
3182
3188
|
|
|
3183
3189
|
// Useful to compare instead of instanceof with minified code
|
|
3184
3190
|
this.type = 'Call';
|
|
@@ -3652,7 +3658,7 @@ class CallSession {
|
|
|
3652
3658
|
ringing: call.isRinging(),
|
|
3653
3659
|
answered: call.isUp(),
|
|
3654
3660
|
answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
|
|
3655
|
-
cameraEnabled:
|
|
3661
|
+
cameraEnabled: call.isVideo,
|
|
3656
3662
|
dialedExtension: call.dialedExtension,
|
|
3657
3663
|
call,
|
|
3658
3664
|
conference: false, // @FIXME?
|
|
@@ -6198,6 +6204,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
6198
6204
|
return fixed;
|
|
6199
6205
|
};
|
|
6200
6206
|
|
|
6207
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
6208
|
+
const parsedSdp = sdpParser.parse(sdp);
|
|
6209
|
+
|
|
6210
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
6211
|
+
if (!mediaWithCandidate) {
|
|
6212
|
+
return sdp;
|
|
6213
|
+
}
|
|
6214
|
+
|
|
6215
|
+
const { candidates } = mediaWithCandidate;
|
|
6216
|
+
|
|
6217
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
6218
|
+
...media,
|
|
6219
|
+
candidates: media.candidates || candidates,
|
|
6220
|
+
}));
|
|
6221
|
+
|
|
6222
|
+
return sdpParser.write(parsedSdp);
|
|
6223
|
+
};
|
|
6224
|
+
|
|
6201
6225
|
/* global RTCSessionDescriptionInit, navigator */
|
|
6202
6226
|
|
|
6203
6227
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -6296,6 +6320,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6296
6320
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6297
6321
|
if (event.candidate) {
|
|
6298
6322
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6323
|
+
|
|
6324
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6325
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6326
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6327
|
+
ice: event.candidate.candidate,
|
|
6328
|
+
});
|
|
6329
|
+
this.iceGatheringComplete();
|
|
6330
|
+
}
|
|
6299
6331
|
}
|
|
6300
6332
|
};
|
|
6301
6333
|
|
|
@@ -6319,7 +6351,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6319
6351
|
|
|
6320
6352
|
// Check if we got ICEs
|
|
6321
6353
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
6322
|
-
return
|
|
6354
|
+
return {
|
|
6355
|
+
type: description.type,
|
|
6356
|
+
sdp: addIcesInAllBundles(sdp),
|
|
6357
|
+
};
|
|
6323
6358
|
}
|
|
6324
6359
|
|
|
6325
6360
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
@@ -7779,11 +7814,11 @@ class WebRTCClient extends Emitter {
|
|
|
7779
7814
|
});
|
|
7780
7815
|
}
|
|
7781
7816
|
|
|
7782
|
-
changeAudioInputDevice(id , session ) {
|
|
7817
|
+
changeAudioInputDevice(id , session , force ) {
|
|
7783
7818
|
const currentId = this.getAudioDeviceId();
|
|
7784
7819
|
logger$8.info('setting audio input device', { id, currentId, session: !!session });
|
|
7785
7820
|
|
|
7786
|
-
if (id === currentId) {
|
|
7821
|
+
if (!force && id === currentId) {
|
|
7787
7822
|
return null;
|
|
7788
7823
|
}
|
|
7789
7824
|
|
|
@@ -9579,10 +9614,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9579
9614
|
this.audioRingVolume = volume;
|
|
9580
9615
|
}
|
|
9581
9616
|
|
|
9582
|
-
changeAudioInputDevice(id ) {
|
|
9617
|
+
changeAudioInputDevice(id , force ) {
|
|
9583
9618
|
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9584
9619
|
|
|
9585
|
-
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9620
|
+
return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
|
|
9586
9621
|
}
|
|
9587
9622
|
|
|
9588
9623
|
changeVideoInputDevice(id ) {
|
|
@@ -13952,8 +13987,7 @@ class Softphone {
|
|
|
13952
13987
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13953
13988
|
|
|
13954
13989
|
if (!server) {
|
|
13955
|
-
|
|
13956
|
-
server = 'stack.dev.wazo.io';
|
|
13990
|
+
throw new Error('`server` is not set');
|
|
13957
13991
|
}
|
|
13958
13992
|
|
|
13959
13993
|
const config = { server };
|
|
@@ -3071,6 +3071,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3071
3071
|
|
|
3072
3072
|
|
|
3073
3073
|
|
|
3074
|
+
|
|
3074
3075
|
|
|
3075
3076
|
|
|
3076
3077
|
|
|
@@ -3081,6 +3082,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3081
3082
|
|
|
3082
3083
|
|
|
3083
3084
|
|
|
3085
|
+
|
|
3084
3086
|
|
|
3085
3087
|
|
|
3086
3088
|
|
|
@@ -3109,6 +3111,7 @@ class Call {
|
|
|
3109
3111
|
|
|
3110
3112
|
|
|
3111
3113
|
|
|
3114
|
+
|
|
3112
3115
|
|
|
3113
3116
|
|
|
3114
3117
|
|
|
@@ -3133,6 +3136,7 @@ class Call {
|
|
|
3133
3136
|
calleeNumber: plain.peer_caller_id_number,
|
|
3134
3137
|
dialedExtension: plain.dialed_extension,
|
|
3135
3138
|
isCaller: plain.is_caller,
|
|
3139
|
+
isVideo: plain.is_video,
|
|
3136
3140
|
muted: plain.muted,
|
|
3137
3141
|
onHold: plain.on_hold,
|
|
3138
3142
|
status: plain.status,
|
|
@@ -3156,6 +3160,7 @@ class Call {
|
|
|
3156
3160
|
calleeNumber,
|
|
3157
3161
|
dialedExtension,
|
|
3158
3162
|
isCaller,
|
|
3163
|
+
isVideo,
|
|
3159
3164
|
lineId,
|
|
3160
3165
|
muted,
|
|
3161
3166
|
onHold,
|
|
@@ -3179,6 +3184,7 @@ class Call {
|
|
|
3179
3184
|
this.startingTime = startingTime;
|
|
3180
3185
|
this.talkingToIds = talkingToIds || [];
|
|
3181
3186
|
this.recording = recording;
|
|
3187
|
+
this.isVideo = !!isVideo;
|
|
3182
3188
|
|
|
3183
3189
|
// Useful to compare instead of instanceof with minified code
|
|
3184
3190
|
this.type = 'Call';
|
|
@@ -3652,7 +3658,7 @@ class CallSession {
|
|
|
3652
3658
|
ringing: call.isRinging(),
|
|
3653
3659
|
answered: call.isUp(),
|
|
3654
3660
|
answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
|
|
3655
|
-
cameraEnabled:
|
|
3661
|
+
cameraEnabled: call.isVideo,
|
|
3656
3662
|
dialedExtension: call.dialedExtension,
|
|
3657
3663
|
call,
|
|
3658
3664
|
conference: false, // @FIXME?
|
|
@@ -6198,6 +6204,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
6198
6204
|
return fixed;
|
|
6199
6205
|
};
|
|
6200
6206
|
|
|
6207
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
6208
|
+
const parsedSdp = sdpParser.parse(sdp);
|
|
6209
|
+
|
|
6210
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
6211
|
+
if (!mediaWithCandidate) {
|
|
6212
|
+
return sdp;
|
|
6213
|
+
}
|
|
6214
|
+
|
|
6215
|
+
const { candidates } = mediaWithCandidate;
|
|
6216
|
+
|
|
6217
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
6218
|
+
...media,
|
|
6219
|
+
candidates: media.candidates || candidates,
|
|
6220
|
+
}));
|
|
6221
|
+
|
|
6222
|
+
return sdpParser.write(parsedSdp);
|
|
6223
|
+
};
|
|
6224
|
+
|
|
6201
6225
|
/* global RTCSessionDescriptionInit, navigator */
|
|
6202
6226
|
|
|
6203
6227
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -6296,6 +6320,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6296
6320
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6297
6321
|
if (event.candidate) {
|
|
6298
6322
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6323
|
+
|
|
6324
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6325
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6326
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6327
|
+
ice: event.candidate.candidate,
|
|
6328
|
+
});
|
|
6329
|
+
this.iceGatheringComplete();
|
|
6330
|
+
}
|
|
6299
6331
|
}
|
|
6300
6332
|
};
|
|
6301
6333
|
|
|
@@ -6319,7 +6351,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6319
6351
|
|
|
6320
6352
|
// Check if we got ICEs
|
|
6321
6353
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
6322
|
-
return
|
|
6354
|
+
return {
|
|
6355
|
+
type: description.type,
|
|
6356
|
+
sdp: addIcesInAllBundles(sdp),
|
|
6357
|
+
};
|
|
6323
6358
|
}
|
|
6324
6359
|
|
|
6325
6360
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
@@ -7779,11 +7814,11 @@ class WebRTCClient extends Emitter {
|
|
|
7779
7814
|
});
|
|
7780
7815
|
}
|
|
7781
7816
|
|
|
7782
|
-
changeAudioInputDevice(id , session ) {
|
|
7817
|
+
changeAudioInputDevice(id , session , force ) {
|
|
7783
7818
|
const currentId = this.getAudioDeviceId();
|
|
7784
7819
|
logger$8.info('setting audio input device', { id, currentId, session: !!session });
|
|
7785
7820
|
|
|
7786
|
-
if (id === currentId) {
|
|
7821
|
+
if (!force && id === currentId) {
|
|
7787
7822
|
return null;
|
|
7788
7823
|
}
|
|
7789
7824
|
|
|
@@ -9579,10 +9614,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9579
9614
|
this.audioRingVolume = volume;
|
|
9580
9615
|
}
|
|
9581
9616
|
|
|
9582
|
-
changeAudioInputDevice(id ) {
|
|
9617
|
+
changeAudioInputDevice(id , force ) {
|
|
9583
9618
|
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9584
9619
|
|
|
9585
|
-
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9620
|
+
return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
|
|
9586
9621
|
}
|
|
9587
9622
|
|
|
9588
9623
|
changeVideoInputDevice(id ) {
|
|
@@ -14033,8 +14068,7 @@ class Softphone {
|
|
|
14033
14068
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14034
14069
|
|
|
14035
14070
|
if (!server) {
|
|
14036
|
-
|
|
14037
|
-
server = 'stack.dev.wazo.io';
|
|
14071
|
+
throw new Error('`server` is not set');
|
|
14038
14072
|
}
|
|
14039
14073
|
|
|
14040
14074
|
const config = { server };
|