From 354445ede2472caff232fb6059e4fbdd3cc21ae5 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 14 Oct 2018 21:58:01 +0100 Subject: [PATCH] talk: Show call quality with stars Signed-off-by: Michael Tremer --- src/backend/talk.py | 8 ++++++++ src/templates/talk/index.html | 2 +- src/templates/talk/modules/cdr.html | 14 +++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/backend/talk.py b/src/backend/talk.py index e5c19655..9c8b5e91 100644 --- a/src/backend/talk.py +++ b/src/backend/talk.py @@ -232,6 +232,14 @@ class CDR(object): def user_agent(self): return self.data.user_agent + @property + def size(self): + return sum((self.data.rtp_audio_in_raw_bytes or 0, self.data.rtp_audio_out_raw_bytes or 0)) + + @property + def mos(self): + return self.data.rtp_audio_in_mos + class Talk(Object): def init(self): diff --git a/src/templates/talk/index.html b/src/templates/talk/index.html index f692ae6e..adbd2bb5 100644 --- a/src/templates/talk/index.html +++ b/src/templates/talk/index.html @@ -9,7 +9,7 @@

{{ _("Your Recent Calls") }}

- {% module TalkCDR(current_user, limit=5) %} + {% module TalkCDR(current_user, limit=20) %}
{% end block %} diff --git a/src/templates/talk/modules/cdr.html b/src/templates/talk/modules/cdr.html index ce7b8547..4e2acc40 100644 --- a/src/templates/talk/modules/cdr.html +++ b/src/templates/talk/modules/cdr.html @@ -31,7 +31,19 @@
- {{ " - ".join((e for e in (c.codec, c.user_agent) if e)) }} + {% if c.mos %} + {% for i in range(1, 6) %} + {% if c.mos > (i + 0.5) %} + + {% elif c.mos > i %} + + {% else %} + + {% end %} + {% end %} + + {{ "%.2f" % c.mos }}/5 + {% end %} -- 2.47.3