Merge branch 'feat/whatsapp-call-meta-bridge' into feat/whatsapp-call-ui

This commit is contained in:
Tanmay Deep Sharma
2026-05-07 16:28:01 +07:00
@@ -11,7 +11,8 @@ describe Whatsapp::IncomingCallService do
let(:provider_call_id) { 'wacid_abc' }
before do
channel.provider_config = channel.provider_config.merge('calling_enabled' => true)
account.enable_features!('channel_voice')
channel.provider_config = channel.provider_config.merge('source' => 'embedded_signup', 'calling_enabled' => true)
channel.save!
end
@@ -57,14 +58,15 @@ describe Whatsapp::IncomingCallService do
provider: :whatsapp, direction: :outgoing, status: 'ringing', provider_call_id: provider_call_id)
end
it 'transitions the call to in_progress and broadcasts voice_call.outbound_connected with the SDP answer' do
it 'stores the SDP answer and broadcasts voice_call.outbound_connected without flipping to in_progress' do
allow(ActionCable.server).to receive(:broadcast)
sdp_answer = "v=0\r\na=setup:actpass\r\n"
params = call_payload(event: 'connect', session: { sdp: sdp_answer, sdp_type: 'answer' })
described_class.new(inbox: inbox, params: params).perform
expect(call.reload).to have_attributes(status: 'in_progress', started_at: be_present)
# connect only completes the SDP handshake; pickup is reported separately as status=ACCEPTED.
expect(call.reload).to have_attributes(status: 'ringing', started_at: nil)
expect(call.meta['sdp_answer']).to include('a=setup:active')
expect(ActionCable.server).to have_received(:broadcast).with(
"account_#{account.id}",
@@ -116,7 +118,6 @@ describe Whatsapp::IncomingCallService do
describe 'terminate with no local row yet' do
it 'logs and skips instead of materialising an inbound missed-call row' do
allow(inbox.channel).to receive(:voice_enabled?).and_return(true)
allow(Rails.logger).to receive(:warn)
allow(ActionCable.server).to receive(:broadcast)
@@ -131,7 +132,6 @@ describe Whatsapp::IncomingCallService do
describe 'outbound connect with no local row yet' do
it 'does not mint an inbound call when sdp_type is answer' do
allow(inbox.channel).to receive(:voice_enabled?).and_return(true)
allow(Rails.logger).to receive(:warn)
allow(ActionCable.server).to receive(:broadcast)