[Freeswitch-svn] [commit] r4140 - in freeswitch/trunk/scripts/socket: . FreeSWITCH

Freeswitch SVN anthm at freeswitch.org
Tue Feb 6 16:24:43 EST 2007


Author: anthm
Date: Tue Feb  6 16:24:43 2007
New Revision: 4140

Modified:
   freeswitch/trunk/scripts/socket/FreeSWITCH/Client.pm
   freeswitch/trunk/scripts/socket/fs.pl

Log:
get fs.pl up to date

Modified: freeswitch/trunk/scripts/socket/FreeSWITCH/Client.pm
==============================================================================
--- freeswitch/trunk/scripts/socket/FreeSWITCH/Client.pm	(original)
+++ freeswitch/trunk/scripts/socket/FreeSWITCH/Client.pm	Tue Feb  6 16:24:43 2007
@@ -112,7 +112,6 @@
   for(;;) {
     $e = $self->readhash(.1);
     if ($e && !$e->{socketerror}) {
-      #print Dumper $e;
       push @{$self->{events}}, $e;
     } else  {
       last;

Modified: freeswitch/trunk/scripts/socket/fs.pl
==============================================================================
--- freeswitch/trunk/scripts/socket/fs.pl	(original)
+++ freeswitch/trunk/scripts/socket/fs.pl	Tue Feb  6 16:24:43 2007
@@ -6,8 +6,9 @@
 
 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,44 +20,38 @@
     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;
   }
 
 }
 
-
-
 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;
+}



More information about the Freeswitch-svn mailing list