]> git.ipfire.org Git - ipfire.org.git/commitdiff
people: Show call status
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 19 Oct 2018 08:48:44 +0000 (09:48 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 19 Oct 2018 08:48:44 +0000 (09:48 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/talk.py
src/templates/people/modules/channels.html

index 8eb2f37c65fe3e3153cd023db8db65e7a1056bdd..34a213156f0c2ab667d787a72d7901f0c91d3b60 100644 (file)
@@ -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,
        ]
index aa0959c550d33137709b3682f7722f762a9ec057..3a234434a51edab3429e6d7bef0102a1bedddfd3 100644 (file)
                                                        </td>
 
                                                        <td class="text-right">
+                                                               {% if chan.state == "ACTIVE" %}
+                                                                       {# Don't show anything #}
+                                                               {% elif chan.state == "HELD" %}
+                                                                       <span class="badge badge-warning mr-2">{{ _("On Hold") }}</span>
+                                                               {% elif chan.state == "RINGING" %}
+                                                                       <span class="badge badge-info mr-2">{{ _("Ringing") }}</span>
+                                                               {% else %}
+                                                                       {{ _("Unknown State: %s") % chan.state }}
+                                                               {% end %}
+
                                                                {{ format_time(chan.duration) }}
                                                        </td>
                                                </tr>