TT#24122 Add filename to the voicemail conversations

Change-Id: Ib55f1e46428707c75a095fde626daf8797cc3465
changes/01/16801/2
Irina Peshinskaya 8 years ago
parent ffcd18ce58
commit 6cb867e06d

@ -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;

@ -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);
}

@ -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;

@ -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

Loading…
Cancel
Save