@@ -, +, @@ raw_transport Wait until it times out (probably the default 60 seconds). Restart SIP and start another telnet 6001 session. Did it timeout within 5 seconds? login attempts. Does the connection close? --- C4/SIP/SIPServer.pm | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) --- a/C4/SIP/SIPServer.pm +++ a/C4/SIP/SIPServer.pm @@ -124,20 +124,34 @@ sub process_request { sub raw_transport { my $self = shift; - my ($input); my $service = $self->{service}; + my $strikes = 3; - while (!$self->{account}) { - local $SIG{ALRM} = sub { die "raw_transport Timed Out!\n"; }; - syslog("LOG_DEBUG", "raw_transport: timeout is %d", $service->{timeout}); - $input = read_SIP_packet(*STDIN); + local $SIG{ALRM} = sub { die "raw_transport Timed Out!\n"; }; + my $timeout = $service->{timeout} || 30; + syslog("LOG_DEBUG", "raw_transport: timeout is %d", $timeout); + + while( $strikes && ( !$self->{account} || !$self->{account}->{id} )) { + # an empty account hash is not good enough.. + alarm $timeout; + my $input = read_SIP_packet(*STDIN); if (!$input) { # EOF on the socket syslog("LOG_INFO", "raw_transport: shutting down: EOF during login"); return; } $input =~ s/[\r\n]+$//sm; # Strip off trailing line terminator(s) - last if C4::SIP::Sip::MsgType::handle($input, $self, LOGIN); + my $login_req = LOGIN; + if( $input =~ /^$login_req/ ) { + # In this loop we are only responding to login attempts + C4::SIP::Sip::MsgType::handle($input, $self, LOGIN); + } + $strikes--; + } + alarm 0; + if( !$self->{account}->{id} ) { + syslog("LOG_ERR", "raw_transport: Login Failed"); + die "Login Failure"; } syslog("LOG_DEBUG", "raw_transport: uname/inst: '%s/%s'", --