Userfield in CDR not working after upgrade to freepbx 2.7

I’ve just upgraded to freepbx 2.7 and my asterisk stopped populating the userfield information in Master.csv.

I’ve already applied the patch in functions.inc.php as described in that tip:

http://www.freepbx.org/forum/freepbx/tips-and-tricks/storing-did-called-in-cdr-userfield

And it continues not working.

Any help would be greatly appreciated.

Ok I got it to work, but only adding the following to extensions_override_freepbx.conf:

[macro-hangupcall]
exten => s,1,Set(CDR(userfield)=${FROM_DID})
exten => s,n,ResetCDR(w)
exten => s,n,NoCDR()

It didn’t work to add those lines to extensions_custom.conf though.

Anyway, when the user hangs up the call before answer, the field isn’t populated.

Any help would be appreciated.

the macro used to be in extensions.conf which would be overridden by extensions_customer.conf. It was moved out of extensions.conf and auto-generated which means the only way in a conf file to override it is to move it to the _override.conf file like you did.

The change was made so that it would be easier for modules to be added that automatically modified this context though a splice. If you look at the new version of it, it looks like:

[macro-hangupcall]
include => macro-hangupcall-custom
exten => s,1(start),GotoIf($["${USE_CONFIRMATION}"="" | "${RINGGROUP_INDEX}"="" | "${CHANNEL}"!="${UNIQCHAN}"]?skiprg)
exten => s,n,Noop(Cleaning Up Confirmation Flag: RG/${RINGGROUP_INDEX}/${CHANNEL})
exten => s,n(delrgi),dbDel(RG/${RINGGROUP_INDEX}/${CHANNEL})
exten => s,n(skiprg),GotoIf($["${BLKVM_BASE}"="" | "BLKVM/${BLKVM_BASE}/${CHANNEL}"!="${BLKVM_OVERRIDE}"]?skipblkvm)
exten => s,n,Noop(Cleaning Up Block VM Flag: ${BLKVM_OVERRIDE})
exten => s,n(delblkvm),dbDel(${BLKVM_OVERRIDE})
exten => s,n(skipblkvm),GotoIf($["${FMGRP}"="" | "${FMUNIQUE}"="" | "${CHANNEL}"!="${FMUNIQUE}"]?theend)
exten => s,n(delfmrgp),dbDel(FM/DND/${FMGRP}/${CHANNEL})
exten => s,n(theend),Hangup

the purpose of all those labels are explicitly to allow the splice code to be able to splice in new instructions. So for example it would not be hard to add a module that allows you to add what ever you want into the user field, or explicitly the DID. (or add an option into FreePBX that lets you specify you want to do that…)

btw - putting in the patch that you did would break other parts of the marco. If you are going to override it though the _overide.conf file, you need to override the entire macro and be very careful as Asterisk can be very tricky when the same macro is presented twice with differing instructions in the priorities.