The 'failed' extension

Hello,

I use asterisk auto-dial out by making of call files. Everything works perfectly but I cannot handle BUSY/NO ANSWER events. I try to use “failed” extension within context of outgoing call (from-internal-custom) but without success, it doesn’t go there.

My call file:
channel: Local/079488223@from-internal
callerid: 079488223
Context: ext-local
Extension: 540
Priority: 1

My [from-internal-custom]:
exten => failed,1,Noop(!!!Call is failed, we will recall…)
exten => failed,2,AGI(click2dial.php, retry, ${REASON}, ${c2c_id}, ${c2c_try_n}, ${c2c_retries}, ${c2c_callto}, ${c2c_ext}, ${c2c_context_out})

Log:

[2012-10-30 10:55:45] WARNING[3975]: pbx_spool.c:278 safe_append: Unable to set utime on /var/spool/asterisk/outgoing/079488223-540.call: Operation not permitted
– Attempting call on Local/079488223@from-internal for 540@ext-local:1 (Retry 1)
– Executing [079488223@from-internal:1] Macro(“Local/079488223@from-internal-49a1;2”, “user-callerid,LIMIT,”) in new stack
– Executing [s@macro-user-callerid:1] Set(“Local/079488223@from-internal-49a1;2”, “AMPUSER=079488223”) in new stack
– Executing [s@macro-user-callerid:2] GotoIf(“Local/079488223@from-internal-49a1;2”, “0?report”) in new stack
– Executing [s@macro-user-callerid:3] ExecIf(“Local/079488223@from-internal-49a1;2”, “1?Set(REALCALLERIDNUM=079488223)”) in new stack
– Executing [s@macro-user-callerid:4] Set(“Local/079488223@from-internal-49a1;2”, “AMPUSER=”) in new stack
– Executing [s@macro-user-callerid:5] Set(“Local/079488223@from-internal-49a1;2”, “AMPUSERCIDNAME=”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“Local/079488223@from-internal-49a1;2”, “1?report”) in new stack
– Goto (macro-user-callerid,s,13)
– Executing [s@macro-user-callerid:13] GotoIf(“Local/079488223@from-internal-49a1;2”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,26)
– Executing [s@macro-user-callerid:26] Set(“Local/079488223@from-internal-49a1;2”, “CALLERID(number)=079488223”) in new stack
– Executing [s@macro-user-callerid:27] Set(“Local/079488223@from-internal-49a1;2”, “CALLERID(name)=”) in new stack
– Executing [s@macro-user-callerid:28] Set(“Local/079488223@from-internal-49a1;2”, “CHANNEL(language)=it”) in new stack
– Executing [079488223@from-internal:2] Set(“Local/079488223@from-internal-49a1;2”, “MOHCLASS=default”) in new stack
– Executing [079488223@from-internal:3] Set(“Local/079488223@from-internal-49a1;2”, “_NODEST=”) in new stack
– Executing [079488223@from-internal:4] Gosub(“Local/079488223@from-internal-49a1;2”, “sub-record-check,s,1(out,079488223,)”) in new stack
– Executing [s@sub-record-check:1] GotoIf(“Local/079488223@from-internal-49a1;2”, “1?check”) in new stack
– Goto (sub-record-check,s,6)
– Executing [s@sub-record-check:6] Set(“Local/079488223@from-internal-49a1;2”, “__MON_FMT=WAV”) in new stack
– Executing [s@sub-record-check:7] GotoIf(“Local/079488223@from-internal-49a1;2”, “1?next”) in new stack
– Goto (sub-record-check,s,10)
– Executing [s@sub-record-check:10] ExecIf(“Local/079488223@from-internal-49a1;2”, “0?Return()”) in new stack
– Executing [s@sub-record-check:11] GotoIf(“Local/079488223@from-internal-49a1;2”, “0?out,1”) in new stack
– Executing [s@sub-record-check:12] Set(“Local/079488223@from-internal-49a1;2”, “__REC_STATUS=INITIALIZED”) in new stack
– Executing [s@sub-record-check:13] ExecIf(“Local/079488223@from-internal-49a1;2”, “0?Set(__REC_POLICY_MODE=)”) in new stack
– Executing [s@sub-record-check:14] Set(“Local/079488223@from-internal-49a1;2”, “NOW=1351587345”) in new stack
– Executing [s@sub-record-check:15] Set(“Local/079488223@from-internal-49a1;2”, “__DAY=30”) in new stack
– Executing [s@sub-record-check:16] Set(“Local/079488223@from-internal-49a1;2”, “__MONTH=10”) in new stack
– Executing [s@sub-record-check:17] Set(“Local/079488223@from-internal-49a1;2”, “__YEAR=2012”) in new stack
– Executing [s@sub-record-check:18] Set(“Local/079488223@from-internal-49a1;2”, “__TIMESTR=20121030-105545”) in new stack
– Executing [s@sub-record-check:19] Set(“Local/079488223@from-internal-49a1;2”, “__FROMEXTEN=079488223”) in new stack
– Executing [s@sub-record-check:20] Set(“Local/079488223@from-internal-49a1;2”, “__CALLFILENAME=out-079488223-079488223-20121030-105545-1351587345.7096”) in new stack
– Executing [s@sub-record-check:21] Goto(“Local/079488223@from-internal-49a1;2”, “out,1”) in new stack
– Goto (sub-record-check,out,1)
– Executing [out@sub-record-check:1] ExecIf(“Local/079488223@from-internal-49a1;2”, “1?Set(__REC_POLICY_MODE=)”) in new stack
– Executing [out@sub-record-check:2] GosubIf(“Local/079488223@from-internal-49a1;2”, “0?record,1(exten,079488223,079488223)”) in new stack
– Executing [out@sub-record-check:3] Return(“Local/079488223@from-internal-49a1;2”, “”) in new stack
– Executing [079488223@from-internal:5] Macro(“Local/079488223@from-internal-49a1;2”, “dialout-trunk,1,079488223,”) in new stack
– Executing [s@macro-dialout-trunk:1] Set(“Local/079488223@from-internal-49a1;2”, “DIAL_TRUNK=1”) in new stack
– Executing [s@macro-dialout-trunk:2] GosubIf(“Local/079488223@from-internal-49a1;2”, “0?sub-pincheck,s,1()”) in new stack
– Executing [s@macro-dialout-trunk:3] GotoIf(“Local/079488223@from-internal-49a1;2”, “0?disabletrunk,1”) in new stack
– Executing [s@macro-dialout-trunk:4] Set(“Local/079488223@from-internal-49a1;2”, “DIAL_NUMBER=079488223”) in new stack
– Executing [s@macro-dialout-trunk:5] Set(“Local/079488223@from-internal-49a1;2”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
– Executing [s@macro-dialout-trunk:6] Set(“Local/079488223@from-internal-49a1;2”, “OUTBOUND_GROUP=OUT_1”) in new stack
– Executing [s@macro-dialout-trunk:7] GotoIf(“Local/079488223@from-internal-49a1;2”, “0?nomax”) in new stack
– Executing [s@macro-dialout-trunk:8] GotoIf(“Local/079488223@from-internal-49a1;2”, “0?chanfull”) in new stack
– Executing [s@macro-dialout-trunk:9] GotoIf(“Local/079488223@from-internal-49a1;2”, “0?skipoutcid”) in new stack
– Executing [s@macro-dialout-trunk:10] Set(“Local/079488223@from-internal-49a1;2”, “DIAL_TRUNK_OPTIONS=”) in new stack
– Executing [s@macro-dialout-trunk:11] Macro(“Local/079488223@from-internal-49a1;2”, “outbound-callerid,1”) in new stack
– Executing [s@macro-outbound-callerid:1] ExecIf(“Local/079488223@from-internal-49a1;2”, “0?Set(CALLERPRES()=)”) in new stack
– Executing [s@macro-outbound-callerid:2] ExecIf(“Local/079488223@from-internal-49a1;2”, “0?Set(REALCALLERIDNUM=079488223)”) in new stack
– Executing [s@macro-outbound-callerid:3] GotoIf(“Local/079488223@from-internal-49a1;2”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,6)
– Executing [s@macro-outbound-callerid:6] Set(“Local/079488223@from-internal-49a1;2”, “USEROUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:7] Set(“Local/079488223@from-internal-49a1;2”, “EMERGENCYCID=”) in new stack
– Executing [s@macro-outbound-callerid:8] Set(“Local/079488223@from-internal-49a1;2”, “TRUNKOUTCID=888888”) in new stack
– Executing [s@macro-outbound-callerid:9] GotoIf(“Local/079488223@from-internal-49a1;2”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,12)
– Executing [s@macro-outbound-callerid:12] ExecIf(“Local/079488223@from-internal-49a1;2”, “1?Set(CALLERID(all)=888888)”) in new stack
– Executing [s@macro-outbound-callerid:13] ExecIf(“Local/079488223@from-internal-49a1;2”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [s@macro-outbound-callerid:14] ExecIf(“Local/079488223@from-internal-49a1;2”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [s@macro-outbound-callerid:15] ExecIf(“Local/079488223@from-internal-49a1;2”, “0?Set(CALLERPRES()=prohib_passed_screen)”) in new stack
– Executing [s@macro-dialout-trunk:12] GosubIf(“Local/079488223@from-internal-49a1;2”, “0?sub-flp-1,s,1()”) in new stack
– Executing [s@macro-dialout-trunk:13] Set(“Local/079488223@from-internal-49a1;2”, “OUTNUM=079488223”) in new stack
– Executing [s@macro-dialout-trunk:14] Set(“Local/079488223@from-internal-49a1;2”, “custom=SIP/main-trunk”) in new stack
– Executing [s@macro-dialout-trunk:15] ExecIf(“Local/079488223@from-internal-49a1;2”, “0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default))”) in new stack
– Executing [s@macro-dialout-trunk:16] ExecIf(“Local/079488223@from-internal-49a1;2”, “0?Set(DIAL_TRUNK_OPTIONS=M(confirm))”) in new stack
– Executing [s@macro-dialout-trunk:17] Macro(“Local/079488223@from-internal-49a1;2”, “dialout-trunk-predial-hook,”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit(“Local/079488223@from-internal-49a1;2”, “”) in new stack
– Executing [s@macro-dialout-trunk:18] GotoIf(“Local/079488223@from-internal-49a1;2”, “0?bypass,1”) in new stack
– Executing [s@macro-dialout-trunk:19] ExecIf(“Local/079488223@from-internal-49a1;2”, “0?Set(CONNECTEDLINE(num,i)=079488223)”) in new stack
– Executing [s@macro-dialout-trunk:20] ExecIf(“Local/079488223@from-internal-49a1;2”, “0?Set(CONNECTEDLINE(name,i)=CID:888888)”) in new stack
– Executing [s@macro-dialout-trunk:21] GotoIf(“Local/079488223@from-internal-49a1;2”, “0?customtrunk”) in new stack
– Executing [s@macro-dialout-trunk:22] Dial(“Local/079488223@from-internal-49a1;2”, “SIP/main-trunk/079488223,300,”) in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/main-trunk/079488223
– SIP/main-trunk-0000041d is ringing
– SIP/main-trunk-0000041d is making progress passing it to Local/079488223@from-internal-49a1;2
– Got SIP response 486 “Busy Here” back from 200.200.200.200:5060
– SIP/main-trunk-0000041d is busy
== Everyone is busy/congested at this time (1:1/0/0)
– Executing [s@macro-dialout-trunk:23] NoOp(“Local/079488223@from-internal-49a1;2”, “Dial failed for some reason with DIALSTATUS = BUSY and HANGUPCAUSE = 17”) in new stack
– Executing [s@macro-dialout-trunk:24] Goto(“Local/079488223@from-internal-49a1;2”, “s-BUSY,1”) in new stack
– Goto (macro-dialout-trunk,s-BUSY,1)
– Executing [s-BUSY@macro-dialout-trunk:1] NoOp(“Local/079488223@from-internal-49a1;2”, “Dial failed due to trunk reporting BUSY - giving up”) in new stack
– Executing [s-BUSY@macro-dialout-trunk:2] PlayTones(“Local/079488223@from-internal-49a1;2”, “busy”) in new stack
– Executing [s-BUSY@macro-dialout-trunk:3] Busy(“Local/079488223@from-internal-49a1;2”, “20”) in new stack
== Spawn extension (macro-dialout-trunk, s-BUSY, 3) exited non-zero on ‘Local/079488223@from-internal-49a1;2’ in macro ‘dialout-trunk’
== Spawn extension (from-internal, 079488223, 5) exited non-zero on ‘Local/079488223@from-internal-49a1;2’
[2012-10-30 10:55:54] NOTICE[4871]: pbx_spool.c:353 attempt_thread: Call failed to go through, reason (5) Remote end is Busy
– Executing [h@from-internal:1] Hangup(“Local/079488223@from-internal-49a1;2”, “”) in new stack
[2012-10-30 10:55:54] NOTICE[4871]: pbx_spool.c:356 attempt_thread: Queued call to Local/079488223@from-internal expired without completion after 0 attempts
== Spawn extension (from-internal, h, 1) exited non-zero on ‘Local/079488223@from-internal-49a1;2’

So nobody uses ‘failed’ extension?