From bd3bd98719c5ad75c81b32ef25532c3b8a088472 Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Thu, 11 Sep 2014 15:42:50 +0200 Subject: [PATCH] MT#9047 Remove allowed ips before subs termination --- lib/NGCP/Panel/Utils/Subscriber.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/NGCP/Panel/Utils/Subscriber.pm b/lib/NGCP/Panel/Utils/Subscriber.pm index 4dbe5d1ea1..8dce7f2cb3 100644 --- a/lib/NGCP/Panel/Utils/Subscriber.pm +++ b/lib/NGCP/Panel/Utils/Subscriber.pm @@ -749,6 +749,17 @@ sub terminate { } NGCP::Panel::Utils::Kamailio::delete_location($c, $prov_subscriber); + foreach my $pref(qw/allowed_ips_grp man_allowed_ips_grp/) { + my $aig_rs = NGCP::Panel::Utils::Preferences::get_usr_preference_rs( + c => $c, prov_subscriber => $prov_subscriber, attribute => $pref, + ); + if($aig_rs && $aig_rs->first) { + $c->model('DB')->resultset('voip_allowed_ip_groups')->delete({ + group_id => $aig_rs->first->value, + }); + } + } + $prov_subscriber->delete; } $subscriber->update({ status => 'terminated' });