[Solved] UserField eq AccountCode

I’ve posted this question over in the FreePBX forums (freepbx.org/forum/freepbx/us … -userfield) since that’s what I’m using. No one is able to help there, so I’m looking here for some guidance.

Because of a requirement of my new billing software, I have a need to set the UserField in my CDR the same as my AccountCode. I have enabled the UserField and can add ‘Set(CDR(userfield)=TEST)’ into my dialplan and have it execute perfectly. The problem I’m running into is that I cannot figure out at what point in the dialplan I can actually reference ${ACCOUNTCODE} in order to run ‘Set(CDR(userfield)=${ACCOUNTCODE})’.

I’ve grepped through /etc/asterisk and /var/lib/asterisk (recursively) for accountcode with no luck.

If someone could at least give me an idea of what to look for, I can probably find it from there.

As always, thank you in advance…

–caw

For asterisk 1.6.1.0, it is never set (the string “ACCOUNTCODE” is not in the source).

${CDR(accountcode)} should contain the value, but, as it is already in the CDR, I don’t see why you would want to copy it to the userfield.

That was it. Two weeks of using the wrong variable because everywhere I read said it could simply be referenced by ${ACCOUNTCODE}. After seeing the actual variable, it makes sense and I should probably have made a logical guess…

I have to set the accountcode string into the userfield because the billing software package uses the userfield instead of accountcode for account identification purposes. Not ideal, I know.

Thank you for your help.