Search

Wednesday, October 20, 2010

How to use Fax for Asterisk - Part 3

We also need a mechanism to retry unanswered numbers and capture the retry result.
 
The Asterisk callfile directive 'Maxretries:1' can be used as a simple way to retry unanswered fax numbers.  A value of 1 means that Asterisk will attempt once more.   The default retry interval is 5 min or you can specify one using the RetryTime directive.
 
 
sample.call :
Channel:SIP/85212345678
Callerid:"Test"<11111111>
Maxretries:1
Retrytime:300
Waittime:45
Context:fax
Extension:ffa_faxout
Set:RECEIVER=85212345678
Priority:1
In the extensions.conf, we could capture failure reason in the 'failed' extension.  Asterisk will land this extension if all retries fail.
 
[fax]
exten => failed,1,NoOp(**** HANDLE UNANSWERED CALLFILE ****)
exten => failed,n,NoOp(FAIL_REASON:${REASON})
exten => failed,n,NoOp(DNIS:${RECEIVER})
The variable ${REASON} provides certain useful information about the failure reasons as below.
 
0 - Failed (not busy or congested)
1 - Hung up
3 - Ring timeout
5 - Busy
8 - Congestion
 
We could use AGI to store the reasons and numbers to database to compile an unsuccessful fax report.