예제 #1
0
    # Initialize by using parameters from config file
    fritzconn = FritzConn()

    fc = FritzCall(fc=fritzconn)
    cp = CallPrefix(fc=fritzconn)
    pb = Phonebook(fc=fritzconn)

    fi = FritzInspection(fc=fritzconn)
    # print(fi.view_servicenames())

    anylist = pb.get_all_numbers_for_pb_ids(
        [0, 1, 2], keep_internals=False)  # White- or blacklist

    print("VoIP numbers (XML):")
    res = pb.get_voip_numbers()
    print(res)

    print("Adding to whitelist internal numbers:")
    tree = ET.fromstring(res)
    iphones = dict()
    for node in tree.iter('Number'):
        nr = cp.area_code + node.text
        iphones.update({nr: 'intern'})
    anylist.update(iphones)
    print(iphones)

    print('Internal active handset devices:')
    res = pb.get_handset_info(keep_phone_only=False)
    print(res)