Small add to @KonradSC awesome patch.
For some reason 'Log Out' via BLF is not working fast and not lit down lamp instantly on Freeswitch 1.8.7.
Small trick worked for me - generate event with same UUID as call UUID
Something like this
if string.find(agent_name, 'agent+', nil, true) ~= 1 then...