@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/esm/index.js
CHANGED
|
@@ -3072,6 +3072,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3072
3072
|
|
|
3073
3073
|
|
|
3074
3074
|
|
|
3075
|
+
|
|
3075
3076
|
|
|
3076
3077
|
|
|
3077
3078
|
|
|
@@ -3082,6 +3083,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3082
3083
|
|
|
3083
3084
|
|
|
3084
3085
|
|
|
3086
|
+
|
|
3085
3087
|
|
|
3086
3088
|
|
|
3087
3089
|
|
|
@@ -3110,6 +3112,7 @@ class Call {
|
|
|
3110
3112
|
|
|
3111
3113
|
|
|
3112
3114
|
|
|
3115
|
+
|
|
3113
3116
|
|
|
3114
3117
|
|
|
3115
3118
|
|
|
@@ -3134,6 +3137,7 @@ class Call {
|
|
|
3134
3137
|
calleeNumber: plain.peer_caller_id_number,
|
|
3135
3138
|
dialedExtension: plain.dialed_extension,
|
|
3136
3139
|
isCaller: plain.is_caller,
|
|
3140
|
+
isVideo: plain.is_video,
|
|
3137
3141
|
muted: plain.muted,
|
|
3138
3142
|
onHold: plain.on_hold,
|
|
3139
3143
|
status: plain.status,
|
|
@@ -3157,6 +3161,7 @@ class Call {
|
|
|
3157
3161
|
calleeNumber,
|
|
3158
3162
|
dialedExtension,
|
|
3159
3163
|
isCaller,
|
|
3164
|
+
isVideo,
|
|
3160
3165
|
lineId,
|
|
3161
3166
|
muted,
|
|
3162
3167
|
onHold,
|
|
@@ -3180,6 +3185,7 @@ class Call {
|
|
|
3180
3185
|
this.startingTime = startingTime;
|
|
3181
3186
|
this.talkingToIds = talkingToIds || [];
|
|
3182
3187
|
this.recording = recording;
|
|
3188
|
+
this.isVideo = !!isVideo;
|
|
3183
3189
|
|
|
3184
3190
|
// Useful to compare instead of instanceof with minified code
|
|
3185
3191
|
this.type = 'Call';
|
|
@@ -3653,7 +3659,7 @@ class CallSession {
|
|
|
3653
3659
|
ringing: call.isRinging(),
|
|
3654
3660
|
answered: call.isUp(),
|
|
3655
3661
|
answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
|
|
3656
|
-
cameraEnabled:
|
|
3662
|
+
cameraEnabled: call.isVideo,
|
|
3657
3663
|
dialedExtension: call.dialedExtension,
|
|
3658
3664
|
call,
|
|
3659
3665
|
conference: false, // @FIXME?
|
|
@@ -5719,6 +5725,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5719
5725
|
return fixed;
|
|
5720
5726
|
};
|
|
5721
5727
|
|
|
5728
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
5729
|
+
const parsedSdp = sdpParser.parse(sdp);
|
|
5730
|
+
|
|
5731
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
5732
|
+
if (!mediaWithCandidate) {
|
|
5733
|
+
return sdp;
|
|
5734
|
+
}
|
|
5735
|
+
|
|
5736
|
+
const { candidates } = mediaWithCandidate;
|
|
5737
|
+
|
|
5738
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
5739
|
+
...media,
|
|
5740
|
+
candidates: media.candidates || candidates,
|
|
5741
|
+
}));
|
|
5742
|
+
|
|
5743
|
+
return sdpParser.write(parsedSdp);
|
|
5744
|
+
};
|
|
5745
|
+
|
|
5722
5746
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5723
5747
|
|
|
5724
5748
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -5817,6 +5841,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5817
5841
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5818
5842
|
if (event.candidate) {
|
|
5819
5843
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
5844
|
+
|
|
5845
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
5846
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
5847
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
5848
|
+
ice: event.candidate.candidate,
|
|
5849
|
+
});
|
|
5850
|
+
this.iceGatheringComplete();
|
|
5851
|
+
}
|
|
5820
5852
|
}
|
|
5821
5853
|
};
|
|
5822
5854
|
|
|
@@ -5840,7 +5872,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5840
5872
|
|
|
5841
5873
|
// Check if we got ICEs
|
|
5842
5874
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
5843
|
-
return
|
|
5875
|
+
return {
|
|
5876
|
+
type: description.type,
|
|
5877
|
+
sdp: addIcesInAllBundles(sdp),
|
|
5878
|
+
};
|
|
5844
5879
|
}
|
|
5845
5880
|
|
|
5846
5881
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
@@ -7300,11 +7335,11 @@ class WebRTCClient extends Emitter {
|
|
|
7300
7335
|
});
|
|
7301
7336
|
}
|
|
7302
7337
|
|
|
7303
|
-
changeAudioInputDevice(id , session ) {
|
|
7338
|
+
changeAudioInputDevice(id , session , force ) {
|
|
7304
7339
|
const currentId = this.getAudioDeviceId();
|
|
7305
7340
|
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7306
7341
|
|
|
7307
|
-
if (id === currentId) {
|
|
7342
|
+
if (!force && id === currentId) {
|
|
7308
7343
|
return null;
|
|
7309
7344
|
}
|
|
7310
7345
|
|
|
@@ -10001,10 +10036,10 @@ class WebRTCPhone extends Emitter {
|
|
|
10001
10036
|
this.audioRingVolume = volume;
|
|
10002
10037
|
}
|
|
10003
10038
|
|
|
10004
|
-
changeAudioInputDevice(id ) {
|
|
10039
|
+
changeAudioInputDevice(id , force ) {
|
|
10005
10040
|
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
10006
10041
|
|
|
10007
|
-
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
10042
|
+
return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
|
|
10008
10043
|
}
|
|
10009
10044
|
|
|
10010
10045
|
changeVideoInputDevice(id ) {
|
|
@@ -14229,8 +14264,7 @@ class Softphone {
|
|
|
14229
14264
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14230
14265
|
|
|
14231
14266
|
if (!server) {
|
|
14232
|
-
|
|
14233
|
-
server = 'stack.dev.wazo.io';
|
|
14267
|
+
throw new Error('`server` is not set');
|
|
14234
14268
|
}
|
|
14235
14269
|
|
|
14236
14270
|
const config = { server };
|
|
@@ -442,6 +442,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
442
442
|
return fixed;
|
|
443
443
|
};
|
|
444
444
|
|
|
445
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
446
|
+
const parsedSdp = sdpParser.parse(sdp);
|
|
447
|
+
|
|
448
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
449
|
+
if (!mediaWithCandidate) {
|
|
450
|
+
return sdp;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
const { candidates } = mediaWithCandidate;
|
|
454
|
+
|
|
455
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
456
|
+
...media,
|
|
457
|
+
candidates: media.candidates || candidates,
|
|
458
|
+
}));
|
|
459
|
+
|
|
460
|
+
return sdpParser.write(parsedSdp);
|
|
461
|
+
};
|
|
462
|
+
|
|
445
463
|
/* global RTCSessionDescriptionInit, navigator */
|
|
446
464
|
|
|
447
465
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -540,6 +558,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
540
558
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
541
559
|
if (event.candidate) {
|
|
542
560
|
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
561
|
+
|
|
562
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
563
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
564
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
565
|
+
ice: event.candidate.candidate,
|
|
566
|
+
});
|
|
567
|
+
this.iceGatheringComplete();
|
|
568
|
+
}
|
|
543
569
|
}
|
|
544
570
|
};
|
|
545
571
|
|
|
@@ -563,7 +589,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
563
589
|
|
|
564
590
|
// Check if we got ICEs
|
|
565
591
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
566
|
-
return
|
|
592
|
+
return {
|
|
593
|
+
type: description.type,
|
|
594
|
+
sdp: addIcesInAllBundles(sdp),
|
|
595
|
+
};
|
|
567
596
|
}
|
|
568
597
|
|
|
569
598
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
package/esm/service/CallApi.js
CHANGED
|
@@ -30,6 +30,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
|
|
@@ -40,6 +41,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
40
41
|
|
|
41
42
|
|
|
42
43
|
|
|
44
|
+
|
|
43
45
|
|
|
44
46
|
|
|
45
47
|
|
|
@@ -68,6 +70,7 @@ class Call {
|
|
|
68
70
|
|
|
69
71
|
|
|
70
72
|
|
|
73
|
+
|
|
71
74
|
|
|
72
75
|
|
|
73
76
|
|
|
@@ -92,6 +95,7 @@ class Call {
|
|
|
92
95
|
calleeNumber: plain.peer_caller_id_number,
|
|
93
96
|
dialedExtension: plain.dialed_extension,
|
|
94
97
|
isCaller: plain.is_caller,
|
|
98
|
+
isVideo: plain.is_video,
|
|
95
99
|
muted: plain.muted,
|
|
96
100
|
onHold: plain.on_hold,
|
|
97
101
|
status: plain.status,
|
|
@@ -115,6 +119,7 @@ class Call {
|
|
|
115
119
|
calleeNumber,
|
|
116
120
|
dialedExtension,
|
|
117
121
|
isCaller,
|
|
122
|
+
isVideo,
|
|
118
123
|
lineId,
|
|
119
124
|
muted,
|
|
120
125
|
onHold,
|
|
@@ -138,6 +143,7 @@ class Call {
|
|
|
138
143
|
this.startingTime = startingTime;
|
|
139
144
|
this.talkingToIds = talkingToIds || [];
|
|
140
145
|
this.recording = recording;
|
|
146
|
+
this.isVideo = !!isVideo;
|
|
141
147
|
|
|
142
148
|
// Useful to compare instead of instanceof with minified code
|
|
143
149
|
this.type = 'Call';
|
|
@@ -3051,6 +3051,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3051
3051
|
|
|
3052
3052
|
|
|
3053
3053
|
|
|
3054
|
+
|
|
3054
3055
|
|
|
3055
3056
|
|
|
3056
3057
|
|
|
@@ -3061,6 +3062,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3061
3062
|
|
|
3062
3063
|
|
|
3063
3064
|
|
|
3065
|
+
|
|
3064
3066
|
|
|
3065
3067
|
|
|
3066
3068
|
|
|
@@ -3089,6 +3091,7 @@ class Call {
|
|
|
3089
3091
|
|
|
3090
3092
|
|
|
3091
3093
|
|
|
3094
|
+
|
|
3092
3095
|
|
|
3093
3096
|
|
|
3094
3097
|
|
|
@@ -3113,6 +3116,7 @@ class Call {
|
|
|
3113
3116
|
calleeNumber: plain.peer_caller_id_number,
|
|
3114
3117
|
dialedExtension: plain.dialed_extension,
|
|
3115
3118
|
isCaller: plain.is_caller,
|
|
3119
|
+
isVideo: plain.is_video,
|
|
3116
3120
|
muted: plain.muted,
|
|
3117
3121
|
onHold: plain.on_hold,
|
|
3118
3122
|
status: plain.status,
|
|
@@ -3136,6 +3140,7 @@ class Call {
|
|
|
3136
3140
|
calleeNumber,
|
|
3137
3141
|
dialedExtension,
|
|
3138
3142
|
isCaller,
|
|
3143
|
+
isVideo,
|
|
3139
3144
|
lineId,
|
|
3140
3145
|
muted,
|
|
3141
3146
|
onHold,
|
|
@@ -3159,6 +3164,7 @@ class Call {
|
|
|
3159
3164
|
this.startingTime = startingTime;
|
|
3160
3165
|
this.talkingToIds = talkingToIds || [];
|
|
3161
3166
|
this.recording = recording;
|
|
3167
|
+
this.isVideo = !!isVideo;
|
|
3162
3168
|
|
|
3163
3169
|
// Useful to compare instead of instanceof with minified code
|
|
3164
3170
|
this.type = 'Call';
|
package/esm/simple/Auth.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?
|
|
@@ -5897,6 +5903,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5897
5903
|
return fixed;
|
|
5898
5904
|
};
|
|
5899
5905
|
|
|
5906
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
5907
|
+
const parsedSdp = sdpParser.parse(sdp);
|
|
5908
|
+
|
|
5909
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
5910
|
+
if (!mediaWithCandidate) {
|
|
5911
|
+
return sdp;
|
|
5912
|
+
}
|
|
5913
|
+
|
|
5914
|
+
const { candidates } = mediaWithCandidate;
|
|
5915
|
+
|
|
5916
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
5917
|
+
...media,
|
|
5918
|
+
candidates: media.candidates || candidates,
|
|
5919
|
+
}));
|
|
5920
|
+
|
|
5921
|
+
return sdpParser.write(parsedSdp);
|
|
5922
|
+
};
|
|
5923
|
+
|
|
5900
5924
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5901
5925
|
|
|
5902
5926
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -5995,6 +6019,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5995
6019
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5996
6020
|
if (event.candidate) {
|
|
5997
6021
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6022
|
+
|
|
6023
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6024
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6025
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6026
|
+
ice: event.candidate.candidate,
|
|
6027
|
+
});
|
|
6028
|
+
this.iceGatheringComplete();
|
|
6029
|
+
}
|
|
5998
6030
|
}
|
|
5999
6031
|
};
|
|
6000
6032
|
|
|
@@ -6018,7 +6050,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6018
6050
|
|
|
6019
6051
|
// Check if we got ICEs
|
|
6020
6052
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
6021
|
-
return
|
|
6053
|
+
return {
|
|
6054
|
+
type: description.type,
|
|
6055
|
+
sdp: addIcesInAllBundles(sdp),
|
|
6056
|
+
};
|
|
6022
6057
|
}
|
|
6023
6058
|
|
|
6024
6059
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
@@ -7478,11 +7513,11 @@ class WebRTCClient extends Emitter {
|
|
|
7478
7513
|
});
|
|
7479
7514
|
}
|
|
7480
7515
|
|
|
7481
|
-
changeAudioInputDevice(id , session ) {
|
|
7516
|
+
changeAudioInputDevice(id , session , force ) {
|
|
7482
7517
|
const currentId = this.getAudioDeviceId();
|
|
7483
7518
|
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7484
7519
|
|
|
7485
|
-
if (id === currentId) {
|
|
7520
|
+
if (!force && id === currentId) {
|
|
7486
7521
|
return null;
|
|
7487
7522
|
}
|
|
7488
7523
|
|
|
@@ -9278,10 +9313,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9278
9313
|
this.audioRingVolume = volume;
|
|
9279
9314
|
}
|
|
9280
9315
|
|
|
9281
|
-
changeAudioInputDevice(id ) {
|
|
9316
|
+
changeAudioInputDevice(id , force ) {
|
|
9282
9317
|
logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9283
9318
|
|
|
9284
|
-
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9319
|
+
return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
|
|
9285
9320
|
}
|
|
9286
9321
|
|
|
9287
9322
|
changeVideoInputDevice(id ) {
|
|
@@ -13790,8 +13825,7 @@ class Softphone {
|
|
|
13790
13825
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13791
13826
|
|
|
13792
13827
|
if (!server) {
|
|
13793
|
-
|
|
13794
|
-
server = 'stack.dev.wazo.io';
|
|
13828
|
+
throw new Error('`server` is not set');
|
|
13795
13829
|
}
|
|
13796
13830
|
|
|
13797
13831
|
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?
|
|
@@ -5897,6 +5903,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5897
5903
|
return fixed;
|
|
5898
5904
|
};
|
|
5899
5905
|
|
|
5906
|
+
const addIcesInAllBundles = (sdp ) => {
|
|
5907
|
+
const parsedSdp = sdpParser.parse(sdp);
|
|
5908
|
+
|
|
5909
|
+
const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
|
|
5910
|
+
if (!mediaWithCandidate) {
|
|
5911
|
+
return sdp;
|
|
5912
|
+
}
|
|
5913
|
+
|
|
5914
|
+
const { candidates } = mediaWithCandidate;
|
|
5915
|
+
|
|
5916
|
+
parsedSdp.media = parsedSdp.media.map(media => ({
|
|
5917
|
+
...media,
|
|
5918
|
+
candidates: media.candidates || candidates,
|
|
5919
|
+
}));
|
|
5920
|
+
|
|
5921
|
+
return sdpParser.write(parsedSdp);
|
|
5922
|
+
};
|
|
5923
|
+
|
|
5900
5924
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5901
5925
|
|
|
5902
5926
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
@@ -5995,6 +6019,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5995
6019
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5996
6020
|
if (event.candidate) {
|
|
5997
6021
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6022
|
+
|
|
6023
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6024
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6025
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6026
|
+
ice: event.candidate.candidate,
|
|
6027
|
+
});
|
|
6028
|
+
this.iceGatheringComplete();
|
|
6029
|
+
}
|
|
5998
6030
|
}
|
|
5999
6031
|
};
|
|
6000
6032
|
|
|
@@ -6018,7 +6050,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6018
6050
|
|
|
6019
6051
|
// Check if we got ICEs
|
|
6020
6052
|
if (sdp.indexOf('a=candidate') !== -1) {
|
|
6021
|
-
return
|
|
6053
|
+
return {
|
|
6054
|
+
type: description.type,
|
|
6055
|
+
sdp: addIcesInAllBundles(sdp),
|
|
6056
|
+
};
|
|
6022
6057
|
}
|
|
6023
6058
|
|
|
6024
6059
|
wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
|
|
@@ -7478,11 +7513,11 @@ class WebRTCClient extends Emitter {
|
|
|
7478
7513
|
});
|
|
7479
7514
|
}
|
|
7480
7515
|
|
|
7481
|
-
changeAudioInputDevice(id , session ) {
|
|
7516
|
+
changeAudioInputDevice(id , session , force ) {
|
|
7482
7517
|
const currentId = this.getAudioDeviceId();
|
|
7483
7518
|
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7484
7519
|
|
|
7485
|
-
if (id === currentId) {
|
|
7520
|
+
if (!force && id === currentId) {
|
|
7486
7521
|
return null;
|
|
7487
7522
|
}
|
|
7488
7523
|
|
|
@@ -9278,10 +9313,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9278
9313
|
this.audioRingVolume = volume;
|
|
9279
9314
|
}
|
|
9280
9315
|
|
|
9281
|
-
changeAudioInputDevice(id ) {
|
|
9316
|
+
changeAudioInputDevice(id , force ) {
|
|
9282
9317
|
logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9283
9318
|
|
|
9284
|
-
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9319
|
+
return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
|
|
9285
9320
|
}
|
|
9286
9321
|
|
|
9287
9322
|
changeVideoInputDevice(id ) {
|
|
@@ -13773,8 +13808,7 @@ class Softphone {
|
|
|
13773
13808
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13774
13809
|
|
|
13775
13810
|
if (!server) {
|
|
13776
|
-
|
|
13777
|
-
server = 'stack.dev.wazo.io';
|
|
13811
|
+
throw new Error('`server` is not set');
|
|
13778
13812
|
}
|
|
13779
13813
|
|
|
13780
13814
|
const config = { server };
|
package/esm/simple/Directory.js
CHANGED
|
@@ -3051,6 +3051,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3051
3051
|
|
|
3052
3052
|
|
|
3053
3053
|
|
|
3054
|
+
|
|
3054
3055
|
|
|
3055
3056
|
|
|
3056
3057
|
|
|
@@ -3061,6 +3062,7 @@ const RECORD_STATE_ACTIVE = 'active';
|
|
|
3061
3062
|
|
|
3062
3063
|
|
|
3063
3064
|
|
|
3065
|
+
|
|
3064
3066
|
|
|
3065
3067
|
|
|
3066
3068
|
|
|
@@ -3089,6 +3091,7 @@ class Call {
|
|
|
3089
3091
|
|
|
3090
3092
|
|
|
3091
3093
|
|
|
3094
|
+
|
|
3092
3095
|
|
|
3093
3096
|
|
|
3094
3097
|
|
|
@@ -3113,6 +3116,7 @@ class Call {
|
|
|
3113
3116
|
calleeNumber: plain.peer_caller_id_number,
|
|
3114
3117
|
dialedExtension: plain.dialed_extension,
|
|
3115
3118
|
isCaller: plain.is_caller,
|
|
3119
|
+
isVideo: plain.is_video,
|
|
3116
3120
|
muted: plain.muted,
|
|
3117
3121
|
onHold: plain.on_hold,
|
|
3118
3122
|
status: plain.status,
|
|
@@ -3136,6 +3140,7 @@ class Call {
|
|
|
3136
3140
|
calleeNumber,
|
|
3137
3141
|
dialedExtension,
|
|
3138
3142
|
isCaller,
|
|
3143
|
+
isVideo,
|
|
3139
3144
|
lineId,
|
|
3140
3145
|
muted,
|
|
3141
3146
|
onHold,
|
|
@@ -3159,6 +3164,7 @@ class Call {
|
|
|
3159
3164
|
this.startingTime = startingTime;
|
|
3160
3165
|
this.talkingToIds = talkingToIds || [];
|
|
3161
3166
|
this.recording = recording;
|
|
3167
|
+
this.isVideo = !!isVideo;
|
|
3162
3168
|
|
|
3163
3169
|
// Useful to compare instead of instanceof with minified code
|
|
3164
3170
|
this.type = 'Call';
|