|
|
|
@ -33,18 +33,28 @@ sub usage
|
|
|
|
my $output = "usage: show_sip.pl [-h] file\n";
|
|
|
|
my $output = "usage: show_sip.pl [-h] file\n";
|
|
|
|
$output .= "\tOptions:\n";
|
|
|
|
$output .= "\tOptions:\n";
|
|
|
|
$output .= "-h --help: this help\n";
|
|
|
|
$output .= "-h --help: this help\n";
|
|
|
|
|
|
|
|
$output .= "-i --sip_in: print sip_in\n";
|
|
|
|
|
|
|
|
$output .= "-o --sip_out: print sip_out\n";
|
|
|
|
|
|
|
|
$output .= "by default prints both\n";
|
|
|
|
return $output
|
|
|
|
return $output
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
my $help = 0;
|
|
|
|
my $help = 0;
|
|
|
|
my $json_in = 0;
|
|
|
|
my $json_in = 0;
|
|
|
|
GetOptions ("h|help" => \$help)
|
|
|
|
my $in = 0;
|
|
|
|
|
|
|
|
my $out = 0;
|
|
|
|
|
|
|
|
GetOptions ("h|help" => \$help, "i|sip_in" => \$in, "o|sip_out" => \$out)
|
|
|
|
or die("Error in command line arguments\n".usage());
|
|
|
|
or die("Error in command line arguments\n".usage());
|
|
|
|
|
|
|
|
|
|
|
|
if($#ARGV!=0 || $help)
|
|
|
|
if($#ARGV!=0 || $help)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
die(usage())
|
|
|
|
die(usage())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!$in && !$out) {
|
|
|
|
|
|
|
|
# default behaviour
|
|
|
|
|
|
|
|
$in = 1;
|
|
|
|
|
|
|
|
$out = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
my $filename = abs_path($ARGV[0]);
|
|
|
|
my $filename = abs_path($ARGV[0]);
|
|
|
|
my $json;
|
|
|
|
my $json;
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -55,14 +65,18 @@ my $json;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
my $inlog = decode_json($json);
|
|
|
|
my $inlog = decode_json($json);
|
|
|
|
|
|
|
|
|
|
|
|
print "=== sip_in ===\n";
|
|
|
|
if($in) {
|
|
|
|
foreach my $i (@{$inlog->{'sip_in'}})
|
|
|
|
print "=== sip_in ===\n";
|
|
|
|
{
|
|
|
|
foreach my $i (@{$inlog->{'sip_in'}})
|
|
|
|
print "$i\n---\n";
|
|
|
|
{
|
|
|
|
|
|
|
|
print "$i\n---\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "=== sip_out ===\n";
|
|
|
|
if($out) {
|
|
|
|
foreach my $i (@{$inlog->{'sip_out'}})
|
|
|
|
print "=== sip_out ===\n";
|
|
|
|
{
|
|
|
|
foreach my $i (@{$inlog->{'sip_out'}})
|
|
|
|
print "$i\n---\n"
|
|
|
|
{
|
|
|
|
|
|
|
|
print "$i\n---\n"
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#EOF
|
|
|
|
#EOF
|
|
|
|
|