From f8b7055d020f2ca7de2105e2330dce3ca775a794 Mon Sep 17 00:00:00 2001 From: djfiander Date: Thu, 31 Aug 2006 23:06:14 +0000 Subject: [PATCH] Log both raw input and raw output messages. Zero-pad the checksum that we transmit. --- Sip.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Sip.pm b/Sip.pm index ea0c9d4..3b826ef 100644 --- a/Sip.pm +++ b/Sip.pm @@ -142,9 +142,12 @@ sub boolspace { # sub read_SIP_packet { my $file = shift; + my $record; local $/ = "\r"; - return readline($file); + $record = readline($file); + syslog("LOG_INFO", "INPUT MSG: '$record'") if $record; + return $record; } # @@ -168,7 +171,7 @@ sub write_msg { } $msg .= 'AZ'; $cksum = checksum($msg); - $msg .= sprintf('%4X', $cksum); + $msg .= sprintf('%04.4X', $cksum); } @@ -176,7 +179,7 @@ sub write_msg { print $file "$msg\r"; } else { print "$msg\r"; - syslog("LOG_DEBUG", "OUTPUT MSG: '$msg'"); + syslog("LOG_INFO", "OUTPUT MSG: '$msg'"); } $last_response = $msg; -- 2.11.0