From 863a125371093aefe7b3ce1fe23918591b792794 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 29 May 2017 11:49:40 -0400 Subject: [PATCH] TT#14570 supply SMS session cancel reason (no credit) Change-Id: Ib53d668bc2a2a5e0a4b5696dc61d7a17974f7018 --- lib/NGCP/Panel/Utils/SMS.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/NGCP/Panel/Utils/SMS.pm b/lib/NGCP/Panel/Utils/SMS.pm index af572a8eb7..bf21d5a14d 100644 --- a/lib/NGCP/Panel/Utils/SMS.pm +++ b/lib/NGCP/Panel/Utils/SMS.pm @@ -234,6 +234,7 @@ sub perform_prepaid_billing { # of them! my @sessions = (); my @failed_sessions = (); + my $cancel_reason; for(my $i = 0; $i < $parts; ++$i) { my $has_credit = 1; my $this_session_id = $session_id."-".$i; @@ -253,6 +254,7 @@ sub perform_prepaid_billing { unless($has_credit) { $c->log->info("No credit for sms from $caller to $callee with session id $this_session_id"); push @failed_sessions, $sess; + $cancel_reason = 'insufficient credit'; last; } push @sessions, $sess; @@ -266,6 +268,9 @@ sub perform_prepaid_billing { return 1; } else { foreach my $sess(@sessions) { + if (defined($cancel_reason)) { + NGCP::Rating::Inew::SmsSession::session_set_cancel_reason($sess, $cancel_reason); + } NGCP::Rating::Inew::SmsSession::session_sms_discard($sess); NGCP::Rating::Inew::SmsSession::session_destroy($sess); }