Skip to content

Commit

Permalink
updated args -s and -o to work properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Rushton committed Oct 23, 2012
1 parent 30e25ce commit 5ae8f8c
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions udplog4jr/udplog4jr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,31 @@
end
$disable_options = false
opts.on( '-o', '--disable-options', 'Remove OPTIONS from being displayed' ) do
puts "Enabling filtering of OPTIONS messages..."
$disable_options = true
end
end
optparse.parse(ARGV)

if ( ($disable_options == true) and ($sipmsg == false) )
puts "ERROR: -o can only be used with -s"
exit
end

if $sipmsg == true
puts "Filtering sipmsg.log files only..."
end
if $disable_options == true
puts "Filtering out all SIP OPTIONS methods..."
end

class PacketHandler < EM::Connection

def receive_data(data)
if /CSeq:.*OPTIONS/i.match(data)
return
end
if $sipmsg
if /sipmsg/.match(data)
if ( $disable_options && /CSeq:.*OPTIONS/i.match(data) )
return
end
puts data
end
else
Expand Down

0 comments on commit 5ae8f8c

Please sign in to comment.