+# 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/>.
+
+from django.db import models
+
+
+class Connection(models.Model):
+ """
+ Connection to a freeswitch server.
+ """
+ name = models.CharField(max_length=100)
+ local_ip_address = models.IPAddressField()
+ local_port = models.PositiveIntegerField()
+ freeswitch_ip_address = models.IPAddressField()
+ freeswitch_port = models.PositiveIntegerField()
+
+
+class SipProfile(models.Model):
+ connection = models.ForeignKey(Connection)
+ name = models.CharField(max_length=100)
+ external_rtp_ip = models.CharField(max_length=100)
+ external_sip_ip = models.CharField(max_length=100)
+ rtp_ip = models.CharField(max_length=100)
+ sip_ip = models.CharField(max_length=100)
+ sip_port = models.PositiveIntegerField()
+ accept_blind_registration = models.BooleanField()
+ authenticate_calls = models.BooleanField()
+ is_active = models.BooleanField()
+
+
+class Domain(models.Model):
+ sip_profile = models.ForeignKey(SipProfile)
+ host_name = models.CharField(max_length=100)
+ is_active = models.BooleanField()
+
+
+class Gateway(models.Model):
+ sip_profile = models.ForeignKey(SipProfile)
+ name = models.CharField(max_length=100)
+ username = models.CharField(max_length=100)
+ password = models.CharField(max_length=100)
+ realm = models.CharField(max_length=100)
+ from_domain = models.CharField(max_length=100)
+ expire_in_seconds = models.PositiveIntegerField()
+ retry_in_seconds = models.PositiveIntegerField()
+ caller_id_in_from_field = models.BooleanField()
+ is_active = models.BooleanField()
+
+
+class Endpoint(models.Model):
+ user_id = models.CharField(max_length=100)
+ password = models.CharField(max_length=100)
+ domain = models.CharField(max_length=100)
+ is_active = models.BooleanField()
+
+
+class Extension(models.Model):
+ destination_match = models.CharField(max_length=100)
+ xml_dialplan = models.TextField()
+ domain = models.CharField(max_length=100)
+ endpoint = models.ForeignKey(Endpoint)
+ authenticate_calls = models.BooleanField()
+ is_active = models.BooleanField()