Answer the question
In order to leave comments, you need to log in
How to disable one IP client when another DD-WRT Dlink-DIR615 client goes offline?
Hello! I have a not quite simple question...
I have a VOIP number, which by default is redirected by the voip provider to the mobile phone. The redirect occurs only when the voip provider does not see the registered ip phones. If there are registered ip-phones, then at first they ring, and after X seconds the call is already redirected to the mobile phone.
I have Router Dlink-DIR615 rev d
Firmware DD-WRT v24-sp2 (03/25/13) std - build 21061
Kernel Linux 3.2.41-svn21039 #101 Mon Mar 25 10:30:36 CET 2013 mips
to which I connected IP phone and to which my mobile phone connects via WiFi when I'm at home.
I need to configure it so that when I am at home, calls go to the IP phone connected to the router via LAN, and when I am not at home, they are redirected to the mobile phone without delay (for this, the home IP phone must be offline).
The only option I imagine is this solution:
You need to somehow program DD-WRT so that when the mobile phone is in the WiFi router (= I'm at home), the IP phone gets full access to the Internet, and if the WiFi connection with the mobile is interrupted (= I'm out at home), then the IP phone loses access to the Internet and thereby disconnects from the VOIP provider, so calls will be redirected to the mobile phone without delay.
I apologize for the possible confusion, but does anyone know how to do this?
Thanks in advance for any idea!
Answer the question
In order to leave comments, you need to log in
Script on the router that enables/disables the interface to which the VoIP device is connected, if there is/is no response from the specified host, in this case, a mobile phone (you should first create a reservation on the DHCP server).
Bash script example: stackoverflow.com/questions/10243845/bash-script-t...
#!/bin/bash
timeout=5 # delay between checks
pingip='8.8.8.8' # what to ping
iface="eth0"
LOG_FILE="/var/log/syslog"
isdown=0 # indicate whether the interface is up or down
# start assuming interface is up
while true; do
LOG_TIME=`date +%b' '%d' '%T`
if ping -q -c 2 "$pingip" >> /dev/null ; then # ping is good - bring iface up
if [ "$isdown" -ne 0 ] ; then
ifup $iface && isdown=0
printf "$LOG_TIME $0: Interface brought up: %s\n" "$iface" | tee -a $LOG_FILE
fi
else # ping is bad - bring iface down
beep -f 4000
if [ "$isdown" -ne 1 ] ; then
ifdown $iface && isdown=1
printf "$LOG_TIME $0: Interface brought down: %s\n" "$iface" | tee -a $LOG_FILE
fi
fi
sleep "$timeout"
done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question