Calling extension using dial macro from custom context

Calling extension using dial macro from custom context

I have a custom context which accepts 4 digit extension number and then call extension using MACRO named dial. The custom context works fine when phone is not DND however when phone is on DND when system tries to call, it diconnects with 3-4 beeps.
Following is my custom context
;exten => s,1,Playback(vm-enter-num-to-call)
exten => s,1,Read(extensao,vm-enter-num-to-call,4)
exten => s,n(start),Gotoif($[ “${LEN(${extensao})}” < “4”]?collect:dialexten)
exten => s,n,NoOp(Executing - ${extensao} - )
exten => s,n(collect),Read(digito,1)
exten => s,n,Set(extensao=${extensao}${digito})
exten => s,n,GoTo(start)
exten => s,n(dialexten),SayDigits(${extensao})
exten => s,n,Macro(dial,${DIAL_OPTIONS},${extensao})
exten => h,1,hangup()

Following is the log message
– Executing [*@ivr-1:1] Goto(“DAHDI/i1/XXXXXXXXX-5ba3”, “calltoextension,s,1”) in new stack
– Goto (calltoextension,s,1)
– Executing [[email protected]:1] Read(“DAHDI/i1/XXXXXXXXX-5ba3”, “extensao,vm-enter-num-to-call,4”) in new stack
– Accepting a maximum of 4 digits.
– <DAHDI/i1/XXXXXXXXX-5ba3> Playing ‘vm-enter-num-to-call.ulaw’ (language ‘en’)
– User entered ‘5089’
– Executing [[email protected]:2] GotoIf(“DAHDI/i1/XXXXXXXXX-5ba3”, “0?collect:dialexten”) in new stack
– Goto (calltoextension,s,7)
– Executing [[email protected]:7] SayDigits(“DAHDI/i1/XXXXXXXXX-5ba3”, “5089”) in new stack
– <DAHDI/i1/XXXXXXXXX-5ba3> Playing ‘digits/5.ulaw’ (language ‘en’)
– <DAHDI/i1/XXXXXXXXX-5ba3> Playing ‘digits/0.ulaw’ (language ‘en’)
– <DAHDI/i1/XXXXXXXXX-5ba3> Playing ‘digits/8.ulaw’ (language ‘en’)
– <DAHDI/i1/XXXXXXXXX-5ba3> Playing ‘digits/9.ulaw’ (language ‘en’)
– Executing [[email protected]:8] Macro(“DAHDI/i1/XXXXXXXXX-5ba3”, “dial,Ttr,5089”) in new stack
– Executing [[email protected]:1] GotoIf(“DAHDI/i1/XXXXXXXXX-5ba3”, “0?dial”) in new stack
– Executing [[email protected]:2] SetMusicOnHold(“DAHDI/i1/XXXXXXXXX-5ba3”, “default”) in new stack
– Executing [[email protected]:3] AGI(“DAHDI/i1/XXXXXXXXX-5ba3”, “dialparties.agi”) in new stack
– Launched AGI Script /opt/asterisk/var/lib/asterisk/agi-bin/dialparties.agi
dialparties.agi: Starting New Dialparties.agi
dialparties.agi: Caller ID name is ‘0XXXXXXXXX’ number is '0XXXXXXXXX’
dialparties.agi: Methodology of ring is ‘none’
– dialparties.agi: Added extension 5089 to extension map
– dialparties.agi: Extension 5089 cf is disabled
== dialparties.agi: Extension 5089 has do not disturb enabled, or followme pre-ring returned busy
– dialparties.agi: Filtered ARG3:
– <DAHDI/i1/XXXXXXXXX-5ba3>AGI Script dialparties.agi completed, returning 0
– Executing [[email protected]:4] NoOp(“DAHDI/i1/XXXXXXXXX-5ba3”, “Returned from dialparties with no extensions to call and DIALSTATUS: BUSY”) in new stack
– Auto fallthrough, channel ‘DAHDI/i1/XXXXXXXXX-5ba3’ status is ‘BUSY’

After Macro is called it checks whether phone is on DND or not. When it is on DND it disconnects. Is there some other MACRO I can use to call internal extension with does all prechecks like CW, CF and DND before dialing.

I am using
Asterisk 11.8.1
CentOS release 6.5 (Final)

Why not just send the call to from-internal?

exten => s,n(dialexten),SayDigits(${extensao})
exten => s,n,Goto(from-internal,${EXTEN},1)

Thanks sanjayws, that works perfect.