Asterisk 1.8 Caller ID Wrong in CDR
After upgrading to Asterisk 1.8 from 1.6.1 I noticed the CALLERID() function was not updating the clid and src fields in the CDR. Previously on Asterisk 1.6.1 with FreePBX 2.7 the clid and src would be set to the outbound cid. With Asterisk 1.8 those fields were staying as the sip device id.
After looking through the code I trace this issue to the set_one_cid function in main/cdr.c. With Asterisk 1.8 connected part identification support was added, which meant the CALLERID() functions were modified. I have submitted a patch to Asterisk bring back the previous behavior.
patch -p1 < /asterisk-1.8.0-cdr-clid.patch