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] Archive send fax
oui, il faut modifier le fichier notify.awk.
voici une copie :
############################################################################
#################################
#! /bin/sh
# $Id: notify.awk,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.
#
# 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.
#
#
# Awk support program for notify shell script. This
# stuff is broken out into a separate file to avoid
# overflowing the exec arg list on some systems like SCO.
#
#
# Modified to send pdf attachment with notification email. Also archives
# all faxes,
# success and failure in seperate dir's in pdf format.
# PDF's are stored in /var/spool/hylafax/pdfs and
# /var/spool/hylafax/pdfs/failed
#
# Also statement for smbfax/winbind users to strip domain for mail delivery
#
#
#
function printItem(fmt, tag, value)
{
printf "%14s: " fmt "\n", tag, value;
}
function printBanner(banner)
{
print "";
print " ---- " banner " ----";
print "";
}
function docType(s)
{
if (match(s, "\.cover"))
return "PostScript cover page";
else if (match(s, "\.ps"))
return "PostScript";
else if (match(s, "\.tif"))
return "TIFF";
else if (match(s, "\.pcl"))
return "PCL";
else
return "Unknown document type";
}
#
# Construct a return-to-sender message.
#
function returnToSender()
{
printBanner("Unsent job status");
printItem("%s", "Destination", number);
printItem("%s", "JobID", jobid);
printItem("%s", "GroupID", groupid);
printItem("%s", "Sender", sender);
printItem("%s", "Mailaddr", mailaddr);
if (commid != "")
printItem("%s", "CommID", commid);
if (modem != "any")
printItem("%s", "Modem", modem);
printItem("%s", "Submitted From", client);
if (jobType == "facsimile") {
printItem("%u (mm)", "Page Width", pagewidth);
printItem("%.0f (mm)", "Page length", pagelength);
printItem("%.0f (lpi)", "Resolution", resolution);
}
printItem("%s", "Status", status == "" ? " (nothing available)"
:status);
printItem("%u (exchanges with remote device)", "Dialogues", tottries);
printItem("%u (consecutive failed calls to destination)",
"Dials",ndials);
printItem("%u (total phone calls placed)", "Calls", totdials);
if (jobType == "facsimile") {
printItem("%u (pages transmitted)", "Pages", npages);
printItem("%u (total pages to transmit))", "TotPages", totpages);
printItem("%u (attempts to send current page)", "Attempts", ntries);
} else if (jobType == "pager") {
if (npins != 0) {
printBanner("Unsent pages submitted for transmission");
for (i = 0; i < npins; i++)
printf "%15s\n", "PIN " pins[i];
}
if (nfiles != 0) {
printBanner("Message text");
while ((getline <files[0]) > 0)
print $0;
close(files[0]);
}
}
}
function returnTranscript()
{
printBanner("Transcript of session follows");
comFile = "log/c" commid;
if ((getline <comFile) > 0) {
do {
if (index($0, "-- data") == 0)
print $0
} while ((getline <comFile) > 0);
close(comFile);
} else {
printf " No transcript available";
if (commid != "")
printf "(CommID c" commid ")";
print ".";
}
}
function printStatus(s)
{
if (s == "")
print "<no reason recorded>";
else
print s
}
function putHeaders(subject)
{
print "MIME-Version: 1.0";
print "Content-Type: multipart/mixed;";
print " boundary=\"----=_NextPart_000_0012_01BF3CD4.528144C0\"";
#
# Uncomment and change to your domain if using smbfax and winbind
# sub(/DOMAIN\+./,"",mailaddr);
#
print "From: Serveur fax <fax>";
print "To: " mailaddr;
print "Subject: " subject;
print "";
print "This is a multi-part message in MIME format.";
print "";
print "------=_NextPart_000_0012_01BF3CD4.528144C0";
print "Content-Type: text/plain;";
print " charset=\"iso-8859-1\"";
print "Content-Transfer-Encoding: 7bit";
print "";
printf "Votre Fax pour le numero de fax: " number "\n";
}
BEGIN { nfiles = 0;
npins = 0;
pagewidth = 0;
pagelength = 0;
resolution = 0;
jobType = "facsimile";
signalrate = "unknown";
dataformat = "unknown";
doneop = "default";
pagernum = "unknown";
commid = "";
}
/^jobid/ { jobid = $2; }
/^groupid/ { groupid = $2; }
/^state/ { state = $2+0; }
/^doneop/ { doneop = $2; }
/^number/ { number = $2; }
/^external/ { number = $2; } # override unprocessed number
/^sender/ { sender = $2; }
/^mailaddr/ { mailaddr = $2; }
/^jobtag/ { jobtag = $2; }
/^jobtype/ { jobType = $2; }
/^status/ { status = $0; sub("status:", "", status);
if (status ~ /\\$/) {
sub("\\\\$", "\n", status);
while (getline > 0) {
status = status $0;
sub("\\\\$", "\n", status);
if ($0 !~ /\\$/)
break;
}
}
}
/^resolution/ { resolution = $2; }
/^npages/ { npages = $2; }
/^totpages/ { totpages = $2; }
/^dirnum/ { dirnum = $2; }
/^commid/ { commid = $2; }
/^ntries/ { ntries = $2; }
/^ndials/ { ndials = $2; }
/^pagewidth/ { pagewidth = $2; }
/^pagelength/ { pagelength = $2; }
/^signalrate/ { signalrate = $2; }
/^dataformat/ { dataformat = $2; }
/^modem/ { modem = $2; }
/^totdials/ { totdials = $2; }
/^tottries/ { tottries = $2; }
/^client/ { client = $2; }
/^[!]*post/ { files[nfiles++] = $4; }
/^!postscipt/ { fichierps = $4; }
/^[!]*tiff/ { files[nfiles++] = $4; }
/^[!]*pcl/ { files[nfiles++] = $4; }
/^page:/ { pins[npins++] = $4; }
/^[!]page:/ { pagernum = $4; }
/^data:/ { files[nfiles++] = $4; }
/^poll/ { poll = " -p"; }
END {
if (jobtag == "")
jobtag = jobType " job " jobid;;
if (doneop == "default")
doneop = "remove";
if (jobType == "pager")
number = pagernum;
if (why == "done") {
putHeaders("Votre fax vers " number " a ete envoye avec succes");
print "";
if (jobType == "facsimile") {
printItem("%u", "Pages", npages);
if (resolution == 196)
printItem("%s", "Quality", "Fine");
else
printItem("%s", "Quality", "Normale");
printItem("%u (mm)", "Page Width", pagewidth);
printItem("%.0f (mm)", "Page Length", pagelength);
printItem("%s", "Signal Rate", signalrate);
printItem("%s", "Data Format", dataformat);
}
if (tottries != 1)
printItem("%s (exchanges with remote device)", "Dialogues",
tottries);
if (totdials != 1)
printItem("%s (total phone calls placed)", "Calls", totdials);
if (modem != "any")
printItem("%s", "Modem", modem);
printItem("%s", "Submitted From", client);
printItem("%s", "JobID", jobid);
printItem("%s", "FichierPS", fichierps);
printItem("%s", "GroupID", groupid);
printItem("%s", "CommID", "c" commid);i
printf "\ntemps du traitment : " jobTime ".\n";
if (status != "") {
print " Additional information:\n " status;
returnTranscript();
}
print "------=_NextPart_000_0012_01BF3CD4.528144C0";
print "Content-Type: application/pdf;";
print " name=\"" number ".pdf\"";
print "Content-Transfer-Encoding: base64";
print "Content-Disposition: inline;";
print " filename=\"" number ".pdf\"";
print "";
system("/usr/bin/ps2pdf /var/spool/hylafax/" files[0] "
/var/spool/hylafax/pdfs/"number".pdf 1>/dev/null 2>/dev/null");
system("/usr/bin/mimencode /var/spool/hylafax/pdfs/"number".pdf");
# print "------=_NextPart_000_0012_01BF3CD4.528144C0";
} else if (why == "failed") {
putHeaders("Votre Fax pour le no " number " a echoue");
printf "\n La cause ::\n ";
printStatus(status);
# returnTranscript();
returnToSender();
print "------=_NextPart_000_0012_01BF3CD4.528144C0";
print "Content-Type: application/pdf;";
print " name=\"" jobtag ".pdf\"";
print "Content-Transfer-Encoding: base64";
print "Content-Disposition: inline;";
print " filename=\"" jobtag ".pdf\"";
print "";
system("/usr/bin/ps2pdf /var/spool/hylafax/" files[0] "
/var/spool/hylafax/pdfs/failed/"number".pdf 1>/dev/null 2>/dev/null");
system("/usr/bin/mimencode /var/spool/hylafax/pdfs/failed/"
number".pdf");
} else if (why == "rejected") {
putHeaders("Votre Fax pour le no " number " a echoue");
printf "\n La cause :\n ";
printStatus(status);
returnToSender();
print "------=_NextPart_000_0012_01BF3CD4.528144C0";
print "Content-Type: application/pdf;";
print " name=\"" jobtag ".pdf\"";
print "Content-Transfer-Encoding: base64";
print "Content-Disposition: inline;";
print " filename=\"" jobtag ".pdf\"";
print "";
system("/usr/bin/ps2pdf /var/spool/hylafax/" files[0] "
/var/spool/hylafax/pdfs/failed/"number".pdf 1>/dev/null 2>/dev/null");
system("/usr/bin/mimencode /var/spool/hylafax/pdfs/failed/"
number".pdf");
} else if (why == "blocked") {
putHeaders("Votre fax pour le no " number " a ete bloque");
printf "\n la cause :\n ";
printStatus(status);
print "";
print "Je vais essayer d emettre le fax le plus rapidement possible."
print "------=_NextPart_000_0012_01BF3CD4.528144C0";
print "Content-Type: application/pdf;";
print " name=\"" jobtag ".pdf\"";
print "Content-Transfer-Encoding: base64";
print "Content-Disposition: inline;";
print " filename=\"" jobtag ".pdf\"";
print "";
system("/usr/bin/ps2pdf /var/spool/hylafax/" files[0] "
/var/spool/hylafax/pdfs/failed/"number".pdf 1>/dev/null 2>/dev/null");
system("/usr/bin/mimencode /var/spool/hylafax/pdfs/failed/"
number".pdf");
} else if (why == "requeued") {
putHeaders("Votre fax pour le no " number " a ete mis en file d
attente\n");
printf " La cause :\n ";
printStatus(status);
print "";
print "Je vais reessayez dans " nextTry "."
returnTranscript();
} else if (why == "removed" || why == "killed") {
putHeaders("Votre fax pour le no " number " a ete efface de la file d
attente");
print " .";
if (why == "killed")
returnToSender();
} else if (why == "timedout") {
putHeaders("Votre Fax pour " number " a echoue\n");
print "Le temps MAXI est depasse ! (timeout)\n";
print " Fichier : " , files[0];
returnToSender();
print "------=_NextPart_000_0012_01BF3CD4.528144C0";
print "Content-Type: application/pdf;";
print " name=\"" jobtag ".pdf\"";
print "Content-Transfer-Encoding: base64";
print "Content-Disposition: inline;";
print " filename=\"" jobtag ".pdf\"";
print "";
system("/usr/bin/ps2pdf /var/spool/hylafax/" files[0] "
/var/spool/hylafax/pdfs/failed/"number".pdf 1>/dev/null 2>/dev/null");
system("/usr/bin/mimencode /var/spool/hylafax/pdfs/failed/"
number".pdf");
} else if (why == "format_failed") {
putHeaders("Votre Fax pour le numero " number " a echoue");
print " pour cause de format non reconnu (convertion pas possible)"
print " Le programme utilise etait:\n";
print status "\n";
printf "Verifiez votre format %s.\n", " et caracteres invalides";
returnToSender();
print "------=_NextPart_000_0012_01BF3CD4.528144C0";
print "Content-Type: application/pdf;";
print " name=\"" jobtag ".pdf\"";
print "Content-Transfer-Encoding: base64";
print "Content-Disposition: inline;";
print " filename=\"" jobtag ".pdf\"";
print "";
system("/usr/bin/ps2pdf /var/spool/hylafax/" files[0] "
/var/spool/hylafax/pdfs/failed/"number".pdf 1>/dev/null 2>/dev/null");
system("/usr/bin/mimencode /var/spool/hylafax/pdfs/failed/"
number".pdf");
} else if (why == "no_formatter") {
putHeaders("Votre Fax pour le no " number " a echoue");
print " parce que ";
print "le document n a pas pu etre converti (script non trouve)..";
returnToSender();
} else if (match(why, "poll_*")) {
putHeaders("Note" jobtag);
printf ", la requete a echoue,\n parce que ";
if (why == "poll_rejected")
print "le destinataire a rejete le fax.";
else if (why == "poll_no_document")
print "pas de document a ete transmis.";
else if (why == "poll_failed")
print "Erreur inconnue.";
print "";
printf "Temps de traitement %s.\n", jobTime;
returnTranscript();
} else {
putHeaders("Note " jobtag);
print " quelque chose d inatendu s est produit !"
print " \n Le reste du message est pour un debugage :\n";
print "why: " why;
print "jobTime: " jobTime;
print "nextTry: " nextTry;
print "";
print "Merci de contacter l administrateur.";
returnTranscript();
returnToSender();
}
}
_________________________________
Olivier WHITE
INFO3W
BP40 - 67 134 SCHIRMECK CEDEX
Tel : (33) 3 88 47 42 73
Fax : (33) 3 88 47 42 72
_________________________________
-----Message d'origine-----
De : hylafax-users-bounce@xxxxxxxxxxx
[mailto:hylafax-users-bounce@xxxxxxxxxxx]De la part de Philippe
MALADJIAN
Envoyé : jeu. 25 mars 2004 11:44
À : hylafax-users@xxxxxxxxxxx
Objet : [hylafax-users] Archive send fax
Hello, excuse my bad english.
I'm using hylafax to send the fax in my compagnie with Whfc on the
windows. When i'm sending the fax, i have necessary to preserve the
picture to consult later.
-------
En francais (pas meilleure;)
Bonjour, j'utilise hylafax pour envoyer des fax dans ma société, comme
client nous avons Whfc (qui marche bien) mais j'ai besoin de garder les
images des fax qui ont été envoyés. Est-ce possible.
Philippe
____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*
____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*