From 437c6844239716fdf39e5c72cea86263abdc830d Mon Sep 17 00:00:00 2001 From: prlanzarin <4529051+prlanzarin@users.noreply.github.com> Date: Wed, 3 Jul 2024 00:10:14 -0300 Subject: [PATCH] fix(audio): stuck unmute due to borked callerId(Num) FreeSWITCH incorrectly generates callerNum headers in its ESL events when specific, special characters are in place. e.g.: w_etc_0-bbbID-User;Semi (notice the semicolon) will be generated by FS as w_etc_0-bbbID-User (everything after the semicolon is ignored). This breaks callerId comparision for session matching in a few places - one of the is the unmute/unhold toggle control. Compare callerNum as prefixes instead of exact strings to match those scenarios. This is a temporary fix; we should review callerNum generation in the future (use Caller-Id-Name in FSESL), as well as stop relying on it for session matching (use UUIDs and/or client session numbers instead). Both of these are more involved changes, though. --- .../org/bigbluebutton/core/models/VoiceUsers.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/VoiceUsers.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/VoiceUsers.scala index 47ca576a4e..abac75842b 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/VoiceUsers.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/VoiceUsers.scala @@ -16,7 +16,15 @@ object VoiceUsers { } def findWithIntIdAndCallerNum(users: VoiceUsers, intId: String, callerNum: String): Option[VoiceUserState] = { - users.toVector.find(u => u.callerNum == callerNum && u.intId == intId) + // prlanzarin: This is a hack to allow for partial matching of callerNums. + // This is needed because the callerNums are incorrectly generated by + // FREESWITCH's ESL events when special characters are in place. + // e.g.: w_etc_0-bbbID-User;Semi (notice the semicolon) will be generated by + // FS as w_etc_0-bbbID-User (everything after the semicolon is ignored). + // We should review callerNum generation in the future as well as stop + // relying on it for session matching (use UUIDs or client session numbers instead). + users.toVector.find(u => u.intId == intId && + (u.callerNum.startsWith(callerNum) || callerNum.startsWith(u.callerNum))) } def findAll(users: VoiceUsers): Vector[VoiceUserState] = users.toVector