SetCDRUserField does not work in screen macro

Hi All,

My requirement is, when a call comes to my extension,
I will tranfer the control to my agent who has to accept the call.
Now I have to keep track of the time when agent has lifted the call, so
for that I am using the my cdr table userField to set that time.

but some reason it does’t work, SetCDRUserField inSide the screen (i.e internalDocument macro).
where as when I keep that SetCDRUserField out side screen(ie. Document macro),
it updates my cdr table with that value.

can some one point me to right direction.

I am below this code.

exten => s,1,Dial(SIP/123…@sip, 60, M(InternalDocumet))

exten => s,1,Read(ACCEPT|/var/lib/asterisk/sounds/pressonetotakecall|1)
exten => s,2,GotoIf($[${ACCEPT} = 1 ]?3:6)
exten => s,3,set(CallAcceptTime=${STRFTIME(${EPOCH},GMT+8,%Y-%m-%d %H:%M:%S)})
exten => s,4,SetCDRUserField(documet-${CallAcceptTime})
exten => s,5,Goto(9)
exten => s,6,SetCDRUserField(" ")
exten => s,7,Playback(/var/lib/asterisk/sounds/agent-busy)
exten => s,9,NOOP(InternalDocument compeleted)

Any help is highly appreciated.

Thanks & Regards,

The reason is because the macro is actually creating a “new call”. You may want to create a variable on the first leg of the call, pass it via the macro to the “second call” (which is the macro) and set them both in a custom field and that way you will know which call is associated with which agent.


Thanks for your quick reply.

but I want to know at what time the agent took the call,
instead of knowing “which call is associated with which agent”.
and I want to store that time to my cdr table in the userfield or
accountcode field.

Any help is highly appreciated.

Thanks & Regards,

Exactly what I was saying or maybe I was not clear enough. You can associate the two calls. Since the screen part is a second call that will record when the agent picks up the phone. On Hangup you then have a script that copies over the pick up time from the “screen call” to the original call.