#!/bin/sh #---------------------------------------------------------------------------- # post-isdnfax-recvd - run after ISDN fax has been received # # Copyright (c) 2001-2002 Frank Meyer # # Creation: 15.02.2003 jed # Last Update: 02.04.2003 jed # # Parameter: $1 - result code # $2 - CAPI disconnect reason # $3 - number of sender # $4 - called number # $5 - number of pages # $6 - files # # 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. #---------------------------------------------------------------------------- # set file names and pathes fax_spoolpath=/var/spool/fax/incoming fax_logfile=/var/spool/fax/log/fax-empfang-journal.txt fax_tmppath=/tmp # set parameters curr_date=`/bin/date +%d%m%Y%H%M%S` curr_longdate=`/bin/date +%d.%m.%Y` curr_longtime=`/bin/date +%H:%M:%S` # read eisfax configuration . /var/run/eisfax # result code fax_result="$1" # CAPI disconnect reason fax_disconnect="$2" # number of sender # - delete leading spaces # - delete trailing spaces # - replace ' ', '_', '.' with '-' fax_sender=`echo "$3"|sed -e 's/ *//' -e 's/ *$//' -e 's/[ _\.]/-/g'` if [ "$fax_sender" = "" ] then fax_sender="unknown" fi # called number fax_cnumber="$4" # number of pages fax_pages="$5" # file name fax_file="$fax_spoolpath/$6" # convert from TIFF to PDF fax_pdffile="$fax_spoolpath/$curr_date.$fax_pages.$fax_sender.$fax_cnumber.$fax_disconnect.pdf" /usr/bin/fax2pdf "$fax_file" "$fax_pdffile" if [ -f "$fax_pdffile" ] then if [ "$EISFAX_DO_DEBUG" != "yes" ] then # pdf filehas been created - delete original file rm "$fax_file" fi chmod 600 $fax_pdffile fi # write log entry echo $curr_longdate $curr_longtime $fax_sender $fax_pages $curr_date."$idx"of$fax_pages.$fax_cnumber.$fax_disconnect.pbm >> $fax_logfile if [ "$EISFAX_RECEIVE_AUTOMAIL" = "yes" ] then # send fax as mail /usr/bin/faxrcvd-mail-pdf "$EISFAX_RECEIVE_AUTOMAIL_MAILADDR" "$fax_pdffile"|/usr/sbin/sendmail "$EISFAX_RECEIVE_AUTOMAIL_MAILADDR" fi exit 0