It is a common misconception (for some reason) that *78 and *79 is default for enable and disable do not disturb. This has to be configured in your dialplan like everything else:
[dnd]
; Enable DnD
exten => *78,1,Set(DB(SIP/DND/${CALLERID(num)})=1)
exten => *78,n,Playback(beep)
; Disable DnD
exten => *79,1,NoOp(${DB_DELETE(SIP/DND/${CALLERID(num)})})
exten => *79,n,Playback(beep)
And then include in your dial macro/sub:
exten => s,5,Set(LOCAL(dnd)=${DB("SIP/DND"/${ext})})
exten => s,6,Gosubif($[${dnd}]?8:7)
exten => s,7,Dial(${dev},10)
exten => s,8,Gosub(somewhere,s,1(${ext}))
Note that you don’t really need to answer and play the beep file. It’s just a matter of taste.