Comme je l'ai mentionn�, les fax sont transmis par email gr�ce � un client
nomm� relayfax (client). Tous les d�tails sont mentionn�s sur le site de
hylafax:
http://www.hylafax.org/howto/clients/RelayFax.html

Les scripts modifi�s sont joints ci dessous. Vous aurez besoins de convert
(imagemagic) et je crois que c'est tout.

Vous trouverez les scripts originaux dans la mailing list de hylafax mais
ils ne convertissent pas en png. Ils produisent du tiff, pdf, ps, des
formats qui semblent �tre mieux que le png pour les fax...

J'imagine que c'est possible de les am�liorer. N'h�sitez pas � le faire si
le coeur vous en dit... Mais moi j'ai du demander � un pote de m'aider donc
comptez pas trop sur moi..

Antoine

---------------notify----------------------------
#!/bin/sh
#       $Id: notify.sh,v 1.24 1996/06/24 03:06:22 sam Rel $
#
# 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.
#
#
# notify qfile why jobtime [nextTry]
#
# Return mail to the submitter of a job when notification is needed.
#
if [ $# != 3 -a $# != 4 ]; then
    echo "Usage: $0 qfile why jobtime [nextTry]"
    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

QFILE=$1
WHY=$2
JTIME=$3
NEXT=${4:-'??:??'}

/var/spool/hylafax/bin/sendpng $QFILE

($AWK -F: -f bin/notify.awk why=$WHY jobTime=$JTIME nextTry=$NEXT $QFILE ||
{
      echo ""
      echo "Sorry, there was a problem sending notification;"
      echo "something went wrong in the shell script $0."
      echo ""
      exit 1;
  }
) | 2>&1 $SENDMAIL -t -ffax -oi
--------------- notify ---------------------------

---------------sendpng-------------------------
#! /bin/sh

TIFFBIN="/var/spool/hylafax/bin"
MIMENCODE=/usr/bin/mimencode
FAX2PDF=/usr/bin/ps2pdf
INFO=/usr/sbin/faxinfo

STATUS=`cat $1 | grep status`

if [ "$STATUS" = "status:" ]
then

DOCNAME=`cat $1 | grep ps$ | cut -f 4 -d :`
FILE_PS="/var/spool/hylafax/${DOCNAME}"

DOCNAME=`cat $1 | grep cover$ | cut -f 4 -d :`
FILE_COVER="/var/spool/hylafax/${DOCNAME}"

DOCNAME=`cat $1 | grep tif$ | cut -f 4 -d :`
FILE_TIF="/var/spool/hylafax/${DOCNAME}"

SENDERNAME=`cat $1 | grep ^sender |cut -f 2 -d :`
SENDTO=`cat $1 | grep ^mailaddr |cut -f 2 -d :`
JOBID=`cat $1 | grep ^jobid |cut -f 2 -d :`
NUMBER=`cat $1 | grep ^number |cut -f 2 -d :`
FNAME="fax${JOBID}"

#$FAX2PDF $FILE /tmp/$FNAME

    (MIMEBOUNDARY="NextPart$$"
    echo "Mime-Version: 1.0"
    echo "Content-Type: Multipart/Mixed; Boundary=\"$MIMEBOUNDARY\""
    echo "Content-Transfer-Enconding: 7bit"
    echo "To: $SENDERNAME <$SENDTO>"
    echo "From: Hylafax Server <fax>"
    echo "Subject: Fax No ${JOBID} sent to ${NUMBER}";
    echo ""
    FILENAME=notify
    if [ -f $FILE_PS ]
    then
    FILE=$FILE_PS
convert -deconstruction -geometry 50%x50% $FILE ./tmpsend/$FILENAME.%02d.png
             i=0;
             while [ -f "./tmpsend/$FILENAME.`printf %02d $i`.png" ]; do
                TMPFILE=$FILENAME.`printf %02d $i`.png
                echo "--$MIMEBOUNDARY"
                echo "Content-Type: image/png; name=\"$TMPFILE\""
                echo "Content-Description: FAX document"
                echo "Content-Transfer-Encoding: base64"
                echo "Content-Disposition: attachment;
filename=\"$TMPFILE\""
                echo ""
                $MIMENCODE ./tmpsend/$TMPFILE 2>/dev/null
                rm ./tmpsend/$TMPFILE
                i=$(( $i + 1 ))
                done
    fi

    if [ -f $FILE_COVER\;01 ]
    then
        FILE=$FILE_COVER_2
        cp $FILE* $FILE_COVER_2
        convert -deconstruction -geometry 50%x50% $FILE
./tmpsend/$FILENAME.%02d.png
             i=0;
             while [ -f "./tmpsend/$FILENAME.`printf %02d $i`.png" ]; do
                TMPFILE=$FILENAME.`printf %02d $i`.png
                echo ""
                echo "--$MIMEBOUNDARY"
                echo "Content-Type: image/png; name=\"$TMPFILE\""
                echo "Content-Description: FAX document"
                echo "Content-Transfer-Encoding: base64"
                echo "Content-Disposition: attachment;
filename=\"$TMPFILE\""
                echo ""
                $MIMENCODE ./tmpsend/$TMPFILE 2>/dev/null
                rm ./tmpsend/$TMPFILE
                i=$(( $i + 1 ))
                done

        rm $FILE_COVER_2
        fi

    if [ -f $FILE_TIF ]
        then
        FILE=$FILE_TIF
        convert -deconstruction -geometry 50%x50% $FILE
./tmpsend/$FILENAME.%02d.png
             i=0;
             while [ -f "./tmpsend/$FILENAME.`printf %02d $i`.png" ]; do
                TMPFILE=$FILENAME.`printf %02d $i`.png
                echo ""
                echo "--$MIMEBOUNDARY"
                echo "Content-Type: image/png; name=\"$TMPFILE\""
                echo "Content-Description: FAX document"
                echo "Content-Transfer-Encoding: base64"
                echo "Content-Disposition: attachment;
filename=\"$TMPFILE\""
                echo ""
                $MIMENCODE ./tmpsend/$TMPFILE 2>/dev/null
                rm ./tmpsend/$TMPFILE
                i=$(( $i + 1 ))
                done

    fi

    echo "--$MIMEBOUNDARY--"
) | 2>&1 /usr/sbin/sendmail -oi $SENDTO

fi
---------------sendpng----------------------

---------------faxrcvd--------------------------
#! /bin/sh
#       $Id: faxrcvd.sh.in,v 1.4 2002/06/09 01:28:26 darren 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.
#

#
# faxrcvd file devID commID error-msg
#
if [ $# != 6 ]; then
    echo "Usage: $0 file devID commID error-msg CIDNumber CIDName "
    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
MIMENCODE=mimencode
TIFF2PS=tiff2ps
PS2PDF=ps2pdf
TOADDR=FaxMaster
TIFFINFO=tiffinfo

#
# Permit various types of attachment types: ps, tif, pdf
# Note that non-ASCII filetypes require metamail.
# pdf requires tiff2ps and ps2pdf
#
FILETYPE=png
EXT=png
#
# 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"
CIDNUMBER="$5"
CIDNAME="$6"

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

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 etc/FaxDispatch ]; then
        . etc/FaxDispatch       # NB: FaxDispatch sets SENDTO
    fi
    if [ "$TOADDR" != "$SENDTO" ]; then # don't send FaxMaster duplicate
        (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 [ "$CIDNUMBER" ]; then
            echo " CIDNumber: $CIDNUMBER"
            echo ""
        fi
        if [ "$CIDNAME" ]; then
            echo "   CIDName: $CIDNAME"
            echo ""
        fi
        if [ -n "$SENDTO" ]; then
            echo ""
            echo "The facsimile was automatically dispatched to: $SENDTO."
        fi
        ) | 2>&1 $SENDMAIL -ffax -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 <fax>"
         echo "Subject: Facsimile received from $SENDER;"
                $INFO -n $FILE | grep 'Sender:';  $INFO -n $FILE | grep
'Pages:'; $INFO -n $FILE | grep 'Received:';
         echo ""
         if [ "$FILETYPE" = "$EXT" ]; then
                convert -deconstruction -geometry 50%x100% $FILE
./tmpsend/$FILENAME.%02d.$EXT
           i=0;
             while [ -f "./tmpsend/$FILENAME.`printf %02d $i`.$EXT" ]; do
                TMPFILE=$FILENAME.`printf %02d $i`.$EXT
                echo ""
                echo "--$MIMEBOUNDARY"
                echo "Content-Type: image/$EXT; name=\"$TMPFILE\""
                echo "Content-Description: FAX document"
                echo "Content-Transfer-Encoding: base64"
                echo "Content-Disposition: attachment;
filename=\"$TMPFILE\""
                echo ""
                $MIMENCODE ./tmpsend/$TMPFILE 2>/dev/null
                rm ./tmpsend/$TMPFILE
                i=$(( $i + 1 ))
                done
         elif [ "$FILETYPE" = "pdf" ]; then
             echo "Content-Type: application/pdf; name=\"c$COMMID.pdf\""
             echo "Content-Description: FAX document"
             echo "Content-Transfer-Encoding: base64"
             echo "Content-Disposition: attachment;
filename=\"c$COMMID.pdf\""
             echo ""
             GW=`$TIFFINFO $FILE | $GREP "Image Width" | \
                $SED 's/.*Image Width: \([0-9]*\).*/\1/g' | sort -n |
$SED -n '$p'`
             GL=`$TIFFINFO $FILE | $GREP "Image Length" | \
                $SED 's/.*Image Length: \([0-9]*\).*/\1/g' | sort -n |
$SED -n '$p'`
             RW=`$TIFFINFO $FILE | $GREP "Resolution" | \
                $SED 's/.*Resolution: \([0-9]*\).*/\1/g' | sort -n | $SED -n
'$p'`
             RL=`$TIFFINFO $FILE | $GREP "Resolution" | \
                $SED 's/.*Resolution: [0-9]*, \([0-9]*\).*/\1/g' | sort -n |
$SED -n '$p'`
             $TIFF2PS -a -O $FILE.ps $FILE 2>/dev/null # fax2ps looks bad
             $PS2PDF -g$GW\x$GL -r$RW\x$RL $FILE.ps $FILE.pdf 2>/dev/null
             $MIMENCODE $FILE.pdf 2>/dev/null
             $RM -f $FILE.ps $FILE.pdf 2>/dev/null
         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>/dev/null
         fi
         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
--------------------------faxrcvd-------------------------------------

--
http://www-internal.alphanet.ch/linux-leman/ avant de poser
une question. Ouais, pour se d�sabonner aussi.

Répondre à