From 40d3ec99dc7030173281ff2f0a1d4886ccab79a6 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Wed, 6 May 2026 15:23:42 +0700 Subject: [PATCH 1/2] fix(voice): require conversation to belong to dialed contact Reject conversation_id hints that point to a different contact in the same voice inbox, so reuse only happens when the agent is genuinely inside the open thread for the dialed contact. --- .../api/v1/accounts/contacts/calls_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 88290a999..64c41993b 100644 --- a/enterprise/app/controllers/api/v1/accounts/contacts/calls_controller.rb +++ b/enterprise/app/controllers/api/v1/accounts/contacts/calls_controller.rb @@ -41,11 +41,14 @@ class Api::V1::Accounts::Contacts::CallsController < Api::V1::Accounts::BaseCont end # Reuse the open conversation when the caller is already inside it; ignore - # the hint if it doesn't belong to the picked voice inbox. + # the hint if it doesn't belong to the picked voice inbox or dialed contact. def existing_conversation return nil if params[:conversation_id].blank? conversation = Current.account.conversations.find_by(display_id: params[:conversation_id]) - conversation if conversation && conversation.inbox_id == voice_inbox.id + return nil unless conversation + return nil unless conversation.inbox_id == voice_inbox.id && conversation.contact_id == contact.id + + conversation end end From 639d087e53078aedac5d14bba619a6df43cf6990 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Wed, 6 May 2026 15:23:50 +0700 Subject: [PATCH 2/2] fix(messenger): re-broadcast audio message after blob attaches Messenger ingest saves the Attachment row before attaching the blob, so the after_create_commit broadcast bails on file.attached? and the FE never gets the audio bubble until a refresh (or until Whisper finishes, or never if transcription is disabled or returns blank). Re-fire the message update after attach completes. --- app/builders/messages/messenger/message_builder.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/builders/messages/messenger/message_builder.rb b/app/builders/messages/messenger/message_builder.rb index be1f98b43..ecd6f06ea 100644 --- a/app/builders/messages/messenger/message_builder.rb +++ b/app/builders/messages/messenger/message_builder.rb @@ -28,6 +28,10 @@ class Messages::Messenger::MessageBuilder filename: attachment_file.original_filename, content_type: attachment_file.content_type ) + # The Attachment row is saved before the blob is attached, so the + # after_create_commit broadcast bails on `file.attached?`. Re-fire here + # for audio so the bubble updates without waiting on transcription. + attachment.message&.reload&.send_update_event if attachment.file_type.to_sym == :audio end def attachment_params(attachment)