HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-users] Problems with "print incoming faxes"



I receive incoming faxes by mail.. all ok. But i can't print them!!!

This is my /var/spool/hylafax/log/cXXXXXX :

[...]
nov 20 16:50:56.55: [16794]: --> [2:OK]
nov 20 16:50:56.55: [16794]: RECV recv DCN (disconnect)
nov 20 16:50:56.55: [16794]: RECV FAX: bin/faxrcvd
"recvq/fax000000006.tif" "ttyS1" "000000018" ""
nov 20 16:50:56.56: [16794]: RECV FAX: end
nov 20 16:50:56.56: [16794]: SESSION END


And this is my /var/spool/hylafax/bin/faxrcvd :


[... comments ...]

/usr/bin/tiff2ps -a -h 11.1082 -w 7.8543 $FILE | /usr/bin/lpr

if [ $# -lt 4 ]; then
   echo "Usage: $0 file devID commID error-msg [ callID-1 [ callID-2
[ ... [ callID-n ] ] ] ]"
   exit 1
fi

test -f etc/setup.cache || {
   SPOOL=`pwd`
   cat<<EOF

FATAL ERROR: $SPOOL/etc/setup.cache is missing!

The file $SPOOL/etc/setup.cache is not present.  This
probably means the machine has not been setup using the faxsetup(8)
command.  Read the documentation on setting up HylaFAX before you
startup a server system.

EOF
   exit 1
}

ENCODING=base64
MIMENCODE=mimencode
TIFF2PDF=bin/tiff2pdf
TTYCMD=tty

. etc/setup.cache

INFO=$SBIN/faxinfo
FAX2PS=$TIFFBIN/fax2ps
TIFF2PS=tiff2ps
TOADDR=FaxMaster
FROMADDR=fax
TIFFINFO=tiffinfo
NOTIFY_FAXMASTER=always

if $TTYCMD >/dev/null 2>&1; then
   ERRORSTO=`$TTYCMD`
else
   ERRORSTO=/dev/null
fi

FILETYPE=pdf
SENDTO=FaxMaster

HOSTNAME=`hostname`			# XXX no good way to find FQDN
PORT=4559				# XXX no good way to lookup service

FILE="$1"; shift;
DEVICE="$1"; shift;
COMMID="$1"; shift;
MSG="$1"; shift;
COUNT=1
while [ $# -ge 1 ]; do
   eval CALLID$COUNT='$1'
   shift
   COUNT=`expr $COUNT + 1`
done
CIDNUMBER="$CALLID1"
CIDNAME="$CALLID2"
DESTINATION="$CALLID3"

FILENAME=`echo $FILE | $SED -e 's/\.tif//' -e 's/recvq\///'`
SENDER="`$INFO $FILE | $AWK -F: '/Sender/ { print $2 }' 2>$ERRORSTO |
$SED 's/^.//'`"
SUBADDR="`$INFO $FILE | $AWK -F: '/SubAddr/ { print $2 }' 2>$ERRORSTO
| $SED 's/^.//'`"

if [ -f etc/FaxDispatch ]; then
   . etc/FaxDispatch		# NB: FaxDispatch sets SENDTO
fi

encode()
{
   if [ -x "$MIMENCODE" ]; then
	$MIMENCODE < $1 2>$ERRORSTO
   elif [ -x "$UUENCODE" ]; then
	if [ "$ENCODING" = "base64" ]; then
	    $UUENCODE -m $1 $1 | grep -E -v "^begin|^====$" 2>$ERRORSTO
	else
	    $UUENCODE $1 $1 | grep -E -v "^begin|^====$" 2>$ERRORSTO
	fi
   else
	$MIMENCODE < $1 2>$ERRORSTO
   fi
}

if [ -f $FILE ]; then
   case $NOTIFY_FAXMASTER$MSG in
	never*)		NOTIFY_FAXMASTER=no;;
	errors)		NOTIFY_FAXMASTER=no;;
	*)		NOTIFY_FAXMASTER=yes;;
   esac
   if [ "$TOADDR" != "$SENDTO" ] && [ "$NOTIFY_FAXMASTER" != "no" ]; then
	(echo "To: $TOADDR"
	 echo "From: The HylaFAX Receive Agent <$FROMADDR>"
	 echo "Subject: Facsimile received from $SENDER";
	 echo ""
	 echo "$FILE (ftp://$HOSTNAME:$PORT/$FILE):"; $INFO -n $FILE
	echo "ReceivedOn: $DEVICE"
	if [ "$MSG" ]; then
	    echo ""
	    echo "The full document was not received because:"
	    echo ""
	    echo "    $MSG"
	    echo ""
	    echo "    ---- Transcript of session follows ----"
	    echo ""
	    if [ -f log/c$COMMID ]; then
		$SED -e '/-- data/d' \
		 -e '/start.*timer/d' -e '/stop.*timer/d' \
		 log/c$COMMID
	    elif [ -n "$COMMID" ]; then
		echo "    No transcript available (CommID c$COMMID)."
	    else
		echo "    No transcript available."
	    fi
	else
	    echo "    CommID: c$COMMID (ftp://$HOSTNAME:$PORT/log/c$COMMID)"
	fi
	if [ -n "$SENDTO" ]; then
	    echo ""
	    echo "The facsimile was automatically dispatched to: $SENDTO."
	fi
	) 2>$ERRORSTO | $SENDMAIL -f$FROMADDR -oi $TOADDR
   fi
   if [ -n "$SENDTO" ]; then
	(MIMEBOUNDARY="NextPart$$"
	 echo "Mime-Version: 1.0"
	 echo "Content-Type: Multipart/Mixed; Boundary=\"$MIMEBOUNDARY\""
	 echo "Content-Transfer-Encoding: 7bit"
	 echo "To: $SENDTO"
	 echo "From: The HylaFAX Receive Agent <$FROMADDR>"
	 echo "Subject: Facsimile received from $SENDER";
	 echo ""
	 echo "--$MIMEBOUNDARY"
	 echo "Content-Type: text/plain; charset=us-ascii"
	 echo "Content-Transfer-Encoding: 7bit"
	 echo ""
	 $INFO -n $FILE
	 echo "ReceivedOn: $DEVICE"
	 if [ "$MSG" ]; then
	    echo ""
	    echo "The full document was not received because:"
	    echo ""
	    echo "    $MSG"
	    echo ""
	    echo "    ---- Transcript of session follows ----"
	    echo ""
	    if [ -f log/c$COMMID ]; then
		$SED -e '/-- data/d' \
		     -e '/start.*timer/d' -e '/stop.*timer/d' \
		     log/c$COMMID
	    elif [ -n "$COMMID" ]; then
		echo "    No transcript available (CommID c$COMMID)."
	    else
		echo "    No transcript available."
	    fi
	 else
	    echo "    CommID: c$COMMID"
	 fi
	 echo ""
	 echo "--$MIMEBOUNDARY"
	 if [ "$FILETYPE" = "tif" ]; then
	     echo "Content-Type: image/tiff; name=\"$FILENAME.tif\""
	     echo "Content-Description: FAX document"
	     echo "Content-Transfer-Encoding: $ENCODING"
	     echo "Content-Disposition: attachment; filename=\"$FILENAME.tif\""
	     echo ""
	     encode $FILE;
	 elif [ "$FILETYPE" = "pdf" ]; then
	     echo "Content-Type: application/pdf; name=\"$FILENAME.pdf\""
	     echo "Content-Description: FAX document"
	     echo "Content-Transfer-Encoding: $ENCODING"
	     echo "Content-Disposition: attachment; filename=\"$FILENAME.pdf\""
	     echo ""
	     $TIFF2PDF -o $FILE.pdf $FILE
	     encode $FILE.pdf
	     $RM -f $FILE.pdf 2>$ERRORSTO
	 else #  default as Postscript
	     echo "Content-Type: application/postscript; name=\"$FILENAME.ps\""
	     echo "Content-Description: FAX document"
	     echo "Content-Transfer-Encoding: 7bit"
	     echo "Content-Disposition: attachment; filename=\"$FILENAME.ps\""
	     echo ""
	     $FAX2PS $FILE 2>$ERRORSTO
	 fi
	 echo ""
	 echo "--$MIMEBOUNDARY--"
	) 2>$ERRORSTO | $SENDMAIL -f$FROMADDR -oi $SENDTO
   fi
else
   #
   # Generate notification mail for a failed attempt.
   #
   (echo "To: $TOADDR"
    echo "From: The HylaFAX Receive Agent <$FROMADDR>"
    echo "Subject: facsimile not received"
    echo ""
    echo "An attempt to receive facsimile on $DEVICE failed because:"
    echo ""
    echo "    $MSG"
    echo ""
    echo "    ---- Transcript of session follows ----"
    echo ""
    if [ -f log/c$COMMID ]; then
	$SED -e '/-- data/d' \
	     -e '/start.*timer/d' -e '/stop.*timer/d' \
	    log/c$COMMID
    elif [ -n "$COMMID" ]; then
	echo "    No transcript available (CommID c$COMMID)."
    else
	echo "    No transcript available."
    fi
   ) 2>$ERRORSTO | $SENDMAIL -f$FROMADDR -oi $TOADDR
fi


It's strage... if I launch "$ lpr output.ps", it prints output.ps!!! So that I tried to change the line

/usr/bin/tiff2ps -a -h 11.1082 -w 7.8543 $FILE | /usr/bin/lpr

with this one

FILENAME=`echo $FILE | $SED -e 's/\.tif//' -e 's/recvq\///'`
lpr $FILENAME.ps

but nothing...

What's the matter?

Thanks in advance,
Salvo

____________________ HylaFAX(tm) Users Mailing List _______________________
 To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
 *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*




Project hosted by iFAX Solutions