[asterisk-users] Cisco remote reboot

Daryl Jurbala daryl at introspect.net
Mon May 28 07:07:13 MST 2007


I've fired a script from an AGI-BIN to accomplish that.

Try this one:

#!/usr/bin/perl
# mk 2004  feel free to distribute
#  mklein at nmedia.net, _Vile
#  perl script to reboot phones
#  try telnetting to your phone, first.
#
use Net::Telnet ();

$phone_ip = shift;

# Your Cisco 79xx prompt
$prompt = "Enter Your Prompt Here";

# Your Password
$password = "xxxxxx";

# Reset Command
$command = "reset";

if ($phone_ip eq "all")
{
	reboot("xxx.xx.x.xx",$password,$command,$prompt);
	reboot("xxx.xx.x.xx",$password,$command,$prompt);
	reboot("xxx.xx.x.xx",$password,$command,$prompt);
	reboot("xxx.xx.x.xx",$password,$command,$prompt);
} elsif ($phone_ip eq "") {
	print "Enter an IP or 'all' for All.";
} else {
	reboot($phone_ip,$password,$command,$prompt);
}

exit;

sub reboot{

     my ($ip,$password,$command,$prompt) = @_;

     $t = new Net::Telnet;
     $t->open($ip);

     $t->waitfor('/Password :.*$/');
     $t->print($password);

     $t->waitfor('/'.$prompt.'>.*$/');
     $t->print($command);

}




More information about the asterisk-users mailing list