refactor(voice): tighten WhatsApp call pipeline and broadcast hyphenated terminate status

This commit is contained in:
Tanmay Deep Sharma
2026-04-30 16:04:39 +07:00
parent 546193de2a
commit ba0fcbfc7f
9 changed files with 46 additions and 61 deletions
@@ -87,8 +87,10 @@ describe Whatsapp::IncomingCallService do
described_class.new(inbox: inbox, params: params).perform
expect(call.reload).to have_attributes(status: 'completed', duration_seconds: 42, end_reason: 'completed_normally')
expect(call.ended_at).to be_present
expect(ActionCable.server).to have_received(:broadcast).with(
"account_#{account.id}", hash_including(event: 'voice_call.ended')
"account_#{account.id}",
hash_including(event: 'voice_call.ended', data: hash_including(status: 'completed'))
)
end
@@ -155,6 +157,10 @@ describe Whatsapp::IncomingCallService do
described_class.new(inbox: inbox, params: params).perform
expect(call.reload.status).to eq('no_answer')
expect(ActionCable.server).to have_received(:broadcast).with(
"account_#{account.id}",
hash_including(event: 'voice_call.ended', data: hash_including(status: 'no-answer'))
)
end
end