|
|
@ -34,7 +34,7 @@ sub new { |
|
|
|
my %listeners; |
|
|
|
|
|
|
|
foreach my $acct (values %{$cfg->{accounts}}) { |
|
|
|
new Sip::Configuration::Account $acct; |
|
|
|
new Sip::Configuration::Account $acct; |
|
|
|
} |
|
|
|
|
|
|
|
# The key to the listeners hash is the 'port' component of the |
|
|
@ -44,40 +44,39 @@ sub new { |
|
|
|
# find_server() when building the keys to search the hash. |
|
|
|
|
|
|
|
foreach my $service (values %{$cfg->{listeners}}) { |
|
|
|
new Sip::Configuration::Service $service; |
|
|
|
$listeners{lc $service->{port}} = $service; |
|
|
|
new Sip::Configuration::Service $service; |
|
|
|
$listeners{lc $service->{port}} = $service; |
|
|
|
} |
|
|
|
$cfg->{listeners} = \%listeners; |
|
|
|
|
|
|
|
foreach my $inst (values %{$cfg->{institutions}}) { |
|
|
|
new Sip::Configuration::Institution $inst; |
|
|
|
new Sip::Configuration::Institution $inst; |
|
|
|
} |
|
|
|
|
|
|
|
return bless $cfg, $class; |
|
|
|
} |
|
|
|
|
|
|
|
sub error_detect { |
|
|
|
my $self = shift; |
|
|
|
|
|
|
|
return $self->{'error-detect'}; |
|
|
|
} |
|
|
|
|
|
|
|
sub accounts { |
|
|
|
my $self = shift; |
|
|
|
|
|
|
|
return values %{$self->{accounts}}; |
|
|
|
} |
|
|
|
|
|
|
|
# sub policy { |
|
|
|
# my $self = shift; |
|
|
|
# return values %{$self->{policy}}; |
|
|
|
# } |
|
|
|
|
|
|
|
sub find_service { |
|
|
|
my ($self, $sockaddr, $port, $proto) = @_; |
|
|
|
my $portstr; |
|
|
|
|
|
|
|
foreach my $addr ('', '*:', "$sockaddr:") { |
|
|
|
$portstr = sprintf("%s%s/%s", $addr, $port, lc $proto); |
|
|
|
Sys::Syslog::syslog("LOG_DEBUG", "Configuration::find_service: Trying $portstr"); |
|
|
|
last if (exists(($self->{listeners})->{$portstr})); |
|
|
|
} |
|
|
|
|
|
|
|
foreach my $addr ('', '*:', "$sockaddr:") { |
|
|
|
$portstr = sprintf("%s%s/%s", $addr, $port, lc $proto); |
|
|
|
Sys::Syslog::syslog("LOG_DEBUG", "Configuration::find_service: Trying $portstr"); |
|
|
|
last if (exists(($self->{listeners})->{$portstr})); |
|
|
|
} |
|
|
|
return $self->{listeners}->{$portstr}; |
|
|
|
} |
|
|
|
|
|
|
@ -85,7 +84,6 @@ sub find_service { |
|
|
|
# Testing |
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
no warnings qw(once); |
|
|
|
eval join('',<main::DATA>) || die $@ unless caller(); |
|
|
|