Just to note, I believe I fixed my issue as well. I am passing device state with queuemetrics login context. So it looks something like this:
; extension 25: agent addqueuemember (for asterisk v1.4+)
exten => 25,1,Answer
exten => 25,2,NoOp( "QM: AddQueueMember (asterisk v1.4+) Agent/${AGENTCODE} on queue ${QUEUENAME} made by '${QM_LOGIN}'" )
exten => 25,3,Macro(queuelog,${EPOCH},${UNIQUEID},NONE,Agent/${AGENTCODE},HOTDESK,SIP/${AGENTCODE}@pbx01)
exten => 25,4,AddQueueMember(${QUEUENAME},Local/${AGENTCODE}@from-queue/n,,,SIP/${AGENTCODE}@pbx01)
exten => 25,5,Hangup
This fixed my issue with transfers not being shown in queue_log and also fixes the device state issue of agents remaining in use after a transfer. I have not put it into production yet but in the labs it is working succesfully.