MT#21195 call kamailio xmlrpc addressReload

when updating "trusted sources" via web or restapi.

Change-Id: I7840fa832407b8ec220074e97a2b14cc60b87de4
changes/34/7534/1
Gerhard Jungwirth 10 years ago
parent 9f7566ed88
commit 687588fbec

@ -10,6 +10,7 @@ use HTTP::Headers qw();
use HTTP::Status qw(:constants);
use NGCP::Panel::Utils::DateTime;
use NGCP::Panel::Utils::Kamailio;
use Path::Tiny qw(path);
use Safe::Isa qw($_isa);
require Catalyst::ActionRole::ACL;
@ -186,6 +187,7 @@ sub POST :Allow {
my $item;
try {
$item = $c->model('DB')->resultset('voip_trusted_sources')->create($resource);
NGCP::Panel::Utils::Kamailio::address_reload($c);
} catch($e) {
$c->log->error("failed to create trusted source: $e"); # TODO: user, message, trace, ...
$self->error($c, HTTP_INTERNAL_SERVER_ERROR, "Failed to create trusted source.");

@ -3461,6 +3461,7 @@ sub create_trusted :Chained('base') :PathPart('preferences/trusted/create') :Arg
protocol => $form->field('protocol')->value,
from_pattern => $form->field('from_pattern') ? $form->field('from_pattern')->value : undef,
});
NGCP::Panel::Utils::Kamailio::address_reload($c);
NGCP::Panel::Utils::Message::info(
c => $c,
desc => $c->loc('Successfully created trusted source'),
@ -3537,6 +3538,7 @@ sub edit_trusted :Chained('trusted_base') :PathPart('edit') {
protocol => $form->field('protocol')->value,
from_pattern => $form->field('from_pattern') ? $form->field('from_pattern')->value : undef,
});
NGCP::Panel::Utils::Kamailio::address_reload($c);
NGCP::Panel::Utils::Message::info(
c => $c,
desc => $c->loc('Successfully updated trusted source'),
@ -3568,6 +3570,7 @@ sub delete_trusted :Chained('trusted_base') :PathPart('delete') :Args(0) {
try {
$c->stash->{trusted}->delete;
NGCP::Panel::Utils::Kamailio::address_reload($c);
NGCP::Panel::Utils::Message::info(
c => $c,
data => { $c->stash->{trusted}->get_inflated_columns },

@ -11,6 +11,7 @@ use Data::HAL qw();
use Data::HAL::Link qw();
use HTTP::Status qw(:constants);
use NGCP::Panel::Form::Subscriber::TrustedSourceAPI;
use NGCP::Panel::Utils::Kamailio;
sub _item_rs {
my ($self, $c) = @_;
@ -115,6 +116,7 @@ sub update_item {
$resource->{uuid} = $sub->uuid;
$item->update($resource);
NGCP::Panel::Utils::Kamailio::address_reload($c);
return $item;
}

@ -86,6 +86,18 @@ sub flush {
EOF
}
sub address_reload {
my ($c) = @_;
my $dispatcher = NGCP::Panel::Utils::XMLDispatcher->new;
my $ret = $dispatcher->dispatch($c, "proxy-ng", 1, 1, <<EOF );
<?xml version="1.0" ?>
<methodCall>
<methodName>permissions.addressReload</methodName>
</methodCall>
EOF
}
sub get_aor{
my ($c, $prov_subscriber) = @_;
return $prov_subscriber->username . '@' . $prov_subscriber->domain->domain;

Loading…
Cancel
Save