kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
304 stars 59 forks source link

Adding all call types #54

Closed bufemc closed 4 years ago

bufemc commented 4 years ago

fritzcall.py could be enhanced with "new" call types, see page 20 here: https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/x_contactSCPD.pdf

1 incoming, 2 missed, 3 outgoing, 9 active incoming, 10 rejected incoming, 11 active outgoing

Especially type 10 is important for me, as I maintain a phonebook just for blocked numbers. And it really exists if I retrieve last calls, example:

<Call><Id>6380</Id><Type>10</Type><Caller>021197633xxx</Caller><Called>SIP: 12345</Called><CalledNumber>12345</CalledNumber><Name>ZeitschriftenAbo mvd</Name><Numbertype>sip</Numbertype><Device></Device><Port>-1</Port><Date>15.06.20 13:27</Date><Duration>0:00</Duration><Count></Count><Path /></Call>
kbr commented 4 years ago

As the library just covers the three (imho) most common call types by dedicated methods, it is possible to filter for any call type by using the get_calls() method:

REJECTED_INCOMING = 10

fc = FritzCall(...)
rejected_incoming_calls = fc.get_calls(calltype=REJECTED_INCOMING)
bufemc commented 4 years ago

I was just puzzled because my phonebook contained the type 10, so I found out. For me it would be enough just to extend the constants on top of fritzcall.py - no other changes - something like:

ACTIVE_RECEIVED_CALL_TYPE = 9
REJECTED_CALL_TYPE = 10
ACTIVE_OUT_CALL_TYPE = 11

But that's up to you, I also understand your point of view.