Incorrect CDR logging for SIP -> ISDN passed dailout

Hi,

I’ve seen this several times, but do not really know where to fix it.

Setup:
Sip trunk for in/out traffic
ISDN2 for the old numbers

Dailing out first tries the Sip-trunk, 
and if that fails, we use the ISDN

Now if I forget to add the area code, it turnsinto a local call which is refused by the SIP provider, but is acceptable on the ISDN line.

Asterisk logs:
[Aug 13 13:15:44] VERBOSE[17167] logger.c: – Called g1/7074907/b
[Aug 13 13:15:44] VERBOSE[17167] logger.c: – CAPI/ISDN1#02/7074907-6e is proceeding passing it to SIP/200-b7cf6318
[Aug 13 13:15:45] VERBOSE[17167] logger.c: – CAPI/ISDN1#02/7074907-6e answered SIP/200-b7cf6318

However, these calls end up in the CDR database as still being originated on the SIP trunk with the SIP number.

And I would expect to see a call originating from an ISDN number.