+
+ if ( scalar(@exists) == 2 ) {
+ if ( $exists[0]->freesidestatus || $exists[1]->freesidestatus ) {
+ return "processed double record for uniqueid ". $cdr->uniqueid. "\n";
+ }
+ warn "deleting double record for uniqueid ". $cdr->uniqueid. "\n";
+ my $extra = shift @exists;
+ my $error = $extra->delete;
+ return $error if $error;
+ }
+
+ return "too many matches (". scalar(@exists). ") found!"
+ if scalar(@exists) > 1;