|
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 193-199
sub telnet_transport {
Link Here
|
| 193 |
my $account = undef; |
193 |
my $account = undef; |
| 194 |
my $input; |
194 |
my $input; |
| 195 |
my $config = $self->{config}; |
195 |
my $config = $self->{config}; |
| 196 |
my $timeout = $self->{service}->{timeout} || $config->{timeout} || 30; |
196 |
my $timeout = get_timeout( $self, { transport => 1 } ); |
| 197 |
syslog("LOG_DEBUG", "telnet_transport: timeout is %s", $timeout); |
197 |
syslog("LOG_DEBUG", "telnet_transport: timeout is %s", $timeout); |
| 198 |
|
198 |
|
| 199 |
eval { |
199 |
eval { |
|
Lines 255-261
sub sip_protocol_loop {
Link Here
|
| 255 |
my $self = shift; |
255 |
my $self = shift; |
| 256 |
my $service = $self->{service}; |
256 |
my $service = $self->{service}; |
| 257 |
my $config = $self->{config}; |
257 |
my $config = $self->{config}; |
| 258 |
my $timeout = $self->{service}->{client_timeout} || $config->{client_timeout}; |
258 |
|
|
|
259 |
my $timeout = get_timeout( $self, { client => 1 } ); |
| 259 |
my $input; |
260 |
my $input; |
| 260 |
|
261 |
|
| 261 |
# The spec says the first message will be: |
262 |
# The spec says the first message will be: |
|
Lines 272-283
sub sip_protocol_loop {
Link Here
|
| 272 |
# |
273 |
# |
| 273 |
# In short, we'll take any valid message here. |
274 |
# In short, we'll take any valid message here. |
| 274 |
#my $expect = SC_STATUS; |
275 |
#my $expect = SC_STATUS; |
| 275 |
local $SIG{ALRM} = sub { die "SIP Timed Out!\n"; } if $timeout; |
276 |
local $SIG{ALRM} = sub { die "SIP Timed Out!\n"; }; |
| 276 |
my $expect = ''; |
277 |
my $expect = ''; |
| 277 |
while (1) { |
278 |
while (1) { |
| 278 |
if ($timeout) { |
279 |
alarm $timeout; |
| 279 |
alarm $timeout; |
|
|
| 280 |
} |
| 281 |
$input = read_SIP_packet(*STDIN); |
280 |
$input = read_SIP_packet(*STDIN); |
| 282 |
unless ($input) { |
281 |
unless ($input) { |
| 283 |
return; # EOF |
282 |
return; # EOF |
|
Lines 303-311
sub sip_protocol_loop {
Link Here
|
| 303 |
} |
302 |
} |
| 304 |
# We successfully received and processed what we were expecting |
303 |
# We successfully received and processed what we were expecting |
| 305 |
$expect = ''; |
304 |
$expect = ''; |
| 306 |
if ($timeout ) { |
305 |
alarm 0; |
| 307 |
alarm 0; |
|
|
| 308 |
} |
| 309 |
} |
306 |
} |
| 310 |
} |
307 |
} |
| 311 |
|
308 |
|