summaryrefslogtreecommitdiffstats
path: root/clients/ivam-autobox
diff options
context:
space:
mode:
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()