From b442be08e2615baf51c64e0709cf29b89301c5a3 Mon Sep 17 00:00:00 2001 From: Rafael Bradley Date: Tue, 26 Aug 2025 13:12:17 -0300 Subject: [PATCH] Disable auto call hangup and check for DB inconsistency in call channels --- src/groups/calls/events.rs | 11 +++++++++++ src/main.rs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/groups/calls/events.rs b/src/groups/calls/events.rs index 6ccf1fe..10af602 100644 --- a/src/groups/calls/events.rs +++ b/src/groups/calls/events.rs @@ -220,6 +220,17 @@ impl OnMessageHandler for CallMessageHandler { return Ok(()); }; + if opposite_channel.call_id != Some(call.id) { + log::error!( + "Channel {} is listed as the opposite channel of channel {} in call {}, but its call ID is {}.", + opposite_channel.id, + channel.id, + call.id, + opposite_channel.call_id.map_or("None".into(), |i| i.to_string()) + ); + return Ok(()); + } + let Some((webhook_id, webhook_token)) = opposite_channel .webhook_id .zip(opposite_channel.webhook_token.clone()) diff --git a/src/main.rs b/src/main.rs index 876fece..5fd7328 100644 --- a/src/main.rs +++ b/src/main.rs @@ -308,7 +308,7 @@ async fn start( .cache_resource_type(ResourceType::CHANNEL) .cache_resource_type(ResourceType::MEMBER) .cache_resource_type(ResourceType::ROLE) - .task(EndInactiveCallsTask::new(shard.number(), shard.total())) + // .task(EndInactiveCallsTask::new(shard.number(), shard.total())) .on_ready(ReadyHandler) .on_reconnect(ReconnectHandler) .on_message(CallMessageHandler)