Hylafax Mailing List Archives

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

Re: [hylafax-users] Automatic fax printing....!?!



On Mon, 2003-05-19 at 14:46, Josh Welch wrote:
> Shafeer Hajamohideen said:
> > I read that to print the incoming faxes, I just need to drop a line like
> > /usr/bin/tiff2ps -a $FILE | lpr into the faxrcvd script in
> > /usr/spool/fax/bin. I'm not sure when in this script I have to include
> > this line of code. Since i use cups for printing i dropped the command
> > /usr/bin/tiff2ps -a $FILE | lpr -P <printer name> at the begining of the
> > script file. But I don't get this faxes printer to this printer.
> >
> > Do I have to make anyother changes.. like the FaxDispatch ?
> >
> > Regards,
> > Shafeer.
> 
> This partial snippet of my FaxDispatch prints out faxes which come in to
> certain lines:
> 
> #!/bin/sh
> case "$DEVICE" in
> ttyG008)            /usr/bin/tiff2ps -a $FILE | lpr -Pexec;;
> ttyG009)            /usr/bin/tiff2ps -a $FILE | lpr -Pacctg;;
> ttyG010)            /usr/bin/tiff2ps -a $FILE | lpr -Pmktg;;
> esac
> 
> HTH,
> Josh

I have a doubt about faxrcvd. Do I get a email notification when a fax
is recieved? If yes then I don't get one!

My fax/log has a file with fax recieved information;

SESSION BEGIN 00000002 +49.40.77291010
Incoming analog call on controller 1 from 00407729100 to 50.
Connection established.
StationID = +49 40 77291010
BaudRate  = 9600
Flags     = MMR_compr
Write fax in path /var/spool/fax to file recvq/fax00001.tif.
Page 1 was received. - Last Page!
Fax received and calling '/var/spool/fax/bin/faxrcvd
"recvq/fax00001.tif" "faxCAPI" "00000002" "" "+49 40 77291010" "" "50"'.
Connection is droped with reason 0x3400 (No additional information).
SESSION END

My faxrcvd script looks like this ( where i've included a line
/usr/bin/tiff2ps -a $FILE | /usr/bin/lpr -P Verkauf to print the
incoming fax)

#! /bin/sh
#	$Id: faxrcvd.sh.in,v 1.1 2001/04/15 03:48:16 darren Exp $
#
# faxrcvd file devID commID error-msg destination
#
if [ $# -lt 5 ]; then
    echo "Usage: $0 file devID commID error-msg destination"
    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(8C)
command.  Read the documentation on setting up HylaFAX before you
startup a server system.

EOF
    exit 1
}
. etc/setup.cache

INFO=$SBIN/faxinfo
FAX2PS=$TIFFBIN/fax2ps
TOADDR=FaxMaster
#
# There is no good portable way to find out the fully qualified
# domain name (FQDN) of the host or the TCP port for the hylafax
# service so we fudge here.  Folks may want to tailor this to
# their needs; e.g. add a domain or use localhost so the loopback
# interface is used.
#
HOSTNAME=`hostname`			# XXX no good way to find FQDN
PORT=4559				# XXX no good way to lookup service

FILE="$1"
DEVICE="$2"
COMMID="$3"
MSG="$4"

if [ -f $FILE ]; then
    #
    # Check the sender's TSI and setup to dispatch
    # facsimile received from well-known senders.
    #
    SENDER="`$INFO $FILE | $AWK -F: '/Sender/ { print $2 }'
2>/dev/null`"
    SENDTO=
    if [ -f bin/FaxDispatch ]; then
	. bin/FaxDispatch	# NB: FaxDispatch sets SENDTO based on $5
    fi
    (echo "To: $TOADDR"
     echo "From: The HylaFAX Receive Agent <fax>"
     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."
     else
        /usr/bin/tiff2ps -a $FILE | /usr/bin/lpr -P Verkauf
     fi
    ) | 2>&1 $SENDMAIL -ffax -oi $TOADDR
    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 <fax>"
	 echo "Subject: facsimile received from $SENDER";
	 echo ""
	 echo "--$MIMEBOUNDARY"
	 echo "Content-Type: text/plain; charset=us-ascii"
	 echo "Content-Transfer-Encoding: 7bit"
	 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
	 echo ""
	 echo "--$MIMEBOUNDARY"
	 echo "Content-Type: application/postscript"
	 echo "Content-Description: FAX document"
	 echo "Content-Transfer-Encoding: 7bit"
	 echo ""
	 $FAX2PS $FILE 2>/dev/null
	 echo ""
	 echo "--$MIMEBOUNDARY--"
	) | 2>&1 $SENDMAIL -ffax -oi $SENDTO
    fi
else
    #
    # Generate notification mail for a failed attempt.
    #
    (echo "To: $TOADDR"
     echo "From: The HylaFAX Receive Agent <fax>"
     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>&1 $SENDMAIL -ffax -oi $TOADDR
fi

Even after that i don't get any fax printer to this printer. Then I
tried the FaxDispatch script as told in reply to my mail;

#! /bin/sh
# Dispatch fax to email depending on own MSN or extention (ISDN lines)
# sourced from faxrcvd
#
if [ "$5" != "" ]; then
    PHONEMATCH=$5\$
    USERENTRY=`grep -v "^#" etc/users | grep "$PHONEMATCH"`
    if [ "$USERENTRY" != "" ]; then
	USERNAME=`echo $USERENTRY | awk '{print $1}'`
	SENDTO="$USERNAME"
    fi
fi
# Dispatch fax to the shared network printer
case "$DEVICE" in
faxCAPI) /usr/bin/tiff2ps -a $FILE | lpr -PVerkauf
esac

Still I'm no success :( Neither i'm getting a notification mail for the
incoming faxes. Do i miss something here? any suggession are highly
appreciated

Regards,

Shafeer.

> 


____________________ 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@hylafax.org < /dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@hylafax.org.*



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services