- fax jobs can be given an addressee and a subject now (resolves #18, reported
by Achim Bohnet) git-svn-id: https://svn.ibp.de/svn/capisuite/trunk/capisuite@135 4ebea2bb-67d4-0310-8558-a5799e421b66
This commit is contained in:
parent
e79f3f0d09
commit
72fc7cf0ad
3
NEWS
3
NEWS
|
@ -17,6 +17,9 @@
|
|||
* scripts: number of needed tries reported after sending a fax was
|
||||
wrong (bug #29, thx to Eckhard Rüggeberg)
|
||||
|
||||
* scripts: fax jobs can be given a literal addressee and a subject
|
||||
for informational purposes now (bug #18 reported by Achim Bohnet)
|
||||
|
||||
0.4.2 (CVS tag CAPISUITE_042):
|
||||
==============================
|
||||
* manual now available as PDF
|
||||
|
|
|
@ -794,7 +794,7 @@ make install</screen>
|
|||
<term><option>dial_prefix=""</option></term>
|
||||
<listitem>
|
||||
<para>Wenn hier etwas angegeben ist, wird es als Präfix vor jede Nummer
|
||||
eingefügt, die an <command>capisuitefax</command> übergeben wird.
|
||||
eingefügt, die an <command>capisuitefax</command> übergeben wird.
|
||||
Dies ist z.B. sehr nützlich, wenn Ihr ISDN-Adapter an einer Telefonanlage
|
||||
hängt, die eine "0" für externe Anrufe benötigt. Es kann aber auch später
|
||||
für ein einzelnes Fax-Dokument deaktiviert werden, sodass diese Einstellung
|
||||
|
@ -1206,9 +1206,10 @@ make install</screen>
|
|||
|
||||
<para><command>capisuitefax</command> kennt die folgenden Optionen:</para>
|
||||
|
||||
<screen>capisuitefax [-q] [-n] [-u username] -d dialstring file1 [file2...]</screen>
|
||||
<screen>capisuitefax [-q] [-n] [-u user] [-A addr] [-S subj] -d number file1 [file2...]</screen>
|
||||
<screen>capisuitefax [-q] -a id</screen>
|
||||
<screen>capisuitefax [-h] [-l]</screen>
|
||||
<screen>capisuitefax -l</screen>
|
||||
<screen>capisuitefax -h</screen>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-a id</option></term>
|
||||
|
@ -1216,6 +1217,12 @@ make install</screen>
|
|||
Auftrags zu ermittelen, können Sie die Option <option>-l</option>
|
||||
verwenden.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-A adr</option></term>
|
||||
<listitem><para>Der Adressat des Faxes. Diese Angabe dient (zur Zeit) nur
|
||||
zur leichteren Identifikation eines Jobs. Sie wird in der versandten Status-Mail
|
||||
später zitiert.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-d dialstring</option></term>
|
||||
<listitem><para>Die Nummer, die angerufen werden soll (Empfänger des Faxes).
|
||||
|
@ -1232,7 +1239,7 @@ make install</screen>
|
|||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-n</option></term>
|
||||
<listitem><para>Nicht den konfigurierten Präfix für diesen Auftrag verwenden.
|
||||
<listitem><para>Nicht den konfigurierten Präfix für diesen Auftrag verwenden.
|
||||
Dies ist nützlich für interne Aufträge.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -1240,6 +1247,12 @@ make install</screen>
|
|||
<listitem><para>Sei still, gib keine informativen Meldungen aus!
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-S subj</option></term>
|
||||
<listitem><para>Der Betreff des Faxes. Diese Angabe dient (zur Zeit) nur
|
||||
zur leichteren Identifikation eines Jobs. Sie wird in der versandten Status-Mail
|
||||
später zitiert.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-u user</option></term>
|
||||
<listitem><para>
|
||||
|
@ -1250,7 +1263,7 @@ make install</screen>
|
|||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>file1 [file2...]</option></term>
|
||||
<listitem><para>Eine oder mehrere PostScript-Dateien, die an diesen Empfänger
|
||||
<listitem><para>Eine oder mehrere PostScript-Dateien, die an diesen Empfänger
|
||||
verschickt werden sollen. Mehrere PostScript-Dateien erzeugen mehrere separate
|
||||
Fax-Aufträge).
|
||||
</para></listitem>
|
||||
|
|
|
@ -1051,9 +1051,10 @@ make install</screen>
|
|||
|
||||
<para>The following options are recognized by <command>capisuitefax</command>:</para>
|
||||
|
||||
<screen>capisuitefax [-q] [-n] [-u username] -d dialstring file1 [file2...]</screen>
|
||||
<screen>capisuitefax [-q] [-n] [-u user] [-A adr] [-S subj] -d number file1 [file2 ...]</screen>
|
||||
<screen>capisuitefax [-q] -a id</screen>
|
||||
<screen>capisuitefax [-h] [-l]</screen>
|
||||
<screen>capisuitefax -h</screen>
|
||||
<screen>capisuitefax -l</screen>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-a id</option></term>
|
||||
|
@ -1061,7 +1062,12 @@ make install</screen>
|
|||
option.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-d dialstring</option></term>
|
||||
<term><option>-A adr</option></term>
|
||||
<listitem><para>The addressee of the fax. This option is (currently) only
|
||||
for informational purposes and will be quoted in the sent status mail.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-d number</option></term>
|
||||
<listitem><para>The number which should be called (destination of the fax)</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -1080,6 +1086,11 @@ make install</screen>
|
|||
<term><option>-q</option></term>
|
||||
<listitem><para>Be quiet, don't output informational messages</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-S subj</option></term>
|
||||
<listitem><para>A subject for the fax. This option is (currently) only
|
||||
for informational purposes and will be quoted in the sent status mail.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-u user</option></term>
|
||||
<listitem><para>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# ---------------------------------------------------
|
||||
# copyright : (C) 2002 by Gernot Hillier
|
||||
# email : gernot@hillier.de
|
||||
# version : $Revision: 1.5 $
|
||||
# version : $Revision: 1.6 $
|
||||
#
|
||||
# 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
|
||||
|
@ -16,6 +16,8 @@ import getopt,os,sys,re,time,pwd,errno,fcntl,string
|
|||
import cs_helpers
|
||||
|
||||
dialstring=""
|
||||
addressee=""
|
||||
subject=""
|
||||
abort=""
|
||||
user=""
|
||||
quiet=0
|
||||
|
@ -26,20 +28,26 @@ def usage(error=""):
|
|||
print """capisuitefax - capisuite tool for enqueueing faxes
|
||||
|
||||
usage:
|
||||
capisuitefax [-q] [-n] [-u <user>] -d <dial> file1 [file2...] or
|
||||
capisuitefax [-q] -a <id> or
|
||||
capisuitefax [-h] [-l]
|
||||
capisuitefax [<send options>] -d <number> file1 [file2...] or
|
||||
capisuitefax [-q] -a <id>
|
||||
capisuitefax -l
|
||||
capisuitefax -h
|
||||
|
||||
possible options are:
|
||||
possible send options are:
|
||||
|
||||
-a <id>, --abort=<id> abort fax job with id (id is a number)
|
||||
-d <dial>, --dialstring=<dial> send fax to this number
|
||||
-h, --help print this usage information
|
||||
-l, --list print jobs in the send queue
|
||||
-d <dial>, --dialstring=<dial> send fax to this number (mandatory)
|
||||
-n, --noprefix ignore configured dial prefix for this call
|
||||
(for internal calls)
|
||||
-u <user>, --user=<user> send fax as <user> (only when called as root!)
|
||||
-A <addr>, --addressee=<addr> addressee (for informational purposes)
|
||||
-S <subj>, --subject=<subj> some subject (for informational purposes)
|
||||
|
||||
other options:
|
||||
|
||||
-q, --quiet be quiet, don't output informational messages
|
||||
-a <id>, --abort=<id> abort fax job with id (id is a number)
|
||||
-h, --help print this usage information
|
||||
-l, --list print jobs in the send queue
|
||||
|
||||
The given files must be in Adobe PostScript format"""
|
||||
if (error!=""):
|
||||
|
@ -54,7 +62,7 @@ def showlist(config,user):
|
|||
sys.exit(1)
|
||||
sendq=os.path.join(sendq,user,"sendq")+"/"
|
||||
|
||||
print "ID Number Tries Next try"
|
||||
print "ID Nr./Addressee Tries Next try Subject"
|
||||
|
||||
files=os.listdir(sendq)
|
||||
files=filter (lambda s: re.match("fax-.*\.txt",s),files)
|
||||
|
@ -65,13 +73,15 @@ def showlist(config,user):
|
|||
control=cs_helpers.readConfig(sendq+job)
|
||||
sys.stdout.write(re.match("fax-([0-9]+)\.txt",job).group(1))
|
||||
sys.stdout.write("\t")
|
||||
sys.stdout.write(control.get("GLOBAL","dialstring"))
|
||||
if (len(control.get("GLOBAL","dialstring"))<8):
|
||||
dest=cs_helpers.getOption(control,"GLOBAL","addressee","")
|
||||
if (dest==""):
|
||||
dest=control.get("GLOBAL","dialstring")
|
||||
sys.stdout.write(dest+"\t")
|
||||
if (len(dest)<8):
|
||||
sys.stdout.write("\t")
|
||||
sys.stdout.write("\t")
|
||||
sys.stdout.write(control.get("GLOBAL","tries"))
|
||||
sys.stdout.write("\t\t")
|
||||
sys.stdout.write(control.get("GLOBAL","starttime")+"\n")
|
||||
sys.stdout.write(control.get("GLOBAL","tries")+"\t")
|
||||
sys.stdout.write(control.get("GLOBAL","starttime")+"\t")
|
||||
sys.stdout.write(cs_helpers.getOption(control,"GLOBAL","subject","")+"\n")
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
@ -99,10 +109,10 @@ def abortjob(config,user,job):
|
|||
if (err.errno in (errno.EACCES,errno.EAGAIN)):
|
||||
print "Job is currently in transmission. Can't abort."
|
||||
|
||||
|
||||
try:
|
||||
optlist,args = getopt.getopt(sys.argv[1:], "d:a:u:lhqn"
|
||||
,['dialstring=','noprefix','help',"abort=","list","quiet","user="])
|
||||
optlist,args = getopt.getopt(sys.argv[1:], "d:a:u:lhqnA:S:"
|
||||
,['dialstring=','noprefix','help',"abort=","list","quiet","user=",
|
||||
'addressee=','subject='])
|
||||
|
||||
except getopt.GetoptError, e:
|
||||
usage(e.msg)
|
||||
|
@ -110,6 +120,8 @@ except getopt.GetoptError, e:
|
|||
# read options
|
||||
for option,param in optlist:
|
||||
if option in ('-d','--dialstring'): dialstring=param
|
||||
if option in ('-A','--addressee'): addressee=param
|
||||
if option in ('-S','--subject'): subject=param
|
||||
if option in ('-n','--noprefix'): useprefix=0
|
||||
if option in ('-h','--help'): usage()
|
||||
if option in ('-l','--list'): listqueue=1
|
||||
|
@ -190,7 +202,8 @@ for i in args:
|
|||
|
||||
cs_helpers.writeDescription(newname,"dialstring=\""+dialstring+"\"\n"
|
||||
+"starttime=\""+time.ctime()+"\"\ntries=\"0\"\n"
|
||||
+"user=\""+user+"\"\n")
|
||||
+"user=\""+user+"\"\naddressee=\""+addressee+"\"\nsubject=\""
|
||||
+subject+"\"\n")
|
||||
os.chmod(newname,0600)
|
||||
os.chmod(newname[:-3]+"txt",0600)
|
||||
if (os.getuid()==0):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# ---------------------------------------------
|
||||
# copyright : (C) 2002 by Gernot Hillier
|
||||
# email : gernot@hillier.de
|
||||
# version : $Revision: 1.7 $
|
||||
# version : $Revision: 1.8 $
|
||||
#
|
||||
# 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
|
||||
|
@ -87,6 +87,8 @@ def idle(capi):
|
|||
|
||||
tries=control.getint("GLOBAL","tries")
|
||||
dialstring=control.get("GLOBAL","dialstring")
|
||||
addressee=cs_helpers.getOption(control,"GLOBAL","addressee","")
|
||||
subject=cs_helpers.getOption(control,"GLOBAL","subject","")
|
||||
mailaddress=cs_helpers.getOption(config,user,"fax_email","")
|
||||
if (mailaddress==""):
|
||||
mailaddress=user
|
||||
|
@ -99,11 +101,14 @@ def idle(capi):
|
|||
if (result in (0,0x3400,0x3480,0x3490) and resultB3==0):
|
||||
movejob(job_fax,sendq,done,user)
|
||||
capisuite.log("job "+job_fax+": finished successfully",1)
|
||||
cs_helpers.sendSimpleMail(user,mailaddress,"Fax to "+dialstring+" sent successfully.",
|
||||
"Your fax job to "+dialstring+" was sent successfully.\n\n"
|
||||
+"Filename: "+job_fax+"\nNeeded tries: "+str(tries)
|
||||
+("\nLast result: 0x%x/0x%x" % (result,resultB3))
|
||||
+"\n\nIt was moved to file://"+done+user+"-"+job_fax)
|
||||
mailtext="Your fax job to "+addressee+" ("+dialstring+") was sent successfully.\n\n" \
|
||||
+"Subject: "+subject+"\nFilename: "+job_fax \
|
||||
+"\nNeeded tries: "+str(tries) \
|
||||
+("\nLast result: 0x%x/0x%x" % (result,resultB3)) \
|
||||
+"\n\nIt was moved to file://"+done+user+"-"+job_fax
|
||||
cs_helpers.sendSimpleMail(user,mailaddress,
|
||||
"Fax to "+addressee+" ("+dialstring+") sent successfully.",
|
||||
mailtext)
|
||||
else:
|
||||
max_tries=int(cs_helpers.getOption(config,"","send_tries","10"))
|
||||
delays=cs_helpers.getOption(config,"","send_delays","60,60,60,300,300,3600,3600,18000,36000").split(",")
|
||||
|
@ -115,16 +120,19 @@ def idle(capi):
|
|||
starttime=time.time()+next_delay
|
||||
capisuite.log("job "+job_fax+": delayed for "+str(next_delay)+" seconds",2)
|
||||
cs_helpers.writeDescription(sendq+job_fax,"dialstring=\""+dialstring+"\"\n"
|
||||
+"starttime=\""+time.ctime(starttime)+"\"\ntries=\""+str(tries)+"\"\n"
|
||||
+"user=\""+user+"\"")
|
||||
+"starttime=\""+time.ctime(starttime)+"\"\ntries=\""+str(tries)+"\"\n"
|
||||
+"user=\""+user+"\"\naddressee=\""+addressee+"\"\nsubject=\""+subject+"\"\n")
|
||||
if (tries>=max_tries):
|
||||
movejob(job_fax,sendq,failed,user)
|
||||
capisuite.log("job "+job_fax+": failed finally",1)
|
||||
cs_helpers.sendSimpleMail(user,mailaddress,"Fax to "+dialstring+" FAILED.",
|
||||
"I'm sorry, but your fax job to "+dialstring+" failed finally.\n\n"
|
||||
+"Filename: "+job_fax+"\nTries: "+str(tries)
|
||||
+"\nLast result: 0x%x/0x%x" % (result,resultB3)
|
||||
+"\n\nIt was moved to file://"+failed+user+"-"+job_fax)
|
||||
mailtext="I'm sorry, but your fax job to "+addressee+" ("+dialstring \
|
||||
+") failed finally.\n\nSubject: "+subject \
|
||||
+"\nFilename: "+job_fax+"\nTries: "+str(tries) \
|
||||
+"\nLast result: 0x%x/0x%x" % (result,resultB3) \
|
||||
+"\n\nIt was moved to file://"+failed+user+"-"+job_fax
|
||||
cs_helpers.sendSimpleMail(user,mailaddress,
|
||||
"Fax to "+addressee+" ("+dialstring+") FAILED.",
|
||||
mailtext)
|
||||
|
||||
fcntl.lockf(lockfile,fcntl.LOCK_UN)
|
||||
lockfile.close()
|
||||
|
@ -132,11 +140,11 @@ def idle(capi):
|
|||
|
||||
def sendfax(capi,job,outgoing_nr,dialstring,user,config):
|
||||
try:
|
||||
controller=int(cs_helpers.getOption(config,"","send_controller","1"))
|
||||
controller=int(cs_helpers.getOption(config,"","send_controller","1"))
|
||||
timeout=int(cs_helpers.getOption(config,user,"outgoing_timeout","60"))
|
||||
stationID=cs_helpers.getOption(config,user,"fax_stationID")
|
||||
if (stationID==None):
|
||||
capisuite.error("Warning: fax_stationID for user "+user+" not set")
|
||||
capisuite.error("Warning: fax_stationID for user "+user+" not set")
|
||||
stationID=""
|
||||
headline=cs_helpers.getOption(config,user,"fax_headline","")
|
||||
(call,result)=capisuite.call_faxG3(capi,controller,outgoing_nr,dialstring,timeout,stationID,headline)
|
||||
|
@ -155,6 +163,10 @@ def movejob(job,olddir,newdir,user):
|
|||
# History:
|
||||
#
|
||||
# $Log: idle.py,v $
|
||||
# Revision 1.8 2003/06/26 11:53:17 gernot
|
||||
# - fax jobs can be given an addressee and a subject now (resolves #18, reported
|
||||
# by Achim Bohnet)
|
||||
#
|
||||
# Revision 1.7 2003/06/19 14:58:43 gernot
|
||||
# - fax_numbers is now really optional (bug #23)
|
||||
# - tries counter was wrongly reported (bug #29)
|
||||
|
|
Loading…
Reference in New Issue