fix(audio): only enforce hold on mute state mismatch if !muted

There's a routine that's supposed to enforce the channel hold state if
mute and hold states are mismatched. This should only happen in case the
user is unmuted and the channel is held to avoid leaving an user without
inbound or outbound audio by accident. The routine currently checks for
the oppositve scenario as well (muted=true,hold=false), which should not
be enforced because of special scenarios (e.g.: audio-only breakout room
transfers, which have their transparent LO mechanism disabled).

Only enforce hold on muted state mismatch IF muted == false.
This commit is contained in:
prlanzarin 2024-06-24 16:17:44 -03:00
parent 623c90b19f
commit 025942de5b
3 changed files with 13 additions and 4 deletions

View File

@ -12,7 +12,11 @@ trait ListenOnlyModeToggledInSfuEvtMsgHdlr {
def handleListenOnlyModeToggledInSfuEvtMsg(msg: ListenOnlyModeToggledInSfuEvtMsg): Unit = {
for {
vu <- VoiceUsers.findWithIntId(liveMeeting.voiceUsers, msg.body.userId)
vu <- VoiceUsers.findWithIntIdAndCallerNum(
liveMeeting.voiceUsers,
msg.body.userId,
msg.body.callerNum
)
} yield {
VoiceApp.holdChannelInVoiceConf(
liveMeeting,

View File

@ -546,9 +546,10 @@ object VoiceApp extends SystemConfiguration {
hold
) match {
case Some(vu) =>
// Mute vs hold state mismatch, enforce hold state again.
// Mute state is the predominant one here.
if (vu.muted != hold) {
// Mute vs hold state mismatch. Enforce it if the user is unmuted,
// but hold is active, to avoid the user being unable to talk when
// the channel is active again.
if (!vu.muted && vu.hold) {
toggleListenOnlyMode(
liveMeeting,
outGW,

View File

@ -15,6 +15,10 @@ object VoiceUsers {
users.toVector.find(u => u.uuid == uuid && u.intId == intId)
}
def findWithIntIdAndCallerNum(users: VoiceUsers, intId: String, callerNum: String): Option[VoiceUserState] = {
users.toVector.find(u => u.callerNum == callerNum && u.intId == intId)
}
def findAll(users: VoiceUsers): Vector[VoiceUserState] = users.toVector
def findAllNonListenOnlyVoiceUsers(users: VoiceUsers): Vector[VoiceUserState] = users.toVector.filter(u => u.listenOnly == false)