feat(whatsapp-call): wire up media-server end-to-end
Fixes the four blockers identified in the review so the WhatsApp call
feature actually flows through the Go media-server sidecar:
1. MediaServerClient#create_session now sends `direction` — Go rejected
every session create before this (400). Threaded through to both
CallService#accept_via_media_server (incoming) and
WhatsappCallsController#create_outbound_call_via_media_server (outgoing).
2. Outbound SDP response key aligned — Rails now reads `meta_sdp_offer`
(the media-server's offer for Meta), not the old `meta_sdp_answer`
which never existed in the Go response.
3. Media-server callbacks moved to top-level /callbacks/media_server/<event>
with a new controller that skips Devise account scoping and is guarded
solely by MEDIA_SERVER_AUTH_TOKEN. Matches the Go client's existing
request path, so agent_disconnected / recording_ready / session_terminated
actually reach Rails instead of 404'ing on the account-auth gate.
4. Inbox serializer exposes `media_server_enabled` so the dashboard picks
the server-relay code path when the feature is enabled.
Also lands the outbound server-relay connect flow that was missing:
Go gains POST /sessions/{id}/meta-answer so Rails can feed Meta's SDP
answer back into Peer A when the contact picks up; the webhook handler
then asks the server for a Peer B offer and broadcasts it to the agent
browser instead of Meta's raw answer.
Procfile.dev runs the Go sidecar alongside Rails/sidekiq/vite in dev;
.env gets the three MEDIA_SERVER_* variables.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
f34517dc13
commit
b7d8fcc156
@@ -130,6 +130,7 @@ if resource.whatsapp?
|
||||
json.provider_config resource.channel.try(:provider_config) if Current.account_user&.administrator?
|
||||
json.reauthorization_required resource.channel.try(:reauthorization_required?)
|
||||
json.calling_enabled resource.channel.try(:provider_config)&.dig('calling_enabled') || false
|
||||
json.media_server_enabled Call.media_server_enabled?
|
||||
end
|
||||
|
||||
## Voice Channel Attributes
|
||||
|
||||
Reference in New Issue
Block a user