Only give the DUMMY_DEACTIVATE proposed update if an account is not an external stub account.
Implement merging external stub accounts into real ones. External stub accounts are created when a CDR is seen with an unknown external reference name. Now, these accounts can be merged into normal ones, taking all their temporary CDRs along.
Lock the CDR service before retrieving CDR's to import, so that no account merge operation can ever run during importing.