Open bufemc opened 4 years ago
Could be fixed by this PR for issue 55 + 53: https://github.com/kbr/fritzconnection/pull/56
Heard a rumour that there are also other "internal" numbers, starting with #. So I tend to say we should keep only entries starting with a digit (\d) and remove ANYTHING ELSE..
TLDR: the xml phonebook provided via Fritz!Box Lua seems to contain all internal numbers, too.
I tried to get all the entries for my phonebook id 2, which is for cold calls only. To do so, I used:
However it seems every (!) phonebook will also include internal numbers as well, even in my list for cold calls, like: (I removed private numbers and names). [Possible solution below]
I checked the URL for the XML which is downloaded, unfortunately it also contains these internal numbers, it's a 7490 model here. So how could we filter them? I had a glimpse in the XML:
so type="intern" seems to represent an internal number, I've also seen "memo" or "". And:
so only type="home" (wrong, see * below) seems to represent a real entry.
I could create an own branch and a pull request, if wished.
However, I've seen the processor for the xml.etree in the processor code is heavily examining node values, not attributes, before adding e.g the numbers via ValueSequencer just as a simple list. I guess, the author is more into this ;-) In case of a telephony record when the node is processed it would be available as: node.attrib with a dict of 3 entries, the keys are 'type', 'vanity', 'prio'. I guess it would be best to also extract at least the type. The other way would be to manipulate the xml.etree before processing it, e.g. by removing all (but full contact) entries where type != "home" (*)
(*) But, to make it even worse.. if comparing this with section "5.1 Phonebook Content" in https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/x_contactSCPD.pdf it seems "home" is not the only value for "real" records, it could be also e.g. "work" etc. So we have to find out first the values for "real" records (whitelisting), or otherwise need a blacklist ("intern", "memo", "" spotted so far).
I just filled out anything in the Fritzbox for an invented whitelist number and set all the stuff, it seems "home", "mobile", "work" and "fax_work" would do the job for the whitelist.
Another very simple solution would be just to skip all numbers starting with "**", see above.