Incorrect CDR records on "Moved temporarily"

My uplink uses “Moved temporarily” message for load balancing between its servers, and Asterisk writes redirect IP address instead of peer name:

SIP/client-0001b159 24439 SIP/ 89604 2012-12-21 10:43:46 2 ANSWERED

How to force Asterisk write correct name?

Change to using call event logging. CDRs do not handle complex cases. Attempts to make them do so have caused collateral damage so are no longer attempted.

Note: it is quite possible that CEL doesn’t provide enough information, in which case, in the short term you need to enhance the source code, and in the long term, you need to raise a feature request. (If you produce source code, you can raise the feature request on the bug tracker. Otherwise you should use the developer mailing list. This is only if CEL does not already provide enough information.)

If you are not using promiscredir, you might want to see if that produces a more acceptable result. With the Asterisk version I used, it seemed to produce CDRs as though there had not been any redirection.