Expect script to reset to defaults some Grandstream phones

Usage example:
gsresetdefault.exp admin 192.168.1.234

cat gsresetdefault.exp


#!/usr/bin/expect -f
set ip [lindex $argv 1]
set pass [lindex $argv 0]

set timeout -1
spawn telnet $ip
expect "Password:"
send  "$pass\r"
expect ">"
send -- "reset\r"
expect "Do you want to continue (y/N)?"
send -- "y\r"


Reset to default all Phones:

arp -an | grep 00:0b | gsresetall admin

cat gsresetall


#!/bin/bash
while read str ;
do
ip=$(echo -n ${str} | grep -o -E '([0-9]{1,3}\.){3}[0-9a-z]{1,3}')
if [ "${ip}" ] ; then
    echo Reset ${ip}
    gsresetdefault.exp ${1} ${ip}
fi
done


Usage example:
gsresetdefault.exp admin 192.168.1.234

cat gsresetdefault.exp


#!/usr/bin/expect -f
set ip [lindex $argv 1]
set pass [lindex $argv 0]

set timeout -1
spawn telnet $ip
expect "Password:"
send  "$pass\r"
expect ">"
send -- "reset\r"
expect "Do you want to continue (y/N)?"
send -- "y\r"


Reset to default all Phones:

arp -an | grep 00:0b | gsresetall admin

cat gsresetall


#!/bin/bash
while read str ;
do
ip=$(echo -n ${str} | grep -o -E '([0-9]{1,3}\.){3}[0-9a-z]{1,3}')
if [ "${ip}" ] ; then
    echo Reset ${ip}
    gsresetdefault.exp ${1} ${ip}
fi
done


Created by: laigor, Last modification: Sat 29 of Mar, 2014 (15:19 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+