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] hyla.conf



hi,
you've to hack the notify.awk script
as it's launched when your fax is done

here's my contribution to the best fax server I've ever seen.
(a screenshot is joined for those who wonder how it looks like...)

it has been in production state for 114 days, (+12000 faxes)

pps: note that my paper format is A4, not tested with other formats
ps: don't forget to ln -s /hylafax/bin/ackheader.pl hylafax/bin/ackheader or
change notify.awk's system call and copy 'logger' to /hylafax/bin

	Franck.

#-----------------------------
# /hylafax/bin/ackheader.pl
#!/usr/bin/perl -w
use strict;

my $LOGGER="bin/logger";
my $nbpages=0;
my $numpage=0;
my $doc = shift || die "I need a file name\n";
my $header = shift || die "I need a header string\n";

my $psheader0="20 815 moveto \n /Helvetica findfont 7 scalefont setfont \n (";
my $psheader1=")\nshow\n";
my $thedate = `date +"%d/%m/%Y %T %Z"`;

my @mysetup =();
my @save_the_setup=();


# the doc
open (INPUT,"<$doc")    or
         (
                 system ("$LOGGER","ackheader:","can't open $doc: $!")
                 && die ("can't open $doc: $! \n")
         );

# get the number of pages
while (<INPUT>){
         if (/%%Page:/){
                 $nbpages++;
         }
}
close ( INPUT );

open (INPUT,"<$doc")    or
         (
                 system ("$LOGGER","ackheader:","can't open $doc: $!")
                 && die ("can't open $doc: $! \n")
         );

# the temp doc to reforge the doc
open (TMP,">$doc.ACK")  or
         (
         system ("$LOGGER","ackheader:","can't create $doc.ACK: $! ")
             && die ("can't create $doc.ACK: $!\n")
         );

while (<INPUT>){
     chomp;
     if (/\/mysetup/){
         # change the page height if too high
         @save_the_setup = split(/ /);
         @mysetup= @save_the_setup;
         #for (my $i=0;$i<$#mysetup;$i++){
     #       print "$i: $mysetup[$i] ";
     #   }
     #   print "\n";
         if ($mysetup[7] > 813){
             $mysetup[7]=813;
             print TMP "@mysetup\n";
         }
         else{
             print TMP "@save_the_setup\n";
         }
     }
     else{
         print TMP "$_\n";
         if (/%%Page:/){
             $numpage++;
             print TMP "$psheader0 $thedate $header";
             print TMP " - Page: $numpage / $nbpages";
             print TMP "$psheader1\n";
         }
     }
}

close ( INPUT );
close ( TMP );

# I do not want to loose any doc :]
system ("mv $doc $doc.SAV") or
         (
                 system ("$LOGGER","ackheader:","renaming $doc to $doc.SAV")
                 && die("Can't rename $doc to $doc.SAV: $!\n")
         );


system ("mv $doc.ACK $doc") or
         (
                 system ("$LOGGER","ackheader:","renaming $doc.ACK to $doc")
         );

system ("chown uucp:60002 $doc") or
         (
                 system ("$LOGGER","ackheader:","chowning $doc to uucp:60002")
                 && die("Can't chown $doc to uucp:60002: $!\n")
         );

system ("rm -f $doc.SAV") or
         (
                 system ("$LOGGER","ackheader:","deleting $doc.SAV")
                 && warn("Can't delete $doc.SAV: $!\n")
         );
# eof
#----------------------------------------------------------------------------
# /hylafax/bin/notify.awk
# what I changed is between '<frbn date>' and '</frbn date>'

# ...

function printStatus(s)
{
     if (s == "")
     print "<no reason recorded>";
     else
     print s
}
#<frbn 26/06/02>
function ackheader(jobid,status,receiver,aheader)
{
     system("bin/logger \"docq/doc" jobid " status:" status " receiver:" receiver " [" number "]\"" );
     system("bin/ackheader docq/doc" jobid " \" - job: " jobid " - status: " status " - To: " receiver "  [" number "]\" 
  --  " );
     system("bin/insert doneq/q" jobid );
}
#</frbn 26/06/02>


function putHeaders(subject)
{
     print "To: " mailaddr;
     print "Subject: " subject;
     print "";
     printf "Your " jobType " job to " company " : " receiver " (" number ") ";
}

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; }

# <frbn 15/05/02>
/^receiver/ { receiver = $2; }
/^company/  { company = $2; }
# </frbn 15/05/02>

# ...

/^[!]*post/ { files[nfiles++] = $4; }
/^[!]*tiff/ { files[nfiles++] = $4; }
/^[!]*pcl/  { files[nfiles++] = $4; }
/^page:/    { pins[npins++] = $4; }
/^[!]page:/   { pagernum = $4; }
/^data:/    { files[nfiles++] = $4; }
/^poll/     { poll = " -p"; }
END {

     #<frbn 28/06/02>
     ackheader(jobid,why,receiver,number);
     #</frbn 28/06/02>

# ...
#-----------------------------------------------

nadine.mauch@fnac.net a écrit:
> Hello,
> 
> I would like to configure my Hylafax server to send (to print)
> the name of sender on top of facsimile page on the left corner
> where "fax recu de :" is written.
> 
> I've initialized the variable From: in hyla.conf but
> the information does not appear.
> I send my fax without cover page (not to lost paper)
> and it would be informative to print that.
> ---------------------------------------------------------------------
> 
> How can I disable the notifiing by mail when a document
> has correctly been sent ?
> I've read that the options for Notify are done, none,
> requeued, or default.
> Why not "when rejected" or "when maxdials" or
> "when maxtries" ?
> If you have the same case, how do you do ?
> ---------------------------------------------------------------------
> 
> Thanks. Goodbye
> 
> Nadine
> 
> 
> ____________________ 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@hylafax.org < /dev/null
>  *To learn about commercial HylaFAX(tm) support, mail sales@hylafax.org.*
> 


ackheader.png




Project hosted by iFAX Solutions