diff --git a/lib/NGCP/Panel/Controller/API/VoicemailRecordingsItem.pm b/lib/NGCP/Panel/Controller/API/VoicemailRecordingsItem.pm index e5fdbf1993..ce06b49f3b 100644 --- a/lib/NGCP/Panel/Controller/API/VoicemailRecordingsItem.pm +++ b/lib/NGCP/Panel/Controller/API/VoicemailRecordingsItem.pm @@ -7,6 +7,7 @@ use HTTP::Headers qw(); use HTTP::Status qw(:constants); use NGCP::Panel::Utils::ValidateJSON qw(); +use NGCP::Panel::Utils::Subscriber; require Catalyst::ActionRole::ACL; require NGCP::Panel::Role::HTTPMethods; require Catalyst::ActionRole::RequireSSL; @@ -60,8 +61,8 @@ sub GET :Allow { last unless $self->valid_id($c, $id); my $item = $self->item_by_id($c, $id); last unless $self->resource_exists($c, voicemailrecording => $item); - - $c->response->header ('Content-Disposition' => 'attachment; filename="' . $self->resource_name . '-' . $item->id . '.wav"'); + my $filename = NGCP::Panel::Utils::Subscriber::get_voicemail_filename($c,$item); + $c->response->header ('Content-Disposition' => 'attachment; filename="'.$filename.'"'); $c->response->content_type('audio/x-wav'); $c->response->body($item->recording); return; diff --git a/lib/NGCP/Panel/Controller/Subscriber.pm b/lib/NGCP/Panel/Controller/Subscriber.pm index 673e038a1c..e7503377fa 100644 --- a/lib/NGCP/Panel/Controller/Subscriber.pm +++ b/lib/NGCP/Panel/Controller/Subscriber.pm @@ -3726,8 +3726,8 @@ sub play_voicemail :Chained('voicemail') :PathPart('play') :Args(0) { NGCP::Panel::Utils::Subscriber::mark_voicemail_read( 'c' => $c, 'voicemail' => $c->stash->{voicemail} ); NGCP::Panel::Utils::Subscriber::vmnotify( 'c' => $c, 'voicemail' => $c->stash->{voicemail} ); - - $c->response->header('Content-Disposition' => 'attachment; filename="'.$file->msgnum.'.wav"'); + my $filename = NGCP::Panel::Utils::Subscriber::get_voicemail_filename($c,$file); + $c->response->header('Content-Disposition' => 'attachment; filename="'.$filename.'"'); $c->response->content_type('audio/x-wav'); $c->response->body($data); } diff --git a/lib/NGCP/Panel/Role/API/Conversations.pm b/lib/NGCP/Panel/Role/API/Conversations.pm index 7a7791075d..6e4f74b32e 100644 --- a/lib/NGCP/Panel/Role/API/Conversations.pm +++ b/lib/NGCP/Panel/Role/API/Conversations.pm @@ -7,6 +7,7 @@ use NGCP::Panel::Utils::Generic qw(:all); use NGCP::Panel::Utils::CallList qw(); use NGCP::Panel::Utils::API::Calllist qw(); use NGCP::Panel::Utils::Fax; +use NGCP::Panel::Utils::Subscriber; use NGCP::Panel::Utils::DateTime qw(); use DateTime::Format::Strptime qw(); @@ -774,8 +775,11 @@ sub process_hal_resource { 'mailboxuser' => $item_mock_obj->mailboxuser, })->first->mailboxuser->provisioning_voip_subscriber->voip_subscriber->id; # type is last item of path like /var/spool/asterisk/voicemail/default/uuid/INBOX + my $filename = NGCP::Panel::Utils::Subscriber::get_voicemail_filename($c,$item_mock_obj); my @p = split '/', $item_mock_obj->dir; $resource->{folder} = pop @p; + $resource->{direction} = 'in'; + $resource->{filename} = $filename; }elsif('sms' eq $item->{type}){ $resource = $item_accessors_hash; $resource->{start_time} = NGCP::Panel::Utils::DateTime::from_string($item_mock_obj->timestamp)->epoch; diff --git a/lib/NGCP/Panel/Utils/Subscriber.pm b/lib/NGCP/Panel/Utils/Subscriber.pm index 05c58f65e6..63ce349ab2 100644 --- a/lib/NGCP/Panel/Utils/Subscriber.pm +++ b/lib/NGCP/Panel/Utils/Subscriber.pm @@ -1826,6 +1826,12 @@ sub get_subscriber_pbx_status{ } return 0; } + +sub get_voicemail_filename{ + my($c, $voicemail_item) = @_; + return 'voicemail-'.$voicemail_item->msgnum.'.wav'; +} + 1; =head1 NAME