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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user