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

[Debian]: Re: Anrufe und Faxe im Attachment



Gerhard Kugler schrieb am Freitag, den 11. Juni 1999:

> da meldet mir mein mutt so schön die eingegangenen Faxe (mgetty) und
> Anrufe (vboxgetty). Die Faxe sind sogar in der drauffolgenden Mail
> vollständig. Ich hätte gern beides in Attachments der mails, um sie
> ohne Umweg hören oder sehen zu können. Wie konfiguriere ich die
> sendenden Programme und dann auch mime?

Faxe werden von /etc/mgetty/new_fax gehandelt, ich hänge einfach mal
das new_fax an, das ich hier selber verwende (eine frühe Fassung des
Skriptes findest Du auch unter
/usr/doc/mgetty-docs/examples/new_fax.mime3).

Analoges gilt für vboxgetty, da braucht man ein Skript namens
vboxmail, wobei ich ebenfalls mein lokales Skript anhänge.

Ach so, dann braucht man natürlich noch vboxplay und printfax, die man 
wie folgt in die Printcap einträgt:

image/x-fax-g3; viewfax -geometry +5+23 %s; test=test -n "$DISPLAY"
image/x-fax-g3;; print=printfax %s
audio/x-vbox; vboxplay %s

Tschoeeee

        Roland

-- 
 * roland@spinnaker.de * http://www.spinnaker.de/ *
 PGP: 1024/DD08DD6D   2D E7 CC DE D5 8D 78 BE  3C A0 A4 F1 4B 09 CE AF
#! /bin/sh -e
#
# $Id: new_fax,v 1.4 1999/01/17 14:56:08 roland Exp $
#
# new_fax <getty-exit-code> <fax-sender-id> <number-of-pages> <page> [<page>..]
#
# This program is called by mgetty, when a fax is received. It sends
# the fax as a multipart/mixed MIME mail to the faxadmin ($ADMIN),
# where every fax page is attached as image/x-fax-g3 (the native
# received format, which is compact and which can be viewed with the
# viewfax command). To view and print a page from your mail reader add
# the following to your ~/.mailcap:
# image/x-fax-g3; viewfax -geometry +5+23 '%s'; test=test -n "$DISPLAY"
# image/x-fax-g3;; print=printfax '%s'
#
# You need the program mmencode for base64 encoding of the fax data,
# which you will find in your metamail distribution.
#
##########################################################################
#
#   Copyright (C) 1995-1999  Roland Rosenfeld <roland@spinnaker.rhein.de>
#
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License as
#   published by the Free Software Foundation; either version 2 of
#   the License, or (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#   General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
##########################################################################

PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin

ADMIN="faxadmin"	# mail address of fax administrator
			# change this to your needs!

SENDMAIL="sendmail"
MIMENCODE="mimencode"

CODE="$1"		# getty exit code 
SENDER="$2"		# fax senders ID
PAGES="$3"		# number of pages
shift 3

umask 077

tmpdir=${TMPDIR:-/tmp}/new_fax.$$
mkdir $tmpdir || exit 1
trap "rm -rf $tmpdir; exit" 0 1 2 3 15

TMPMAIL=$tmpdir/message

BOUNDARY="newfax-`date +%s`-$$"

# Create mail header:
echo "Subject: FAX from $SENDER with $PAGES pages" > $TMPMAIL
echo "Mime-Version: 1.0" >> $TMPMAIL
echo "Content-Type: multipart/mixed; boundary=$BOUNDARY" >> $TMPMAIL
echo "" >> $TMPMAIL

# Create first part of the mail (describing the fax):
echo "--$BOUNDARY" >> $TMPMAIL
echo "Content-Type: text/plain; charset=us-ascii" >> $TMPMAIL
echo "" >> $TMPMAIL
echo "A fax from $SENDER was received at about" >> $TMPMAIL
echo "`date` consisting of $PAGES pages." >> $TMPMAIL
echo "The termination code of the fax program was $CODE." >> $TMPMAIL
echo "The pages are included below." >> $TMPMAIL
echo "" >> $TMPMAIL

# Add every page of the fax to the mail:
for file
do
    echo "--$BOUNDARY" >> $TMPMAIL
    echo "Content-Type: image/x-fax-g3" >> $TMPMAIL
    echo "Content-Transfer-Encoding: base64" >> $TMPMAIL
    FILENAME=`basename $file`
    echo "Content-Disposition: attachment; filename=\"$FILENAME\"" >> $TMPMAIL
    PAGE=`echo $file | sed -e 's/^.*\.//'`
    PAGE=`expr $PAGE + 0`
    echo "Content-Description: Fax page $PAGE" >> $TMPMAIL
    echo "" >> $TMPMAIL

    # base64 encoder:
    $MIMENCODE -b $file >> $TMPMAIL
    
    echo "" >> $TMPMAIL
done

echo "--$BOUNDARY--" >> $TMPMAIL

# Send out the created mail:
$SENDMAIL $ADMIN < $TMPMAIL

exit 0
#! /bin/sh
#
# $Id: vboxmail,v 1.3 1999/01/24 02:09:38 roland Exp $
#
# Usage: vboxmail MESSAGENAME CALLERNAME CALLERID MAIL-TO-ADDRESS
#
# This script is a plug-in-replacement for the vboxmail delivered with
# vbox 2.0, but it does not only send you a notify mail but it appends
# the complete voice message as a MIME attachment of the type
# audio/x-vbox. You will need the following in your mailcap to hear
# the message:
# audio/x-vbox; /usr/local/vbox/bin/vboxplay '%s'
# 
# With some small adjustments (see commented out parts) it should be
# easy to convert the sound to ULAW or WAV format and create an
# audio/ulaw or audio/wav MIME type.
#
##########################################################################
#
#   Copyright (C) 1998-1999  Roland Rosenfeld <roland@spinnaker.rhein.de>
#
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License as
#   published by the Free Software Foundation; either version 2 of
#   the License, or (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#   General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
##########################################################################

MSNAME="${1}"
CALLER="${2}"
CALLID="${3}"
MAILTO="${4}"

SENDMAIL=sendmail
VBOXMODE=vboxmode
VBOXTOAU=vboxtoau
MMENCODE=mimencode

umask 077

tmpdir=${TMPDIR-/tmp}/vboxmail.$$
mkdir $tmpdir || exit 1
trap "rm -rf $tmpdir; exit" 0 1 2 3 15
TMPMAIL=$tmpdir/message

BOUNDARY="vboxmail-`date +%s`-$$"

echo "Subject: New message from ${CALLER} (${CALLID})" > $TMPMAIL
echo "Mime-Version: 1.0" >> $TMPMAIL
echo "Content-Type: multipart/mixed; boundary=$BOUNDARY" >> $TMPMAIL
echo "" >> $TMPMAIL

echo "--$BOUNDARY" >> $TMPMAIL
echo "Content-Type: text/plain; charset=us-ascii" >> $TMPMAIL
echo "" >> $TMPMAIL
$VBOXMODE $MSNAME >> $TMPMAIL
echo "" >> $TMPMAIL

echo "--$BOUNDARY" >> $TMPMAIL
#echo "Content-Type: audio/ulaw" >> $TMPMAIL
echo "Content-Type: audio/x-vbox" >> $TMPMAIL
echo "Content-Transfer-Encoding: base64" >> $TMPMAIL
#echo "Content-Disposition: attachment; filename=\"vbox.au\"" >> $TMPMAIL
echo "Content-Disposition: attachment; filename=\"message.vbox\"" >> $TMPMAIL
echo "" >> $TMPMAIL

#$VBOXTOAU < $MSNAME | $MMENCODE -b >> $TMPMAIL
$MMENCODE -b $MSNAME >> $TMPMAIL

echo "" >> $TMPMAIL

echo "--$BOUNDARY--" >> $TMPMAIL

$SENDMAIL $MAILTO < $TMPMAIL
#! /bin/sh
##
## vboxplay v2.0.0 BETA 4 (02-Jun-97)

#----------------------------------------------------------------------------#
# Usage: vboxplay SAMPLENAME [ VOLUME ]                                      #
#----------------------------------------------------------------------------#

SAMPLE=$1
VOLUME=$2

if [ "$VOLUME" = "" ]
then
        VOLUME=128
fi

   # Replace this with your own play command. You also can use the pvftools
   # (or some other) to convert and play the messages.

#DOPLAY="/usr/local/bin/auplay -audio localhost:0 -volume $VOLUME"
#DOPLAY="autopvf | pvfamp $VOLUME | pvftoau -ulaw 8000 > /dev/audio"

/usr/local/bin/vboxmode $SAMPLE

case $? in

#   2|3|4|6) /usr/local/vbox/bin/vboxtoau <$SAMPLE \
#   	    | autopvf \
#	    | pvfamp $VOLUME \
#	    | pvftoau -ulaw 8000 > /dev/audio
   2|3|4|6) /usr/local/bin/vboxtoau <$SAMPLE 2>/dev/null\
   	    | rplay -v $VOLUME -
            ;;
         *) echo "$0: unknown vbox message format!"
            ;;
esac

# Example with pvftools:
#
# vboxtoau <$SAMPLE | \
#           autopvf | \
#           pvfamp $VOLUME | \
#           pvfcut 0.20 | \
#           pvftoau 8000 | \
#           auplay
#!/bin/sh
#
# $Id: printfax,v 1.3 1999/01/16 18:49:19 roland Exp $
#
# printfax - print G3-FAX pages
#
# printfax [-h|-l] <page1.g3> [page.g3 ...]
#
# This script prints G3 FAX pages that you add on the command line.
# You can specify whether the pages have high resolution (204x196)
# with the option "-h" or low resolution (204x98) with the option
# "-l". If you don't specify the resolution, printfax will try to find
# out it by checking the filename. "fn*" and "FAXn*" is a low
# resolution fax, while "ff*" and "FAXh*" stands for high resolution.
# If printfax still can't find out the resolution, it will fall back
# to high resolution.
#
##########################################################################
#
#   Copyright (C) 1997-1999  Roland Rosenfeld <roland@spinnaker.rhein.de>
#
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License as
#   published by the Free Software Foundation; either version 2 of
#   the License, or (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#   General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
##########################################################################

# Configure for you special needs:

DPI=600			# printer resolution
PRINTCMD="lpr -Ploki"	# print command

# End of configuration section.

if [ $# -eq 0 ]
then
    echo "Usage: $0 [-h|-l] faxfile [faxfile...]"
    exit 1
fi

case $1
in
    -h)
        res=""; shift;;
    -l|-n)
        res="-s"; shift;;
esac

for file 
do
    case `basename $file`
    in
        fn*-*.[0-9][0-9]|FAXn????.[0-9][0-9])
            res="-s";;
        ff*-*.[0-9][0-9]|FAXf????.[0-9][0-9])
            res="";;
    esac

    # convert G3 to PBM, scale page to Din A4 and print it:
    cat $file \
    | g32pbm $res \
    | pnmtops -noturn -dpi $DPI -width 8.268 -height 11.693 \
    | $PRINTCMD
	
done

exit 0

Reply to: