[Solved] CDR UserField

FreePBX box running Asterisk

I have a need to add data into the CDR’s userfield whenever users place outbound calls.

hostname = localhost
password = **********
user = *********

I found one post where someone said to make sure from-pstn-custom was included into the from-pstn context and create the following in extensions_custom.conf:

exten => s,n,Set(CDR(userfield)=TEST)

When that didn’t work, I changed it to:

exten => s,n,SetCDRUserField(TEST)

That didn’t work either.

I did verify that extensions_custom.conf is being included in extensions.conf

I can’t even verify that the Set(CDR()) command is even running.

Any help or direction you can give would be much appreciated.

The accountcode variable changed in Asterisk 1.6. ${ACCOUNTCODE} has been depricated and replaced with ${CDR(accountcode)}.

My fix:

(1) I copied macro-dialout-trunk into extensions_override_freepbx.conf.
(2) As the second step in the macro, I added “exten => s,n,Set(CDR(userfield)=${CDR(accountcode)})”
(3) Reloaded Asterisk and tested.

I’ve figured out how to get the userfield populated by copying a context or macro to extensions_override_freepbx.conf and modifying it there. So I know the settings for userfield and everything are finally correct.

The next step in getting this problem resolved is figuring out which macro(s) I need to modify to set userfield to account code plus some additional data.

I’ve been trying to trace this down for a day now. Ideas?