},
{
+ 'key' => 'cdr-skip_duplicate_rewrite-sipcallid',
+ 'section' => 'telephony',
+ 'description' => 'Use the freeside-cdrrewrited daemon to prevent billing CDRs with a sipcallid identical to an existing CDR',
+ 'type' => 'checkbox',
+ },
+
+
+ {
'key' => 'cdr-charged_party_rewrite',
'section' => 'telephony',
'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 or cdr-charged_party-truncate*.',
# FK to cust_bill_pkg_detail; having a value here absolutely means
# that the CDR appears on an invoice
'detailnum', 'bigint', 'NULL', '', '', '',
+
+ #for mediation/deduplication
+ 'sipcallid', 'varchar', 'NULL', 255, '', '',
],
'primary_key' => 'acctid',
'unique' => [],
[ 'freesidestatus' ], [ 'freesiderewritestatus' ],
[ 'cdrbatchnum' ],
[ 'src_ip_addr' ], [ 'dst_ip_addr' ], [ 'dst_term' ],
- [ 'detailnum' ],
+ [ 'detailnum' ], [ 'sipcallid' ],
],
#no FKs on cdr table... choosing not to throw errors no matter what's
# thrown in here. better to have the data.
=item detailnum - Link to invoice detail (L<FS::cust_bill_pkg_detail>)
+=item sipcallid - SIP Call-ID
+
=back
=head1 METHODS
# 22: networkTranslatedGroup
# 23: releasingParty
# 24: route
+ skip(10),
+
# 25: networkCallID
+ 'sipcallid',
+
# 26: codedc
# 27: accessDeviceAddress
# 28: accessCallID
# 31: spare
# 32: group
# 33: department
- skip(19),
+ skip(8),
# 34: accountCode
sub {
# 47: callingPartyCategory
#
# Also... cols 48 - 448 see Broadsoft documentation
+ skip(111), #35-145 inclusive
+
+ # 146: chargedNumber
+ 'charged_party',
],
#60
- '', #OrigIPCallID
+ 'sipcallid', #OrigIPCallID
'', #ESAIPTrunkGroup
'', #ESAReason
'', #BearerlessCall
#order matters for removing dupes--only the first is preserved
$extra_sql .= ' ORDER BY acctid '
- if $conf->exists('cdr-skip_duplicate_rewrite');
+ if $conf->exists('cdr-skip_duplicate_rewrite')
+ || $conf->exists('cdr-skip_duplicate_rewrite-sipcallid');
my $found = 0;
my %skip = (); #used only by taqua
}
}
+ if ($conf->exists('cdr-skip_duplicate_rewrite-sipcallid')) {
+ my $sth = dbh->prepare(
+ 'SELECT 1 FROM cdr WHERE sipcallid=? AND acctid < ? LIMIT 1'
+ ) or die dbh->errstr;
+ $sth->execute($cdr->sipcallid, $cdr->acctid) or die $sth->errstr;
+ my $isdup = $sth->fetchrow_hashref;
+ $sth->finish;
+ if ($isdup) {
+ #we only act on this cdr, not touching previous dupes
+ #if a dupe somehow creeped in previously, too late to fix it
+ $cdr->freesidestatus('skipped'); #prevent it from being billed
+ push(@status,'duplicate');
+ }
+ }
+
+
if ( $conf->exists('cdr-asterisk_forward_rewrite')
&& $cdr->dstchannel =~ /^Local\/(\d+)/i && $1 ne $cdr->dst
)
|| $conf->exists('cdr-intl_to_domestic_rewrite')
|| $conf->exists('cdr-userfield_dnis_rewrite')
|| $conf->exists('cdr-skip_duplicate_rewrite')
+ || $conf->exists('cdr-skip_duplicate_rewrite-sipcallid')
|| 0
;
}
Marks as 'skipped' (prevents billing for) any CDRs with
a src, dst and calldate identical to an existing CDR
+=item cdr-skip_duplicate_rewrite-sipcallid
+
+Marks as 'skipped' (prevents billing for) any CDRs with
+a sipcallid identical to an existing CDR
+
=item cdr-asterisk_australia_rewrite
Classifies Australian numbers as domestic, mobile, tollfree, international, or