Patch for /etc/asterisk/extensions.conf to add address conflict check ; Configure unique IP address C-O-N-F (2663) ;------------------------------------------ exten => 2663,1,Answer exten => 2663,2,Playback(enter-ip) exten => 2663,3,Read(newip||15) exten => 2663,4,SayDigits(${newip}) exten => 2663,5,System(/bin/echo "${newip}" > /tmp/newip.txt) exten => 2663,6,System(/bin/setnewip) exten => 2663,7,Playback(address-conflict) --------------------------------------------------------------------- New file for /bin/setnewip to add address conflict check #!/bin/sh -x # /bin/setnewip # David Rowe Nov 18 2007 # Modified for Openwrt's uci interface by Elektra # Sets a new IP based on DTMF digits collected by Asterisk # Asterisk places its collected IP in /tmp/newip.txt # Modified to check if IP address is in use. TLG May 21 2011. if [ ! -f /tmp/newip.txt ]; then exit fi # convert * seperated IP like 192*168*1*32 to 192.168.1.32 cat /tmp/newip.txt | sed 's/\*/\./g' > /tmp/newip_dot.txt # Check for address conflict if ping -c 5 `cat /tmp/newip_dot.txt`; then exit fi OCTET_A=`uci show network.lan.ipaddr | cut -d = -f2 | cut -d . -f1` OCTET_B=`uci show network.lan.ipaddr | cut -d = -f2 | cut -d . -f2` OCTET_C=`uci show network.lan.ipaddr | cut -d = -f2 | cut -d . -f3` uci set network.lan.ipaddr=`cat /tmp/newip_dot.txt` uci set network.lan.gateway=$OCTET_A.$OCTET_B.$OCTET_C.1 uci commit network reboot