Asterisk Remove Sipgate Alphanumeric ID Extension

Sipgate provide SIP account numbers with alphanumeric sub-accounts. The sub-account extension needs to be removed in order for FreePBX to generate the trunks inbound route.

The following has been added to extensions_custom.conf

[from-trunk-sipgate]
exten => _.,1,Noop(Remove Sipgate Extra Digits)
exten => _.,n,Goto(from-trunk,${EXTEN:0:7},1)

and the following added to the trunks PEER Details

context=from-trunk-sipgate

Ping Watchdog for Strongswan

#!/bin/bash
HOST=$1 ##Host IP at endpoint to test
ConnName=$2 ##StrongSwan connection name to call
OfflineCount=1
while [ $OfflineCount -gt 0 ]
do
echo loop $OfflineCount
ping=$(ping -c 1 -w 2 $HOST | grep bytes | wc -l)
if [[ $ping -gt 1 ]];then
echo "HOST ONLINE"
logger "[vpnwatchdog] host $HOST online"
OfflineCount=0
exit
else
echo "HOST OFFLINE"
let OfflineCount++
sleep 1
fi
if [[ $OfflineCount -gt 9 ]];then
logger "[vpnwatchdog] host $HOST timeout reached. Restarting VPN..."
echo "OFFLINE LIMIT REACHED"
sudo strongswan down $ConnName
sudo strongswan up $ConnName
exit
fi
done