Backup Internet and Provider Re-Registration
Configuring Backup Internet
Create the IP Check Script
cat > /storage/usbdisk1/mikopbx/custom_modules/update_ip.sh#!/bin/bash
# File to store the previous IP
IP_FILE="/tmp/last_ip.txt"
# Command to retrieve the current public IP
CURRENT_IP=$(/usr/bin/curl -s https://checkip.amazonaws.com)
# Check if the file with the previous IP exists
if [ -f "$IP_FILE" ]; then
LAST_IP=$(cat "$IP_FILE")
else
LAST_IP=""
fi
# Compare the current IP with the previous IP
if [ "$CURRENT_IP" != "$LAST_IP" ]; then
/bin/busybox logger -t 'UpdateIP' "IP changed: $LAST_IP -> $CURRENT_IP"
echo "$CURRENT_IP" > "$IP_FILE"
# Trigger an Asterisk command
/usr/sbin/asterisk -rx 'pjsip send register *all'
fiSchedule the Script



Last updated
Was this helpful?

