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.
This commit is contained in:
Tanmay Deep Sharma
2026-05-08 12:19:52 +05:30
parent 9e56a024c5
commit 0875ae719e
@@ -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