DND is a FreePBX concept, not an Asterisk one. For the Asterisk queue system to consider the agent unavailable, without actually trying to call them, they would have to pause themselves in the queue.
Small conclusion: this script actually works as intended! Nice!!!
Now I would have one more small thing:
Is there a way when joining the queue not to play the Join Intro if he has no free agents?
Background is this: i have a personalized audio file for the join intro and the mailbox each. But now I want that when he goes into failover, the Join Intro does not play.