Thanks for the reply by email. For the benefit of others the code we were using was:
exten => 21,n(logagentoff),Macro(queuelog,${NOW},${UNIQUEID},${QUEUENUMBER},Agent/${AGENTCODE},AGENTCALLBACKLOGOFF,SIP/${DB(QM/Agent/${AGENTCODE})},${LOGONTIME},0)
Which we changed to
exten => 21,n(logagentoff),Macro(queuelog,${NOW},${UNIQUEID},NONE,Agent/${AGENTCODE},AGENTCALLBACKLOGOFF,SIP/${DB(QM/Agent/${AGENTCODE})},${LOGONTIME},0)
This solved the problem.