[input]
exten => s,1,Set(D1=${STRFTIME(${EPOCH},,%Y%m)})
exten => s,n,Set(D3=${STRFTIME(${EPOCH},,%d)})
exten => s,n,Set(D2=${STRFTIME(${EPOCH},,%H%M)})
exten => s,n,Set(Fo1=${CALLERID(number)})
exten => s,n,Set(Fo3=${STRFTIME(${EPOCH},,%H%M%S)})
exten => s,n,Set(PATH_FN=/billing/asterisk_wav/input/${D1}/${D3}/${D2}-${Fo1}-${Fo3})
exten => s,n,MixMonitor(${PATH_FN}.wav)
exten => s,n,Answer
exten => s,n,Dial(SIP/310,25)
exten => s,n,Goto(310-${DIALSTATUS},1)
;exten => s,n,Hangup
exten => 310-CHANUNAVAIL,1,Dial(SIP/311,15)
exten => 310-CHANUNAVAIL,2,Goto(311-${DIALSTATUS},1)
exten => 310-CHANUNAVAIL,3,Hangup
exten => 310-BUSY,1,Dial(SIP/311,15)
exten => 310-BUSY,2,Goto(311-${DIALSTATUS},1)
exten => 310-BUSY,3,Hangup
exten => 310-NOANSWER,1,Dial(SIP/311,15)
exten => 310-NOANSWER,2,Goto(311-${DIALSTATUS},1)
exten => 310-NOANSWER,3,Hangup
exten => 311-CHANUNAVAIL,1,Dial(SIP/301,15)
exten => 311-CHANUNAVAIL,2,Goto(301-${DIALSTATUS},1)
exten => 311-CHANUNAVAIL,3,Hangup
exten => 311-BUSY,1,Dial(SIP/301,15)
exten => 311-BUSY,2,Goto(301-${DIALSTATUS},1)
exten => 311-BUSY,3,Hangup
exten => 311-NOANSWER,1,Dial(SIP/301,15)
exten => 311-NOANSWER,2,Goto(301-${DIALSTATUS},1)
exten => 311-NOANSWER,3,Hangup
exten => 301-CHANUNAVAIL,1,Dial(SIP/314,15)
exten => 301-CHANUNAVAIL,2,Goto(314-${DIALSTATUS},1)
exten => 301-CHANUNAVAIL,3,Hangup
exten => 301-BUSY,1,Dial(SIP/314,15)
exten => 301-BUSY,2,Goto(314-${DIALSTATUS},1)
exten => 301-BUSY,3,Hangup
exten => 301-NOANSWER,1,Dial(SIP/314,15)
exten => 301-NOANSWER,2,Goto(314-${DIALSTATUS},1)
exten => 301-NOANSWER,3,Hangup
exten => 314-CHANUNAVAIL,1,Dial(SIP/313,15)
exten => 314-CHANUNAVAIL,2,Goto(313-${DIALSTATUS},1)
exten => 314-CHANUNAVAIL,3,Hangup
exten => 314-BUSY,1,Dial(SIP/313,15)
exten => 314-BUSY,2,Goto(313-${DIALSTATUS},1)
exten => 314-BUSY,3,Hangup
exten => 314-NOANSWER,1,Dial(SIP/313,15)
exten => 314-NOANSWER,2,Goto(313-${DIALSTATUS},1)
exten => 314-NOANSWER,3,Hangup