#!/bin/bash #Check status of FreeSWITCH SIP interfaces #Doesn't restart FreeSWITCH if WAN or VPN interfaces are down RHIZO_SCRIPT="/home/rhizomatica/bin" . $RHIZO_SCRIPT/vars.sh 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 "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 GERAN start" fi 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 extrtp start" fi 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 vpn start" fi 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 rem_xcode start" fi