Custom field not in CDR for calls initiated by call file


We’re trying to setup an asterisk server with CDR’s on a remote mysql server. The asterisk server makes outbound calls via call files. In our CDR configuration, we have a custom CDR field named “globalID”. For a call file, typically 2 CDRs are created - one for the outbound local channel and another for the context to which the local channel is bound to.

However, the custom CDR field only appears in only one of the pair of CDRs generated. If we use NoCDR() in the context/extension (as shown below), then only 1 CDR is generated, but this CDR doesn’t have the custom CDR field. This is a for a straightforward call initiated from a call file. There’s no call transfer nor is there a call back initiated.

What can we do to create a single CDR for a call file situation where CDR includes the custom field?

call file format (from call file, slightly edited):
Channel: Local/9xx38x90xx@extensions/n
CallerID: 888xx51xxx
MaxRetries: 0
RetryTime: 60
WaitTime: 60
Account: 111111
Context: extensions
Extension: call
Priority: 1
Archive: Yes
SetVar: GlobalID=23300308_134417_2971537

Context/extension (from extensions.conf, highly edited):
exten = s,1,Wait(0)
exten = s,n,Set(CDR(globalid)=${GlobalID})
; exten = s,n,ForkCDR(v)
; exten = s,n,Set(CDR(globalid)=${GlobalID})
exten = s,n,Set(count=0)
exten = s,n,Set(TIMEOUT(digit)=10)
exten = s,n,Set(TIMEOUT(response)=10)
exten = s,n,Goto(loop,1)

exten = loop,1,GotoIf($[${count}<3]?repeat:finish)
exten = loop,n(repeat),Goto(rec,1)
exten = loop,n(finish),Goto(h,1)

exten = rec,1,Set(count=$[${count}+1])
exten = rec,n,NoOp(${count})
exten = rec,n,Background(callbroadcast/${AudioFile})
exten = rec,n(wait),WaitExten

exten = t,1,Goto(h,1)
exten = i,1,Goto(loop,1)
exten = h,1,Set(CDR(globalid)=${GlobalID})
exten = h,n,NoCDR()
exten = h,n,Hangup