From 0875ae719ec4e15b01f8763e4df2dc117863117a Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Fri, 8 May 2026 12:19:26 +0530 Subject: [PATCH] fix(voice): only reuse open conversations for Twilio outbound calls Message#reopen_conversation bails on outgoing messages, so reusing a resolved/snoozed/pending conversation hint left the call bubble inside a thread that stays in its prior status. Restrict the existing-conversation hint to open conversations and fall through to creating a fresh one otherwise. --- .../controllers/api/v1/accounts/contacts/calls_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/enterprise/app/controllers/api/v1/accounts/contacts/calls_controller.rb b/enterprise/app/controllers/api/v1/accounts/contacts/calls_controller.rb index 64c41993b..740a2fda4 100644 --- a/enterprise/app/controllers/api/v1/accounts/contacts/calls_controller.rb +++ b/enterprise/app/controllers/api/v1/accounts/contacts/calls_controller.rb @@ -42,12 +42,16 @@ class Api::V1::Accounts::Contacts::CallsController < Api::V1::Accounts::BaseCont # Reuse the open conversation when the caller is already inside it; ignore # the hint if it doesn't belong to the picked voice inbox or dialed contact. + # Only reuse open conversations — Message#reopen_conversation skips outgoing + # messages, so dropping a voice_call bubble into a resolved/snoozed/pending + # thread leaves it stuck in that state. def existing_conversation return nil if params[:conversation_id].blank? conversation = Current.account.conversations.find_by(display_id: params[:conversation_id]) return nil unless conversation return nil unless conversation.inbox_id == voice_inbox.id && conversation.contact_id == contact.id + return nil unless conversation.open? conversation end