From: Michael Tremer Date: Fri, 19 Oct 2018 08:48:44 +0000 (+0100) Subject: people: Show call status X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e2b63b7f593ec2487bdc1ed28004438452c20b0d;p=ipfire.org.git people: Show call status Signed-off-by: Michael Tremer --- diff --git a/src/backend/talk.py b/src/backend/talk.py index 8eb2f37c..34a21315 100644 --- a/src/backend/talk.py +++ b/src/backend/talk.py @@ -48,9 +48,9 @@ class Freeswitch(Object): return self._get_channels("SELECT * FROM channels \ WHERE (direction = %s AND cid_num = %s) OR \ (direction = %s AND (callee_num = %s OR callee_num = ANY(%s))) \ - ORDER BY created_epoch", + AND callstate != %s ORDER BY created_epoch", "inbound", account.sip_id, "outbound", account.sip_id, - account._all_telephone_numbers) + account._all_telephone_numbers, "DOWN") def get_cdr_by_account(self, account, date=None, limit=None): res = self.db.query("SELECT * FROM cdr \ @@ -161,6 +161,10 @@ class Channel(object): def called_number(self): return self.data.dest + @property + def state(self): + return self.data.callstate + @property def application(self): return self.data.application @@ -328,6 +332,9 @@ class Talk(Object): def format_codec(name, bit_rate, bandwidth): + if not name: + return + s = [ name, ] diff --git a/src/templates/people/modules/channels.html b/src/templates/people/modules/channels.html index aa0959c5..3a234434 100644 --- a/src/templates/people/modules/channels.html +++ b/src/templates/people/modules/channels.html @@ -58,6 +58,16 @@ + {% if chan.state == "ACTIVE" %} + {# Don't show anything #} + {% elif chan.state == "HELD" %} + {{ _("On Hold") }} + {% elif chan.state == "RINGING" %} + {{ _("Ringing") }} + {% else %} + {{ _("Unknown State: %s") % chan.state }} + {% end %} + {{ format_time(chan.duration) }}