--- /dev/null
+*~
+*.pyc
+local_settings.py
+.#*
+*#
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '/home/antisvin/.ipypbx/ipypbx.db' # Or path to database file if using sqlite3.
-DATABASE_USER = '' # Not used with sqlite3.
-DATABASE_PASSWORD = '' # Not used with sqlite3.
-DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
-DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
-
-INSTALLED_APPS = (
- 'django.contrib.admindocs',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.sites',
-)
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
+ 'ipypbxweb'
)
try:
+++ /dev/null
-*~
-*.pyc
-
# Otherwise initialize a new model.
else:
self.model = QtSql.QSqlTableModel(parent)
- self.model.setTable(self.basename + 's')
+ self.model.setTable('ipypbxweb_%s' % self.basename)
# Create model header from fields list.
for i, field in enumerate(self.fields):
--- /dev/null
+BEGIN;
+CREATE TABLE "ipypbxweb_connection" (
+ "id" integer NOT NULL PRIMARY KEY,
+ "name" varchar(100) NOT NULL,
+ "local_ip_address" char(15) NOT NULL,
+ "local_port" integer unsigned NOT NULL,
+ "freeswitch_ip_address" char(15) NOT NULL,
+ "freeswitch_port" integer unsigned NOT NULL
+)
+;
+CREATE TABLE "ipypbxweb_sipprofile" (
+ "id" integer NOT NULL PRIMARY KEY,
+ "connection_id" integer NOT NULL REFERENCES "ipypbxweb_connection" ("id"),
+ "name" varchar(100) NOT NULL,
+ "external_rtp_ip" varchar(100) NOT NULL,
+ "external_sip_ip" varchar(100) NOT NULL,
+ "rtp_ip" varchar(100) NOT NULL,
+ "sip_ip" varchar(100) NOT NULL,
+ "sip_port" integer unsigned NOT NULL,
+ "accept_blind_registration" bool NOT NULL,
+ "authenticate_calls" bool NOT NULL,
+ "is_active" bool NOT NULL
+)
+;
+CREATE TABLE "ipypbxweb_domain" (
+ "id" integer NOT NULL PRIMARY KEY,
+ "sip_profile_id" integer NOT NULL REFERENCES "ipypbxweb_sipprofile" ("id"),
+ "host_name" varchar(100) NOT NULL,
+ "is_active" bool NOT NULL
+)
+;
+CREATE TABLE "ipypbxweb_gateway" (
+ "id" integer NOT NULL PRIMARY KEY,
+ "sip_profile_id" integer NOT NULL REFERENCES "ipypbxweb_sipprofile" ("id"),
+ "name" varchar(100) NOT NULL,
+ "username" varchar(100) NOT NULL,
+ "password" varchar(100) NOT NULL,
+ "realm" varchar(100) NOT NULL,
+ "from_domain" varchar(100) NOT NULL,
+ "expire_in_seconds" integer unsigned NOT NULL,
+ "retry_in_seconds" integer unsigned NOT NULL,
+ "caller_id_in_from_field" bool NOT NULL,
+ "is_active" bool NOT NULL
+)
+;
+CREATE TABLE "ipypbxweb_endpoint" (
+ "id" integer NOT NULL PRIMARY KEY,
+ "user_id" varchar(100) NOT NULL,
+ "password" varchar(100) NOT NULL,
+ "domain" varchar(100) NOT NULL,
+ "is_active" bool NOT NULL
+)
+;
+CREATE TABLE "ipypbxweb_extension" (
+ "id" integer NOT NULL PRIMARY KEY,
+ "destination_match" varchar(100) NOT NULL,
+ "xml_dialplan" text NOT NULL,
+ "domain" varchar(100) NOT NULL,
+ "endpoint_id" integer NOT NULL REFERENCES "ipypbxweb_endpoint" ("id"),
+ "authenticate_calls" bool NOT NULL,
+ "is_active" bool NOT NULL
+)
+;
+CREATE INDEX "ipypbxweb_sipprofile_connection_id" ON "ipypbxweb_sipprofile" ("connection_id");
+CREATE INDEX "ipypbxweb_domain_sip_profile_id" ON "ipypbxweb_domain" ("sip_profile_id");
+CREATE INDEX "ipypbxweb_gateway_sip_profile_id" ON "ipypbxweb_gateway" ("sip_profile_id");
+CREATE INDEX "ipypbxweb_extension_endpoint_id" ON "ipypbxweb_extension" ("endpoint_id");
+COMMIT;
import os
import sys
-from ipypbx import controllers, sql, ui
+from ipypbx import controllers, ui
from PyQt4 import QtCore, QtGui, QtSql
if db.open():
if created:
- for query in sql.creation_queries:
- QtSql.QSqlQuery().exec_(query)
+ # Load script from local file.
+ sql_script = open(os.path.join(os.path.dirname(__file__), 'create.sql')).read()
+
+ # Split into individual queries.
+ sql_queries = sql_script.split(';')
+
+ # Execute all queries except BEGIN/COMMIT sequences.
+ query = QtSql.QSqlQuery()
+ for query_string in sql_queries[1:-2]:
+ query.exec_(query_string)
else:
+ # Something went horribly wrong.
QtGui.QMessageBox.warning(
None, "Fatal Error", "Database Error: %s" % db.lastError().text())
sys.exit(1)
+++ /dev/null
-# Copyright (c) Stas Shtin, 2010
-
-# This file is part of IPyPBX.
-
-# IPyPBX is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# IPyPBX is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with IPyPBX. If not, see <http://www.gnu.org/licenses/>.
-
-
-# THIS FILE WILL BE DELETED SOON
-
-from axiom.item import Item
-from axiom.attributes import boolean, integer, reference, text
-
-
-class Connection(Item):
- name = text()
- local_ip_address = text()
- local_port = integer()
- freeswitch_ip_address = text()
- freeswitch_port = integer()
-
-
-class SipProfile(Item):
- connection = reference()
- name = text()
- external_rtp_ip = text()
- external_sip_ip = text()
- rtp_ip = text()
- sip_ip = text()
- sip_port = integer()
- accept_blind_registration = boolean()
- authenticate_calls = boolean()
- is_active = boolean()
-
-
-class Domain(Item):
- sip_profile = reference()
- host_name = text()
- is_active = boolean()
-
-
-class Gateway(Item):
- sip_profile = reference()
- name = text()
- username = text()
- password = text()
- realm = text()
- from_domain = text()
- expire_in_seconds = integer()
- retry_in_seconds = integer()
- caller_id_in_from_field = boolean()
- is_active = boolean()
-
-
-class Endpoint(Item):
- user_id = text()
- password = text()
- domain = text()
- is_active = boolean()
-
-
-class Extension(Item):
- destination_match = text()
- xml_dialplan = text()
- domain = text()
- endpoint = reference()
- authenticate_calls = boolean()
- is_active = boolean()
-