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

"Exception in thread Thread-1" when doing monitoring, but no capture. #11

Closed duffy6 closed 6 years ago

duffy6 commented 6 years ago

log_debug_fritzcap.txt Hi!

I installed this on an ubuntu machine (Ubuntu 16.04.2 LTS) using it with a Fritzbox 7390 (V6.83). Installed via GIT on 7. July 2017.

when I start fritzcap via

sudo python fritzcap.py -m -p MYPASSWORD

it throws this:

2017-07-07 14:50:28,761 - FritzCap version 2.3 started. 2017-07-07 14:50:28,765 - Connect to the call monitor service on fritz.box:1012. 2017-07-07 14:50:28,771 - Connected to the call monitor service on fritz.box:1012.

But when a call goes out/comes in this happends:

Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/home/couchdb/fritzcap/fritzcap/core/call_monitor.py", line 150, in run self.capture_monitor.set_data("callevent.name", command) AttributeError: 'NoneType' object has no attribute 'set_data'

Is this a bug or did I do something wrong?

greetz duffy6

Link to the discussion: https://www.ip-phone-forum.de/threads/new-fritzcap-py-version-2-3.295776/

jpluimers commented 6 years ago

Relevant extract from log:

2017-07-07 14:53:02,721 [MainThread::140229812938496] [INFO    ] [        fritzcap::<module>          ] FritzCap version 2.3 started.
2017-07-07 14:53:02,722 [MainThread::140229812938496] [DEBUG   ] [        fritzcap::<module>          ] Command line parameters: ['fritzcap.py', '-m', '-p', 'MYPASSWORD^C']
2017-07-07 14:53:02,723 [MainThread::140229812938496] [DEBUG   ] [        fritzcap::<module>          ] Parsed parameters:       Namespace(after_capture_time=10, box_name='fritz.box', call_service_port=1012, cap_file='capture_%(tcaps.YmdHMS).cap', cap_folder='captures/%(tcaps.Y-m-d/HMS)/', cap_interface=' ', capture_files=None, config_file=<open file 'fritzcap.conf', mode 'r' at 0x7f89c9e980c0>, decode_files=None, decode_workers_count=2, default_login='getpage=../html/de/menus/menu2.html&errorpage=../html/index.html&var:lang=de&var:pagename=home&var:menu=home&=&login:command/password=%s', logging_config='logging.conf', login_not_required=None, monitor_calls=True, password='MYPASSWORD^C', protocol='http', show_interfaces=None, sid_challenge='getpage=../html/login_sid.xml', sid_login='login:command/response=%s&getpage=../html/login_sid.xml', start_str='?start=1&start1=Start', stop_str='?stop=1&stop1=Stop', username='root')
2017-07-07 14:53:02,724 [MainThread::140229812938496] [DEBUG   ] [    call_monitor::__init__          ] CallMonitor(capture_monitor:'None', box_name:'fritz.box', call_service_port:'1012').
2017-07-07 14:53:02,725 [  Thread-1::140229769926400] [DEBUG   ] [    call_monitor::run               ] Thread started.

Command-line:

fritzcap.py -m -p MYPASSWORD^C

which translates to:

fritzcap.py --monitor_calls --password MYPASSWORD^C

This means it does monitoring, but no capture as either -c or --capture_files are missing, which we can see in the log file from the None value:

CallMonitor(capture_monitor:'None', box_name:'fritz.box', call_service_port:'1012').

Resolution:

  1. in this case perform a self.logger.info indicating there is no capture taking place either inside CallMonitor or when setting them up in fritzcap:
    • call_monitor = CallMonitor(capture_monitor, args.box_name, args.call_service_port)
    • capture_monitor.start_capture();
  2. ensure CallMonitor does not dereference capture_monitor when it is set to None
duffy6 commented 6 years ago

Working like a charme!

THX!!!