<span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt"><br />
<span style="font-family: tahoma,arial,sans-serif; font-size: 10pt;"><hr width="100%" size="2" align="center" />
<b>From</b>: "khalid touati" <khalidtouati@gmail.com><br />
<b>Sent</b>: Tuesday, June 21, 2011 9:12 AM<br />
<b>To</b>: "Asterisk Users Mailing List - Non-Commercial Discussion" <asterisk-users@lists.digium.com><br />
<b>Subject</b>: Re: [asterisk-users] Problem with ReceiveFAX app from FFA</span><br />
<br />
Ok, for the variables, I can retrieve some of them like the caller number and so on (I would assume that all the variables that last for duration of call are there), but I still think that I sould not use the h extension to continue after ReceiveFAX use, it's like not a lot of people use FFA, moreover very few came accross such an issue which is fine.<br />
<br />
<hr width="100%" size="2" align="center" />
<br />
<br />
<br />
<p>Here is a receivefax example. Note this is not a complete example just a snip. You have to use the "h" extension if you really want to make it all work. Don't fight it just do it. This is a standard process very similar to how you need to handle returns from "Dial" comands. </p>
<p>f/F option is a special patch written by Kevin @ digium and will not be in the distro unitl 10.x<br />
FAX-MASTER_CHK-FAILED(${CALLERID(number)) FAX-MASTER_DO-FAILED() are database storage macro that stores and get's failed fax attempts so I can force a roll back. Store the fax vars in a database on success and fail. This lets me notify the user for either case. </p>
<p>[fax_inbound_efax]<br />
exten => PFax,1,Set(SIP_CODEC=ulaw)<br />
exten => PFax,n,Set(l_faxoptions=f)<br />
exten => PFax,n,Set(l_faxhasfailed=${FAX-MASTER_CHK-FAILED(${CALLERID(number)},${p_CallSrcTrunk})})<br />
exten => PFax,n,GotoIf($[${l_faxhasfailed}>0]?audioonly:tryt38)<br />
exten => PFax,n(audioonly),Set(l_faxoptions=F)<br />
exten => PFax,n(tryt38),Answer()<br />
exten => PFax,n,Wait(2)<br />
exten => PFax,n,Set(l_faxFile_Base=${STRFTIME(,,%Y%m%d-%H%M)}_${RAND(1)})<br />
exten => PFax,n,Set(l_faxFile_Path=/var/spool/fax_in/)<br />
exten => PFax,n,Set(l_faxFile_FullName=fax_${l_faxFile_Base}.tiff)<br />
exten => PFax,n,Set(l_faxFile=${l_faxFile_Path}${l_faxFile_FullName})<br />
exten => PFax,n,ReceiveFAX(${l_faxFile},${l_faxoptions})</p>
<p>exten => h,1,NoOp(Do Fax Hangup)<br />
exten => h,n,Goto(Do-${FAXOPT(status)},1)</p>
<p>exten => Do-SUCCESS,1,NoOp(Fax Success)<br />
exten => Do-SUCCESS,n,Goto(Do-Store,1)<br />
exten => Do-SUCCESS,n,NoOp(Return from System)</p>
<p>exten => Do-FAILED,1,NoOp(Fax Failed)<br />
exten => Do-FAILED,n,GotoIf($[${l_faxoptions}=f]?DoLogFallback:DoNoFallback)<br />
exten => Do-FAILED,n(DoLogFallback),Set(FAX-MASTER_DO-FAILED()=${CALLERID(number)},${p_CallSrcTrunk})<br />
exten => Do-FAILED,n(DoNoFallback),Goto(Do-Store,1)</p>
<p>exten => Do-Store,1,NoOp(Store Fax Data)<br />
exten => Do-Store,n,GotoIf($["${FAXOPT(rate)}"=""]?DoRate0:DoRate)<br />
exten => Do-Store,n(DoRate0),Set(l_storeRate=0)<br />
exten => Do-Store,n,Goto(DoDisplay)<br />
exten => Do-Store,n(DoRate),Set(l_storeRate=${FAXOPT(rate)})<br />
exten => Do-Store,n(DoDisplay),NoOp(DT = ${STRFTIME(,,%Y-%m-%d %H:%M:%S)})<br />
exten => Do-Store,n,NoOp(Fax Base = ${l_faxFile_Base})<br />
exten => Do-Store,n,NoOp(Switch ID = ${gbl_switchid})<br />
exten => Do-Store,n,NoOp(Account Code = ${gbl_actnumber})<br />
exten => Do-Store,n,NoOp(Line Code = ${gbl_actlineid})<br />
exten => Do-Store,n,NoOp(Caller ID Num = ${CALLERID(number)})<br />
exten => Do-Store,n,NoOp(Caller ID Name = ${CALLERID(name)})<br />
exten => Do-Store,n,NoOp(File Path = ${l_faxFile_Path})<br />
exten => Do-Store,n,NoOp(File Name = ${l_faxFile_FullName})<br />
exten => Do-Store,n,NoOp(opt emc = ${FAXOPT(ecm)})<br />
exten => Do-Store,n,NoOp(opt filename = ${FAXOPT(filename)})<br />
exten => Do-Store,n,NoOp(opt localstationid = ${FAXOPT(localstationid)})<br />
exten => Do-Store,n,NoOp(opt headerinfo = ${FAXOPT(headerinfo)})<br />
exten => Do-Store,n,NoOp(opt remotestationid = ${FAXOPT(remotestationid)})<br />
exten => Do-Store,n,NoOp(opt maxrate = ${FAXOPT(maxrate)})<br />
exten => Do-Store,n,NoOp(opt minrate = ${FAXOPT(minrate)})<br />
exten => Do-Store,n,NoOp(opt rate = ${l_storeRate})<br />
exten => Do-Store,n,NoOp(opt pages = ${FAXOPT(pages)})<br />
exten => Do-Store,n,NoOp(opt resolution = ${FAXOPT(resolution)})<br />
exten => Do-Store,n,NoOp(opt error = ${FAXOPT(error)})<br />
exten => Do-Store,n,NoOp(opt status = ${FAXOPT(status)})<br />
exten => Do-Store,n,NoOp(opt statusstr = ${FAXOPT(statusstr)})<br />
exten => Do-Store,n,"Run some kind of macro or storage/email script here"</p>
<br />
Good luck<br />
<br />
Bryant</span>