summaryrefslogtreecommitdiff
path: root/FS/bin
diff options
context:
space:
mode:
authorivan <ivan>2009-03-02 04:58:09 +0000
committerivan <ivan>2009-03-02 04:58:09 +0000
commitcaf4bbf142bc25fa583e258ac3e1724a9eee8d5b (patch)
tree6323c7e33b2523d238e0a183bb2c3d07da365df4 /FS/bin
parentbd73a121f43bea3bf2ea576be109a680827676b9 (diff)
option to do charged_party rewriting in the cdrrewrited daemon, RT#4342
Diffstat (limited to 'FS/bin')
-rw-r--r--FS/bin/freeside-cdrrewrited30
1 files changed, 22 insertions, 8 deletions
diff --git a/FS/bin/freeside-cdrrewrited b/FS/bin/freeside-cdrrewrited
index 198fbb5e7..0b7f6883f 100644
--- a/FS/bin/freeside-cdrrewrited
+++ b/FS/bin/freeside-cdrrewrited
@@ -24,7 +24,8 @@ daemonize2();
$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 @@ while (1) {
) {
$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 @@ while (1) {
$cdr->dst($dst);
$cdr->amaflags(2);
- $cdr->freesiderewritestatus('asterisk_forward');
+ push @status, 'asterisk_forward';
- } else {
- $cdr->freesiderewritestatus('skipped')
}
+ if ( $conf->exists('cdr-charged_party_rewrite') && ! $cdr->charged_party ) {
+
+ $cdr->set_charged_party;
+ push @status, 'charged_party';
+
+ }
+
+ $cdr->freesiderewritestatus(
+ scalar(@status) ? join('/', @status) : 'skipped'
+ );
+
my $error = $cdr->replace;
if ( $error ) {
@@ -88,7 +100,8 @@ while (1) {
#--
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 @@ freeside-cdrrewrited - Real-time daemon for CDR rewriting
=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