If pcc is enabled for a subscriber, don't forward sms immediately, rather than mark for forwarding and let the API forward it on incoming request. Change-Id: I75104266a1c1fccc7165af9ba65b31f085d7081fchanges/01/10701/2
parent
1bbad6aaf2
commit
5ca51f930a
@ -0,0 +1,44 @@
|
||||
package NGCP::Panel::Utils::PartyCallControl;
|
||||
|
||||
use Sipwise::Base;
|
||||
use LWP::UserAgent;
|
||||
use URI;
|
||||
use JSON;
|
||||
|
||||
sub dispatch {
|
||||
my (%args) = @_;
|
||||
my $c = $args{c};
|
||||
my $url = $args{url};
|
||||
my $timeout = $args{timeout};
|
||||
my $id = $args{id};
|
||||
my $type = $args{type};
|
||||
my $from = $args{from};
|
||||
my $to = $args{to};
|
||||
my $text = $args{text};
|
||||
my $token = $args{token};
|
||||
|
||||
# TODO: dispatch asynchronously!
|
||||
my $ua = LWP::UserAgent->new(
|
||||
#ssl_opts => { verify_hostname => 0, SSL_verify_mode => 0 },
|
||||
timeout => $timeout,
|
||||
);
|
||||
$c->log->info("sending pcc request for $type with id $id to $url");
|
||||
my $req = HTTP::Request->new(POST => $url);
|
||||
$req->header('Content-Type' => 'application/json');
|
||||
$req->content(to_json({
|
||||
actualMsisdn => $to,
|
||||
callingMsisdn => $from,
|
||||
callid => $id,
|
||||
type => $type,
|
||||
token => $token,
|
||||
$type eq "sms" ? (text => $text) : (),
|
||||
}));
|
||||
my $res = $ua->request($req);
|
||||
$c->log->info("sending pcc request " . ($res->is_success ? "succeeded" : "failed"));
|
||||
if ($res->is_success) {
|
||||
return 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
1;
|
||||
Loading…
Reference in new issue