[asterisk-users] Sending Fax Dialplan with Retry Attempt
Zoel Hairi
zoelhairi at yahoo.co.id
Mon Dec 19 07:26:12 CST 2011
Hello All,
I have a problem with Fax For Asterisk, the Successful Rate when sending Fax are very Low especially when we send the Fax just once. Now I’m trying to modify the dialplan so it will keep trying to send the fax for maximum 5 times at once and it only retry if the Sending Status has Error in it.
Here is the dialplan :
[fax-tx]
;Fax For Asterisk - Digium
exten => s,1,NoOp(**** SENDING FAX ****)
exten => s,n,Wait(6)
;zoel : Insert to MySQL
exten => s,n,MySQL(Connect connid localhost zzzz zzzz asterisk)
exten => s,n,GotoIf($["${MYSQL_STATUS}" = "0"]?:mysql_error,1)
exten => s,n,MYSQL(Query resultid ${connid} INSERT INTO fax_activity SET date=now(),faxfile="${FAXFILE}",faxtxnumber="${FAXTXNUMBER}",faxresult="Sent to Spooler",faxpages="${FAXPAGES}",faxstatus="${FAXERROR}",faxline="${CHANNEL}")
exten => s,n,MYSQL(Disconnect ${connid})
;zoel : End Insert to MySQL
; Set FAXOPTs
exten => s,n,NoOp(**** SETTING FAXOPT ****)
exten => s,n,Set(FAXOPT(ecm)=yes)
exten => s,n,Set(FAXOPT(headerinfo)=TEST FAX)
exten => s,n,Set(FAXOPT(localstationid)=1234567)
exten => s,n,Set(FAXOPT(maxrate)=14400)
exten => s,n,Set(FAXOPT(minrate)=2400)
; Send the fax
exten => s,n,NoOp(**** SENDING FAX RETRY ATTEMPT 1 : ${FAXFILE} : ${FAXOPT(error)} ****)
exten => s,n,SendFAX(${FAXFILE})
;zoel : Add Retry Attempt 2
exten => s,n,GotoIf($["${FAXOPT(error)}" = "NO_ERROR"]?FaxStop:RetryAttempt2)
;===================== The Call Stop Here … L
exten => s,n,Wait(6)
exten => s,n,NoOp(**** SENDING FAX RETRY ATTEMPT 2 : ${FAXFILE} : ${FAXOPT(error)} ****)
exten => s,n,SendFAX(${FAXFILE})
;zoel : Add Retry Attempt 3
exten => s,n,GotoIf($["${FAXOPT(error)}" = "NO_ERROR"]?FaxStop:RetryAttempt3)
exten => s,n(RetryAttempt3),Wait(6)
exten => s,n,NoOp(**** SENDING FAX RETRY ATTEMPT 3 : ${FAXFILE} : ${FAXOPT(error)} ****)
exten => s,n,SendFAX(${FAXFILE})
;zoel : Add Retry Attempt 4
exten => s,n,GotoIf($["${FAXOPT(error)}" = "NO_ERROR"]?FaxStop:RetryAttempt4)
exten => s,n(RetryAttempt4),Wait(6)
exten => s,n,NoOp(**** SENDING FAX RETRY ATTEMPT 4 : ${FAXFILE} : ${FAXOPT(error)} ****)
exten => s,n,SendFAX(${FAXFILE})
;zoel : Add Retry Attempt 5
exten => s,n,GotoIf($["${FAXOPT(error)}" = "NO_ERROR"]?FaxStop:RetryAttempt5)
exten => s,n(RetryAttempt5),Wait(6)
exten => s,n,NoOp(**** SENDING FAX RETRY ATTEMPT 5 : ${FAXFILE} : ${FAXOPT(error)} ****)
exten => s,n,SendFAX(${FAXFILE})
; Hangup! Print FAXOPTs
exten => s,n(FaxStop),NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})
exten => s,n,NoOp(FAXOPT(filename) : ${FAXOPT(filename)})
exten => s,n,NoOp(FAXOPT(headerinfo) : ${FAXOPT(headerinfo)})
exten => s,n,NoOp(FAXOPT(localstationid) : ${FAXOPT(localstationid)})
exten => s,n,NoOp(FAXOPT(maxrate) : ${FAXOPT(maxrate)})
exten => s,n,NoOp(FAXOPT(minrate) : ${FAXOPT(minrate)})
exten => s,n,NoOp(FAXOPT(pages) : ${FAXOPT(pages)})
exten => s,n,NoOp(FAXOPT(rate) : ${FAXOPT(rate)})
exten => s,n,NoOp(FAXOPT(remotestationid) : ${FAXOPT(remotestationid)})
exten => s,n,NoOp(FAXOPT(resolution) : ${FAXOPT(resolution)})
exten => s,n,NoOp(FAXOPT(status) : ${FAXOPT(status)})
exten => s,n,NoOp(FAXOPT(statusstr) : ${FAXOPT(statusstr)})
exten => s,n,NoOp(FAXOPT(error) : ${FAXOPT(error)})
;zoel : Insert to MySQL fax_activity
exten => s,n,MySQL(Connect connid localhost zzzz zzzz asterisk)
exten => s,n,GotoIf($["${MYSQL_STATUS}" = "0"]?:mysql_error,1)
exten => s,n,MYSQL(Query resultid ${connid} INSERT INTO fax_activity SET date=now(),faxfile="${FAXOPT(filename)}",faxtxnumber="${FAXTXNUMBER}",faxresult="${FAXOPT(status)}",faxpages="${FAXOPT(pages)}",faxstatus="${FAXOPT(error)}",faxline="${CHANNEL}")
exten => s,n,MYSQL(Disconnect ${connid})
;zoel : Insert to MySQL fax_activity
exten => mysql_error,1,Noop("Error Connection Mysql")
exten => mysql_error,n,Macro(hangupcall)
I know the dialplan above is not working cause it keep hangup after SendFax for the 1st time, and it just stop.
So is there any of you guys know how to fix this or is there any otherway so I can achieve it ?
Thanks
Regards,
ZH
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111219/6fc695bd/attachment-0001.htm>
More information about the asterisk-users
mailing list