Files
B2BCall-dialer/docs/NETWORK_ARCHITECTURE.md
Matheus b3b0aaacb3 feat: add FreeSWITCH service (SignalWire packages, not compiled from source)
- infrastructure/freeswitch/Dockerfile: debian:trixie-slim + SignalWire
  packaged freeswitch-meta-vanilla, avoiding a C/C++ build on a 1.9GB RAM VM
- FREESWITCH_PAT used only via Docker BuildKit secret, apt credentials file
  created and deleted within the same RUN — verified absent from the final
  image with docker history
- minimal module set (agente.md secao 15): sofia, event_socket, commands,
  dptools, callcenter, avmd, curl, local_stream, etc. mod_xml_curl installed
  but disabled — it refuses to load without a configured gateway-url, which
  will exist once b2bcall-fs-config is built
- entrypoint.sh rotates the Event Socket password away from the 'ClueCon'
  default at container runtime (never baked into the image); fails loudly if
  ESL_PASSWORD is unset
- port 8021 not published to the host; only reachable from other containers
  on the compose network
- found and fixed: freeswitch-conf-vanilla is a Recommends (not a Depends)
  of freeswitch-meta-vanilla, so --no-install-recommends silently produced
  an empty /etc/freeswitch and a crash loop
- verified end-to-end: fs_cli status via ESL with the custom password,
  default password rejected, expected modules loaded, healthcheck green,
  ~44MB RAM usage
- docs/FREESWITCH.md, docs/NETWORK_ARCHITECTURE.md (network_mode decision
  deferred until a real SIP trunk exists)
2026-08-28 06:30:25 -03:00

1.7 KiB

Arquitetura de Rede

Estado atual (fase FreeSWITCH inicial)

freeswitch roda na rede padrão do Docker Compose (bridge, b2bcall_default), igual a postgres e redis. Nenhuma porta é publicada no host — nem 8021 (ESL), nem SIP (5060/5080), nem RTP. Isso é intencional: ainda não existe nenhum tronco SIP real nem ramal externo, então não há motivo pra expor nada.

apps/api roda hoje direto no host (fora do Docker), então usa APP_DATABASE_URL/REDIS_URL apontando pra localhost nas portas publicadas pelo Postgres/Redis. Ela não consegue (nem precisa, ainda) alcançar o FreeSWITCH.

Decisão pendente: network_mode do FreeSWITCH (agente.md secao 19)

Quando existir um tronco SIP real (fase Trunks), será preciso decidir entre:

  • network_mode: host: mais simples pra SIP/RTP (sem NAT entre o container e a rede), mas perde isolamento de rede do Docker.
  • macvlan/ipvlan: dá ao FreeSWITCH um IP próprio na rede física, sem expor outros serviços do host: mais trabalho de configurar, melhor isolamento.

Não decidido ainda — só vira relevante quando houver um carrier/SBC real pra conectar (secao 17: "FreeSWITCH não deverá depender de IP SIP público" — a topologia esperada é Internet → OpenSIPS → rede SIP privada → FreeSWITCH, então o FreeSWITCH em si tende a ficar em rede privada mesmo, o que favorece manter bridge/macvlan em vez de host).

Quando apps/api virar container

Hoje ela roda no host por conveniência de desenvolvimento. Quando virar o serviço Docker b2bcall-api (agente.md secao 14), as connection strings precisam trocar de localhost pros hostnames internos do compose (postgres, redis, freeswitch) — ver nota em docs/AUTHENTICATION.md sobre essa pegadinha.