From 1fbe4aef121120151bdf0610ae8355342b40e6b6 Mon Sep 17 00:00:00 2001 From: Keith Whyte Date: Wed, 2 Aug 2023 05:52:08 +0200 Subject: [PATCH] FS: Rename SIP Profiles --- .../sip_profiles/internal/example.xml | 37 -- .../freeswitch/sip_profiles/internalvpn.xml | 412 ------------------ .../files/etc/freeswitch/sip_profiles/lan.xml | 6 +- .../sip_profiles/{external.xml => vpn.xml} | 31 +- modules/rhizo_base/manifests/freeswitch.pp | 40 +- modules/rhizo_base/templates/GERAN.xml.erb | 191 ++++++++ modules/rhizo_base/templates/extrtp.xml.erb | 86 ++++ .../templates/monitor_freeswitch.sh.erb | 33 +- .../rem_xcode.xml.erb} | 8 +- modules/rhizo_base/templates/vars.xml.erb | 3 +- 10 files changed, 333 insertions(+), 514 deletions(-) delete mode 100644 modules/rhizo_base/files/etc/freeswitch/sip_profiles/internal/example.xml delete mode 100644 modules/rhizo_base/files/etc/freeswitch/sip_profiles/internalvpn.xml rename modules/rhizo_base/files/etc/freeswitch/sip_profiles/{external.xml => vpn.xml} (84%) create mode 100644 modules/rhizo_base/templates/GERAN.xml.erb create mode 100644 modules/rhizo_base/templates/extrtp.xml.erb rename modules/rhizo_base/{files/etc/freeswitch/sip_profiles/rem_xcode.xml => templates/rem_xcode.xml.erb} (88%) diff --git a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/internal/example.xml b/modules/rhizo_base/files/etc/freeswitch/sip_profiles/internal/example.xml deleted file mode 100644 index 10263b0..0000000 --- a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/internal/example.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/internalvpn.xml b/modules/rhizo_base/files/etc/freeswitch/sip_profiles/internalvpn.xml deleted file mode 100644 index d62391c..0000000 --- a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/internalvpn.xml +++ /dev/null @@ -1,412 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/lan.xml b/modules/rhizo_base/files/etc/freeswitch/sip_profiles/lan.xml index 5b1a347..4713169 100644 --- a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/lan.xml +++ b/modules/rhizo_base/files/etc/freeswitch/sip_profiles/lan.xml @@ -19,7 +19,7 @@ - + @@ -45,8 +45,8 @@ - - + + diff --git a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/external.xml b/modules/rhizo_base/files/etc/freeswitch/sip_profiles/vpn.xml similarity index 84% rename from modules/rhizo_base/files/etc/freeswitch/sip_profiles/external.xml rename to modules/rhizo_base/files/etc/freeswitch/sip_profiles/vpn.xml index cac4952..0f99794 100644 --- a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/external.xml +++ b/modules/rhizo_base/files/etc/freeswitch/sip_profiles/vpn.xml @@ -1,8 +1,8 @@ - + - + @@ -13,11 +13,14 @@ - + - + + + + @@ -26,12 +29,14 @@ - + - - + + + + @@ -53,8 +58,8 @@ - - + + @@ -63,10 +68,10 @@ - - - - + + + + diff --git a/modules/rhizo_base/manifests/freeswitch.pp b/modules/rhizo_base/manifests/freeswitch.pp index f8ac0c7..959313e 100644 --- a/modules/rhizo_base/manifests/freeswitch.pp +++ b/modules/rhizo_base/manifests/freeswitch.pp @@ -173,56 +173,40 @@ class rhizo_base::freeswitch::common { require => Package['freeswitch'], } - file {'/etc/freeswitch/sip_profiles/extrtp': + file {'/etc/freeswitch/sip_profiles/gateways': ensure => directory, } - file { '/etc/freeswitch/sip_profiles/outgoing.xml': - content => template('rhizo_base/outgoing.xml.erb'), + file { '/etc/freeswitch/sip_profiles/extrtp.xml': + content => template('rhizo_base/extrtp.xml.erb'), require => [ Package[ 'freeswitch' ], File[ '/etc/freeswitch/' ] ], } - - file { '/etc/freeswitch/sip_profiles/extrtp/rhizoextrtp.xml': - content => template('rhizo_base/rhizoextrtp.xml.erb'), + file { '/etc/freeswitch/sip_profiles/rem_xcode.xml': + content => template('rhizo_base/rem_xcode.xml.erb'), require => [ Package['freeswitch'], - File['/etc/freeswitch/sip_profiles/extrtp'] ], + File['/etc/freeswitch/'] ], } - file {'/etc/freeswitch/sip_profiles/external': - ensure => directory, + file { '/etc/freeswitch/sip_profiles/GERAN.xml': + content => template('rhizo_base/GERAN.xml.erb'), } - file { '/etc/freeswitch/sip_profiles/external/provider.xml': - content => template('rhizo_base/provider.xml.erb'), - require => - [ Package['freeswitch'], - 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, - } - - file { '/etc/freeswitch/sip_profiles/outgoing/rhizomatica.xml': + file { '/etc/freeswitch/sip_profiles/gateways/rhizomatica.xml': content => template('rhizo_base/rhizomatica.xml.erb'), require => [ Package['freeswitch'], - File['/etc/freeswitch/sip_profiles/outgoing'] ], + File['/etc/freeswitch/sip_profiles/gateways'] ], } - file { '/etc/freeswitch/sip_profiles/outgoing/rhizoalt.xml': + file { '/etc/freeswitch/sip_profiles/gateways/rhizoalt.xml': content => template('rhizo_base/rhizoalt.xml.erb'), require => [ Package['freeswitch'], - File['/etc/freeswitch/sip_profiles/outgoing'] ], + File['/etc/freeswitch/sip_profiles/gateways'] ], } file { '/etc/freeswitch/autoload_configs/acl.conf.xml': diff --git a/modules/rhizo_base/templates/GERAN.xml.erb b/modules/rhizo_base/templates/GERAN.xml.erb new file mode 100644 index 0000000..addfa06 --- /dev/null +++ b/modules/rhizo_base/templates/GERAN.xml.erb @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/rhizo_base/templates/extrtp.xml.erb b/modules/rhizo_base/templates/extrtp.xml.erb new file mode 100644 index 0000000..accd9db --- /dev/null +++ b/modules/rhizo_base/templates/extrtp.xml.erb @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/rhizo_base/templates/monitor_freeswitch.sh.erb b/modules/rhizo_base/templates/monitor_freeswitch.sh.erb index 8aeeb2b..1fb6a1f 100755 --- a/modules/rhizo_base/templates/monitor_freeswitch.sh.erb +++ b/modules/rhizo_base/templates/monitor_freeswitch.sh.erb @@ -9,31 +9,32 @@ LOGFILE="/var/log/monitor_fs.log" IFS= FS_STATUS="$(fs_cli -x 'sofia status')" +FS_STATUS_GW="$(fs_cli -x 'sofia status gateway')" -if !(echo $FS_STATUS | egrep -q "internal.*<%= @mncc_ip_address %>"); then - logc "Missing internal profile! Restarting Profile"; - fs_cli -x "sofia profile internal stop" +if !(echo $FS_STATUS | egrep -q "GERAN.*<%= @mncc_ip_address %>"); then + logc "Missing GERAN profile! Restarting Profile"; + fs_cli -x "sofia profile GERAN stop" sleep 10 - fs_cli -x "sofia profile internal start" + fs_cli -x "sofia profile GERAN start" fi -if !(echo $FS_STATUS | grep -q "external::provider") && (ping -qc 5 8.8.8.8 > /dev/null); then - logc "Missing external provider! Restarting Profile"; - fs_cli -x "sofia profile external stop" +if !(echo $FS_STATUS_GW | grep -q "extrtp::extrtp") && (ping -qc 5 8.8.8.8 > /dev/null); then + logc "Missing external RTP Gateway. Restarting Profile"; + fs_cli -x "sofia profile extrtp stop" sleep 10 - fs_cli -x "sofia profile external start" + fs_cli -x "sofia profile extrtp start" fi -if !(echo $FS_STATUS | grep -q "outgoing::rhizomatica") && (ping -qc 5 10.23.0.2 > /dev/null); then - logc "Missing outgoing profile! Restarting Profile"; - fs_cli -x "sofia profile outgoing stop" +if !(echo $FS_STATUS_GW | grep -q "vpn::rhizomatica") && (ping -qc 5 10.23.0.2 > /dev/null); then + logc "Missing VPN Gateway. Restarting Profile"; + fs_cli -x "sofia profile vpn stop" sleep 10 - fs_cli -x "sofia profile outgoing start" + fs_cli -x "sofia profile vpn start" fi -if !(echo $FS_STATUS | grep -q "internalvpn") && (ping -qc 5 10.23.0.2 > /dev/null); then - logc "Missing internal VPN. Restarting FreeSWITCH profile"; - fs_cli -x "sofia profile internalvpn stop" +if !(echo $FS_STATUS | grep -q "rem_xcode") && (ping -qc 5 10.23.0.2 > /dev/null); then + logc "Missing Remote Transcoding Profile. Restarting FreeSWITCH profile"; + fs_cli -x "sofia profile rem_xcode stop" sleep 10 - fs_cli -x "sofia profile internalvpn start" + fs_cli -x "sofia profile rem_xcode start" fi diff --git a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/rem_xcode.xml b/modules/rhizo_base/templates/rem_xcode.xml.erb similarity index 88% rename from modules/rhizo_base/files/etc/freeswitch/sip_profiles/rem_xcode.xml rename to modules/rhizo_base/templates/rem_xcode.xml.erb index 5018358..20fd8ca 100644 --- a/modules/rhizo_base/files/etc/freeswitch/sip_profiles/rem_xcode.xml +++ b/modules/rhizo_base/templates/rem_xcode.xml.erb @@ -2,9 +2,9 @@ - - - + + + @@ -38,7 +38,7 @@ - + diff --git a/modules/rhizo_base/templates/vars.xml.erb b/modules/rhizo_base/templates/vars.xml.erb index 80fae6f..55f84d6 100644 --- a/modules/rhizo_base/templates/vars.xml.erb +++ b/modules/rhizo_base/templates/vars.xml.erb @@ -38,6 +38,7 @@ + @@ -148,7 +149,7 @@ 127 - BV32 --> - +