]> git.ipfire.org Git - ipfire.org.git/commitdiff
people: Show when clients are on the phone
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 17 Oct 2018 12:55:36 +0000 (13:55 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 17 Oct 2018 15:12:45 +0000 (16:12 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/accounts.py
src/templates/people/modules/sip-status.html
src/web/people.py

index 6b8c1757082667d7c075350db300c9f830e4da67..d1bd6d144971b738857b24ef98d6278e0f8814c8 100644 (file)
@@ -470,6 +470,10 @@ class Account(Object):
 
                return sip_registrations
 
+       @lazy_property
+       def sip_channels(self):
+               return self.backend.talk.freeswitch.get_sip_channels(self)
+
        def get_cdr(self, date=None, limit=None):
                return self.backend.talk.freeswitch.get_cdr_by_account(self, date=date, limit=limit)
 
index c614b9f563a2539b5ffc31d3c59271b1dc8b9696..c1626fbeac21a81e1e7d1b17906a70a152e6f5de 100644 (file)
@@ -1,4 +1,8 @@
-{% if account.sip_registrations %}
+{% if account.sip_channels %}
+    <a class="text-warning" href="/users/{{ account.uid }}/registrations">
+        {{ _("On The Phone") }} ({{ len(account.sip_registrations) }})
+    </a>
+{% elif account.sip_registrations %}
     <a class="text-success" href="/users/{{ account.uid }}/registrations">
         {{ _("Online") }} ({{ len(account.sip_registrations) }})
     </a>
index c327e52e3bea1bc2be69a6859a9a440e9cee5624..595a9483b6701ca85e3acce25ad3bef27518df47 100644 (file)
@@ -252,9 +252,8 @@ class CDRModule(ui_modules.UIModule):
 
 class ChannelsModule(ui_modules.UIModule):
        def render(self, account):
-               channels = self.backend.talk.freeswitch.get_sip_channels(account)
-
-               return self.render_string("people/modules/channels.html", account=account, channels=channels)
+               return self.render_string("people/modules/channels.html",
+                       account=account, channels=account.sip_channels)
 
 
 class MOSModule(ui_modules.UIModule):