From: Michael Tremer Date: Wed, 17 Oct 2018 12:55:36 +0000 (+0100) Subject: people: Show when clients are on the phone X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f38be5ae15f14643fb96a0ec9aec36ef1041a41;p=ipfire.org.git people: Show when clients are on the phone Signed-off-by: Michael Tremer --- diff --git a/src/backend/accounts.py b/src/backend/accounts.py index 6b8c1757..d1bd6d14 100644 --- a/src/backend/accounts.py +++ b/src/backend/accounts.py @@ -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) diff --git a/src/templates/people/modules/sip-status.html b/src/templates/people/modules/sip-status.html index c614b9f5..c1626fbe 100644 --- a/src/templates/people/modules/sip-status.html +++ b/src/templates/people/modules/sip-status.html @@ -1,4 +1,8 @@ -{% if account.sip_registrations %} +{% if account.sip_channels %} + + {{ _("On The Phone") }} ({{ len(account.sip_registrations) }}) + +{% elif account.sip_registrations %} {{ _("Online") }} ({{ len(account.sip_registrations) }}) diff --git a/src/web/people.py b/src/web/people.py index c327e52e..595a9483 100644 --- a/src/web/people.py +++ b/src/web/people.py @@ -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):