MT#4019 Implement C2D in api via /api/callcontrols

gjungwirth/voicemail_number
Andreas Granig 11 years ago
parent ed613638ea
commit 2f06618362

@ -0,0 +1,140 @@
package NGCP::Panel::Controller::API::CallControls;
use Sipwise::Base;
use namespace::sweep;
use boolean qw(true);
use Data::HAL qw();
use Data::HAL::Link qw();
use HTTP::Headers qw();
use HTTP::Status qw(:constants);
use MooseX::ClassAttribute qw(class_has);
use NGCP::Panel::Utils::DateTime;
use Path::Tiny qw(path);
use Safe::Isa qw($_isa);
use NGCP::Panel::Utils::Sems;
BEGIN { extends 'Catalyst::Controller::ActionRole'; }
require Catalyst::ActionRole::ACL;
require Catalyst::ActionRole::CheckTrailingSlash;
require Catalyst::ActionRole::HTTPMethods;
require Catalyst::ActionRole::RequireSSL;
class_has 'api_description' => (
is => 'ro',
isa => 'Str',
default =>
'Allows to place calls via the API.',
);
class_has 'query_params' => (
is => 'ro',
isa => 'ArrayRef',
default => sub {[
]},
);
with 'NGCP::Panel::Role::API::CallControls';
class_has('resource_name', is => 'ro', default => 'callcontrols');
class_has('dispatch_path', is => 'ro', default => '/api/callcontrols/');
class_has('relation', is => 'ro', default => 'http://purl.org/sipwise/ngcp-api/#rel-callcontrols');
__PACKAGE__->config(
action => {
map { $_ => {
ACLDetachTo => '/api/root/invalid_user',
AllowedRole => [qw/admin reseller/],
Args => 0,
Does => [qw(ACL CheckTrailingSlash RequireSSL)],
Method => $_,
Path => __PACKAGE__->dispatch_path,
} } @{ __PACKAGE__->allowed_methods }
},
action_roles => [qw(HTTPMethods)],
);
sub auto :Private {
my ($self, $c) = @_;
$self->set_body($c);
$self->log_request($c);
}
sub OPTIONS :Allow {
my ($self, $c) = @_;
my $allowed_methods = $self->allowed_methods;
$c->response->headers(HTTP::Headers->new(
Allow => $allowed_methods->join(', '),
Accept_Post => 'application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-'.$self->resource_name,
));
$c->response->content_type('application/json');
$c->response->body(JSON::to_json({ methods => $allowed_methods })."\n");
return;
}
sub POST :Allow {
my ($self, $c) = @_;
my $guard = $c->model('DB')->txn_scope_guard;
{
my $resource = $self->get_valid_post_data(
c => $c,
media_type => 'application/json',
);
last unless $resource;
my $form = $self->get_form($c);
last unless $self->validate_form(
c => $c,
resource => $resource,
form => $form,
exceptions => [qw/subscriber_id/],
);
# TODO: fetch subscriber by id
my $subscriber_rs = $c->model('DB')->resultset('voip_subscribers')->search({
id => $resource->{subscriber_id},
status => { '!=' => 'terminated' },
});
if($c->user->roles eq "admin") {
} elsif($c->user->roles eq "reseller") {
$subscriber_rs = $subscriber_rs->search({
'contact.reseller_id' => $c->user->reseller_id,
},{
join => { contract => 'contact' },
});
}
my $subscriber = $subscriber_rs->first;
unless($subscriber) {
$c->log->error("invalid subscriber id $$resource{subscriber_id} for outbound call");
$self->error($c, HTTP_NOT_FOUND, "Calling subscriber not found.");
last;
}
my ($callee_user, $callee_domain) = split /\@/, $resource->{destination};
$callee_domain //= $subscriber->domain->domain;
try {
NGCP::Panel::Utils::Sems::dial_out($c, $subscriber->provisioning_voip_subscriber,
$callee_user, $callee_domain);
} catch($e) {
$c->log->error("failed to dial out: $e");
$self->error($c, HTTP_INTERNAL_SERVER_ERROR, "Failed to create call.");
last;
}
$guard->commit;
$c->response->status(HTTP_OK);
$c->response->body(q());
}
return;
}
sub end : Private {
my ($self, $c) = @_;
$self->log_response($c);
}
# vim: set tabstop=4 expandtab:

@ -144,7 +144,7 @@ sub create :Chained('dom_list') :PathPart('create') :Args() {
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/domain'));
}
$self->_sip_domain_reload;
$self->_sip_domain_reload($c);
$c->flash(messages => [{type => 'success', text => $c->loc('Domain successfully created') }]);
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/domain'));
}
@ -213,7 +213,7 @@ sub edit :Chained('base') :PathPart('edit') :Args(0) {
return;
}
$self->_sip_domain_reload;
$self->_sip_domain_reload($c);
$c->flash(messages => [{type => 'success', text => $c->loc('Domain successfully updated') }]);
$c->response->redirect($c->uri_for());
@ -246,7 +246,7 @@ sub delete :Chained('base') :PathPart('delete') :Args(0) {
return;
}
$self->_sip_domain_reload;
$self->_sip_domain_reload($c);
$c->flash(messages => [{type => 'success', text => $c->loc('Domain successfully deleted!') }]);
$c->response->redirect($c->uri_for());
@ -370,7 +370,7 @@ sub load_preference_list :Private {
}
sub _sip_domain_reload {
my ($self) = @_;
my ($self, $c) = @_;
my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new;
$dispatcher->dispatch("proxy-ng", 1, 1, <<EOF );
<?xml version="1.0" ?>

@ -117,7 +117,7 @@ sub edit :Chained('base') :PathPart('edit') {
if($posted && $form->validated) {
try {
$c->stash->{group_result}->update($form->custom_get_values);
$self->_sip_lcr_reload;
$self->_sip_lcr_reload($c);
delete $c->session->{created_objects}->{contract};
$c->flash(messages => [{type => 'success', text => $c->loc('Peering group successfully updated')}]);
} catch ($e) {
@ -144,7 +144,7 @@ sub delete :Chained('base') :PathPart('delete') {
$p->delete;
}
$c->stash->{group_result}->delete;
$self->_sip_lcr_reload;
$self->_sip_lcr_reload($c);
$c->flash(messages => [{type => 'success', text => $c->loc('Peering Group successfully deleted') }]);
} catch ($e) {
NGCP::Panel::Utils::Message->error(
@ -178,7 +178,7 @@ sub create :Chained('group_list') :PathPart('create') :Args(0) {
try {
$c->model('DB')->resultset('voip_peer_groups')->create(
$formdata );
$self->_sip_lcr_reload;
$self->_sip_lcr_reload($c);
delete $c->session->{created_objects}->{contract};
$c->flash(messages => [{type => 'success', text => $c->loc('Peering group successfully created') }]);
} catch ($e) {
@ -232,7 +232,7 @@ sub servers_create :Chained('servers_list') :PathPart('create') :Args(0) {
if($posted && $form->validated) {
try {
$c->stash->{group_result}->voip_peer_hosts->create($form->values);
$self->_sip_lcr_reload;
$self->_sip_lcr_reload($c);
$c->flash(messages => [{type => 'success', text => $c->loc('Peering server successfully created') }]);
} catch($e) {
NGCP::Panel::Utils::Message->error(
@ -299,7 +299,7 @@ sub servers_edit :Chained('servers_base') :PathPart('edit') :Args(0) {
if($posted && $form->validated) {
try {
$c->stash->{server_result}->update($form->values);
$self->_sip_lcr_reload;
$self->_sip_lcr_reload($c);
$c->flash(messages => [{type => 'success', text => $c->loc('Peering server successfully updated') }]);
} catch ($e) {
NGCP::Panel::Utils::Message->error(
@ -323,7 +323,7 @@ sub servers_delete :Chained('servers_base') :PathPart('delete') :Args(0) {
try {
$c->stash->{server_result}->delete;
$self->_sip_lcr_reload;
$self->_sip_lcr_reload($c);
$c->flash(messages => [{type => 'success', text => $c->loc('Peering server successfully deleted') }]);
} catch ($e) {
NGCP::Panel::Utils::Message->error(
@ -451,7 +451,7 @@ sub rules_create :Chained('rules_list') :PathPart('create') :Args(0) {
try {
$form->values->{callee_prefix} //= '';
$c->stash->{group_result}->voip_peer_rules->create($form->values);
$self->_sip_lcr_reload;
$self->_sip_lcr_reload($c);
$c->flash(rules_messages => [{type => 'success', text => $c->loc('Peering rule successfully created') }]);
} catch ($e) {
NGCP::Panel::Utils::Message->error(
@ -519,7 +519,7 @@ sub rules_edit :Chained('rules_base') :PathPart('edit') :Args(0) {
try {
$form->values->{callee_prefix} //= '';
$c->stash->{rule_result}->update($form->values);
$self->_sip_lcr_reload;
$self->_sip_lcr_reload($c);
$c->flash(rules_messages => [{type => 'success', text => $c->loc('Peering rule successfully changed') }]);
} catch ($e) {
NGCP::Panel::Utils::Message->error(
@ -543,7 +543,7 @@ sub rules_delete :Chained('rules_base') :PathPart('delete') :Args(0) {
try {
$c->stash->{rule_result}->delete;
$self->_sip_lcr_reload;
$self->_sip_lcr_reload($c);
$c->flash(rules_messages => [{type => 'success', text => $c->loc('Peering rule successfully deleted') }]);
} catch ($e) {
NGCP::Panel::Utils::Message->error(
@ -556,9 +556,9 @@ sub rules_delete :Chained('rules_base') :PathPart('delete') :Args(0) {
}
sub _sip_lcr_reload {
my ($self) = @_;
my ($self, $c) = @_;
my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new;
$dispatcher->dispatch("proxy-ng", 1, 1, <<EOF );
$dispatcher->dispatch($c, "proxy-ng", 1, 1, <<EOF );
<?xml version="1.0" ?>
<methodCall>
<methodName>lcr.reload</methodName>

@ -384,7 +384,7 @@ sub rules_edit :Chained('rules_base') :PathPart('edit') {
if($posted && $form->validated) {
try {
$c->stash->{rule_result}->update($form->values);
$self->_sip_dialplan_reload();
$self->_sip_dialplan_reload($c);
$c->flash(messages => [{type => 'success', text => $c->loc('Rewrite rule successfully updated')}]);
} catch($e) {
NGCP::Panel::Utils::Message->error(
@ -405,7 +405,7 @@ sub rules_delete :Chained('rules_base') :PathPart('delete') {
try {
$c->stash->{rule_result}->delete;
$self->_sip_dialplan_reload();
$self->_sip_dialplan_reload($c);
$c->flash(messages => [{type => 'success', text => $c->loc('Rewrite rule successfully deleted') }]);
} catch($e) {
NGCP::Panel::Utils::Message->error(
@ -437,7 +437,7 @@ sub rules_create :Chained('rules_list') :PathPart('create') :Args(0) {
my $last_priority = $c->stash->{rules_rs}->get_column('priority')->max() || 49;
$form->values->{priority} = int($last_priority) + 1;
$c->stash->{rules_rs}->create($form->values);
$self->_sip_dialplan_reload();
$self->_sip_dialplan_reload($c);
$c->flash(messages => [{type => 'success', text => $c->loc('Rewrite rule successfully created') }]);
} catch($e) {
NGCP::Panel::Utils::Message->error(
@ -454,9 +454,9 @@ sub rules_create :Chained('rules_list') :PathPart('create') :Args(0) {
}
sub _sip_dialplan_reload {
my ($self) = @_;
my ($self, $c) = @_;
my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new;
$dispatcher->dispatch("proxy-ng", 1, 1, <<EOF );
$dispatcher->dispatch($c, "proxy-ng", 1, 1, <<EOF );
<?xml version="1.0" ?>
<methodCall>
<methodName>dialplan.reload</methodName>

@ -34,7 +34,7 @@ sub index :Chained('/') :PathPart('security') :Args(0) {
</methodCall>
EOF
my $ip_res = $dispatcher->dispatch("loadbalancer", 1, 1, $ip_xml);
my $ip_res = $dispatcher->dispatch($c, "loadbalancer", 1, 1, $ip_xml);
my @ips = ();
for my $host (grep {$$_[1]} @$ip_res) {
@ -70,7 +70,7 @@ EOF
</methodCall>
EOF
my $user_res = $dispatcher->dispatch("loadbalancer", 1, 1, $user_xml);
my $user_res = $dispatcher->dispatch($c, "loadbalancer", 1, 1, $user_xml);
my @users = ();
my $usr = {};
for my $host (grep {$$_[1]} @$user_res) {
@ -140,7 +140,7 @@ sub ip_unban :Chained('ip_base') :PathPart('unban') :Args(0) {
</methodCall>
EOF
$dispatcher->dispatch("loadbalancer", 1, 1, $xml);
$dispatcher->dispatch($c, "loadbalancer", 1, 1, $xml);
$c->flash(messages => [{type => 'success', text => $c->loc('IP successfully unbanned')}]);
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/security'));
@ -170,7 +170,7 @@ sub user_unban :Chained('user_base') :PathPart('unban') :Args(0) {
</methodCall>
EOF
$dispatcher->dispatch("loadbalancer", 1, 1, $xml);
$dispatcher->dispatch($c, "loadbalancer", 1, 1, $xml);
}
$c->flash(messages => [{type => 'success', text => $c->loc('User successfully unbanned')}]);

@ -569,7 +569,7 @@ sub handles_edit :Chained('handles_base') :PathPart('edit') {
given($file_result->handle->group->name) {
when([qw/calling_card/]) {
try {
NGCP::Panel::Utils::Sems::clear_audio_cache("appserver", $file_result->set_id, $file_result->handle->name);
NGCP::Panel::Utils::Sems::clear_audio_cache($c, "appserver", $file_result->set_id, $file_result->handle->name);
} catch ($e) {
NGCP::Panel::Utils::Message->error(
c => $c,
@ -584,10 +584,10 @@ sub handles_edit :Chained('handles_base') :PathPart('edit') {
try {
if(!$file_result->set->contract_id) {
$service = "appserver";
NGCP::Panel::Utils::Sems::clear_audio_cache($service, $file_result->set_id, $file_result->handle->name);
NGCP::Panel::Utils::Sems::clear_audio_cache($c, $service, $file_result->set_id, $file_result->handle->name);
} else {
$service = "pbx";
NGCP::Panel::Utils::Sems::clear_audio_cache($service, $file_result->set_id, $file_result->handle->name);
NGCP::Panel::Utils::Sems::clear_audio_cache($c, $service, $file_result->set_id, $file_result->handle->name);
}
} catch ($e) {
NGCP::Panel::Utils::Message->error(

@ -0,0 +1,43 @@
package NGCP::Panel::Form::CallControl::CallAPI;
use HTML::FormHandler::Moose;
extends 'HTML::FormHandler';
use Moose::Util::TypeConstraints;
use HTML::FormHandler::Widget::Block::Bootstrap;
has '+widget_wrapper' => ( default => 'Bootstrap' );
has_field 'submitid' => ( type => 'Hidden' );
sub build_render_list {[qw/submitid fields actions/]}
sub build_form_element_class {[qw(form-horizontal)]}
has_field 'subscriber_id' => (
type => 'PosInteger',
label => 'Subscriber #',
required => 1,
maxlength => 255,
element_attr => {
rel => ['tooltip'],
title => ['The ID of the calling subscriber']
},
);
has_field 'destination' => (
type => 'Text',
label => 'Destination URI, user or number',
required => 1,
element_attr => {
rel => ['tooltip'],
title => ['The destination URI, user or number as dialed by the end user']
},
);
has_block 'fields' => (
tag => 'div',
class => [qw/modal-body/],
render_list => [qw/subscriber_id destination/],
);
1;
# vim: set tabstop=4 expandtab:

@ -481,6 +481,7 @@ sub item_rs {}
around 'item_rs' => sub {
my ($orig, $self, @orig_params) = @_;
my $item_rs = $self->$orig(@orig_params);
return unless($item_rs);
# no query params defined in collection controller
unless($self->can('query_params') && @{ $self->query_params }) {

@ -0,0 +1,26 @@
package NGCP::Panel::Role::API::CallControls;
use Moose::Role;
use Sipwise::Base;
with 'NGCP::Panel::Role::API' => {
-alias =>{ item_rs => '_item_rs', },
-excludes => [ 'item_rs' ],
};
use boolean qw(true);
use TryCatch;
use Data::HAL qw();
use Data::HAL::Link qw();
use HTTP::Status qw(:constants);
use NGCP::Panel::Form::CallControl::CallAPI;
sub item_rs {
}
sub get_form {
my ($self, $c) = @_;
return NGCP::Panel::Form::CallControl::CallAPI->new;
}
1;
# vim: set tabstop=4 expandtab:

@ -130,7 +130,7 @@ sub item_by_id {
sub sip_domain_reload {
my ($self, $c) = @_;
my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new;
$dispatcher->dispatch("proxy-ng", 1, 1, <<EOF );
$dispatcher->dispatch($c, "proxy-ng", 1, 1, <<EOF );
<?xml version="1.0" ?>
<methodCall>
<methodName>domain.reload</methodName>

@ -10,7 +10,7 @@ sub delete_location_contact {
my $aor = $prov_subscriber->username . '@' . $prov_subscriber->domain->domain;
my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new;
my $ret = $dispatcher->dispatch("proxy-ng", 1, 1, <<EOF );
my $ret = $dispatcher->dispatch($c, "proxy-ng", 1, 1, <<EOF );
<?xml version="1.0" ?>
<methodCall>
<methodName>ul.rm_contact</methodName>
@ -29,7 +29,7 @@ sub delete_location {
my $aor = $prov_subscriber->username . '@' . $prov_subscriber->domain->domain;
my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new;
my $ret = $dispatcher->dispatch("proxy-ng", 1, 1, <<EOF );
my $ret = $dispatcher->dispatch($c, "proxy-ng", 1, 1, <<EOF );
<?xml version="1.0" ?>
<methodCall>
<methodName>ul.rm</methodName>
@ -55,7 +55,7 @@ sub create_location {
$flags //= 0;
$cflags //= 0;
my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new;
my $ret = $dispatcher->dispatch("proxy-ng", 1, 1, <<EOF );
my $ret = $dispatcher->dispatch($c, "proxy-ng", 1, 1, <<EOF );
<?xml version="1.0" ?>
<methodCall>
<methodName>ul.add</methodName>

@ -20,7 +20,7 @@ sub create_peer_registration {
my $uuid = $prov_subscriber->uuid;
my $contact = $c->config->{sip}->{lb_ext};
my @ret = $dispatcher->dispatch("appserver", 1, 1, <<EOF);
my @ret = $dispatcher->dispatch($c, "appserver", 1, 1, <<EOF);
<?xml version="1.0"?>
<methodCall>
<methodName>db_reg_agent.createRegistration</methodName>
@ -39,7 +39,7 @@ EOF
# remove reg from successsful backends
foreach my $ret (grep {!$$_[1]} @ret) { # successful backends
$dispatcher->dispatch($$ret[0], 1, 1, <<EOF);
$dispatcher->dispatch($c, $$ret[0], 1, 1, <<EOF);
<?xml version="1.0"?>
<methodCall>
<methodName>db_reg_agent.removeRegistration</methodName>
@ -78,7 +78,7 @@ sub update_peer_registration {
$c->log->debug("+++++++++++++++++++ uuid=$uuid");
$c->log->debug("+++++++++++++++++++ contact=$contact");
my @ret = $dispatcher->dispatch("appserver", 1, 1, <<EOF);
my @ret = $dispatcher->dispatch($c, "appserver", 1, 1, <<EOF);
<?xml version="1.0"?>
<methodCall>
<methodName>db_reg_agent.updateRegistration</methodName>
@ -97,7 +97,7 @@ EOF
# undo update on successsful backends
foreach my $ret (grep {!$$_[1]} @ret) { # successful backends
$dispatcher->dispatch($$ret[0], 1, 1, <<EOF);
$dispatcher->dispatch($c, $$ret[0], 1, 1, <<EOF);
<?xml version="1.0"?>
<methodCall>
<methodName>db_reg_agent.updateRegistration</methodName>
@ -133,7 +133,7 @@ sub delete_peer_registration {
my $uuid = $prov_subscriber->uuid;
my $contact = $c->config->{sip}->{lb_ext};
my @ret = $dispatcher->dispatch("appserver", 1, 1, <<EOF);
my @ret = $dispatcher->dispatch($c, "appserver", 1, 1, <<EOF);
<?xml version="1.0"?>
<methodCall>
<methodName>db_reg_agent.removeRegistration</methodName>
@ -148,7 +148,7 @@ EOF
# remove reg from successsful backends
foreach my $ret (grep {!$$_[1]} @ret) { # successful backends
$dispatcher->dispatch($ret[0], 1, 1, <<EOF);
$dispatcher->dispatch($c, $ret[0], 1, 1, <<EOF);
<?xml version="1.0"?>
<methodCall>
<methodName>db_reg_agent.createRegistration</methodName>
@ -170,11 +170,11 @@ EOF
}
sub clear_audio_cache {
my ($service, $sound_set_id, $handle_name) = @_;
my ($c, $service, $sound_set_id, $handle_name) = @_;
my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new;
my @ret = $dispatcher->dispatch($service, 1, 1, <<EOF );
my @ret = $dispatcher->dispatch($c, $service, 1, 1, <<EOF );
<?xml version="1.0"?>
<methodCall>
<methodName>postDSMEvent</methodName>
@ -209,6 +209,54 @@ EOF
return 1;
}
sub dial_out {
my ($c, $prov_subscriber, $callee_user, $callee_domain) = @_;
# TODO: what about announcement
my $announcement = 'test.wav';
my $proxy_rs = $c->model('DB')->resultset('xmlhosts')->search({
'group.name' => 'proxy',
},{
join => { xmlhostgroups => 'group' },
order_by => \'rand()',
});
my $proxy = $proxy_rs->first;
unless($proxy) {
die "failed to fetch proxy for dial-out, none available";
}
my $proxyuri = $proxy->ip . ':' . $proxy->sip_port;
my $caller_username = $prov_subscriber->username;
my $caller_domain = $prov_subscriber->domain->domain;
my $caller_password = $prov_subscriber->password;
my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new;
my $ret = $dispatcher->dispatch($c, "appserver", 0, 1, <<EOF );
<?xml version="1.0"?>
<methodCall>
<methodName>dial_auth_b2b</methodName>
<params>
<param><value><string>click2dial</string></value></param>
<param><value><string>$announcement</string></value></param>
<param><value><string>sip:$caller_username\@$caller_domain</string></value></param>
<param><value><string>sip:$callee_user\@$callee_domain</string></value></param>
<param><value><string>sip:$caller_username\@$proxyuri;sw_domain=$caller_domain</string></value></param>
<param><value><string>sip:$callee_user\@$proxyuri;sw_domain=$callee_domain</string></value></param>
<param><value><string>$caller_domain</string></value></param>
<param><value><string>$caller_username</string></value></param>
<param><value><string>$caller_password</string></value></param>
</params>
</methodCall>
EOF
use Data::Dumper;
$c->log->info("received from dispatcher: " . Dumper $ret);
if(!$ret or $ret->[1] != 1 or $ret->[2] =~ m#<name>faultString</name>#) {
die "failed to trigger dial-out";
}
return 1;
}
1;
# vim: set tabstop=4 expandtab:

@ -12,7 +12,7 @@ has 'schema' => (
);
sub dispatch {
my ($self, $target, $all, $sync, $body) = @_;
my ($self, $c, $target, $all, $sync, $body) = @_;
my $schema = $self->schema;
@ -33,7 +33,7 @@ sub dispatch {
for my $host (@$hosts) {
my ($meth, $ip, $port, $path, $hostid) = ("http", $host->{ip}, $host->{port}, $host->{path}, $host->{id});
Log::Log4perl->get_logger($self)->info("dispatching xmlrpc $target request to ".$ip.":".$port.$path);
$c->log->info("dispatching xmlrpc $target request to ".$ip.":".$port.$path);
my $ret = eval { # catch exceptions
my $s = Net::HTTP->new(Host => $ip, KeepAlive => 0, PeerPort => $port || 80, Timeout => 5);
@ -72,7 +72,7 @@ sub dispatch {
# failure
Log::Log4perl->get_logger($self)->info("failure: $@");
$c->log->info("failure: $@");
$all or next;

Loading…
Cancel
Save