[freeside-commits] freeside/FS/bin freeside-cdrrewrited,1.3,1.4
Ivan,,,
ivan at wavetail.420.am
Sun Apr 10 21:59:33 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/bin
In directory wavetail.420.am:/tmp/cvs-serv15554/FS/bin
Modified Files:
freeside-cdrrewrited
Log Message:
taqua accountcodes, RT#12181
Index: freeside-cdrrewrited
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-cdrrewrited,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- freeside-cdrrewrited 2 Mar 2009 04:58:08 -0000 1.3
+++ freeside-cdrrewrited 11 Apr 2011 04:59:31 -0000 1.4
@@ -24,8 +24,8 @@
$conf = new FS::Conf;
-die "not running; cdr-asterisk_forward_rewrite and cdr-charged_party_rewrite ".
- " conf options are both off\n"
+die "not running; cdr-asterisk_forward_rewrite, cdr-charged_party_rewrite ".
+ " and cdr-taqua-accountcode_rewrite conf options are all off\n"
unless _shouldrun();
#--
@@ -77,6 +77,35 @@
}
+ if ( $conf->exists('cdr-taqua-accountcode_rewrite')
+ && $cdr->lastapp eq 'acctcode' && $cdr->cdrtypenum == 1
+ )
+ {
+
+ #find the matching CDR
+ my $primary = qsearchs('cdr', {
+ 'sessionnum' => $cdr->sessionnum,
+ 'src' => $cdr->subscriber,
+ #'accountcode' => '',
+ });
+
+ unless ( $primary ) {
+ warn "WARNING: can't find primary CDR with session ". $cdr->sessionnum.
+ ", src ". $cdr->subscriber. "; will keep trying\n";
+ next;
+ }
+
+ $primary->accountcode( $cdr->lastdata );
+ #$primary->freesiderewritestatus( 'taqua-accountcode-primary' );
+ my $error = $primary->replace;
+ if ( $error ) {
+ warn "WARNING: error rewriting primary CDR (will retry): $error\n"
+ next;
+ }
+
+ push @status, 'taqua-accountcode';
+ }
+
$cdr->freesiderewritestatus(
scalar(@status) ? join('/', @status) : 'skipped'
);
@@ -101,7 +130,8 @@
sub _shouldrun {
$conf->exists('cdr-asterisk_forward_rewrite')
- || $conf->exists('cdr-charged_party_rewrite');
+ || $conf->exists('cdr-charged_party_rewrite')
+ || $conf->exists('cdr-taqua-accountcode_rewrite');
}
sub usage {
More information about the freeside-commits
mailing list