]> git.ipfire.org Git - ipfire.org.git/commitdiff
talk: Show more status about ongoing calls
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 15 Mar 2017 18:25:57 +0000 (18:25 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 15 Mar 2017 18:25:57 +0000 (18:25 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
templates/talk/modules/contact.html
templates/talk/modules/ongoing-calls.html
webapp/backend/asterisk.py
webapp/ui_modules.py

index 84b1b6e6905fd97c205cb712535aec72e0a1646b..a8bd7080ddfa068bdfd2c766708f46b4bf0d09ff 100644 (file)
@@ -1,4 +1,15 @@
-{% if account %}
+{% if application == "ConfBridge" %}
+       {{ _("Conference Room %s") % number }}
+
+{% elif application == "VoiceMail" %}
+       {{ _("Voicemail") }}:
+
+       {% if account %}
+               <a href="/phonebook/{{ account.uid }}">{{ account.name }}</a>
+               <span class="text-muted">({{ number }})</span>
+       {% end %}
+
+{% elif account %}
        <i class="fa fa-user"></i>
        <a href="/phonebook/{{ account.uid }}">{{ account.name }}</a>
        <span class="text-muted">({{ number }})</span>
@@ -6,9 +17,6 @@
 {% elif number == "900" %}
        {{ _("Conference Service") }}
 
-{% elif number in ("901", "902", "903", "904", "905", "906", "907", "908", "909") %}
-       {{ _("Conference Room #%s") % number[2] }}
-
 {% elif number in ("980", "981", "982", "983", "984", "985", "986", "987", "988", "989") %}
        {{ _("Parked Calls Extension") }} <span class="text-muted">({{ number }})</span>
 
index d57f6331dc1b1090442bc7fdd19e4dce5306a373..8473dcf8221f87eaeeaa7babe2dd11c7596604bf 100644 (file)
@@ -23,7 +23,7 @@
                                        </td>
 
                                        <td>
-                                               {% module TalkContact(c.callee) %}
+                                               {% module TalkContact(c.callee, application=c.application) %}
                                        </td>
 
                                        <td>
index d404bbabbf65dbd59a39d61e3ab03b018ddb347f..8f382579de83f9eed29397f9a5f6f3d851e4ee97 100644 (file)
@@ -191,6 +191,20 @@ class Channel(object):
 
                 return int(seconds)
 
+        _states = {
+            "4" : "ringing",
+            "6" : "connected",
+        }
+
+        @property
+        def state(self):
+                state = self.status.get("ChannelState")
+
+                try:
+                        return self._states[state]
+                except KeyError:
+                        return
+
         @property
         def format(self):
                 return "%s/%s" % (
@@ -223,10 +237,29 @@ class Channel(object):
 
         @property
         def callee(self):
-                num = self.status.get("DNID")
+                if self.application == "ConfBridge":
+                        return self.data # Will have the conference room number
+
+                elif self.application == "VoiceMail":
+                        try:
+                            user, rest = self.data.split("@", 1)
+                        except:
+                            return self.data
+
+                        return user
+
+                num = self.status.get("EffectiveConnectedLineNum") or self.status.get("DNID")
 
                 return self._format_number(num)
 
+        @property
+        def application(self):
+                return self.status.get("Application")
+
+        @property
+        def data(self):
+                return self.status.get("Data")
+
 
 class Peer(object):
         def __init__(self, manager, peer_id):
index f72f65abcd77ba7202843dcf66b31f0e0bb2f683..1cedb4583e9d810f25e0fa6e5fab28d44330f99f 100644 (file)
@@ -329,11 +329,11 @@ class ProgressBarModule(UIModule):
 
 
 class TalkContactModule(UIModule):
-        def render(self, number, name=None):
+        def render(self, number, name=None, application=None):
                 account = self.accounts.get_by_sip_id(number)
 
                 return self.render_string("talk/modules/contact.html",
-                        account=account, number=number, name=name)
+                        account=account, number=number, name=name, application=application)
 
 
 class TalkCallLogModule(UIModule):