diff options
author | ivan <ivan> | 2008-10-16 22:45:19 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-10-16 22:45:19 +0000 |
commit | 2fc2c6d6dcb77a006db232b7b9efd624e814fe9f (patch) | |
tree | 9f965d84de61c8933b7fb684b93653e670c50ca6 | |
parent | debbdccf367a4f41767632548286836c8ed86eb9 (diff) |
add an option to use duration instead of billsec to calculate billable time, RT#4147
-rw-r--r-- | FS/FS/part_pkg/voip_cdr.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index 6b27465f8..0ceaac181 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -106,6 +106,10 @@ tie my %temporalities, 'Tie::IxHash', 'use_cdrtypenum' => { 'name' => 'Do not charge for CDRs where the CDR Type is not set to: ', }, + 'use_duration' => { 'name' => 'Calculate usage based on the duration field instead of the billsec field', + 'type' => 'checkbox', + }, + '411_rewrite' => { 'name' => 'Rewrite these (comma-separated) destination numbers to 411 for rating purposes: ', }, @@ -154,6 +158,7 @@ tie my %temporalities, 'Tie::IxHash', disable_tollfree use_amaflags use_disposition use_disposition_taqua use_carrierid use_cdrtypenum + use_duration 411_rewrite output_format summarize_usage usage_section ) @@ -415,7 +420,12 @@ sub calc_recur { unless exists $included_min{$regionnum}; my $granularity = $rate_detail->sec_granularity; - my $seconds = $cdr->billsec; # length($cdr->billsec) ? $cdr->billsec : $cdr->duration; + + # length($cdr->billsec) ? $cdr->billsec : $cdr->duration; + my $seconds = $self->option('use_duration') + ? $cdr->duration + : $cdr->billsec; + $seconds += $granularity - ( $seconds % $granularity ) if $seconds # don't granular-ize 0 billsec calls (bills them) && $granularity; # 0 is per call |