@wazo/sdk 0.37.4 → 0.37.8
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 +2 -2
- package/esm/__tests__/web-rtc-client.test.js +4 -0
- package/esm/checker/Checker.js +4 -0
- package/esm/checker/checks/index.js +4 -0
- package/esm/checker/checks/webrtc-transport.js +4 -0
- package/esm/checker/checks/webrtc.js +4 -0
- package/esm/domain/Phone/WebRTCPhone.js +17 -4
- package/esm/index.js +23 -5
- package/esm/simple/Auth.js +23 -5
- package/esm/simple/Configuration.js +23 -5
- package/esm/simple/Phone.js +23 -5
- package/esm/simple/index.js +23 -5
- package/esm/simple/room/LocalParticipant.js +23 -5
- package/esm/simple/room/Participant.js +23 -5
- package/esm/simple/room/RemoteParticipant.js +23 -5
- package/esm/simple/room/Room.js +23 -5
- package/esm/simple/room/SipRoom.js +23 -5
- package/esm/simple/room/Stream.js +23 -5
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +23 -5
- package/esm/simple/utils.js +23 -5
- package/esm/web-rtc-client.js +4 -0
- package/lib/__tests__/web-rtc-client.test.js +4 -0
- package/lib/checker/Checker.js +4 -0
- package/lib/checker/checks/index.js +4 -0
- package/lib/checker/checks/webrtc-transport.js +4 -0
- package/lib/checker/checks/webrtc.js +4 -0
- package/lib/domain/Phone/WebRTCPhone.js +17 -4
- package/lib/index.js +23 -5
- package/lib/simple/Auth.js +23 -5
- package/lib/simple/Configuration.js +23 -5
- package/lib/simple/Phone.js +23 -5
- package/lib/simple/index.js +23 -5
- package/lib/simple/room/LocalParticipant.js +23 -5
- package/lib/simple/room/Participant.js +23 -5
- package/lib/simple/room/RemoteParticipant.js +23 -5
- package/lib/simple/room/Room.js +23 -5
- package/lib/simple/room/SipRoom.js +23 -5
- package/lib/simple/room/Stream.js +23 -5
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +23 -5
- package/lib/simple/utils.js +23 -5
- package/lib/web-rtc-client.js +4 -0
- package/package.json +1 -1
- package/src/domain/Phone/WebRTCPhone.js +17 -4
- package/src/simple/room/Room.js +2 -1
- package/src/web-rtc-client.js +4 -0
|
@@ -5797,6 +5797,8 @@ class WebRTCClient extends Emitter {
|
|
|
5797
5797
|
}
|
|
5798
5798
|
options.sessionDescriptionHandlerOptions = {
|
|
5799
5799
|
constraints: options.constraints,
|
|
5800
|
+
hold: true,
|
|
5801
|
+
conference: isConference,
|
|
5800
5802
|
};
|
|
5801
5803
|
|
|
5802
5804
|
// Send re-INVITE
|
|
@@ -5839,6 +5841,8 @@ class WebRTCClient extends Emitter {
|
|
|
5839
5841
|
}
|
|
5840
5842
|
options.sessionDescriptionHandlerOptions = {
|
|
5841
5843
|
constraints: options.constraints,
|
|
5844
|
+
hold: false,
|
|
5845
|
+
conference: isConference,
|
|
5842
5846
|
};
|
|
5843
5847
|
|
|
5844
5848
|
// Send re-INVITE
|
|
@@ -1050,7 +1050,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1050
1050
|
return this.client.onDisconnect();
|
|
1051
1051
|
}
|
|
1052
1052
|
|
|
1053
|
-
_downgradeToAudio(callSession ) {
|
|
1053
|
+
_downgradeToAudio(callSession , withMessage = true) {
|
|
1054
1054
|
const sipSession = this.findSipSession(callSession);
|
|
1055
1055
|
if (!sipSession) {
|
|
1056
1056
|
return false;
|
|
@@ -1077,7 +1077,9 @@ class WebRTCPhone extends Emitter {
|
|
|
1077
1077
|
localStream.removeTrack(videoTrack);
|
|
1078
1078
|
});
|
|
1079
1079
|
|
|
1080
|
-
|
|
1080
|
+
if (withMessage) {
|
|
1081
|
+
this._sendReinviteMessage(callSession, false);
|
|
1082
|
+
}
|
|
1081
1083
|
|
|
1082
1084
|
return true;
|
|
1083
1085
|
}
|
|
@@ -1096,9 +1098,9 @@ class WebRTCPhone extends Emitter {
|
|
|
1096
1098
|
|
|
1097
1099
|
// Check if a video sender already exists
|
|
1098
1100
|
let videoSender;
|
|
1101
|
+
const videoTransceiver = pc.getTransceivers().find(transceiver => transceiver.mid === '1');
|
|
1099
1102
|
if (isConference) {
|
|
1100
|
-
|
|
1101
|
-
videoSender = trans ? trans.sender : null;
|
|
1103
|
+
videoSender = videoTransceiver ? videoTransceiver.sender : null;
|
|
1102
1104
|
} else {
|
|
1103
1105
|
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
1104
1106
|
}
|
|
@@ -1128,6 +1130,11 @@ class WebRTCPhone extends Emitter {
|
|
|
1128
1130
|
videoSender.replaceTrack(videoTrack);
|
|
1129
1131
|
}
|
|
1130
1132
|
|
|
1133
|
+
// Put back last direction (was set to `recvonly` when downgrading)
|
|
1134
|
+
if (videoTransceiver && videoTransceiver.currentDirection !== videoTransceiver.direction) {
|
|
1135
|
+
videoTransceiver.direction = videoTransceiver.currentDirection;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1131
1138
|
this.client.setLocalMediaStream(this.getSipSessionId(sipSession), newStream);
|
|
1132
1139
|
this._sendReinviteMessage(callSession, true);
|
|
1133
1140
|
|
|
@@ -1290,6 +1297,12 @@ class WebRTCPhone extends Emitter {
|
|
|
1290
1297
|
// We have to downgrade to audio.
|
|
1291
1298
|
const screenshareStopped = this.currentScreenShare.sender && this.currentScreenShare.hadVideo;
|
|
1292
1299
|
const constraints = { audio: false, video: screenshareStopped };
|
|
1300
|
+
if (!conference) {
|
|
1301
|
+
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
1302
|
+
this._downgradeToAudio(targetCallSession, false);
|
|
1303
|
+
// Wait for the track to be removed, unless the video sender won't have a null track in `_upgradeToVideo`.
|
|
1304
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
1305
|
+
}
|
|
1293
1306
|
reinvited = await this.sendReinvite(targetCallSession, constraints, conference);
|
|
1294
1307
|
}
|
|
1295
1308
|
} catch (e) {
|
package/lib/index.js
CHANGED
|
@@ -6608,6 +6608,8 @@ class WebRTCClient extends Emitter {
|
|
|
6608
6608
|
}
|
|
6609
6609
|
options.sessionDescriptionHandlerOptions = {
|
|
6610
6610
|
constraints: options.constraints,
|
|
6611
|
+
hold: true,
|
|
6612
|
+
conference: isConference,
|
|
6611
6613
|
};
|
|
6612
6614
|
|
|
6613
6615
|
// Send re-INVITE
|
|
@@ -6650,6 +6652,8 @@ class WebRTCClient extends Emitter {
|
|
|
6650
6652
|
}
|
|
6651
6653
|
options.sessionDescriptionHandlerOptions = {
|
|
6652
6654
|
constraints: options.constraints,
|
|
6655
|
+
hold: false,
|
|
6656
|
+
conference: isConference,
|
|
6653
6657
|
};
|
|
6654
6658
|
|
|
6655
6659
|
// Send re-INVITE
|
|
@@ -8869,7 +8873,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8869
8873
|
return this.client.onDisconnect();
|
|
8870
8874
|
}
|
|
8871
8875
|
|
|
8872
|
-
_downgradeToAudio(callSession ) {
|
|
8876
|
+
_downgradeToAudio(callSession , withMessage = true) {
|
|
8873
8877
|
const sipSession = this.findSipSession(callSession);
|
|
8874
8878
|
if (!sipSession) {
|
|
8875
8879
|
return false;
|
|
@@ -8896,7 +8900,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8896
8900
|
localStream.removeTrack(videoTrack);
|
|
8897
8901
|
});
|
|
8898
8902
|
|
|
8899
|
-
|
|
8903
|
+
if (withMessage) {
|
|
8904
|
+
this._sendReinviteMessage(callSession, false);
|
|
8905
|
+
}
|
|
8900
8906
|
|
|
8901
8907
|
return true;
|
|
8902
8908
|
}
|
|
@@ -8915,9 +8921,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8915
8921
|
|
|
8916
8922
|
// Check if a video sender already exists
|
|
8917
8923
|
let videoSender;
|
|
8924
|
+
const videoTransceiver = pc.getTransceivers().find(transceiver => transceiver.mid === '1');
|
|
8918
8925
|
if (isConference) {
|
|
8919
|
-
|
|
8920
|
-
videoSender = trans ? trans.sender : null;
|
|
8926
|
+
videoSender = videoTransceiver ? videoTransceiver.sender : null;
|
|
8921
8927
|
} else {
|
|
8922
8928
|
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
8923
8929
|
}
|
|
@@ -8947,6 +8953,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8947
8953
|
videoSender.replaceTrack(videoTrack);
|
|
8948
8954
|
}
|
|
8949
8955
|
|
|
8956
|
+
// Put back last direction (was set to `recvonly` when downgrading)
|
|
8957
|
+
if (videoTransceiver && videoTransceiver.currentDirection !== videoTransceiver.direction) {
|
|
8958
|
+
videoTransceiver.direction = videoTransceiver.currentDirection;
|
|
8959
|
+
}
|
|
8960
|
+
|
|
8950
8961
|
this.client.setLocalMediaStream(this.getSipSessionId(sipSession), newStream);
|
|
8951
8962
|
this._sendReinviteMessage(callSession, true);
|
|
8952
8963
|
|
|
@@ -9109,6 +9120,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9109
9120
|
// We have to downgrade to audio.
|
|
9110
9121
|
const screenshareStopped = this.currentScreenShare.sender && this.currentScreenShare.hadVideo;
|
|
9111
9122
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9123
|
+
if (!conference) {
|
|
9124
|
+
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
9125
|
+
this._downgradeToAudio(targetCallSession, false);
|
|
9126
|
+
// Wait for the track to be removed, unless the video sender won't have a null track in `_upgradeToVideo`.
|
|
9127
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
9128
|
+
}
|
|
9112
9129
|
reinvited = await this.sendReinvite(targetCallSession, constraints, conference);
|
|
9113
9130
|
}
|
|
9114
9131
|
} catch (e) {
|
|
@@ -12792,7 +12809,8 @@ class Room extends Emitter {
|
|
|
12792
12809
|
}
|
|
12793
12810
|
|
|
12794
12811
|
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
12795
|
-
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
12812
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
12813
|
+
stream && stream.id === streamId);
|
|
12796
12814
|
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
12797
12815
|
}
|
|
12798
12816
|
|
package/lib/simple/Auth.js
CHANGED
|
@@ -6783,6 +6783,8 @@ class WebRTCClient extends Emitter {
|
|
|
6783
6783
|
}
|
|
6784
6784
|
options.sessionDescriptionHandlerOptions = {
|
|
6785
6785
|
constraints: options.constraints,
|
|
6786
|
+
hold: true,
|
|
6787
|
+
conference: isConference,
|
|
6786
6788
|
};
|
|
6787
6789
|
|
|
6788
6790
|
// Send re-INVITE
|
|
@@ -6825,6 +6827,8 @@ class WebRTCClient extends Emitter {
|
|
|
6825
6827
|
}
|
|
6826
6828
|
options.sessionDescriptionHandlerOptions = {
|
|
6827
6829
|
constraints: options.constraints,
|
|
6830
|
+
hold: false,
|
|
6831
|
+
conference: isConference,
|
|
6828
6832
|
};
|
|
6829
6833
|
|
|
6830
6834
|
// Send re-INVITE
|
|
@@ -8154,7 +8158,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8154
8158
|
return this.client.onDisconnect();
|
|
8155
8159
|
}
|
|
8156
8160
|
|
|
8157
|
-
_downgradeToAudio(callSession ) {
|
|
8161
|
+
_downgradeToAudio(callSession , withMessage = true) {
|
|
8158
8162
|
const sipSession = this.findSipSession(callSession);
|
|
8159
8163
|
if (!sipSession) {
|
|
8160
8164
|
return false;
|
|
@@ -8181,7 +8185,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8181
8185
|
localStream.removeTrack(videoTrack);
|
|
8182
8186
|
});
|
|
8183
8187
|
|
|
8184
|
-
|
|
8188
|
+
if (withMessage) {
|
|
8189
|
+
this._sendReinviteMessage(callSession, false);
|
|
8190
|
+
}
|
|
8185
8191
|
|
|
8186
8192
|
return true;
|
|
8187
8193
|
}
|
|
@@ -8200,9 +8206,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8200
8206
|
|
|
8201
8207
|
// Check if a video sender already exists
|
|
8202
8208
|
let videoSender;
|
|
8209
|
+
const videoTransceiver = pc.getTransceivers().find(transceiver => transceiver.mid === '1');
|
|
8203
8210
|
if (isConference) {
|
|
8204
|
-
|
|
8205
|
-
videoSender = trans ? trans.sender : null;
|
|
8211
|
+
videoSender = videoTransceiver ? videoTransceiver.sender : null;
|
|
8206
8212
|
} else {
|
|
8207
8213
|
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
8208
8214
|
}
|
|
@@ -8232,6 +8238,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8232
8238
|
videoSender.replaceTrack(videoTrack);
|
|
8233
8239
|
}
|
|
8234
8240
|
|
|
8241
|
+
// Put back last direction (was set to `recvonly` when downgrading)
|
|
8242
|
+
if (videoTransceiver && videoTransceiver.currentDirection !== videoTransceiver.direction) {
|
|
8243
|
+
videoTransceiver.direction = videoTransceiver.currentDirection;
|
|
8244
|
+
}
|
|
8245
|
+
|
|
8235
8246
|
this.client.setLocalMediaStream(this.getSipSessionId(sipSession), newStream);
|
|
8236
8247
|
this._sendReinviteMessage(callSession, true);
|
|
8237
8248
|
|
|
@@ -8394,6 +8405,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8394
8405
|
// We have to downgrade to audio.
|
|
8395
8406
|
const screenshareStopped = this.currentScreenShare.sender && this.currentScreenShare.hadVideo;
|
|
8396
8407
|
const constraints = { audio: false, video: screenshareStopped };
|
|
8408
|
+
if (!conference) {
|
|
8409
|
+
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
8410
|
+
this._downgradeToAudio(targetCallSession, false);
|
|
8411
|
+
// Wait for the track to be removed, unless the video sender won't have a null track in `_upgradeToVideo`.
|
|
8412
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
8413
|
+
}
|
|
8397
8414
|
reinvited = await this.sendReinvite(targetCallSession, constraints, conference);
|
|
8398
8415
|
}
|
|
8399
8416
|
} catch (e) {
|
|
@@ -11556,7 +11573,8 @@ class Room$1 extends Emitter {
|
|
|
11556
11573
|
}
|
|
11557
11574
|
|
|
11558
11575
|
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
11559
|
-
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
11576
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
11577
|
+
stream && stream.id === streamId);
|
|
11560
11578
|
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
11561
11579
|
}
|
|
11562
11580
|
|
|
@@ -6781,6 +6781,8 @@ class WebRTCClient extends Emitter {
|
|
|
6781
6781
|
}
|
|
6782
6782
|
options.sessionDescriptionHandlerOptions = {
|
|
6783
6783
|
constraints: options.constraints,
|
|
6784
|
+
hold: true,
|
|
6785
|
+
conference: isConference,
|
|
6784
6786
|
};
|
|
6785
6787
|
|
|
6786
6788
|
// Send re-INVITE
|
|
@@ -6823,6 +6825,8 @@ class WebRTCClient extends Emitter {
|
|
|
6823
6825
|
}
|
|
6824
6826
|
options.sessionDescriptionHandlerOptions = {
|
|
6825
6827
|
constraints: options.constraints,
|
|
6828
|
+
hold: false,
|
|
6829
|
+
conference: isConference,
|
|
6826
6830
|
};
|
|
6827
6831
|
|
|
6828
6832
|
// Send re-INVITE
|
|
@@ -8152,7 +8156,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8152
8156
|
return this.client.onDisconnect();
|
|
8153
8157
|
}
|
|
8154
8158
|
|
|
8155
|
-
_downgradeToAudio(callSession ) {
|
|
8159
|
+
_downgradeToAudio(callSession , withMessage = true) {
|
|
8156
8160
|
const sipSession = this.findSipSession(callSession);
|
|
8157
8161
|
if (!sipSession) {
|
|
8158
8162
|
return false;
|
|
@@ -8179,7 +8183,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8179
8183
|
localStream.removeTrack(videoTrack);
|
|
8180
8184
|
});
|
|
8181
8185
|
|
|
8182
|
-
|
|
8186
|
+
if (withMessage) {
|
|
8187
|
+
this._sendReinviteMessage(callSession, false);
|
|
8188
|
+
}
|
|
8183
8189
|
|
|
8184
8190
|
return true;
|
|
8185
8191
|
}
|
|
@@ -8198,9 +8204,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8198
8204
|
|
|
8199
8205
|
// Check if a video sender already exists
|
|
8200
8206
|
let videoSender;
|
|
8207
|
+
const videoTransceiver = pc.getTransceivers().find(transceiver => transceiver.mid === '1');
|
|
8201
8208
|
if (isConference) {
|
|
8202
|
-
|
|
8203
|
-
videoSender = trans ? trans.sender : null;
|
|
8209
|
+
videoSender = videoTransceiver ? videoTransceiver.sender : null;
|
|
8204
8210
|
} else {
|
|
8205
8211
|
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
8206
8212
|
}
|
|
@@ -8230,6 +8236,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8230
8236
|
videoSender.replaceTrack(videoTrack);
|
|
8231
8237
|
}
|
|
8232
8238
|
|
|
8239
|
+
// Put back last direction (was set to `recvonly` when downgrading)
|
|
8240
|
+
if (videoTransceiver && videoTransceiver.currentDirection !== videoTransceiver.direction) {
|
|
8241
|
+
videoTransceiver.direction = videoTransceiver.currentDirection;
|
|
8242
|
+
}
|
|
8243
|
+
|
|
8233
8244
|
this.client.setLocalMediaStream(this.getSipSessionId(sipSession), newStream);
|
|
8234
8245
|
this._sendReinviteMessage(callSession, true);
|
|
8235
8246
|
|
|
@@ -8392,6 +8403,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8392
8403
|
// We have to downgrade to audio.
|
|
8393
8404
|
const screenshareStopped = this.currentScreenShare.sender && this.currentScreenShare.hadVideo;
|
|
8394
8405
|
const constraints = { audio: false, video: screenshareStopped };
|
|
8406
|
+
if (!conference) {
|
|
8407
|
+
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
8408
|
+
this._downgradeToAudio(targetCallSession, false);
|
|
8409
|
+
// Wait for the track to be removed, unless the video sender won't have a null track in `_upgradeToVideo`.
|
|
8410
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
8411
|
+
}
|
|
8395
8412
|
reinvited = await this.sendReinvite(targetCallSession, constraints, conference);
|
|
8396
8413
|
}
|
|
8397
8414
|
} catch (e) {
|
|
@@ -11554,7 +11571,8 @@ class Room$1 extends Emitter {
|
|
|
11554
11571
|
}
|
|
11555
11572
|
|
|
11556
11573
|
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
11557
|
-
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
11574
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
11575
|
+
stream && stream.id === streamId);
|
|
11558
11576
|
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
11559
11577
|
}
|
|
11560
11578
|
|
package/lib/simple/Phone.js
CHANGED
|
@@ -6781,6 +6781,8 @@ class WebRTCClient extends Emitter {
|
|
|
6781
6781
|
}
|
|
6782
6782
|
options.sessionDescriptionHandlerOptions = {
|
|
6783
6783
|
constraints: options.constraints,
|
|
6784
|
+
hold: true,
|
|
6785
|
+
conference: isConference,
|
|
6784
6786
|
};
|
|
6785
6787
|
|
|
6786
6788
|
// Send re-INVITE
|
|
@@ -6823,6 +6825,8 @@ class WebRTCClient extends Emitter {
|
|
|
6823
6825
|
}
|
|
6824
6826
|
options.sessionDescriptionHandlerOptions = {
|
|
6825
6827
|
constraints: options.constraints,
|
|
6828
|
+
hold: false,
|
|
6829
|
+
conference: isConference,
|
|
6826
6830
|
};
|
|
6827
6831
|
|
|
6828
6832
|
// Send re-INVITE
|
|
@@ -8152,7 +8156,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8152
8156
|
return this.client.onDisconnect();
|
|
8153
8157
|
}
|
|
8154
8158
|
|
|
8155
|
-
_downgradeToAudio(callSession ) {
|
|
8159
|
+
_downgradeToAudio(callSession , withMessage = true) {
|
|
8156
8160
|
const sipSession = this.findSipSession(callSession);
|
|
8157
8161
|
if (!sipSession) {
|
|
8158
8162
|
return false;
|
|
@@ -8179,7 +8183,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8179
8183
|
localStream.removeTrack(videoTrack);
|
|
8180
8184
|
});
|
|
8181
8185
|
|
|
8182
|
-
|
|
8186
|
+
if (withMessage) {
|
|
8187
|
+
this._sendReinviteMessage(callSession, false);
|
|
8188
|
+
}
|
|
8183
8189
|
|
|
8184
8190
|
return true;
|
|
8185
8191
|
}
|
|
@@ -8198,9 +8204,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8198
8204
|
|
|
8199
8205
|
// Check if a video sender already exists
|
|
8200
8206
|
let videoSender;
|
|
8207
|
+
const videoTransceiver = pc.getTransceivers().find(transceiver => transceiver.mid === '1');
|
|
8201
8208
|
if (isConference) {
|
|
8202
|
-
|
|
8203
|
-
videoSender = trans ? trans.sender : null;
|
|
8209
|
+
videoSender = videoTransceiver ? videoTransceiver.sender : null;
|
|
8204
8210
|
} else {
|
|
8205
8211
|
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
8206
8212
|
}
|
|
@@ -8230,6 +8236,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8230
8236
|
videoSender.replaceTrack(videoTrack);
|
|
8231
8237
|
}
|
|
8232
8238
|
|
|
8239
|
+
// Put back last direction (was set to `recvonly` when downgrading)
|
|
8240
|
+
if (videoTransceiver && videoTransceiver.currentDirection !== videoTransceiver.direction) {
|
|
8241
|
+
videoTransceiver.direction = videoTransceiver.currentDirection;
|
|
8242
|
+
}
|
|
8243
|
+
|
|
8233
8244
|
this.client.setLocalMediaStream(this.getSipSessionId(sipSession), newStream);
|
|
8234
8245
|
this._sendReinviteMessage(callSession, true);
|
|
8235
8246
|
|
|
@@ -8392,6 +8403,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8392
8403
|
// We have to downgrade to audio.
|
|
8393
8404
|
const screenshareStopped = this.currentScreenShare.sender && this.currentScreenShare.hadVideo;
|
|
8394
8405
|
const constraints = { audio: false, video: screenshareStopped };
|
|
8406
|
+
if (!conference) {
|
|
8407
|
+
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
8408
|
+
this._downgradeToAudio(targetCallSession, false);
|
|
8409
|
+
// Wait for the track to be removed, unless the video sender won't have a null track in `_upgradeToVideo`.
|
|
8410
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
8411
|
+
}
|
|
8395
8412
|
reinvited = await this.sendReinvite(targetCallSession, constraints, conference);
|
|
8396
8413
|
}
|
|
8397
8414
|
} catch (e) {
|
|
@@ -11427,7 +11444,8 @@ class Room$1 extends Emitter {
|
|
|
11427
11444
|
}
|
|
11428
11445
|
|
|
11429
11446
|
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
11430
|
-
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
11447
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
11448
|
+
stream && stream.id === streamId);
|
|
11431
11449
|
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
11432
11450
|
}
|
|
11433
11451
|
|
package/lib/simple/index.js
CHANGED
|
@@ -7043,6 +7043,8 @@ class WebRTCClient extends Emitter {
|
|
|
7043
7043
|
}
|
|
7044
7044
|
options.sessionDescriptionHandlerOptions = {
|
|
7045
7045
|
constraints: options.constraints,
|
|
7046
|
+
hold: true,
|
|
7047
|
+
conference: isConference,
|
|
7046
7048
|
};
|
|
7047
7049
|
|
|
7048
7050
|
// Send re-INVITE
|
|
@@ -7085,6 +7087,8 @@ class WebRTCClient extends Emitter {
|
|
|
7085
7087
|
}
|
|
7086
7088
|
options.sessionDescriptionHandlerOptions = {
|
|
7087
7089
|
constraints: options.constraints,
|
|
7090
|
+
hold: false,
|
|
7091
|
+
conference: isConference,
|
|
7088
7092
|
};
|
|
7089
7093
|
|
|
7090
7094
|
// Send re-INVITE
|
|
@@ -8414,7 +8418,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8414
8418
|
return this.client.onDisconnect();
|
|
8415
8419
|
}
|
|
8416
8420
|
|
|
8417
|
-
_downgradeToAudio(callSession ) {
|
|
8421
|
+
_downgradeToAudio(callSession , withMessage = true) {
|
|
8418
8422
|
const sipSession = this.findSipSession(callSession);
|
|
8419
8423
|
if (!sipSession) {
|
|
8420
8424
|
return false;
|
|
@@ -8441,7 +8445,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8441
8445
|
localStream.removeTrack(videoTrack);
|
|
8442
8446
|
});
|
|
8443
8447
|
|
|
8444
|
-
|
|
8448
|
+
if (withMessage) {
|
|
8449
|
+
this._sendReinviteMessage(callSession, false);
|
|
8450
|
+
}
|
|
8445
8451
|
|
|
8446
8452
|
return true;
|
|
8447
8453
|
}
|
|
@@ -8460,9 +8466,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8460
8466
|
|
|
8461
8467
|
// Check if a video sender already exists
|
|
8462
8468
|
let videoSender;
|
|
8469
|
+
const videoTransceiver = pc.getTransceivers().find(transceiver => transceiver.mid === '1');
|
|
8463
8470
|
if (isConference) {
|
|
8464
|
-
|
|
8465
|
-
videoSender = trans ? trans.sender : null;
|
|
8471
|
+
videoSender = videoTransceiver ? videoTransceiver.sender : null;
|
|
8466
8472
|
} else {
|
|
8467
8473
|
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
8468
8474
|
}
|
|
@@ -8492,6 +8498,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8492
8498
|
videoSender.replaceTrack(videoTrack);
|
|
8493
8499
|
}
|
|
8494
8500
|
|
|
8501
|
+
// Put back last direction (was set to `recvonly` when downgrading)
|
|
8502
|
+
if (videoTransceiver && videoTransceiver.currentDirection !== videoTransceiver.direction) {
|
|
8503
|
+
videoTransceiver.direction = videoTransceiver.currentDirection;
|
|
8504
|
+
}
|
|
8505
|
+
|
|
8495
8506
|
this.client.setLocalMediaStream(this.getSipSessionId(sipSession), newStream);
|
|
8496
8507
|
this._sendReinviteMessage(callSession, true);
|
|
8497
8508
|
|
|
@@ -8654,6 +8665,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8654
8665
|
// We have to downgrade to audio.
|
|
8655
8666
|
const screenshareStopped = this.currentScreenShare.sender && this.currentScreenShare.hadVideo;
|
|
8656
8667
|
const constraints = { audio: false, video: screenshareStopped };
|
|
8668
|
+
if (!conference) {
|
|
8669
|
+
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
8670
|
+
this._downgradeToAudio(targetCallSession, false);
|
|
8671
|
+
// Wait for the track to be removed, unless the video sender won't have a null track in `_upgradeToVideo`.
|
|
8672
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
8673
|
+
}
|
|
8657
8674
|
reinvited = await this.sendReinvite(targetCallSession, constraints, conference);
|
|
8658
8675
|
}
|
|
8659
8676
|
} catch (e) {
|
|
@@ -11816,7 +11833,8 @@ class Room$1 extends Emitter {
|
|
|
11816
11833
|
}
|
|
11817
11834
|
|
|
11818
11835
|
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
11819
|
-
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
11836
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
11837
|
+
stream && stream.id === streamId);
|
|
11820
11838
|
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
11821
11839
|
}
|
|
11822
11840
|
|
|
@@ -7043,6 +7043,8 @@ class WebRTCClient extends Emitter {
|
|
|
7043
7043
|
}
|
|
7044
7044
|
options.sessionDescriptionHandlerOptions = {
|
|
7045
7045
|
constraints: options.constraints,
|
|
7046
|
+
hold: true,
|
|
7047
|
+
conference: isConference,
|
|
7046
7048
|
};
|
|
7047
7049
|
|
|
7048
7050
|
// Send re-INVITE
|
|
@@ -7085,6 +7087,8 @@ class WebRTCClient extends Emitter {
|
|
|
7085
7087
|
}
|
|
7086
7088
|
options.sessionDescriptionHandlerOptions = {
|
|
7087
7089
|
constraints: options.constraints,
|
|
7090
|
+
hold: false,
|
|
7091
|
+
conference: isConference,
|
|
7088
7092
|
};
|
|
7089
7093
|
|
|
7090
7094
|
// Send re-INVITE
|
|
@@ -8414,7 +8418,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8414
8418
|
return this.client.onDisconnect();
|
|
8415
8419
|
}
|
|
8416
8420
|
|
|
8417
|
-
_downgradeToAudio(callSession ) {
|
|
8421
|
+
_downgradeToAudio(callSession , withMessage = true) {
|
|
8418
8422
|
const sipSession = this.findSipSession(callSession);
|
|
8419
8423
|
if (!sipSession) {
|
|
8420
8424
|
return false;
|
|
@@ -8441,7 +8445,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8441
8445
|
localStream.removeTrack(videoTrack);
|
|
8442
8446
|
});
|
|
8443
8447
|
|
|
8444
|
-
|
|
8448
|
+
if (withMessage) {
|
|
8449
|
+
this._sendReinviteMessage(callSession, false);
|
|
8450
|
+
}
|
|
8445
8451
|
|
|
8446
8452
|
return true;
|
|
8447
8453
|
}
|
|
@@ -8460,9 +8466,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8460
8466
|
|
|
8461
8467
|
// Check if a video sender already exists
|
|
8462
8468
|
let videoSender;
|
|
8469
|
+
const videoTransceiver = pc.getTransceivers().find(transceiver => transceiver.mid === '1');
|
|
8463
8470
|
if (isConference) {
|
|
8464
|
-
|
|
8465
|
-
videoSender = trans ? trans.sender : null;
|
|
8471
|
+
videoSender = videoTransceiver ? videoTransceiver.sender : null;
|
|
8466
8472
|
} else {
|
|
8467
8473
|
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
8468
8474
|
}
|
|
@@ -8492,6 +8498,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8492
8498
|
videoSender.replaceTrack(videoTrack);
|
|
8493
8499
|
}
|
|
8494
8500
|
|
|
8501
|
+
// Put back last direction (was set to `recvonly` when downgrading)
|
|
8502
|
+
if (videoTransceiver && videoTransceiver.currentDirection !== videoTransceiver.direction) {
|
|
8503
|
+
videoTransceiver.direction = videoTransceiver.currentDirection;
|
|
8504
|
+
}
|
|
8505
|
+
|
|
8495
8506
|
this.client.setLocalMediaStream(this.getSipSessionId(sipSession), newStream);
|
|
8496
8507
|
this._sendReinviteMessage(callSession, true);
|
|
8497
8508
|
|
|
@@ -8654,6 +8665,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8654
8665
|
// We have to downgrade to audio.
|
|
8655
8666
|
const screenshareStopped = this.currentScreenShare.sender && this.currentScreenShare.hadVideo;
|
|
8656
8667
|
const constraints = { audio: false, video: screenshareStopped };
|
|
8668
|
+
if (!conference) {
|
|
8669
|
+
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
8670
|
+
this._downgradeToAudio(targetCallSession, false);
|
|
8671
|
+
// Wait for the track to be removed, unless the video sender won't have a null track in `_upgradeToVideo`.
|
|
8672
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
8673
|
+
}
|
|
8657
8674
|
reinvited = await this.sendReinvite(targetCallSession, constraints, conference);
|
|
8658
8675
|
}
|
|
8659
8676
|
} catch (e) {
|
|
@@ -12682,7 +12699,8 @@ class Room extends Emitter {
|
|
|
12682
12699
|
}
|
|
12683
12700
|
|
|
12684
12701
|
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
12685
|
-
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
12702
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
12703
|
+
stream && stream.id === streamId);
|
|
12686
12704
|
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
12687
12705
|
}
|
|
12688
12706
|
|
|
@@ -7043,6 +7043,8 @@ class WebRTCClient extends Emitter {
|
|
|
7043
7043
|
}
|
|
7044
7044
|
options.sessionDescriptionHandlerOptions = {
|
|
7045
7045
|
constraints: options.constraints,
|
|
7046
|
+
hold: true,
|
|
7047
|
+
conference: isConference,
|
|
7046
7048
|
};
|
|
7047
7049
|
|
|
7048
7050
|
// Send re-INVITE
|
|
@@ -7085,6 +7087,8 @@ class WebRTCClient extends Emitter {
|
|
|
7085
7087
|
}
|
|
7086
7088
|
options.sessionDescriptionHandlerOptions = {
|
|
7087
7089
|
constraints: options.constraints,
|
|
7090
|
+
hold: false,
|
|
7091
|
+
conference: isConference,
|
|
7088
7092
|
};
|
|
7089
7093
|
|
|
7090
7094
|
// Send re-INVITE
|
|
@@ -8414,7 +8418,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8414
8418
|
return this.client.onDisconnect();
|
|
8415
8419
|
}
|
|
8416
8420
|
|
|
8417
|
-
_downgradeToAudio(callSession ) {
|
|
8421
|
+
_downgradeToAudio(callSession , withMessage = true) {
|
|
8418
8422
|
const sipSession = this.findSipSession(callSession);
|
|
8419
8423
|
if (!sipSession) {
|
|
8420
8424
|
return false;
|
|
@@ -8441,7 +8445,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8441
8445
|
localStream.removeTrack(videoTrack);
|
|
8442
8446
|
});
|
|
8443
8447
|
|
|
8444
|
-
|
|
8448
|
+
if (withMessage) {
|
|
8449
|
+
this._sendReinviteMessage(callSession, false);
|
|
8450
|
+
}
|
|
8445
8451
|
|
|
8446
8452
|
return true;
|
|
8447
8453
|
}
|
|
@@ -8460,9 +8466,9 @@ class WebRTCPhone extends Emitter {
|
|
|
8460
8466
|
|
|
8461
8467
|
// Check if a video sender already exists
|
|
8462
8468
|
let videoSender;
|
|
8469
|
+
const videoTransceiver = pc.getTransceivers().find(transceiver => transceiver.mid === '1');
|
|
8463
8470
|
if (isConference) {
|
|
8464
|
-
|
|
8465
|
-
videoSender = trans ? trans.sender : null;
|
|
8471
|
+
videoSender = videoTransceiver ? videoTransceiver.sender : null;
|
|
8466
8472
|
} else {
|
|
8467
8473
|
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
8468
8474
|
}
|
|
@@ -8492,6 +8498,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8492
8498
|
videoSender.replaceTrack(videoTrack);
|
|
8493
8499
|
}
|
|
8494
8500
|
|
|
8501
|
+
// Put back last direction (was set to `recvonly` when downgrading)
|
|
8502
|
+
if (videoTransceiver && videoTransceiver.currentDirection !== videoTransceiver.direction) {
|
|
8503
|
+
videoTransceiver.direction = videoTransceiver.currentDirection;
|
|
8504
|
+
}
|
|
8505
|
+
|
|
8495
8506
|
this.client.setLocalMediaStream(this.getSipSessionId(sipSession), newStream);
|
|
8496
8507
|
this._sendReinviteMessage(callSession, true);
|
|
8497
8508
|
|
|
@@ -8654,6 +8665,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8654
8665
|
// We have to downgrade to audio.
|
|
8655
8666
|
const screenshareStopped = this.currentScreenShare.sender && this.currentScreenShare.hadVideo;
|
|
8656
8667
|
const constraints = { audio: false, video: screenshareStopped };
|
|
8668
|
+
if (!conference) {
|
|
8669
|
+
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
8670
|
+
this._downgradeToAudio(targetCallSession, false);
|
|
8671
|
+
// Wait for the track to be removed, unless the video sender won't have a null track in `_upgradeToVideo`.
|
|
8672
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
8673
|
+
}
|
|
8657
8674
|
reinvited = await this.sendReinvite(targetCallSession, constraints, conference);
|
|
8658
8675
|
}
|
|
8659
8676
|
} catch (e) {
|
|
@@ -12687,7 +12704,8 @@ class Room extends Emitter {
|
|
|
12687
12704
|
}
|
|
12688
12705
|
|
|
12689
12706
|
// Find in all the streams by streamId (used on FF where we can't map by trackId)
|
|
12690
|
-
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
12707
|
+
const idx = Object.values(this._unassociatedVideoStreams).findIndex((stream ) =>
|
|
12708
|
+
stream && stream.id === streamId);
|
|
12691
12709
|
return idx === -1 ? null : Object.keys(this._unassociatedVideoStreams)[idx];
|
|
12692
12710
|
}
|
|
12693
12711
|
|