1 # Copyright (c) Stas Shtin, 2010
3 # This file is part of IPyPBX.
5 # IPyPBX is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # IPyPBX is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with IPyPBX. If not, see <http://www.gnu.org/licenses/>.
18 from django.db import models
21 class Connection(models.Model):
23 Connection to a freeswitch server.
25 name = models.CharField(max_length=100)
26 local_ip_address = models.IPAddressField()
27 local_port = models.PositiveIntegerField()
28 freeswitch_ip_address = models.IPAddressField()
29 freeswitch_port = models.PositiveIntegerField()
32 class SipProfile(models.Model):
33 connection = models.ForeignKey(Connection)
34 name = models.CharField(max_length=100)
35 external_rtp_ip = models.CharField(max_length=100)
36 external_sip_ip = models.CharField(max_length=100)
37 rtp_ip = models.CharField(max_length=100)
38 sip_ip = models.CharField(max_length=100)
39 sip_port = models.PositiveIntegerField()
40 accept_blind_registration = models.BooleanField()
41 authenticate_calls = models.BooleanField()
42 is_active = models.BooleanField()
45 class Domain(models.Model):
46 connection = models.ForeignKey(Connection)
47 sip_profile = models.ForeignKey(SipProfile)
48 host_name = models.CharField(max_length=100)
49 is_active = models.BooleanField()
52 class Gateway(models.Model):
53 connection = models.ForeignKey(Connection)
54 sip_profile = models.ForeignKey(SipProfile)
55 name = models.CharField(max_length=100)
56 username = models.CharField(max_length=100)
57 password = models.CharField(max_length=100)
58 realm = models.CharField(max_length=100)
59 from_domain = models.CharField(max_length=100)
60 expire_in_seconds = models.PositiveIntegerField()
61 retry_in_seconds = models.PositiveIntegerField()
62 caller_id_in_from_field = models.BooleanField()
63 is_active = models.BooleanField()
66 class Endpoint(models.Model):
67 connection = models.ForeignKey(Connection)
68 user_id = models.CharField(max_length=100)
69 password = models.CharField(max_length=100)
70 domain = models.ForeignKey(Domain)
71 is_active = models.BooleanField()
74 class Extension(models.Model):
75 connection = models.ForeignKey(Connection)
76 destination_match = models.CharField(max_length=100)
77 xml_dialplan = models.TextField()
78 domain = models.ForeignKey(Domain)
79 endpoint = models.ForeignKey(Endpoint)
80 authenticate_calls = models.BooleanField()
81 is_active = models.BooleanField()