How to insert the DID in the userfield in the CDR mysql table

I am running asterisk and FreePBX

I have spent a lot of time trying to figure out how to get the dialed inbound DID into the userfield of the asteriskcdrdb table. I have userfield=1 in cdr_mysql.conf. I beleive that I should be able to accomplish this by puting the following in extensions_custom.conf:

exten => s,1,Set(CDR(userfield)=${EXTEN})

I have tried this and many other ideas with no luck. My userfield remains empty no matter what I try. I have seen posts where people claim to have this working but I have been unable to find any examples that actually work for me. Does anybody have an idea how to accomplish this?

from-pstn has an include of from-pstn-custom as shown below so I assume I did not have to modify my trunk and maybe that is where my mistake lies.

include => from-pstn-custom ; create this context in extensions_custom.conf to include customizations

The above is found in extensions.conf and I was basically just following its instructions to put the customization in extensions_custom.conf.

I did not see the patch you mention, where would I find it?

I can certainly wait to see what you come up with next week.

So you changed the trunk context to from-pstn-custom?

What is the next extension in that context? You need to pass control back to from-pstn.

I am working this out and will be providing the code at the OTTS training. Will blog afterward. Have you seen the patch to add the userfield to reports I uploaded last week?

Send debug log output also so we can help.