Skip to content

Commit

Permalink
Add proxy and proxy port variables also to tancredi
Browse files Browse the repository at this point in the history
  • Loading branch information
Stell0 committed Nov 10, 2023
1 parent 9baca75 commit ec51025
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
5 changes: 4 additions & 1 deletion freepbx/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions imageroot/systemd/user/freepbx.service
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions imageroot/systemd/user/tancredi.service
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
2 changes: 2 additions & 0 deletions tancredi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 11 additions & 0 deletions tancredi/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ec51025

Please sign in to comment.