Prevent incoming group call to start in audio-only layout if video auto accept policy is disabled, instead enable video with receive only direction

This commit is contained in:
Sylvain Berfini 2022-05-20 16:25:17 +02:00
parent ecc94161ee
commit c3ce265c78

View file

@ -565,11 +565,27 @@ class CoreContext(
fun answerCall(call: Call) {
Log.i("[Context] Answering call $call")
val params = core.createCallParams(call)
params?.recordFile = LinphoneUtils.getRecordingFilePathForAddress(call.remoteAddress)
if (params == null) {
Log.w("[Context] Answering call without params!")
call.accept()
return
}
params.recordFile = LinphoneUtils.getRecordingFilePathForAddress(call.remoteAddress)
if (LinphoneUtils.checkIfNetworkHasLowBandwidth(context)) {
Log.w("[Context] Enabling low bandwidth mode!")
params?.isLowBandwidthEnabled = true
params.isLowBandwidthEnabled = true
}
if (call.callLog.wasConference()) {
// Prevent incoming group call to start in audio only layout
// Do the same as the conference waiting room
params.isVideoEnabled = true
params.videoDirection = if (core.videoActivationPolicy.automaticallyInitiate) MediaDirection.SendRecv else MediaDirection.RecvOnly
Log.i("[Context] Enabling video on call params to prevent audio-only layout when answering")
}
call.acceptWithParams(params)
}