summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-08-08 13:23:25 -0700
committerMark Wells <mark@freeside.biz>2016-08-08 13:24:19 -0700
commit247b5106adf262ec8e6a21c2afa493d38808b8c9 (patch)
tree1c252f752953943fa89a1ecc2c995ceb330c61d9 /FS
parent7ef0f1cd88449eb54d95d2f847ccacbb5b876f1d (diff)
option to extract destination number from userfield, #71674
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/bin/freeside-cdrrewrited7
2 files changed, 14 insertions, 0 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index d36103153..d4c03b4a1 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -5037,6 +5037,13 @@ and customer address. Include units.',
},
{
+ 'key' => 'cdr-userfield_dnis_rewrite',
+ 'section' => 'telephony',
+ 'description' => 'If the CDR userfield contains "DNIS=" followed by a sequence of digits, use that as the destination number for the call.',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'cdr-intl_to_domestic_rewrite',
'section' => 'telephony',
'description' => 'Strip the "011" international prefix from CDR destination numbers if the rest of the number is 7 digits or shorter, and so probably does not contain a country code.',
diff --git a/FS/bin/freeside-cdrrewrited b/FS/bin/freeside-cdrrewrited
index 1745d67a0..34a206849 100644
--- a/FS/bin/freeside-cdrrewrited
+++ b/FS/bin/freeside-cdrrewrited
@@ -219,6 +219,12 @@ while (1) {
}
+ if ( $conf->exists('cdr-userfield_dnis_rewrite') and
+ $cdr->userfield =~ /DNIS=(\d+)/ ) {
+ $cdr->dst($1);
+ push @status, 'userfield_dnis';
+ }
+
if ( $conf->exists('cdr-intl_to_domestic_rewrite') and
$cdr->dst =~ /^(011)(\d{0,7})$/ ) {
$cdr->dst($2);
@@ -261,6 +267,7 @@ sub _shouldrun {
|| $conf->exists('cdr-taqua-accountcode_rewrite')
|| $conf->exists('cdr-taqua-callerid_rewrite')
|| $conf->exists('cdr-intl_to_domestic_rewrite')
+ || $conf->exists('cdr-userfield_dnis_rewrite')
|| $conf->exists('cdr-skip_duplicate_rewrite')
|| 0
;