1
|
|
|
# Copyright 2018 Mathias WOLFF |
2
|
|
|
# This file is part of pyfreebilling. |
3
|
|
|
# |
4
|
|
|
# pyfreebilling is free software: you can redistribute it and/or modify |
5
|
|
|
# it under the terms of the Affero GNU General Public License as published by |
6
|
|
|
# the Free Software Foundation, either version 3 of the License, or |
7
|
|
|
# (at your option) any later version. |
8
|
|
|
# |
9
|
|
|
# pyfreebilling is distributed in the hope that it will be useful, |
10
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
# GNU General Public License for more details. |
13
|
|
|
# |
14
|
|
|
# You should have received a copy of the GNU Affero General Public License |
15
|
|
|
# along with pyfreebilling. If not, see <http://www.gnu.org/licenses/> |
16
|
|
|
|
17
|
|
|
from django.core.urlresolvers import reverse |
18
|
|
|
from django.db import models as models |
19
|
|
|
from django.db.models import * |
20
|
|
|
from django.conf import settings |
21
|
|
|
from django.utils.translation import ugettext_lazy as _ |
22
|
|
|
|
23
|
|
|
from django_extensions.db import fields as extension_fields |
24
|
|
|
from django_extensions.db.fields import AutoSlugField |
25
|
|
|
|
26
|
|
|
|
27
|
|
View Code Duplication |
class Acc(models.Model): |
|
|
|
|
28
|
|
|
|
29
|
|
|
# Fields |
30
|
|
|
method = CharField(max_length=16, default='', help_text=_(u"A method is the primary function that a request is meant to invoke on a server.")) |
31
|
|
|
from_tag = CharField(max_length=64, default='', help_text=_(u"The tag parameter serves as a general mechanism to identify a dialog, which is the combination of the Call-ID along with two tags, one from participant in the dialog.")) |
32
|
|
|
to_tag = CharField(max_length=64, default='', help_text=_(u"The tag parameter serves as a general mechanism to identify a dialog, which is the combination of the Call-ID along with two tags, one from participant in the dialog.")) |
33
|
|
|
callid = CharField(max_length=255, default='', db_index=True, help_text=_(u"Call-ID header field uniquely identifies a particular invitation or all registrations of a particular client.")) |
34
|
|
|
sip_code = CharField(max_length=3, default='', help_text=_(u"SIP reply code.")) |
35
|
|
|
sip_reason = CharField(max_length=128, default='', help_text=_(u"SIP reply reason")) |
36
|
|
|
time = DateTimeField(help_text=_(u"Date and time when this record was written.")) |
37
|
|
|
time_attr = models.IntegerField(help_text=_(u"Unix timestamp")) |
38
|
|
|
time_exten = models.IntegerField(help_text=_(u"extended value related to the time of event")) |
39
|
|
|
|
40
|
|
|
|
41
|
|
|
class Meta: |
42
|
|
|
db_table = 'acc' |
43
|
|
|
app_label = 'accounting' |
44
|
|
|
ordering = ('-pk',) |
45
|
|
|
|
46
|
|
|
def __unicode__(self): |
47
|
|
|
return u'%s' % self.pk |
48
|
|
|
|
49
|
|
|
def get_absolute_url(self): |
50
|
|
|
return reverse('accounting_acc_detail', args=(self.pk,)) |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
def get_update_url(self): |
54
|
|
|
return reverse('accounting_acc_update', args=(self.pk,)) |
55
|
|
|
|
56
|
|
|
|
57
|
|
|
class AccCdr(models.Model): |
58
|
|
|
|
59
|
|
|
# Fields |
60
|
|
|
start_time = DateTimeField(default='2000-01-01 00:00:00', db_index=True, help_text=_(u"Start date and time")) |
61
|
|
|
end_time = DateTimeField(default='2000-01-01 00:00:00', help_text=_(u"End date and time")) |
62
|
|
|
duration = DecimalField(max_digits=10, decimal_places=3, default=0, help_text=_(u"Duration")) |
63
|
|
|
|
64
|
|
|
|
65
|
|
|
class Meta: |
66
|
|
|
db_table = 'acc_cdrs' |
67
|
|
|
app_label = 'accounting' |
68
|
|
|
ordering = ('-pk',) |
69
|
|
|
|
70
|
|
|
def __unicode__(self): |
71
|
|
|
return u'%s' % self.pk |
72
|
|
|
|
73
|
|
|
def get_absolute_url(self): |
74
|
|
|
return reverse('accounting_acccdr_detail', args=(self.pk,)) |
75
|
|
|
|
76
|
|
|
|
77
|
|
|
def get_update_url(self): |
78
|
|
|
return reverse('accounting_acccdr_update', args=(self.pk,)) |
79
|
|
|
|
80
|
|
|
|
81
|
|
|
class MissedCall(models.Model): |
82
|
|
|
|
83
|
|
|
# Fields |
84
|
|
|
method = CharField(max_length=16, default='', help_text=_(u"A method is the primary function that a request is meant to invoke on a server.")) |
85
|
|
|
from_tag = CharField(max_length=64, default='', help_text=_(u"The tag parameter serves as a general mechanism to identify a dialog, which is the combination of the Call-ID along with two tags, one from participant in the dialog.")) |
86
|
|
|
to_tag = CharField(max_length=64, default='', help_text=_(u"The tag parameter serves as a general mechanism to identify a dialog, which is the combination of the Call-ID along with two tags, one from participant in the dialog.")) |
87
|
|
|
callid = CharField(max_length=255, default='', db_index=True, help_text=_(u"Call-ID header field uniquely identifies a particular invitation or all registrations of a particular client.")) |
88
|
|
|
sip_code = CharField(max_length=3, default='', help_text=_(u"SIP reply code.")) |
89
|
|
|
sip_reason = CharField(max_length=128, default='', help_text=_(u"SIP reply reason")) |
90
|
|
|
time = DateTimeField(help_text=_(u"Date and time when this record was written.")) |
91
|
|
|
|
92
|
|
|
|
93
|
|
|
class Meta: |
94
|
|
|
db_table = 'missed_calls' |
95
|
|
|
app_label = 'accounting' |
96
|
|
|
ordering = ('-pk',) |
97
|
|
|
|
98
|
|
|
def __unicode__(self): |
99
|
|
|
return u'%s' % self.pk |
100
|
|
|
|
101
|
|
|
def get_absolute_url(self): |
102
|
|
|
return reverse('accounting_missedcall_detail', args=(self.pk,)) |
103
|
|
|
|
104
|
|
|
|
105
|
|
|
def get_update_url(self): |
106
|
|
|
return reverse('accounting_missedcall_update', args=(self.pk,)) |
107
|
|
|
|