respect granularity settings for display of inbound call duration, #71715
[freeside.git] / FS / FS / part_pkg / voip_inbound.pm
index 052bb7f..e911439 100644 (file)
@@ -214,6 +214,7 @@ sub calc_usage {
 #  my $downstream_cdr = '';
 
   my $included_min  = $self->option('min_included', 1) || 0;
+  $included_min *= ($cust_pkg->quantity || 1);
   my $use_duration  = $self->option('use_duration');
   my $output_format = $self->option('output_format', 1) || 'default';
 
@@ -291,10 +292,7 @@ sub calc_usage {
         my @call_details = (
           $cdr->downstream_csv( 'format'      => $output_format,
                                 'charge'      => $charge,
-                                'seconds'     => ($use_duration
-                                                   ? $cdr->duration
-                                                   : $cdr->billsec
-                                                 ),
+                                'seconds'     => $seconds,
                                 'granularity' => $granularity,
                               )
         );
@@ -316,10 +314,10 @@ sub calc_usage {
         'done',
         $charge,
         $cust_svc->svcnum,
-        'rated_seconds'     => $use_duration ? $cdr->duration : $cdr->billsec,
+        'rated_seconds'     => $seconds,
         'rated_granularity' => $granularity, 
         'rated_classnum'    => $cdr->calltypenum,
-        'inbound'        => 1,
+        'inbound'        => 1, # to update cdr_termination, not cdr
       );
       die $error if $error;
       $formatter->append($cdr);