[freeside-commits] freeside/FS/FS cdr.pm, 1.31, 1.32 Conf.pm, 1.264, 1.265

Ivan,,, ivan at wavetail.420.am
Sun Mar 1 20:58:11 PST 2009


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv23333/FS/FS

Modified Files:
	cdr.pm Conf.pm 
Log Message:
option to do charged_party rewriting in the cdrrewrited daemon, RT#4342

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.264
retrieving revision 1.265
diff -u -d -r1.264 -r1.265
--- Conf.pm	23 Feb 2009 23:52:00 -0000	1.264
+++ Conf.pm	2 Mar 2009 04:58:09 -0000	1.265
@@ -2647,6 +2647,13 @@
   },
 
   {
+    'key'         => 'cdr-charged_party_rewrite',
+    'section'     => '',
+    'description' => 'Do charged party rewriting in the freeside-cdrrewrited daemon; useful if CDRs are being dropped off directly in the database and require special charged_party processing such as cdr-charged_party-accountcode.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'cdr-taqua-da_rewrite',
     'section'     => '',
     'description' => 'For the Taqua CDR format, a comma-separated list of directory assistance 800 numbers.  Any CDRs with these numbers as "BilledNumber" will be rewritten to the "CallingPartyNumber" (and CallType "12") on import.',
@@ -2660,6 +2667,13 @@
     'type'       => 'checkbox',
   },
 
+  {
+    'key'         => 'cdr-asterisk_forward_rewrite',
+    'section'     => '',
+    'description' => 'Enable special processing for CDRs representing forwarded calls: For CDRs that have a dcontext that starts with "Local/" but does not match dst, set charged_party to dst, parse a new dst from dstchannel, and set amaflags to "2" ("BILL"/"BILLING").',
+    'type'        => 'checkbox',
+  },
+
 );
 
 1;

Index: cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- cdr.pm	24 Feb 2009 08:41:35 -0000	1.31
+++ cdr.pm	2 Mar 2009 04:58:09 -0000	1.32
@@ -246,25 +246,7 @@
     $self->billsec(  $self->enddate - $self->answerdate );
   } 
 
-  my $conf = new FS::Conf;
-
-  unless ( $self->charged_party ) {
-
-    if ( $conf->exists('cdr-charged_party-accountcode') && $self->accountcode ){
-
-      $self->charged_party( $self->accountcode );
-
-    } else {
-
-      if ( $self->dst =~ /^(\+?1)?8[02-8]{2}/ ) {
-        $self->charged_party($self->dst);
-      } else {
-        $self->charged_party($self->src);
-      }
-
-    }
-
-  }
+  $self->set_charged_party;
 
   #check the foreign keys even?
   #do we want to outright *reject* the CDR?
@@ -287,6 +269,43 @@
   $self->SUPER::check;
 }
 
+=item set_charged_party
+
+If the charged_party field is already set, does nothing.  Otherwise:
+
+If the cdr-charged_party-accountcode config option is enabled, sets the
+charged_party to the accountcode.
+
+Otherwise sets the charged_party normally: to the src field in most cases,
+or to the dst field if it is a toll free number.
+
+=cut
+
+sub set_charged_party {
+  my $self = shift;
+
+  unless ( $self->charged_party ) {
+
+    my $conf = new FS::Conf;
+
+    if ( $conf->exists('cdr-charged_party-accountcode') && $self->accountcode ){
+
+      $self->charged_party( $self->accountcode );
+
+    } else {
+
+      if ( $self->dst =~ /^(\+?1)?8[02-8]{2}/ ) {
+        $self->charged_party($self->dst);
+      } else {
+        $self->charged_party($self->src);
+      }
+
+    }
+
+  }
+
+}
+
 =item set_status_and_rated_price STATUS [ RATED_PRICE ]
 
 Sets the status to the provided string.  If there is an error, returns the



More information about the freeside-commits mailing list