Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
areski committed May 20, 2015
2 parents 4f85205 + 2c43940 commit 4d743d1
Show file tree
Hide file tree
Showing 541 changed files with 50,137 additions and 66,898 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*.pyc
*dilla*
*.db
*nbproject*
*devserver*
Expand All @@ -11,4 +10,7 @@ cdr_stats/settings_local.py
*sublime*
*.log
build
_build
output.html
.ipynb_checkpoints
bower_components
14 changes: 6 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ language: python
python:
- "2.7"
env:
- DJANGO=1.4.3
- DJANGO=1.7.7
services:
- mongodb # will start riak
- redis-server
# - rabbitmq # will start rabbitmq-server
# - memcache # will start memcached
Expand All @@ -14,15 +13,14 @@ install:
# - pip install pep8 --use-mirrors
# - pip install https://github.com/dcramer/pyflakes/tarball/master
before_script:
- cp install/conf/settings_local.py cdr_stats/settings_local.py
- cp install/conf/settings_travis.py cdr_stats/settings_travis.py
#TODO: Now we should use postgresql
- "mysql -e 'create database cdrstats;'"
- "mysql -e 'create database cdrstats_test;'"
- cp install/conf/settings_travis.py cdr_stats/cdr_stats/settings_local.py
#- cp install/conf/settings_local.py cdr_stats/cdr_stats/settings_local.py
#- cp install/conf/settings_travis.py cdr_stats/cdr_stats/settings_travis.py
# - "pep8 --exclude=migrations --ignore=E501,E225 cdr_stats"
# - pyflakes -x W cdr_stats
script:
- python cdr_stats/manage.py test --settings=settings_travis -s -x --with-xtraceback --with-color
python cdr_stats/manage.py test -s -x --with-xtraceback --with-color
#- python cdr_stats/manage.py test --settings=settings_travis -s -x --with-xtraceback --with-color --ignore-files=api_tests.py
#- python cdr_stats/manage.py test --settings=settings_travis -s --with-progressive
# whitelist
branches:
Expand Down
74 changes: 74 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#
#Makefile - Why not :)
#

SHELL := /bin/bash
VERSION = $(shell python setup.py --version)

DB_NAME=cdrstatsdb
DB_OPTS=
PRJ_DIR=./cdr_stats

all:
@echo "See Makefile source for targets details"

recreate-static: clean-static create-static

create-static:
cd $(PRJ_DIR) && ./manage.py collectstatic --noinput

#clean-static:
# cd $(PRJ_DIR) && echo rm -rf $(dirname $(shell ./manage.py findstatic site.js))

makeallmessages:
cd $(PRJ_DIR) && ./manage.py makemessages -s -a -e ".html,.txt"

compilemessages:
cd $(PRJ_DIR) && ./manage.py compilemessages

test:
python setup.py nosetests

release:
git tag $(VERSION)
git push origin $(VERSION)
git push origin master
python setup.py sdist upload

lint-js:
# Check JS for any problems
# Requires jshint
jshint ${STATIC_DIR}/js/mycode.js

watch:
bundle exec guard

runlocal: kill_server
cd $(PRJ_DIR) && python manage.py runserver 0.0.0.0:8000

kill_server:
@if /usr/sbin/lsof -i :8000; then \
echo "WARNING: A server was already listening on port 8000, I'm trying to kill it"; \
kill -9 `/usr/sbin/lsof -i :8000 -Fp|cut -c2-`; \
fi

clean:
find $(PRJ_DIR) -type f -name "*.pyc" -exec rm -rf \{\} \;

cleardb: clean
-dropdb $(DB_NAME) $(DB_OPTS)
createdb $(DB_NAME) $(DB_OPTS) -E UTF-8 -T cdrstatsdb

reset: cleardb
cd $(PRJ_DIR) && python manage.py syncdb --noinput
cd $(PRJ_DIR) && python manage.py loaddata fixtures/auth.json
@echo 'Login as admin/admin'

graph_models:
cd $(PRJ_DIR) && python manage.py graph_models -a -g -o project_models.png

doc_html:
cd docs && rm -rf build/html && rm -rf build/doctrees && make html

doc_pdf:
cd docs && rm -rf build/latex && rm -rf build/doctrees && make latexpdf
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

.. image:: https://github.com/Star2Billing/cdr-stats/raw/master/docs/source/_static/images/cdr-stats_600.png
.. image:: https://github.com/areski/cdr-stats/raw/master/docs/source/_static/images/cdr-stats_600.png

.. image:: https://secure.travis-ci.org/Star2Billing/cdr-stats.png?branch=develop

Expand All @@ -8,7 +8,7 @@ CDR-Stats is a free and open source call detail record analysis and reporting so
Asterisk and other types of VoIP Switch. It allows you to interrogate CDR to provide reports
and statistics via a simple to use powerful web interface.

It is based on the Django Python Framework, Celery, Gevent and MongoDB.
It is based on the Django Python Framework, Celery, Gevent, PostgreSQL and InfluxDB.


Features
Expand Down Expand Up @@ -37,14 +37,14 @@ Applications
This application provide Reports, CDR Viewing, CDR reporting, Dashboard.
Users can login and see their CDR only.

.. image:: https://github.com/Star2Billing/cdr-stats/raw/master/screenshot/cdr-stats-user.png
.. image:: https://github.com/areski/cdr-stats/raw/master/screenshot/cdr-stats-user.png

* Admin UI :
http://localhost:8008/admin/
This interface provides user (ACL) management, assignation of accountcode,
also basic CRUD functions on the CDR

.. image:: https://github.com/Star2Billing/cdr-stats/raw/master/screenshot/cdr-stats-admin.png
.. image:: https://github.com/areski/cdr-stats/raw/master/screenshot/cdr-stats-admin.png


Documentation
Expand Down Expand Up @@ -80,9 +80,9 @@ Conventions :
Additional information
-----------------------

Fork the project on GitHub : https://github.com/Star2Billing/cdr-stats
Fork the project on GitHub : https://github.com/areski/cdr-stats

License : MPL 2.0 (https://raw.github.com/Star2Billing/cdr-stats/master/COPYING)
License : MPL 2.0 (https://raw.github.com/areski/cdr-stats/master/COPYING)

Website : http://www.cdr-stats.org

Expand Down
10 changes: 4 additions & 6 deletions addons/generate_cdr_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys, string
import namegen
import uuid
import random
Expand All @@ -7,8 +6,8 @@
# Use namegen : https://github.com/amnong/namegen


#CallerID, CallerName, Destination, Duration, BillSec, hangupcauseID, uuid, StartDate
#1773500, Erik, 640234009, 50, 45, 16, 3e308846-9036-11e1-964f-000c296bd875, 1327521966
# CallerID, CallerName, Destination, Duration, BillSec, hangupcauseID, uuid, StartDate
# 1773500, Erik, 640234009, 50, 45, 16, 3e308846-9036-11e1-964f-000c296bd875, 1327521966

test = namegen.NameGenerator()
count_contact = 0
Expand All @@ -24,11 +23,10 @@
hangupcause_id = random.randint(15, 17)
timestamp = int(str(time.time()).split('.')[0])
timestamp = timestamp - random.randint(1, 86400)

print "%d, %s, %d, %d, %d, %d, %s, %d" % (start_callerid, callername, start_phonenumber, duration, billsec, hangupcause_id, str(uuid.uuid1()), timestamp)
start_phonenumber = start_phonenumber + 1
start_callerid = start_callerid + 1

if count_contact >= max_contact:
exit()

45 changes: 45 additions & 0 deletions addons/generate_series_cdr_pg.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

CREATE EXTENSION "uuid-ossp";

-- HANGUP_CAUSE = ['NORMAL_CLEARING', 'USER_BUSY', 'NO_ANSWER']
-- HANGUP_CAUSE_Q850 = ['16', '17', '19']


-- Generate 1.000.000 random calls in next the 60 days
INSERT INTO voip_cdr (user_id, switch_id, cdr_source_type, callid, caller_id_number, caller_id_name,
destination_number, starting_date, duration, billsec, hangup_cause_id, direction, country_id,
authorized, buy_rate, buy_cost, sell_rate, sell_cost, data) (
SELECT
1 AS user_id,
cast(random() * 1 as int) + 1 AS switch_id,
cast(random() * 4 as int) + 1 AS cdr_source_type,
cast(uuid_generate_v4() AS text) AS callid,
'+' || cast(30 + cast(trunc(random() * 20 + 1) as int) as text) || 800000000 + cast(trunc(random() * 5000000 + 1) as int) AS caller_id_number,
'' AS caller_id_name,
'+' || cast(30 + cast(trunc(random() * 20 + 1) as int) as text) || 800000000 + cast(trunc(random() * 5000000 + 1) as int) AS destination_number,
current_timestamp - ( cast(trunc(random() * 30) as int) || ' days')::interval
+ ( cast(trunc(random() * 1440) as int) || ' minutes')::interval
AS starting_date,
cast(trunc(random() * 150 + 1) as int) AS duration,
cast(trunc(random() * 120 + 1) as int) AS billsec,
16 + cast(trunc(random() * 10 + 0) as int) AS hangup_cause_id,
cast(random() * 2 as int) AS direction,
cast(trunc(random() * 200 + 1) as int) as country_id,
TRUE AS authorized,
cast(random()::numeric / 5 AS numeric(10,5)) AS buy_rate,
cast(random()::numeric AS numeric(12,5)) AS buy_cost,
cast(random()::numeric / 5 AS numeric(10,5)) / 5 AS sell_rate,
cast(random()::numeric AS numeric(12,5)) AS sell_cost,
'{"mos": 3}'::jsonb AS data
FROM generate_series(1, 500000) AS n
);

-- Generate fake data in events (used to test pydata)
INSERT INTO events (value, starting_date) (
SELECT
cast(random() * 100 as int) + 1 AS value,
current_timestamp - ( cast(trunc(random() * 30) as int) || ' days')::interval
+ ( cast(trunc(random() * 1440) as int) || ' minutes')::interval
AS starting_date
FROM generate_series(1, 50) AS n
);

0 comments on commit 4d743d1

Please sign in to comment.