diff --git a/README.md b/README.md index ff8c333be..9a45941cf 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,10 @@ This module is intended to be used with the ns8-nethvoice-proxy module as SIP pr Module can be configured from cluster-admin NethServer 8 interface. -To make also provisioniong RPS work with Falconieri, you need to manualy set `SUBSCRIPTION_SECRET` and `SUBSCRIPTION_SYSTEMID` into `~/.config/state/environment` file and restart freepbx container with `systemctl --user restart freepbx` +To make also provisioniong RPS work with Falconieri, you need to manualy set `SUBSCRIPTION_SECRET` and `SUBSCRIPTION_SYSTEMID` into `~/.config/state/environment` +file and restart freepbx container with `systemctl --user restart freepbx` + +Also `PUBLIC_IP` environment variable should be configured You can access NethVoice wizard at: ``` diff --git a/freepbx/README.md b/freepbx/README.md index dc37167a3..cb6c30498 100644 --- a/freepbx/README.md +++ b/freepbx/README.md @@ -33,6 +33,7 @@ This container also hosts push-proxy script for Flexisip. - `PHONEBOOK_LDAP_PORT` port of LDAP server - `PHONEBOOK_LDAP_USER` user of LDAP server - `PHONEBOOK_LDAP_PASS` password of LDAP server +- `PUBLIC_IP` public ip address - `APACHE_PORT` Port used for httpd - `TANCREDIPORT` Port used bt Tancredi - `BRAND_NAME` Name for branding (default: NethVoice) diff --git a/freepbx/initdb.d/migration.php b/freepbx/initdb.d/migration.php index 4d67ca997..ed0b00599 100644 --- a/freepbx/initdb.d/migration.php +++ b/freepbx/initdb.d/migration.php @@ -39,3 +39,22 @@ $sql = "UPDATE `asterisk`.`rest_devices_phones` SET `srtp` = 1 WHERE `extension` IN ('".str_repeat('?, ', count($extensions) - 1) . '?'."')"; $stmt = $db->prepare($sql); $stmt->execute($extensions); + +# configure proxy on all FreePBX extensions +$proxy_host = $_ENV['PUBLIC_IP']; +$proxy_port = 5060; + +$sql = "UPDATE `asterisk`.`sip` SET `data` = ? WHERE `keyword` = 'outbound_proxy' AND `id` IN ('".str_repeat('?, ', count($extensions) - 1) . '?'."')"; +$stmt = $db->prepare($sql); +$stmt->execute(array_merge(['sip:'.$proxy_host.':'.$proxy_port], $extensions)); + +# set rtp_symmetric to no in freepbx sip table +$sql = "UPDATE `asterisk`.`sip` SET `data` = 'no' WHERE `keyword` = 'rtp_symmetric' WHERE `id` IN ('".str_repeat('?, ', count($extensions) - 1) . '?'."')"; +$stmt = $db->prepare($sql); +$stmt->execute($extensions); + +# set rewrite_contact to no in freepbx sip table +$sql = "UPDATE `asterisk`.`sip` SET `data` = 'no' WHERE `keyword` = 'rewrite_contact' WHERE `id` IN ('".str_repeat('?, ', count($extensions) - 1) . '?'."')"; +$db->query($sql); +$stmt = $db->prepare($sql); +$stmt->execute($extensions); \ No newline at end of file diff --git a/tancredi/entrypoint.sh b/tancredi/entrypoint.sh index 1193b4d4f..6d6f29ad9 100755 --- a/tancredi/entrypoint.sh +++ b/tancredi/entrypoint.sh @@ -49,7 +49,7 @@ if [[ ! -f ${dst_file} ]]; then echo 'ui_first_config = "1"' >> ${dst_file} # Remove variables if they exists - for variable in timezone language tonezone hostname provisioning_url_scheme provisioning_freq time_format date_format ldap_server ldap_port ldap_tls ldap_user ldap_password ldap_base ldap_name_display ldap_number_attr ldap_mainphone_number_attr ldap_mobilephone_number_attr ldap_otherphone_number_attr ldap_name_attr ldap_number_filter ldap_name_filter adminpw userpw; do + for variable in timezone language tonezone hostname outbound_proxy outbound_proxy_port provisioning_url_scheme provisioning_freq time_format date_format ldap_server ldap_port ldap_tls ldap_user ldap_password ldap_base ldap_name_display ldap_number_attr ldap_mainphone_number_attr ldap_mobilephone_number_attr ldap_otherphone_number_attr ldap_name_attr ldap_number_filter ldap_name_filter adminpw userpw; do sed -i '/^'${variable}' =.*/d' ${dst_file} done # Add defaults @@ -57,6 +57,8 @@ if [[ ! -f ${dst_file} ]]; then echo 'language = "it"' >> ${dst_file} echo 'tonezone = "it"' >> ${dst_file} echo 'hostname = "'${NETHVOICE_HOST}'"' >> ${dst_file} + echo 'outbound_proxy_1 = "'${PUBLIC_IP}'"' >> ${dst_file} + echo 'outbound_proxy_port_1 = "5060"' >> ${dst_file} echo 'provisioning_url_scheme = "https"' >> ${dst_file} echo 'provisioning_freq = "everyday"' >> ${dst_file}