[asterisk-users] Sending Fax Dialplan with Retry Attempt

Zoel Hairi zoelhairi at yahoo.co.id
Mon Dec 19 10:20:36 CST 2011


> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
> bounces at lists.digium.com] On Behalf Of Stefan Schmidt
> Sent: Monday, December 19, 2011 8:32 PM
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> Subject: Re: [asterisk-users] Sending Fax Dialplan with Retry Attempt
> 
> Am 19.12.11 14:26, schrieb Zoel Hairi:
> > 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 :
> > exten => s,n,GotoIf($["${FAXOPT(error)}" =
> "NO_ERROR"]?FaxStop:RetryAttempt2)
> >
> > ;===================== The Call Stop Here … L
> 
> hello,
> 
> you dont have RetryAttempt2 in your dialplan maybe thats why it stops.
> 
> best regards
> 
> Stefan

Hi Stefan,

Sorry, My Mistake, in dial plan there's already RetryAttempt2

Below is the Correct One :

[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 … 
exten => s,n(RetryAttempt2),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)

So do you have any suggestion ?

Thanks 
ZH






More information about the asterisk-users mailing list