- if ($conf->exists('cdr-skip_duplicate_rewrite')) {
- #qsearch can't handle timestamp type of calldate
- my $sth = dbh->prepare(
- 'SELECT 1 FROM cdr WHERE src=? AND dst=? AND calldate=? AND acctid < ? LIMIT 1'
- ) or die dbh->errstr;
- $sth->execute($cdr->src,$cdr->dst,$cdr->calldate,$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('done'); #prevent it from being billed
- push(@status,'duplicate');
- }
- }
-