From f0d1350bbaf8e7fcea7bbddffc5fa5bb3c0eae08 Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Mon, 3 Jul 2017 01:08:17 +0200 Subject: [PATCH] TT#18308 more detailed POST /api/faxes debug msgs Change-Id: I6f5ba0878541cc6cb7694210e2c25e89bc670205 --- lib/NGCP/Panel/Controller/API/Faxes.pm | 3 +++ lib/NGCP/Panel/Utils/Fax.pm | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/lib/NGCP/Panel/Controller/API/Faxes.pm b/lib/NGCP/Panel/Controller/API/Faxes.pm index b4b2ebf9ce..3f33b6ea7a 100644 --- a/lib/NGCP/Panel/Controller/API/Faxes.pm +++ b/lib/NGCP/Panel/Controller/API/Faxes.pm @@ -211,6 +211,7 @@ sub POST :Allow { last unless $self->require_wellformed_json($c, 'application/json', $json_utf8 ); my $resource = JSON::from_json($json_utf8, { utf8 => 0 }); $resource->{faxfile} = $self->get_upload($c, 'faxfile'); + $c->log->debug("upload received"); my $form = $self->get_form($c); last unless $self->validate_form( @@ -219,6 +220,7 @@ sub POST :Allow { form => $form, exceptions => [qw/subscriber_id/], ); + $c->log->debug("form validated"); my $billing_subscriber = NGCP::Panel::Utils::API::Subscribers::get_active_subscriber($self, $c, $resource->{subscriber_id}); unless($billing_subscriber) { $c->log->error("invalid subscriber id $$resource{subscriber_id} for fax send"); @@ -234,6 +236,7 @@ sub POST :Allow { last; } try { + $c->log->debug("contacting fax server"); my $output = NGCP::Panel::Utils::Fax::send_fax( c => $c, subscriber => $billing_subscriber, diff --git a/lib/NGCP/Panel/Utils/Fax.pm b/lib/NGCP/Panel/Utils/Fax.pm index 140a258a03..69fc9403a4 100644 --- a/lib/NGCP/Panel/Utils/Fax.pm +++ b/lib/NGCP/Panel/Utils/Fax.pm @@ -30,10 +30,12 @@ sub send_fax { if ($c->config->{faxserver}{hosts}) { my @hosts = split(/,\s*/, $c->config->{faxserver}{hosts}); my $port = $c->config->{faxserver}{port}; + $c->log->debug("faxserver port $port hosts: " . join(',',@hosts)); my $ping = new Net::Ping('tcp', 1); $ping->port_number($port); do { my $host = $hosts[rand @hosts]; + $c->log->debug("pinging $host:$port"); if ($ping->ping($host)) { $sendfax_args{host} = $host; $sendfax_args{port} = $port; @@ -66,11 +68,14 @@ sub send_fax { $sendfax_args{files} = []; if($args{upload}){ push @{$sendfax_args{files}}, eval { $args{upload}->tempname }; + $c->log->debug('error to retrieve tempfile of upload: ' . @_) if @_; } if($args{data}){ $sendfax_args{input} = [\$args{data}]; } my $client = new NGCP::Fax; + use Data::Dumper; + $c->log->debug('invoke send_fax with args: ' . Dumper(\%sendfax_args)); $client->send_fax(\%sendfax_args); $c->log->debug("webfax: res=$res;"); }