Populate CDR userfield

I want to populate the CDR userfield fromt the dial plan so that we can maintain consitancy of the cdr through the entire existance of a call.

I am looking at somthing like this to add to inbound and outbound calls from the trunk but i am unsure what would be the best way to do it.

exten => 777,1,SetGlobalVar(SEQID=${UNIQUEID})
exten => 777,n,Set(CDR(userfield)=${SEQID})

I think the uniqueid is already in CDR(uniqueid) so there is no need to copy UNIQUEID into CDR(userfield).

If you cannot see it in the the mysql cdr database try adding
to the top of cdr_addon_mysql.c

If you really need it in the userfield then I think you will need to edit the core_get_config function in modules/core/functions.inc.php