提交 d1d1c733 authored 作者: Anthony Minessale's avatar Anthony Minessale

get fs.pl up to date

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4140 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 57c5be05
......@@ -112,7 +112,6 @@ sub sendmsg($$$) {
for(;;) {
$e = $self->readhash(.1);
if ($e && !$e->{socketerror}) {
#print Dumper $e;
push @{$self->{events}}, $e;
} else {
last;
......
......@@ -6,8 +6,9 @@ my $password = "ClueCon";
my $fs = init FreeSWITCH::Client {-password => $password} or die "Error $@";
my $term = new Term::ReadLine "FreeSWITCH CLI";
my $prompt = "FS>";
my $prompt = "FreeSWITCH>";
my $OUT = $term->OUT .. \*STDOUT;
my $pid;
my $log = shift;
......@@ -19,16 +20,15 @@ if ($log) {
my $fs2 = init FreeSWITCH::Client {-password => $password} or die "Error $@";
$fs2->cmd({ command => "log $log" });
$fs2->sendmsg({ 'command' => "log $log" });
while (1) {
my $reply = $fs2->readhash(undef);
if ($reply->{socketerror}) {
die "socket error";
}
if ($reply->{body}) {
print $reply->{body} . "\n";
} elsif ($reply->{'reply-text'}) {
print $reply->{'reply-text'} . "\n";
print $reply->{body};
}
}
exit;
......@@ -36,27 +36,22 @@ if ($log) {
}
while ( defined ($_ = $term->readline($prompt)) ) {
my $reply;
if ($_) {
my $reply = $fs->cmd({command => "api $_"});
if ($_ =~ /exit/) {
last;
}
my $reply = $fs->command($_);
if ($reply->{socketerror}) {
$fs2->disconnect();
die "socket error";
}
if ($reply->{body}) {
print $reply->{body};
} elsif ($reply->{'reply-text'}) {
print $reply->{'reply-text'};
}
print "\n";
if ($_ =~ /exit/) {
last;
}
print "$reply\n";
}
$term->addhistory($_) if /\S/;
}
if ($pid) {
kill 9 => $pid;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论