Merge pull request #28 from outis1one/claude/asterisk-vpn-mobile-issue-Nt958

Make TURN/STUN port configurable via TURN_PORT env var
This commit is contained in:
Outis
2026-02-23 21:17:06 -05:00
committed by GitHub
5 changed files with 20 additions and 12 deletions
+10 -4
View File
@@ -8,9 +8,9 @@
# 4. docker exec -it easy-asterisk easy-asterisk
#
# Port forwarding required on your router:
# 5061/tcp → SIP TLS signaling
# 3478/udp → STUN/TURN (NAT traversal + media relay)
# 3478/tcp → TURN TCP fallback (for restrictive networks)
# 5061/tcp → SIP TLS signaling
# 3478/udp+tcp → STUN/TURN (NAT traversal + media relay)
# (change with TURN_PORT if 3478 is taken)
# 10000-20000/udp → RTP media (or your custom range below)
#
# How it works:
@@ -58,7 +58,7 @@ LOCAL_CIDR=
HAS_VLANS=n
VLAN_SUBNETS=
# ── TURN/STUN Credentials ────────────────────────────────────
# ── TURN/STUN Settings ──────────────────────────────────────
# Used by coturn for TURN relay authentication.
# If TURN_PASSWORD is empty, a random password is generated on
# first startup and saved to /etc/easy-asterisk/config.
@@ -68,6 +68,12 @@ VLAN_SUBNETS=
TURN_USERNAME=easyasterisk
TURN_PASSWORD=
# ── TURN/STUN Port ──────────────────────────────────────────
# Default: 3478 (standard STUN/TURN port)
# Change if 3478 is already in use (e.g., UniFi controller uses 3478/udp).
# Common alternative: 3479
TURN_PORT=3478
# ── TURN Relay Port Range ─────────────────────────────────────
# Ports coturn uses for media relay. Forward this range on your router.
# Default is 100 ports (enough for ~50 simultaneous relayed calls).
+1 -1
View File
@@ -79,7 +79,7 @@ EXPOSE 8080/tcp
EXPOSE 8088/tcp
EXPOSE 8089/tcp
# STUN (if running coturn in same container)
# STUN (if running coturn in same container; default 3478, configurable via TURN_PORT)
EXPOSE 3478/udp
# RTP media range (use --network host in production for full range)
+3 -3
View File
@@ -53,7 +53,7 @@ services:
# ── TURN/STUN Server ──
# Points to the coturn service (auto-configured)
- TURN_ENABLED=y
- TURN_SERVER=${DOMAIN_NAME:?}:3478
- TURN_SERVER=${DOMAIN_NAME:?}:${TURN_PORT:-3478}
- TURN_USERNAME=${TURN_USERNAME:-easyasterisk}
- TURN_PASSWORD=${TURN_PASSWORD:-}
@@ -90,7 +90,7 @@ services:
- DETECT_EXTERNAL_IP=${DETECT_EXTERNAL_IP:-yes}
command:
- -n
- --listening-port=3478
- --listening-port=${TURN_PORT:-3478}
- --fingerprint
- --lt-cred-mech
- --user=${TURN_USERNAME:-easyasterisk}:${TURN_PASSWORD:-changeme}
@@ -104,7 +104,7 @@ services:
- --log-file=stdout
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "turnutils_stunclient 127.0.0.1 >/dev/null 2>&1"]
test: ["CMD-SHELL", "turnutils_stunclient -p ${TURN_PORT:-3478} 127.0.0.1 >/dev/null 2>&1"]
interval: 10s
timeout: 5s
retries: 3
+1 -1
View File
@@ -94,7 +94,7 @@ fi
mkdir -p "$CONFIG_DIR"
# Determine TURN/STUN server address
turn_server="${TURN_SERVER:-${DOMAIN_NAME:-$local_ip}:3478}"
turn_server="${TURN_SERVER:-${DOMAIN_NAME:-$local_ip}:${TURN_PORT:-3478}}"
cat > "$CONFIG_FILE" << EOF
# Easy Asterisk Configuration (Docker) - $(date)
+5 -3
View File
@@ -1599,7 +1599,7 @@ show_firewall_guide() {
echo " - Protocol: UDP/TCP"
echo " - Source: VLAN 10 Net"
echo " - Dest: ${CURRENT_PUBLIC_IP:-Server_IP}"
echo " - Port: 3478"
echo " - Port: 3478 (or your TURN_PORT if changed)"
echo ""
echo "STEP 3: Create Rule 2 (The Relay Range - CRITICAL)"
echo " - Action: Pass (Allow)"
@@ -1621,7 +1621,7 @@ show_firewall_guide() {
echo "STEP 2: Create Rule."
echo " - Interface: WAN"
echo " - Protocol: UDP"
echo " - Dest. Port: 3478 (and 49152-65535)"
echo " - Dest. Port: 3478 (or your TURN_PORT) and 49152-65535"
echo " - Redirect IP: ${CURRENT_PUBLIC_IP:-Server_IP}"
echo ""
read -p "Press Enter to return..."
@@ -2748,7 +2748,9 @@ configure_local_client() {
read -p "TURN Host [${server}]: " th
turn_host="${th:-$server}"
fi
turn_config="turn_server turn:${t_user}:${t_pass}@${turn_host}:3478"
read -p "TURN Port [3478]: " t_port
t_port="${t_port:-3478}"
turn_config="turn_server turn:${t_user}:${t_pass}@${turn_host}:${t_port}"
fi
# Update config file for TURN