Hylafax Mailing List Archives
|
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
[hylafax-users] notify script
Hello list,
is there somebody who can provide me a modified
notify(.awk) script, which is modified so that
sent faxes can be archieved in a /var/sent-fax - folder
or where the fax-confirmation is with attached .jpg
preview ?
i have seen parts of scripts in this list...
who can provide the full script ?
i did modify the faxrcvd script, so that a preview of
the incoming fax is attached as .jpg
you find it attached
thanks to all
thomas
--
Thomas Baumann // Postfach 110115 // D-64216 Darmstadt // <tom@tiri.li>
#!/bin/sh
echo DEFANGED.155
exit
#!/bin/sh
echo DEFANGED.48
exit
#!/bin/sh
echo DEFANGED.156
exit
#! /bin/sh
# $Id: faxrcvd.sh.in,v 1.1 2001/04/15 03:48:16 darren Exp $
#
# HylaFAX Facsimile Software
#
POSTMASTER="The HylaFAX Receive Subsystem <postmaster@mydomain.com>"
#
# faxrcvd file devID commID error-msg destination
#
if [ $# != 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
PS2JPEG=/usr/local/bin/ps2jpeg
UUENCODE=/usr/bin/uuencode
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=tom@tiri.li
if [ -f bin/FaxDispatch ]; then
. bin/FaxDispatch # NB: FaxDispatch sets SENDTO based on $5
fi
(echo "To: $TOADDR"
echo "From: $POSTMASTER"
echo "Subject: [tiri] 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 "
# echo " (ftp://$HOSTNAME:$PORT/log/c$COMMID)"
fi
if [ -n "$SENDTO" ]; then
echo ""
echo "The facsimile was automatically dispatched to: $SENDTO."
fi
) | 2>&1 $SENDMAIL -f"$POSTMASTER" -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: $POSTMASTER"
echo "Subject: [tiri] 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 "
# echo " (ftp://$HOSTNAME:$PORT/log/c$COMMID)"
fi
$FAX2PS $FILE > /tmp/$$.ps 2>/dev/null
$PS2JPEG /tmp/$$.ps /tmp/$$.jpeg 2>/dev/null
echo ""
echo "--$MIMEBOUNDARY"
echo "Content-Type: application/postscript; name=\"fax.$$.ps\""
echo "Content-Description: FAX document"
echo "Content-Transfer-Encoding: base64"
echo "Content-disposition: attachment; filename=\"fax.$$.ps\""
echo ""
$UUENCODE --base64 /tmp/$$.ps fax.$$.ps | grep -v "^begin" | grep -v "^====$"
echo ""
echo "--$MIMEBOUNDARY"
echo "Content-Type: image/jpeg; name=\"fax.$$.jpg\""
echo "Content-Description: FAX document"
echo "Content-Transfer-Encoding: base64"
echo "Content-disposition: attachment; filename=\"fax.$$.jpg\""
echo ""
$UUENCODE --base64 /tmp/$$.jpeg fax.$$.jpg | grep -v "^begin" | grep -v "^====$"
echo ""
echo "--$MIMEBOUNDARY--"
rm /tmp/$$.ps
) | 2>&1 $SENDMAIL -f"$POSTMASTER" -oi $SENDTO
fi
else
#
# Generate notification mail for a failed attempt.
#
(echo "To: $TOADDR"
echo "From: $POSTMASTER"
echo "Subject: [tiri] 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 -f"$POSTMASTER" -oi $TOADDR
fi