HylaFAX The world's most advanced open source fax server

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

Re: [hylafax-users] Forward incoming faxes



Hi Milos,

I use a modified faxrcvd:


create an alias for the faxreceiver in your mail system
and you may use this modified /var/spool/fax/bin/faxrcvd as example

... there may be better solutions, but this script is working well for us



---------snip----------------------------------------------------------
#!/bin/sh
#	$Id: faxrcvd.sh,v 1.1.1.1 1998/10/12 20:47:48 root Exp $
#
# HylaFAX Facsimile Software
#
# Copyright (c) 1990-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
# HylaFAX is a trademark of Silicon Graphics
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee,
provided
# that (i) the above copyright notices and this permission notice appear
in
# all copies of the software and related documentation, and (ii) the names
of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY
OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
#
# MODIFIED BY KARL REIMANN 13.03.01
# send all incoming faxes per mail to faxreceiver



# Edit this to your alias who should receive all faxes
SENDTO=your_faxreceiver@yourdomain


#
# faxrcvd file devID commID error-msg
#
if [ $# != 4 ]; then
    echo "Usage: $0 file devID commID error-msg"
    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(1M)
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
BINENCODE="/usr/bin/mmencode"
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
    SENDER="`$INFO $FILE | $AWK -F: '/Sender/ { print $2 }' 2>/dev/null`"
    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: HylaFAX Receive Agent <fax>"
	 echo "Subject: Fax von $SENDER";
	 echo ""
	 echo "--$MIMEBOUNDARY"
	 echo "Content-Type: text/plain; charset=us-ascii"
	 echo "Content-Transfer-Encoding: 7bit"
	 echo ""
	 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 "     FaxId: $COMMID"; $INFO -n $FILE
	 fi
	 echo ""
	 echo "--$MIMEBOUNDARY"
	 echo "Content-Type: image/tiff; name=\"$COMMID.tif\""
	 echo "Content-Description: FAX Document"
	 echo "Content-Disposition: attachment; filename=\"$COMMID.tif\""
	 echo "Content-Transfer-Encoding: base64"
	 echo ""
	 $BINENCODE $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: 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

--------------endsnip---------------------------------------------



*********** REPLY SEPARATOR  ***********

On 28.05.2001 at 18:33 Lee Howard wrote:

>At 09:28 AM 5/28/01 +0200, Puchta, Milos wrote:
>>I have Hylafax and Postfix installation on server. 
>>Faxserver sends messages on [un]delivery to 
>>client's Outlook. I wish the faxserver forwards
>>incoming faxes to all mail recipients. How to
>>retrieve the incoming faxes from recvq directory
>>and send them as mail to mail recipients in the
>>internal network?
>
>I don't know how it's done in postfix, but in sendmail you can create an
>alias that forwards to a list of people, I believe.  Or - it would be
>really easy to set up a simple procmail "mailing-list" of sorts for this
>purpose.
>
>Lee.
>
>
>
>____________________ HylaFAX(tm) Users Mailing List
_______________________
> To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org <
/dev/null




Karlheinz Reimann
Trillian GmbH
k.reimann@trillian.de




____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null




Project hosted by iFAX Solutions