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] incoming faxes as pdf



Here’s part of my log in case someone has some insight:

 

Jan 16 13:07:15.72: [16925]: RECV received frame number 50

Jan 16 13:07:15.86: [16925]: RECV received frame number 51

Jan 16 13:07:16.07: [16925]: RECV received frame number 52

Jan 16 13:07:16.14: [16925]: RECV received frame number 53

Jan 16 13:07:16.14: [16925]: RECV received RCP frame

Jan 16 13:07:16.27: [16925]: --> [10:NO CARRIER]

Jan 16 13:07:16.27: [16925]: <-- [9:AT+FRH=3\r]

Jan 16 13:07:16.37: [16925]: --> [7:CONNECT]

Jan 16 13:07:17.69: [16925]: --> [2:OK]

Jan 16 13:07:17.69: [16925]: RECV recv PPS (partial page signal)

Jan 16 13:07:17.69: [16925]: RECV recv EOP (no more pages or documents)

Jan 16 13:07:17.69: [16925]: RECV received 54 frames of block 1 of page 1

Jan 16 13:07:17.72: [16925]: RECV: 13760 bytes of data, 1069 total lines

Jan 16 13:07:17.72: [16925]: <-- [9:AT+FRS=7\r]

Jan 16 13:07:17.80: [16925]: --> [2:OK]

Jan 16 13:07:17.80: [16925]: <-- [9:AT+FTH=3\r]

Jan 16 13:07:18.67: [16925]: --> [7:CONNECT]

Jan 16 13:07:18.67: [16925]: <-- data [3]

Jan 16 13:07:18.67: [16925]: <-- data [2]

Jan 16 13:07:18.99: [16925]: --> [2:OK]

Jan 16 13:07:18.99: [16925]: RECV send MCF (message confirmation)

Jan 16 13:07:18.99: [16925]: RECV FAX (000000009): from 8703361401, page 1 in 0:20, INF, 3.85 line/mm, 2-D MMR, 14400 bit/s

Jan 16 13:07:18.99: [16925]: RECV FAX (000000009): recvq/fax000000009.tif from 8703361401, route to <unspecified>, 1 pages i$

Jan 16 13:07:18.99: [16925]: <-- [9:AT+FRH=3\r]

Jan 16 13:07:19.37: [16925]: --> [7:CONNECT]

Jan 16 13:07:20.56: [16925]: --> [2:OK]

Jan 16 13:07:20.56: [16925]: RECV recv DCN (disconnect)

Jan 16 13:07:20.56: [16925]: RECV FAX: bin/faxrcvd "recvq/fax000000009.tif" "ttyS0" "000000009" ""

Jan 16 13:07:20.56: [16925]: RECV FAX: end

Jan 16 13:07:20.56: [16925]: SESSION END

 

And here’s my faxrcvd:

 

 

#

# faxrcvd file devID commID error-msg

#

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

}

 

# These settings may not be present in setup.cache if user upgraded and

# didn't re-run faxsetup; we set them before calling setup.cache for

# backward compatibility.

ENCODING=base64

TIFF2PDF=bin/tiff2pdf

TTYCMD=tty

 

. etc/setup.cache

. bin/common-functions

 

INFO=$SBIN/faxinfo

FAX2PS=$TIFFBIN/fax2ps

TIFF2PS=tiff2ps

TOADDR=FaxMaster

FROMADDR=FaxMaster

TIFFINFO=tiffinfo

NOTIFY_FAXMASTER=always

 

#

# Redirect errors to a tty, if possible, rather than

# dev-nulling them or allowing them to creep into

# the mail.

#

if $TTYCMD >/dev/null 2>&1; then

    ERRORSTO=`$TTYCMD`

else

    ERRORSTO=/dev/null

fi

 

#

# Permit various types of attachment types: ps, tif, pdf

# Note that non-ASCII filetypes require an encoder.

# pdf requires tiff2ps and tiff2pdf

# Multiple file types may be specified by separating them with

# whitespace; in that case a separate attachment for each filetype

# will be created.

#

FILETYPE=pdf

SENDTO=

 

#

# 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"; shift;

DEVICE="$1"; shift;

COMMID="$1"; shift;

MSG="$1"; shift;

COUNT=1

while [ $# -ge 1 ]; do

    # The eval has $1 set yet, and this forces a variable-to-variable

    # assignment, allowing us to not need to do escaping

    eval CALLID$COUNT='$1'

    export CALLID$COUNT

    shift

    COUNT=`expr $COUNT + 1`

done

CIDNUMBER="$CALLID1"

CIDNAME="$CALLID2"

DESTINATION="$CALLID3"

 

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

 

SetupPrivateTmp

 

parseFaxInfo $FILE

 

MIMEBOUNDARY="NextPart$$"

 

export FILE

export COMMID

export DEVICE

export MSG

export FROMADDR

export HOSTNAME

export PORT

export SENDTO

export TOADDR

 

 

#

# Apply customizations.  All customizable variables should

# be set to their non-customized defaults prior to this.

#

if [ -f etc/FaxDispatch ]; then

    . etc/FaxDispatch           # NB: FaxDispatch sets SENDTO

fi

 

if [ -f etc/templates/$TEMPLATE/hook.sh ]

then

    # Any hooks that the templates need

    . etc/templates/$TEMPLATE/hook.sh

fi

 

 

## MailWithFAX <type>

## Email the <type> template,adding the attachments according

## to $FILETYPE to $SENDTO

##

## We use the common CreateMailMessage <template> <f1> <t1> <n1> <d1>

## function, creating the file to mail as we go.

MailWithFAX ()

{

    template="etc/templates/$TEMPLATE/faxrcvd-$1.txt"

    files_1=$FILE;

    filetype_1=TIFF;

    nfiles=1;

    for ft in $FILETYPE

    do

        ATTACH_ARGS="$ATTACH_ARGS "`BuildAttachArgs $ft`

    done

    eval CreateMailMessage $template $ATTACH_ARGS \

        2>$ERRORSTO | $SENDMAIL -f"$FROMADDR" -oi "$SENDTO"

 

 

}

 

if [ -f $FILE ]; then

    #

    # Don't send FaxMaster duplicates, and FaxMaster may not even

    # want a message at all, depending on NOTIFY_FAXMASTER.

    #

    case $NOTIFY_FAXMASTER$MSG in

        never*)         NOTIFY_FAXMASTER=no;;

        errors)         NOTIFY_FAXMASTER=no;;

        *)              NOTIFY_FAXMASTER=yes;;

    esac

    if [ "$TOADDR" != "$SENDTO" ] && [ "$NOTIFY_FAXMASTER" != "no" ]; then

        if [ -z "$MSG" ]; then

            CreateMailMessage etc/templates/$TEMPLATE/faxrcvd-notify-success.txt \

                        2>$ERRORSTO | $SENDMAIL -f"$FROMADDR" -oi "$TOADDR"

        else

            CreateMailMessage etc/templates/$TEMPLATE/faxrcvd-notify-error.txt \

 

                        2>$ERRORSTO | $SENDMAIL -f"$FROMADDR" -oi "$TOADDR"

        fi

    fi

    if [ -n "$SENDTO" ]; then

        # Create the document to attache

        if [ -z "$MSG" ]; then

            MailWithFAX success

        else

            MailWithFAX error

        fi

 

    fi

else

    #

    # Generate notification mail for a failed attempt.

    # There is no file to send...

    #

    CreateMailMessage etc/templates/$TEMPLATE/faxrcvd-failure.txt \

        2>$ERRORSTO | $SENDMAIL -f"$FROMADDR" -oi "$TOADDR"

fi

 

CleanupPrivateTmp

 

tiff2pdf $FILE -o $FILE

mv $FILE.pdf /var/spool/hylafax/incoming

 

 

 


From: Travis Risner
Sent: Friday, January 16, 2009 7:01 AM
To: Siri Vias Khalsa
Cc: hylafax-users@xxxxxxxxxxx
Subject: RE: [hylafax-users] incoming faxes as pdf

 

Thanks for the response.  I am in fact looking to store the PDF to a disk.  When I try to insert those lines into faxrcvd, all I get is the .tiff stored in recvq.  Here’s what I’ve inserted at the bottom of my faxrcvd:

 

tiff2pdf $FILE

mv $FILE.pdf /var/spool/hylafax/incoming

 

I’ve given ownership of the directory to uucp:

 

drwxr-xr-x 2 uucp uucp 4096 2009-01-15 16:58 incoming

 

Any clues as to what I’m doing wrong?

 

 


From: Siri Vias Khalsa [mailto:sirivias.khalsa@xxxxxxxxxx]
Sent: Thursday, January 15, 2009 4:46 PM
To: Travis Risner
Cc: hylafax-users@xxxxxxxxxxx
Subject: Re: [hylafax-users] incoming faxes as pdf

 

Do you want it so send the faxes as PDFs in email or do you want them saved on disk as PDFs?
if email, look at the docs: http://hylafax.sourceforge.net/howto/delivery.php#ss4.2

If on disk, just add a couple of lines at the end of the faxrcvd script:
tiff2pdf $FILE                                                #converts to a pdf
mv $FILE.pdf /some/path/faxes_incoming      #moves the PDF where you want

notes:
The user that hylafax runs as, usually uucp needs to have access to create files in the destination folder.
The files come in as TIFF files (this is the file format that the fax protocol uses) and will eventually take up alot of space if you dont archive/delete them

-Siri Vias

On Thu, 2009-01-15 at 16:32 -0600, Travis Risner wrote:

I’m looking for a little help with getting hylafax to save all incoming faxes as a pdf.  I read an article in the archives about someone who uses imagemagick.  I do have imagemagick, but don’t quite understand how to plug the convert command into FaxDispatch.

 
-- 
 
 
-Siri Vias
 
Siri Vias Khalsa
Verifi, Inc.
Senior Systems Administrator
sirivias.khalsa@xxxxxxxxxx
323-655-5789 x125 office
310-498-3975 cell

 




Project hosted by iFAX Solutions