This guide is not complete, and must be adapted to your setup.
This guide is written for asterisk 18.10 running on Ubuntu 22.04
Here are the two main files of asterisk to be changed
/etc/asterisk/pjsip_wizard.conf, add the following lines at the end of the file[ht503] type = wizard accepts_auth = yes accepts_registrations = yes endpoint/context = receivefax aor/max_contacts = 1 aor/qualify_frequency = 30 endpoint/transport = transport-udp endpoint/from_user = ht503 endpoint/identify_by = auth_username endpoint/allow = !all,g722,alaw,ulaw inbound_auth/username = ht503 inbound_auth/password = _the_ht503_sip_password_ identify/endpoint = ht503
[receivefax] exten => ht503,1,Verbose(3,Incoming fax) same => n,Set(datetime=${STRFTIME(,,%Y%m%d-%H%M%S)}) same => n,Set(faxname=fax-${datetime}) ; where we put the TIF same => n,Set(tiffpath=/var/spool/received-faxes/${faxname}.tif) ; get the fax and store the given tif file same => n,ReceiveFAX(${tiffpath}) same => n,System(/usr/local/bin/fax_convert_and_send.sh ${tiffpath} ${faxname} '${REMOTESTATIONID}' ${FAXPAGES} ${CALLERID(num)} ${DID})
#!/bin/bash fax_file=$1 fax_name=$2 fax_remoteid=$3 fax_pages=$4 fax_caller=$5 fax_callee=$6 # fax_dest_email: space separated list of destinations fax_dest_email="destination1@mydest.dom destination2@mydest.dom"" # Directory to publish with apache or nginx outdir=/var/www/html/infaxes errdie() { echo $1 exit } [[ $# -lt 4 ]] && errdie "error: 4 arguments needed" [ -f "$fax_file" ] || errdie "file not found" outfile="$outdir/$fax_name.pdf" dt=`date '+%d/%m/%Y %H:%M:%S'` convert "$fax_file" -pointsize 30 -draw "text 60,70 'Received $dt from $fax_remoteid ($fax_caller)'" "$outfile" echo "Attached FAX." | mutt -a "$outfile" -s "Fax da $fax_remoteid ($fax_caller)" -- $fax_dest_email
mkdir -p /var/www/html/infaxes mkdir -p /var/spool/received-faxes chown asterisk:asterisk /var/www/html/infaxes /var/spool/received-faxes apt install mutt postfix imagemagick
You need also an MTA, postfix for example.
And mutt configuration ~asterisk/.muttrcset copy=no set from="FAX Incoming"