View | Details | Raw Unified | Return to bug 7619
Collapse All | Expand All

(-)a/C4/SIP/Sip.pm (-4 / +13 lines)
Lines 8-13 use strict; Link Here
8
use warnings;
8
use warnings;
9
use English;
9
use English;
10
use Exporter;
10
use Exporter;
11
use Readonly;
11
12
12
use Sys::Syslog qw(syslog);
13
use Sys::Syslog qw(syslog);
13
use POSIX qw(strftime);
14
use POSIX qw(strftime);
Lines 38-44 BEGIN { Link Here
38
39
39
our $error_detection = 0;
40
our $error_detection = 0;
40
our $protocol_version = 1;
41
our $protocol_version = 1;
41
our $field_delimiter = '|'; 	# Protocol Default
42
our $field_delimiter = '|'; # Protocol Default
43
# The message terminator for a SIP message is '\r' in the standard doc
44
# However most sip devices in the wild send a CR LF pair
45
# This is required by Telnet if that is your carrier mechanism
46
# On raw connections it may also be required because the buffer is
47
# only flushed on linefeed and its absence causes enough delay for
48
# client machines to go into an error state
49
# The below works for almost all machines if however you have one
50
# which does not like the additional linefeed change value to $CR
51
Readonly my $msg_terminator => $CRLF;
42
52
43
# We need to keep a copy of the last message we sent to the SC,
53
# We need to keep a copy of the last message we sent to the SC,
44
# in case there's a transmission error and the SC sends us a
54
# in case there's a transmission error and the SC sends us a
Lines 234-243 sub write_msg { Link Here
234
244
235
    if ($file) {
245
    if ($file) {
236
        $file->autoflush(1);
246
        $file->autoflush(1);
237
        print $file "$msg\r";
247
        print $file $msg, $msg_terminator;
238
    } else {
248
    } else {
239
        STDOUT->autoflush(1);
249
        STDOUT->autoflush(1);
240
        print $msg, "\r";
250
        print $msg, $msg_terminator;
241
        syslog("LOG_INFO", "OUTPUT MSG: '$msg'");
251
        syslog("LOG_INFO", "OUTPUT MSG: '$msg'");
242
    }
252
    }
243
253
244
- 

Return to bug 7619