Use Rejected instead of Error call disconnect cause because otherwise it triggers an exception on some devices

This commit is contained in:
Sylvain Berfini 2024-12-18 13:56:40 +01:00
parent 679f125870
commit aad50669c4

View file

@ -81,7 +81,12 @@ class TelecomCallControlCallback(
} else if (state == Call.State.Error) {
scope.launch {
Log.w("$TAG Disconnecting call due to error [$message]")
callControl.disconnect(DisconnectCause(DisconnectCause.ERROR))
try {
// For some reason DisconnectCause.ERROR triggers an IllegalArgumentException
callControl.disconnect(DisconnectCause(DisconnectCause.REJECTED))
} catch (ise: IllegalArgumentException) {
Log.e("$TAG Couldn't terminate call control with REJECTED cause: $ise")
}
}
} else if (state == Call.State.Pausing) {
scope.launch {