From b179f5848938a58ea5ecea82c4ac7a26e4aa8264 Mon Sep 17 00:00:00 2001 From: Monocots Date: Sat, 10 Aug 2019 07:11:27 +0000 Subject: [PATCH] FreeSwitch, make use of the mncc_ip_address variable --- modules/rhizo_base/manifests/freeswitch.pp | 10 ++++++++++ modules/rhizo_base/manifests/init.pp | 5 +++++ .../acl.conf.xml => templates/acl.conf.xml.erb} | 2 +- .../internal.xml => templates/internal.xml.erb} | 8 ++++---- .../monitor_freeswitch.sh.erb} | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) rename modules/rhizo_base/{files/etc/freeswitch/autoload_configs/acl.conf.xml => templates/acl.conf.xml.erb} (95%) rename modules/rhizo_base/{files/etc/freeswitch/sip_profiles/internal.xml => templates/internal.xml.erb} (98%) rename modules/rhizo_base/{files/bin/monitor_freeswitch.sh => templates/monitor_freeswitch.sh.erb} (93%) diff --git a/modules/rhizo_base/manifests/freeswitch.pp b/modules/rhizo_base/manifests/freeswitch.pp index a1e38e6..1590447 100644 --- a/modules/rhizo_base/manifests/freeswitch.pp +++ b/modules/rhizo_base/manifests/freeswitch.pp @@ -92,6 +92,7 @@ class rhizo_base::freeswitch::common { $voip_proxy = $rhizo_base::voip_proxy $sip_central_ip_address = $rhizo_base::sip_central_ip_address $reg_provider = $rhizo_base::reg_provider + $mncc_ip_address = $rhizo_base::mncc_ip_address package { ['freeswitch', 'freeswitch-lang-en', @@ -149,6 +150,10 @@ class rhizo_base::freeswitch::common { File['/etc/freeswitch/sip_profiles/external'] ], } + file { '/etc/freeswitch/sip_profiles/internal.xml': + content => template('rhizo_base/internal.xml.erb'), + } + file {'/etc/freeswitch/sip_profiles/outgoing': ensure => directory, } @@ -160,6 +165,11 @@ class rhizo_base::freeswitch::common { File['/etc/freeswitch/sip_profiles/outgoing'] ], } + file { '/etc/freeswitch/autoload_configs/acl.conf.xml': + content => template('rhizo_base/acl.conf.xml.erb'), + require => Package['freeswitch'], + } + file { '/etc/freeswitch/autoload_configs/cdr_pg_csv.conf.xml': content => template('rhizo_base/cdr_pg_csv.conf.xml.erb'), require => Package['freeswitch'], diff --git a/modules/rhizo_base/manifests/init.pp b/modules/rhizo_base/manifests/init.pp index d1ce8ea..7507413 100644 --- a/modules/rhizo_base/manifests/init.pp +++ b/modules/rhizo_base/manifests/init.pp @@ -252,6 +252,11 @@ schedule { 'repo': purge => false, } + file { '/home/rhizomatica/bin/monitor_freeswitch.sh': + ensure => present, + content => template('rhizo_base/monitor_freeswitch.sh.erb'), + } + file { '/home/rhizomatica/bin/vars.sh': ensure => present, content => template('rhizo_base/vars.sh.erb'), diff --git a/modules/rhizo_base/files/etc/freeswitch/autoload_configs/acl.conf.xml b/modules/rhizo_base/templates/acl.conf.xml.erb similarity index 95% rename from modules/rhizo_base/files/etc/freeswitch/autoload_configs/acl.conf.xml rename to modules/rhizo_base/templates/acl.conf.xml.erb index 33ae0ff..6b26044 100644 --- a/modules/rhizo_base/files/etc/freeswitch/autoload_configs/acl.conf.xml +++ b/modules/rhizo_base/templates/acl.conf.xml.erb @@ -26,7 +26,7 @@ - + diff --git a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/internal.xml b/modules/rhizo_base/templates/internal.xml.erb similarity index 98% rename from modules/rhizo_base/files/etc/freeswitch/sip_profiles/internal.xml rename to modules/rhizo_base/templates/internal.xml.erb index 2b7a22b..ad04993 100644 --- a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/internal.xml +++ b/modules/rhizo_base/templates/internal.xml.erb @@ -91,9 +91,9 @@ - + - + @@ -272,8 +272,8 @@ auto - Use guessed ip. auto-nat - Use ip learned from NAT-PMP or UPNP --> - - + + diff --git a/modules/rhizo_base/files/bin/monitor_freeswitch.sh b/modules/rhizo_base/templates/monitor_freeswitch.sh.erb similarity index 93% rename from modules/rhizo_base/files/bin/monitor_freeswitch.sh rename to modules/rhizo_base/templates/monitor_freeswitch.sh.erb index 5fe3bef..8aeeb2b 100755 --- a/modules/rhizo_base/files/bin/monitor_freeswitch.sh +++ b/modules/rhizo_base/templates/monitor_freeswitch.sh.erb @@ -10,7 +10,7 @@ LOGFILE="/var/log/monitor_fs.log" IFS= FS_STATUS="$(fs_cli -x 'sofia status')" -if !(echo $FS_STATUS | egrep -q "internal.*172.16.0.1"); then +if !(echo $FS_STATUS | egrep -q "internal.*<%= @mncc_ip_address %>"); then logc "Missing internal profile! Restarting Profile"; fs_cli -x "sofia profile internal stop" sleep 10