TUTORIAL Howto install CDR-Stats

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Dear All

We have just released the latest version of CDR-Stats, version 1.3.0.

CDR-Stats is the replacement for Asterisk Stats, and anyone who has used CDR reporting in FreePBX which was written by Areski about 8 years ago will be familiar with Asterisk-Stat. CDR-Stats is a complete rewrite of this application starting with a new framework based on Django and Python.

CDR-Stats can be used to provide call data records to your customers, without having to give them open access to the rest of FreePBX, where they may do untold damage.

You can set up limited ACL access to the system as well to limit customers as to what they can see.

There is more information and a demo of CDR-Stats at http://www.cdr-stats.org/

We promised to provide an install script for CentOS based FreePBX aggregations, as the installation methodology can be quite complicated. We have done some re-writing of the scripts, and done some testing, so we are confident that they work as expected.

As ever, check the script to see what it is going to do to your machine, and backup before you start.

To install CDR-Stats, run the following commands.

wget --no-check-certificate https://github.com/Star2Billing/cdr-stats/raw/master/scripts/install-cdr-stats-freePBX.sh
bash install-cdr-stats-freePBX.sh

Go with the defaults, and answer yes to creating a new root user, and overwriting the CDR-Stats installation.

This will back up your existing CDR database and then make some alterations to the asteriskcdrdb database the CDR Reports in FreePBX will be unchanged), and install the GUI on port 9000 e.g. http://your-pbx-ip:9000

You can then log in using the username and password you created during the installation and view your CDR. Previous CDR will be included.


Yours

Joe
 

lowno

Guru
Joined
Feb 18, 2009
Messages
125
Reaction score
8
Been wanting to try that out. Just installed, took maybe 5 minutes. I am running purple.

Looks great.

By any chance are there any future plans to integrate a link to the call recording if it exists? That is really the only thing that trixbox had over all the other distros. I know there is the ARI, but it is clunky in my opinion.

Thanks.
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
I'm trying to automate (remove interactive portion)... how would you script 'python manage.py syncdb' to create a superuser of 'somebody' with a password of 'whatever' and an email of '[email protected]'?
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Hi

In Ubuntu, this is easy, just use "expect" does such a thing exist for CentOS? However, in this case, I believe, although not tested, that if you create the superuser in the database first, you will not be prompted for one again during the syncdb process. To achieve this would take some script re-organisation and writing.

Joe
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
Yeah, that's what I tried to do... I did a manual install creating user 'whatever', and then exported the entry from asteriskcdrdb's auth_user table into an .sql file. Then I tried an automatic install (inserting the .sql) to no avail.

Also after a good install, when you log in as the user inserted via .sql... the webserver comes back w/ an error 500 (Internal Server Error). Is there something else going on outside MySQL? (not familiar with django/etc)

Not sure what you're referring to w/ 'expect' in Ubuntu...
...seems like a very heavy install.

For kicks, you can view me piddling around w/ cdrstats, trying to get it to install way back when you first released it here: http://www.edgeproductions.com/sites/default/files/TheShniz/voip/never_worked.txt
(never got it to work, and am simply using your script here now)
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Hi

Expect is a neat trick in Debian based systems where you can set up a file with answers to questions that an install may ask you.

I'm not sure what your issue is, maybe the apache error log can cast some light.

Joe
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
That sounds quite handy, I'll have to search for a redhat counterpart...

The only thing which stuck out was a couple instances of:

Code:
[Thu Apr 14 17:26:44 2011] [notice] mod_python: (Re)importing module 'django.core.handlers.modpython'
/usr/lib/python2.4/site-packages/django/core/context_processors.py:27: DeprecationWarning: The context processor at `django.core.context_processors.auth` is deprecated; use the path `django.contrib.auth.context_processors.auth` instead.
DeprecationWarning
 

darmock

PIAF Developer
Joined
Oct 18, 2007
Messages
2,892
Reaction score
98
Expect has been around in redhat/centos for years.... we already use it to test certain modules prior to publication. yum -y install expect will put it on your PIAF system.

Tom
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
I've got it working and it is nice. A few thoughts:

1. I like the resizable columns but could there be a way to make the column size stick?

2. What is TORTURE status I keep seeing?

Thanks leon
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Hi

Areski, The Author of CDR-Stats writes

you can skip creating a user with python manage.py syncdb --noinput

then you can create it later on with python manage.py createsuperuser

I trust that this helps.

Yours

Joe
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
Yes, that helped immensely... thank him for me :)

Question:
What purpose does creating a superuser via Python bring? My insert directly into MySQL seems to be working, and I want to make sure I've not broken/missing anything.

Also, the reason for the 500 Error, was because I scripted CDR-Stats to install while the password was still the default (amp109) and was later changed (which generated the error)... basically saying it could no longer access the database.
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Hi

I do mention the matter of default passwords on the console during the script, but good to know there was a reason for the error 500.

It would be better if the script referred to amportal.conf for these variables - anyone got any useful shell script code to inspect amportal.conf to pick up these variables?

Joe
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
Yep, this is what I typically use:

Code:
cat /etc/amportal.conf | grep -v "# AMPDBPASS=" | grep "AMPDBPASS=" | cut -d"=" -f2

So can I safely assume I'm fine NOT creating a superuser via Python?
 

usa4148

Member
Joined
Jan 5, 2009
Messages
43
Reaction score
0
Joe, (and Areski), Others,

Thanks again for all your hard work. This is a cool tool indeed. I have tried this install on Asterisk 1.4 (Gold) and it seems to mangle the Disposition field of the CDR table by making it an int. On a test Asterisk 1.8 (Purple) install it correctly left the CDR table intact by keeping it varchar(45). So did I miss something or is Cdr-Stats just not compatible with Asterisk 1.4 - presumably because of a MySQL version issue?

Hmm - Seems I may have spoken too spoon. The field was mangled between the installation Almost finishing and when I created the superuser. So on Purple as well the Disposition field show all '0's where it used to show 'ANSWERED' etc.

Thanks Heaps!!!,
Dan
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
pip install -r /usr/share/django_app/cdr_stats/requirements.txt

is currently generating this error:

Code:
Downloading/unpacking hg+https://bitbucket.org/jespern/django-piston (from -r /usr/share/django_app/cdr_stats/requirements.txt (line 10))
  Cloning hg https://bitbucket.org/jespern/django-piston to /tmp/pip-ZuvI2c-build
warning: bitbucket.org certificate not verified (check web.cacerts config setting)
  Running setup.py egg_info for package from hg+https://bitbucket.org/jespern/django-piston
Downloading/unpacking git+https://github.com/pydanny/django-uni-form.git (from -r /usr/share/django_app/cdr_stats/requirements.txt (line 11))
  Cloning https://github.com/pydanny/django-uni-form.git to /tmp/pip-0e5Zme-build
error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/pydanny/django-uni-form.git/info/refs

fatal: HTTP request failed
  Complete output from command /usr/bin/git clone -q https://github.com/pydanny/django-uni-form.git /tmp/pip-0e5Zme-build:

----------------------------------------
Command /usr/bin/git clone -q https://github.com/pydanny/django-uni-form.git /tmp/pip-0e5Zme-build failed with error code 128
Storing complete log in /root/.pip/pip.log

Which later on causes 'python manage.py syncdb --noinput' to generate an error of admin_tools not found (I think it is)
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
After searching... the reason is because CentOS has an old certificate authority bundle (atleast my CentOS 5.5 box anyways). You just need to download a new certificate bundle:


Code:
cd /etc/pki/tls/certs
curl [URL]http://curl.haxx.se/ca/cacert.pem[/URL] -o /etc/pki/tls/certs/ca-bundle.crt
 
Joined
Feb 13, 2011
Messages
330
Reaction score
12
Problem with the installation

After install I get

Forbidden

You don't have permission to access / on this server.
Apache/2.2.3 (CentOS) Server at carlostico.ath.cx Port 9000



Any ideas ?
 

Members online

No members online now.

Forum statistics

Threads
25,810
Messages
167,754
Members
19,240
Latest member
nikko
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top