CDR-Stats : INSTALLATION GUIDE

Set-up Asterisk/Freeswitch to write CDR to a database.
—————————————————————————–

For instance http://www.voip-info.org/wiki/view/Asterisk+cdr+mysql or http://www.voip-info.org/wiki/view/Asterisk+cdr+SQLite

Configure your Database :
————————————-
edit settings.py :-
‘ENGINE’: ’sqlite3′, # Add ‘postgresql_psycopg2′, ‘postgresql’, ‘mysql’, ’sqlite3′ or ‘oracle’.
‘NAME’: os.path.dirname(os.path.abspath( __file__ )) + ‘/database/local.db’,                      # Or path to database file if using sqlite3.
‘USER’: ”,                      # Not used with sqlite3.
‘PASSWORD’: ”,                  # Not used with sqlite3.
‘HOST’: ”,                      # Set to empty string for localhost. Not used with sqlite3.
‘PORT’: ”,                      # Set to empty string for default. Not used with sqlite3.
Change Media URL :
—————————-
edit settings.py :
MEDIA_URL = ‘http://localhost:8000/resources/’
replace localhost by your public IP
Update Admin Media path :
—————————————
cd resources
ln -s /usr/lib/pymodules/python2.6/django/contrib/admin/media/ admin
edit settings.py :
ADMIN_MEDIA_PREFIX = ‘/resources/admin/’
Set Permission on Sqlite DB :
—————————————–
If using Sqlite.
chmod -R 777 database
create the database then :
python manage.py syncdb
Create Super User :
—————————
python manage.py createsuperuser –username=admin –email=areski@gmail.com
Test with :
- python manage.py runserver 0.0.0.0:8000
Apache Configuration to auto-start CDR-Stats:
——————————————————————
vim /etc/apache2/sites-enabled/cdr_stats.conf
Copy the following :

Listen *:9000

<VirtualHost *:9000>
DocumentRoot /usr/share/django_app/cdr_stats/
ErrorLog /usr/share/django_app/err-cdr_stats.log

<Location “/”>
SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonPath “[@/usr/share/django_app/cdr_stats/@, @/usr/share/django_app/@] + sys.path”
SetEnv DJANGO_SETTINGS_MODULE cdr_stats.settings
PythonDebug On
</Location>

<location “/media”>
SetHandler None
</location>
</VirtualHost>