1
|
|
|
from django.core.urlresolvers import reverse |
2
|
|
|
from django_extensions.db.fields import AutoSlugField |
3
|
|
|
from django.db.models import * |
4
|
|
|
from django.db import models as models |
5
|
|
|
from django.conf import settings |
6
|
|
|
from django.utils.translation import ugettext_lazy as _ |
7
|
|
|
|
8
|
|
|
from django_extensions.db import fields as extension_fields |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
class Dialog(models.Model): |
12
|
|
|
|
13
|
|
|
# Fields |
14
|
|
|
hash_entry = IntegerField(help_text=_(u"Number of the hash entry in the dialog hash table")) |
15
|
|
|
hash_id = IntegerField(help_text=_(u"The ID on the hash entry")) |
16
|
|
|
callid = CharField(max_length=255, help_text=_(u"Call-ID of the dialog")) |
17
|
|
|
from_uri = CharField(max_length=128, help_text=_(u"The URI of the FROM header (as per INVITE)")) |
18
|
|
|
from_tag = CharField(max_length=64, 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.")) |
19
|
|
|
to_uri = CharField(max_length=128, help_text=_(u"The URI of the TO header (as per INVITE)")) |
20
|
|
|
to_tag = CharField(max_length=64, 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.")) |
21
|
|
|
caller_cseq = CharField(max_length=20, help_text=_(u"Last Cseq number on the caller side.")) |
22
|
|
|
callee_cseq = CharField(max_length=20, help_text=_(u"Last Cseq number on the callee side.")) |
23
|
|
|
caller_route_set = CharField(max_length=512, null=True, blank=True, help_text=_(u"Route set on the caller side.")) |
24
|
|
|
callee_route_set = CharField(max_length=512, null=True, blank=True, help_text=_(u"Route set on the callee side.")) |
25
|
|
|
caller_contact = CharField(max_length=128, help_text=_(u"Caller's contact uri.")) |
26
|
|
|
callee_contact = CharField(max_length=128, help_text=_(u"Callee's contact uri.")) |
27
|
|
|
caller_sock = CharField(max_length=64, help_text=_(u"Local socket used to communicate with caller")) |
28
|
|
|
callee_stock = CharField(max_length=64, help_text=_(u"Local socket used to communicate with callee")) |
29
|
|
|
state = IntegerField(help_text=_(u"The state of the dialog.")) |
30
|
|
|
start_time = IntegerField(help_text=_(u"The timestamp (unix time) when the dialog was confirmed.")) |
31
|
|
|
timeout = IntegerField(help_text=_(u"The timestamp (unix time) when the dialog will expire.")) |
32
|
|
|
sflags = IntegerField(help_text=_(u"The flags to set for dialog and accesible from config file.")) |
33
|
|
|
iflags = IntegerField(help_text=_(u"The internal flags for dialog.")) |
34
|
|
|
toroute_name = CharField(max_length=32, null=True, blank=True, help_text=_(u"The name of route to be executed at dialog timeout.")) |
35
|
|
|
req_uri = CharField(max_length=128, help_text=_(u"The URI of initial request in dialog")) |
36
|
|
|
xdata = CharField(max_length=512, blank=True, null=True, help_text=_(u"Extra data associated to the dialog (e.g., serialized profiles).")) |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
class Meta: |
40
|
|
|
db_table = 'dialog' |
41
|
|
|
app_label = 'sipdialog' |
42
|
|
|
ordering = ('-pk',) |
43
|
|
|
verbose_name = _(u"SIP dialog") |
44
|
|
|
verbose_name_plural = _(u"SIP dialogs") |
45
|
|
|
indexes = [ |
46
|
|
|
models.Index(fields=['hash_entry', 'hash_id']), |
47
|
|
|
] |
48
|
|
|
|
49
|
|
|
def __unicode__(self): |
50
|
|
|
return u'%s' % self.pk |
51
|
|
|
|
52
|
|
|
def get_absolute_url(self): |
53
|
|
|
return reverse('sipdialog_dialog_detail', args=(self.pk,)) |
54
|
|
|
|
55
|
|
|
|
56
|
|
|
def get_update_url(self): |
57
|
|
|
return reverse('sipdialog_dialog_update', args=(self.pk,)) |
58
|
|
|
|
59
|
|
|
|
60
|
|
|
class DialogVar(models.Model): |
61
|
|
|
|
62
|
|
|
# Fields |
63
|
|
|
hash_entry = IntegerField(help_text=_(u"Number of the hash entry in the dialog hash table")) |
64
|
|
|
hash_id = IntegerField(help_text=_(u"The ID on the hash entry")) |
65
|
|
|
dialog_key = CharField(max_length=128, help_text=_(u"The key of the dialog variable")) |
66
|
|
|
dialog_value = CharField(max_length=512, help_text=_(u"The value of the dialog variable")) |
67
|
|
|
|
68
|
|
|
|
69
|
|
|
class Meta: |
70
|
|
|
db_table = 'dialog_vars' |
71
|
|
|
app_label = 'sipdialog' |
72
|
|
|
ordering = ('-pk',) |
73
|
|
|
verbose_name = _(u"SIP dialog vars") |
74
|
|
|
verbose_name_plural = _(u"SIP dialog vars") |
75
|
|
|
indexes = [ |
76
|
|
|
models.Index(fields=['hash_entry', 'hash_id']), |
77
|
|
|
] |
78
|
|
|
|
79
|
|
|
def __unicode__(self): |
80
|
|
|
return u'%s' % self.pk |
81
|
|
|
|
82
|
|
|
def get_absolute_url(self): |
83
|
|
|
return reverse('sipdialog_dialogvar_detail', args=(self.pk,)) |
84
|
|
|
|
85
|
|
|
|
86
|
|
|
def get_update_url(self): |
87
|
|
|
return reverse('sipdialog_dialogvar_update', args=(self.pk,)) |
88
|
|
|
|