Lines 15-21
use C4::SIP::Sip::Constants qw(:all);
Link Here
|
15 |
use C4::SIP::Sip::Configuration; |
15 |
use C4::SIP::Sip::Configuration; |
16 |
use C4::SIP::Sip::Checksum qw(checksum verify_cksum); |
16 |
use C4::SIP::Sip::Checksum qw(checksum verify_cksum); |
17 |
use C4::SIP::Sip::MsgType qw( handle login_core ); |
17 |
use C4::SIP::Sip::MsgType qw( handle login_core ); |
18 |
use C4::SIP::Sip qw( read_SIP_packet ); |
18 |
use C4::SIP::Sip qw( read_SIP_packet get_timeout ); |
19 |
|
19 |
|
20 |
use base qw(Net::Server::PreFork); |
20 |
use base qw(Net::Server::PreFork); |
21 |
|
21 |
|
Lines 128-134
sub raw_transport {
Link Here
|
128 |
my $strikes = 3; |
128 |
my $strikes = 3; |
129 |
|
129 |
|
130 |
local $SIG{ALRM} = sub { die "raw_transport Timed Out!\n"; }; |
130 |
local $SIG{ALRM} = sub { die "raw_transport Timed Out!\n"; }; |
131 |
my $timeout = $service->{timeout} || 30; |
131 |
my $timeout = get_timeout( $self, { transport => 1 } ); |
132 |
syslog("LOG_DEBUG", "raw_transport: timeout is %d", $timeout); |
132 |
syslog("LOG_DEBUG", "raw_transport: timeout is %d", $timeout); |
133 |
|
133 |
|
134 |
while( $strikes && ( !$self->{account} || !$self->{account}->{id} )) { |
134 |
while( $strikes && ( !$self->{account} || !$self->{account}->{id} )) { |
Lines 189-195
sub telnet_transport {
Link Here
|
189 |
my $account = undef; |
189 |
my $account = undef; |
190 |
my $input; |
190 |
my $input; |
191 |
my $config = $self->{config}; |
191 |
my $config = $self->{config}; |
192 |
my $timeout = $self->{service}->{timeout} || $config->{timeout} || 30; |
192 |
my $timeout = get_timeout( $self, { transport => 1 } ); |
193 |
syslog("LOG_DEBUG", "telnet_transport: timeout is %s", $timeout); |
193 |
syslog("LOG_DEBUG", "telnet_transport: timeout is %s", $timeout); |
194 |
|
194 |
|
195 |
eval { |
195 |
eval { |
Lines 251-257
sub sip_protocol_loop {
Link Here
|
251 |
my $self = shift; |
251 |
my $self = shift; |
252 |
my $service = $self->{service}; |
252 |
my $service = $self->{service}; |
253 |
my $config = $self->{config}; |
253 |
my $config = $self->{config}; |
254 |
my $timeout = $self->{service}->{client_timeout} || $config->{client_timeout}; |
254 |
|
|
|
255 |
my $timeout = get_timeout( $self, { client => 1 } ); |
255 |
my $input; |
256 |
my $input; |
256 |
|
257 |
|
257 |
# The spec says the first message will be: |
258 |
# The spec says the first message will be: |
Lines 268-279
sub sip_protocol_loop {
Link Here
|
268 |
# |
269 |
# |
269 |
# In short, we'll take any valid message here. |
270 |
# In short, we'll take any valid message here. |
270 |
#my $expect = SC_STATUS; |
271 |
#my $expect = SC_STATUS; |
271 |
local $SIG{ALRM} = sub { die "SIP Timed Out!\n"; } if $timeout; |
272 |
local $SIG{ALRM} = sub { die "SIP Timed Out!\n"; }; |
272 |
my $expect = ''; |
273 |
my $expect = ''; |
273 |
while (1) { |
274 |
while (1) { |
274 |
if ($timeout) { |
275 |
alarm $timeout; |
275 |
alarm $timeout; |
|
|
276 |
} |
277 |
$input = read_SIP_packet(*STDIN); |
276 |
$input = read_SIP_packet(*STDIN); |
278 |
unless ($input) { |
277 |
unless ($input) { |
279 |
return; # EOF |
278 |
return; # EOF |
Lines 299-307
sub sip_protocol_loop {
Link Here
|
299 |
} |
298 |
} |
300 |
# We successfully received and processed what we were expecting |
299 |
# We successfully received and processed what we were expecting |
301 |
$expect = ''; |
300 |
$expect = ''; |
302 |
if ($timeout ) { |
301 |
alarm 0; |
303 |
alarm 0; |
|
|
304 |
} |
305 |
} |
302 |
} |
306 |
} |
303 |
} |
307 |
|
304 |
|