summaryrefslogtreecommitdiff
path: root/FS/FS/svc_phone.pm
diff options
context:
space:
mode:
authorivan <ivan>2011-11-18 00:09:50 +0000
committerivan <ivan>2011-11-18 00:09:50 +0000
commit4b4d74a09dd4e39f53b7d0944b20b178cbecd5ec (patch)
tree9e7129827f550acb74c831a67005186e102b642a /FS/FS/svc_phone.pm
parentf1371047a59f62165fa3b6d639af72e03cba9a8f (diff)
reduce memory usage of voip_tiered, RT#14903
Diffstat (limited to 'FS/FS/svc_phone.pm')
-rw-r--r--FS/FS/svc_phone.pm31
1 files changed, 15 insertions, 16 deletions
diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm
index 4945391..e3d18e0 100644
--- a/FS/FS/svc_phone.pm
+++ b/FS/FS/svc_phone.pm
@@ -650,7 +650,7 @@ Accepts the following options:
=item for_update => 1: SELECT the CDRs "FOR UPDATE".
-=item status => "" (or "done"): Return only CDRs with that processing status.
+=item status => "" (or "processing-tiered", "done"): Return only CDRs with that processing status.
=item inbound => 1: Return CDRs for inbound calls. With "status", will filter
on inbound processing status.
@@ -673,25 +673,24 @@ sub get_cdrs {
my @where;
if ( $options{'inbound'} ) {
+
@fields = ( 'dst' );
if ( exists($options{'status'}) ) {
- # must be 'done' or ''
- my $sq = 'EXISTS ( SELECT 1 FROM cdr_termination '.
- 'WHERE cdr.acctid = cdr_termination.acctid '.
- 'AND cdr_termination.status = \'done\' '.
- 'AND cdr_termination.termpart = 1 )';
- if ( $options{'status'} eq 'done' ) {
- push @where, $sq;
- }
- elsif ($options{'status'} eq '' ) {
- push @where, "NOT $sq";
- }
- else {
- warn "invalid status: $options{'status'} (ignored)\n";
+ my $status = $options{'status'};
+ if ( $status ) {
+ push @where, 'EXISTS ( SELECT 1 FROM cdr_termination '.
+ 'WHERE cdr.acctid = cdr_termination.acctid '.
+ "AND cdr_termination.status = '$status' ". #quoting kludge
+ 'AND cdr_termination.termpart = 1 )';
+ } else {
+ push @where, 'NOT EXISTS ( SELECT 1 FROM cdr_termination '.
+ 'WHERE cdr.acctid = cdr_termination.acctid '.
+ 'AND cdr_termination.termpart = 1 )';
}
}
- }
- else {
+
+ } else {
+
@fields = ( 'charged_party' );
push @fields, 'src' if !$options{'disable_src'};
$hash{'freesidestatus'} = $options{'status'}