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>
6 lines
432 B
Plaintext
6 lines
432 B
Plaintext
backend: bin/rails s -p 3000
|
|
# https://github.com/mperham/sidekiq/issues/3090#issuecomment-389748695
|
|
worker: dotenv bundle exec sidekiq -C config/sidekiq.yml
|
|
vite: bin/vite dev
|
|
media_server: cd enterprise/media-server && AUTH_TOKEN=${MEDIA_SERVER_AUTH_TOKEN:-devtoken} RAILS_CALLBACK_URL=http://localhost:3000 PUBLIC_IP=${MEDIA_SERVER_PUBLIC_IP:-127.0.0.1} RECORDINGS_DIR=/tmp/chatwoot-recordings HTTP_PORT=4000 go run ./cmd/server
|