in reply to Re: Retrieving status data from a device with SSH 2 using Perl
in thread Retrieving status data from a device with SSH 2 using Perl
I am really astonished with all the fast answers. Thanks to all of you!
Here is an example of the code, using Net::OpenSSH (the results with the other packages are similar):
my $ssh = Net::OpenSSH->new($host, "user"=>$user, "passwd"=>$pass); $ssh->error and die "Couldn't establish connection: ". $ssh->error; my @output = $ssh->capture('control call dial $receiver'); $ssh->error and warn "Couldn't make the call: ". $ssh->error; print "line: $_" for (@output); sleep(1); my @output = $ssh->capture('control call hangup -a'); $ssh->error and warn "Couldn't hangup: ". $ssh->error; print "line: $_" for (@output);
With this, I get the following output printed:
line: line: ok,00 line: line: ok,00
And this is the same but using the shell with the ssh command:
$ control call dial *receiver* ok,00 CS,23,1,Dialing $ control call hangup -a ok,00 CS,23,1,Terminated $
|
|---|