[fax]
exten => _329.,1,Set(FAXFILE=/var/spool/asterisk/fax/${UNIQUEID}.tif)
exten => _329.,n,Set(from_addr=${CUT(CHANNEL(from),:,2)})
exten => _329.,n,Set(from_hdr=${IF($[ "${CALLERID(name)}" != "" ]? "\"${CALLERID(name)}\" <${from_addr}>" : ${from_addr} )})
exten => _329.,n,Set(FAXEXTEN=${EXTEN})
exten => _329.,n,Goto(fax_in,s,1)

[home]
include => fax

[fax_in]
exten => s,1,ReceiveFax(${FAXFILE})
exten => h,1,System(/root/fax/fax_receive.pl ${FAXFILE} ${FAXEXTEN:4} '${from_hdr}' '${FAXERROR}')

[fax_out]
;exten => s,1,Wait(7)
exten => s,1,SendFax(${FILE})
exten => h,1,System(/root/fax/fax_spooler.pl "${FILE}" ${FAXSTATUS} "${FAXERROR}" "${REMOTESTATIONID}" "${FAXPAGES}")
exten => failed,1,Set(FAXSTATUS=CALL_FAILED)
exten => failed,n,Set(FAXERROR="${REASON}")
