From 3a9d043d4032d05e1831725633b4226785fc3039 Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Wed, 2 Jul 2014 15:34:30 +0200 Subject: [PATCH] MT#7899 API: clear audio cache on sound file mod. --- lib/NGCP/Panel/Role/API/SoundFiles.pm | 11 +++++++++++ lib/NGCP/Panel/Utils/XMLDispatcher.pm | 2 ++ 2 files changed, 13 insertions(+) diff --git a/lib/NGCP/Panel/Role/API/SoundFiles.pm b/lib/NGCP/Panel/Role/API/SoundFiles.pm index 6fd8e9c4e2..be363414ff 100644 --- a/lib/NGCP/Panel/Role/API/SoundFiles.pm +++ b/lib/NGCP/Panel/Role/API/SoundFiles.pm @@ -14,6 +14,7 @@ use HTTP::Status qw(:constants); use File::Temp qw(tempfile); use NGCP::Panel::Form::Sound::FileAPI; use NGCP::Panel::Utils::Sounds; +use NGCP::Panel::Utils::Sems; sub transcode_data { my ($self, $c, $from_codec, $resource) = @_; @@ -174,6 +175,16 @@ sub update_item { } $resource->{handle_id} = $handle->id; + given($handle->group->name) { + when([qw/calling_card/]) { + NGCP::Panel::Utils::Sems::clear_audio_cache($c, "appserver", $set->id, $handle->name); + } + when([qw/pbx music_on_hold/]) { + my $service = $set->contract_id ? "pbx" : "appserver"; + NGCP::Panel::Utils::Sems::clear_audio_cache($c, $service, $set->id, $handle->name); + } + } + if($resource->{handle} eq 'music_on_hold' && !$set->contract_id) { $resource->{codec} = 'PCMA'; $resource->{filename} =~ s/\.[^.]+$/.pcma/; diff --git a/lib/NGCP/Panel/Utils/XMLDispatcher.pm b/lib/NGCP/Panel/Utils/XMLDispatcher.pm index 93ce9e73a3..dcdc279ab5 100644 --- a/lib/NGCP/Panel/Utils/XMLDispatcher.pm +++ b/lib/NGCP/Panel/Utils/XMLDispatcher.pm @@ -15,6 +15,8 @@ sub dispatch { my ($self, $c, $target, $all, $sync, $body) = @_; my $schema = $self->schema; + $c->log->info("dispatching to target $target, all=$all, sync=$sync"); + $c->log->debug("dispatching body $body"); my $hosts; if ($target =~ /^%TG%/) {