Skip to content

Commit

Permalink
Add outbound proxy to extension configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Stell0 committed Oct 20, 2023
1 parent 906ef28 commit 58a110c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
```
Expand Down
1 change: 1 addition & 0 deletions freepbx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 19 additions & 0 deletions freepbx/initdb.d/migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
4 changes: 3 additions & 1 deletion tancredi/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ 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
echo 'timezone = "Europe/Rome"' >> ${dst_file}
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}

Expand Down

0 comments on commit 58a110c

Please sign in to comment.