Exemplo n.º 1
0
def run(number=None, filename="log_dialer.txt"):
    # path to save logs
    path = os.path.dirname(os.path.abspath(__file__))
    path = os.path.join(path, "..", "..", "qa", "reports", "")
    logger = Logger(filename, path)

    controller = PhoneControl()

    serials = controller.read_serials()
    for i in range(len(serials)):
        logger.write_log(" Device {} = {}".format(i + 1, serials))

        controller.init_device(serials[i])
        device_params = utils.get_device_data(serials[i])
        logger.write_log("Script Dial Number---------")
        if number is None:
            n = raw_input("Enter the number to dial : ")
        else:
            n = number
        try:
            dialable, parsedNumber, msg = utils.validate_number(n)
            if dialable:
                logger.write_log(msg + " " + str(parsedNumber))
                action(logger, controller, parsedNumber, device_params)
            else:
                logger.end_log("Invalid phone number")
        except Exception as ex:
            logger.error_log(ex.message)
Exemplo n.º 2
0
def run(filename, path, number=None):

    logger = Logger(filename, path)

    controller = PhoneControl(3)

    serial = controller.read_serial()
    logger.write_log("1st Device on List = {}".format(serial))

    controller.init_device()

    logger.write_log("Script Dial Number---------")
    if number is None:
        n = raw_input("Enter the number to dial : ")
    else:
        n = number

    try:
        dialable, parsedNumber, msg = utils.validate_number(n)
        if dialable:
            logger.write_log(msg + " " + str(parsedNumber))
            action(logger, controller, parsedNumber)
        else:
            logger.error_log("Invalid phone number")
    except Exception as ex:
        logger.error_log(ex.message)
Exemplo n.º 3
0
def run(number=None, stf_info=None, name="", filename="log_dialer.txt"):
    stf = False
    device_params = {}
    # path to save logs
    path = os.path.dirname(os.path.abspath(__file__))
    path = os.path.join(path, "..", "..", "qa", "reports", "")
    logger = Logger(filename, path, name)

    # 1 sec between steps so dialing is faster
    controller = PhoneControl(1)

    if stf_info is not None:
        serials = [stf_info['remote_serial']]
        device_params = utils.get_device_data(stf_info['device'])
        stf = True
    else:
        serials = controller.read_serials()

    for i in range(len(serials)):
        logger.write_log(" Device {} = {}".format(i + 1, serials))

        controller.init_device(serials[i])

        if not stf:
            device_params = utils.get_device_data(serials[i])

        logger.write_log("Script Dial Number UI---------")
        if number is None:
            n = raw_input("Enter the number to dial : ")
        else:
            n = number
        try:
            dialable, parsedNumber, msg = utils.validate_number(n)
            if dialable:
                logger.write_log(msg + " " + str(parsedNumber))
                action(logger, controller, parsedNumber, device_params)
            else:
                logger.end_log("Invalid phone number")
        except Exception as ex:
            logger.error_log(ex.message)