From 78692c5999bad9599d61b48b517c345539f5d0b2 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 3 Aug 2026 20:56:41 +0000 Subject: [PATCH] traccar: exclude Asterisk's AMI port (5038/tcp) from the published range MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Confirmed live: on a box also running Asterisk from this repo, `docker network connect caddy_net traccar` failed with "failed to bind host port 0.0.0.0:5038/tcp: address already in use". Asterisk runs with network_mode: host (services/asterisk.sh), so its AMI (port 5038, hardcoded in services/sms-inbound.sh) binds directly on the host's network stack — no Docker NAT involved. Traccar's docker-compose.yml published the entire 5000-5150 range for device protocols, which needs Docker to also bind host port 5038 for its own port-forwarding, directly colliding with Asterisk's AMI on any box running both services from this repo. Split the TCP range into 5000-5037 and 5039-5150 to skip that one port; left UDP as a single 5000-5150 range since AMI is TCP-only. --- services/traccar.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/services/traccar.sh b/services/traccar.sh index 4e3ddb7..6878a78 100644 --- a/services/traccar.sh +++ b/services/traccar.sh @@ -196,7 +196,7 @@ install_traccar() { echo " - Deploy a PostgreSQL database container (Traccar no longer ships H2)" echo " - Point Traccar at it via env vars (CONFIG_USE_ENVIRONMENT_VARIABLES) — no secrets in a config file" echo " - Deploy an autoheal container that restarts Traccar if its healthcheck fails" - echo " - Expose port 8082 (web) and 5000-5150 (device protocols)" + echo " - Expose port 8082 (web) and 5000-5150 (device protocols; 5038/tcp skipped — Asterisk AMI)" echo " - No default login — register the first account at the web UI, it becomes admin" echo " - Offer a Caddy reverse proxy and to start the container" return 0 @@ -287,7 +287,16 @@ ${_CADDY_NET_BLOCK} healthcheck: - ./data:/opt/traccar/data:rw ports: - "8082:8082" - - "5000-5150:5000-5150" + # 5038/tcp is skipped: it's Asterisk's AMI port (services/asterisk.sh + # runs Asterisk with network_mode: host, so AMI binds it directly on + # the host, not through Docker networking). Publishing the full + # 5000-5150 range here would fight Asterisk for that exact host port + # on any box running both services from this repo. Confirmed live: + # this is what made "docker network connect caddy_net traccar" fail + # with "failed to bind host port 0.0.0.0:5038/tcp: address already in + # use" on a box with Asterisk's PSTN trunk already installed. + - "5000-5037:5000-5037" + - "5039-5150:5039-5150" - "5000-5150:5000-5150/udp" ${_CADDY_NET_BLOCK} autoheal: @@ -336,7 +345,8 @@ Android/iOS app, OwnTracks, or any of 200+ supported device protocols. stays open to anyone who reaches this server until you turn it off, so do this right away, then go to Settings → Server → Permissions and uncheck Registration. -- Device protocols: ports 5000-5150 (TCP + UDP) +- Device protocols: ports 5000-5150 (TCP + UDP; 5038/tcp is skipped — reserved + for Asterisk's AMI if this box also runs Asterisk from this repo) - App data: \`data/\` and \`logs/\` - Database: PostgreSQL (\`traccar-db\` container, data in \`db/\`) - All database settings (name, user, password) live in \`.env\` — Traccar