Browse Source

Добавил прослушивание записей звонков, и ссылку на поиск абонентов с номерами телефонов

devel
bashmak 9 years ago
parent
commit
c68eebba41
  1. 37
      dialing_app/locale/ru/LC_MESSAGES/django.po
  2. 19
      dialing_app/models.py
  3. 1
      dialing_app/urls.py
  4. 19
      dialing_app/views.py

37
dialing_app/locale/ru/LC_MESSAGES/django.po

@ -59,30 +59,10 @@ msgstr "кто"
msgid "dst"
msgstr "куда"
#: dialing_app/templates/index.html:22
msgid "dcontext"
msgstr "контекст"
#: dialing_app/templates/index.html:23
msgid "channel"
msgstr "канал"
#: dialing_app/templates/index.html:24
msgid "dstchannel"
msgstr "канал назначения"
#: dialing_app/templates/index.html:25
msgid "lastdata"
msgstr "lastdata"
#: dialing_app/templates/index.html:26
msgid "duration"
msgstr "продолжительность"
#: dialing_app/templates/index.html:27
msgid "billsec"
msgstr "вся продолж."
#: dialing_app/templates/index.html:28
msgid "start"
msgstr "начало"
@ -99,14 +79,15 @@ msgstr "конец"
msgid "disposition"
msgstr "состояние"
#: dialing_app/templates/index.html:32
msgid "amaflags"
msgstr "amaflags"
#: dialing_app/templates/index.html:33
msgid "uniqueid"
msgstr "uniqueid"
#: dialing_app/templates/index.html:57
msgid "Calls was not found"
msgstr "Звонки не найдены"
msgid "Play"
msgstr "Слушать"
msgid "User with the telephone number not found"
msgstr "Абонент с таким номером телефона не найден"
msgid "Multiple users with the telephone number"
msgstr "Несколько абонентов с указанным номером телефона"

19
dialing_app/models.py

@ -1,5 +1,6 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from djing import settings
class AsteriskCDR(models.Model):
@ -36,6 +37,24 @@ class AsteriskCDR(models.Model):
def delete(self, *args, **kwargs):
return
def locate_disposition(self):
dsp = self.disposition
if dsp == 'NO ANSWER':
return _('No answer')
elif dsp == 'FAILED':
return _('Failed')
elif dsp == 'BUSY':
return _('Busy')
elif dsp == 'ANSWERED':
return _('Answered')
elif dsp == 'UNKNOWN':
return _('Unknown')
return ''
@staticmethod
def path_to_media():
return getattr(settings, 'DIALING_MEDIA', '/media')
class Meta:
abstract = True

1
dialing_app/urls.py

@ -4,4 +4,5 @@ from . import views
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^to_abon(?P<tel>\+?\d+)$', views.to_abon, name='to_abon')
]

19
dialing_app/views.py

@ -1,6 +1,9 @@
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.contrib import messages
from django.shortcuts import render, redirect
from django.utils.translation import ugettext_lazy as _
from abonapp.models import Abon
from mydefs import only_admins
from .models import getModel
@ -13,3 +16,17 @@ def home(request):
return render(request, 'index.html', {
'logs': logs
})
@login_required
@only_admins
def to_abon(request, tel):
abon = Abon.objects.filter(telephone=tel)
abon_count = abon.count()
if abon_count > 1:
messages.warning(request, _('Multiple users with the telephone number'))
abon = abon[0]
elif abon_count == 0:
messages.error(request, _('User with the telephone number not found'))
return redirect('dialapp:home')
return redirect('abonapp:abon_home', gid=abon.group_id, uid=abon.pk)
Loading…
Cancel
Save