Пример #1
0
def gui_prompt_to_call_next(opts, delta, item, code):
    sound = CONF.get('prefs', 'alert_sound')
    player = CONF.get('prefs', 'alert_player')
    timeout = int(CONF.get('prefs', 'prompt_timeout'))
    host = CONF.get('prefs', 'asterisk_host')
    port = int(CONF.get('prefs', 'host_port'))
    number = CONF.get('prefs', 'conf_number')

    msg = '%s (Passcode %s).\nCall this?' % (item.get('summary'),
                                            code)
    msg = saxutils.escape(msg)
    os.system('%s %s >/dev/null 2>&1 &' % (player, sound))

    gui = subprocess.Popen(['zenity', '--question', '--text=%s' % msg])
    start = time.time()
    result = None
    while (time.time() - start) < timeout:
        if gui.poll() is not None:
            result = gui.returncode
            break
    if result is None:
        gui.terminate()
        raise Exception("User did not respond, abort!")

    if result != 0:
        return
    if opts.dryrun:
        print 'Would call %s %s %s %s' % (host, port, number, code)
    else:
        client.make_call(host, port, number, code)
Пример #2
0
	def finish(self):
		
		self.current_step_index = 0
		print("data is: ")
		pretty_data = json.dumps(self.data, indent=4)
		print(pretty_data)
		client.make_call(self.data)
		
		self.parent.quit()
Пример #3
0
def tui_prompt_to_call_next(opts, delta, item, code):
    host = CONF.get('prefs', 'asterisk_host')
    port = int(CONF.get('prefs', 'host_port'))
    number = CONF.get('prefs', 'conf_number')

    print item.get('summary')
    print '  Passcode %s' % code
    print 'Call this? [y/N] ',
    answer = sys.stdin.readline()
    if answer.strip() != 'y':
        return
    if opts.dryrun:
        print '\rWould call %s %s %s %s' % (host, port, number, code)
    else:
        client.make_call(host, port, number, code)