Star2Billing/cdr-stats — Issue #6: AttributeError at /export_csv/ - 'NoneType' object has no attribute 'encode'
Author: ozren1983
Created: 2011-11-16 14:40:15+00:00
State: open

I'm using release 1.3.0 of cdr-stats. When exporting CDRs to CSV file, AttributeError exception appears (AttributeError at /export_csv/ 'NoneType' object has no attribute 'encode') if there is a row in cdr_new table where src or clid fields are set to null.

Here is the traceback:
/usr/share/django_app/cdr_stats/cdr/views.py in export_to_csv
158. writer.writerow([cdr['calldate'], cdr['channel'].encode("utf-8"), cdr['src'].encode("utf-8"), cdr['clid'].encode("utf-8"), cdr['dst'].encode("utf-8"), cdr['disposition'], cdr['duration'].encode("utf-8"), cdr['accountcode']])

When dialing from asterisk console, src and clid field are set to null, so whenever asterisk console is used, Export to CSV might not work.