Auto Dial Out, Dial, exited non-zero capture

Hello,

I’m new here and Asterisk. Also my English was not so good. I thank you for patience.

We are trying to build an auto dialer solution for GSM Numbers. We almost manage the solution however one thing was remaining as problem.

One of our goal was detecting non used numbers. However we reach face an interesting situation.

In some situations, our outbound dial macro Dial application was exited non zero and falling through to extension then “OutgoingSpoolFailed”, then every variable which available to current call was wanished.

It was not busy, congestion or inavalid. For example if called phone rings but does not answer it was act like this. Or if called number was not valid anymore (carrier was playing a message).

I try to look every available documentation from internet, however I cannot found any solution.

Here my dial out macro


[macro-dialout-trunk]
exten => s,1,Set(DIAL_TRUNK=${ARG1})
exten => s,n,Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(GROUP()=${DIAL_TRUNK})
exten => s,n,GotoIf($[ "${GROUP_COUNT(${DIAL_TRUNK})}" > "${PORTS_${DIAL_TRUNK}}" ]?chanfull)
exten => s,n,Progress
exten => s,n,Ringing
exten => s,n,Dial(sip/${DIAL_TRUNK}/${DIAL_NUMBER},30)
exten => s,n,NoOp(${DIALSTATUS})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(chanfull),Noop(max channels used up)
exten => s-BUSY,1,Noop(Dial failed due to trunk reporting BUSY - giving up)
exten => s-BUSY,n,Hangup()
exten => s-ANSWER,1,Noop(Call successfully answered - Hanging up now)
exten => s-ANSWER,n,Hangup()
exten => s-NOANSWER,1,Noop(Dial failed due to trunk reporting NOANSWER)
exten => s-NOANSWER,n,Hangup()
exten => s-INVALIDNMBR,1,Noop(Dial failed due to trunk reporting Address Incomplete - giving up)
exten => s-INVALIDNMBR,n,Hangup()
exten => s-CHANGED,1,Noop(Dial failed due to trunk reporting Number Changed - giving up)
exten => s-CHANGED,n,Hangup()
exten => _s-.,1,Set(RC=${IF($[${ISNULL(${HANGUPCAUSE})}]?0:${HANGUPCAUSE})})
exten => _s-.,n,Goto(${RC},1)
exten => 17,1,Goto(s-BUSY,1)
exten => 18,1,Goto(s-NOANSWER,1)
exten => 22,1,Goto(s-CHANGED,1)
exten => 23,1,Goto(s-CHANGED,1)
exten => 28,1,Goto(s-INVALIDNMBR,1)
exten => _X,1,Goto(continue,1)
exten => _X.,1,Goto(continue,1)
exten => continue,1,GotoIf($["${OUTFAIL_${ARG1}}" = ""]?noreport)
exten => continue,n,AGI(${OUTFAIL_${ARG1}})
exten => continue,n(noreport),Noop(TRUNK Dial failed due to ${DIALSTATUS} HANGUPCAUSE: ${HANGUPCAUSE} - failing through to other trunks)
exten => continue,n,Set(CALLERID(number)=${AMPUSER})
exten => disabletrunk,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} DISABLED - falling through to next trunk)
exten => bypass,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} BYPASSING because dialout-trunk-predial-hook)
exten => h,1,Macro(hangupcall,)

So? My Question is, is there any way to capture exited non-zero status of the Dial application before the falling trough.

Or is there any other solution.
My Best Regards