diff --git a/lib/NGCP/Panel/Controller/Sound.pm b/lib/NGCP/Panel/Controller/Sound.pm index 6d9298856a..9a32af8ba5 100644 --- a/lib/NGCP/Panel/Controller/Sound.pm +++ b/lib/NGCP/Panel/Controller/Sound.pm @@ -12,6 +12,7 @@ use File::Type; use NGCP::Panel::Utils::XMLDispatcher; use NGCP::Panel::Utils::Sounds; use NGCP::Panel::Utils::Navigation; +use NGCP::Panel::Utils::Sems; sub auto :Private { my ($self, $c) = @_; @@ -507,7 +508,7 @@ sub handles_edit :Chained('handles_base') :PathPart('edit') { if($file_result->handle->group->name eq 'calling_card') { try { - $self->_clear_audio_cache($file_result->set_id, $file_result->handle->name); + NGCP::Panel::Utils::Sems::clear_audio_cache("appserver", $file_result->set_id, $file_result->handle->name); } catch ($e) { $c->flash(messages => [{type => 'error', text => 'Failed to clear audio cache'}]); NGCP::Panel::Utils::Navigation::back_or($c, $c->stash->{handles_base_uri}); @@ -597,45 +598,6 @@ sub handles_download :Chained('handles_base') :PathPart('download') :Args(0) { $c->response->body($data); } -sub _clear_audio_cache { - my ($self, $sound_set_id, $handle_name) = @_; - - my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new; - - my @ret = $dispatcher->dispatch("appserver", 1, 1, < - - postDSMEvent - - - sw_audio - - - - - cmd - clearFile - - - audio_id - $handle_name - - - sound_set_id - $sound_set_id - - - - - -EOF - - if(grep { $$_[1] != 1 or $$_[2] !~ m#OK# } @ret) { # error - die "failed to clear SEMS audio cache"; - } - - return 1; -} __PACKAGE__->meta->make_immutable; @@ -721,12 +683,6 @@ L. Delete the Sound File determined by L. -=head2 _clear_audio_cache - -Ported from ossbss. - -tells our application server to clear a specific audio file - =head1 AUTHOR Gerhard Jungwirth C<< >> diff --git a/lib/NGCP/Panel/Utils/Sems.pm b/lib/NGCP/Panel/Utils/Sems.pm index 5927fc4971..40cbce253e 100644 --- a/lib/NGCP/Panel/Utils/Sems.pm +++ b/lib/NGCP/Panel/Utils/Sems.pm @@ -169,6 +169,46 @@ EOF return 1; } +sub clear_audio_cache { + my ($service, $sound_set_id, $handle_name) = @_; + + my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new; + + my @ret = $dispatcher->dispatch($service, 1, 1, < + + postDSMEvent + + + sw_audio + + + + + cmd + clearFile + + + audio_id + $handle_name + + + sound_set_id + $sound_set_id + + + + + +EOF + + if(grep { $$_[1] != 1 or $$_[2] !~ m#OK# } @ret) { # error + die "failed to clear SEMS audio cache"; + } + + return 1; +} + 1; # vim: set tabstop=4 expandtab: