Set device to a busy or DND state

Thanks for that David,

I have went down the route of setting a value in the astDB to handle this:

My context for inbound is:
[sip-incoming-calls]
exten => _X.,1,Answer
exten => _X.,n,Queue(cc-queue,t,60)
exten => _X.,n,Dial(${siptrunk}/012345678910)
exten => _X.,n,hangup

and for my DND functionality:
[DND]
exten => *99,1,Macro(DND)
exten => *99,n,hangup

[macro-DND]
exten => s,1,noop(–macro DND device=${CALLERID(name)}–)
exten => s,n,GotoIf(${DB_EXISTS(DND/"${CALLERID(name)}")}?disabled-dnd,1)
exten => s,n,Set(DB(DND/"${CALLERID(name)}")=“1”) ;There was no entry on AstDB, so We active your DND
exten => s,n,playback(do-not-disturb)
exten => s,n,playback(activated)
exten => s,n,hangup

exten => disabled-dnd,1,noop(–DND Deactivated–)
exten => disabled-dnd,n,DBdel(DND/"${CALLERID(name)}") ; You are disabling your DND
exten => disabled-dnd,n,playback(do-not-disturb)
exten => disabled-dnd,n,playback(de-activated)
exten => disabled-dnd,n,hangup

exten => h,1,hangup

When calling *99 the activated and de-activated playback is successful. However in my inbound context where the call goes into a queue how do I check the astDB to find if the device that is being rung has the DND activated.

Thanks
Chad