TT#179901 Discontinue iNew dedicated features and code (part 2)

Remove party_call_control feature

Change-Id: I6ea1c725a463ee62696de93a7ee52080515cc2b7
mr12.0
Marco Capetta 4 years ago
parent d41dfe0d62
commit 967bc581fe

@ -63,16 +63,7 @@ sub POST :Allow {
form => $form,
);
if ($resource->{type} eq "pcc") {
try {
NGCP::Panel::Utils::Sems::party_call_control($c, $resource);
} catch($e) {
$c->log->error("failed to handle a party call control request: $e");
$self->error($c, HTTP_INTERNAL_SERVER_ERROR,
"Failed to handle a party call control request.");
last;
}
} elsif ($resource->{type} eq "sms") {
if ($resource->{type} eq "sms") {
my $error_msg;
my $callid = $resource->{callid};
my $status = $resource->{status};

@ -74,29 +74,10 @@ sub receive :Chained('list') :PathPart('receive') :Args(0) {
die "no_subscriber_found";
}
my $pcc_url = $c->config->{pcc}->{url};
my $pcc_timeout = $c->config->{pcc}->{timeout};
my $pcc_enabled = 0;
my ($pcc_uuid, $pcc_token);
my $smsc_peer = 'default';
UUID::generate($pcc_uuid);
UUID::unparse($pcc_uuid, $pcc_token);
my $fwd_pref_rs = NGCP::Panel::Utils::Preferences::get_usr_preference_rs(
c => $c, attribute => 'party_call_control',
prov_subscriber => $prov_dbalias->subscriber,
);
if($fwd_pref_rs && $fwd_pref_rs->first && $fwd_pref_rs->first->value) {
$pcc_enabled = 1;
} else {
$fwd_pref_rs = NGCP::Panel::Utils::Preferences::get_dom_preference_rs(
c => $c, attribute => 'party_call_control',
prov_domain => $prov_dbalias->domain,
);
if($fwd_pref_rs && $fwd_pref_rs->first && $fwd_pref_rs->first->value) {
$pcc_enabled = 1;
}
}
$c->log->info("pcc is set to $pcc_enabled for prov subscriber id " . $prov_dbalias->subscriber_id);
my $smsc_peer_rs = NGCP::Panel::Utils::Preferences::get_dom_preference_rs(
c => $c, attribute => 'smsc_peer',
@ -200,7 +181,7 @@ sub receive :Chained('list') :PathPart('receive') :Args(0) {
$dst =~ s/^sip:(.+)\@.+$/$1/;
$c->log->debug(">>>> forward sms to $dst");
my $pcc_status = $pcc_enabled ? "pending" : "none";
my $pcc_status = "pending";
my $fwd_item = NGCP::Panel::Utils::SMS::add_journal_record(
c => $c,
prov_subscriber => $prov_dbalias->subscriber,
@ -216,40 +197,16 @@ sub receive :Chained('list') :PathPart('receive') :Args(0) {
status => $pcc_status,
);
if($pcc_enabled && $pcc_url) {
try {
my $ret = NGCP::Panel::Utils::PartyCallControl::dispatch(
c => $c,
url => $pcc_url,
timeout => $pcc_timeout,
id => $fwd_item->id,
from => $from,
to => $to,
type => "sms",
text => $text,
token => $pcc_token,
);
unless($ret) {
$c->log->error("failed to dispatch pcc request");
$fwd_item->update({ pcc_status => "failed" });
}
} catch($e) {
$c->log->error("failed to dispatch pcc request: $e");
$fwd_item->update({ pcc_status => "failed" });
}
} else {
# no 3rd party call control, feed back into kannel
my $error_msg;
NGCP::Panel::Utils::SMS::send_sms(
c => $c,
smsc_peer => $smsc_peer,
caller => $to, # use the original to as new from
callee => $dst,
text => $text,
coding => $coding,
err_code => sub {$error_msg = shift;},
);
}
my $error_msg;
NGCP::Panel::Utils::SMS::send_sms(
c => $c,
smsc_peer => $smsc_peer,
caller => $to, # use the original to as new from
callee => $dst,
text => $text,
coding => $coding,
err_code => sub {$error_msg = shift;},
);
}
});

@ -534,61 +534,6 @@ EOF
return 1;
}
sub party_call_control {
my ($c, $data) = @_;
foreach my $param (qw(caller callee callid status token)) {
die "missing '$param' parameter'" unless $data->{$param};
}
my ($caller, $callee, $callid, $status, $token) =
@{$data}{qw(caller callee callid status token)};
my $service = 'appserver';
my @ret = NGCP::Panel::Utils::XMLDispatcher::dispatch($c, $service, 1, 1, <<EOF );
<?xml version="1.0"?>
<methodCall>
<methodName>postDSMEvent</methodName>
<params>
<param>
<value><string>$token</string></value>
</param>
<param>
<value><array><data>
<value><array><data>
<value><string>cmd</string></value>
<value><string>handleCall</string></value>
</data></array></value>
<value><array><data>
<value><string>callid</string></value>
<value><string>$callid</string></value>
</data></array></value>
<value><array><data>
<value><string>caller</string></value>
<value><string>$caller</string></value>
</data></array></value>
<value><array><data>
<value><string>callee</string></value>
<value><string>$callee</string></value>
</data></array></value>
<value><array><data>
<value><string>status</string></value>
<value><string>$status</string></value>
</data></array></value>
</data></array></value>
</param>
</params>
</methodCall>
EOF
if(grep { $$_[1] == 0 or $$_[2] !~ m#<value>OK</value># } @ret) {
die "failed to handle party call control request";
}
return 1;
}
1;
# vim: set tabstop=4 expandtab:

Loading…
Cancel
Save