標題:
QNAP Asterisk SIP IP Tracking
[打印本頁]
作者:
角色
時間:
2010-9-8 22:04
標題:
QNAP Asterisk SIP IP Tracking
trunk_ip_check.sh
#!/bin/sh
PEER="sz-gw"
ASTCMD="/opt/sbin/asterisk -rx"
NSLCMD="ping -c 1"
OLD_IP=`$ASTCMD "sip show peer $PEER" | grep "Addr->IP" | cut -c 16- | cut -f2 -d\ `
PEER_HOST=`$ASTCMD "sip show peer $PEER" | grep "ToHost" | cut -c 16- | cut -f2 -d\ `
NEW_IP=`$NSLCMD $PEER_HOST | head -1 | cut -f3 -d\ | sed s/:// | sed s/\(// | sed s/\)//`
if [ $NEW_IP != $OLD_IP ]
then
$ASTCMD "sip reload"
echo "$PEER `date` IP changed from $OLD_IP to $NEW_IP then sip reload" >> /opt/etc/asterisk/trunk_ip_change.dat
fi
複製代碼
In the file /mnt/HDA_ROOT/.config/crontab add the following cron job
*/5 * * * * /bin/sh /opt/etc/asterisk/trunk_ip_check.sh
複製代碼
Restart the cron routine
/etc/init.d/crond.sh restart
複製代碼
YH
歡迎光臨 電訊茶室 (http://telecom-cafe.com/forum/)
Powered by Discuz! 7.2