├── requirements_dev.txt ├── MANIFEST.in ├── screenshots ├── A2Billing-API-Admin.png └── A2Billing-API-Admin-Edit.png ├── a2billing_flask_api ├── auth.py ├── templates │ └── base.html ├── app.py ├── config.py ├── a2billing_flask_api.py ├── a2billing_flask_app.wsgi ├── admin.py ├── api.py ├── views.py ├── models_orig.py └── models.py ├── install ├── gunicorn │ └── gunicorn.conf.py ├── nginx │ └── a2billing_flask_app.conf ├── supervisor │ └── supervisord_a2billing_flask_api.conf ├── bash-common-functions.sh └── install-a2b-flask-api.sh ├── requirements.txt ├── docs ├── source │ ├── api-documentation.rst │ ├── resources.rst │ ├── index.rst │ ├── api-documentation-extra-charge.rst │ ├── api-documentation-refill.rst │ ├── api-documentation-country.rst │ ├── api-documentation-logrefill.rst │ ├── api-documentation-logpayment.rst │ ├── api-documentation-call.rst │ ├── deploy.rst │ ├── api-documentation-callerid.rst │ ├── api-documentation-card-group.rst │ ├── api-documentation-card.rst │ ├── overview.rst │ ├── api-list.rst │ └── conf.py └── Makefile ├── Makefile ├── .gitignore ├── data └── install-db.sh ├── README.rst ├── HACKING ├── setup.py └── LICENSE /requirements_dev.txt: -------------------------------------------------------------------------------- 1 | Sphinx==1.3.1 2 | sphinx-rtd-theme==0.1.9 3 | pip-review==0.4 4 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | global-exclude *.pyc 2 | include README.rst 3 | include LICENSE 4 | recursive-include a2billing_flask_api * 5 | -------------------------------------------------------------------------------- /screenshots/A2Billing-API-Admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/areski/a2billing-flask-api/HEAD/screenshots/A2Billing-API-Admin.png -------------------------------------------------------------------------------- /screenshots/A2Billing-API-Admin-Edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/areski/a2billing-flask-api/HEAD/screenshots/A2Billing-API-Admin-Edit.png -------------------------------------------------------------------------------- /a2billing_flask_api/auth.py: -------------------------------------------------------------------------------- 1 | from flask_peewee.auth import Auth 2 | from app import app, db 3 | 4 | 5 | # create an Auth object for use with our flask app and database wrapper 6 | auth = Auth(app, db) 7 | -------------------------------------------------------------------------------- /a2billing_flask_api/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test site 4 | 5 |

{% block content_title %}{% endblock %}

6 | {% block content %}{% endblock %} 7 | 8 | -------------------------------------------------------------------------------- /install/gunicorn/gunicorn.conf.py: -------------------------------------------------------------------------------- 1 | bind = "0.0.0.0:8008" 2 | logfile = "/var/log/a2billing-flask-api/a2billing_flask_api.log" 3 | workers = 32 4 | daemon = True 5 | debug = False 6 | pidfile = "/tmp/gunicorn-a2b-flask-api.pid" 7 | -------------------------------------------------------------------------------- /a2billing_flask_api/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | from flask_peewee.db import Database 3 | 4 | app = Flask(__name__) 5 | app.config.from_object('config.Configuration') 6 | # app.config.from_object(__name__) 7 | 8 | # Instantiate the db wrapper 9 | db = Database(app) 10 | -------------------------------------------------------------------------------- /install/nginx/a2billing_flask_app.conf: -------------------------------------------------------------------------------- 1 | 2 | server { 3 | listen 8008; 4 | server_name _; 5 | location / { try_files $uri @yourapplication; } 6 | location @yourapplication { 7 | include uwsgi_params; 8 | uwsgi_pass unix:/tmp/uwsgi.sock; 9 | } 10 | } -------------------------------------------------------------------------------- /install/supervisor/supervisord_a2billing_flask_api.conf: -------------------------------------------------------------------------------- 1 | [program:a2billing_flask_api] 2 | command=/usr/share/virtualenvs/a2billing-flask-api/bin/uwsgi -s /tmp/uwsgi.sock -w a2billing_flask_api:app -H /usr/share/virtualenvs/a2billing-flask-api --chmod-socket=666 3 | directory=/usr/share/a2billing-flask-api 4 | autostart=true 5 | autorestart=true 6 | stdout_logfile=/var/log/a2billing-flask-api/uwsgi.log 7 | redirect_stderr=true 8 | stopsignal=QUIT -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==0.10.1 2 | Flask-HTTPAuth==2.7.0 3 | Jinja2==2.8 4 | MySQL-python==1.2.5 5 | flask-peewee==0.6.5 6 | WTForms==2.0.2 7 | Werkzeug==0.11.2 8 | aniso8601==1.1.0 9 | Babel==2.1.1 10 | docutils==0.12 11 | gunicorn==19.4.1 12 | itsdangerous==0.24 13 | MarkupSafe==0.23 14 | peewee==2.7.3 15 | Pygments==2.0.2 16 | python-dateutil==2.4.2 17 | pytz==2015.7 18 | six==1.10.0 19 | snowballstemmer==1.2.0 20 | uWSGI==2.0.11.2 21 | wtf-peewee==0.2.5 22 | simplejson==3.8.1 23 | -------------------------------------------------------------------------------- /docs/source/api-documentation.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _apis-detailed-documentation: 3 | 4 | APIs Detailed Documentation 5 | --------------------------- 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 2 10 | 11 | api-documentation-card 12 | api-documentation-card-group 13 | api-documentation-callerid 14 | api-documentation-logrefill 15 | api-documentation-logpayment 16 | api-documentation-call 17 | api-documentation-country 18 | api-documentation-refill 19 | api-documentation-extra-charge 20 | -------------------------------------------------------------------------------- /a2billing_flask_api/config.py: -------------------------------------------------------------------------------- 1 | # config 2 | 3 | 4 | class Configuration(object): 5 | # Configure your A2Billing database 6 | DATABASE = { 7 | 'name': 'a2billing_db', 8 | 'engine': 'peewee.MySQLDatabase', 9 | 'user': 'root', 10 | 'passwd': 'password', 11 | } 12 | DEBUG = True 13 | # Set the secret key. keep this really secret 14 | # Default implementation stores all session data in a signed cookie. This requires that the secret_key is set 15 | SECRET_KEY = 'THE_SECRET_KEY' 16 | -------------------------------------------------------------------------------- /docs/source/resources.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _resources: 3 | 4 | Resources 5 | --------- 6 | 7 | Extra tools 8 | ~~~~~~~~~~~ 9 | 10 | * pwiz, a model generator: 11 | 12 | pwiz is a little script that ships with peewee and is capable of introspecting 13 | an existing database and generating model code suitable for interacting with 14 | the underlying data. If you have a database already, pwiz can give you a nice 15 | boost by generating skeleton code with correct column affinities and foreign 16 | keys. 17 | 18 | Documentation: http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#pwiz-a-model-generator 19 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. A2Billing Flask API documentation master file, created by 2 | sphinx-quickstart on Thu Nov 26 13:11:06 2015. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to A2Billing Flask API's documentation! 7 | =============================================== 8 | 9 | 10 | Contents: 11 | 12 | .. toctree:: 13 | :maxdepth: 2 14 | 15 | overview 16 | api-list 17 | api-documentation 18 | deploy 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | 23 | resources 24 | 25 | 26 | 27 | Indices and tables 28 | ================== 29 | 30 | * :ref:`genindex` 31 | * :ref:`modindex` 32 | * :ref:`search` 33 | 34 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docs release clean build install test 2 | 3 | test: buildenv install 4 | . a2billing_flask_api_env/bin/activate; python setup.py test 5 | 6 | buildenv: 7 | virtualenv a2billing_flask_api_env 8 | . a2billing_flask_api_env/bin/activate; pip install -Ur requirements.txt 9 | 10 | # assume that the developer already works with virtualenv 11 | # or virtualenv-wrapper 12 | install: 13 | . a2billing_flask_api_env/bin/activate; python setup.py install 14 | 15 | coverage: install 16 | coverage run --source=a2billing_flask_api setup.py test 17 | coverage report 18 | coverage html 19 | 20 | docs: buildenv 21 | $(MAKE) -C docs; 22 | 23 | clean: 24 | rm -rf a2billing_flask_api_env htmlcov 25 | 26 | cleanall: clean 27 | $(MAKE) -C docs clean 28 | -------------------------------------------------------------------------------- /a2billing_flask_api/a2billing_flask_api.py: -------------------------------------------------------------------------------- 1 | from app import app 2 | from auth import auth 3 | # from flask import Blueprint, abort, request, Response, session, redirect, url_for, g 4 | from peewee import IntegrityError 5 | 6 | from admin import admin 7 | from api import api 8 | from views import * 9 | 10 | admin.setup() 11 | api.setup() 12 | 13 | 14 | if __name__ == '__main__': 15 | auth.User.create_table(fail_silently=True) 16 | # Note.create_table(fail_silently=True) 17 | try: 18 | admin = auth.User(username='admin', email='', admin=True, active=True) 19 | admin.set_password('admin') 20 | admin.save() 21 | except IntegrityError: 22 | print "User 'admin' already created!" 23 | 24 | app.debug = True 25 | app.run(host='0.0.0.0', port=8008) 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | bin/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | 25 | # Installer logs 26 | pip-log.txt 27 | pip-delete-this-directory.txt 28 | 29 | # Unit test / coverage reports 30 | htmlcov/ 31 | .tox/ 32 | .coverage 33 | .cache 34 | nosetests.xml 35 | coverage.xml 36 | 37 | # Translations 38 | *.mo 39 | 40 | # Mr Developer 41 | .mr.developer.cfg 42 | .project 43 | .pydevproject 44 | 45 | # Rope 46 | .ropeproject 47 | 48 | # Django stuff: 49 | *.log 50 | *.pot 51 | 52 | # Sphinx documentation 53 | docs/_build/ 54 | 55 | try_apis/ 56 | -------------------------------------------------------------------------------- /data/install-db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This Source Code Form is subject to the terms of the Mozilla Public 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 | # You can obtain one at http://mozilla.org/MPL/2.0/. 6 | # 7 | # Copyright (C) 2014 Star2Billing S.L. 8 | # 9 | # The Initial Developer of the Original Code is 10 | # Arezqui Belaid 11 | # 12 | 13 | # 14 | # To download and run the script on your server : 15 | # cd /usr/src/ ; wget --no-check-certificate https://raw.github.com/areski/a2billing-flask-api/master/data/install-db.sh -O install-db.sh ; bash install-db.sh 16 | # 17 | 18 | 19 | #Install A2billing DB 20 | apt-get install mysql-server 21 | /etc/init.d/mysql start 22 | 23 | mysql -uroot -ppassword -e "CREATE DATABASE a2billing_db;" 24 | cat a2billing_db.mysql | mysql --user=root --password=password a2billing_db 25 | -------------------------------------------------------------------------------- /a2billing_flask_api/a2billing_flask_app.wsgi: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | 5 | activate_this = '/usr/share/virtualenvs/a2billing-flask-api/bin/activate_this.py' 6 | execfile(activate_this, dict(__file__=activate_this)) 7 | 8 | 9 | apache_configuration= os.path.dirname(__file__) 10 | project = os.path.dirname(apache_configuration) 11 | workspace = os.path.dirname(project) 12 | sys.path.append(workspace) 13 | 14 | sys.path.insert(0, '/usr/share/virtualenvs/a2billing-flask-api/lib/python2.6/site-packages') 15 | sys.path.insert(1, '/usr/share/virtualenvs/a2billing-flask-api/lib/python2.7/site-packages') 16 | sys.path.append('/usr/share') 17 | sys.path.append('/usr/share/a2billing-flask-api') 18 | 19 | # os.environ['DJANGO_SETTINGS_MODULE'] = 'newfies_dialer.settings' 20 | # import django.core.handlers.wsgi 21 | # application = django.core.handlers.wsgi.WSGIHandler() 22 | 23 | from a2billing_flask_api import app as application 24 | -------------------------------------------------------------------------------- /docs/source/api-documentation-extra-charge.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _usage-api-extra-charge: 3 | 4 | Usage API - Extra Charge 5 | ~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | This API will decrement an Account/Card for a given amount (value: Decimal), 8 | then a charge will also be added to log the transaction. 9 | 10 | In the result, the current balance will be returned and the created Charge Id 11 | will also be returned. 12 | 13 | 14 | ADD 15 | ^^^ 16 | 17 | $ curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"amount": 5}' http://localhost:8008/custom_api/extra_charge/1 18 | 19 | Result:: 20 | 21 | HTTP/1.0 200 OK 22 | Content-Type: application/json 23 | Content-Length: 82 24 | Server: Werkzeug/0.11.2 Python/2.7.9 25 | Date: Fri, 27 Nov 2015 22:46:36 GMT 26 | 27 | { 28 | "amount": 5.0, 29 | "card_id": 1, 30 | "charge_id": 8, 31 | "current_balance": 6496.0 32 | } 33 | -------------------------------------------------------------------------------- /docs/source/api-documentation-refill.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _usage-api-refill: 3 | 4 | Usage API - Refill 5 | ~~~~~~~~~~~~~~~~~~ 6 | 7 | This API will refill an Account/Card for a given credit amount (value: Decimal). 8 | A logpayment and a logrefill will also be added to log the refill. 9 | 10 | In the result, the current balance will be returned with the VAT/Tax from the 11 | Account/Card, and the created logpayment ID and logrefill Id will also be returned. 12 | 13 | 14 | ADD 15 | ^^^ 16 | 17 | $ curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"credit": 5}' http://localhost:8008/custom_api/refill/1 18 | 19 | Result:: 20 | 21 | HTTP/1.0 200 OK 22 | Content-Type: application/json 23 | Content-Length: 169 24 | Server: Werkzeug/0.11.2 Python/2.7.9 25 | Date: Fri, 27 Nov 2015 22:04:31 GMT 26 | 27 | { 28 | "card_id": 1, 29 | "credit_without_vat": 5.0, 30 | "credited": 5.0, 31 | "current_balance": 6511.0, 32 | "logpayment_id": 9, 33 | "logrefill_id": 19 34 | "vat": 0 35 | } 36 | -------------------------------------------------------------------------------- /docs/source/api-documentation-country.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _usage-api-country: 3 | 4 | Usage API - Country 5 | ~~~~~~~~~~~~~~~~~~~ 6 | 7 | List of countries. 8 | 9 | 10 | GET ALL 11 | ^^^^^^^ 12 | 13 | $ curl -u username:password http://localhost:8008/api/country/ 14 | 15 | Result:: 16 | 17 | { 18 | "meta": { 19 | "model": "country", 20 | "next": "/api/country/?page=2", 21 | "page": 1, 22 | "previous": "" 23 | }, 24 | "objects": [ 25 | { 26 | "countryname": "Afghanistan", 27 | "id": 1, 28 | "countrycode": "AFG", 29 | "countryprefix": "93" 30 | }, 31 | { 32 | "countryname": "Albania", 33 | "id": 2, 34 | "countrycode": "ALB", 35 | "countryprefix": "355" 36 | }, 37 | ... 38 | ] 39 | } 40 | 41 | 42 | GET ONE 43 | ^^^^^^^ 44 | 45 | TODO: Not documented! 46 | 47 | 48 | DELETE 49 | ^^^^^^ 50 | 51 | TODO: Not documented! 52 | 53 | 54 | ADD 55 | ^^^ 56 | 57 | TODO: Not documented! 58 | 59 | 60 | UPDATE 61 | ^^^^^^ 62 | 63 | TODO: Not documented! 64 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | A2Billing-Flask-API 2 | =================== 3 | 4 | Flexible & Fast Restful APIs framework for A2Billing powered by Flask_ & Peewee_. 5 | A2Billing-Flask-API comes with some tools for exposing your A2Billing 6 | models via a RESTful API. 7 | 8 | .. _Flask: http://flask.pocoo.org/ 9 | .. _Peewee: http://peewee.readthedocs.org/en/latest/ 10 | 11 | 12 | Each RestFul APIs exposed supports the following: 13 | 14 | /api// – GET and POST requests 15 | 16 | /api/// – GET, PUT and DELETE requests 17 | 18 | Also, you can filter results by columns on the model. For example: 19 | 20 | /api/cardgroup/?name=Some%20Blog 21 | 22 | 23 | Documentation 24 | ------------- 25 | 26 | A2Billing-Flask-API's documentation can be found at http://a2billing-flask-api.readthedocs.org/en/latest/index.html 27 | 28 | 29 | Coding Conventions 30 | ------------------ 31 | 32 | This project is PEP8 compilant and please refer to these sources for the Coding 33 | Conventions : http://www.python.org/dev/peps/pep-0008/ 34 | 35 | 36 | Additional information 37 | ----------------------- 38 | 39 | License: MPL V2.0 40 | 41 | Fork the project on GitHub: https://github.com/areski/a2billing-flask-api 42 | 43 | The initial Author is Arezqui Belaid 44 | -------------------------------------------------------------------------------- /docs/source/api-documentation-logrefill.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _usage-api-logrefill: 3 | 4 | Usage API - Logrefill 5 | ~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | This is used to track the refill made into the A2Billing platform. 8 | 9 | 10 | GET ALL 11 | ^^^^^^^ 12 | 13 | $ curl -u username:password http://localhost:8008/api/logrefill/ 14 | 15 | Result:: 16 | 17 | { 18 | "meta": { 19 | "model": "logrefill", 20 | "next": "", 21 | "page": 1, 22 | "previous": "" 23 | }, 24 | "objects": [ 25 | { 26 | "description": "CREATION CARD REFILL", 27 | "refill_type": 0, 28 | "agent": null, 29 | "credit": 5.00000, 30 | "date": "2014-04-16 01:11:45", 31 | "id": 1, 32 | "card": 1, 33 | "added_invoice": 0 34 | }, 35 | { 36 | "description": "4654", 37 | "refill_type": 0, 38 | "agent": null, 39 | "credit": 6456.00000, 40 | "date": "2014-06-04 14:56:36", 41 | "id": 2, 42 | "card": 1, 43 | "added_invoice": 0 44 | }, 45 | ] 46 | } 47 | 48 | 49 | GET ONE 50 | ^^^^^^^ 51 | 52 | TODO: Not documented! 53 | 54 | 55 | DELETE 56 | ^^^^^^ 57 | 58 | TODO: Not documented! 59 | 60 | 61 | ADD 62 | ^^^ 63 | 64 | TODO: Not documented! 65 | 66 | 67 | UPDATE 68 | ^^^^^^ 69 | 70 | TODO: Not documented! 71 | -------------------------------------------------------------------------------- /docs/source/api-documentation-logpayment.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _usage-api-logpayment: 3 | 4 | Usage API - Logpayment 5 | ~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | This is used to track the payment made into the A2Billing platform. 8 | 9 | 10 | GET ALL 11 | ^^^^^^^ 12 | 13 | $ curl -u username:password http://localhost:8008/api/logpayment/ 14 | 15 | Result:: 16 | 17 | { 18 | "meta": { 19 | "model": "logpayment", 20 | "next": "", 21 | "page": 1, 22 | "previous": "" 23 | }, 24 | "objects": [ 25 | { 26 | "added_refill": 1, 27 | "description": "4654", 28 | "added_commission": 0, 29 | "id": 1, 30 | "payment_type": 2, 31 | "agent": null, 32 | "date": "2014-06-04 14:56:36", 33 | "id_logrefill": 2, 34 | "payment": 6456.00000, 35 | "card": 1 36 | }, 37 | { 38 | "added_refill": 0, 39 | "description": null, 40 | "added_commission": 0, 41 | "id": 2, 42 | "payment_type": 0, 43 | "agent": null, 44 | "date": null, 45 | "id_logrefill": 12, 46 | "payment": 5.89000, 47 | "card": 2 48 | }, 49 | ] 50 | } 51 | 52 | 53 | GET ONE 54 | ^^^^^^^ 55 | 56 | TODO: Not documented! 57 | 58 | 59 | DELETE 60 | ^^^^^^ 61 | 62 | TODO: Not documented! 63 | 64 | 65 | ADD 66 | ^^^ 67 | 68 | TODO: Not documented! 69 | 70 | 71 | UPDATE 72 | ^^^^^^ 73 | 74 | TODO: Not documented! 75 | -------------------------------------------------------------------------------- /docs/source/api-documentation-call.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _usage-api-call: 3 | 4 | Usage API - Call 5 | ~~~~~~~~~~~~~~~~ 6 | 7 | This entity is the Call, also known as CDR. 8 | 9 | 10 | GET ALL 11 | ^^^^^^^ 12 | 13 | $ curl -u username:password http://localhost:8008/api/call/ 14 | 15 | Result:: 16 | 17 | { 18 | "meta": { 19 | "model": "call", 20 | "next": "", 21 | "page": 1, 22 | "previous": "" 23 | }, 24 | "objects": [ 25 | { 26 | "calledstation": "7987944994", 27 | "id_did": 0, 28 | "id_tariffplan": 1, 29 | "id": 1, 30 | "id_ratecard": 1, 31 | "terminatecauseid": 5, 32 | "destination": 132487987, 33 | "dnid": "61984644", 34 | "starttime": "2015-11-27 22:36:02", 35 | "id_card_package_offer": 0, 36 | "nasipaddress": "127.0.0.1", 37 | "id_trunk": 2, 38 | "sipiax": null, 39 | "sessionid": "13564654984", 40 | "stoptime": null, 41 | "sessiontime": 40, 42 | "uniqueid": "654654981615", 43 | "src": "source", 44 | "buycost": 0.10000, 45 | "card_id": 1, 46 | "id_tariffgroup": 2, 47 | "real_sessiontime": 50, 48 | "sessionbill": 40.0 49 | } 50 | ] 51 | } 52 | 53 | 54 | GET ONE 55 | ^^^^^^^ 56 | 57 | TODO: Not documented! 58 | 59 | 60 | DELETE 61 | ^^^^^^ 62 | 63 | TODO: Not documented! 64 | 65 | 66 | ADD 67 | ^^^ 68 | 69 | TODO: Not documented! 70 | 71 | 72 | UPDATE 73 | ^^^^^^ 74 | 75 | TODO: Not documented! 76 | -------------------------------------------------------------------------------- /docs/source/deploy.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _deploy-a2billing-flask-api: 3 | 4 | Deploy A2Billing-Flask-API 5 | -------------------------- 6 | 7 | There are many ways to deploy a Flask application, here we will focus on 8 | deploying on Apache2 webserver using mod_wsgi. This should be the easiest way 9 | for A2Billing users without installing too many applications on their server. 10 | 11 | 12 | Installing mod_wsgi 13 | ~~~~~~~~~~~~~~~~~~~ 14 | 15 | If you don't have mod_wsgi installed yet you have to either install it using a package 16 | manager or compile it yourself. 17 | 18 | If you are using Ubuntu/Debian you can apt-get it and activate it as follows:: 19 | 20 | apt-get install libapache2-mod-wsgi 21 | 22 | 23 | WSGI Application 24 | ~~~~~~~~~~~~~~~~ 25 | 26 | To run your application you need an app.wsgi file. Mod_wsgi is executing this 27 | file on startup to get the application object. 28 | 29 | The a2billing_flask_app.wsgi is located at the root of this repository. 30 | 31 | 32 | Configuring Apache 33 | ~~~~~~~~~~~~~~~~~~ 34 | 35 | The last thing to do is to create an Apache configuration file for your application. 36 | 37 | Apache config:: 38 | 39 | 40 | ServerName example.com 41 | 42 | WSGIDaemonProcess a2billing_flask_app user=user1 group=group1 threads=5 43 | WSGIScriptAlias / /usr/share/a2billing-flask-api/a2billing_flask_app.wsgi 44 | 45 | 46 | WSGIProcessGroup a2billing_flask_app 47 | WSGIApplicationGroup %{GLOBAL} 48 | Order deny,allow 49 | Allow from all 50 | 51 | 52 | -------------------------------------------------------------------------------- /HACKING: -------------------------------------------------------------------------------- 1 | Nova Style Commandments 2 | ======================= 3 | 4 | Step 1: Read http://www.python.org/dev/peps/pep-0008/ 5 | Step 2: Read http://www.python.org/dev/peps/pep-0008/ again 6 | Step 3: Read on 7 | 8 | Imports 9 | ------- 10 | - thou shalt not import objects, only modules 11 | - thou shalt not import more than one module per line 12 | - thou shalt not make relative imports 13 | - thou shalt "from nova import vendor" before importing third party code 14 | - thou shalt organize your imports according to the following template 15 | 16 | :: 17 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 18 | {{stdlib imports in human alphabetical order}} 19 | \n 20 | from nova import vendor 21 | {{vendor imports in human alphabetical order}} 22 | \n 23 | {{nova imports in human alphabetical order}} 24 | \n 25 | \n 26 | {{begin your code}} 27 | 28 | 29 | General 30 | ------- 31 | - thou shalt put two newlines twixt toplevel code (funcs, classes, etc) 32 | - thou shalt put one newline twixt methods in classes and anywhere else 33 | - thou shalt not write "except:", use "except Exception:" at the very least 34 | - thou shalt include your name with TODOs as in "TODO(termie)" 35 | - thou shalt not name anything the same name as a builtin or reserved word 36 | - thou shalt not violate causality in our time cone, or else 37 | 38 | 39 | Human Alphabetical Order Examples 40 | --------------------------------- 41 | :: 42 | import httplib 43 | import logging 44 | import random 45 | import StringIO 46 | import time 47 | import unittest 48 | 49 | 50 | Tool to make code PEP8 compliant 51 | -------------------------------- 52 | - Install : https://github.com/cburroughs/pep8 53 | - Usage in your project directory : pep8 --statistics --filename=*.py --show-source --show-pep8 . 54 | -------------------------------------------------------------------------------- /a2billing_flask_api/admin.py: -------------------------------------------------------------------------------- 1 | from flask_peewee.admin import Admin, ModelAdmin 2 | from app import app 3 | from auth import auth 4 | from models import CardGroup, Card, Callerid, Logrefill, Logpayment, Call, Country, Charge 5 | # from models import Did, DidDestination 6 | 7 | 8 | class CardAdmin(ModelAdmin): 9 | columns = ('id', 'username', 'creationdate', 'credit', 'status',) 10 | 11 | 12 | class CardGroupAdmin(ModelAdmin): 13 | columns = ('id', 'name',) 14 | 15 | 16 | class CalleridAdmin(ModelAdmin): 17 | columns = ('id', 'id_cc_card', 'activated', 'cid',) 18 | 19 | 20 | class LogrefillAdmin(ModelAdmin): 21 | columns = ('id', 'card', 'date', 'credit', 'refill_type',) 22 | 23 | 24 | class LogpaymentAdmin(ModelAdmin): 25 | columns = ('id', 'card', 'date', 'credit', 'refill_type',) 26 | 27 | 28 | class CallAdmin(ModelAdmin): 29 | columns = ('card_id', 'sessionid', 'dnid') 30 | 31 | 32 | class CountryAdmin(ModelAdmin): 33 | columns = ('id', 'countrycode', 'countryname') 34 | 35 | 36 | class ChargeAdmin(ModelAdmin): 37 | columns = ('id', 'id_cc_card', 'creationdate', 'amount', 'chargetype') 38 | 39 | 40 | class DidAdmin(ModelAdmin): 41 | columns = ('id', 'did', 'iduser', 'activated', 'reserved') 42 | 43 | 44 | class DidDestinationAdmin(ModelAdmin): 45 | columns = ('destination', 'id_cc_card', 'id_cc_did', 'activated') 46 | 47 | 48 | admin = Admin(app, auth, branding='A2Billing API Admin Site') 49 | admin.register(Card, CardAdmin) 50 | admin.register(CardGroup, CardGroupAdmin) 51 | admin.register(Callerid, CalleridAdmin) 52 | admin.register(Logrefill, LogrefillAdmin) 53 | admin.register(Logpayment, LogpaymentAdmin) 54 | admin.register(Call, CallAdmin) 55 | admin.register(Country, CountryAdmin) 56 | admin.register(Charge, ChargeAdmin) 57 | # admin.register(Did, DidAdmin) 58 | # admin.register(DidDestination, DidDestinationAdmin) 59 | auth.register_admin(admin) 60 | -------------------------------------------------------------------------------- /a2billing_flask_api/api.py: -------------------------------------------------------------------------------- 1 | from flask_peewee.rest import RestAPI, UserAuthentication, RestResource 2 | from flask import request 3 | from auth import auth 4 | from app import app 5 | from models import CardGroup, Card, Callerid, Logrefill, Logpayment, Call, Country, Charge 6 | # from models import Did, DidDestination 7 | import json 8 | 9 | 10 | # create a special resource for users that excludes email and password 11 | class CardResource(RestResource): 12 | # exclude = ('lock_pin',) 13 | 14 | def check_post(self): 15 | datajson = json.loads(request.data) 16 | if 'username' not in datajson or len(datajson['username']) == 0: 17 | return False 18 | if 'useralias' not in datajson or len(datajson['useralias']) == 0: 19 | return False 20 | if 'uipass' not in datajson or len(datajson['uipass']) == 0: 21 | return False 22 | if 'credit' not in datajson or len(datajson['credit']) == 0: 23 | return False 24 | if 'tariff' not in datajson or len(datajson['tariff']) == 0: 25 | return False 26 | 27 | return True 28 | 29 | 30 | # create a special resource for users that excludes email and password 31 | class UserResource(RestResource): 32 | exclude = ('password', 'email',) 33 | 34 | 35 | # class LogrefillResource(RestResource): 36 | 37 | # def prepare_data(self, obj, data): 38 | # data["credit"] = str(data["credit"]) 39 | # return data 40 | 41 | 42 | # instantiate the user auth 43 | user_auth = UserAuthentication(auth, protected_methods=['GET', 'POST', 'PUT', 'DELETE']) 44 | 45 | 46 | # create a RestAPI container 47 | api = RestAPI(app, default_auth=user_auth) 48 | # register the models 49 | api.register(Card, CardResource, auth=user_auth) 50 | api.register(CardGroup, auth=user_auth) 51 | api.register(Callerid, auth=user_auth) 52 | api.register(Logrefill, auth=user_auth) 53 | api.register(Logpayment, auth=user_auth) 54 | api.register(Call, auth=user_auth) 55 | api.register(Country, auth=user_auth) 56 | api.register(Charge, auth=user_auth) 57 | # api.register(Did, auth=user_auth) 58 | # api.register(DidDestination, auth=user_auth) 59 | api.register(auth.User, UserResource, auth=user_auth) 60 | -------------------------------------------------------------------------------- /docs/source/api-documentation-callerid.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _usage-api-callerid: 3 | 4 | Usage API - Callerid 5 | ~~~~~~~~~~~~~~~~~~~~ 6 | 7 | This entity is the CallerIDs associated to a customer (Card) 8 | 9 | 10 | GET ALL 11 | ^^^^^^^ 12 | 13 | $ curl -u username:password http://localhost:8008/api/cardgroup/ 14 | 15 | Result:: 16 | 17 | { 18 | "meta": { 19 | "model": "callerid", 20 | "next": "", 21 | "page": 1, 22 | "previous": "" 23 | }, 24 | "objects": [ 25 | { 26 | "id_cc_card": 1, 27 | "activated": "t", 28 | "id": 2, 29 | "cid": "45454565456456" 30 | } 31 | ] 32 | } 33 | 34 | 35 | 36 | GET ONE 37 | ^^^^^^^ 38 | 39 | $ curl -i -u username:password http://localhost:8008/api/cardgroup/1/ 40 | 41 | Result:: 42 | 43 | HTTP/1.0 200 OK 44 | Content-Type: application/json 45 | Content-Length: 79 46 | Server: Werkzeug/0.11.2 Python/2.7.9 47 | Date: Fri, 27 Nov 2015 21:27:56 GMT 48 | 49 | { 50 | "id_cc_card": 1, 51 | "activated": "t", 52 | "id": 2, 53 | "cid": "45454565456456" 54 | } 55 | 56 | 57 | DELETE 58 | ^^^^^^ 59 | 60 | $ curl -u username:password --dump-header - -H "Content-Type:application/json" -X DELETE http://localhost:8008/api/callerid/6/ 61 | 62 | Result:: 63 | 64 | HTTP/1.0 200 OK 65 | Content-Type: application/json 66 | Content-Length: 18 67 | Server: Werkzeug/0.11.2 Python/2.7.9 68 | Date: Fri, 27 Nov 2015 21:29:18 GMT 69 | 70 | { 71 | "deleted": 1 72 | } 73 | 74 | 75 | ADD 76 | ^^^ 77 | 78 | $ curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"id_cc_card": 1, "cid": "9501234657"}' http://localhost:8008/api/callerid/ 79 | 80 | Result:: 81 | 82 | HTTP/1.0 200 OK 83 | Content-Type: application/json 84 | Content-Length: 75 85 | Server: Werkzeug/0.11.2 Python/2.7.9 86 | Date: Fri, 27 Nov 2015 21:31:19 GMT 87 | 88 | { 89 | "id_cc_card": 1, 90 | "activated": "t", 91 | "id": 7, 92 | "cid": "9501234657" 93 | } 94 | 95 | 96 | UPDATE 97 | ^^^^^^ 98 | 99 | $ curl -u username:password --dump-header - -H "Content-Type:application/json" -X PUT --data '{"cid": "9501234658"}' http://localhost:8008/api/callerid/7/ 100 | 101 | Result:: 102 | 103 | HTTP/1.0 200 OK 104 | Content-Type: application/json 105 | Content-Length: 75 106 | Server: Werkzeug/0.11.2 Python/2.7.9 107 | Date: Fri, 27 Nov 2015 21:32:30 GMT 108 | 109 | { 110 | "id_cc_card": 1, 111 | "activated": "t", 112 | "id": 7, 113 | "cid": "9501234658" 114 | } 115 | -------------------------------------------------------------------------------- /docs/source/api-documentation-card-group.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _usage-api-card-group: 3 | 4 | Usage API - Card Group 5 | ~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | Card Group allows to regroup Card per entity and define agents associated 8 | to them, as well as user permissions when accessing the Customer UI. 9 | 10 | 11 | GET ALL 12 | ^^^^^^^ 13 | 14 | $ curl -u username:password http://localhost:8008/api/cardgroup/ 15 | 16 | Result:: 17 | 18 | { 19 | "meta": { 20 | "model": "cardgroup", 21 | "next": "", 22 | "page": 1, 23 | "previous": "" 24 | }, 25 | "objects": [ 26 | { 27 | "id_agent": null, 28 | "description": "This group is the default group used when you create a customer. It's forbidden to delete it because you need at least one group but you can edit it.", 29 | "users_perms": 262142, 30 | "id": 1, 31 | "name": "DEFAULT" 32 | }, 33 | { 34 | "id_agent": 0, 35 | "description": null, 36 | "users_perms": 0, 37 | "id": 2, 38 | "name": "NewGroup" 39 | } 40 | ] 41 | } 42 | 43 | 44 | GET ONE 45 | ^^^^^^^ 46 | 47 | $ curl -u username:password http://localhost:8008/api/cardgroup/1/ 48 | 49 | Result:: 50 | 51 | { 52 | "id_agent": null, 53 | "description": "This group is the default group used when you create a customer. It's forbidden to delete it because you need at least one group but you can edit it.", 54 | "users_perms": 262142, 55 | "id": 1, 56 | "name": "DEFAULT" 57 | } 58 | 59 | 60 | DELETE 61 | ^^^^^^ 62 | 63 | $ curl -u username:password --dump-header - -H "Content-Type:application/json" -X DELETE http://localhost:8008/api/cardgroup/4/ 64 | 65 | Result:: 66 | 67 | HTTP/1.0 200 OK 68 | Content-Type: application/json 69 | Content-Length: 18 70 | Server: Werkzeug/0.9.4 Python/2.7.5+ 71 | Date: Thu, 17 Apr 2014 16:11:03 GMT 72 | 73 | { 74 | "deleted": 1 75 | } 76 | 77 | 78 | ADD 79 | ^^^ 80 | 81 | $ curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"name": "mygroup", "description": ""}' http://localhost:8008/api/cardgroup/ 82 | 83 | Result:: 84 | 85 | HTTP/1.0 200 OK 86 | Content-Type: application/json 87 | Content-Length: 96 88 | Server: Werkzeug/0.9.4 Python/2.7.5+ 89 | Date: Thu, 17 Apr 2014 16:08:55 GMT 90 | 91 | { 92 | "id_agent": 0, 93 | "description": "", 94 | "users_perms": 0, 95 | "id": 3, 96 | "name": "mygroup" 97 | } 98 | 99 | 100 | UPDATE 101 | ^^^^^^ 102 | 103 | $ curl -u username:password --dump-header - -H "Content-Type:application/json" -X PUT --data '{"name": "mygroup-updated", "description": ""}' http://localhost:8008/api/cardgroup/3/ 104 | 105 | Result:: 106 | 107 | HTTP/1.0 200 OK 108 | Content-Type: application/json 109 | Content-Length: 104 110 | Server: Werkzeug/0.9.4 Python/2.7.5+ 111 | Date: Thu, 17 Apr 2014 16:12:31 GMT 112 | 113 | { 114 | "id_agent": 0, 115 | "description": "", 116 | "users_perms": 0, 117 | "id": 3, 118 | "name": "mygroup-updated" 119 | } 120 | -------------------------------------------------------------------------------- /install/bash-common-functions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This Source Code Form is subject to the terms of the Mozilla Public 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 | # You can obtain one at http://mozilla.org/MPL/2.0/. 6 | # 7 | # Copyright (C) 2014 Star2Billing S.L. 8 | # 9 | # The Initial Developer of the Original Code is 10 | # Arezqui Belaid 11 | # 12 | 13 | DATETIME=$(date +"%Y%m%d%H%M%S") 14 | KERNELARCH=$(uname -p) 15 | SCRIPT_NOTICE="This script is only intended to run on Ubuntu 12.04 / 14.04" 16 | 17 | 18 | # Identify Linux Distribution type 19 | func_identify_os() { 20 | 21 | if [ -f /etc/debian_version ] ; then 22 | DIST='DEBIAN' 23 | if [ "$(lsb_release -cs)" != "lucid" ] && [ "$(lsb_release -cs)" != "precise" ] && [ "$(lsb_release -cs)" != "trusty" ]; then 24 | echo $SCRIPT_NOTICE 25 | exit 255 26 | fi 27 | # elif [ -f /etc/redhat-release ] ; then 28 | # DIST='CENTOS' 29 | # if [ "$(awk '{print $3}' /etc/redhat-release)" != "6.2" ] ; then 30 | # echo $SCRIPT_NOTICE 31 | # exit 255 32 | # fi 33 | else 34 | echo $SCRIPT_NOTICE 35 | exit 1 36 | fi 37 | 38 | #Prepare settings for installation 39 | case $DIST in 40 | 'DEBIAN') 41 | SCRIPT_VIRTUALENVWRAPPER="/usr/local/bin/virtualenvwrapper.sh" 42 | APACHE_CONF_DIR="/etc/apache2/sites-enabled/" 43 | APACHE_USER="www-data" 44 | APACHE_SERVICE='apache2' 45 | WSGI_ADDITIONAL="" 46 | WSGIApplicationGroup="" 47 | ;; 48 | 'CENTOS') 49 | SCRIPT_VIRTUALENVWRAPPER="/usr/bin/virtualenvwrapper.sh" 50 | APACHE_CONF_DIR="/etc/httpd/conf.d/" 51 | APACHE_USER="apache" 52 | APACHE_SERVICE='httpd' 53 | #WSGI_ADDITIONAL="WSGISocketPrefix run/wsgi" 54 | WSGI_ADDITIONAL="WSGISocketPrefix /var/run/wsgi" 55 | WSGIApplicationGroup="WSGIApplicationGroup %{GLOBAL}" 56 | ;; 57 | esac 58 | } 59 | 60 | 61 | #Function mysql db setting 62 | func_get_mysql_database_setting_asteriskcdrdb() { 63 | if mysql -u$MYSQLUSER -p$MYSQLPASSWORD -P$MYHOSTPORT -h$MYHOST $DATABASENAME -e ";" ; then 64 | #Database settings correct 65 | echo "Mysql settings correct!" 66 | else 67 | echo "" 68 | echo "Configure Mysql Settings to connect to the A2Billing Database..." 69 | echo "" 70 | 71 | echo "Enter Mysql hostname (default:localhost)" 72 | read MYHOST 73 | if [ -z "$MYHOST" ]; then 74 | MYHOST="localhost" 75 | fi 76 | echo "Enter Mysql port (default:3306)" 77 | read MYHOSTPORT 78 | if [ -z "$MYHOSTPORT" ]; then 79 | MYHOSTPORT="3306" 80 | fi 81 | echo "Enter Mysql Username (default:root)" 82 | read MYSQLUSER 83 | if [ -z "$MYSQLUSER" ]; then 84 | MYSQLUSER="root" 85 | fi 86 | echo "Enter Mysql Password (default:password)" 87 | read MYSQLPASSWORD 88 | if [ -z "$MYSQLPASSWORD" ]; then 89 | MYSQLPASSWORD="password" 90 | fi 91 | echo "Enter Database name (default:asteriskcdrdb)" 92 | read DATABASENAME 93 | if [ -z "$DATABASENAME" ]; then 94 | DATABASENAME="asteriskcdrdb" 95 | fi 96 | fi 97 | } 98 | -------------------------------------------------------------------------------- /a2billing_flask_api/views.py: -------------------------------------------------------------------------------- 1 | from auth import auth 2 | from app import app 3 | from flask import jsonify 4 | from peewee import * 5 | from functools import wraps 6 | from flask import g, request, redirect, url_for, Response 7 | from models import Card, Logrefill, Logpayment, Charge 8 | import datetime 9 | 10 | 11 | def response_auth_failed(): 12 | return Response('Authentication failed', 401, { 13 | 'WWW-Authenticate': 'Basic realm="Login Required"' 14 | }) 15 | 16 | 17 | def custom_login_required(f): 18 | @wraps(f) 19 | def decorated_function(*args, **kwargs): 20 | basic_auth = request.authorization 21 | if not basic_auth: 22 | return response_auth_failed() 23 | g.user = auth.authenticate(basic_auth.username, basic_auth.password) 24 | if not g.user: 25 | return response_auth_failed() 26 | 27 | return f(*args, **kwargs) 28 | return decorated_function 29 | 30 | 31 | @app.route('/') 32 | def homepage(): 33 | return 'Welcome to A2B Restful API!' 34 | 35 | 36 | @app.route('/private/') 37 | @auth.login_required 38 | def private_view(): 39 | return 'This is private!' 40 | 41 | 42 | @app.route('/custom_api/refill/', methods=['POST']) 43 | @custom_login_required 44 | def refill(card_id): 45 | if not request.json or 'credit' not in request.json: 46 | return Response('Missing credit parameter.', 400) 47 | 48 | # Get Card(vat, credit) 49 | card = Card.select(Card.credit).where(Card.id == card_id) 50 | if not card and not card[0]: 51 | return Response('Card not found.', 400) 52 | 53 | vat = card[0].vat 54 | 55 | credit = float(request.json['credit']) 56 | prev_credit = card[0].credit 57 | new_balance = prev_credit + credit 58 | Card.update(credit=new_balance).where(Card.id == card_id).execute() 59 | 60 | credit_without_vat = credit / (1 + vat / 100) 61 | 62 | # add logrefill 63 | logrefill = Logrefill(card=card_id, date=datetime.datetime.now, credit=credit, refill_type=0) 64 | logrefill.save() 65 | 66 | # add logpayment 67 | logpayment = Logpayment(card=card_id, date=datetime.datetime.now, payment=credit, payment_type=0, id_logrefill=logrefill.id) 68 | logpayment.save() 69 | 70 | # prepare dictionary for JSON return 71 | data = { 72 | 'card_id': card_id, 73 | 'current_balance': new_balance, 74 | 'credit_without_vat': credit_without_vat, 75 | 'credited': credit, 76 | 'vat': card[0].vat, 77 | 'logrefill_id': logrefill.id, 78 | 'logpayment_id': logpayment.id 79 | } 80 | return jsonify(data) 81 | 82 | 83 | @app.route('/custom_api/extra_charge/', methods=['POST']) 84 | @custom_login_required 85 | def extra_charge(card_id): 86 | if not request.json or 'amount' not in request.json: 87 | return Response('Missing amount parameter.', 400) 88 | 89 | # Get Card 90 | card = Card.select(Card.credit).where(Card.id == card_id) 91 | if not card and not card[0]: 92 | return Response('Card not found.', 400) 93 | 94 | amount = float(request.json['amount']) 95 | prev_credit = card[0].credit 96 | new_balance = prev_credit - amount 97 | Card.update(credit=new_balance).where(Card.id == card_id).execute() 98 | 99 | # add charge 100 | charge = Charge(id_cc_card=card_id, amount=amount, chargetype=4) 101 | charge.save() 102 | 103 | # prepare dictionary for JSON return 104 | data = { 105 | 'card_id': card_id, 106 | 'current_balance': new_balance, 107 | 'amount': amount, 108 | 'charge_id': charge.id 109 | } 110 | return jsonify(data) 111 | -------------------------------------------------------------------------------- /docs/source/api-documentation-card.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _usage-api-card: 3 | 4 | Usage API - Card 5 | ~~~~~~~~~~~~~~~~ 6 | 7 | Cards are A2Billing Users on the A2Billing Platform, this regroups credentials and specific information related to 8 | the users, such as names, address, balance, etc.. 9 | 10 | 11 | GET ALL 12 | ^^^^^^^ 13 | 14 | $ curl -u username:password http://localhost:8008/api/card/ 15 | 16 | Result:: 17 | 18 | { 19 | "meta": { 20 | "model": "card", 21 | "next": "", 22 | "page": 1, 23 | "previous": "" 24 | }, 25 | "objects": [ 26 | { 27 | "email_notification": "areski@gmail.com", 28 | "status": 1, 29 | "expiredays": null, 30 | "loginkey": "4654", 31 | "lock_pin": "0", 32 | "useralias": "312224525577965", 33 | "uipass": "18314euvyzix7spr1eew", 34 | "activated": "f", 35 | "currency": "USD", 36 | "tag": "ok", 37 | "initialbalance": 0.0, 38 | "voicemail_activated": 0, 39 | ..., 40 | ... 41 | } 42 | ] 43 | } 44 | 45 | 46 | GET ONE 47 | ^^^^^^^ 48 | 49 | $ curl -u username:password http://localhost:8008/api/card/1/ 50 | 51 | Result:: 52 | 53 | { 54 | "email_notification": "areski@gmail.com", 55 | "status": 1, 56 | "expiredays": null, 57 | "loginkey": "4654", 58 | "lock_pin": "0", 59 | "useralias": "312224525577965", 60 | "uipass": "18314euvyzix7spr1eew", 61 | "activated": "f", 62 | "currency": "USD", 63 | "tag": "ok", 64 | "initialbalance": 0.0, 65 | "voicemail_activated": 0, 66 | "redial": "0", 67 | "id": 1, 68 | "sip_buddy": 1, 69 | "city": "Barcelona", 70 | "id_group": 1, 71 | ..., 72 | } 73 | 74 | 75 | DELETE 76 | ^^^^^^ 77 | 78 | $ curl -u username:password --dump-header - -H "Content-Type:application/json" -X DELETE http://localhost:8008/api/card/4/ 79 | 80 | Result:: 81 | 82 | HTTP/1.0 200 OK 83 | Content-Type: application/json 84 | Content-Length: 18 85 | Server: Werkzeug/0.9.4 Python/2.7.5+ 86 | Date: Thu, 17 Apr 2014 18:50:43 GMT 87 | 88 | { 89 | "deleted": 1 90 | } 91 | 92 | 93 | ADD 94 | ^^^ 95 | 96 | $ curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"username": "1234567890", "useralias": "0554654648", "lastname": "Belaid", "firstname": "Areski", "uipass": "6546456", "credit": "5", "tariff": "1"}' http://localhost:8008/api/card/ 97 | 98 | Result:: 99 | 100 | HTTP/1.0 200 OK 101 | Content-Type: application/json 102 | Content-Length: 1257 103 | Server: Werkzeug/0.9.4 Python/2.7.5+ 104 | Date: Thu, 17 Apr 2014 23:33:14 GMT 105 | 106 | { 107 | "email_notification": "", 108 | "status": 1, 109 | "expiredays": null, 110 | "loginkey": "", 111 | "lock_pin": null, 112 | "useralias": "0554654648", 113 | "uipass": "6546456", 114 | "activated": null, 115 | "currency": "USD", 116 | "tag": "", 117 | "initialbalance": 0.0, 118 | "voicemail_activated": 0, 119 | "redial": "", 120 | "id": 7, 121 | "sip_buddy": 0, 122 | "city": "", 123 | "id_group": 1, 124 | "notify_email": 0, 125 | ... 126 | } 127 | 128 | 129 | UPDATE 130 | ^^^^^^ 131 | 132 | $ curl -u username:password --dump-header - -H "Content-Type:application/json" -X PUT --data '{"lastname": "Belaid"}' http://localhost:8008/api/card/7/ 133 | 134 | Result:: 135 | 136 | HTTP/1.0 200 OK 137 | Content-Type: application/json 138 | Content-Length: 1290 139 | Server: Werkzeug/0.9.4 Python/2.7.5+ 140 | Date: Thu, 17 Apr 2014 23:36:10 GMT 141 | 142 | { 143 | "email_notification": "", 144 | "status": 1, 145 | "expiredays": "", 146 | "loginkey": "", 147 | "lock_pin": null, 148 | "useralias": "0554654648", 149 | "uipass": "6546456", 150 | "activated": "f", 151 | "currency": "USD", 152 | "tag": "", 153 | "initialbalance": 0.0, 154 | "voicemail_activated": 0, 155 | "redial": "", 156 | "id": 7, 157 | "sip_buddy": 0, 158 | "city": "", 159 | "id_group": 1, 160 | "notify_email": 0, 161 | ... 162 | } 163 | -------------------------------------------------------------------------------- /docs/source/overview.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _overview: 3 | 4 | Overview 5 | ======== 6 | 7 | :Source: https://github.com/areski/a2billing-flask-api/ 8 | :Keywords: a2billing, api, flask 9 | 10 | 11 | Flexible & Fast Restful APIs framework for A2Billing powered by Flask_ & Peewee_. 12 | A2Billing-Flask-API comes with some tools for exposing your A2Billing 13 | models via a RESTful API. 14 | 15 | .. _Flask: http://flask.pocoo.org/ 16 | .. _Peewee: http://peewee.readthedocs.org/en/latest/ 17 | 18 | 19 | Each RestFul APIs exposed supports the following: 20 | 21 | /api// – GET and POST requests 22 | 23 | /api/// – GET, PUT and DELETE requests 24 | 25 | Also, you can filter results by columns on the model. For example: 26 | 27 | /api/cardgroup/?name=Some%20Blog 28 | 29 | 30 | .._installation: 31 | 32 | Installation 33 | ------------ 34 | 35 | An install shell script is provided at https://github.com/areski/a2billing-flask-api/tree/master/install 36 | 37 | The install script is intended to run on Debian 8. 38 | 39 | Usage:: 40 | 41 | wget https://raw.githubusercontent.com/areski/a2billing-flask-api/master/install/install-a2b-flask-api.sh 42 | bash install-a2b-flask-api.sh 43 | 44 | 45 | .. _requirements: 46 | 47 | Requirements 48 | ------------ 49 | 50 | This Application is build using Flask and Peewee: 51 | 52 | * Python 2.5 or greater 53 | 54 | * Flask : http://flask.pocoo.org/ 55 | 56 | * Peewee : http://peewee.readthedocs.org/en/latest/ 57 | 58 | * Gunicorn : http://gunicorn.org/ 59 | 60 | * WTForms : http://wtforms.readthedocs.org/en/latest/ 61 | 62 | * MySQL-python : MySQL-python 63 | 64 | * Flask-HTTPAuth : https://pypi.python.org/pypi/Flask-HTTPAuth 65 | 66 | 67 | See the file requirements.txt for the full list of requirements. 68 | 69 | 70 | .._admin-panel: 71 | 72 | Admin Panel 73 | ----------- 74 | 75 | An Admin Panel is provided which can be accessed at http://:8008/admin/ 76 | 77 | You will need an admin username and password to login, see the section below on how to create an admin user. 78 | 79 | View resources: 80 | 81 | .. image:: https://github.com/areski/a2billing-flask-api/raw/master/screenshots/A2Billing-API-Admin.png 82 | 83 | Edit resources: 84 | 85 | .. image:: https://github.com/areski/a2billing-flask-api/raw/master/screenshots/A2Billing-API-Admin-Edit.png 86 | 87 | 88 | .. _stress-test: 89 | 90 | Stress Test 91 | ----------- 92 | 93 | Use ab, the Apache HTTP server benchmarking tool 94 | 95 | Usage:: 96 | 97 | ab -c 100 -n 1000 -p test/post.txt -T application/x-www-form-urlencoded http://localhost:8008/api/cardgroup/ 98 | 99 | 100 | .. _install-deployment: 101 | 102 | Install & Deployment 103 | -------------------- 104 | 105 | There are many ways to deploy a Flask Application, we will describe the Apache Method here as this is the one 106 | more suitable for A2Billing users. 107 | 108 | 109 | Reference: https://www.digitalocean.com/community/articles/how-to-deploy-a-flask-application-on-an-ubuntu-vps 110 | 111 | 112 | .. _security: 113 | 114 | Security 115 | -------- 116 | 117 | Edit a2billing_flaskapi.py and change the secret key and keep this really secret:: 118 | 119 | app.secret_key = 'ssshhhh-and-changeme-when-deploying' 120 | 121 | 122 | .. _create-an-admin-user: 123 | 124 | Create an Admin User 125 | -------------------- 126 | 127 | We now have a functioning admin site, you can login with user / password: admin / admin 128 | 129 | **Change immediately the default password by a strong password!!!** 130 | 131 | You might want to create an other admin user from shell, to do so open up an 132 | interactive python shell in the directory alongside the app and run the following:: 133 | 134 | $ cd /usr/share/a2billing-flask-api/ 135 | $ workon a2billing-flask-api 136 | $ python 137 | 138 | Then in Python interpreter, type the following:: 139 | 140 | from a2billing_flask_api import auth 141 | auth.User.create_table(fail_silently=True) # make sure table created. 142 | admin = auth.User(username='admin', email='', admin=True, active=True) 143 | admin.set_password('admin') 144 | admin.save() 145 | 146 | 147 | .. _documentation: 148 | 149 | Documentation 150 | ------------- 151 | 152 | Check out the documentation on 'Read the Docs': http://a2billing-flask-api.readthedocs.org/en/latest/index.html 153 | 154 | 155 | .. _contributing: 156 | 157 | Contributing 158 | ------------ 159 | 160 | If you've found a bug, add a feature or improve the project and 161 | think it is useful then please consider contributing. 162 | Patches, pull requests or just suggestions are always welcome! 163 | 164 | Source code: https://github.com/areski/a2billing-flask-api/ 165 | 166 | 167 | If you don’t like Github and Git you’re welcome to send regular patches. 168 | 169 | Bug tracker: https://github.com/areski/a2billing-flask-api//issues 170 | 171 | 172 | .. _license: 173 | 174 | License 175 | ------- 176 | 177 | A2Billing-Flask-API is licensed under MPLv2. 178 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # coding=utf-8 3 | 4 | # 5 | # A2Billing-Flask-API License 6 | # http://www.star2billing.com 7 | # 8 | # This Source Code Form is subject to the terms of the Mozilla Public 9 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 10 | # You can obtain one at http://mozilla.org/MPL/2.0/. 11 | # 12 | # Copyright (C) 2011-2012 Star2Billing S.L. 13 | # 14 | # The Initial Developer of the Original Code is 15 | # Arezqui Belaid 16 | # 17 | 18 | 19 | import os 20 | from setuptools import setup, find_packages 21 | from fnmatch import fnmatchcase 22 | from distutils.util import convert_path 23 | 24 | VERSION = '1.0' 25 | 26 | 27 | def read(*parts): 28 | return open(os.path.join(os.path.dirname(__file__), *parts)).read() 29 | 30 | 31 | # Provided as an attribute, so you can append to these instead 32 | # of replicating them: 33 | standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak') 34 | standard_exclude_directories = ('.*', 'CVS', '_darcs', './build', 35 | './dist', 'EGG-INFO', '*.egg-info') 36 | 37 | 38 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 39 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 40 | # Note: you may want to copy this into your setup.py file verbatim, as 41 | # you can't import this from another package, when you don't know if 42 | # that package is installed yet. 43 | def find_package_data(where='.', package='', 44 | exclude=standard_exclude, 45 | exclude_directories=standard_exclude_directories, 46 | only_in_packages=True, 47 | show_ignored=False): 48 | """ 49 | Return a dictionary suitable for use in ``package_data`` 50 | in a distutils ``setup.py`` file. 51 | 52 | The dictionary looks like:: 53 | 54 | {'package': [files]} 55 | 56 | Where ``files`` is a list of all the files in that package that 57 | don't match anything in ``exclude``. 58 | 59 | If ``only_in_packages`` is true, then top-level directories that 60 | are not packages won't be included (but directories under packages 61 | will). 62 | 63 | Directories matching any pattern in ``exclude_directories`` will 64 | be ignored; by default directories with leading ``.``, ``CVS``, 65 | and ``_darcs`` will be ignored. 66 | 67 | If ``show_ignored`` is true, then all the files that aren't 68 | included in package data are shown on stderr (for debugging 69 | purposes). 70 | 71 | Note patterns use wildcards, or can be exact paths (including 72 | leading ``./``), and all searching is case-insensitive. 73 | """ 74 | 75 | out = {} 76 | stack = [(convert_path(where), '', package, only_in_packages)] 77 | while stack: 78 | where, prefix, package, only_in_packages = stack.pop(0) 79 | for name in os.listdir(where): 80 | fn = os.path.join(where, name) 81 | if os.path.isdir(fn): 82 | bad_name = False 83 | for pattern in exclude_directories: 84 | if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()): 85 | bad_name = True 86 | if show_ignored: 87 | print ("Directory %s ignored by pattern %s" % (fn, pattern)) 88 | break 89 | if bad_name: 90 | continue 91 | if (os.path.isfile(os.path.join(fn, '__init__.py')) and not prefix): 92 | if not package: 93 | new_package = name 94 | else: 95 | new_package = package + '.' + name 96 | stack.append((fn, '', new_package, False)) 97 | else: 98 | stack.append((fn, prefix + name + '/', package, only_in_packages)) 99 | elif package or not only_in_packages: 100 | # is a file 101 | bad_name = False 102 | for pattern in exclude: 103 | if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()): 104 | bad_name = True 105 | if show_ignored: 106 | print ("File %s ignored by pattern %s" % (fn, pattern)) 107 | break 108 | if bad_name: 109 | continue 110 | out.setdefault(package, []).append(prefix + name) 111 | return out 112 | 113 | 114 | setup( 115 | name='a2billing-flask-api', 116 | version=VERSION.replace(' ', '-'), 117 | description="Restful APIs framework for A2Billing", 118 | long_description=read('README.rst'), 119 | keywords='a2billing, flask, api, rest', 120 | author='Belaid Arezqui', 121 | author_email='areski@gmail.com', 122 | url='http://github.com/areski/a2billing-flask-api', 123 | license='MPL 2.0 license', 124 | # py_modules=['a2billing_flask_api'], 125 | namespace_packages=[], 126 | # test_suite='tests', 127 | packages=find_packages(), 128 | package_data=find_package_data(), 129 | zip_safe=False, 130 | install_requires=[ 131 | 'setuptools', 132 | 'Jinja2>=2.8', 133 | 'Flask==0.8' 134 | # -*- Extra requirements: -*- 135 | ], 136 | classifiers=[ 137 | 'Development Status :: 5 - Production/Stable', 138 | 'Environment :: Console', 139 | 'Intended Audience :: Developers', 140 | 'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)', 141 | 'Operating System :: OS Independent', 142 | 'Programming Language :: Python', 143 | 'Programming Language :: Python :: 2', 144 | 'Programming Language :: Python :: 2.7', 145 | 'Programming Language :: Python :: 3', 146 | 'Programming Language :: Python :: 3.3', 147 | 'Programming Language :: Python :: 3.4', 148 | 'Programming Language :: Python :: 3.5', 149 | 'Topic :: Multimedia :: Graphics :: Presentation', 150 | 'Topic :: Software Development :: Libraries :: Python Modules', 151 | ], 152 | ) 153 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | 49 | clean: 50 | rm -rf $(BUILDDIR)/* 51 | 52 | html: 53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 54 | @echo 55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 56 | 57 | dirhtml: 58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 59 | @echo 60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 61 | 62 | singlehtml: 63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 64 | @echo 65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 66 | 67 | pickle: 68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 69 | @echo 70 | @echo "Build finished; now you can process the pickle files." 71 | 72 | json: 73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 74 | @echo 75 | @echo "Build finished; now you can process the JSON files." 76 | 77 | htmlhelp: 78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 79 | @echo 80 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 81 | ".hhp project file in $(BUILDDIR)/htmlhelp." 82 | 83 | qthelp: 84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 85 | @echo 86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/A2BillingFlaskAPI.qhcp" 89 | @echo "To view the help file:" 90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/A2BillingFlaskAPI.qhc" 91 | 92 | devhelp: 93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 94 | @echo 95 | @echo "Build finished." 96 | @echo "To view the help file:" 97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/A2BillingFlaskAPI" 98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/A2BillingFlaskAPI" 99 | @echo "# devhelp" 100 | 101 | epub: 102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 103 | @echo 104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 105 | 106 | latex: 107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 108 | @echo 109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 111 | "(use \`make latexpdf' here to do that automatically)." 112 | 113 | latexpdf: 114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 115 | @echo "Running LaTeX files through pdflatex..." 116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 118 | 119 | latexpdfja: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through platex and dvipdfmx..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | text: 126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 127 | @echo 128 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 129 | 130 | man: 131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 132 | @echo 133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 134 | 135 | texinfo: 136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 137 | @echo 138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 139 | @echo "Run \`make' in that directory to run these through makeinfo" \ 140 | "(use \`make info' here to do that automatically)." 141 | 142 | info: 143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 144 | @echo "Running Texinfo files through makeinfo..." 145 | make -C $(BUILDDIR)/texinfo info 146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 147 | 148 | gettext: 149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 150 | @echo 151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 152 | 153 | changes: 154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 155 | @echo 156 | @echo "The overview file is in $(BUILDDIR)/changes." 157 | 158 | linkcheck: 159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 160 | @echo 161 | @echo "Link check complete; look for any errors in the above output " \ 162 | "or in $(BUILDDIR)/linkcheck/output.txt." 163 | 164 | doctest: 165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 166 | @echo "Testing of doctests in the sources finished, look at the " \ 167 | "results in $(BUILDDIR)/doctest/output.txt." 168 | 169 | xml: 170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 171 | @echo 172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 173 | 174 | pseudoxml: 175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 176 | @echo 177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 178 | -------------------------------------------------------------------------------- /docs/source/api-list.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _list-apis: 3 | 4 | List of APIs 5 | ------------ 6 | 7 | This is the list of Restful APIs supported. 8 | 9 | CardGroup - Method [GET/POST/PUT/DELETE] 10 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11 | 12 | Get list of card-groups, create new card-group, Update/Delete existing card-group. 13 | 14 | METHODS: 15 | ^^^^^^^^ 16 | 17 | GET ALL:: 18 | 19 | curl -u username:password http://localhost:8008/api/cardgroup/ 20 | 21 | 22 | GET ALL FILTER:: 23 | 24 | curl -u username:password 'http://localhost:8008/api/cardgroup/?name=DEFAULT' 25 | 26 | 27 | GET ONE:: 28 | 29 | curl -u username:password http://localhost:8008/api/cardgroup/1 30 | 31 | DELETE:: 32 | 33 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X DELETE http://localhost:8008/api/cardgroup/4/ 34 | 35 | ADD:: 36 | 37 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"name": "mygroup", "description": ""}' http://localhost:8008/api/cardgroup/ 38 | 39 | UPDATE:: 40 | 41 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X PUT --data '{"name": "mygroup-updated", "description": ""}' http://localhost:8008/api/cardgroup/3/ 42 | 43 | 44 | Card - Method [GET/POST/PUT/DELETE] 45 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 46 | 47 | Get list of cards, create new card, Update/Delete existing card. 48 | 49 | METHODS: 50 | ^^^^^^^^ 51 | 52 | GET ALL:: 53 | 54 | curl -u username:password http://localhost:8008/api/card/ 55 | 56 | 57 | GET ALL FILTER:: 58 | 59 | curl -u username:password 'http://localhost:8008/api/card/?username=1321546' 60 | 61 | 62 | GET ONE:: 63 | 64 | curl -u username:password http://localhost:8008/api/card/1/ 65 | 66 | DELETE:: 67 | 68 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X DELETE http://localhost:8008/api/card/4/ 69 | 70 | ADD:: 71 | 72 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"name": "mygroup", "description": ""}' http://localhost:8008/api/card/ 73 | 74 | UPDATE:: 75 | 76 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X PUT --data '{"name": "mygroup-updated", "description": ""}' http://localhost:8008/api/card/3/ 77 | 78 | 79 | 80 | Call - Method [GET/POST/PUT/DELETE] 81 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | 83 | Get list of calls, create new calls, Update/Delete existing calls. 84 | 85 | METHODS: 86 | ^^^^^^^^ 87 | 88 | GET ALL:: 89 | 90 | curl -u username:password http://localhost:8008/api/call/ 91 | 92 | 93 | GET ALL FILTER:: 94 | 95 | curl -u username:password 'http://localhost:8008/api/call/?field=1321546' 96 | 97 | 98 | GET ONE:: 99 | 100 | curl -u username:password http://localhost:8008/api/call/1/ 101 | 102 | DELETE:: 103 | 104 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X DELETE http://localhost:8008/api/call/4/ 105 | 106 | ADD:: 107 | 108 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{...}' http://localhost:8008/api/call/ 109 | 110 | UPDATE:: 111 | 112 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X PUT --data '{...}' http://localhost:8008/api/call/3/ 113 | 114 | 115 | 116 | CallerID - Method [GET/POST/PUT/DELETE] 117 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | 119 | Get list of CallerIds, create new CallerIds, Update/Delete existing CallerIds. 120 | 121 | METHODS: 122 | ^^^^^^^^ 123 | 124 | GET ALL:: 125 | 126 | curl -u username:password http://localhost:8008/api/callerid/ 127 | 128 | 129 | GET ALL FILTER:: 130 | 131 | curl -u username:password 'http://localhost:8008/api/callerid/?field=1321546' 132 | 133 | 134 | GET ONE:: 135 | 136 | curl -u username:password http://localhost:8008/api/callerid/1/ 137 | 138 | DELETE:: 139 | 140 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X DELETE http://localhost:8008/api/callerid/4/ 141 | 142 | ADD:: 143 | 144 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{...}' http://localhost:8008/api/callerid/ 145 | 146 | UPDATE:: 147 | 148 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X PUT --data '{...}' http://localhost:8008/api/callerid/3/ 149 | 150 | 151 | 152 | LogRefill - Method [GET/POST/PUT/DELETE] 153 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | 155 | Get list of Refills, create new Refills, Update/Delete existing Refills. 156 | 157 | METHODS: 158 | ^^^^^^^^ 159 | 160 | GET ALL:: 161 | 162 | curl -u username:password http://localhost:8008/api/logrefill/ 163 | 164 | 165 | GET ALL FILTER:: 166 | 167 | curl -u username:password 'http://localhost:8008/api/logrefill/?field=1321546' 168 | 169 | 170 | GET ONE:: 171 | 172 | curl -u username:password http://localhost:8008/api/logrefill/1/ 173 | 174 | DELETE:: 175 | 176 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X DELETE http://localhost:8008/api/logrefill/4/ 177 | 178 | ADD:: 179 | 180 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{...}' http://localhost:8008/api/logrefill/ 181 | 182 | UPDATE:: 183 | 184 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X PUT --data '{...}' http://localhost:8008/api/logrefill/3/ 185 | 186 | 187 | 188 | LogPayment - Method [GET/POST/PUT/DELETE] 189 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | 191 | Get list of Payments, create new Payments, Update/Delete existing Payments. 192 | 193 | METHODS: 194 | ^^^^^^^^ 195 | 196 | GET ALL:: 197 | 198 | curl -u username:password http://localhost:8008/api/logpayment/ 199 | 200 | 201 | GET ALL FILTER:: 202 | 203 | curl -u username:password 'http://localhost:8008/api/logpayment/?field=1321546' 204 | 205 | 206 | GET ONE:: 207 | 208 | curl -u username:password http://localhost:8008/api/logpayment/1/ 209 | 210 | DELETE:: 211 | 212 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X DELETE http://localhost:8008/api/logpayment/4/ 213 | 214 | ADD:: 215 | 216 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{...}' http://localhost:8008/api/logpayment/ 217 | 218 | UPDATE:: 219 | 220 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X PUT --data '{...}' http://localhost:8008/api/logpayment/3/ 221 | 222 | 223 | Country - Method [GET/POST/PUT/DELETE] 224 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 225 | 226 | Get list of Countries, create new Countries, Update/Delete existing Countries. 227 | 228 | METHODS: 229 | ^^^^^^^^ 230 | 231 | GET ALL:: 232 | 233 | curl -u username:password http://localhost:8008/api/country/ 234 | 235 | 236 | GET ALL FILTER:: 237 | 238 | curl -u username:password 'http://localhost:8008/api/country/?field=1321546' 239 | 240 | 241 | GET ONE:: 242 | 243 | curl -u username:password http://localhost:8008/api/country/1/ 244 | 245 | DELETE:: 246 | 247 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X DELETE http://localhost:8008/api/country/4/ 248 | 249 | ADD:: 250 | 251 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{...}' http://localhost:8008/api/country/ 252 | 253 | UPDATE:: 254 | 255 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X PUT --data '{...}' http://localhost:8008/api/country/3/ 256 | 257 | 258 | Refill - Method [POST] 259 | ~~~~~~~~~~~~~~~~~~~~~~ 260 | 261 | This API will refill an Account/Card for a given credit amount (value: Decimal). 262 | A logpayment and a logrefill will also be added to log the refill. 263 | 264 | In the result, the current balance will be returned with the VAT/Tax from the 265 | Account/Card, and the created logpayment ID and logrefill Id will also be returned. 266 | 267 | METHODS: 268 | ^^^^^^^^ 269 | 270 | ADD:: 271 | 272 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"credit": 5}' http://localhost:8008/custom_api/refill/1 273 | 274 | 275 | Extra Charge - Method [POST] 276 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | 278 | This API will decrement an Account/Card for a given amount (value: Decimal), 279 | then a charge will also be added to log the transaction. 280 | 281 | In the result, the current balance will be returned and the created Charge Id 282 | will also be returned. 283 | 284 | METHODS: 285 | ^^^^^^^^ 286 | 287 | ADD:: 288 | 289 | curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"amount": 5}' http://localhost:8008/custom_api/extra_charge/1 290 | -------------------------------------------------------------------------------- /install/install-a2b-flask-api.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This Source Code Form is subject to the terms of the Mozilla Public 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 | # You can obtain one at http://mozilla.org/MPL/2.0/. 6 | # 7 | # Copyright (C) 2014 Star2Billing S.L. 8 | # 9 | # The Initial Developer is 10 | # Arezqui Belaid 11 | # 12 | 13 | # 14 | # To download and run the script on your server : 15 | # cd /usr/src/ ; rm install-a2b-flask-api.sh; wget --no-check-certificate https://raw.githubusercontent.com/areski/a2billing-flask-api/master/install/install-a2b-flask-api.sh -O install-a2b-flask-api.sh ; bash install-a2b-flask-api.sh 16 | # 17 | 18 | INSTALL_MODE='CLONE' 19 | INSTALL_DIR='/usr/share/a2billing-flask-api' 20 | INSTALL_ENV="a2billing-flask-api" 21 | HTTP_PORT="8008" 22 | 23 | export LANGUAGE=en_US.UTF-8 24 | export LANG=en_US.UTF-8 25 | export LC_ALL=en_US.UTF-8 26 | 27 | #Include general functions 28 | rm bash-common-functions.sh 29 | wget --no-check-certificate https://raw.githubusercontent.com/areski/a2billing-flask-api/master/install/bash-common-functions.sh -O bash-common-functions.sh 30 | source bash-common-functions.sh 31 | 32 | #Identify the OS 33 | func_identify_os 34 | 35 | 36 | #Fuction to create the virtual env 37 | func_setup_virtualenv() { 38 | echo "This will install virtualenv & virtualenvwrapper" 39 | echo "and create a new virtualenv : $INSTALL_ENV" 40 | 41 | easy_install virtualenv 42 | easy_install virtualenvwrapper 43 | 44 | # Enable virtualenvwrapper 45 | chk=`grep "virtualenvwrapper" ~/.bashrc|wc -l` 46 | if [ $chk -lt 1 ] ; then 47 | echo "Set Virtualenvwrapper into bash" 48 | echo "export WORKON_HOME=/usr/share/virtualenvs" >> ~/.bashrc 49 | echo "source $SCRIPT_VIRTUALENVWRAPPER" >> ~/.bashrc 50 | fi 51 | 52 | # Setup virtualenv 53 | export WORKON_HOME=/usr/share/virtualenvs 54 | source $SCRIPT_VIRTUALENVWRAPPER 55 | 56 | mkvirtualenv $INSTALL_ENV 57 | workon $INSTALL_ENV 58 | 59 | echo "Virtualenv $INSTALL_ENV created and activated" 60 | echo "" 61 | } 62 | 63 | 64 | #NGINX / SUPERVISOR 65 | func_nginx_supervisor(){ 66 | #Leave virtualenv 67 | # deactivate 68 | #Install Supervisor 69 | # pip install supervisor 70 | 71 | #Nginx 72 | cp /usr/src/a2billing-flask-api/install/nginx/a2billing_flask_app.conf /etc/nginx/sites-enabled/ 73 | 74 | #Configure and Start supervisor 75 | case $DIST in 76 | 'DEBIAN') 77 | cp /usr/src/a2billing-flask-api/install/supervisor/supervisord_a2billing_flask_api.conf /etc/supervisor/conf.d/ 78 | ;; 79 | 'CENTOS') 80 | #TODO: support CentOS 81 | 82 | # cp /usr/src/a2billing-flask-api/install/supervisor/centos/supervisord /etc/init.d/supervisor 83 | # chmod +x /etc/init.d/supervisor 84 | # chkconfig --levels 235 supervisor on 85 | # cp /usr/src/a2billing-flask-api/install/supervisor/centos/supervisord.conf /etc/supervisord.conf 86 | # mkdir -p /etc/supervisor/conf.d 87 | # cp /usr/src/a2billing-flask-api/install/supervisor/gunicorn_a2billing_flask_api.conf /etc/supervisor/conf.d/ 88 | # mkdir /var/log/supervisor/ 89 | ;; 90 | esac 91 | #Restart 92 | /etc/init.d/supervisor stop; sleep 2; /etc/init.d/supervisor start 93 | /etc/init.d/nginx restart 94 | } 95 | 96 | 97 | #Configure Logs files and logrotate 98 | func_prepare_logger() { 99 | echo "" 100 | echo "Prepare logger..." 101 | 102 | mkdir /var/log/a2billing-flask-api/ 103 | touch /var/log/a2billing-flask-api/err-apache-a2billing_flask_api.log 104 | touch /var/log/a2billing-flask-api/a2billing_flask_api.log 105 | chown -R $APACHE_USER:$APACHE_USER /var/log/a2billing-flask-api 106 | 107 | rm /etc/logrotate.d/a2billing_flask_api 108 | touch /etc/logrotate.d/a2billing_flask_api 109 | echo ' 110 | /var/log/a2billing-flask-api/*.log { 111 | daily 112 | rotate 10 113 | size = 50M 114 | missingok 115 | compress 116 | } 117 | ' > /etc/logrotate.d/a2billing_flask_api 118 | 119 | logrotate /etc/logrotate.d/a2billing_flask_api 120 | } 121 | 122 | 123 | #Function to install Frontend 124 | func_install() { 125 | echo "" 126 | echo "We will now install a2billing-flask-api on your server" 127 | echo "======================================================" 128 | echo "" 129 | 130 | #python setup tools 131 | echo "Install dependencies and Python modules..." 132 | echo "" 133 | case $DIST in 134 | 'DEBIAN') 135 | apt-get -y install python-setuptools python-dev build-essential git-core mercurial gawk 136 | easy_install pip 137 | apt-get -y install libapache2-mod-python libapache2-mod-wsgi 138 | apt-get -y install libmysqld-dev 139 | apt-get -y install nginx supervisor 140 | ;; 141 | 'CENTOS') 142 | if [ "$INSTALLMODE" = "FULL" ]; then 143 | yum -y update 144 | fi 145 | yum -y install autoconf automake bzip2 cpio curl curl-devel curl-devel expat-devel fileutils gcc-c++ gettext-devel gnutls-devel libjpeg-devel libogg-devel libtiff-devel libtool libvorbis-devel make ncurses-devel nmap openssl openssl-devel openssl-devel perl patch unzip wget zip zlib zlib-devel policycoreutils-python 146 | 147 | if [ ! -f /etc/yum.repos.d/rpmforge.repo ]; 148 | then 149 | # Install RPMFORGE Repo 150 | if [ $KERNELARCH = "x86_64" ]; then 151 | rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 152 | else 153 | rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm 154 | fi 155 | fi 156 | 157 | yum -y --enablerepo=rpmforge install git-core 158 | 159 | #Install epel repo for pip and mod_python 160 | if [ $KERNELARCH = "x86_64" ]; then 161 | rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm 162 | else 163 | rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm 164 | fi 165 | 166 | # disable epel repository since by default it is enabled. 167 | sed -i "s/enabled=1/enable=0/" /etc/yum.repos.d/epel.repo 168 | yum -y --enablerepo=epel install python-pip mod_python python-setuptools python-tools python-devel mercurial mod_wsgi libevent libevent-devel 169 | ;; 170 | esac 171 | 172 | #Create and enable virtualenv 173 | func_setup_virtualenv 174 | 175 | echo "Install a2billing-flask-api..." 176 | cd /usr/src/ 177 | rm -rf a2billing-flask-api 178 | 179 | #Configure Logs files and logrotate 180 | func_prepare_logger 181 | 182 | case $INSTALL_MODE in 183 | 'CLONE') 184 | git clone git://github.com/areski/a2billing-flask-api.git 185 | ;; 186 | esac 187 | 188 | # Copy files 189 | cp -rf /usr/src/a2billing-flask-api/a2billing_flask_api $INSTALL_DIR 190 | 191 | # Update Secret key 192 | echo "Update Secret Key..." 193 | RANDPASSW=` /dev/null 2>&1 || head -c 50)` 194 | sed -i "s/THE_SECRET_KEY/$RANDPASSW/g" /usr/share/a2billing-flask-api//usr/share/a2billing_flask_api.py 195 | 196 | #Install depencencies 197 | easy_install -U distribute 198 | echo "Install requirements..." 199 | for line in $(cat /usr/src/a2billing-flask-api/requirements.txt) 200 | do 201 | pip install $line 202 | done 203 | 204 | #Fix permission on python-egg 205 | mkdir $INSTALL_DIR/.python-eggs 206 | 207 | #Create admin user 208 | python /usr/share/a2billing-flask-api/a2billing_flask_api.py 209 | 210 | #Configure Supervisor and Nginx 211 | func_nginx_supervisor 212 | 213 | echo "" 214 | echo "*************************************************************" 215 | echo "Congratulations, A2Billing-Flask-API Server is now installed!" 216 | echo "*************************************************************" 217 | echo "" 218 | echo "" 219 | echo "You should now edit /usr/share/a2billing-flask-api/a2billing_flask_api.py" 220 | echo "and enter the right DB settings to connect to your A2Billing Database" 221 | echo "See the file /etc/a2billing.conf" 222 | echo "" 223 | echo "Example of common settings:" 224 | echo "" 225 | echo "DATABASE = {" 226 | echo " 'name': 'a2billing14'," 227 | echo " 'engine': 'peewee.MySQLDatabase'," 228 | echo " 'user': 'a2bdbuser'," 229 | echo " 'passwd': 'a2bdbpassw'," 230 | echo "}" 231 | echo "" 232 | echo "Restart Apache:" 233 | echo "/etc/init.d/apache2 restart" 234 | echo "" 235 | echo "Admin Panel is provided which can be accessed at http://:8008/admin/" 236 | echo "Now you can access the admin site and log-in with: admin / admin" 237 | echo "" 238 | echo "To create a new admin user refer to the README.rst:" 239 | echo "https://github.com/areski/a2billing-flask-api/blob/master/README.rst#create-an-admin-user" 240 | echo "" 241 | echo "" 242 | } 243 | 244 | #Run install 245 | func_install 246 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # A2Billing Flask API documentation build configuration file, created by 4 | # sphinx-quickstart on Thu Nov 26 13:11:06 2015. 5 | # 6 | # This file is execfile()d with the current directory set to its 7 | # containing dir. 8 | # 9 | # Note that not all possible configuration values are present in this 10 | # autogenerated file. 11 | # 12 | # All configuration values have a default; values that are commented out 13 | # serve to show the default. 14 | 15 | import sys 16 | import os 17 | 18 | # If extensions (or modules to document with autodoc) are in another directory, 19 | # add these directories to sys.path here. If the directory is relative to the 20 | # documentation root, use os.path.abspath to make it absolute, like shown here. 21 | #sys.path.insert(0, os.path.abspath('.')) 22 | 23 | # -- General configuration ------------------------------------------------ 24 | 25 | # If your documentation needs a minimal Sphinx version, state it here. 26 | #needs_sphinx = '1.0' 27 | 28 | # Add any Sphinx extension module names here, as strings. They can be 29 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 30 | # ones. 31 | extensions = [] 32 | 33 | # Add any paths that contain templates here, relative to this directory. 34 | templates_path = ['_templates'] 35 | 36 | # The suffix of source filenames. 37 | source_suffix = '.rst' 38 | 39 | # The encoding of source files. 40 | #source_encoding = 'utf-8-sig' 41 | 42 | # The master toctree document. 43 | master_doc = 'index' 44 | 45 | # General information about the project. 46 | project = u'A2Billing Flask API' 47 | copyright = u'2015, Areski Belaid' 48 | 49 | # The version info for the project you're documenting, acts as replacement for 50 | # |version| and |release|, also used in various other places throughout the 51 | # built documents. 52 | # 53 | # The short X.Y version. 54 | version = '1.0' 55 | # The full version, including alpha/beta/rc tags. 56 | release = '1.0' 57 | 58 | # The language for content autogenerated by Sphinx. Refer to documentation 59 | # for a list of supported languages. 60 | #language = None 61 | 62 | # There are two options for replacing |today|: either, you set today to some 63 | # non-false value, then it is used: 64 | #today = '' 65 | # Else, today_fmt is used as the format for a strftime call. 66 | #today_fmt = '%B %d, %Y' 67 | 68 | # List of patterns, relative to source directory, that match files and 69 | # directories to ignore when looking for source files. 70 | exclude_patterns = [] 71 | 72 | # The reST default role (used for this markup: `text`) to use for all 73 | # documents. 74 | #default_role = None 75 | 76 | # If true, '()' will be appended to :func: etc. cross-reference text. 77 | #add_function_parentheses = True 78 | 79 | # If true, the current module name will be prepended to all description 80 | # unit titles (such as .. function::). 81 | #add_module_names = True 82 | 83 | # If true, sectionauthor and moduleauthor directives will be shown in the 84 | # output. They are ignored by default. 85 | #show_authors = False 86 | 87 | # The name of the Pygments (syntax highlighting) style to use. 88 | pygments_style = 'sphinx' 89 | 90 | # A list of ignored prefixes for module index sorting. 91 | #modindex_common_prefix = [] 92 | 93 | # If true, keep warnings as "system message" paragraphs in the built documents. 94 | #keep_warnings = False 95 | 96 | 97 | # -- Options for HTML output ---------------------------------------------- 98 | 99 | # The theme to use for HTML and HTML Help pages. See the documentation for 100 | # a list of builtin themes. 101 | # html_theme = 'alabaster' 102 | html_theme = 'sphinx_rtd_theme' 103 | 104 | # Theme options are theme-specific and customize the look and feel of a theme 105 | # further. For a list of options available for each theme, see the 106 | # documentation. 107 | #html_theme_options = {} 108 | 109 | # Add any paths that contain custom themes here, relative to this directory. 110 | #html_theme_path = [] 111 | 112 | # The name for this set of Sphinx documents. If None, it defaults to 113 | # " v documentation". 114 | #html_title = None 115 | 116 | # A shorter title for the navigation bar. Default is the same as html_title. 117 | #html_short_title = None 118 | 119 | # The name of an image file (relative to this directory) to place at the top 120 | # of the sidebar. 121 | #html_logo = None 122 | 123 | # The name of an image file (within the static path) to use as favicon of the 124 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 125 | # pixels large. 126 | #html_favicon = None 127 | 128 | # Add any paths that contain custom static files (such as style sheets) here, 129 | # relative to this directory. They are copied after the builtin static files, 130 | # so a file named "default.css" will overwrite the builtin "default.css". 131 | html_static_path = ['_static'] 132 | 133 | # Add any extra paths that contain custom files (such as robots.txt or 134 | # .htaccess) here, relative to this directory. These files are copied 135 | # directly to the root of the documentation. 136 | #html_extra_path = [] 137 | 138 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 139 | # using the given strftime format. 140 | #html_last_updated_fmt = '%b %d, %Y' 141 | 142 | # If true, SmartyPants will be used to convert quotes and dashes to 143 | # typographically correct entities. 144 | #html_use_smartypants = True 145 | 146 | # Custom sidebar templates, maps document names to template names. 147 | #html_sidebars = {} 148 | 149 | # Additional templates that should be rendered to pages, maps page names to 150 | # template names. 151 | #html_additional_pages = {} 152 | 153 | # If false, no module index is generated. 154 | #html_domain_indices = True 155 | 156 | # If false, no index is generated. 157 | #html_use_index = True 158 | 159 | # If true, the index is split into individual pages for each letter. 160 | #html_split_index = False 161 | 162 | # If true, links to the reST sources are added to the pages. 163 | #html_show_sourcelink = True 164 | 165 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 166 | #html_show_sphinx = True 167 | 168 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 169 | #html_show_copyright = True 170 | 171 | # If true, an OpenSearch description file will be output, and all pages will 172 | # contain a tag referring to it. The value of this option must be the 173 | # base URL from which the finished HTML is served. 174 | #html_use_opensearch = '' 175 | 176 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 177 | #html_file_suffix = None 178 | 179 | # Output file base name for HTML help builder. 180 | htmlhelp_basename = 'A2BillingFlaskAPIdoc' 181 | 182 | 183 | # -- Options for LaTeX output --------------------------------------------- 184 | 185 | latex_elements = { 186 | # The paper size ('letterpaper' or 'a4paper'). 187 | #'papersize': 'letterpaper', 188 | 189 | # The font size ('10pt', '11pt' or '12pt'). 190 | #'pointsize': '10pt', 191 | 192 | # Additional stuff for the LaTeX preamble. 193 | #'preamble': '', 194 | } 195 | 196 | # Grouping the document tree into LaTeX files. List of tuples 197 | # (source start file, target name, title, 198 | # author, documentclass [howto, manual, or own class]). 199 | latex_documents = [ 200 | ('index', 'A2BillingFlaskAPI.tex', u'A2Billing Flask API Documentation', 201 | u'Areski Belaid', 'manual'), 202 | ] 203 | 204 | # The name of an image file (relative to this directory) to place at the top of 205 | # the title page. 206 | #latex_logo = None 207 | 208 | # For "manual" documents, if this is true, then toplevel headings are parts, 209 | # not chapters. 210 | #latex_use_parts = False 211 | 212 | # If true, show page references after internal links. 213 | #latex_show_pagerefs = False 214 | 215 | # If true, show URL addresses after external links. 216 | #latex_show_urls = False 217 | 218 | # Documents to append as an appendix to all manuals. 219 | #latex_appendices = [] 220 | 221 | # If false, no module index is generated. 222 | #latex_domain_indices = True 223 | 224 | 225 | # -- Options for manual page output --------------------------------------- 226 | 227 | # One entry per manual page. List of tuples 228 | # (source start file, name, description, authors, manual section). 229 | man_pages = [ 230 | ('index', 'a2billingflaskapi', u'A2Billing Flask API Documentation', 231 | [u'Areski Belaid'], 1) 232 | ] 233 | 234 | # If true, show URL addresses after external links. 235 | #man_show_urls = False 236 | 237 | 238 | # -- Options for Texinfo output ------------------------------------------- 239 | 240 | # Grouping the document tree into Texinfo files. List of tuples 241 | # (source start file, target name, title, author, 242 | # dir menu entry, description, category) 243 | texinfo_documents = [ 244 | ('index', 'A2BillingFlaskAPI', u'A2Billing Flask API Documentation', 245 | u'Areski Belaid', 'A2BillingFlaskAPI', 'One line description of project.', 246 | 'Miscellaneous'), 247 | ] 248 | 249 | # Documents to append as an appendix to all manuals. 250 | #texinfo_appendices = [] 251 | 252 | # If false, no module index is generated. 253 | #texinfo_domain_indices = True 254 | 255 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 256 | #texinfo_show_urls = 'footnote' 257 | 258 | # If true, do not generate a @detailmenu in the "Top" node's menu. 259 | #texinfo_no_detailmenu = False 260 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /a2billing_flask_api/models_orig.py: -------------------------------------------------------------------------------- 1 | from flask_peewee.db import Database 2 | from app import db 3 | 4 | 5 | # Configure your A2Billing database 6 | DATABASE = { 7 | 'name': 'a2billing_db', 8 | 'engine': 'peewee.MySQLDatabase', 9 | 'user': 'root', 10 | 'passwd': 'password', 11 | } 12 | 13 | 14 | from peewee import * 15 | 16 | database = MySQLDatabase('a2billing_db', **{'password': 'password', 'user': 'root'}) 17 | 18 | 19 | class BaseModel(Model): 20 | class Meta: 21 | database = database 22 | 23 | 24 | class CcAgent(BaseModel): 25 | active = CharField() 26 | address = CharField(null=True) 27 | bank_info = TextField(null=True) 28 | banner = TextField(null=True) 29 | city = CharField(null=True) 30 | com_balance = DecimalField() 31 | commission = DecimalField() 32 | company = CharField(null=True) 33 | country = CharField(null=True) 34 | credit = DecimalField() 35 | currency = CharField(null=True) 36 | datecreation = DateTimeField() 37 | email = CharField(null=True) 38 | fax = CharField(null=True) 39 | firstname = CharField(null=True) 40 | id = BigIntegerField(primary_key=True) 41 | id_tariffgroup = IntegerField(null=True) 42 | language = CharField(null=True) 43 | lastname = CharField(null=True) 44 | locale = CharField(null=True) 45 | location = TextField(null=True) 46 | login = CharField(unique=True) 47 | options = IntegerField() 48 | passwd = CharField(null=True) 49 | perms = IntegerField(null=True) 50 | phone = CharField(null=True) 51 | state = CharField(null=True) 52 | threshold_remittance = DecimalField() 53 | vat = DecimalField() 54 | zipcode = CharField(null=True) 55 | 56 | class Meta: 57 | db_table = 'cc_agent' 58 | 59 | 60 | class CcAgentCommission(BaseModel): 61 | amount = DecimalField() 62 | commission_percent = DecimalField() 63 | commission_type = IntegerField() 64 | date = DateTimeField() 65 | description = TextField(null=True) 66 | id = BigIntegerField(primary_key=True) 67 | id_agent = IntegerField() 68 | id_card = BigIntegerField() 69 | id_payment = BigIntegerField(null=True) 70 | 71 | class Meta: 72 | db_table = 'cc_agent_commission' 73 | 74 | 75 | class CcAgentSignup(BaseModel): 76 | code = CharField(unique=True) 77 | id = BigIntegerField(primary_key=True) 78 | id_agent = IntegerField() 79 | id_group = IntegerField() 80 | id_tariffgroup = IntegerField() 81 | 82 | class Meta: 83 | db_table = 'cc_agent_signup' 84 | 85 | 86 | class CcAgentTariffgroup(BaseModel): 87 | id_agent = BigIntegerField() 88 | id_tariffgroup = IntegerField() 89 | 90 | class Meta: 91 | db_table = 'cc_agent_tariffgroup' 92 | indexes = ( 93 | (('id_agent', 'id_tariffgroup'), True), 94 | ) 95 | primary_key = CompositeKey('id_agent', 'id_tariffgroup') 96 | 97 | 98 | class CcAlarm(BaseModel): 99 | datecreate = DateTimeField() 100 | datelastrun = DateTimeField() 101 | emailreport = CharField(null=True) 102 | id = BigIntegerField(primary_key=True) 103 | id_trunk = IntegerField(null=True) 104 | maxvalue = FloatField() 105 | minvalue = FloatField() 106 | name = TextField() 107 | numberofalarm = IntegerField() 108 | numberofrun = IntegerField() 109 | periode = IntegerField() 110 | status = IntegerField() 111 | type = IntegerField() 112 | 113 | class Meta: 114 | db_table = 'cc_alarm' 115 | 116 | 117 | class CcAlarmReport(BaseModel): 118 | calculatedvalue = FloatField() 119 | cc_alarm = BigIntegerField(db_column='cc_alarm_id') 120 | daterun = DateTimeField() 121 | id = BigIntegerField(primary_key=True) 122 | 123 | class Meta: 124 | db_table = 'cc_alarm_report' 125 | 126 | 127 | class CcAutorefillReport(BaseModel): 128 | daterun = DateTimeField() 129 | id = BigIntegerField(primary_key=True) 130 | totalcardperform = IntegerField(null=True) 131 | totalcredit = DecimalField(null=True) 132 | 133 | class Meta: 134 | db_table = 'cc_autorefill_report' 135 | 136 | 137 | class CcBackup(BaseModel): 138 | creationdate = DateTimeField() 139 | id = BigIntegerField(primary_key=True) 140 | name = CharField(unique=True) 141 | path = CharField() 142 | 143 | class Meta: 144 | db_table = 'cc_backup' 145 | 146 | 147 | class CcBillingCustomer(BaseModel): 148 | date = DateTimeField() 149 | id = BigIntegerField(primary_key=True) 150 | id_card = BigIntegerField() 151 | id_invoice = BigIntegerField() 152 | start_date = DateTimeField(null=True) 153 | 154 | class Meta: 155 | db_table = 'cc_billing_customer' 156 | 157 | 158 | class CcCall(BaseModel): 159 | buycost = DecimalField(null=True) 160 | calledstation = CharField(index=True) 161 | card = BigIntegerField(db_column='card_id') 162 | destination = IntegerField(null=True) 163 | dnid = CharField() 164 | id = BigIntegerField(primary_key=True) 165 | id_card_package_offer = IntegerField(null=True) 166 | id_did = IntegerField(null=True) 167 | id_ratecard = IntegerField(null=True) 168 | id_tariffgroup = IntegerField(null=True) 169 | id_tariffplan = IntegerField(null=True) 170 | id_trunk = IntegerField(null=True) 171 | nasipaddress = CharField() 172 | real_sessiontime = IntegerField(null=True) 173 | sessionbill = FloatField(null=True) 174 | sessionid = CharField() 175 | sessiontime = IntegerField(null=True) 176 | sipiax = IntegerField(null=True) 177 | src = CharField() 178 | starttime = DateTimeField(index=True) 179 | stoptime = DateTimeField() 180 | terminatecauseid = IntegerField(index=True, null=True) 181 | uniqueid = CharField() 182 | 183 | class Meta: 184 | db_table = 'cc_call' 185 | 186 | 187 | class CcCallArchive(BaseModel): 188 | buycost = DecimalField(null=True) 189 | calledstation = CharField(index=True) 190 | card = BigIntegerField(db_column='card_id') 191 | destination = IntegerField(null=True) 192 | dnid = CharField() 193 | id = BigIntegerField(primary_key=True) 194 | id_card_package_offer = IntegerField(null=True) 195 | id_did = IntegerField(null=True) 196 | id_ratecard = IntegerField(null=True) 197 | id_tariffgroup = IntegerField(null=True) 198 | id_tariffplan = IntegerField(null=True) 199 | id_trunk = IntegerField(null=True) 200 | nasipaddress = CharField() 201 | real_sessiontime = IntegerField(null=True) 202 | sessionbill = FloatField(null=True) 203 | sessionid = CharField() 204 | sessiontime = IntegerField(null=True) 205 | sipiax = IntegerField(null=True) 206 | src = CharField() 207 | starttime = DateTimeField(index=True) 208 | stoptime = DateTimeField() 209 | terminatecauseid = IntegerField(index=True, null=True) 210 | uniqueid = CharField() 211 | 212 | class Meta: 213 | db_table = 'cc_call_archive' 214 | 215 | 216 | class CcCallbackSpool(BaseModel): 217 | account = CharField(null=True) 218 | actionid = CharField(null=True) 219 | agi_result = CharField(null=True) 220 | application = CharField(null=True) 221 | async = CharField(null=True) 222 | callback_time = DateTimeField() 223 | callerid = CharField(null=True) 224 | channel = CharField(null=True) 225 | context = CharField(null=True) 226 | data = CharField(null=True) 227 | entry_time = DateTimeField() 228 | exten = CharField(null=True) 229 | id = BigIntegerField(primary_key=True) 230 | id_server = IntegerField(null=True) 231 | id_server_group = IntegerField(null=True) 232 | last_attempt_time = DateTimeField() 233 | manager_result = CharField(null=True) 234 | num_attempt = IntegerField() 235 | priority = CharField(null=True) 236 | server_ip = CharField(null=True) 237 | status = CharField(null=True) 238 | timeout = CharField(null=True) 239 | uniqueid = CharField(null=True, unique=True) 240 | variable = CharField(null=True) 241 | 242 | class Meta: 243 | db_table = 'cc_callback_spool' 244 | 245 | 246 | class CcCallerid(BaseModel): 247 | activated = CharField() 248 | cid = CharField(unique=True) 249 | id = BigIntegerField(primary_key=True) 250 | id_cc_card = BigIntegerField() 251 | 252 | class Meta: 253 | db_table = 'cc_callerid' 254 | 255 | 256 | class CcCallplanLcr(BaseModel): 257 | buyrate = DecimalField(null=True) 258 | connectcharge = DecimalField(null=True) 259 | destination = CharField(null=True) 260 | dialprefix = CharField(null=True) 261 | id = IntegerField(null=True) 262 | id_trunk = IntegerField(null=True) 263 | idtariffplan = IntegerField(null=True) 264 | initblock = IntegerField(null=True) 265 | ratecard = IntegerField(db_column='ratecard_id', null=True) 266 | rateinitial = DecimalField(null=True) 267 | startdate = DateTimeField(null=True) 268 | stopdate = DateTimeField(null=True) 269 | tariffgroup = IntegerField(db_column='tariffgroup_id', null=True) 270 | 271 | class Meta: 272 | db_table = 'cc_callplan_lcr' 273 | 274 | 275 | class CcCampaign(BaseModel): 276 | creationdate = DateTimeField() 277 | daily_start_time = TimeField() 278 | daily_stop_time = TimeField() 279 | description = TextField(null=True) 280 | expirationdate = DateTimeField() 281 | forward_number = CharField(null=True) 282 | frequency = IntegerField() 283 | friday = IntegerField() 284 | id_campaign_config = IntegerField() 285 | id_card = BigIntegerField() 286 | id_cid_group = IntegerField() 287 | monday = IntegerField() 288 | name = CharField(unique=True) 289 | nb_callmade = IntegerField(null=True) 290 | saturday = IntegerField() 291 | secondusedreal = IntegerField(null=True) 292 | startingdate = DateTimeField() 293 | status = IntegerField() 294 | sunday = IntegerField() 295 | thursday = IntegerField() 296 | tuesday = IntegerField() 297 | wednesday = IntegerField() 298 | 299 | class Meta: 300 | db_table = 'cc_campaign' 301 | 302 | 303 | class CcCampaignConfig(BaseModel): 304 | context = CharField() 305 | description = TextField(null=True) 306 | flatrate = DecimalField() 307 | name = CharField() 308 | 309 | class Meta: 310 | db_table = 'cc_campaign_config' 311 | 312 | 313 | class CcCampaignPhonebook(BaseModel): 314 | id_campaign = IntegerField() 315 | id_phonebook = IntegerField() 316 | 317 | class Meta: 318 | db_table = 'cc_campaign_phonebook' 319 | indexes = ( 320 | (('id_campaign', 'id_phonebook'), True), 321 | ) 322 | primary_key = CompositeKey('id_campaign', 'id_phonebook') 323 | 324 | 325 | class CcCampaignPhonestatus(BaseModel): 326 | id_callback = CharField() 327 | id_campaign = IntegerField() 328 | id_phonenumber = BigIntegerField() 329 | lastuse = DateTimeField() 330 | status = IntegerField() 331 | 332 | class Meta: 333 | db_table = 'cc_campaign_phonestatus' 334 | indexes = ( 335 | (('id_phonenumber', 'id_campaign'), True), 336 | ) 337 | primary_key = CompositeKey('id_campaign', 'id_phonenumber') 338 | 339 | 340 | class CcCampaignconfCardgroup(BaseModel): 341 | id_campaign_config = IntegerField() 342 | id_card_group = IntegerField() 343 | 344 | class Meta: 345 | db_table = 'cc_campaignconf_cardgroup' 346 | indexes = ( 347 | (('id_campaign_config', 'id_card_group'), True), 348 | ) 349 | primary_key = CompositeKey('id_campaign_config', 'id_card_group') 350 | 351 | 352 | class CcCard(BaseModel): 353 | activated = CharField() 354 | address = CharField() 355 | autorefill = IntegerField(null=True) 356 | block = IntegerField() 357 | city = CharField() 358 | company_name = CharField() 359 | company_website = CharField() 360 | country = CharField() 361 | creationdate = DateTimeField(index=True) 362 | credit = DecimalField() 363 | credit_notification = IntegerField() 364 | creditlimit = IntegerField(null=True) 365 | currency = CharField(null=True) 366 | discount = DecimalField() 367 | email = CharField() 368 | email_notification = CharField() 369 | enableexpire = IntegerField(null=True) 370 | expirationdate = DateTimeField() 371 | expiredays = IntegerField(null=True) 372 | fax = CharField() 373 | firstname = CharField() 374 | firstusedate = DateTimeField() 375 | iax_buddy = IntegerField(null=True) 376 | id = BigIntegerField(primary_key=True) 377 | id_campaign = IntegerField(null=True) 378 | id_didgroup = IntegerField(null=True) 379 | id_group = IntegerField() 380 | id_seria = IntegerField(null=True) 381 | id_timezone = IntegerField(null=True) 382 | initialbalance = DecimalField() 383 | inuse = IntegerField(null=True) 384 | invoiceday = IntegerField(null=True) 385 | language = CharField(null=True) 386 | last_notification = DateTimeField(null=True) 387 | lastname = CharField() 388 | lastuse = DateTimeField() 389 | lock_date = DateTimeField(null=True) 390 | lock_pin = CharField(null=True) 391 | loginkey = CharField() 392 | mac_addr = CharField() 393 | max_concurrent = IntegerField() 394 | nbservice = IntegerField(null=True) 395 | nbused = IntegerField(null=True) 396 | notify_email = IntegerField() 397 | num_trials_done = BigIntegerField(null=True) 398 | phone = CharField() 399 | redial = CharField() 400 | restriction = IntegerField() 401 | runservice = IntegerField(null=True) 402 | serial = BigIntegerField(null=True) 403 | servicelastrun = DateTimeField() 404 | simultaccess = IntegerField(null=True) 405 | sip_buddy = IntegerField(null=True) 406 | state = CharField() 407 | status = IntegerField() 408 | tag = CharField() 409 | tariff = IntegerField(null=True) 410 | traffic = BigIntegerField(null=True) 411 | traffic_target = CharField() 412 | typepaid = IntegerField(null=True) 413 | uipass = CharField() 414 | useralias = CharField(unique=True) 415 | username = CharField(unique=True) 416 | vat = FloatField() 417 | vat_rn = CharField(null=True) 418 | voicemail_activated = IntegerField() 419 | voicemail_permitted = IntegerField() 420 | voipcall = IntegerField(null=True) 421 | zipcode = CharField() 422 | 423 | class Meta: 424 | db_table = 'cc_card' 425 | 426 | 427 | class CcCardArchive(BaseModel): 428 | vat_rn = CharField(db_column='VAT_RN', null=True) 429 | activated = CharField() 430 | activatedbyuser = CharField() 431 | address = CharField(null=True) 432 | autorefill = IntegerField(null=True) 433 | city = CharField(null=True) 434 | company_name = CharField(null=True) 435 | company_website = CharField(null=True) 436 | country = CharField(null=True) 437 | creationdate = DateTimeField(index=True) 438 | credit = DecimalField() 439 | credit_notification = IntegerField() 440 | creditlimit = IntegerField(null=True) 441 | currency = CharField(null=True) 442 | discount = DecimalField() 443 | email = CharField(null=True) 444 | email_notification = CharField(null=True) 445 | enableexpire = IntegerField(null=True) 446 | expirationdate = DateTimeField() 447 | expiredays = IntegerField(null=True) 448 | fax = CharField(null=True) 449 | firstname = CharField(null=True) 450 | firstusedate = DateTimeField() 451 | iax_buddy = IntegerField(null=True) 452 | id = BigIntegerField(primary_key=True) 453 | id_campaign = IntegerField(null=True) 454 | id_didgroup = IntegerField(null=True) 455 | id_group = IntegerField() 456 | id_timezone = IntegerField(null=True) 457 | initialbalance = DecimalField() 458 | inuse = IntegerField(null=True) 459 | invoiceday = IntegerField(null=True) 460 | language = CharField(null=True) 461 | last_notification = DateTimeField(null=True) 462 | lastname = CharField(null=True) 463 | lastuse = DateTimeField() 464 | loginkey = CharField(null=True) 465 | mac_addr = CharField() 466 | nbservice = IntegerField(null=True) 467 | nbused = IntegerField(null=True) 468 | notify_email = IntegerField() 469 | num_trials_done = BigIntegerField(null=True) 470 | phone = CharField(null=True) 471 | redial = CharField(null=True) 472 | restriction = IntegerField() 473 | runservice = IntegerField(null=True) 474 | servicelastrun = DateTimeField() 475 | simultaccess = IntegerField(null=True) 476 | sip_buddy = IntegerField(null=True) 477 | state = CharField(null=True) 478 | status = IntegerField(null=True) 479 | tag = CharField(null=True) 480 | tariff = IntegerField(null=True) 481 | traffic = BigIntegerField(null=True) 482 | traffic_target = TextField(null=True) 483 | typepaid = IntegerField(null=True) 484 | uipass = CharField(null=True) 485 | useralias = CharField() 486 | username = CharField(index=True) 487 | vat = FloatField() 488 | voicemail_activated = IntegerField() 489 | voicemail_permitted = IntegerField() 490 | voipcall = IntegerField(null=True) 491 | zipcode = CharField(null=True) 492 | 493 | class Meta: 494 | db_table = 'cc_card_archive' 495 | 496 | 497 | class CcCardGroup(BaseModel): 498 | description = CharField(null=True) 499 | id_agent = IntegerField(null=True) 500 | name = CharField(null=True) 501 | provisioning = CharField(null=True) 502 | users_perms = IntegerField() 503 | 504 | class Meta: 505 | db_table = 'cc_card_group' 506 | 507 | 508 | class CcCardHistory(BaseModel): 509 | datecreated = DateTimeField() 510 | description = TextField(null=True) 511 | id = BigIntegerField(primary_key=True) 512 | id_cc_card = BigIntegerField(null=True) 513 | 514 | class Meta: 515 | db_table = 'cc_card_history' 516 | 517 | 518 | class CcCardPackageOffer(BaseModel): 519 | date_consumption = DateTimeField(index=True) 520 | id = BigIntegerField(primary_key=True) 521 | id_cc_card = BigIntegerField(index=True) 522 | id_cc_package_offer = BigIntegerField(index=True) 523 | used_secondes = BigIntegerField() 524 | 525 | class Meta: 526 | db_table = 'cc_card_package_offer' 527 | 528 | 529 | class CcCardSeria(BaseModel): 530 | description = TextField(null=True) 531 | name = CharField() 532 | value = BigIntegerField() 533 | 534 | class Meta: 535 | db_table = 'cc_card_seria' 536 | 537 | 538 | class CcCardSubscription(BaseModel): 539 | id = BigIntegerField(primary_key=True) 540 | id_cc_card = BigIntegerField(null=True) 541 | id_subscription_fee = IntegerField(null=True) 542 | last_run = DateTimeField() 543 | limit_pay_date = DateTimeField() 544 | next_billing_date = DateTimeField() 545 | paid_status = IntegerField() 546 | product = CharField(db_column='product_id', null=True) 547 | product_name = CharField(null=True) 548 | startdate = DateTimeField() 549 | stopdate = DateTimeField() 550 | 551 | class Meta: 552 | db_table = 'cc_card_subscription' 553 | 554 | 555 | class CcCardgroupService(BaseModel): 556 | id_card_group = IntegerField() 557 | id_service = IntegerField() 558 | 559 | class Meta: 560 | db_table = 'cc_cardgroup_service' 561 | indexes = ( 562 | (('id_card_group', 'id_service'), True), 563 | ) 564 | primary_key = CompositeKey('id_card_group', 'id_service') 565 | 566 | 567 | class CcCharge(BaseModel): 568 | amount = FloatField() 569 | charged_status = IntegerField() 570 | chargetype = IntegerField(null=True) 571 | cover_from = DateField(null=True) 572 | cover_to = DateField(null=True) 573 | creationdate = DateTimeField(index=True) 574 | description = TextField(null=True) 575 | id = BigIntegerField(primary_key=True) 576 | id_cc_card = BigIntegerField(index=True) 577 | id_cc_card_subscription = BigIntegerField(null=True) 578 | id_cc_did = BigIntegerField(null=True) 579 | iduser = IntegerField() 580 | invoiced_status = IntegerField() 581 | 582 | class Meta: 583 | db_table = 'cc_charge' 584 | 585 | 586 | class CcConfig(BaseModel): 587 | config_description = CharField(null=True) 588 | config_group_title = CharField() 589 | config_key = CharField(null=True) 590 | config_listvalues = CharField(null=True) 591 | config_title = CharField(null=True) 592 | config_value = CharField(null=True) 593 | config_valuetype = IntegerField() 594 | 595 | class Meta: 596 | db_table = 'cc_config' 597 | 598 | 599 | class CcConfigGroup(BaseModel): 600 | group_description = CharField() 601 | group_title = CharField(unique=True) 602 | 603 | class Meta: 604 | db_table = 'cc_config_group' 605 | 606 | 607 | class CcConfiguration(BaseModel): 608 | configuration_description = CharField() 609 | configuration = PrimaryKeyField(db_column='configuration_id') 610 | configuration_key = CharField() 611 | configuration_title = CharField() 612 | configuration_type = IntegerField() 613 | configuration_value = CharField() 614 | set_function = CharField(null=True) 615 | use_function = CharField(null=True) 616 | 617 | class Meta: 618 | db_table = 'cc_configuration' 619 | 620 | 621 | class CcCountry(BaseModel): 622 | countrycode = CharField() 623 | countryname = CharField() 624 | countryprefix = CharField() 625 | id = BigIntegerField(primary_key=True) 626 | 627 | class Meta: 628 | db_table = 'cc_country' 629 | 630 | 631 | class CcCurrencies(BaseModel): 632 | basecurrency = CharField() 633 | currency = CharField(unique=True) 634 | lastupdate = DateTimeField() 635 | name = CharField() 636 | value = DecimalField() 637 | 638 | class Meta: 639 | db_table = 'cc_currencies' 640 | 641 | 642 | class CcDid(BaseModel): 643 | activated = IntegerField() 644 | aleg_carrier_connect_charge = DecimalField() 645 | aleg_carrier_connect_charge_offp = DecimalField() 646 | aleg_carrier_cost_min = DecimalField() 647 | aleg_carrier_cost_min_offp = DecimalField() 648 | aleg_carrier_increment = IntegerField() 649 | aleg_carrier_increment_offp = IntegerField() 650 | aleg_carrier_initblock = IntegerField() 651 | aleg_carrier_initblock_offp = IntegerField() 652 | aleg_retail_connect_charge = DecimalField() 653 | aleg_retail_connect_charge_offp = DecimalField() 654 | aleg_retail_cost_min = DecimalField() 655 | aleg_retail_cost_min_offp = DecimalField() 656 | aleg_retail_increment = IntegerField() 657 | aleg_retail_increment_offp = IntegerField() 658 | aleg_retail_initblock = IntegerField() 659 | aleg_retail_initblock_offp = IntegerField() 660 | aleg_timeinterval = TextField(null=True) 661 | billingtype = IntegerField(null=True) 662 | connection_charge = DecimalField() 663 | creationdate = DateTimeField() 664 | description = TextField(null=True) 665 | did = CharField(unique=True) 666 | expirationdate = DateTimeField() 667 | fixrate = FloatField() 668 | id = BigIntegerField(primary_key=True) 669 | id_cc_country = IntegerField() 670 | id_cc_didgroup = BigIntegerField() 671 | iduser = BigIntegerField() 672 | max_concurrent = IntegerField() 673 | reserved = IntegerField(null=True) 674 | secondusedreal = IntegerField(null=True) 675 | selling_rate = DecimalField() 676 | startingdate = DateTimeField() 677 | 678 | class Meta: 679 | db_table = 'cc_did' 680 | 681 | 682 | class CcDidDestination(BaseModel): 683 | activated = IntegerField() 684 | creationdate = DateTimeField() 685 | destination = CharField(null=True) 686 | id = BigIntegerField(primary_key=True) 687 | id_cc_card = BigIntegerField() 688 | id_cc_did = BigIntegerField() 689 | priority = IntegerField() 690 | secondusedreal = IntegerField(null=True) 691 | validated = IntegerField(null=True) 692 | voip_call = IntegerField(null=True) 693 | 694 | class Meta: 695 | db_table = 'cc_did_destination' 696 | 697 | 698 | class CcDidUse(BaseModel): 699 | activated = IntegerField(null=True) 700 | id = BigIntegerField(primary_key=True) 701 | id_cc_card = BigIntegerField(null=True) 702 | id_did = BigIntegerField() 703 | month_payed = IntegerField(null=True) 704 | releasedate = DateTimeField() 705 | reminded = IntegerField() 706 | reservationdate = DateTimeField() 707 | 708 | class Meta: 709 | db_table = 'cc_did_use' 710 | 711 | 712 | class CcDidgroup(BaseModel): 713 | creationdate = DateTimeField() 714 | didgroupname = CharField() 715 | id = BigIntegerField(primary_key=True) 716 | 717 | class Meta: 718 | db_table = 'cc_didgroup' 719 | 720 | 721 | class CcEpaymentLog(BaseModel): 722 | amount = CharField() 723 | cardid = BigIntegerField() 724 | cc_expires = CharField(null=True) 725 | cc_number = CharField(null=True) 726 | cc_owner = CharField(null=True) 727 | creationdate = DateTimeField() 728 | credit_card_type = CharField(null=True) 729 | currency = CharField(null=True) 730 | cvv = CharField(null=True) 731 | id = BigIntegerField(primary_key=True) 732 | item = BigIntegerField(db_column='item_id', null=True) 733 | item_type = CharField(null=True) 734 | paymentmethod = CharField() 735 | status = IntegerField() 736 | transaction_detail = TextField(null=True) 737 | vat = FloatField() 738 | 739 | class Meta: 740 | db_table = 'cc_epayment_log' 741 | 742 | 743 | class CcEpaymentLogAgent(BaseModel): 744 | agent = BigIntegerField(db_column='agent_id') 745 | amount = CharField() 746 | cc_expires = CharField(null=True) 747 | cc_number = CharField(null=True) 748 | cc_owner = CharField(null=True) 749 | creationdate = DateTimeField() 750 | credit_card_type = CharField(null=True) 751 | currency = CharField(null=True) 752 | cvv = CharField(null=True) 753 | id = BigIntegerField(primary_key=True) 754 | paymentmethod = CharField() 755 | status = IntegerField() 756 | transaction_detail = TextField(null=True) 757 | vat = FloatField() 758 | 759 | class Meta: 760 | db_table = 'cc_epayment_log_agent' 761 | 762 | 763 | class CcIaxBuddies(BaseModel): 764 | defaultip = CharField(db_column='DEFAULTip', null=True) 765 | accountcode = CharField() 766 | adsi = CharField() 767 | allow = CharField() 768 | amaflags = CharField(null=True) 769 | auth = CharField() 770 | callerid = CharField() 771 | cid_number = CharField() 772 | codecpriority = CharField() 773 | context = CharField() 774 | dbsecret = CharField() 775 | deny = CharField() 776 | disallow = CharField() 777 | encryption = CharField() 778 | forcejitterbuffer = CharField() 779 | fullname = CharField() 780 | host = CharField(index=True) 781 | id_cc_card = IntegerField() 782 | inkeys = CharField() 783 | ipaddr = CharField(index=True) 784 | jitterbuffer = CharField() 785 | language = CharField(null=True) 786 | mask = CharField() 787 | maxauthreq = CharField() 788 | maxcallnumbers = CharField() 789 | maxcallnumbers_nonvalidated = CharField() 790 | mohinterpret = CharField() 791 | mohsuggest = CharField() 792 | name = CharField(unique=True) 793 | outkey = CharField() 794 | permit = CharField(null=True) 795 | port = CharField(index=True) 796 | qualify = CharField(null=True) 797 | qualifyfreqnotok = CharField() 798 | qualifyfreqok = CharField() 799 | qualifysmoothing = CharField() 800 | regcontext = CharField() 801 | regexten = CharField() 802 | regseconds = IntegerField() 803 | requirecalltoken = CharField() 804 | secret = CharField() 805 | sendani = CharField() 806 | setvar = CharField() 807 | sourceaddress = CharField() 808 | timezone = CharField() 809 | transfer = CharField() 810 | trunk = CharField(null=True) 811 | type = CharField() 812 | username = CharField() 813 | 814 | class Meta: 815 | db_table = 'cc_iax_buddies' 816 | indexes = ( 817 | (('host', 'port'), False), 818 | (('ipaddr', 'port'), False), 819 | (('name', 'host'), False), 820 | (('name', 'ipaddr', 'port'), False), 821 | ) 822 | 823 | 824 | class CcInvoice(BaseModel): 825 | date = DateTimeField() 826 | description = TextField() 827 | id = BigIntegerField(primary_key=True) 828 | id_card = BigIntegerField() 829 | paid_status = IntegerField() 830 | reference = CharField(null=True, unique=True) 831 | status = IntegerField() 832 | title = CharField() 833 | 834 | class Meta: 835 | db_table = 'cc_invoice' 836 | 837 | 838 | class CcInvoiceConf(BaseModel): 839 | key_val = CharField(unique=True) 840 | value = CharField() 841 | 842 | class Meta: 843 | db_table = 'cc_invoice_conf' 844 | 845 | 846 | class CcInvoiceItem(BaseModel): 847 | vat = DecimalField(db_column='VAT') 848 | date = DateTimeField() 849 | description = TextField() 850 | id = BigIntegerField(primary_key=True) 851 | id_ext = BigIntegerField(null=True) 852 | id_invoice = BigIntegerField() 853 | price = DecimalField() 854 | type_ext = CharField(null=True) 855 | 856 | class Meta: 857 | db_table = 'cc_invoice_item' 858 | 859 | 860 | class CcInvoicePayment(BaseModel): 861 | id_invoice = BigIntegerField() 862 | id_payment = BigIntegerField() 863 | 864 | class Meta: 865 | db_table = 'cc_invoice_payment' 866 | indexes = ( 867 | (('id_invoice', 'id_payment'), True), 868 | ) 869 | primary_key = CompositeKey('id_invoice', 'id_payment') 870 | 871 | 872 | class CcIso639(BaseModel): 873 | charset = CharField() 874 | code = CharField(primary_key=True) 875 | lname = CharField(null=True) 876 | name = CharField(unique=True) 877 | 878 | class Meta: 879 | db_table = 'cc_iso639' 880 | 881 | 882 | class CcLogpayment(BaseModel): 883 | added_commission = IntegerField() 884 | added_refill = IntegerField() 885 | agent = BigIntegerField(db_column='agent_id', null=True) 886 | card = BigIntegerField(db_column='card_id') 887 | date = DateTimeField() 888 | description = TextField(null=True) 889 | id_logrefill = BigIntegerField(null=True) 890 | payment = DecimalField() 891 | payment_type = IntegerField() 892 | 893 | class Meta: 894 | db_table = 'cc_logpayment' 895 | 896 | 897 | class CcLogpaymentAgent(BaseModel): 898 | added_refill = IntegerField() 899 | agent = BigIntegerField(db_column='agent_id') 900 | date = DateTimeField() 901 | description = TextField(null=True) 902 | id = BigIntegerField(primary_key=True) 903 | id_logrefill = BigIntegerField(null=True) 904 | payment = DecimalField() 905 | payment_type = IntegerField() 906 | 907 | class Meta: 908 | db_table = 'cc_logpayment_agent' 909 | 910 | 911 | class CcLogrefill(BaseModel): 912 | added_invoice = IntegerField() 913 | agent = BigIntegerField(db_column='agent_id', null=True) 914 | card = BigIntegerField(db_column='card_id') 915 | credit = DecimalField() 916 | date = DateTimeField() 917 | description = TextField(null=True) 918 | id = BigIntegerField(primary_key=True) 919 | refill_type = IntegerField() 920 | 921 | class Meta: 922 | db_table = 'cc_logrefill' 923 | 924 | 925 | class CcLogrefillAgent(BaseModel): 926 | agent = BigIntegerField(db_column='agent_id') 927 | credit = DecimalField() 928 | date = DateTimeField() 929 | description = TextField(null=True) 930 | id = BigIntegerField(primary_key=True) 931 | refill_type = IntegerField() 932 | 933 | class Meta: 934 | db_table = 'cc_logrefill_agent' 935 | 936 | 937 | class CcMessageAgent(BaseModel): 938 | id = BigIntegerField(primary_key=True) 939 | id_agent = IntegerField() 940 | logo = IntegerField() 941 | message = TextField(null=True) 942 | order_display = IntegerField() 943 | type = IntegerField() 944 | 945 | class Meta: 946 | db_table = 'cc_message_agent' 947 | 948 | 949 | class CcMonitor(BaseModel): 950 | description = CharField(null=True) 951 | dial_code = IntegerField(null=True) 952 | enable = IntegerField() 953 | id = BigIntegerField(primary_key=True) 954 | label = CharField() 955 | query = CharField(null=True) 956 | query_type = IntegerField() 957 | result_type = IntegerField() 958 | text_intro = CharField(null=True) 959 | 960 | class Meta: 961 | db_table = 'cc_monitor' 962 | 963 | 964 | class CcNotification(BaseModel): 965 | date = DateTimeField() 966 | from_ = BigIntegerField(db_column='from_id', null=True) 967 | from_type = IntegerField() 968 | id = BigIntegerField(primary_key=True) 969 | key_value = CharField(null=True) 970 | link = BigIntegerField(db_column='link_id', null=True) 971 | link_type = CharField(null=True) 972 | priority = IntegerField() 973 | 974 | class Meta: 975 | db_table = 'cc_notification' 976 | 977 | 978 | class CcNotificationAdmin(BaseModel): 979 | id_admin = IntegerField() 980 | id_notification = BigIntegerField() 981 | viewed = IntegerField() 982 | 983 | class Meta: 984 | db_table = 'cc_notification_admin' 985 | indexes = ( 986 | (('id_notification', 'id_admin'), True), 987 | ) 988 | primary_key = CompositeKey('id_admin', 'id_notification') 989 | 990 | 991 | class CcOutboundCidGroup(BaseModel): 992 | creationdate = DateTimeField() 993 | group_name = CharField() 994 | 995 | class Meta: 996 | db_table = 'cc_outbound_cid_group' 997 | 998 | 999 | class CcOutboundCidList(BaseModel): 1000 | activated = IntegerField() 1001 | cid = CharField(null=True) 1002 | creationdate = DateTimeField() 1003 | outbound_cid_group = IntegerField() 1004 | 1005 | class Meta: 1006 | db_table = 'cc_outbound_cid_list' 1007 | 1008 | 1009 | class CcPackageGroup(BaseModel): 1010 | description = TextField(null=True) 1011 | name = CharField() 1012 | 1013 | class Meta: 1014 | db_table = 'cc_package_group' 1015 | 1016 | 1017 | class CcPackageOffer(BaseModel): 1018 | billingtype = IntegerField() 1019 | creationdate = DateTimeField() 1020 | freetimetocall = IntegerField() 1021 | id = BigIntegerField(primary_key=True) 1022 | label = CharField() 1023 | packagetype = IntegerField() 1024 | startday = IntegerField() 1025 | 1026 | class Meta: 1027 | db_table = 'cc_package_offer' 1028 | 1029 | 1030 | class CcPackageRate(BaseModel): 1031 | package = IntegerField(db_column='package_id') 1032 | rate = IntegerField(db_column='rate_id') 1033 | 1034 | class Meta: 1035 | db_table = 'cc_package_rate' 1036 | indexes = ( 1037 | (('package', 'rate'), True), 1038 | ) 1039 | primary_key = CompositeKey('package', 'rate') 1040 | 1041 | 1042 | class CcPackgroupPackage(BaseModel): 1043 | package = IntegerField(db_column='package_id') 1044 | packagegroup = IntegerField(db_column='packagegroup_id') 1045 | 1046 | class Meta: 1047 | db_table = 'cc_packgroup_package' 1048 | indexes = ( 1049 | (('packagegroup', 'package'), True), 1050 | ) 1051 | primary_key = CompositeKey('package', 'packagegroup') 1052 | 1053 | 1054 | class CcPaymentMethods(BaseModel): 1055 | payment_filename = CharField() 1056 | payment_method = CharField() 1057 | 1058 | class Meta: 1059 | db_table = 'cc_payment_methods' 1060 | 1061 | 1062 | class CcPayments(BaseModel): 1063 | cc_expires = CharField(null=True) 1064 | cc_number = CharField(null=True) 1065 | cc_owner = CharField(null=True) 1066 | cc_type = CharField(null=True) 1067 | currency = CharField(null=True) 1068 | currency_value = DecimalField(null=True) 1069 | customers_email_address = CharField() 1070 | customers = BigIntegerField(db_column='customers_id') 1071 | customers_name = CharField() 1072 | date_purchased = DateTimeField(null=True) 1073 | id = BigIntegerField(primary_key=True) 1074 | item = CharField(db_column='item_id', null=True) 1075 | item_name = CharField(null=True) 1076 | item_quantity = IntegerField() 1077 | last_modified = DateTimeField(null=True) 1078 | orders_amount = DecimalField(null=True) 1079 | orders_date_finished = DateTimeField(null=True) 1080 | orders_status = IntegerField() 1081 | payment_method = CharField() 1082 | 1083 | class Meta: 1084 | db_table = 'cc_payments' 1085 | 1086 | 1087 | class CcPaymentsAgent(BaseModel): 1088 | agent_email_address = CharField() 1089 | agent = BigIntegerField(db_column='agent_id') 1090 | agent_name = CharField() 1091 | cc_expires = CharField(null=True) 1092 | cc_number = CharField(null=True) 1093 | cc_owner = CharField(null=True) 1094 | cc_type = CharField(null=True) 1095 | currency = CharField(null=True) 1096 | currency_value = DecimalField(null=True) 1097 | date_purchased = DateTimeField(null=True) 1098 | id = BigIntegerField(primary_key=True) 1099 | item = CharField(db_column='item_id', null=True) 1100 | item_name = CharField(null=True) 1101 | item_quantity = IntegerField() 1102 | last_modified = DateTimeField(null=True) 1103 | orders_amount = DecimalField(null=True) 1104 | orders_date_finished = DateTimeField(null=True) 1105 | orders_status = IntegerField() 1106 | payment_method = CharField() 1107 | 1108 | class Meta: 1109 | db_table = 'cc_payments_agent' 1110 | 1111 | 1112 | class CcPaymentsStatus(BaseModel): 1113 | status = IntegerField(db_column='status_id') 1114 | status_name = CharField() 1115 | 1116 | class Meta: 1117 | db_table = 'cc_payments_status' 1118 | 1119 | 1120 | class CcPaypal(BaseModel): 1121 | address_city = CharField() 1122 | address_country = CharField() 1123 | address_name = CharField() 1124 | address_state = CharField() 1125 | address_status = CharField() 1126 | address_street = CharField() 1127 | address_zip = CharField() 1128 | first_name = CharField(null=True) 1129 | item_name = CharField(null=True) 1130 | item_number = CharField(null=True) 1131 | last_name = CharField(null=True) 1132 | mc_currency = CharField(null=True) 1133 | mc_fee = DecimalField(null=True) 1134 | mc_gross = DecimalField(null=True) 1135 | memo = TextField(null=True) 1136 | payer_business_name = CharField() 1137 | payer_email = CharField(null=True) 1138 | payer = CharField(db_column='payer_id', null=True) 1139 | payer_status = CharField(null=True) 1140 | payment_date = CharField(null=True) 1141 | payment_status = CharField() 1142 | payment_type = CharField(null=True) 1143 | pending_reason = CharField() 1144 | quantity = IntegerField() 1145 | reason_code = CharField() 1146 | tax = DecimalField(null=True) 1147 | txn = CharField(db_column='txn_id', null=True, unique=True) 1148 | txn_type = CharField() 1149 | 1150 | class Meta: 1151 | db_table = 'cc_paypal' 1152 | 1153 | 1154 | class CcPhonebook(BaseModel): 1155 | description = TextField(null=True) 1156 | id_card = BigIntegerField() 1157 | name = CharField() 1158 | 1159 | class Meta: 1160 | db_table = 'cc_phonebook' 1161 | 1162 | 1163 | class CcPhonenumber(BaseModel): 1164 | amount = IntegerField() 1165 | creationdate = DateTimeField() 1166 | id = BigIntegerField(primary_key=True) 1167 | id_phonebook = IntegerField() 1168 | info = TextField(null=True) 1169 | name = CharField(null=True) 1170 | number = CharField() 1171 | status = IntegerField() 1172 | 1173 | class Meta: 1174 | db_table = 'cc_phonenumber' 1175 | 1176 | 1177 | class CcPrefix(BaseModel): 1178 | destination = CharField(index=True) 1179 | prefix = BigIntegerField(primary_key=True) 1180 | 1181 | class Meta: 1182 | db_table = 'cc_prefix' 1183 | 1184 | 1185 | class CcProvider(BaseModel): 1186 | creationdate = DateTimeField() 1187 | description = TextField(null=True) 1188 | provider_name = CharField(unique=True) 1189 | 1190 | class Meta: 1191 | db_table = 'cc_provider' 1192 | 1193 | 1194 | class CcRatecard(BaseModel): 1195 | additional_block_charge = DecimalField() 1196 | additional_block_charge_time = IntegerField() 1197 | additional_grace = IntegerField() 1198 | announce_time_correction = DecimalField() 1199 | billingblock = IntegerField() 1200 | billingblocka = IntegerField() 1201 | billingblockb = IntegerField() 1202 | billingblockc = IntegerField() 1203 | buyrate = DecimalField() 1204 | buyrateincrement = IntegerField() 1205 | buyrateinitblock = IntegerField() 1206 | chargea = DecimalField() 1207 | chargeb = DecimalField() 1208 | chargec = FloatField() 1209 | connectcharge = DecimalField() 1210 | destination = BigIntegerField(null=True) 1211 | dialprefix = CharField(index=True) 1212 | disconnectcharge = DecimalField() 1213 | disconnectcharge_after = IntegerField() 1214 | endtime = IntegerField(null=True) 1215 | id_outbound_cidgroup = IntegerField(null=True) 1216 | id_trunk = IntegerField(null=True) 1217 | idtariffplan = IntegerField(index=True) 1218 | initblock = IntegerField() 1219 | is_merged = IntegerField(null=True) 1220 | minimal_cost = DecimalField() 1221 | musiconhold = CharField() 1222 | rateinitial = DecimalField() 1223 | rounding_calltime = IntegerField() 1224 | rounding_threshold = IntegerField() 1225 | startdate = DateTimeField() 1226 | starttime = IntegerField(null=True) 1227 | stepchargea = DecimalField() 1228 | stepchargeb = DecimalField() 1229 | stepchargec = FloatField() 1230 | stopdate = DateTimeField() 1231 | tag = CharField(null=True) 1232 | timechargea = IntegerField() 1233 | timechargeb = IntegerField() 1234 | timechargec = IntegerField() 1235 | 1236 | class Meta: 1237 | db_table = 'cc_ratecard' 1238 | 1239 | 1240 | class CcReceipt(BaseModel): 1241 | date = DateTimeField() 1242 | description = TextField() 1243 | id = BigIntegerField(primary_key=True) 1244 | id_card = BigIntegerField() 1245 | status = IntegerField() 1246 | title = CharField() 1247 | 1248 | class Meta: 1249 | db_table = 'cc_receipt' 1250 | 1251 | 1252 | class CcReceiptItem(BaseModel): 1253 | date = DateTimeField() 1254 | description = TextField() 1255 | id = BigIntegerField(primary_key=True) 1256 | id_ext = BigIntegerField(null=True) 1257 | id_receipt = BigIntegerField() 1258 | price = DecimalField() 1259 | type_ext = CharField(null=True) 1260 | 1261 | class Meta: 1262 | db_table = 'cc_receipt_item' 1263 | 1264 | 1265 | class CcRemittanceRequest(BaseModel): 1266 | amount = DecimalField() 1267 | date = DateTimeField() 1268 | id = BigIntegerField(primary_key=True) 1269 | id_agent = BigIntegerField() 1270 | status = IntegerField() 1271 | type = IntegerField() 1272 | 1273 | class Meta: 1274 | db_table = 'cc_remittance_request' 1275 | 1276 | 1277 | class CcRestrictedPhonenumber(BaseModel): 1278 | id = BigIntegerField(primary_key=True) 1279 | id_card = BigIntegerField() 1280 | number = CharField() 1281 | 1282 | class Meta: 1283 | db_table = 'cc_restricted_phonenumber' 1284 | 1285 | 1286 | class CcServerGroup(BaseModel): 1287 | description = TextField(null=True) 1288 | id = BigIntegerField(primary_key=True) 1289 | name = CharField(null=True) 1290 | 1291 | class Meta: 1292 | db_table = 'cc_server_group' 1293 | 1294 | 1295 | class CcServerManager(BaseModel): 1296 | id = BigIntegerField(primary_key=True) 1297 | id_group = IntegerField(null=True) 1298 | lasttime_used = DateTimeField() 1299 | manager_host = CharField(null=True) 1300 | manager_secret = CharField(null=True) 1301 | manager_username = CharField(null=True) 1302 | server_ip = CharField(null=True) 1303 | 1304 | class Meta: 1305 | db_table = 'cc_server_manager' 1306 | 1307 | 1308 | class CcService(BaseModel): 1309 | amount = FloatField() 1310 | datecreate = DateTimeField() 1311 | datelastrun = DateTimeField() 1312 | daynumber = IntegerField() 1313 | dialplan = IntegerField(null=True) 1314 | emailreport = CharField() 1315 | id = BigIntegerField(primary_key=True) 1316 | maxnumbercycle = IntegerField() 1317 | name = CharField() 1318 | numberofrun = IntegerField() 1319 | operate_mode = IntegerField(null=True) 1320 | period = IntegerField() 1321 | rule = IntegerField() 1322 | status = IntegerField() 1323 | stopmode = IntegerField() 1324 | totalcardperform = IntegerField() 1325 | totalcredit = FloatField() 1326 | use_group = IntegerField(null=True) 1327 | 1328 | class Meta: 1329 | db_table = 'cc_service' 1330 | 1331 | 1332 | class CcServiceReport(BaseModel): 1333 | cc_service = BigIntegerField(db_column='cc_service_id') 1334 | daterun = DateTimeField() 1335 | id = BigIntegerField(primary_key=True) 1336 | totalcardperform = IntegerField(null=True) 1337 | totalcredit = FloatField(null=True) 1338 | 1339 | class Meta: 1340 | db_table = 'cc_service_report' 1341 | 1342 | 1343 | class CcSipBuddies(BaseModel): 1344 | defaultip = CharField(db_column='DEFAULTip', null=True) 1345 | accountcode = CharField() 1346 | allow = CharField() 1347 | allowtransfer = CharField() 1348 | amaflags = CharField(null=True) 1349 | auth = CharField() 1350 | autoframing = CharField() 1351 | callbackextension = CharField(null=True) 1352 | callerid = CharField() 1353 | callgroup = CharField(null=True) 1354 | callingpres = CharField() 1355 | cancallforward = CharField(null=True) 1356 | canreinvite = CharField() 1357 | cid_number = CharField() 1358 | context = CharField() 1359 | defaultuser = CharField() 1360 | deny = CharField() 1361 | disallow = CharField() 1362 | dtmfmode = CharField() 1363 | fromdomain = CharField() 1364 | fromuser = CharField() 1365 | fullcontact = CharField() 1366 | host = CharField(index=True) 1367 | id_cc_card = IntegerField() 1368 | incominglimit = CharField() 1369 | insecure = CharField() 1370 | ipaddr = CharField(index=True) 1371 | language = CharField(null=True) 1372 | lastms = CharField(null=True) 1373 | mailbox = CharField() 1374 | mask = CharField() 1375 | maxcallbitrate = CharField() 1376 | md5secret = CharField() 1377 | mohsuggest = CharField() 1378 | musicclass = CharField() 1379 | musiconhold = CharField() 1380 | name = CharField(unique=True) 1381 | nat = CharField(null=True) 1382 | outboundproxy = CharField() 1383 | permit = CharField(null=True) 1384 | pickupgroup = CharField(null=True) 1385 | port = CharField(index=True) 1386 | qualify = CharField(null=True) 1387 | regexten = CharField() 1388 | regseconds = IntegerField() 1389 | regserver = CharField(null=True) 1390 | restrictcid = CharField(null=True) 1391 | rtpholdtimeout = CharField(null=True) 1392 | rtpkeepalive = CharField() 1393 | rtptimeout = CharField(null=True) 1394 | secret = CharField() 1395 | setvar = CharField() 1396 | subscribecontext = CharField() 1397 | subscribemwi = CharField() 1398 | type = CharField() 1399 | useragent = CharField(null=True) 1400 | usereqphone = CharField() 1401 | username = CharField() 1402 | vmexten = CharField() 1403 | 1404 | class Meta: 1405 | db_table = 'cc_sip_buddies' 1406 | indexes = ( 1407 | (('host', 'port'), False), 1408 | (('ipaddr', 'port'), False), 1409 | ) 1410 | 1411 | 1412 | class CcSipBuddiesEmpty(BaseModel): 1413 | defaultip = CharField(db_column='DEFAULTip', null=True) 1414 | accountcode = CharField() 1415 | allow = CharField() 1416 | amaflags = CharField(null=True) 1417 | callerid = CharField() 1418 | callgroup = CharField(null=True) 1419 | cancallforward = CharField(null=True) 1420 | canreinvite = CharField() 1421 | context = CharField() 1422 | deny = CharField() 1423 | disallow = CharField() 1424 | dtmfmode = CharField() 1425 | fromdomain = CharField() 1426 | fromuser = CharField() 1427 | fullcontact = CharField() 1428 | host = CharField() 1429 | id = IntegerField() 1430 | id_cc_card = IntegerField() 1431 | insecure = CharField() 1432 | ipaddr = CharField() 1433 | language = CharField(null=True) 1434 | mailbox = CharField() 1435 | mask = CharField() 1436 | md5secret = CharField() 1437 | musiconhold = CharField() 1438 | name = CharField() 1439 | nat = CharField(null=True) 1440 | permit = CharField(null=True) 1441 | pickupgroup = CharField(null=True) 1442 | port = CharField() 1443 | qualify = CharField(null=True) 1444 | regexten = CharField() 1445 | regseconds = IntegerField() 1446 | restrictcid = CharField(null=True) 1447 | rtpholdtimeout = CharField(null=True) 1448 | rtptimeout = CharField(null=True) 1449 | secret = CharField() 1450 | setvar = CharField() 1451 | type = CharField() 1452 | username = CharField() 1453 | 1454 | class Meta: 1455 | db_table = 'cc_sip_buddies_empty' 1456 | 1457 | 1458 | class CcSpeeddial(BaseModel): 1459 | creationdate = DateTimeField() 1460 | id = BigIntegerField(primary_key=True) 1461 | id_cc_card = BigIntegerField() 1462 | name = CharField() 1463 | phone = CharField() 1464 | speeddial = IntegerField(null=True) 1465 | 1466 | class Meta: 1467 | db_table = 'cc_speeddial' 1468 | indexes = ( 1469 | (('id_cc_card', 'speeddial'), True), 1470 | ) 1471 | 1472 | 1473 | class CcStatusLog(BaseModel): 1474 | id = BigIntegerField(primary_key=True) 1475 | id_cc_card = BigIntegerField() 1476 | status = IntegerField() 1477 | updated_date = DateTimeField() 1478 | 1479 | class Meta: 1480 | db_table = 'cc_status_log' 1481 | 1482 | 1483 | class CcSubscriptionService(BaseModel): 1484 | datecreate = DateTimeField() 1485 | datelastrun = DateTimeField() 1486 | emailreport = CharField() 1487 | fee = FloatField() 1488 | id = BigIntegerField(primary_key=True) 1489 | label = CharField() 1490 | numberofrun = IntegerField() 1491 | startdate = DateTimeField() 1492 | status = IntegerField() 1493 | stopdate = DateTimeField() 1494 | totalcardperform = IntegerField() 1495 | totalcredit = FloatField() 1496 | 1497 | class Meta: 1498 | db_table = 'cc_subscription_service' 1499 | 1500 | 1501 | class CcSubscriptionSignup(BaseModel): 1502 | description = CharField(null=True) 1503 | enable = IntegerField() 1504 | id = BigIntegerField(primary_key=True) 1505 | id_callplan = BigIntegerField(null=True) 1506 | id_subscription = BigIntegerField(null=True) 1507 | label = CharField() 1508 | 1509 | class Meta: 1510 | db_table = 'cc_subscription_signup' 1511 | 1512 | 1513 | class CcSupport(BaseModel): 1514 | email = CharField(null=True) 1515 | language = CharField() 1516 | name = CharField() 1517 | 1518 | class Meta: 1519 | db_table = 'cc_support' 1520 | 1521 | 1522 | class CcSupportComponent(BaseModel): 1523 | activated = IntegerField() 1524 | id_support = IntegerField() 1525 | name = CharField() 1526 | type_user = IntegerField() 1527 | 1528 | class Meta: 1529 | db_table = 'cc_support_component' 1530 | 1531 | 1532 | class CcSystemLog(BaseModel): 1533 | action = TextField() 1534 | agent = IntegerField(null=True) 1535 | creationdate = DateTimeField() 1536 | data = TextField(null=True) 1537 | description = TextField(null=True) 1538 | iduser = IntegerField() 1539 | ipaddress = CharField(null=True) 1540 | loglevel = IntegerField() 1541 | pagename = CharField(null=True) 1542 | tablename = CharField(null=True) 1543 | 1544 | class Meta: 1545 | db_table = 'cc_system_log' 1546 | 1547 | 1548 | class CcTariffgroup(BaseModel): 1549 | creationdate = DateTimeField() 1550 | id_cc_package_offer = BigIntegerField() 1551 | idtariffplan = IntegerField() 1552 | iduser = IntegerField() 1553 | lcrtype = IntegerField() 1554 | removeinterprefix = IntegerField() 1555 | tariffgroupname = CharField() 1556 | 1557 | class Meta: 1558 | db_table = 'cc_tariffgroup' 1559 | 1560 | 1561 | class CcTariffgroupPlan(BaseModel): 1562 | idtariffgroup = IntegerField() 1563 | idtariffplan = IntegerField() 1564 | 1565 | class Meta: 1566 | db_table = 'cc_tariffgroup_plan' 1567 | indexes = ( 1568 | (('idtariffgroup', 'idtariffplan'), True), 1569 | ) 1570 | primary_key = CompositeKey('idtariffgroup', 'idtariffplan') 1571 | 1572 | 1573 | class CcTariffplan(BaseModel): 1574 | calleridprefix = CharField() 1575 | creationdate = DateTimeField() 1576 | description = TextField(null=True) 1577 | dnidprefix = CharField() 1578 | expirationdate = DateTimeField() 1579 | id_trunk = IntegerField(null=True) 1580 | idowner = IntegerField(null=True) 1581 | iduser = IntegerField() 1582 | reftariffplan = IntegerField(null=True) 1583 | secondusedcarrier = IntegerField(null=True) 1584 | secondusedratecard = IntegerField(null=True) 1585 | secondusedreal = IntegerField(null=True) 1586 | startingdate = DateTimeField() 1587 | tariffname = CharField() 1588 | 1589 | class Meta: 1590 | db_table = 'cc_tariffplan' 1591 | indexes = ( 1592 | (('iduser', 'tariffname'), True), 1593 | ) 1594 | 1595 | 1596 | class CcTemplatemail(BaseModel): 1597 | fromemail = CharField(null=True) 1598 | fromname = CharField(null=True) 1599 | id_language = CharField() 1600 | mailtype = CharField(null=True) 1601 | messagehtml = CharField(null=True) 1602 | messagetext = CharField(null=True) 1603 | subject = CharField(null=True) 1604 | 1605 | class Meta: 1606 | db_table = 'cc_templatemail' 1607 | indexes = ( 1608 | (('mailtype', 'id_language'), True), 1609 | ) 1610 | 1611 | 1612 | class CcTicket(BaseModel): 1613 | creationdate = DateTimeField() 1614 | creator = BigIntegerField() 1615 | creator_type = IntegerField() 1616 | description = TextField(null=True) 1617 | id = BigIntegerField(primary_key=True) 1618 | id_component = IntegerField() 1619 | priority = IntegerField() 1620 | status = IntegerField() 1621 | title = CharField() 1622 | viewed_admin = IntegerField() 1623 | viewed_agent = IntegerField() 1624 | viewed_cust = IntegerField() 1625 | 1626 | class Meta: 1627 | db_table = 'cc_ticket' 1628 | 1629 | 1630 | class CcTicketComment(BaseModel): 1631 | creator = BigIntegerField() 1632 | creator_type = IntegerField() 1633 | date = DateTimeField() 1634 | description = TextField(null=True) 1635 | id = BigIntegerField(primary_key=True) 1636 | id_ticket = BigIntegerField() 1637 | viewed_admin = IntegerField() 1638 | viewed_agent = IntegerField() 1639 | viewed_cust = IntegerField() 1640 | 1641 | class Meta: 1642 | db_table = 'cc_ticket_comment' 1643 | 1644 | 1645 | class CcTimezone(BaseModel): 1646 | gmtoffset = BigIntegerField() 1647 | gmttime = CharField(null=True) 1648 | gmtzone = CharField(null=True) 1649 | 1650 | class Meta: 1651 | db_table = 'cc_timezone' 1652 | 1653 | 1654 | class CcTrunk(BaseModel): 1655 | addparameter = CharField(null=True) 1656 | creationdate = DateTimeField() 1657 | failover_trunk = IntegerField(null=True) 1658 | id_provider = IntegerField(null=True) 1659 | id_trunk = PrimaryKeyField() 1660 | if_max_use = IntegerField(null=True) 1661 | inuse = IntegerField(null=True) 1662 | maxuse = IntegerField(null=True) 1663 | providerip = CharField() 1664 | providertech = CharField() 1665 | removeprefix = CharField(null=True) 1666 | secondusedcarrier = IntegerField(null=True) 1667 | secondusedratecard = IntegerField(null=True) 1668 | secondusedreal = IntegerField(null=True) 1669 | status = IntegerField(null=True) 1670 | trunkcode = CharField(null=True) 1671 | trunkprefix = CharField(null=True) 1672 | 1673 | class Meta: 1674 | db_table = 'cc_trunk' 1675 | 1676 | 1677 | class CcUiAuthen(BaseModel): 1678 | city = CharField(null=True) 1679 | confaddcust = IntegerField(null=True) 1680 | country = CharField(null=True) 1681 | datecreation = DateTimeField() 1682 | direction = CharField(null=True) 1683 | email = CharField(null=True) 1684 | fax = CharField(null=True) 1685 | groupid = IntegerField(null=True) 1686 | login = CharField(unique=True) 1687 | name = CharField(null=True) 1688 | perms = IntegerField(null=True) 1689 | phone = CharField(null=True) 1690 | pwd_encoded = CharField() 1691 | state = CharField(null=True) 1692 | userid = BigIntegerField(primary_key=True) 1693 | zipcode = CharField(null=True) 1694 | 1695 | class Meta: 1696 | db_table = 'cc_ui_authen' 1697 | 1698 | 1699 | class CcVersion(BaseModel): 1700 | version = CharField() 1701 | 1702 | class Meta: 1703 | db_table = 'cc_version' 1704 | 1705 | 1706 | class CcVoucher(BaseModel): 1707 | activated = CharField() 1708 | creationdate = DateTimeField() 1709 | credit = FloatField() 1710 | currency = CharField(null=True) 1711 | expirationdate = DateTimeField() 1712 | id = BigIntegerField(primary_key=True) 1713 | tag = CharField(null=True) 1714 | used = IntegerField(null=True) 1715 | usedate = DateTimeField() 1716 | usedcardnumber = CharField(null=True) 1717 | voucher = CharField(unique=True) 1718 | 1719 | class Meta: 1720 | db_table = 'cc_voucher' 1721 | 1722 | 1723 | class Cdrs(BaseModel): 1724 | call_start_time = DateTimeField() 1725 | cdr = BigIntegerField(db_column='cdr_id', primary_key=True) 1726 | cost = IntegerField() 1727 | created = DateTimeField() 1728 | dst_domain = CharField() 1729 | dst_ousername = CharField() 1730 | dst_username = CharField() 1731 | duration = IntegerField() 1732 | rated = IntegerField() 1733 | sip_call = CharField(db_column='sip_call_id') 1734 | sip_from_tag = CharField() 1735 | sip_to_tag = CharField() 1736 | src_domain = CharField() 1737 | src_ip = CharField() 1738 | src_username = CharField() 1739 | 1740 | class Meta: 1741 | db_table = 'cdrs' 1742 | indexes = ( 1743 | (('sip_call', 'sip_from_tag', 'sip_to_tag'), True), 1744 | ) 1745 | 1746 | 1747 | class CollectionCdrs(BaseModel): 1748 | call_start_time = DateTimeField() 1749 | cdr = BigIntegerField(db_column='cdr_id') 1750 | cost = IntegerField() 1751 | dst_domain = CharField() 1752 | dst_ousername = CharField() 1753 | dst_username = CharField() 1754 | duration = IntegerField() 1755 | flag_imported = IntegerField() 1756 | id = BigIntegerField(primary_key=True) 1757 | rated = IntegerField() 1758 | sip_call = CharField(db_column='sip_call_id') 1759 | sip_code = CharField() 1760 | sip_from_tag = CharField() 1761 | sip_reason = CharField() 1762 | sip_to_tag = CharField() 1763 | src_domain = CharField() 1764 | src_ip = CharField() 1765 | src_username = CharField() 1766 | 1767 | class Meta: 1768 | db_table = 'collection_cdrs' 1769 | 1770 | 1771 | class MissedCalls(BaseModel): 1772 | callid = CharField(index=True) 1773 | cdr = IntegerField(db_column='cdr_id') 1774 | dst_domain = CharField() 1775 | dst_ouser = CharField() 1776 | dst_user = CharField() 1777 | from_tag = CharField() 1778 | method = CharField() 1779 | sip_code = CharField() 1780 | sip_reason = CharField() 1781 | src_domain = CharField() 1782 | src_ip = CharField() 1783 | src_user = CharField() 1784 | time = DateTimeField() 1785 | to_tag = CharField() 1786 | 1787 | class Meta: 1788 | db_table = 'missed_calls' 1789 | 1790 | 1791 | class Note(BaseModel): 1792 | created = DateTimeField() 1793 | message = TextField() 1794 | 1795 | class Meta: 1796 | db_table = 'note' 1797 | 1798 | 1799 | class User(BaseModel): 1800 | active = IntegerField() 1801 | admin = IntegerField() 1802 | email = CharField(unique=True) 1803 | password = CharField() 1804 | username = CharField(unique=True) 1805 | 1806 | class Meta: 1807 | db_table = 'user' 1808 | -------------------------------------------------------------------------------- /a2billing_flask_api/models.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | from app import db 3 | from peewee import * 4 | 5 | 6 | class CardGroup(db.Model): 7 | name = CharField() 8 | description = TextField(null=True) 9 | users_perms = IntegerField(default=0) 10 | id_agent = IntegerField(default=0) 11 | 12 | class Meta: 13 | db_table = 'cc_card_group' 14 | 15 | 16 | class Card(db.Model): 17 | # user = ForeignKeyField(User, related_name='tweets') 18 | creationdate = DateTimeField(default=datetime.datetime.now) 19 | firstusedate = CharField(null=True) 20 | expirationdate = CharField(null=True) 21 | enableexpire = CharField(null=True) 22 | expiredays = CharField(null=True) 23 | username = CharField(null=False) 24 | useralias = CharField() 25 | uipass = CharField() 26 | credit = FloatField(default=0.0) 27 | tariff = CharField() 28 | id_didgroup = CharField(null=True) 29 | activated = CharField(choices=(('f', 'False'), ('t', 'True'))) 30 | status = IntegerField(default=1) 31 | lastname = CharField(default='') 32 | firstname = CharField(default='') 33 | address = CharField(default='') 34 | city = CharField(default='') 35 | state = CharField(default='') 36 | country = CharField(default='') 37 | zipcode = CharField(default='') 38 | phone = CharField(default='') 39 | email = CharField(default='') 40 | fax = CharField(default='') 41 | # inuse = CharField(null=True) 42 | simultaccess = IntegerField(default=0) 43 | currency = CharField(default='USD') 44 | # lastuse = CharField(null=True) 45 | # nbused = CharField(null=True) 46 | typepaid = IntegerField(default=0) 47 | creditlimit = IntegerField(default=0) 48 | voipcall = IntegerField(default=0) 49 | sip_buddy = IntegerField(default=0) 50 | iax_buddy = IntegerField(default=0) 51 | language = CharField(default='en') 52 | redial = CharField(default='') 53 | runservice = CharField(null=True) 54 | # nbservice = CharField(null=True) 55 | # id_campaign = CharField(null=True) 56 | # num_trials_done = CharField(null=True) 57 | vat = FloatField(null=False, default=0) 58 | # servicelastrun = CharField(null=True) 59 | # Using DecimalField produce an error 60 | initialbalance = FloatField(default=0.0) 61 | invoiceday = IntegerField(default=1) 62 | autorefill = IntegerField(default=0) 63 | loginkey = CharField(default='') 64 | mac_addr = CharField(default='00-00-00-00-00-00') 65 | id_timezone = IntegerField(default=0) 66 | tag = CharField(default='') 67 | voicemail_permitted = IntegerField(default=0) 68 | voicemail_activated = IntegerField(default=0) 69 | # last_notification = CharField(null=True) 70 | email_notification = CharField(default='') 71 | notify_email = IntegerField(default=0) 72 | credit_notification = IntegerField(default=-1) 73 | id_group = IntegerField(default=1) 74 | company_name = CharField(default='') 75 | company_website = CharField(default='') 76 | vat_rn = CharField(null=True) 77 | traffic = BigIntegerField(default=0) 78 | traffic_target = CharField(default='') 79 | # Using DecimalField produce an error 80 | discount = FloatField(default=0.0) 81 | # restriction = CharField(null=True) 82 | # id_seria = CharField(null=True) 83 | # serial = CharField(null=True) 84 | block = IntegerField(default=0) 85 | lock_pin = CharField(null=True) 86 | lock_date = DateTimeField(null=True) 87 | max_concurrent = IntegerField(default=10) 88 | # is_published = BooleanField(default=True) 89 | 90 | class Meta: 91 | db_table = 'cc_card' 92 | 93 | 94 | class Callerid(db.Model): 95 | # id = BigIntegerField(primary_key=True) 96 | # id_cc_card = BigIntegerField() 97 | id_cc_card = ForeignKeyField(Card, db_column='id_cc_card') 98 | activated = CharField(default='t') 99 | cid = CharField(unique=True) 100 | 101 | class Meta: 102 | db_table = 'cc_callerid' 103 | 104 | 105 | class Logrefill(db.Model): 106 | # id = BigIntegerField(primary_key=True) 107 | # card = ForeignKeyField(Card, db_column='card_id') 108 | card = BigIntegerField(db_column='card_id', null=True) 109 | date = DateTimeField(null=True) 110 | agent = BigIntegerField(db_column='agent_id', null=True) 111 | credit = DecimalField(default=0.0) 112 | description = TextField(null=True) 113 | # refill_type (amount:0, correction:1, extra fee:2,agent refund:3) 114 | refill_type = IntegerField(default=0) 115 | added_invoice = IntegerField(default=0) 116 | 117 | class Meta: 118 | db_table = 'cc_logrefill' 119 | 120 | 121 | class Logpayment(db.Model): 122 | card = BigIntegerField(db_column='card_id') 123 | date = DateTimeField(null=True, default=datetime.datetime.now) 124 | description = TextField(null=True) 125 | payment = DecimalField(default=0.0) 126 | # payment_type (amount:0, correction:1, extra fee:2,agent refund:3) 127 | payment_type = IntegerField(default=0) 128 | id_logrefill = BigIntegerField(null=True) 129 | added_commission = IntegerField(default=0) 130 | added_refill = IntegerField(default=0) 131 | agent = BigIntegerField(db_column='agent_id', null=True) 132 | 133 | class Meta: 134 | db_table = 'cc_logpayment' 135 | 136 | 137 | class Country(db.Model): 138 | # id = BigIntegerField(primary_key=True) 139 | countrycode = CharField() 140 | countryname = CharField() 141 | countryprefix = CharField() 142 | 143 | class Meta: 144 | db_table = 'cc_country' 145 | 146 | def __str__(self): 147 | return self.countryname 148 | 149 | 150 | class Did(db.Model): 151 | # id = BigIntegerField(primary_key=True) 152 | # id_cc_country = IntegerField() 153 | # id_cc_didgroup = BigIntegerField() 154 | id_cc_didgroup = IntegerField(null=False) 155 | id_cc_country = ForeignKeyField(Country, related_name='country', db_column='id_cc_country') 156 | activated = IntegerField(null=False) 157 | did = CharField(unique=True) 158 | reserved = IntegerField(null=True) 159 | iduser = BigIntegerField(null=False) 160 | creationdate = DateTimeField(default=datetime.datetime.now) 161 | startingdate = DateTimeField() 162 | expirationdate = DateTimeField() 163 | aleg_carrier_connect_charge = DecimalField() 164 | aleg_carrier_connect_charge_offp = DecimalField() 165 | aleg_carrier_cost_min = DecimalField() 166 | aleg_carrier_cost_min_offp = DecimalField() 167 | aleg_carrier_increment = IntegerField() 168 | aleg_carrier_increment_offp = IntegerField() 169 | aleg_carrier_initblock = IntegerField() 170 | aleg_carrier_initblock_offp = IntegerField() 171 | aleg_retail_connect_charge = DecimalField() 172 | aleg_retail_connect_charge_offp = DecimalField() 173 | aleg_retail_cost_min = DecimalField() 174 | aleg_retail_cost_min_offp = DecimalField() 175 | aleg_retail_increment = IntegerField() 176 | aleg_retail_increment_offp = IntegerField() 177 | aleg_retail_initblock = IntegerField() 178 | aleg_retail_initblock_offp = IntegerField() 179 | aleg_timeinterval = TextField(null=True) 180 | billingtype = IntegerField(null=True) 181 | connection_charge = DecimalField() 182 | description = TextField(null=True) 183 | fixrate = FloatField() 184 | max_concurrent = IntegerField() 185 | secondusedreal = IntegerField(null=True) 186 | selling_rate = DecimalField() 187 | 188 | class Meta: 189 | db_table = 'cc_did' 190 | 191 | 192 | class DidDestination(db.Model): 193 | # id = BigIntegerField(primary_key=True) 194 | destination = CharField(null=True) 195 | priority = IntegerField() 196 | id_cc_card = BigIntegerField() 197 | id_cc_did = BigIntegerField() 198 | activated = IntegerField() 199 | secondusedreal = IntegerField(null=True) 200 | voip_call = IntegerField(null=True) 201 | validated = IntegerField(null=True) 202 | # creationdate = DateTimeField() 203 | 204 | class Meta: 205 | db_table = 'cc_did_destination' 206 | 207 | 208 | class Call(db.Model): 209 | # id = BigIntegerField(primary_key=True) 210 | sessionid = CharField(default=0) 211 | uniqueid = CharField(null=False) 212 | card_id = BigIntegerField(null=False, db_column='card_id') 213 | nasipaddress = CharField(null=False) 214 | starttime = DateTimeField(index=True, default=datetime.datetime.now) 215 | stoptime = CharField(default="0000-00-00 00:00:00") 216 | buycost = DecimalField(null=True) 217 | calledstation = CharField(index=True) 218 | destination = IntegerField(null=True) 219 | dnid = CharField(null=False) 220 | id_card_package_offer = IntegerField(null=True) 221 | id_did = IntegerField(null=True) 222 | id_ratecard = IntegerField(null=True) 223 | id_tariffgroup = IntegerField(null=True) 224 | id_tariffplan = IntegerField(null=True) 225 | id_trunk = IntegerField(null=True) 226 | real_sessiontime = IntegerField(null=True) 227 | sessionbill = FloatField(null=True) 228 | sessiontime = IntegerField(null=True) 229 | sipiax = IntegerField(null=True) 230 | src = CharField() 231 | terminatecauseid = IntegerField(index=True, null=True) 232 | 233 | class Meta: 234 | db_table = 'cc_call' 235 | 236 | 237 | class Charge(db.Model): 238 | # id = BigIntegerField(primary_key=True) 239 | amount = FloatField(default=0) 240 | charged_status = IntegerField(default=0) 241 | # Values: 1:charge DID setup, 2:Montly charge for DID use, 3:Subscription fee, 4:Extra Charge 242 | chargetype = IntegerField(null=True, default=4) 243 | cover_from = DateField(null=True) 244 | cover_to = DateField(null=True) 245 | creationdate = DateTimeField(index=True, default=datetime.datetime.now) 246 | description = TextField(null=True) 247 | id_cc_card = ForeignKeyField(Card, db_column='id_cc_card') 248 | id_cc_card_subscription = BigIntegerField(null=True) 249 | # id_cc_did = BigIntegerField(null=True) 250 | id_cc_did = ForeignKeyField(Did, db_column='id_cc_did', default=0) 251 | iduser = IntegerField(default=0) 252 | invoiced_status = IntegerField(default=0) 253 | 254 | class Meta: 255 | db_table = 'cc_charge' 256 | 257 | 258 | # 259 | # Previous Models are currently used 260 | # 261 | 262 | 263 | class Agent(db.Model): 264 | active = CharField() 265 | address = CharField(null=True) 266 | bank_info = TextField(null=True) 267 | banner = TextField(null=True) 268 | city = CharField(null=True) 269 | com_balance = DecimalField() 270 | commission = DecimalField() 271 | company = CharField(null=True) 272 | country = CharField(null=True) 273 | credit = DecimalField() 274 | currency = CharField(null=True) 275 | datecreation = DateTimeField() 276 | email = CharField(null=True) 277 | fax = CharField(null=True) 278 | firstname = CharField(null=True) 279 | id = BigIntegerField(primary_key=True) 280 | id_tariffgroup = IntegerField(null=True) 281 | language = CharField(null=True) 282 | lastname = CharField(null=True) 283 | locale = CharField(null=True) 284 | location = TextField(null=True) 285 | login = CharField(unique=True) 286 | options = IntegerField() 287 | passwd = CharField(null=True) 288 | perms = IntegerField(null=True) 289 | phone = CharField(null=True) 290 | state = CharField(null=True) 291 | threshold_remittance = DecimalField() 292 | vat = DecimalField() 293 | zipcode = CharField(null=True) 294 | 295 | class Meta: 296 | db_table = 'cc_agent' 297 | 298 | 299 | class AgentCommission(db.Model): 300 | amount = DecimalField() 301 | commission_percent = DecimalField() 302 | commission_type = IntegerField() 303 | date = DateTimeField() 304 | description = TextField(null=True) 305 | id = BigIntegerField(primary_key=True) 306 | id_agent = IntegerField() 307 | id_card = BigIntegerField() 308 | id_payment = BigIntegerField(null=True) 309 | 310 | class Meta: 311 | db_table = 'cc_agent_commission' 312 | 313 | 314 | class AgentSignup(db.Model): 315 | code = CharField(unique=True) 316 | id = BigIntegerField(primary_key=True) 317 | id_agent = IntegerField() 318 | id_group = IntegerField() 319 | id_tariffgroup = IntegerField() 320 | 321 | class Meta: 322 | db_table = 'cc_agent_signup' 323 | 324 | 325 | class AgentTariffgroup(db.Model): 326 | id_agent = BigIntegerField() 327 | id_tariffgroup = IntegerField() 328 | 329 | class Meta: 330 | db_table = 'cc_agent_tariffgroup' 331 | indexes = ( 332 | (('id_agent', 'id_tariffgroup'), True), 333 | ) 334 | primary_key = CompositeKey('id_agent', 'id_tariffgroup') 335 | 336 | 337 | class Alarm(db.Model): 338 | datecreate = DateTimeField() 339 | datelastrun = DateTimeField() 340 | emailreport = CharField(null=True) 341 | id = BigIntegerField(primary_key=True) 342 | id_trunk = IntegerField(null=True) 343 | maxvalue = FloatField() 344 | minvalue = FloatField() 345 | name = TextField() 346 | numberofalarm = IntegerField() 347 | numberofrun = IntegerField() 348 | periode = IntegerField() 349 | status = IntegerField() 350 | type = IntegerField() 351 | 352 | class Meta: 353 | db_table = 'cc_alarm' 354 | 355 | 356 | class AlarmReport(db.Model): 357 | calculatedvalue = FloatField() 358 | cc_alarm = BigIntegerField(db_column='cc_alarm_id') 359 | daterun = DateTimeField() 360 | id = BigIntegerField(primary_key=True) 361 | 362 | class Meta: 363 | db_table = 'cc_alarm_report' 364 | 365 | 366 | class AutorefillReport(db.Model): 367 | daterun = DateTimeField() 368 | id = BigIntegerField(primary_key=True) 369 | totalcardperform = IntegerField(null=True) 370 | totalcredit = DecimalField(null=True) 371 | 372 | class Meta: 373 | db_table = 'cc_autorefill_report' 374 | 375 | 376 | class Backup(db.Model): 377 | creationdate = DateTimeField() 378 | id = BigIntegerField(primary_key=True) 379 | name = CharField(unique=True) 380 | path = CharField() 381 | 382 | class Meta: 383 | db_table = 'cc_backup' 384 | 385 | 386 | class BillingCustomer(db.Model): 387 | date = DateTimeField() 388 | id = BigIntegerField(primary_key=True) 389 | id_card = BigIntegerField() 390 | id_invoice = BigIntegerField() 391 | start_date = DateTimeField(null=True) 392 | 393 | class Meta: 394 | db_table = 'cc_billing_customer' 395 | 396 | 397 | class CallArchive(db.Model): 398 | buycost = DecimalField(null=True) 399 | calledstation = CharField(index=True) 400 | card = BigIntegerField(db_column='card_id') 401 | destination = IntegerField(null=True) 402 | dnid = CharField() 403 | id = BigIntegerField(primary_key=True) 404 | id_card_package_offer = IntegerField(null=True) 405 | id_did = IntegerField(null=True) 406 | id_ratecard = IntegerField(null=True) 407 | id_tariffgroup = IntegerField(null=True) 408 | id_tariffplan = IntegerField(null=True) 409 | id_trunk = IntegerField(null=True) 410 | nasipaddress = CharField() 411 | real_sessiontime = IntegerField(null=True) 412 | sessionbill = FloatField(null=True) 413 | sessionid = CharField() 414 | sessiontime = IntegerField(null=True) 415 | sipiax = IntegerField(null=True) 416 | src = CharField() 417 | starttime = DateTimeField(index=True) 418 | stoptime = DateTimeField() 419 | terminatecauseid = IntegerField(index=True, null=True) 420 | uniqueid = CharField() 421 | 422 | class Meta: 423 | db_table = 'cc_call_archive' 424 | 425 | 426 | class CallbackSpool(db.Model): 427 | account = CharField(null=True) 428 | actionid = CharField(null=True) 429 | agi_result = CharField(null=True) 430 | application = CharField(null=True) 431 | async = CharField(null=True) 432 | callback_time = DateTimeField() 433 | callerid = CharField(null=True) 434 | channel = CharField(null=True) 435 | context = CharField(null=True) 436 | data = CharField(null=True) 437 | entry_time = DateTimeField() 438 | exten = CharField(null=True) 439 | id = BigIntegerField(primary_key=True) 440 | id_server = IntegerField(null=True) 441 | id_server_group = IntegerField(null=True) 442 | last_attempt_time = DateTimeField() 443 | manager_result = CharField(null=True) 444 | num_attempt = IntegerField() 445 | priority = CharField(null=True) 446 | server_ip = CharField(null=True) 447 | status = CharField(null=True) 448 | timeout = CharField(null=True) 449 | uniqueid = CharField(null=True, unique=True) 450 | variable = CharField(null=True) 451 | 452 | class Meta: 453 | db_table = 'cc_callback_spool' 454 | 455 | 456 | class CallplanLcr(db.Model): 457 | buyrate = DecimalField(null=True) 458 | connectcharge = DecimalField(null=True) 459 | destination = CharField(null=True) 460 | dialprefix = CharField(null=True) 461 | id = IntegerField(null=True) 462 | id_trunk = IntegerField(null=True) 463 | idtariffplan = IntegerField(null=True) 464 | initblock = IntegerField(null=True) 465 | ratecard = IntegerField(db_column='ratecard_id', null=True) 466 | rateinitial = DecimalField(null=True) 467 | startdate = DateTimeField(null=True) 468 | stopdate = DateTimeField(null=True) 469 | tariffgroup = IntegerField(db_column='tariffgroup_id', null=True) 470 | 471 | class Meta: 472 | db_table = 'cc_callplan_lcr' 473 | 474 | 475 | class Campaign(db.Model): 476 | creationdate = DateTimeField() 477 | daily_start_time = TimeField() 478 | daily_stop_time = TimeField() 479 | description = TextField(null=True) 480 | expirationdate = DateTimeField() 481 | forward_number = CharField(null=True) 482 | frequency = IntegerField() 483 | friday = IntegerField() 484 | id_campaign_config = IntegerField() 485 | id_card = BigIntegerField() 486 | id_cid_group = IntegerField() 487 | monday = IntegerField() 488 | name = CharField(unique=True) 489 | nb_callmade = IntegerField(null=True) 490 | saturday = IntegerField() 491 | secondusedreal = IntegerField(null=True) 492 | startingdate = DateTimeField() 493 | status = IntegerField() 494 | sunday = IntegerField() 495 | thursday = IntegerField() 496 | tuesday = IntegerField() 497 | wednesday = IntegerField() 498 | 499 | class Meta: 500 | db_table = 'cc_campaign' 501 | 502 | 503 | class CampaignConfig(db.Model): 504 | context = CharField() 505 | description = TextField(null=True) 506 | flatrate = DecimalField() 507 | name = CharField() 508 | 509 | class Meta: 510 | db_table = 'cc_campaign_config' 511 | 512 | 513 | class CampaignPhonebook(db.Model): 514 | id_campaign = IntegerField() 515 | id_phonebook = IntegerField() 516 | 517 | class Meta: 518 | db_table = 'cc_campaign_phonebook' 519 | indexes = ( 520 | (('id_campaign', 'id_phonebook'), True), 521 | ) 522 | primary_key = CompositeKey('id_campaign', 'id_phonebook') 523 | 524 | 525 | class CampaignPhonestatus(db.Model): 526 | id_callback = CharField() 527 | id_campaign = IntegerField() 528 | id_phonenumber = BigIntegerField() 529 | lastuse = DateTimeField() 530 | status = IntegerField() 531 | 532 | class Meta: 533 | db_table = 'cc_campaign_phonestatus' 534 | indexes = ( 535 | (('id_phonenumber', 'id_campaign'), True), 536 | ) 537 | primary_key = CompositeKey('id_campaign', 'id_phonenumber') 538 | 539 | 540 | class CampaignconfCardgroup(db.Model): 541 | id_campaign_config = IntegerField() 542 | id_card_group = IntegerField() 543 | 544 | class Meta: 545 | db_table = 'cc_campaignconf_cardgroup' 546 | indexes = ( 547 | (('id_campaign_config', 'id_card_group'), True), 548 | ) 549 | primary_key = CompositeKey('id_campaign_config', 'id_card_group') 550 | 551 | 552 | class CardArchive(db.Model): 553 | vat_rn = CharField(db_column='VAT_RN', null=True) 554 | activated = CharField() 555 | activatedbyuser = CharField() 556 | address = CharField(null=True) 557 | autorefill = IntegerField(null=True) 558 | city = CharField(null=True) 559 | company_name = CharField(null=True) 560 | company_website = CharField(null=True) 561 | country = CharField(null=True) 562 | creationdate = DateTimeField(index=True) 563 | credit = DecimalField() 564 | credit_notification = IntegerField() 565 | creditlimit = IntegerField(null=True) 566 | currency = CharField(null=True) 567 | discount = DecimalField() 568 | email = CharField(null=True) 569 | email_notification = CharField(null=True) 570 | enableexpire = IntegerField(null=True) 571 | expirationdate = DateTimeField() 572 | expiredays = IntegerField(null=True) 573 | fax = CharField(null=True) 574 | firstname = CharField(null=True) 575 | firstusedate = DateTimeField() 576 | iax_buddy = IntegerField(null=True) 577 | id = BigIntegerField(primary_key=True) 578 | id_campaign = IntegerField(null=True) 579 | id_didgroup = IntegerField(null=True) 580 | id_group = IntegerField() 581 | id_timezone = IntegerField(null=True) 582 | initialbalance = DecimalField() 583 | inuse = IntegerField(null=True) 584 | invoiceday = IntegerField(null=True) 585 | language = CharField(null=True) 586 | last_notification = DateTimeField(null=True) 587 | lastname = CharField(null=True) 588 | lastuse = DateTimeField() 589 | loginkey = CharField(null=True) 590 | mac_addr = CharField() 591 | nbservice = IntegerField(null=True) 592 | nbused = IntegerField(null=True) 593 | notify_email = IntegerField() 594 | num_trials_done = BigIntegerField(null=True) 595 | phone = CharField(null=True) 596 | redial = CharField(null=True) 597 | restriction = IntegerField() 598 | runservice = IntegerField(null=True) 599 | servicelastrun = DateTimeField() 600 | simultaccess = IntegerField(null=True) 601 | sip_buddy = IntegerField(null=True) 602 | state = CharField(null=True) 603 | status = IntegerField(null=True) 604 | tag = CharField(null=True) 605 | tariff = IntegerField(null=True) 606 | traffic = BigIntegerField(null=True) 607 | traffic_target = TextField(null=True) 608 | typepaid = IntegerField(null=True) 609 | uipass = CharField(null=True) 610 | useralias = CharField() 611 | username = CharField(index=True) 612 | vat = FloatField() 613 | voicemail_activated = IntegerField() 614 | voicemail_permitted = IntegerField() 615 | voipcall = IntegerField(null=True) 616 | zipcode = CharField(null=True) 617 | 618 | class Meta: 619 | db_table = 'cc_card_archive' 620 | 621 | 622 | class CardHistory(db.Model): 623 | datecreated = DateTimeField() 624 | description = TextField(null=True) 625 | id = BigIntegerField(primary_key=True) 626 | id_cc_card = BigIntegerField(null=True) 627 | 628 | class Meta: 629 | db_table = 'cc_card_history' 630 | 631 | 632 | class CardPackageOffer(db.Model): 633 | date_consumption = DateTimeField(index=True) 634 | id = BigIntegerField(primary_key=True) 635 | id_cc_card = BigIntegerField(index=True) 636 | id_cc_package_offer = BigIntegerField(index=True) 637 | used_secondes = BigIntegerField() 638 | 639 | class Meta: 640 | db_table = 'cc_card_package_offer' 641 | 642 | 643 | class CardSeria(db.Model): 644 | description = TextField(null=True) 645 | name = CharField() 646 | value = BigIntegerField() 647 | 648 | class Meta: 649 | db_table = 'cc_card_seria' 650 | 651 | 652 | class CardSubscription(db.Model): 653 | id = BigIntegerField(primary_key=True) 654 | id_cc_card = BigIntegerField(null=True) 655 | id_subscription_fee = IntegerField(null=True) 656 | last_run = DateTimeField() 657 | limit_pay_date = DateTimeField() 658 | next_billing_date = DateTimeField() 659 | paid_status = IntegerField() 660 | product = CharField(db_column='product_id', null=True) 661 | product_name = CharField(null=True) 662 | startdate = DateTimeField() 663 | stopdate = DateTimeField() 664 | 665 | class Meta: 666 | db_table = 'cc_card_subscription' 667 | 668 | 669 | class CardgroupService(db.Model): 670 | id_card_group = IntegerField() 671 | id_service = IntegerField() 672 | 673 | class Meta: 674 | db_table = 'cc_cardgroup_service' 675 | indexes = ( 676 | (('id_card_group', 'id_service'), True), 677 | ) 678 | primary_key = CompositeKey('id_card_group', 'id_service') 679 | 680 | 681 | class Config(db.Model): 682 | config_description = CharField(null=True) 683 | config_group_title = CharField() 684 | config_key = CharField(null=True) 685 | config_listvalues = CharField(null=True) 686 | config_title = CharField(null=True) 687 | config_value = CharField(null=True) 688 | config_valuetype = IntegerField() 689 | 690 | class Meta: 691 | db_table = 'cc_config' 692 | 693 | 694 | class ConfigGroup(db.Model): 695 | group_description = CharField() 696 | group_title = CharField(unique=True) 697 | 698 | class Meta: 699 | db_table = 'cc_config_group' 700 | 701 | 702 | class Configuration(db.Model): 703 | configuration_description = CharField() 704 | configuration = PrimaryKeyField(db_column='configuration_id') 705 | configuration_key = CharField() 706 | configuration_title = CharField() 707 | configuration_type = IntegerField() 708 | configuration_value = CharField() 709 | set_function = CharField(null=True) 710 | use_function = CharField(null=True) 711 | 712 | class Meta: 713 | db_table = 'cc_configuration' 714 | 715 | 716 | class Currencies(db.Model): 717 | basecurrency = CharField() 718 | currency = CharField(unique=True) 719 | lastupdate = DateTimeField() 720 | name = CharField() 721 | value = DecimalField() 722 | 723 | class Meta: 724 | db_table = 'cc_currencies' 725 | 726 | 727 | class DidUse(db.Model): 728 | activated = IntegerField(null=True) 729 | id = BigIntegerField(primary_key=True) 730 | id_cc_card = BigIntegerField(null=True) 731 | id_did = BigIntegerField() 732 | month_payed = IntegerField(null=True) 733 | releasedate = DateTimeField() 734 | reminded = IntegerField() 735 | reservationdate = DateTimeField() 736 | 737 | class Meta: 738 | db_table = 'cc_did_use' 739 | 740 | 741 | class Didgroup(db.Model): 742 | creationdate = DateTimeField() 743 | didgroupname = CharField() 744 | id = BigIntegerField(primary_key=True) 745 | 746 | class Meta: 747 | db_table = 'cc_didgroup' 748 | 749 | 750 | class EpaymentLog(db.Model): 751 | amount = CharField() 752 | cardid = BigIntegerField() 753 | cc_expires = CharField(null=True) 754 | cc_number = CharField(null=True) 755 | cc_owner = CharField(null=True) 756 | creationdate = DateTimeField() 757 | credit_card_type = CharField(null=True) 758 | currency = CharField(null=True) 759 | cvv = CharField(null=True) 760 | id = BigIntegerField(primary_key=True) 761 | item = BigIntegerField(db_column='item_id', null=True) 762 | item_type = CharField(null=True) 763 | paymentmethod = CharField() 764 | status = IntegerField() 765 | transaction_detail = TextField(null=True) 766 | vat = FloatField() 767 | 768 | class Meta: 769 | db_table = 'cc_epayment_log' 770 | 771 | 772 | class EpaymentLogAgent(db.Model): 773 | agent = BigIntegerField(db_column='agent_id') 774 | amount = CharField() 775 | cc_expires = CharField(null=True) 776 | cc_number = CharField(null=True) 777 | cc_owner = CharField(null=True) 778 | creationdate = DateTimeField() 779 | credit_card_type = CharField(null=True) 780 | currency = CharField(null=True) 781 | cvv = CharField(null=True) 782 | id = BigIntegerField(primary_key=True) 783 | paymentmethod = CharField() 784 | status = IntegerField() 785 | transaction_detail = TextField(null=True) 786 | vat = FloatField() 787 | 788 | class Meta: 789 | db_table = 'cc_epayment_log_agent' 790 | 791 | 792 | class IaxBuddies(db.Model): 793 | defaultip = CharField(db_column='DEFAULTip', null=True) 794 | accountcode = CharField() 795 | adsi = CharField() 796 | allow = CharField() 797 | amaflags = CharField(null=True) 798 | auth = CharField() 799 | callerid = CharField() 800 | cid_number = CharField() 801 | codecpriority = CharField() 802 | context = CharField() 803 | dbsecret = CharField() 804 | deny = CharField() 805 | disallow = CharField() 806 | encryption = CharField() 807 | forcejitterbuffer = CharField() 808 | fullname = CharField() 809 | host = CharField(index=True) 810 | id_cc_card = IntegerField() 811 | inkeys = CharField() 812 | ipaddr = CharField(index=True) 813 | jitterbuffer = CharField() 814 | language = CharField(null=True) 815 | mask = CharField() 816 | maxauthreq = CharField() 817 | maxcallnumbers = CharField() 818 | maxcallnumbers_nonvalidated = CharField() 819 | mohinterpret = CharField() 820 | mohsuggest = CharField() 821 | name = CharField(unique=True) 822 | outkey = CharField() 823 | permit = CharField(null=True) 824 | port = CharField(index=True) 825 | qualify = CharField(null=True) 826 | qualifyfreqnotok = CharField() 827 | qualifyfreqok = CharField() 828 | qualifysmoothing = CharField() 829 | regcontext = CharField() 830 | regexten = CharField() 831 | regseconds = IntegerField() 832 | requirecalltoken = CharField() 833 | secret = CharField() 834 | sendani = CharField() 835 | setvar = CharField() 836 | sourceaddress = CharField() 837 | timezone = CharField() 838 | transfer = CharField() 839 | trunk = CharField(null=True) 840 | type = CharField() 841 | username = CharField() 842 | 843 | class Meta: 844 | db_table = 'cc_iax_buddies' 845 | indexes = ( 846 | (('host', 'port'), False), 847 | (('ipaddr', 'port'), False), 848 | (('name', 'host'), False), 849 | (('name', 'ipaddr', 'port'), False), 850 | ) 851 | 852 | 853 | class Invoice(db.Model): 854 | date = DateTimeField() 855 | description = TextField() 856 | id = BigIntegerField(primary_key=True) 857 | id_card = BigIntegerField() 858 | paid_status = IntegerField() 859 | reference = CharField(null=True, unique=True) 860 | status = IntegerField() 861 | title = CharField() 862 | 863 | class Meta: 864 | db_table = 'cc_invoice' 865 | 866 | 867 | class InvoiceConf(db.Model): 868 | key_val = CharField(unique=True) 869 | value = CharField() 870 | 871 | class Meta: 872 | db_table = 'cc_invoice_conf' 873 | 874 | 875 | class InvoiceItem(db.Model): 876 | vat = DecimalField(db_column='VAT') 877 | date = DateTimeField() 878 | description = TextField() 879 | id = BigIntegerField(primary_key=True) 880 | id_ext = BigIntegerField(null=True) 881 | id_invoice = BigIntegerField() 882 | price = DecimalField() 883 | type_ext = CharField(null=True) 884 | 885 | class Meta: 886 | db_table = 'cc_invoice_item' 887 | 888 | 889 | class InvoicePayment(db.Model): 890 | id_invoice = BigIntegerField() 891 | id_payment = BigIntegerField() 892 | 893 | class Meta: 894 | db_table = 'cc_invoice_payment' 895 | indexes = ( 896 | (('id_invoice', 'id_payment'), True), 897 | ) 898 | primary_key = CompositeKey('id_invoice', 'id_payment') 899 | 900 | 901 | class Iso639(db.Model): 902 | charset = CharField() 903 | code = CharField(primary_key=True) 904 | lname = CharField(null=True) 905 | name = CharField(unique=True) 906 | 907 | class Meta: 908 | db_table = 'cc_iso639' 909 | 910 | 911 | class LogpaymentAgent(db.Model): 912 | added_refill = IntegerField() 913 | agent = BigIntegerField(db_column='agent_id') 914 | date = DateTimeField() 915 | description = TextField(null=True) 916 | id = BigIntegerField(primary_key=True) 917 | id_logrefill = BigIntegerField(null=True) 918 | payment = DecimalField() 919 | payment_type = IntegerField() 920 | 921 | class Meta: 922 | db_table = 'cc_logpayment_agent' 923 | 924 | 925 | class LogrefillAgent(db.Model): 926 | agent = BigIntegerField(db_column='agent_id') 927 | credit = DecimalField() 928 | date = DateTimeField() 929 | description = TextField(null=True) 930 | id = BigIntegerField(primary_key=True) 931 | refill_type = IntegerField() 932 | 933 | class Meta: 934 | db_table = 'cc_logrefill_agent' 935 | 936 | 937 | class MessageAgent(db.Model): 938 | id = BigIntegerField(primary_key=True) 939 | id_agent = IntegerField() 940 | logo = IntegerField() 941 | message = TextField(null=True) 942 | order_display = IntegerField() 943 | type = IntegerField() 944 | 945 | class Meta: 946 | db_table = 'cc_message_agent' 947 | 948 | 949 | class Monitor(db.Model): 950 | description = CharField(null=True) 951 | dial_code = IntegerField(null=True) 952 | enable = IntegerField() 953 | id = BigIntegerField(primary_key=True) 954 | label = CharField() 955 | query = CharField(null=True) 956 | query_type = IntegerField() 957 | result_type = IntegerField() 958 | text_intro = CharField(null=True) 959 | 960 | class Meta: 961 | db_table = 'cc_monitor' 962 | 963 | 964 | class Notification(db.Model): 965 | date = DateTimeField() 966 | from_ = BigIntegerField(db_column='from_id', null=True) 967 | from_type = IntegerField() 968 | id = BigIntegerField(primary_key=True) 969 | key_value = CharField(null=True) 970 | link = BigIntegerField(db_column='link_id', null=True) 971 | link_type = CharField(null=True) 972 | priority = IntegerField() 973 | 974 | class Meta: 975 | db_table = 'cc_notification' 976 | 977 | 978 | class NotificationAdmin(db.Model): 979 | id_admin = IntegerField() 980 | id_notification = BigIntegerField() 981 | viewed = IntegerField() 982 | 983 | class Meta: 984 | db_table = 'cc_notification_admin' 985 | indexes = ( 986 | (('id_notification', 'id_admin'), True), 987 | ) 988 | primary_key = CompositeKey('id_admin', 'id_notification') 989 | 990 | 991 | class OutboundCidGroup(db.Model): 992 | creationdate = DateTimeField() 993 | group_name = CharField() 994 | 995 | class Meta: 996 | db_table = 'cc_outbound_cid_group' 997 | 998 | 999 | class OutboundCidList(db.Model): 1000 | activated = IntegerField() 1001 | cid = CharField(null=True) 1002 | creationdate = DateTimeField() 1003 | outbound_cid_group = IntegerField() 1004 | 1005 | class Meta: 1006 | db_table = 'cc_outbound_cid_list' 1007 | 1008 | 1009 | class PackageGroup(db.Model): 1010 | description = TextField(null=True) 1011 | name = CharField() 1012 | 1013 | class Meta: 1014 | db_table = 'cc_package_group' 1015 | 1016 | 1017 | class PackageOffer(db.Model): 1018 | billingtype = IntegerField() 1019 | creationdate = DateTimeField() 1020 | freetimetocall = IntegerField() 1021 | id = BigIntegerField(primary_key=True) 1022 | label = CharField() 1023 | packagetype = IntegerField() 1024 | startday = IntegerField() 1025 | 1026 | class Meta: 1027 | db_table = 'cc_package_offer' 1028 | 1029 | 1030 | class PackageRate(db.Model): 1031 | package = IntegerField(db_column='package_id') 1032 | rate = IntegerField(db_column='rate_id') 1033 | 1034 | class Meta: 1035 | db_table = 'cc_package_rate' 1036 | indexes = ( 1037 | (('package', 'rate'), True), 1038 | ) 1039 | primary_key = CompositeKey('package', 'rate') 1040 | 1041 | 1042 | class PackgroupPackage(db.Model): 1043 | package = IntegerField(db_column='package_id') 1044 | packagegroup = IntegerField(db_column='packagegroup_id') 1045 | 1046 | class Meta: 1047 | db_table = 'cc_packgroup_package' 1048 | indexes = ( 1049 | (('packagegroup', 'package'), True), 1050 | ) 1051 | primary_key = CompositeKey('package', 'packagegroup') 1052 | 1053 | 1054 | class PaymentMethods(db.Model): 1055 | payment_filename = CharField() 1056 | payment_method = CharField() 1057 | 1058 | class Meta: 1059 | db_table = 'cc_payment_methods' 1060 | 1061 | 1062 | class Payments(db.Model): 1063 | cc_expires = CharField(null=True) 1064 | cc_number = CharField(null=True) 1065 | cc_owner = CharField(null=True) 1066 | cc_type = CharField(null=True) 1067 | currency = CharField(null=True) 1068 | currency_value = DecimalField(null=True) 1069 | customers_email_address = CharField() 1070 | customers = BigIntegerField(db_column='customers_id') 1071 | customers_name = CharField() 1072 | date_purchased = DateTimeField(null=True) 1073 | id = BigIntegerField(primary_key=True) 1074 | item = CharField(db_column='item_id', null=True) 1075 | item_name = CharField(null=True) 1076 | item_quantity = IntegerField() 1077 | last_modified = DateTimeField(null=True) 1078 | orders_amount = DecimalField(null=True) 1079 | orders_date_finished = DateTimeField(null=True) 1080 | orders_status = IntegerField() 1081 | payment_method = CharField() 1082 | 1083 | class Meta: 1084 | db_table = 'cc_payments' 1085 | 1086 | 1087 | class PaymentsAgent(db.Model): 1088 | agent_email_address = CharField() 1089 | agent = BigIntegerField(db_column='agent_id') 1090 | agent_name = CharField() 1091 | cc_expires = CharField(null=True) 1092 | cc_number = CharField(null=True) 1093 | cc_owner = CharField(null=True) 1094 | cc_type = CharField(null=True) 1095 | currency = CharField(null=True) 1096 | currency_value = DecimalField(null=True) 1097 | date_purchased = DateTimeField(null=True) 1098 | id = BigIntegerField(primary_key=True) 1099 | item = CharField(db_column='item_id', null=True) 1100 | item_name = CharField(null=True) 1101 | item_quantity = IntegerField() 1102 | last_modified = DateTimeField(null=True) 1103 | orders_amount = DecimalField(null=True) 1104 | orders_date_finished = DateTimeField(null=True) 1105 | orders_status = IntegerField() 1106 | payment_method = CharField() 1107 | 1108 | class Meta: 1109 | db_table = 'cc_payments_agent' 1110 | 1111 | 1112 | class PaymentsStatus(db.Model): 1113 | status = IntegerField(db_column='status_id') 1114 | status_name = CharField() 1115 | 1116 | class Meta: 1117 | db_table = 'cc_payments_status' 1118 | 1119 | 1120 | class Paypal(db.Model): 1121 | address_city = CharField() 1122 | address_country = CharField() 1123 | address_name = CharField() 1124 | address_state = CharField() 1125 | address_status = CharField() 1126 | address_street = CharField() 1127 | address_zip = CharField() 1128 | first_name = CharField(null=True) 1129 | item_name = CharField(null=True) 1130 | item_number = CharField(null=True) 1131 | last_name = CharField(null=True) 1132 | mc_currency = CharField(null=True) 1133 | mc_fee = DecimalField(null=True) 1134 | mc_gross = DecimalField(null=True) 1135 | memo = TextField(null=True) 1136 | payer_business_name = CharField() 1137 | payer_email = CharField(null=True) 1138 | payer = CharField(db_column='payer_id', null=True) 1139 | payer_status = CharField(null=True) 1140 | payment_date = CharField(null=True) 1141 | payment_status = CharField() 1142 | payment_type = CharField(null=True) 1143 | pending_reason = CharField() 1144 | quantity = IntegerField() 1145 | reason_code = CharField() 1146 | tax = DecimalField(null=True) 1147 | txn = CharField(db_column='txn_id', null=True, unique=True) 1148 | txn_type = CharField() 1149 | 1150 | class Meta: 1151 | db_table = 'cc_paypal' 1152 | 1153 | 1154 | class Phonebook(db.Model): 1155 | description = TextField(null=True) 1156 | id_card = BigIntegerField() 1157 | name = CharField() 1158 | 1159 | class Meta: 1160 | db_table = 'cc_phonebook' 1161 | 1162 | 1163 | class Phonenumber(db.Model): 1164 | amount = IntegerField() 1165 | creationdate = DateTimeField() 1166 | id = BigIntegerField(primary_key=True) 1167 | id_phonebook = IntegerField() 1168 | info = TextField(null=True) 1169 | name = CharField(null=True) 1170 | number = CharField() 1171 | status = IntegerField() 1172 | 1173 | class Meta: 1174 | db_table = 'cc_phonenumber' 1175 | 1176 | 1177 | class Prefix(db.Model): 1178 | destination = CharField(index=True) 1179 | prefix = BigIntegerField(primary_key=True) 1180 | 1181 | class Meta: 1182 | db_table = 'cc_prefix' 1183 | 1184 | 1185 | class Provider(db.Model): 1186 | creationdate = DateTimeField() 1187 | description = TextField(null=True) 1188 | provider_name = CharField(unique=True) 1189 | 1190 | class Meta: 1191 | db_table = 'cc_provider' 1192 | 1193 | 1194 | class Ratecard(db.Model): 1195 | additional_block_charge = DecimalField() 1196 | additional_block_charge_time = IntegerField() 1197 | additional_grace = IntegerField() 1198 | announce_time_correction = DecimalField() 1199 | billingblock = IntegerField() 1200 | billingblocka = IntegerField() 1201 | billingblockb = IntegerField() 1202 | billingblockc = IntegerField() 1203 | buyrate = DecimalField() 1204 | buyrateincrement = IntegerField() 1205 | buyrateinitblock = IntegerField() 1206 | chargea = DecimalField() 1207 | chargeb = DecimalField() 1208 | chargec = FloatField() 1209 | connectcharge = DecimalField() 1210 | destination = BigIntegerField(null=True) 1211 | dialprefix = CharField(index=True) 1212 | disconnectcharge = DecimalField() 1213 | disconnectcharge_after = IntegerField() 1214 | endtime = IntegerField(null=True) 1215 | id_outbound_cidgroup = IntegerField(null=True) 1216 | id_trunk = IntegerField(null=True) 1217 | idtariffplan = IntegerField(index=True) 1218 | initblock = IntegerField() 1219 | is_merged = IntegerField(null=True) 1220 | minimal_cost = DecimalField() 1221 | musiconhold = CharField() 1222 | rateinitial = DecimalField() 1223 | rounding_calltime = IntegerField() 1224 | rounding_threshold = IntegerField() 1225 | startdate = DateTimeField() 1226 | starttime = IntegerField(null=True) 1227 | stepchargea = DecimalField() 1228 | stepchargeb = DecimalField() 1229 | stepchargec = FloatField() 1230 | stopdate = DateTimeField() 1231 | tag = CharField(null=True) 1232 | timechargea = IntegerField() 1233 | timechargeb = IntegerField() 1234 | timechargec = IntegerField() 1235 | 1236 | class Meta: 1237 | db_table = 'cc_ratecard' 1238 | 1239 | 1240 | class Receipt(db.Model): 1241 | date = DateTimeField() 1242 | description = TextField() 1243 | id = BigIntegerField(primary_key=True) 1244 | id_card = BigIntegerField() 1245 | status = IntegerField() 1246 | title = CharField() 1247 | 1248 | class Meta: 1249 | db_table = 'cc_receipt' 1250 | 1251 | 1252 | class ReceiptItem(db.Model): 1253 | date = DateTimeField() 1254 | description = TextField() 1255 | id = BigIntegerField(primary_key=True) 1256 | id_ext = BigIntegerField(null=True) 1257 | id_receipt = BigIntegerField() 1258 | price = DecimalField() 1259 | type_ext = CharField(null=True) 1260 | 1261 | class Meta: 1262 | db_table = 'cc_receipt_item' 1263 | 1264 | 1265 | class RemittanceRequest(db.Model): 1266 | amount = DecimalField() 1267 | date = DateTimeField() 1268 | id = BigIntegerField(primary_key=True) 1269 | id_agent = BigIntegerField() 1270 | status = IntegerField() 1271 | type = IntegerField() 1272 | 1273 | class Meta: 1274 | db_table = 'cc_remittance_request' 1275 | 1276 | 1277 | class RestrictedPhonenumber(db.Model): 1278 | id = BigIntegerField(primary_key=True) 1279 | id_card = BigIntegerField() 1280 | number = CharField() 1281 | 1282 | class Meta: 1283 | db_table = 'cc_restricted_phonenumber' 1284 | 1285 | 1286 | class ServerGroup(db.Model): 1287 | description = TextField(null=True) 1288 | id = BigIntegerField(primary_key=True) 1289 | name = CharField(null=True) 1290 | 1291 | class Meta: 1292 | db_table = 'cc_server_group' 1293 | 1294 | 1295 | class ServerManager(db.Model): 1296 | id = BigIntegerField(primary_key=True) 1297 | id_group = IntegerField(null=True) 1298 | lasttime_used = DateTimeField() 1299 | manager_host = CharField(null=True) 1300 | manager_secret = CharField(null=True) 1301 | manager_username = CharField(null=True) 1302 | server_ip = CharField(null=True) 1303 | 1304 | class Meta: 1305 | db_table = 'cc_server_manager' 1306 | 1307 | 1308 | class Service(db.Model): 1309 | amount = FloatField() 1310 | datecreate = DateTimeField() 1311 | datelastrun = DateTimeField() 1312 | daynumber = IntegerField() 1313 | dialplan = IntegerField(null=True) 1314 | emailreport = CharField() 1315 | id = BigIntegerField(primary_key=True) 1316 | maxnumbercycle = IntegerField() 1317 | name = CharField() 1318 | numberofrun = IntegerField() 1319 | operate_mode = IntegerField(null=True) 1320 | period = IntegerField() 1321 | rule = IntegerField() 1322 | status = IntegerField() 1323 | stopmode = IntegerField() 1324 | totalcardperform = IntegerField() 1325 | totalcredit = FloatField() 1326 | use_group = IntegerField(null=True) 1327 | 1328 | class Meta: 1329 | db_table = 'cc_service' 1330 | 1331 | 1332 | class ServiceReport(db.Model): 1333 | cc_service = BigIntegerField(db_column='cc_service_id') 1334 | daterun = DateTimeField() 1335 | id = BigIntegerField(primary_key=True) 1336 | totalcardperform = IntegerField(null=True) 1337 | totalcredit = FloatField(null=True) 1338 | 1339 | class Meta: 1340 | db_table = 'cc_service_report' 1341 | 1342 | 1343 | class SipBuddies(db.Model): 1344 | defaultip = CharField(db_column='DEFAULTip', null=True) 1345 | accountcode = CharField() 1346 | allow = CharField() 1347 | allowtransfer = CharField() 1348 | amaflags = CharField(null=True) 1349 | auth = CharField() 1350 | autoframing = CharField() 1351 | callbackextension = CharField(null=True) 1352 | callerid = CharField() 1353 | callgroup = CharField(null=True) 1354 | callingpres = CharField() 1355 | cancallforward = CharField(null=True) 1356 | canreinvite = CharField() 1357 | cid_number = CharField() 1358 | context = CharField() 1359 | defaultuser = CharField() 1360 | deny = CharField() 1361 | disallow = CharField() 1362 | dtmfmode = CharField() 1363 | fromdomain = CharField() 1364 | fromuser = CharField() 1365 | fullcontact = CharField() 1366 | host = CharField(index=True) 1367 | id_cc_card = IntegerField() 1368 | incominglimit = CharField() 1369 | insecure = CharField() 1370 | ipaddr = CharField(index=True) 1371 | language = CharField(null=True) 1372 | lastms = CharField(null=True) 1373 | mailbox = CharField() 1374 | mask = CharField() 1375 | maxcallbitrate = CharField() 1376 | md5secret = CharField() 1377 | mohsuggest = CharField() 1378 | musicclass = CharField() 1379 | musiconhold = CharField() 1380 | name = CharField(unique=True) 1381 | nat = CharField(null=True) 1382 | outboundproxy = CharField() 1383 | permit = CharField(null=True) 1384 | pickupgroup = CharField(null=True) 1385 | port = CharField(index=True) 1386 | qualify = CharField(null=True) 1387 | regexten = CharField() 1388 | regseconds = IntegerField() 1389 | regserver = CharField(null=True) 1390 | restrictcid = CharField(null=True) 1391 | rtpholdtimeout = CharField(null=True) 1392 | rtpkeepalive = CharField() 1393 | rtptimeout = CharField(null=True) 1394 | secret = CharField() 1395 | setvar = CharField() 1396 | subscribecontext = CharField() 1397 | subscribemwi = CharField() 1398 | type = CharField() 1399 | useragent = CharField(null=True) 1400 | usereqphone = CharField() 1401 | username = CharField() 1402 | vmexten = CharField() 1403 | 1404 | class Meta: 1405 | db_table = 'cc_sip_buddies' 1406 | indexes = ( 1407 | (('host', 'port'), False), 1408 | (('ipaddr', 'port'), False), 1409 | ) 1410 | 1411 | 1412 | class SipBuddiesEmpty(db.Model): 1413 | defaultip = CharField(db_column='DEFAULTip', null=True) 1414 | accountcode = CharField() 1415 | allow = CharField() 1416 | amaflags = CharField(null=True) 1417 | callerid = CharField() 1418 | callgroup = CharField(null=True) 1419 | cancallforward = CharField(null=True) 1420 | canreinvite = CharField() 1421 | context = CharField() 1422 | deny = CharField() 1423 | disallow = CharField() 1424 | dtmfmode = CharField() 1425 | fromdomain = CharField() 1426 | fromuser = CharField() 1427 | fullcontact = CharField() 1428 | host = CharField() 1429 | id = IntegerField() 1430 | id_cc_card = IntegerField() 1431 | insecure = CharField() 1432 | ipaddr = CharField() 1433 | language = CharField(null=True) 1434 | mailbox = CharField() 1435 | mask = CharField() 1436 | md5secret = CharField() 1437 | musiconhold = CharField() 1438 | name = CharField() 1439 | nat = CharField(null=True) 1440 | permit = CharField(null=True) 1441 | pickupgroup = CharField(null=True) 1442 | port = CharField() 1443 | qualify = CharField(null=True) 1444 | regexten = CharField() 1445 | regseconds = IntegerField() 1446 | restrictcid = CharField(null=True) 1447 | rtpholdtimeout = CharField(null=True) 1448 | rtptimeout = CharField(null=True) 1449 | secret = CharField() 1450 | setvar = CharField() 1451 | type = CharField() 1452 | username = CharField() 1453 | 1454 | class Meta: 1455 | db_table = 'cc_sip_buddies_empty' 1456 | 1457 | 1458 | class Speeddial(db.Model): 1459 | creationdate = DateTimeField() 1460 | id = BigIntegerField(primary_key=True) 1461 | id_cc_card = BigIntegerField() 1462 | name = CharField() 1463 | phone = CharField() 1464 | speeddial = IntegerField(null=True) 1465 | 1466 | class Meta: 1467 | db_table = 'cc_speeddial' 1468 | indexes = ( 1469 | (('id_cc_card', 'speeddial'), True), 1470 | ) 1471 | 1472 | 1473 | class StatusLog(db.Model): 1474 | id = BigIntegerField(primary_key=True) 1475 | id_cc_card = BigIntegerField() 1476 | status = IntegerField() 1477 | updated_date = DateTimeField() 1478 | 1479 | class Meta: 1480 | db_table = 'cc_status_log' 1481 | 1482 | 1483 | class SubscriptionService(db.Model): 1484 | datecreate = DateTimeField() 1485 | datelastrun = DateTimeField() 1486 | emailreport = CharField() 1487 | fee = FloatField() 1488 | id = BigIntegerField(primary_key=True) 1489 | label = CharField() 1490 | numberofrun = IntegerField() 1491 | startdate = DateTimeField() 1492 | status = IntegerField() 1493 | stopdate = DateTimeField() 1494 | totalcardperform = IntegerField() 1495 | totalcredit = FloatField() 1496 | 1497 | class Meta: 1498 | db_table = 'cc_subscription_service' 1499 | 1500 | 1501 | class SubscriptionSignup(db.Model): 1502 | description = CharField(null=True) 1503 | enable = IntegerField() 1504 | id = BigIntegerField(primary_key=True) 1505 | id_callplan = BigIntegerField(null=True) 1506 | id_subscription = BigIntegerField(null=True) 1507 | label = CharField() 1508 | 1509 | class Meta: 1510 | db_table = 'cc_subscription_signup' 1511 | 1512 | 1513 | class Support(db.Model): 1514 | email = CharField(null=True) 1515 | language = CharField() 1516 | name = CharField() 1517 | 1518 | class Meta: 1519 | db_table = 'cc_support' 1520 | 1521 | 1522 | class SupportComponent(db.Model): 1523 | activated = IntegerField() 1524 | id_support = IntegerField() 1525 | name = CharField() 1526 | type_user = IntegerField() 1527 | 1528 | class Meta: 1529 | db_table = 'cc_support_component' 1530 | 1531 | 1532 | class SystemLog(db.Model): 1533 | action = TextField() 1534 | agent = IntegerField(null=True) 1535 | creationdate = DateTimeField() 1536 | data = TextField(null=True) 1537 | description = TextField(null=True) 1538 | iduser = IntegerField() 1539 | ipaddress = CharField(null=True) 1540 | loglevel = IntegerField() 1541 | pagename = CharField(null=True) 1542 | tablename = CharField(null=True) 1543 | 1544 | class Meta: 1545 | db_table = 'cc_system_log' 1546 | 1547 | 1548 | class Tariffgroup(db.Model): 1549 | creationdate = DateTimeField() 1550 | id_cc_package_offer = BigIntegerField() 1551 | idtariffplan = IntegerField() 1552 | iduser = IntegerField() 1553 | lcrtype = IntegerField() 1554 | removeinterprefix = IntegerField() 1555 | tariffgroupname = CharField() 1556 | 1557 | class Meta: 1558 | db_table = 'cc_tariffgroup' 1559 | 1560 | 1561 | class TariffgroupPlan(db.Model): 1562 | idtariffgroup = IntegerField() 1563 | idtariffplan = IntegerField() 1564 | 1565 | class Meta: 1566 | db_table = 'cc_tariffgroup_plan' 1567 | indexes = ( 1568 | (('idtariffgroup', 'idtariffplan'), True), 1569 | ) 1570 | primary_key = CompositeKey('idtariffgroup', 'idtariffplan') 1571 | 1572 | 1573 | class Tariffplan(db.Model): 1574 | calleridprefix = CharField() 1575 | creationdate = DateTimeField() 1576 | description = TextField(null=True) 1577 | dnidprefix = CharField() 1578 | expirationdate = DateTimeField() 1579 | id_trunk = IntegerField(null=True) 1580 | idowner = IntegerField(null=True) 1581 | iduser = IntegerField() 1582 | reftariffplan = IntegerField(null=True) 1583 | secondusedcarrier = IntegerField(null=True) 1584 | secondusedratecard = IntegerField(null=True) 1585 | secondusedreal = IntegerField(null=True) 1586 | startingdate = DateTimeField() 1587 | tariffname = CharField() 1588 | 1589 | class Meta: 1590 | db_table = 'cc_tariffplan' 1591 | indexes = ( 1592 | (('iduser', 'tariffname'), True), 1593 | ) 1594 | 1595 | 1596 | class Templatemail(db.Model): 1597 | fromemail = CharField(null=True) 1598 | fromname = CharField(null=True) 1599 | id_language = CharField() 1600 | mailtype = CharField(null=True) 1601 | messagehtml = CharField(null=True) 1602 | messagetext = CharField(null=True) 1603 | subject = CharField(null=True) 1604 | 1605 | class Meta: 1606 | db_table = 'cc_templatemail' 1607 | indexes = ( 1608 | (('mailtype', 'id_language'), True), 1609 | ) 1610 | 1611 | 1612 | class Ticket(db.Model): 1613 | creationdate = DateTimeField() 1614 | creator = BigIntegerField() 1615 | creator_type = IntegerField() 1616 | description = TextField(null=True) 1617 | id = BigIntegerField(primary_key=True) 1618 | id_component = IntegerField() 1619 | priority = IntegerField() 1620 | status = IntegerField() 1621 | title = CharField() 1622 | viewed_admin = IntegerField() 1623 | viewed_agent = IntegerField() 1624 | viewed_cust = IntegerField() 1625 | 1626 | class Meta: 1627 | db_table = 'cc_ticket' 1628 | 1629 | 1630 | class TicketComment(db.Model): 1631 | creator = BigIntegerField() 1632 | creator_type = IntegerField() 1633 | date = DateTimeField() 1634 | description = TextField(null=True) 1635 | id = BigIntegerField(primary_key=True) 1636 | id_ticket = BigIntegerField() 1637 | viewed_admin = IntegerField() 1638 | viewed_agent = IntegerField() 1639 | viewed_cust = IntegerField() 1640 | 1641 | class Meta: 1642 | db_table = 'cc_ticket_comment' 1643 | 1644 | 1645 | class Timezone(db.Model): 1646 | gmtoffset = BigIntegerField() 1647 | gmttime = CharField(null=True) 1648 | gmtzone = CharField(null=True) 1649 | 1650 | class Meta: 1651 | db_table = 'cc_timezone' 1652 | 1653 | 1654 | class Trunk(db.Model): 1655 | addparameter = CharField(null=True) 1656 | creationdate = DateTimeField() 1657 | failover_trunk = IntegerField(null=True) 1658 | id_provider = IntegerField(null=True) 1659 | id_trunk = PrimaryKeyField() 1660 | if_max_use = IntegerField(null=True) 1661 | inuse = IntegerField(null=True) 1662 | maxuse = IntegerField(null=True) 1663 | providerip = CharField() 1664 | providertech = CharField() 1665 | removeprefix = CharField(null=True) 1666 | secondusedcarrier = IntegerField(null=True) 1667 | secondusedratecard = IntegerField(null=True) 1668 | secondusedreal = IntegerField(null=True) 1669 | status = IntegerField(null=True) 1670 | trunkcode = CharField(null=True) 1671 | trunkprefix = CharField(null=True) 1672 | 1673 | class Meta: 1674 | db_table = 'cc_trunk' 1675 | 1676 | 1677 | class UiAuthen(db.Model): 1678 | city = CharField(null=True) 1679 | confaddcust = IntegerField(null=True) 1680 | country = CharField(null=True) 1681 | datecreation = DateTimeField() 1682 | direction = CharField(null=True) 1683 | email = CharField(null=True) 1684 | fax = CharField(null=True) 1685 | groupid = IntegerField(null=True) 1686 | login = CharField(unique=True) 1687 | name = CharField(null=True) 1688 | perms = IntegerField(null=True) 1689 | phone = CharField(null=True) 1690 | pwd_encoded = CharField() 1691 | state = CharField(null=True) 1692 | userid = BigIntegerField(primary_key=True) 1693 | zipcode = CharField(null=True) 1694 | 1695 | class Meta: 1696 | db_table = 'cc_ui_authen' 1697 | 1698 | 1699 | class Version(db.Model): 1700 | version = CharField() 1701 | 1702 | class Meta: 1703 | db_table = 'cc_version' 1704 | 1705 | 1706 | class Voucher(db.Model): 1707 | activated = CharField() 1708 | creationdate = DateTimeField() 1709 | credit = FloatField() 1710 | currency = CharField(null=True) 1711 | expirationdate = DateTimeField() 1712 | id = BigIntegerField(primary_key=True) 1713 | tag = CharField(null=True) 1714 | used = IntegerField(null=True) 1715 | usedate = DateTimeField() 1716 | usedcardnumber = CharField(null=True) 1717 | voucher = CharField(unique=True) 1718 | 1719 | class Meta: 1720 | db_table = 'cc_voucher' 1721 | 1722 | 1723 | class Cdrs(db.Model): 1724 | call_start_time = DateTimeField() 1725 | cdr = BigIntegerField(db_column='cdr_id', primary_key=True) 1726 | cost = IntegerField() 1727 | created = DateTimeField() 1728 | dst_domain = CharField() 1729 | dst_ousername = CharField() 1730 | dst_username = CharField() 1731 | duration = IntegerField() 1732 | rated = IntegerField() 1733 | sip_call = CharField(db_column='sip_call_id') 1734 | sip_from_tag = CharField() 1735 | sip_to_tag = CharField() 1736 | src_domain = CharField() 1737 | src_ip = CharField() 1738 | src_username = CharField() 1739 | 1740 | class Meta: 1741 | db_table = 'cdrs' 1742 | indexes = ( 1743 | (('sip_call', 'sip_from_tag', 'sip_to_tag'), True), 1744 | ) 1745 | 1746 | 1747 | class CollectionCdrs(db.Model): 1748 | call_start_time = DateTimeField() 1749 | cdr = BigIntegerField(db_column='cdr_id') 1750 | cost = IntegerField() 1751 | dst_domain = CharField() 1752 | dst_ousername = CharField() 1753 | dst_username = CharField() 1754 | duration = IntegerField() 1755 | flag_imported = IntegerField() 1756 | id = BigIntegerField(primary_key=True) 1757 | rated = IntegerField() 1758 | sip_call = CharField(db_column='sip_call_id') 1759 | sip_code = CharField() 1760 | sip_from_tag = CharField() 1761 | sip_reason = CharField() 1762 | sip_to_tag = CharField() 1763 | src_domain = CharField() 1764 | src_ip = CharField() 1765 | src_username = CharField() 1766 | 1767 | class Meta: 1768 | db_table = 'collection_cdrs' 1769 | 1770 | 1771 | class MissedCalls(db.Model): 1772 | callid = CharField(index=True) 1773 | cdr = IntegerField(db_column='cdr_id') 1774 | dst_domain = CharField() 1775 | dst_ouser = CharField() 1776 | dst_user = CharField() 1777 | from_tag = CharField() 1778 | method = CharField() 1779 | sip_code = CharField() 1780 | sip_reason = CharField() 1781 | src_domain = CharField() 1782 | src_ip = CharField() 1783 | src_user = CharField() 1784 | time = DateTimeField() 1785 | to_tag = CharField() 1786 | 1787 | class Meta: 1788 | db_table = 'missed_calls' 1789 | 1790 | 1791 | class Note(db.Model): 1792 | created = DateTimeField() 1793 | message = TextField() 1794 | 1795 | class Meta: 1796 | db_table = 'note' 1797 | 1798 | 1799 | class User(db.Model): 1800 | active = IntegerField() 1801 | admin = IntegerField() 1802 | email = CharField(unique=True) 1803 | password = CharField() 1804 | username = CharField(unique=True) 1805 | 1806 | class Meta: 1807 | db_table = 'user' 1808 | --------------------------------------------------------------------------------