Question around userfield in CDR record

Hi all,

I’ve been digging through some CDR bits and peices lately and a thought occured to me.

Could FreePBX insert the SIP CALLID values into the userfield of the CDR record?

This will help us a lot as we get our CDRs from our Trunk provider and they contain the providers callID. As far as I know there’s no current way to match these with the CDRs from asterisk. However, if the SIP CALL ID of a call down a trunk was stored in the userfield column it would be a simple join in the databases.

Any thoughts?



I’ve finally had a chance to look into my idea and I’ve been tweaking the macro-dialout-trunk on a test system to prove the concept.

exten => h,n,Set(CDR(userfield)=${SIPCALLID})

Will do as required, however, it’s the SIP Call ID of the initial call legs, not the call leg down the trunk. Any ideas on how I get access to the trunk call leg from the dial plan?


Check out this page on the voip-info wiki:

I found your question to be interesting and went researching it a little. The section at the bottom labeled “Extending CDR” seems to have some ideas. Maybe a line or two of dialplan commands at the right places in the context will allow you to Set(CDR(userfield)=${CHANNEL(SIPCALLID)}), for example…

Please let us know what you work out!