diff --git a/freepbx/entrypoint.sh b/freepbx/entrypoint.sh index b0284114c..3154b3f3c 100755 --- a/freepbx/entrypoint.sh +++ b/freepbx/entrypoint.sh @@ -121,10 +121,13 @@ while (\$row = \$sth->fetch(\PDO::FETCH_ASSOC)) { EOF -# Set public ip if not already set +# Set proxy ip and port if not already set if [[ -z "${PROXY_IP}" ]]; then export PROXY_IP=$(curl -s https://api.ipify.org) fi +if [[ -z "${PROXY_PORT}" ]]; then + export PROXY_PORT=5060 +fi # migrate database php /initdb.d/migration.php diff --git a/imageroot/systemd/user/freepbx.service b/imageroot/systemd/user/freepbx.service index aeaa8100e..4601dfc9f 100644 --- a/imageroot/systemd/user/freepbx.service +++ b/imageroot/systemd/user/freepbx.service @@ -59,6 +59,7 @@ ExecStart=/usr/bin/podman run \ --env=SUBSCRIPTION_SYSTEMID \ --env=SUBSCRIPTION_SECRET \ --env=PROXY_IP \ + --env=PROXY_PORT \ --network=host \ --hostname=${NETHVOICE_HOST} \ ${NETHVOICE_FREEPBX_IMAGE} diff --git a/imageroot/systemd/user/tancredi.service b/imageroot/systemd/user/tancredi.service index d92f5a83f..2f2309282 100644 --- a/imageroot/systemd/user/tancredi.service +++ b/imageroot/systemd/user/tancredi.service @@ -30,6 +30,8 @@ ExecStart=/usr/bin/podman run \ --env=NETHVOICE_MARIADB_PORT \ --env=NETHVOICE_HOST \ --env=TANCREDI_STATIC_TOKEN \ + --env=PROXY_IP \ + --env=PROXY_PORT \ --network=host \ ${NETHVOICE_TANCREDI_IMAGE} diff --git a/tancredi/README.md b/tancredi/README.md index 8236dc1b9..1600343a9 100644 --- a/tancredi/README.md +++ b/tancredi/README.md @@ -12,4 +12,6 @@ Tancredi code repository are https://github.com/nethesis/tancredi and https://gi - `NETHVOICE_HOST` hostname of NethVoice server devices will connect to - `NETHVOICE_MARIADB_PORT` port of MariaDB - `NETHVOICESECRETKEY` secret key used by NethVoice UI to authenticate with Tancredi +- `PROXY_IP` sip proxy ip address to be used in extensions. Default is own public IP +- `PROXY_PORT` sip proxy port. Default is 5060 - `TANCREDI_STATIC_TOKEN` static token used by NethCTI to authenticate with Tancredi diff --git a/tancredi/entrypoint.sh b/tancredi/entrypoint.sh index 6d6f29ad9..acf86ef00 100755 --- a/tancredi/entrypoint.sh +++ b/tancredi/entrypoint.sh @@ -85,6 +85,17 @@ if [[ ! -f ${dst_file} ]]; then echo 'adminpw = "'$(head /dev/urandom | tr -dc a-z0-9 | head -c 10)'"' >> ${dst_file} echo 'userpw = "'$(head /dev/urandom | tr -dc a-z | head -c 6)'"' >> ${dst_file} + # Set proxy ip and port if not already set + if [[ -z "${PROXY_IP}" ]]; then + export PROXY_IP=$(curl -s https://api.ipify.org) + fi + if [[ -z "${PROXY_PORT}" ]]; then + export PROXY_PORT=5060 + fi + + # Set default proxy + echo 'outbound_proxy_1 = "${PROXY_IP}"' >> ${dst_file} + echo 'outbound_proxy_port_1 = "${PROXY_PORT}"' >> ${dst_file} fi runuser -s /bin/bash -c "php /usr/share/tancredi/scripts/upgrade.php" - www-data