CDR rating: migrate use_disposition and use_disposition_taqua to disposition_in,...
[freeside.git] / FS / FS / part_pkg / voip_cdr.pm
index b522a99..158debd 100644 (file)
@@ -141,14 +141,6 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
                         'type' => 'checkbox',
                       },
 
-    'use_disposition' => { 'name' => 'Do not charge for CDRs where the disposition flag is not set to "ANSWERED".',
-                           'type' => 'checkbox',
-                         },
-
-    'use_disposition_taqua' => { 'name' => 'Do not charge for CDRs where the disposition is not set to "100" (Taqua).',
-                                 'type' => 'checkbox',
-                               },
-
     'use_carrierid' => { 'name' => 'Do not charge for CDRs where the Carrier ID is not set to: ',
                          },
 
@@ -160,6 +152,9 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
     
     'ignore_disposition' => { 'name' => 'Do not charge for CDRs where the Disposition is set to any of these (comma-separated) values: ',
                          },
+    
+    'disposition_in' => { 'name' => 'Do not charge for CDRs where the Disposition is not set to any of these (comma-separated) values: ',
+                         },
 
     'skip_dst_prefix' => { 'name' => 'Do not charge for CDRs where the destination number starts with any of these values: ',
     },
@@ -275,10 +270,10 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
                        disable_src
                        domestic_prefix international_prefix
                        disable_tollfree
-                       use_amaflags use_disposition
-                       use_disposition_taqua use_carrierid 
+                       use_amaflags
+                       use_carrierid 
                        use_cdrtypenum ignore_cdrtypenum
-                       ignore_disposition
+                       ignore_disposition disposition_in
                        skip_dcontext skip_dst_prefix 
                        skip_dstchannel_prefix skip_src_length_more 
                        noskip_src_length_accountcode_tollfree
@@ -881,11 +876,10 @@ sub check_chargable {
 
   my @opt = qw(
     use_amaflags
-    use_disposition
-    use_disposition_taqua
     use_carrierid
     use_cdrtypenum
     ignore_cdrtypenum
+    disposition_in
     ignore_disposition
     skip_dst_prefix
     skip_dcontext
@@ -903,11 +897,9 @@ sub check_chargable {
   return 'amaflags != 2'
     if $opt{'use_amaflags'} && $cdr->amaflags != 2;
 
-  return 'disposition != ANSWERED'
-    if $opt{'use_disposition'} && $cdr->disposition ne 'ANSWERED';
-
-  return "disposition != 100"
-    if $opt{'use_disposition_taqua'} && $cdr->disposition != 100;
+  return "disposition NOT IN ( $opt{'disposition_in'} )"
+    if $opt{'disposition_in'} =~ /\S/
+    && !grep { $cdr->disposition eq $_ } split(/\s*,\s*/, $opt{'disposition_in'});
   
   return "disposition IN ( $opt{'ignore_disposition'} )"
     if $opt{'ignore_disposition'} =~ /\S/