diff --git a/entrypoint.freeswitch.sh b/entrypoint.freeswitch.sh index 64ad12b..bdeb233 100644 --- a/entrypoint.freeswitch.sh +++ b/entrypoint.freeswitch.sh @@ -81,29 +81,14 @@ fi export SOUNDS_PATH=$SOUNDS_DIR/$(echo "$SOUNDS_LANGUAGE" | sed 's|-|/|g') sed -i -e 's/10.7.7.10/0.0.0.0/g' /etc/freeswitch/vars.xml.tmpl +sed -i -e 's/console_loglevel=info/console_loglevel=debug/g' /etc/freeswitch/vars.xml.tmpl + sed -i -e 's/:5066/0.0.0.0:5066/g' /etc/freeswitch/sip_profiles/external.xml -sed -i -e 's/:5066/0.0.0.0:5066/g' /etc/freeswitch/sip_profiles/internal.xml +# sed -i -e 's/:5066/0.0.0.0:5066/g' /etc/freeswitch/sip_profiles/external-ipv6.xml +# sed -i -e 's/:5066/0.0.0.0:5066/g' /etc/freeswitch/sip_profiles/internal.xml -# This deployment is IPv4-only (EXTERNAL_IPv6 is unset). Remove the IPv6 sofia -# profiles so they do not also bind the WebSocket audio port (5066). -rm -f /etc/freeswitch/sip_profiles/external-ipv6.xml -rm -f /etc/freeswitch/sip_profiles/internal-ipv6.xml - -# Determine this container's IPv4 address on the internal overlay network. -FS_PEER_IP=$(getent hosts redis | awk '{print $1; exit}' || true) -OVERLAY_PREFIX=$(echo "$FS_PEER_IP" | cut -d. -f1,2) -OWN_IP="" -if [ -n "$OVERLAY_PREFIX" ]; then - OWN_IP=$(hostname -I | tr ' ' '\n' | grep "^${OVERLAY_PREFIX}\." | head -n1) -fi -[ -z "$OWN_IP" ] && OWN_IP=$(hostname -I | awk '{print $1}') -echo "entrypoint.freeswitch.sh: external profile binding IPv4, advertising ${OWN_IP}" - -# Configure the IPv4 "external" profile for the overlay network. -sed -i -E 's#(&2 "error: /run/secrets/fsesl_password does not exist" exit 1 fi - -# Determine this container's own IP on the internal overlay network. -OWN_IP=$(node -e ' - const dgram = require("dgram"); - const dns = require("dns"); - dns.lookup("freeswitch", (err, addr, family) => { - if (err || !addr) { process.exit(1); } - const sock = dgram.createSocket(family === 6 ? "udp6" : "udp4"); - sock.connect(9, addr, () => { - process.stdout.write(sock.address().address); - sock.close(); - }); - }); -') || true - -if [ -z "$OWN_IP" ]; then - echo >&2 "error: could not determine own container IP for mediasoup announcedIp" - exit 1 -fi - -echo "entrypoint.webrtc-sfu.sh using announcedIp=${OWN_IP} for the FreeSWITCH audio bridge" - -export NODE_CONFIG="{\"mediasoup\":{\"plainRtp\":{\"listenIp\":{\"announcedIp\":\"${OWN_IP}\"}}}}" - +sleep 100 # start npm in WORKDIR (should be /app ?) -npm start +npm start \ No newline at end of file