I add
exten => _XXX,1,Macro(user-callerid,SKIPTTL,)
exten => _XXX,2,Gosub(sub-record-check,s,1(out,${EXTEN},))
exten => _XXX,3,Dial(PJSIP/${EXTEN}
I got
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:1] Set("PJSIP/505-0000000c", "TOUCH_MONITOR=1199222200.12") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:2] Set("PJSIP/505-0000000c", "AMPUSER=505") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:3] GotoIf("PJSIP/505-0000000c", "0?report") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:4] ExecIf("PJSIP/505-0000000c", "1?Set(REALCALLERIDNUM=505)") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:5] Set("PJSIP/505-0000000c", "AMPUSER=") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:6] GotoIf("PJSIP/505-0000000c", "0?limit") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:7] Set("PJSIP/505-0000000c", "AMPUSERCIDNAME=") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:8] ExecIf("PJSIP/505-0000000c", "0?Set(__CIDMASQUERADING=TRUE)") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:9] GotoIf("PJSIP/505-0000000c", "1?report") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx_builtins.c: Goto (macro-user-callerid,s,16)
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:16] NoOp("PJSIP/505-0000000c", "Macro Depth is 1") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:17] GotoIf("PJSIP/505-0000000c", "1?report2:macroerror") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx_builtins.c: Goto (macro-user-callerid,s,18)
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:18] GotoIf("PJSIP/505-0000000c", "1?continue") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx_builtins.c: Goto (macro-user-callerid,s,37)
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:37] Set("PJSIP/505-0000000c", "CALLERID(number)=505") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:38] Set("PJSIP/505-0000000c", "CALLERID(name)=necto.random3") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:39] GotoIf("PJSIP/505-0000000c", "0?cnum") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:40] Set("PJSIP/505-0000000c", "CDR(cnam)=necto.random3") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:41] Set("PJSIP/505-0000000c", "CDR(cnum)=505") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-user-callerid:42] Set("PJSIP/505-0000000c", "CHANNEL(language)=en") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [507@default:2] Gosub("PJSIP/505-0000000c", "sub-record-check,s,1(out,507,)") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:1] GotoIf("PJSIP/505-0000000c", "0?initialized") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:2] Set("PJSIP/505-0000000c", "__REC_STATUS=INITIALIZED") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:3] Set("PJSIP/505-0000000c", "NOW=1199222200") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:4] Set("PJSIP/505-0000000c", "__DAY=01") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:5] Set("PJSIP/505-0000000c", "__MONTH=01") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:6] Set("PJSIP/505-0000000c", "__YEAR=2008") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:7] Set("PJSIP/505-0000000c", "__TIMESTR=20080101-211640") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:8] Set("PJSIP/505-0000000c", "__FROMEXTEN=505") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:9] Set("PJSIP/505-0000000c", "__MON_FMT=wav") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:10] NoOp("PJSIP/505-0000000c", "Recordings initialized") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:11] ExecIf("PJSIP/505-0000000c", "1?Set(ARG3=dontcare)") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:12] Set("PJSIP/505-0000000c", "REC_POLICY_MODE_SAVE=") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:13] ExecIf("PJSIP/505-0000000c", "0?Set(REC_STATUS=NO)") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:14] GotoIf("PJSIP/505-0000000c", "3?checkaction") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx_builtins.c: Goto (sub-record-check,s,17)
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [s@sub-record-check:17] GotoIf("PJSIP/505-0000000c", "1?sub-record-check,out,1") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx_builtins.c: Goto (sub-record-check,out,1)
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [out@sub-record-check:1] NoOp("PJSIP/505-0000000c", "Outbound Recording Check from 505 to 507") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [out@sub-record-check:2] Set("PJSIP/505-0000000c", "RECMODE=") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [out@sub-record-check:3] ExecIf("PJSIP/505-0000000c", "1?Goto(routewins)") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx_builtins.c: Goto (sub-record-check,out,7)
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [out@sub-record-check:7] Gosub("PJSIP/505-0000000c", "recordcheck,1(dontcare,out,507)") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [recordcheck@sub-record-check:1] NoOp("PJSIP/505-0000000c", "Starting recording check against dontcare") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [recordcheck@sub-record-check:2] Goto("PJSIP/505-0000000c", "dontcare") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx_builtins.c: Goto (sub-record-check,recordcheck,3)
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [recordcheck@sub-record-check:3] Return("PJSIP/505-0000000c", "") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [out@sub-record-check:8] Return("PJSIP/505-0000000c", "") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] pbx.c: Executing [507@default:3] Dial("PJSIP/505-0000000c", "PJSIP/507") in new stack
[2008-01-01 21:16:40] VERBOSE[7445][C-00000006] app_dial.c: Called PJSIP/507
[2008-01-01 21:16:41] VERBOSE[7445][C-00000006] app_dial.c: PJSIP/507-0000000d is ringing
[2008-01-01 21:16:42] VERBOSE[7445][C-00000006] app_dial.c: PJSIP/507-0000000d answered PJSIP/505-0000000c
[2008-01-01 21:16:42] VERBOSE[7448][C-00000006] bridge_channel.c: Channel PJSIP/507-0000000d joined 'simple_bridge' basic-bridge <0f16be77-2258-4b42-b707-5a7b13f04add>
[2008-01-01 21:16:42] VERBOSE[7445][C-00000006] bridge_channel.c: Channel PJSIP/505-0000000c joined 'simple_bridge' basic-bridge <0f16be77-2258-4b42-b707-5a7b13f04add>
[2008-01-01 21:16:44] VERBOSE[7448][C-00000006] bridge_channel.c: Channel PJSIP/507-0000000d left 'simple_bridge' basic-bridge <0f16be77-2258-4b42-b707-5a7b13f04add>
[2008-01-01 21:16:44] VERBOSE[7445][C-00000006] bridge_channel.c: Channel PJSIP/505-0000000c left 'simple_bridge' basic-bridge <0f16be77-2258-4b42-b707-5a7b13f04add>
[2008-01-01 21:16:44] VERBOSE[7445][C-00000006] pbx.c: Spawn extension (default, 507, 3) exited non-zero on 'PJSIP/505-0000000c'
[2008-01-01 21:16:44] VERBOSE[7445][C-00000006] pbx.c: Executing [h@default:1] Macro("PJSIP/505-0000000c", "hangupcall,") in new stack
[2008-01-01 21:16:44] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-hangupcall:1] GotoIf("PJSIP/505-0000000c", "1?theend") in new stack
[2008-01-01 21:16:44] VERBOSE[7445][C-00000006] pbx_builtins.c: Goto (macro-hangupcall,s,3)
[2008-01-01 21:16:44] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-hangupcall:3] ExecIf("PJSIP/505-0000000c", "0?Set(CDR(recordingfile)=)") in new stack
[2008-01-01 21:16:44] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-hangupcall:4] NoOp("PJSIP/505-0000000c", "PJSIP/507-0000000d monior file= ") in new stack
[2008-01-01 21:16:44] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-hangupcall:5] AGI("PJSIP/505-0000000c", "attendedtransfer-rec-restart.php,PJSIP/507-0000000d,") in new stack
[2008-01-01 21:16:44] VERBOSE[7445][C-00000006] res_agi.c: Launched AGI Script /var/lib/asterisk/agi-bin/attendedtransfer-rec-restart.php
[2008-01-01 21:16:44] VERBOSE[7445][C-00000006] res_agi.c: <PJSIP/505-0000000c>AGI Script attendedtransfer-rec-restart.php completed, returning 0
[2008-01-01 21:16:44] VERBOSE[7445][C-00000006] pbx.c: Executing [s@macro-hangupcall:6] Hangup("PJSIP/505-0000000c", "") in new stack