get fs.pl up to date
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4140 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
57c5be057d
commit
d1d1c73390
|
@ -112,7 +112,6 @@ sub sendmsg($$$) {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
$e = $self->readhash(.1);
|
$e = $self->readhash(.1);
|
||||||
if ($e && !$e->{socketerror}) {
|
if ($e && !$e->{socketerror}) {
|
||||||
#print Dumper $e;
|
|
||||||
push @{$self->{events}}, $e;
|
push @{$self->{events}}, $e;
|
||||||
} else {
|
} else {
|
||||||
last;
|
last;
|
||||||
|
|
|
@ -6,8 +6,9 @@ my $password = "ClueCon";
|
||||||
|
|
||||||
my $fs = init FreeSWITCH::Client {-password => $password} or die "Error $@";
|
my $fs = init FreeSWITCH::Client {-password => $password} or die "Error $@";
|
||||||
my $term = new Term::ReadLine "FreeSWITCH CLI";
|
my $term = new Term::ReadLine "FreeSWITCH CLI";
|
||||||
my $prompt = "FS>";
|
my $prompt = "[mFreeSWITCH>";
|
||||||
my $OUT = $term->OUT .. \*STDOUT;
|
my $OUT = $term->OUT .. \*STDOUT;
|
||||||
|
my $pid;
|
||||||
|
|
||||||
my $log = shift;
|
my $log = shift;
|
||||||
|
|
||||||
|
@ -19,44 +20,38 @@ if ($log) {
|
||||||
my $fs2 = init FreeSWITCH::Client {-password => $password} or die "Error $@";
|
my $fs2 = init FreeSWITCH::Client {-password => $password} or die "Error $@";
|
||||||
|
|
||||||
|
|
||||||
$fs2->cmd({ command => "log $log" });
|
$fs2->sendmsg({ 'command' => "log $log" });
|
||||||
while (1) {
|
while (1) {
|
||||||
my $reply = $fs2->readhash(undef);
|
my $reply = $fs2->readhash(undef);
|
||||||
if ($reply->{socketerror}) {
|
if ($reply->{socketerror}) {
|
||||||
die "socket error";
|
die "socket error";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($reply->{body}) {
|
if ($reply->{body}) {
|
||||||
print $reply->{body} . "\n";
|
print $reply->{body};
|
||||||
} elsif ($reply->{'reply-text'}) {
|
}
|
||||||
print $reply->{'reply-text'} . "\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while ( defined ($_ = $term->readline($prompt)) ) {
|
while ( defined ($_ = $term->readline($prompt)) ) {
|
||||||
my $reply;
|
|
||||||
|
|
||||||
if ($_) {
|
if ($_) {
|
||||||
my $reply = $fs->cmd({command => "api $_"});
|
if ($_ =~ /exit/) {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
my $reply = $fs->command($_);
|
||||||
if ($reply->{socketerror}) {
|
if ($reply->{socketerror}) {
|
||||||
$fs2->disconnect();
|
$fs2->disconnect();
|
||||||
die "socket error";
|
die "socket error";
|
||||||
}
|
}
|
||||||
if ($reply->{body}) {
|
print "$reply\n";
|
||||||
print $reply->{body};
|
|
||||||
} elsif ($reply->{'reply-text'}) {
|
|
||||||
print $reply->{'reply-text'};
|
|
||||||
}
|
|
||||||
print "\n";
|
|
||||||
if ($_ =~ /exit/) {
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$term->addhistory($_) if /\S/;
|
$term->addhistory($_) if /\S/;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($pid) {
|
||||||
|
kill 9 => $pid;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue