summaryrefslogtreecommitdiffstats
path: root/clients/ivam-autobox
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-01-09 14:02:55 +0000
committerLennart Poettering <lennart@poettering.net>2004-01-09 14:02:55 +0000
commitd5168da28d6574d106f50fdb69bdbb9fe73596b5 (patch)
tree900d38646f2629042a7a6138dba5a2300fa34839 /clients/ivam-autobox
parent8ceda18de1ba57c10af74043d0e3c33fecd4767a (diff)
some more python work
git-svn-id: file:///home/lennart/svn/public/ivam2/trunk@22 dbf6933d-3bce-0310-9bcc-ed052ba35b35
Diffstat (limited to 'clients/ivam-autobox')
-rwxr-xr-xclients/ivam-autobox24
1 files changed, 21 insertions, 3 deletions
diff --git a/clients/ivam-autobox b/clients/ivam-autobox
index 8b11f8e..4b043d2 100755
--- a/clients/ivam-autobox
+++ b/clients/ivam-autobox
@@ -7,18 +7,20 @@ import ivamCore, ivamVoiceBox
from optparse import OptionParser
def usage():
- log("%s [--record-time=SECS] [--pin=PIN] [--pin-file=PINFILE] [--default-record-time=SECS] [--default-pin=PIN] [--default-pin-file=PINFILE] [--debug] [DIRECTORY]" % sys.argv[0])
+ log("%s [--record-time=SECS] [--pin=PIN] [--pin-file=PINFILE] [--default-record-time=SECS] [--default-pin=PIN] [--default-pin-file=PINFILE] [--record-only] [--no-record] [--debug] [--notify-script=PATH] [--email=EMAIL] [DIRECTORY]" % sys.argv[0])
def parseArgs(vb, argv):
try:
- opts, args = getopt.getopt(argv[1:], "dh", ["help", "record-time=", "pin=", "pin-file=", "default-record-time=", "default-pin=", "default-pin-file=", "debug"])
+ opts, args = getopt.getopt(argv[1:], "dh", ["help", "record-time=", "pin=", "pin-file=", "default-record-time=", "default-pin=", "default-pin-file=", "debug", "record-only", "no-record", "email=", "notify-script="])
except getopt.GetoptError:
usage()
sys.exit(1)
recordTime = 60
pin = "-"
+ email = "root"
+ notifyScript = "newvoicebox"
for o, a in opts:
if o in ("-d", "--debug"):
@@ -37,13 +39,24 @@ def parseArgs(vb, argv):
elif o in ("--default-pin-file"):
pin = getContents(a)
+ elif o in ("--notify-script"):
+ notifyScript = a
+
+ elif o in ("--email"):
+ email = a
+
dname = "msn-" + os.getenv("RINGMSN")
if len(args):
dname = args[0] + "/" + dname
try:
- ivamVoiceBox.setupVoiceBox(dname, pin, recordTime)
+ dname = ivamVoiceBox.setupVoiceBox(dname, pin, recordTime)
+
+ ivamCore.log("Created new voice box, calling notification script. ('%s %s %s')" % (notifyScript, dname, email))
+ r=os.spawnvp(os.P_WAIT, notifyScript, (notifyScript, dname, email))
+ ivamCore.log("Program finished (return value is %i)." % r)
+
except OSError:
pass
@@ -59,6 +72,11 @@ def parseArgs(vb, argv):
elif o in ("--pin-file"):
vb.setPin(getContents(a))
+ elif o in ("--record-only"):
+ vb.recordOnly = True
+
+ elif o in ("--no-record"):
+ vb.noRecord = True
def main():
vb = ivamVoiceBox.VoiceBox()