Fax over PSTN line

Need help to setup fax in asterisk. I have obtained a free fax for asterisk license and have the modules res_fax.so and res_fax_digium.so loaded in asterisk. While trying to recieve a fax from a E1 line send by a normal POTS fax machine i get an error as 3RD_T2_TIMEOUT (FAX_FAILURE_PROTOCOL_ERROR). The “fax show stats” shows digium g711 fax failed due to protocol error. Cannot undertsand why T38 is not chosen and g711 is being used. Also while googling i found a lot of people are saying to modify the sip.conf and udptl.conf files, but do i really need to look in them as i am using a digium TDM board and a E1 line from the telco.

exten => fax,1,Answer()
exten => fax,n,Set(start_time=${STRFTIME(${EPOCH},%Y-%m-%d %H:%M:%S)})
exten => fax,n,Set(NumberCalled=${CALLERID(dnid)})
exten => fax,n,Set(CallingNumber=${CALLERID(ani)})
exten => fax,n,Set(filename=${CALLERID(ani)}_${STRFTIME(${EPOCH},%Y%m%d%H%M%S)})
exten => fax,n,Set(FAXFILE=/var/lib/asterisk/fax/${filename}.tif)
exten => fax,n,wait(6)
exten => fax,n,ReceiveFax(${FAXFILE},f)
exten => fax,n,Hangup()
exten => h,1,NoOp(fax status is—>>>${FAXSTATUS})
exten => h,n,agi(faxagi.php)

Any help will be appreciated.