예제 #1
0
def remoteInquiry(config, user, call, receivedQ):
    """
    Remote inquiry function (uses german wave snippets!)

    Implemented commands for remote inquiry are:
      delete message - 1
      next message - 4
      last message - 5
      repeat current message - 6

    'user' name of the user who is responsible for this
    'config' ConfigParser instance holding the config data
    'call' reference to the call. Needed by all capisuite functions
    'receivedQ' the received queue dir of the user
    """
    try:
        lock = fileutils._getLock(
            os.path.join(receivedQ, 'inquiry_lock'), blocking=0)
    except fileutils.LockTakenError:
        say(config, user, call, "fernabfrage-aktiv.la")
        return
    try:
        # read directory contents
        messages = capisuite.voice.getQueueFiles(config, user)
        # read the number of the message heard last at the last inquiry
        lastinquiry = capisuite.voice.getInquiryCounter(config, user)
        # filter out old messages
        oldmessages = [m for m in capisuite.voice.getQueueFiles(config, user) if int(m[0]) <= lastinquiry]
        messages    = [m for m in capisuite.voice.getQueueFiles(config, user) if int(m[0]) >  lastinquiry]
        #oldmessages = [m for m in messages if m[0] <= lastinquiry]
        #messages    = [m for m in messages if m[0] >  lastinquiry]
	call.log("Count of messages = %x" % lastinquiry, 1)
        oldmessages.sort()
        messages.sort()

        announceNumMessages(config, user, call, len(messages), new=1)

        # menu for record new announcement
        cmd = ""
        while cmd not in ("1", "9"):
            if len(messages) or len(oldmessages):
                say(config, user, call, "zum-abhoeren-1.la")
            say(config, user, call, "fuer-neue-ansage-9.la")
            cmd = call.read_DTMF(0, 1)
        if cmd == "9":
            cmd_recordNewAnnouncement(config, user, call, receivedQ)
            return

        # start inquiry
        cmd_inquiry(config, user, call, oldmessages, messages, lastinquiry)

    finally:
        fileutils._releaseLock(lock)
예제 #2
0
def remoteInquiry(config, user, call, receivedQ):
    """
    Remote inquiry function (uses german wave snippets!)

    Implemented commands for remote inquiry are:
      delete message - 1
      next message - 4
      last message - 5
      repeat current message - 6

    'user' name of the user who is responsible for this
    'config' ConfigParser instance holding the config data
    'call' reference to the call. Needed by all capisuite functions
    'receivedQ' the received queue dir of the user
    """
    try:
        lock = fileutils._getLock(os.path.join(receivedQ, 'inquiry_lock'),
                                  blocking=0)
    except fileutils.LockTakenError:
        say(config, user, call, "fernabfrage-aktiv.la")
        return
    try:
        # read directory contents
        messages = capisuite.voice.getQueueFiles(config, user)

        # read the number of the message heard last at the last inquiry
        lastinquiry = capisuite.voice.getInquiryCounter(config, user)
        # filter out old messages
        oldmessages = [m for m in messages if m[0] <= lastinquiry]
        messages = [m for m in messages if m[0] > lastinquiry]
        oldmessages.sort()
        messages.sort()

        announceNumMessages(config, user, call, len(messages), new=1)

        # menu for record new announcement
        cmd = ""
        while cmd not in ("1", "9"):
            if len(messages) or len(oldmessages):
                say(config, user, call, "zum-abhoeren-1.la")
            say(config, user, call, "fuer-neue-ansage-9.la")
            cmd = call.read_DTMF(0, 1)
        if cmd == "9":
            cmd_recordNewAnnouncement(config, user, call, receivedQ)
            return

        # start inquiry
        cmd_inquiry(config, user, call, oldmessages, messages, lastinquiry)

    finally:
        fileutils._releaseLock(lock)
예제 #3
0
        outgoing_num = config.getUser(user, "outgoing_msn")
        if not outgoing_num:
            incoming_nums = config.getUser(user, "fax_numbers")
            if not incoming_nums:
                continue
            outgoing_num = incoming_nums.split(',')[0].strip()

        mailaddress = config.getUser(user, "fax_email", user)
        fromaddress = config.getUser(user, "fax_email_from", user)

        for jobnum, controlfile in capisuite.fax.getQueueFiles(config, user):
            core.log("checking job %s %s" % (jobnum, controlfile), 3)
            assert controlfile == os.path.abspath(controlfile)
            try:
                # lock the job so that it isn't deleted while sending
                lock = _getLock('dummy', forfile=controlfile, blocking=0)
            except LockTakenError:
                # if we didn't get the lock, continue with next job
                continue
            try:
                control = capisuite.config.JobDescription(controlfile)

                fax_file = control.get('filename')
                assert fax_file == os.path.abspath(fax_file)

                # both the job control file and the fax file must have
                # the users uid
                uid = pwd.getpwnam(user).pw_uid
                try:
                    if os.stat(controlfile).st_uid != uid or \
                       os.stat(fax_file).st_uid != uid:
예제 #4
0
파일: idle.py 프로젝트: cloph/capisuite
        outgoing_num = config.getUser(user, "outgoing_msn")
        if not outgoing_num:
            incoming_nums = config.getUser(user, "fax_numbers")
            if not incoming_nums:
                continue
            outgoing_num = incoming_nums.split(',')[0].strip()

        mailaddress = config.getUser(user, "fax_email", user)
        fromaddress = config.getUser(user, "fax_email_from", user)

        for jobnum, controlfile in capisuite.fax.getQueueFiles(config, user):
            core.log("checking job %s %s" % (jobnum, controlfile), 3)
            assert controlfile == os.path.abspath(controlfile)
            try:
                # lock the job so that it isn't deleted while sending
                lock = _getLock('dummy', forfile=controlfile, blocking=0)
            except LockTakenError:
                # if we didn't get the lock, continue with next job
                continue
            try:
                control = capisuite.config.JobDescription(controlfile)

                fax_file = control.get('filename')
                assert fax_file == os.path.abspath(fax_file)

                # both the job control file and the fax file must have
                # the users uid
                uid = pwd.getpwnam(user).pw_uid
                try:
                    if os.stat(controlfile).st_uid != uid or \
                       os.stat(fax_file).st_uid != uid: