rendered paste body; extensions.conf
[out-AVATAR]
include=>phones
exten=>_XXXXXXX,1,Macro(PFL,${EXTEN},n,0)
; macros.inc
[macro-PFL]
; params: exten,secret,timeout
exten=s,1,GotoIf($[${ARG2} = n]?3:2)
exten=s,2,Authenticate(${ARG2})
exten=s,3,GotoIf($[${ARG3} = 0]?4:7)
exten=s,4,SetVar(timeout=0)
exten=s,5,SetVar(options=Tt)
exten=s,6,Goto(9)
exten=s,7,SetVar(timeout=300)
exten=s,8,SetVar(options=TtL(300:10000))
exten=s,9,ResetCDR
exten=s,10,AbsoluteTimeout(${timeout})
exten=s,11,SetAccount(0)
exten=s,12,Dial(Zap/g2/${ARG1},120|${options})
exten=s,13,Congestion(5)
exten=s,14,Goto(9)
exten=T,1,ResetCDR(w)
exten=T,2,NoCDR
exten=T,3,Hangup
exten=t,1,ResetCDR(w)
exten=t,2,NoCDR
exten=t,3,Hangup