},
);
+my $duration_sub = sub {
+ my($cdr, %opt) = @_;
+ if ( $opt{minutes} ) {
+ $opt{minutes}. ( $opt{granularity} ? 'm' : ' call' );
+ } else {
+ sprintf('%.2fm', $cdr->billsec / 60 );
+ }
+};
+
my %export_formats = (
'convergent' => [
'carriername', #CARRIER
sub { time2str('%r', shift->calldate_unix ) }, #TIME
'userfield', #USER
'dst', #NUMBER_DIALED
- sub { sprintf('%.2fm', shift->billsec / 60 ) }, #DURATION
+ $duration_sub, #DURATION
#sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE
sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; }, #PRICE
],
#'userfield', #USER
'dst', #NUMBER_DIALED
'src', #called from
- sub { sprintf('%.2fm', shift->billsec / 60 ) }, #DURATION
+ $duration_sub, #DURATION
#sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE
sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; }, #PRICE
],
sub { my($cdr, %opt) = @_; $opt{dst_regionname}; },
#DURATION
- sub { my($cdr, %opt) = @_;
- $opt{minutes}. ( $opt{granularity} ? 'm' : ' call' );
- },
+ $duration_sub,
#PRICE
sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; },