Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
815eb27
update on README.md
jvnsoares Jan 29, 2016
21adefa
create celcombiller.conf
jvnsoares Jan 29, 2016
bcda905
adjustments on celcombiller.conf file
jvnsoares Feb 5, 2016
44ecd0b
Small changes in the README
jvnsoares Feb 22, 2016
a472768
The admin user credentials were moved from celcom_reduncer to config
Feb 29, 2016
a8ec73d
Now we can pass the imsi as id to change the ballace. It has a bug wh…
Mar 16, 2016
9cdb7fd
Now we can pass the imsi as id to change the ballace. It has a bug wh…
Mar 16, 2016
d86d80d
feat(routes): The route check_balance was added
jvnsoares May 10, 2016
fd869d5
feat(User,Balance) more user's informations and data balance.
jvnsoares May 12, 2016
d11bd19
feat(User,Balance) more user's informations and data balance.
jvnsoares May 12, 2016
67a8de3
Merge branch 'master' of https://github.com/jvnsoares/celcombiller
jvnsoares May 12, 2016
1a6523c
Merge branch 'master' of https://github.com/jvnsoares/celcombiller
jvnsoares May 12, 2016
a313a12
Merge branch 'master' of https://github.com/jvnsoares/celcombiller
jvnsoares May 12, 2016
572ab34
adapting to the new database schema
jvnsoares May 23, 2016
e09e7bd
bug fixes
jvnsoares May 23, 2016
03502cb
feat(cross-domain), fix(style): Cross-domain habilitated and style up…
jvnsoares May 27, 2016
95763d9
feat(cross-domain), fix(style): Cross-domain habilitated and style up…
jvnsoares May 27, 2016
20dcba0
small changes
jvnsoares Jun 9, 2016
6510e36
typo correction
jvnsoares Jun 10, 2016
7daa8fb
feat(reducer) Update the celcombiller_reduce
jvnsoares Jun 13, 2016
49f77fc
feat(upstart) New upstart job to the back end.
jvnsoares Jun 23, 2016
a5a8d4b
Merge pull request #1 from jvnsoares/master
jvnsoares Jul 12, 2016
ee502e1
feat(docs) Docs folder added
jvnsoares Jul 13, 2016
8b458f5
Merge branch 'master' of https://github.com/lasseufpa/celcombiller
jvnsoares Jul 13, 2016
206fc18
feat(users) Now we have 3 level of user
jvnsoares Aug 1, 2016
b2624fb
feat(openbts) Solved the openbts connection issue
jvnsoares Aug 3, 2016
95975e5
Merge pull request #1 from lasseufpa/working_branch
jvnsoares Aug 3, 2016
b9e16c1
Revert "feat(openbts) Solved the openbts connection issue"
jvnsoares Aug 3, 2016
143039d
Merge pull request #2 from jvnsoares/revert-1-working_branch
jvnsoares Aug 3, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 30 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@

CELCOMBiller
============

CELCOMBiller is an open source biller system to *OpenBTS* and *Asterisk*



# Used third-party libraries

* pyst
Expand All @@ -10,7 +18,7 @@
```bash
$ virtualenv -p /usr/bin/python2.7 venv
$ source venv/bin/activate
$ pip install --allow-external pyst --allow-unverified pyst -r requirements.txt
$ pip install --allow-external --allow-unverified -r requirements.txt
```

## Database setup
Expand All @@ -21,13 +29,14 @@ Each SIP user must be inserted in the database of users with a balance. The pyth
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from config import db
from models import User
from models import User, Ballance

admin = User('admin', 'adm123', '999999999', '9999', True)
guest = User('guest', '123123', '999999999', '0000', False)
admin = User(True,'administrator', 'nowhere', '000','admin', 'adm123', '999999999','999999999999999', '0' ,'0')
guest = User(True,'guest', 'nowhere', '1','guest', '123123', '999999998','999999999999998', '0' ,'0')

db.session.add(admin)
db.session.add(guest)

db.session.commit()
```

Expand All @@ -41,7 +50,7 @@ To test the api we will use curl

###USER

login is required to test:
you must login before test the api:

```bash
curl -c cookiefile -d "username=admin&password=adm123" -X POST -s http://localhost:5000/login
Expand All @@ -50,25 +59,31 @@ curl -c cookiefile -d "username=admin&password=adm123" -X POST -s http://localho
now to add user:

```bash
curl -b cookiefile -H "Content-Type: application/json" -X POST -d '{"username":"yourusername","password":"yourpassword","clid":"999999999","imsi":"12345678900" "admin":'false'}' -s http://localhost:5000/api/users
curl -b cookiefile -H "Content-Type: application/json" -X POST -d '{"username":"yourusername","password":"yourpassword","clid":"999999999","imsi":"12345678900", "admin":'false', "name":"administrator","adress":"lasse","cpf":"000","voice_balance":"0","data_balance":"0"}' -s http://localhost:5000/api/users
```

the balance came by another table, so we want add balance to user we need run:

add balance:
add/remove data balance:

```bash
curl -b cookiefile -H "Content-Type: application/json" -X POST -d '{"signal":"+", "type_":"increase", "value": "1000", "userId":1}' -s http://localhost:5000/api/balance
curl -b cookiefile -H "Content-Type: application/json" -X POST -d '{"value": "1000", "user_id":3,"origin":"web"}' -s http://localhost:5000/api/data_balance


#note that userId need some user id, in that case we use 1
#to remove balance the value must be negative
```

remove balance:
add/remove voice balance:

```bash
curl -b cookiefile -H "Content-Type: application/json" -X POST -d '{"signal":"+", "type_":"increase", "value": "1000", "userId":1}' -s http://localhost:5000/api/balance
curl -b cookiefile -H "Content-Type: application/json" -X POST -d '{"value": "1000", "userId":1}' -s http://localhost:5000/api/voice_balance

#note that userId need some user id, in that case we use 1
#to remove balance the value must be negative
```


update user

```bash
Expand All @@ -81,18 +96,18 @@ remove user
curl -X DELETE -s http://localhost:5000/api/users/yourusername -b cookiefile
```

###GROUPS
###Schedule

add group

```bash
curl -X POST -H "Content-Type: application/json" -d '{"name":"group_name","day":1, "month":1, "year":3000, "count":10, "users":[id_]}' -s http://localhost:5000/api/groups
curl -X POST -H "Content-Type: application/json" -d '{"name":"group_name","day":1, "month":1, "year":3000, "count":10}' -s http://localhost:5000/api/schedules
```

update group

```bash
curl -X PATCH -H "Content-Type: application/json" -d '{}' -s http://localost:5000/api/groups/group_name
curl -X PATCH -H "Content-Type: application/json" -d '{}' -s http://localost:5000/api/schedules/schedule
```


Expand Down Expand Up @@ -145,25 +160,7 @@ celcombiller_reducer
```


## Upstart


You dont need to write a constructor, you can either treat the addresses property on a Person instance as a list:

a = Address(email='foo@bar.com')
p = Person(name='foo')
p.addresses.append(a)

Or you can pass a list of addresses to the Person constructor

a = Address(email='foo@bar.com')
p = Person(name='foo', addresses=[a])

In either case you can then access the addresses on your Person instance like so:

db.session.add(p)
db.session.add(a)
db.session.commit()
print p.addresses.count() # 1
print p.addresses[0] # <Address object at 0x10c098ed0>
print p.addresses.filter_by(email='foo@bar.com').count() # 1
To have Celcombiler running as a service you have to modify the file celcombiller.conf and put it in your /etc/init directory.

12 changes: 7 additions & 5 deletions adduser.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from config import db
from models import User, Ballance
from models import User

admin = User('admin', 'adm123', '999999999', True,'999999999999999')
guest = User('guest', '123123', '999999998', False,'000000000000000')

admin = User('0', 'administrator', '000', 'admin', 'adm123',
'999999999', '999999999999999', '0', '0', 'nowhere')
guest = User('3', 'guest', '1', 'guest', '123123', '999999998',
'999999999999998', '0', '0', 'nowhere')

db.session.add(admin)
db.session.add(guest)

db.session.commit()
Loading