jpluimers / fritzcap

Fork of elpatron68/fritzcap which was previously automatically exported from code.google.com/p/fritzcap
https://wiert.me/category/power-user/internet/fritz/fritzbox-fritz/
26 stars 11 forks source link

Fix `KeyError: '0'` issue when call is in progress when starting fritzcap #9

Open jpluimers opened 7 years ago

jpluimers commented 7 years ago

This happened when:

  1. nobody was home
  2. an incoming phone call was ringing
  3. fritzcap starts
  4. the incoming phone call stops ringing
2017-06-28 16:59:27,401 - FritzCap version 2.3 started.
2017-06-28 16:59:27,402 - Connect    to the call monitor service on 192.168.124.23:1012.
2017-06-28 16:59:27,409 - Connected  to the call monitor service on 192.168.124.23:1012.
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/Users/jeroenp/Versioned/fritzcap/core/call_monitor.py", line 176, in run
    self.logger.info("Disconnect (ID:%s, ActiveCalls.:%s, Caller:%s, DialedNumber:%s, LinePort:%s)" % (sline[2],callers_count,call_id_map[sline[2]][0],call_id_map[sline[2]][1],call_id_map[sline[2]][2]))
KeyError: '0'

Similar, but starting fritzcap when an outgoing call is in progress:

2017-06-28 17:11:22,274 - FritzCap version 2.3 started.
2017-06-28 17:11:22,275 - Connect    to the call monitor service on 192.168.124.23:1012.
2017-06-28 17:11:22,282 - Connected  to the call monitor service on 192.168.124.23:1012.
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/Users/jeroenp/Versioned/fritzcap/core/call_monitor.py", line 176, in run
    self.logger.info("Disconnect (ID:%s, ActiveCalls.:%s, Caller:%s, DialedNumber:%s, LinePort:%s)" % (sline[2],callers_count,call_id_map[sline[2]][0],call_id_map[sline[2]][1],call_id_map[sline[2]][2]))
KeyError: '1'