@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
package/lib/simple/Auth.js
CHANGED
|
@@ -3083,6 +3083,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3083
3083
|
|
|
3084
3084
|
|
|
3085
3085
|
|
|
3086
|
+
|
|
3086
3087
|
|
|
3087
3088
|
|
|
3088
3089
|
|
|
@@ -3093,6 +3094,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3093
3094
|
|
|
3094
3095
|
|
|
3095
3096
|
|
|
3097
|
+
|
|
3096
3098
|
|
|
3097
3099
|
|
|
3098
3100
|
|
|
@@ -3121,6 +3123,7 @@ class Call {
|
|
|
3121
3123
|
|
|
3122
3124
|
|
|
3123
3125
|
|
|
3126
|
+
|
|
3124
3127
|
|
|
3125
3128
|
|
|
3126
3129
|
|
|
@@ -3145,6 +3148,7 @@ class Call {
|
|
|
3145
3148
|
calleeNumber: plain.peer_caller_id_number,
|
|
3146
3149
|
dialedExtension: plain.dialed_extension,
|
|
3147
3150
|
isCaller: plain.is_caller,
|
|
3151
|
+
isVideo: plain.is_video,
|
|
3148
3152
|
muted: plain.muted,
|
|
3149
3153
|
onHold: plain.on_hold,
|
|
3150
3154
|
status: plain.status,
|
|
@@ -3168,6 +3172,7 @@ class Call {
|
|
|
3168
3172
|
calleeNumber,
|
|
3169
3173
|
dialedExtension,
|
|
3170
3174
|
isCaller,
|
|
3175
|
+
isVideo,
|
|
3171
3176
|
lineId,
|
|
3172
3177
|
muted,
|
|
3173
3178
|
onHold,
|
|
@@ -3191,6 +3196,7 @@ class Call {
|
|
|
3191
3196
|
this.startingTime = startingTime;
|
|
3192
3197
|
this.talkingToIds = talkingToIds || [];
|
|
3193
3198
|
this.recording = recording;
|
|
3199
|
+
this.isVideo = !!isVideo;
|
|
3194
3200
|
|
|
3195
3201
|
// Useful to compare instead of instanceof with minified code
|
|
3196
3202
|
this.type = 'Call';
|
|
@@ -3664,7 +3670,7 @@ class CallSession {
|
|
|
3664
3670
|
ringing: call.isRinging(),
|
|
3665
3671
|
answered: call.isUp(),
|
|
3666
3672
|
answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
|
|
3667
|
-
cameraEnabled:
|
|
3673
|
+
cameraEnabled: call.isVideo,
|
|
3668
3674
|
dialedExtension: call.dialedExtension,
|
|
3669
3675
|
call,
|
|
3670
3676
|
conference: false, // @FIXME?
|
|
@@ -5909,6 +5915,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5909
5915
|
return fixed;
|
|
5910
5916
|
};
|
|
5911
5917
|
|
|
5918
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
5919
|
+
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5920
|
+
|
|
5921
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
5922
|
+
if (!mediaWithCandidate) {
|
|
5923
|
+
return sdp;
|
|
5924
|
+
}
|
|
5925
|
+
|
|
5926
|
+
const { candidates } = mediaWithCandidate;
|
|
5927
|
+
|
|
5928
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
5929
|
+
...media,
|
|
5930
|
+
candidates: media.candidates || candidates,
|
|
5931
|
+
}));
|
|
5932
|
+
|
|
5933
|
+
return sdpParser__default['default'].write(parsedSdp);
|
|
5934
|
+
};
|
|
5935
|
+
|
|
5912
5936
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5913
5937
|
|
|
5914
5938
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -6007,6 +6031,14 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6007
6031
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6008
6032
|
if (event.candidate) {
|
|
6009
6033
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6034
|
+
|
|
6035
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6036
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6037
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6038
|
+
ice: event.candidate.candidate,
|
|
6039
|
+
});
|
|
6040
|
+
this.iceGatheringComplete();
|
|
6041
|
+
}
|
|
6010
6042
|
}
|
|
6011
6043
|
};
|
|
6012
6044
|
|
|
@@ -6030,7 +6062,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6030
6062
|
|
|
6031
6063
|
// Check if we got ICEs
|
|
6032
6064
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
6033
|
-
return
|
|
6065
|
+
return {
|
|
6066
|
+
type: description.type,
|
|
6067
|
+
sdp: addIcesInAllBundles(sdp),
|
|
6068
|
+
};
|
|
6034
6069
|
}
|
|
6035
6070
|
|
|
6036
6071
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
@@ -7490,11 +7525,11 @@ class WebRTCClient extends Emitter {
|
|
|
7490
7525
|
});
|
|
7491
7526
|
}
|
|
7492
7527
|
|
|
7493
|
-
changeAudioInputDevice(id , session ) {
|
|
7528
|
+
changeAudioInputDevice(id , session , force ) {
|
|
7494
7529
|
const currentId = this.getAudioDeviceId();
|
|
7495
7530
|
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7496
7531
|
|
|
7497
|
-
if (id === currentId) {
|
|
7532
|
+
if (!force && id === currentId) {
|
|
7498
7533
|
return null;
|
|
7499
7534
|
}
|
|
7500
7535
|
|
|
@@ -9290,10 +9325,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9290
9325
|
this.audioRingVolume = volume;
|
|
9291
9326
|
}
|
|
9292
9327
|
|
|
9293
|
-
changeAudioInputDevice(id ) {
|
|
9328
|
+
changeAudioInputDevice(id , force ) {
|
|
9294
9329
|
logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9295
9330
|
|
|
9296
|
-
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9331
|
+
return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
|
|
9297
9332
|
}
|
|
9298
9333
|
|
|
9299
9334
|
changeVideoInputDevice(id ) {
|
|
@@ -13802,8 +13837,7 @@ class Softphone {
|
|
|
13802
13837
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13803
13838
|
|
|
13804
13839
|
if (!server) {
|
|
13805
|
-
|
|
13806
|
-
server = 'stack.dev.wazo.io';
|
|
13840
|
+
throw new Error('`server` is not set');
|
|
13807
13841
|
}
|
|
13808
13842
|
|
|
13809
13843
|
const config = { server };
|
|
@@ -3081,6 +3081,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3081
3081
|
|
|
3082
3082
|
|
|
3083
3083
|
|
|
3084
|
+
|
|
3084
3085
|
|
|
3085
3086
|
|
|
3086
3087
|
|
|
@@ -3091,6 +3092,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3091
3092
|
|
|
3092
3093
|
|
|
3093
3094
|
|
|
3095
|
+
|
|
3094
3096
|
|
|
3095
3097
|
|
|
3096
3098
|
|
|
@@ -3119,6 +3121,7 @@ class Call {
|
|
|
3119
3121
|
|
|
3120
3122
|
|
|
3121
3123
|
|
|
3124
|
+
|
|
3122
3125
|
|
|
3123
3126
|
|
|
3124
3127
|
|
|
@@ -3143,6 +3146,7 @@ class Call {
|
|
|
3143
3146
|
calleeNumber: plain.peer_caller_id_number,
|
|
3144
3147
|
dialedExtension: plain.dialed_extension,
|
|
3145
3148
|
isCaller: plain.is_caller,
|
|
3149
|
+
isVideo: plain.is_video,
|
|
3146
3150
|
muted: plain.muted,
|
|
3147
3151
|
onHold: plain.on_hold,
|
|
3148
3152
|
status: plain.status,
|
|
@@ -3166,6 +3170,7 @@ class Call {
|
|
|
3166
3170
|
calleeNumber,
|
|
3167
3171
|
dialedExtension,
|
|
3168
3172
|
isCaller,
|
|
3173
|
+
isVideo,
|
|
3169
3174
|
lineId,
|
|
3170
3175
|
muted,
|
|
3171
3176
|
onHold,
|
|
@@ -3189,6 +3194,7 @@ class Call {
|
|
|
3189
3194
|
this.startingTime = startingTime;
|
|
3190
3195
|
this.talkingToIds = talkingToIds || [];
|
|
3191
3196
|
this.recording = recording;
|
|
3197
|
+
this.isVideo = !!isVideo;
|
|
3192
3198
|
|
|
3193
3199
|
// Useful to compare instead of instanceof with minified code
|
|
3194
3200
|
this.type = 'Call';
|
|
@@ -3662,7 +3668,7 @@ class CallSession {
|
|
|
3662
3668
|
ringing: call.isRinging(),
|
|
3663
3669
|
answered: call.isUp(),
|
|
3664
3670
|
answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
|
|
3665
|
-
cameraEnabled:
|
|
3671
|
+
cameraEnabled: call.isVideo,
|
|
3666
3672
|
dialedExtension: call.dialedExtension,
|
|
3667
3673
|
call,
|
|
3668
3674
|
conference: false, // @FIXME?
|
|
@@ -5907,6 +5913,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5907
5913
|
return fixed;
|
|
5908
5914
|
};
|
|
5909
5915
|
|
|
5916
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
5917
|
+
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5918
|
+
|
|
5919
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
5920
|
+
if (!mediaWithCandidate) {
|
|
5921
|
+
return sdp;
|
|
5922
|
+
}
|
|
5923
|
+
|
|
5924
|
+
const { candidates } = mediaWithCandidate;
|
|
5925
|
+
|
|
5926
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
5927
|
+
...media,
|
|
5928
|
+
candidates: media.candidates || candidates,
|
|
5929
|
+
}));
|
|
5930
|
+
|
|
5931
|
+
return sdpParser__default['default'].write(parsedSdp);
|
|
5932
|
+
};
|
|
5933
|
+
|
|
5910
5934
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5911
5935
|
|
|
5912
5936
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -6005,6 +6029,14 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6005
6029
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6006
6030
|
if (event.candidate) {
|
|
6007
6031
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6032
|
+
|
|
6033
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6034
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6035
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6036
|
+
ice: event.candidate.candidate,
|
|
6037
|
+
});
|
|
6038
|
+
this.iceGatheringComplete();
|
|
6039
|
+
}
|
|
6008
6040
|
}
|
|
6009
6041
|
};
|
|
6010
6042
|
|
|
@@ -6028,7 +6060,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6028
6060
|
|
|
6029
6061
|
// Check if we got ICEs
|
|
6030
6062
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
6031
|
-
return
|
|
6063
|
+
return {
|
|
6064
|
+
type: description.type,
|
|
6065
|
+
sdp: addIcesInAllBundles(sdp),
|
|
6066
|
+
};
|
|
6032
6067
|
}
|
|
6033
6068
|
|
|
6034
6069
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
@@ -7488,11 +7523,11 @@ class WebRTCClient extends Emitter {
|
|
|
7488
7523
|
});
|
|
7489
7524
|
}
|
|
7490
7525
|
|
|
7491
|
-
changeAudioInputDevice(id , session ) {
|
|
7526
|
+
changeAudioInputDevice(id , session , force ) {
|
|
7492
7527
|
const currentId = this.getAudioDeviceId();
|
|
7493
7528
|
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7494
7529
|
|
|
7495
|
-
if (id === currentId) {
|
|
7530
|
+
if (!force && id === currentId) {
|
|
7496
7531
|
return null;
|
|
7497
7532
|
}
|
|
7498
7533
|
|
|
@@ -9288,10 +9323,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9288
9323
|
this.audioRingVolume = volume;
|
|
9289
9324
|
}
|
|
9290
9325
|
|
|
9291
|
-
changeAudioInputDevice(id ) {
|
|
9326
|
+
changeAudioInputDevice(id , force ) {
|
|
9292
9327
|
logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9293
9328
|
|
|
9294
|
-
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9329
|
+
return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
|
|
9295
9330
|
}
|
|
9296
9331
|
|
|
9297
9332
|
changeVideoInputDevice(id ) {
|
|
@@ -13783,8 +13818,7 @@ class Softphone {
|
|
|
13783
13818
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13784
13819
|
|
|
13785
13820
|
if (!server) {
|
|
13786
|
-
|
|
13787
|
-
server = 'stack.dev.wazo.io';
|
|
13821
|
+
throw new Error('`server` is not set');
|
|
13788
13822
|
}
|
|
13789
13823
|
|
|
13790
13824
|
const config = { server };
|
package/lib/simple/Directory.js
CHANGED
|
@@ -3057,6 +3057,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3057
3057
|
|
|
3058
3058
|
|
|
3059
3059
|
|
|
3060
|
+
|
|
3060
3061
|
|
|
3061
3062
|
|
|
3062
3063
|
|
|
@@ -3067,6 +3068,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3067
3068
|
|
|
3068
3069
|
|
|
3069
3070
|
|
|
3071
|
+
|
|
3070
3072
|
|
|
3071
3073
|
|
|
3072
3074
|
|
|
@@ -3095,6 +3097,7 @@ class Call {
|
|
|
3095
3097
|
|
|
3096
3098
|
|
|
3097
3099
|
|
|
3100
|
+
|
|
3098
3101
|
|
|
3099
3102
|
|
|
3100
3103
|
|
|
@@ -3119,6 +3122,7 @@ class Call {
|
|
|
3119
3122
|
calleeNumber: plain.peer_caller_id_number,
|
|
3120
3123
|
dialedExtension: plain.dialed_extension,
|
|
3121
3124
|
isCaller: plain.is_caller,
|
|
3125
|
+
isVideo: plain.is_video,
|
|
3122
3126
|
muted: plain.muted,
|
|
3123
3127
|
onHold: plain.on_hold,
|
|
3124
3128
|
status: plain.status,
|
|
@@ -3142,6 +3146,7 @@ class Call {
|
|
|
3142
3146
|
calleeNumber,
|
|
3143
3147
|
dialedExtension,
|
|
3144
3148
|
isCaller,
|
|
3149
|
+
isVideo,
|
|
3145
3150
|
lineId,
|
|
3146
3151
|
muted,
|
|
3147
3152
|
onHold,
|
|
@@ -3165,6 +3170,7 @@ class Call {
|
|
|
3165
3170
|
this.startingTime = startingTime;
|
|
3166
3171
|
this.talkingToIds = talkingToIds || [];
|
|
3167
3172
|
this.recording = recording;
|
|
3173
|
+
this.isVideo = !!isVideo;
|
|
3168
3174
|
|
|
3169
3175
|
// Useful to compare instead of instanceof with minified code
|
|
3170
3176
|
this.type = 'Call';
|
package/lib/simple/Phone.js
CHANGED
|
@@ -59,6 +59,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
|
|
62
|
+
|
|
62
63
|
|
|
63
64
|
|
|
64
65
|
|
|
@@ -69,6 +70,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
69
70
|
|
|
70
71
|
|
|
71
72
|
|
|
73
|
+
|
|
72
74
|
|
|
73
75
|
|
|
74
76
|
|
|
@@ -97,6 +99,7 @@ class Call {
|
|
|
97
99
|
|
|
98
100
|
|
|
99
101
|
|
|
102
|
+
|
|
100
103
|
|
|
101
104
|
|
|
102
105
|
|
|
@@ -121,6 +124,7 @@ class Call {
|
|
|
121
124
|
calleeNumber: plain.peer_caller_id_number,
|
|
122
125
|
dialedExtension: plain.dialed_extension,
|
|
123
126
|
isCaller: plain.is_caller,
|
|
127
|
+
isVideo: plain.is_video,
|
|
124
128
|
muted: plain.muted,
|
|
125
129
|
onHold: plain.on_hold,
|
|
126
130
|
status: plain.status,
|
|
@@ -144,6 +148,7 @@ class Call {
|
|
|
144
148
|
calleeNumber,
|
|
145
149
|
dialedExtension,
|
|
146
150
|
isCaller,
|
|
151
|
+
isVideo,
|
|
147
152
|
lineId,
|
|
148
153
|
muted,
|
|
149
154
|
onHold,
|
|
@@ -167,6 +172,7 @@ class Call {
|
|
|
167
172
|
this.startingTime = startingTime;
|
|
168
173
|
this.talkingToIds = talkingToIds || [];
|
|
169
174
|
this.recording = recording;
|
|
175
|
+
this.isVideo = !!isVideo;
|
|
170
176
|
|
|
171
177
|
// Useful to compare instead of instanceof with minified code
|
|
172
178
|
this.type = 'Call';
|
|
@@ -640,7 +646,7 @@ class CallSession {
|
|
|
640
646
|
ringing: call.isRinging(),
|
|
641
647
|
answered: call.isUp(),
|
|
642
648
|
answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
|
|
643
|
-
cameraEnabled:
|
|
649
|
+
cameraEnabled: call.isVideo,
|
|
644
650
|
dialedExtension: call.dialedExtension,
|
|
645
651
|
call,
|
|
646
652
|
conference: false, // @FIXME?
|
|
@@ -5907,6 +5913,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5907
5913
|
return fixed;
|
|
5908
5914
|
};
|
|
5909
5915
|
|
|
5916
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
5917
|
+
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5918
|
+
|
|
5919
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
5920
|
+
if (!mediaWithCandidate) {
|
|
5921
|
+
return sdp;
|
|
5922
|
+
}
|
|
5923
|
+
|
|
5924
|
+
const { candidates } = mediaWithCandidate;
|
|
5925
|
+
|
|
5926
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
5927
|
+
...media,
|
|
5928
|
+
candidates: media.candidates || candidates,
|
|
5929
|
+
}));
|
|
5930
|
+
|
|
5931
|
+
return sdpParser__default['default'].write(parsedSdp);
|
|
5932
|
+
};
|
|
5933
|
+
|
|
5910
5934
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5911
5935
|
|
|
5912
5936
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -6005,6 +6029,14 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6005
6029
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6006
6030
|
if (event.candidate) {
|
|
6007
6031
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6032
|
+
|
|
6033
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6034
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6035
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6036
|
+
ice: event.candidate.candidate,
|
|
6037
|
+
});
|
|
6038
|
+
this.iceGatheringComplete();
|
|
6039
|
+
}
|
|
6008
6040
|
}
|
|
6009
6041
|
};
|
|
6010
6042
|
|
|
@@ -6028,7 +6060,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6028
6060
|
|
|
6029
6061
|
// Check if we got ICEs
|
|
6030
6062
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
6031
|
-
return
|
|
6063
|
+
return {
|
|
6064
|
+
type: description.type,
|
|
6065
|
+
sdp: addIcesInAllBundles(sdp),
|
|
6066
|
+
};
|
|
6032
6067
|
}
|
|
6033
6068
|
|
|
6034
6069
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
@@ -7488,11 +7523,11 @@ class WebRTCClient extends Emitter {
|
|
|
7488
7523
|
});
|
|
7489
7524
|
}
|
|
7490
7525
|
|
|
7491
|
-
changeAudioInputDevice(id , session ) {
|
|
7526
|
+
changeAudioInputDevice(id , session , force ) {
|
|
7492
7527
|
const currentId = this.getAudioDeviceId();
|
|
7493
7528
|
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7494
7529
|
|
|
7495
|
-
if (id === currentId) {
|
|
7530
|
+
if (!force && id === currentId) {
|
|
7496
7531
|
return null;
|
|
7497
7532
|
}
|
|
7498
7533
|
|
|
@@ -9288,10 +9323,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9288
9323
|
this.audioRingVolume = volume;
|
|
9289
9324
|
}
|
|
9290
9325
|
|
|
9291
|
-
changeAudioInputDevice(id ) {
|
|
9326
|
+
changeAudioInputDevice(id , force ) {
|
|
9292
9327
|
logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9293
9328
|
|
|
9294
|
-
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9329
|
+
return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
|
|
9295
9330
|
}
|
|
9296
9331
|
|
|
9297
9332
|
changeVideoInputDevice(id ) {
|
|
@@ -13691,8 +13726,7 @@ class Softphone {
|
|
|
13691
13726
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13692
13727
|
|
|
13693
13728
|
if (!server) {
|
|
13694
|
-
|
|
13695
|
-
server = 'stack.dev.wazo.io';
|
|
13729
|
+
throw new Error('`server` is not set');
|
|
13696
13730
|
}
|
|
13697
13731
|
|
|
13698
13732
|
const config = { server };
|
package/lib/simple/Softphone.js
CHANGED
|
@@ -122,8 +122,7 @@ class Softphone {
|
|
|
122
122
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
123
123
|
|
|
124
124
|
if (!server) {
|
|
125
|
-
|
|
126
|
-
server = 'stack.dev.wazo.io';
|
|
125
|
+
throw new Error('`server` is not set');
|
|
127
126
|
}
|
|
128
127
|
|
|
129
128
|
const config = { server };
|
package/lib/simple/index.js
CHANGED
|
@@ -3081,6 +3081,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3081
3081
|
|
|
3082
3082
|
|
|
3083
3083
|
|
|
3084
|
+
|
|
3084
3085
|
|
|
3085
3086
|
|
|
3086
3087
|
|
|
@@ -3091,6 +3092,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3091
3092
|
|
|
3092
3093
|
|
|
3093
3094
|
|
|
3095
|
+
|
|
3094
3096
|
|
|
3095
3097
|
|
|
3096
3098
|
|
|
@@ -3119,6 +3121,7 @@ class Call {
|
|
|
3119
3121
|
|
|
3120
3122
|
|
|
3121
3123
|
|
|
3124
|
+
|
|
3122
3125
|
|
|
3123
3126
|
|
|
3124
3127
|
|
|
@@ -3143,6 +3146,7 @@ class Call {
|
|
|
3143
3146
|
calleeNumber: plain.peer_caller_id_number,
|
|
3144
3147
|
dialedExtension: plain.dialed_extension,
|
|
3145
3148
|
isCaller: plain.is_caller,
|
|
3149
|
+
isVideo: plain.is_video,
|
|
3146
3150
|
muted: plain.muted,
|
|
3147
3151
|
onHold: plain.on_hold,
|
|
3148
3152
|
status: plain.status,
|
|
@@ -3166,6 +3170,7 @@ class Call {
|
|
|
3166
3170
|
calleeNumber,
|
|
3167
3171
|
dialedExtension,
|
|
3168
3172
|
isCaller,
|
|
3173
|
+
isVideo,
|
|
3169
3174
|
lineId,
|
|
3170
3175
|
muted,
|
|
3171
3176
|
onHold,
|
|
@@ -3189,6 +3194,7 @@ class Call {
|
|
|
3189
3194
|
this.startingTime = startingTime;
|
|
3190
3195
|
this.talkingToIds = talkingToIds || [];
|
|
3191
3196
|
this.recording = recording;
|
|
3197
|
+
this.isVideo = !!isVideo;
|
|
3192
3198
|
|
|
3193
3199
|
// Useful to compare instead of instanceof with minified code
|
|
3194
3200
|
this.type = 'Call';
|
|
@@ -3662,7 +3668,7 @@ class CallSession {
|
|
|
3662
3668
|
ringing: call.isRinging(),
|
|
3663
3669
|
answered: call.isUp(),
|
|
3664
3670
|
answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
|
|
3665
|
-
cameraEnabled:
|
|
3671
|
+
cameraEnabled: call.isVideo,
|
|
3666
3672
|
dialedExtension: call.dialedExtension,
|
|
3667
3673
|
call,
|
|
3668
3674
|
conference: false, // @FIXME?
|
|
@@ -6208,6 +6214,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
6208
6214
|
return fixed;
|
|
6209
6215
|
};
|
|
6210
6216
|
|
|
6217
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
6218
|
+
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
6219
|
+
|
|
6220
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
6221
|
+
if (!mediaWithCandidate) {
|
|
6222
|
+
return sdp;
|
|
6223
|
+
}
|
|
6224
|
+
|
|
6225
|
+
const { candidates } = mediaWithCandidate;
|
|
6226
|
+
|
|
6227
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
6228
|
+
...media,
|
|
6229
|
+
candidates: media.candidates || candidates,
|
|
6230
|
+
}));
|
|
6231
|
+
|
|
6232
|
+
return sdpParser__default['default'].write(parsedSdp);
|
|
6233
|
+
};
|
|
6234
|
+
|
|
6211
6235
|
/* global RTCSessionDescriptionInit, navigator */
|
|
6212
6236
|
|
|
6213
6237
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -6306,6 +6330,14 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6306
6330
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6307
6331
|
if (event.candidate) {
|
|
6308
6332
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6333
|
+
|
|
6334
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6335
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6336
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6337
|
+
ice: event.candidate.candidate,
|
|
6338
|
+
});
|
|
6339
|
+
this.iceGatheringComplete();
|
|
6340
|
+
}
|
|
6309
6341
|
}
|
|
6310
6342
|
};
|
|
6311
6343
|
|
|
@@ -6329,7 +6361,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6329
6361
|
|
|
6330
6362
|
// Check if we got ICEs
|
|
6331
6363
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
6332
|
-
return
|
|
6364
|
+
return {
|
|
6365
|
+
type: description.type,
|
|
6366
|
+
sdp: addIcesInAllBundles(sdp),
|
|
6367
|
+
};
|
|
6333
6368
|
}
|
|
6334
6369
|
|
|
6335
6370
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
@@ -7789,11 +7824,11 @@ class WebRTCClient extends Emitter {
|
|
|
7789
7824
|
});
|
|
7790
7825
|
}
|
|
7791
7826
|
|
|
7792
|
-
changeAudioInputDevice(id , session ) {
|
|
7827
|
+
changeAudioInputDevice(id , session , force ) {
|
|
7793
7828
|
const currentId = this.getAudioDeviceId();
|
|
7794
7829
|
logger$8.info('setting audio input device', { id, currentId, session: !!session });
|
|
7795
7830
|
|
|
7796
|
-
if (id === currentId) {
|
|
7831
|
+
if (!force && id === currentId) {
|
|
7797
7832
|
return null;
|
|
7798
7833
|
}
|
|
7799
7834
|
|
|
@@ -9589,10 +9624,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9589
9624
|
this.audioRingVolume = volume;
|
|
9590
9625
|
}
|
|
9591
9626
|
|
|
9592
|
-
changeAudioInputDevice(id ) {
|
|
9627
|
+
changeAudioInputDevice(id , force ) {
|
|
9593
9628
|
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9594
9629
|
|
|
9595
|
-
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9630
|
+
return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
|
|
9596
9631
|
}
|
|
9597
9632
|
|
|
9598
9633
|
changeVideoInputDevice(id ) {
|
|
@@ -14101,8 +14136,7 @@ class Softphone {
|
|
|
14101
14136
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14102
14137
|
|
|
14103
14138
|
if (!server) {
|
|
14104
|
-
|
|
14105
|
-
server = 'stack.dev.wazo.io';
|
|
14139
|
+
throw new Error('`server` is not set');
|
|
14106
14140
|
}
|
|
14107
14141
|
|
|
14108
14142
|
const config = { server };
|