From 28a85b75539e52c33a1c8e12af6789627829de79 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Fri, 20 Nov 2015 12:12:48 +0000 Subject: [PATCH] Bug 15006 Sip separate global from login timeouts Content-Type: text/plain; charset=utf-8 Timeout logic has been added to the main sip loop However the timeout parameter was initially for the login process which requires a short duration applying such a brief timeout to the main sip loop causes instability in many selfcheck units Most selfchecks have persistent connections and send a periodic status request at intervals (approx every 5mins appears the norm) The timeout was dropping connections by default every 30secs which for the client appears as a very flakey network This patch adds a separate parameter client_timeout that can be used if you do want to force a disconnect if the client sends no requests for a period. By not defining it you can switch off the timeout in the main loop, I recommend this unless you have a good reason not too. If you do want this behaviour you can at least now set it to a more realistic value (see sample config file) Removed the commented out html entry in the config file, this was dead code born of a misconception and was just a source of confusion for users Signed-off-by: Frederic Demians Signed-off-by: Jonathan Druart Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- C4/SIP/SIPServer.pm | 9 +++++---- etc/SIPconfig.xml | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/C4/SIP/SIPServer.pm b/C4/SIP/SIPServer.pm index aff49e5..e496683 100755 --- a/C4/SIP/SIPServer.pm +++ b/C4/SIP/SIPServer.pm @@ -243,7 +243,7 @@ sub sip_protocol_loop { my $self = shift; my $service = $self->{service}; my $config = $self->{config}; - my $timeout = $self->{service}->{timeout} || $config->{timeout} || 30; + my $timeout = $self->{service}->{client_timeout} || $config->{client_timeout}; # The spec says the first message will be: # SIP v1: SC_STATUS @@ -263,13 +263,14 @@ sub sip_protocol_loop { syslog( 'LOG_DEBUG', 'Inactive: timed out' ); die "Timed Out!\n"; }; - my $previous_alarm = alarm($timeout); + my $previous_alarm; + $previous_alarm = alarm($timeout) if $timeout; while ( my $inputbuf = read_request() ) { if ( !defined $inputbuf ) { return; #EOF } - alarm($timeout); + alarm($timeout) if $timeout; unless ($inputbuf) { syslog( "LOG_ERR", "sip_protocol_loop: empty input skipped" ); @@ -287,7 +288,7 @@ sub sip_protocol_loop { } next if $status eq REQUEST_ACS_RESEND; } - alarm($previous_alarm); + alarm($previous_alarm) if $previous_alarm; return; }; if ( $@ =~ m/timed out/i ) { diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml index fc7635e..8bd69f1 100644 --- a/etc/SIPconfig.xml +++ b/etc/SIPconfig.xml @@ -16,12 +16,6 @@ /> - + + -- 1.7.10.4