[freeside-commits] freeside/FS/bin freeside-cdrrewrited,1.2,1.3
Ivan,,,
ivan at wavetail.420.am
Sun Mar 1 20:58:11 PST 2009
Update of /home/cvs/cvsroot/freeside/FS/bin
In directory wavetail.420.am:/tmp/cvs-serv23333/FS/bin
Modified Files:
freeside-cdrrewrited
Log Message:
option to do charged_party rewriting in the cdrrewrited daemon, RT#4342
Index: freeside-cdrrewrited
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-cdrrewrited,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- freeside-cdrrewrited 24 Feb 2009 08:45:10 -0000 1.2
+++ freeside-cdrrewrited 2 Mar 2009 04:58:08 -0000 1.3
@@ -24,7 +24,8 @@
$conf = new FS::Conf;
-die "not running; cdr-asterisk_forward_rewrite conf is off\n"
+die "not running; cdr-asterisk_forward_rewrite and cdr-charged_party_rewrite ".
+ " conf options are both off\n"
unless _shouldrun();
#--
@@ -49,8 +50,10 @@
) {
$found = 1;
+ my @status = ();
- if ( $cdr->dstchannel =~ /^Local\/(\d+)/i && $1 ne $cdr->dst
+ if ( $conf->exists('cdr-asterisk_forward_rewrite')
+ && $cdr->dstchannel =~ /^Local\/(\d+)/i && $1 ne $cdr->dst
)
{
@@ -63,12 +66,21 @@
$cdr->dst($dst);
$cdr->amaflags(2);
- $cdr->freesiderewritestatus('asterisk_forward');
+ push @status, 'asterisk_forward';
+
+ }
+
+ if ( $conf->exists('cdr-charged_party_rewrite') && ! $cdr->charged_party ) {
+
+ $cdr->set_charged_party;
+ push @status, 'charged_party';
- } else {
- $cdr->freesiderewritestatus('skipped')
}
+ $cdr->freesiderewritestatus(
+ scalar(@status) ? join('/', @status) : 'skipped'
+ );
+
my $error = $cdr->replace;
if ( $error ) {
@@ -88,7 +100,8 @@
#--
sub _shouldrun {
- $conf->exists('cdr-asterisk_forward_rewrite');
+ $conf->exists('cdr-asterisk_forward_rewrite')
+ || $conf->exists('cdr-charged_party_rewrite');
}
sub usage {
@@ -105,8 +118,9 @@
=head1 DESCRIPTION
-Runs continuously, searches for CDRs and does forwarded-call rewriting if
-the "cdr-asterisk_forward_rewrite" option is enabled.
+Runs continuously, searches for CDRs and does forwarded-call rewriting if the
+"cdr-asterisk_forward_rewrite" or "cdr-charged_party_rewrite" config option is
+enabled.
=head1 SEE ALSO
More information about the freeside-commits
mailing list