Here is the dial Macro:
[macro-dial_ext]
exten => s,1,Dial(Sip/${ARG1},20,r)
exten => s,n,GotoIf($["${DIALSTATUS}"="BUSY"]?s-BUSY,1)
exten => s,n,GotoIf($["${DIALSTATUS}"="CHANCONGESTION"]?s-UNAVAIL,1)
exten => s,n,Voicemail(su${ARG1})
exten => s-BUSY,1,Voicemail(sb${ARG1})
exten => s-UNAVAIL,1,Voicemail(su${ARG1})
Here is what the console reports when I dial a phone with DND on:
-- Starting simple switch on 'Zap/26-1'
-- Executing Dial("Zap/26-1", "SIP/1003|20") in new stack
-- Called 1003
-- Got SIP response 486 "Busy Here" back from 192.168.1.203
-- SIP/1003-08197e88 is busy
== Everyone is busy/congested at this time (1:1/0/0)
-- Executing Hangup("Zap/26-1", "") in new stack
== Spawn extension (international, 1003, 102) exited non-zero on 'Zap/26-1'
-- Hungup 'Zap/26-1'