]> git.ipfire.org Git - ipfire.org.git/commitdiff
talk: Drop functionality to initiate calls from webapp
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 15 Mar 2017 18:54:36 +0000 (18:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 15 Mar 2017 18:54:36 +0000 (18:54 +0000)
This really doesn't work well and brings ACL issues with it and so
on...

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
templates/talk/conference-invite.html [deleted file]
templates/talk/index.html
templates/talk/initiate-call.html [deleted file]
templates/talk/phonebook-contact.html
webapp/__init__.py
webapp/backend/talk.py
webapp/handlers_talk.py

diff --git a/templates/talk/conference-invite.html b/templates/talk/conference-invite.html
deleted file mode 100644 (file)
index e7ed054..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ _("Inviting %s to %s...") % (invitee.name, conference.name) }}{% end block %}
-
-{% block body %}
-       <div class="row">
-               <div class="col-md-4 col-md-offset-4">
-                       <div class="thumbnail">
-                               <img src="{{ invitee.gravatar_icon(350) }}" alt="{{ invitee.name }}">
-
-                               <div class="caption ac">
-                                       <h3>{{ _("Inviting %s to %s...") % (invitee.name, conference.name) }}</h3>
-                               </div>
-                       </div>
-
-                       <p class="ac">
-                               <a href="/conferences" class="btn btn-sm btn-default" role="button">
-                                       {{ _("Back") }}
-                               </a>
-                       </p>
-               </div>
-       </div>
-{% end block %}
index e2bed372abb331bcd8b0d1ddb7903bfccb8b7dd8..6e99cc3f65c23a9c26e25944cb18092ce3d79da4 100644 (file)
                                                                        {% else %}
                                                                                <h4>{{ contact.called }}</h4>
                                                                        {% end %}
-                                                                       <p>
-                                                                               <a href="/call/{{ contact.called }}" class="btn btn-sm {% if contact.called_account and contact.called_account.sip_is_online() %}btn-success{% else %}btn-danger disabled{% end %}" role="button">
-                                                                                       <span class="glyphicon glyphicon-earphone"></span> {{ _("Call") }}
-                                                                               </a>
-                                                                       </p>
+
+                                                                       {% if contact.called_account and contact.called_account.sip_is_online() %}
+                                                                               <span class="label label-success">{{ _("Online") }}</span>
+                                                                       {% else %}
+                                                                               <span class="label label-danger">{{ _("Offline") }}</span>
+                                                                       {% end %}
                                                                </div>
                                                        </div>
                                                </div>
diff --git a/templates/talk/initiate-call.html b/templates/talk/initiate-call.html
deleted file mode 100644 (file)
index 1b5789f..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ _("Calling %s...") % called_id }}{% end block %}
-
-{% block body %}
-       <div class="row">
-               <div class="col-md-4 col-md-offset-4">
-                       {% if called %}
-                               <div class="thumbnail">
-                                       <img src="{{ called.gravatar_icon(350) }}" alt="{{ called.name }}">
-
-                                       <div class="caption ac">
-                                               <h3>{{ _("Calling %s...") % called.name }}</h3>
-                                       </div>
-                               </div>
-                       {% else %}
-                               <h3 class="ac">{{ _("Calling %s...") % called_id }}</h3>
-                       {% end %}
-
-                       {% if next %}
-                               <p class="ac">
-                                       <a href="{{ next }}" class="btn btn-sm btn-default" role="button">
-                                               {{ _("Back") }}
-                                       </a>
-                               </p>
-                       {% end %}
-               </div>
-       </div>
-{% end block %}
index 7c109f14e99b182418bb10053831b80f4fb17b52..facebf498e44cf6c7274cc770d53fb1db0e7c7da 100644 (file)
                                                        <h4>
                                                                {% if account.uses_sip_forwarding() %}
                                                                        <span class="glyphicon glyphicon-earphone" title="{{ _("calls forwarded") }}"></span>
-                                                                       <a href="/call/{{ account.sip_id }}">{{ account.sip_id }}</a>
                                                                {% elif account.sip_is_online() %}
                                                                        <span class="glyphicon glyphicon-earphone text-success" title="{{ _("online") }}"></span>
-                                                                       <a href="/call/{{ account.sip_id }}">{{ account.sip_id }}</a>
                                                                {% else %}
-                                                                       <span class="glyphicon glyphicon-earphone text-danger" title="{{ _("offline") }}"></span>                                                                       
-                                                                       {{ account.sip_id }}
+                                                                       <span class="glyphicon glyphicon-earphone text-danger" title="{{ _("offline") }}"></span>
                                                                {% end %}
+                                                               {{ account.sip_id }}
                                                        </h4>
                                                </li>
 
index b6db358b12f458929d69b4ca6bbf75e5649d0ef6..b378188c0e4b31f474ecc1a6d9ec3f7ce5596471 100644 (file)
@@ -252,9 +252,7 @@ class Application(tornado.web.Application):
                # talk.ipfire.org
                self.add_handlers(r"talk(\.dev)?\.ipfire\.org", [
                        (r"/", TalkIndexHandler),
-                       (r"/call/(\d+)", TalkInitiateCallHandler),
                        (r"/conferences", TalkConferencesHandler),
-                       (r"/conferences/(\d+)/invite/(\d+)", TalkConferencesInviteHandler),
                        (r"/diagnosis", TalkDiagnosisHandler),
                        (r"/phonebook/(\w+)", TalkPhonebookAccountHandler),
                        (r"/phonebook", TalkPhonebookHandler),
index 79520715b1e09096980743e9a64d304228c001eb..da2f00282aa5a3d774de3884f50bbc8579cd2cf8 100644 (file)
@@ -181,12 +181,6 @@ class Talk(Object):
 
                return self._process_cdr(res, replace_sip_uris=True)
 
-       def initiate_call(self, caller, callee):
-                a = self.connect_to_asterisk()
-
-                return a.call(caller.sip_id, callee,
-                        caller_id="%s <%s>" % (caller.name, caller.sip_id))
-
        # Favourites
 
        def get_favourite_contacts(self, account, limit=6):
@@ -244,19 +238,3 @@ class Conference(Object):
                        self._participants = self.backend.talk.get_ongoing_calls(sip_id=self.sip_id)
 
                return self._participants
-
-       @property
-       def invitees(self):
-               invitees = []
-               participants = [p.caller for p in self.participants]
-
-               for invitee in self.backend.talk.get_phonebook():
-                       if not invitee.sip_id:
-                               continue
-
-                       if invitee.sip_id in participants:
-                               continue
-
-                       invitees.append(invitee)
-
-               return invitees
index f990aa88b3cd04143de5df0cd4532d35d0332e95..ece823b0a508a53e923c8ba6cae1bbc0db06435c 100644 (file)
@@ -45,44 +45,6 @@ class TalkConferencesHandler(BaseHandler):
                        conferences=self.talk.conferences)
 
 
-class TalkConferencesInviteHandler(BaseHandler):
-       @tornado.web.authenticated
-       def get(self, conference_id, invitee_id):
-               # Check for the conference room
-               conference = self.talk.get_conference(conference_id)
-               if not conference:
-                       raise tornado.web.HTTPError(400)
-
-               # Ccheck for the invitee
-               invitee = self.accounts.get_by_sip_id(invitee_id)
-               if not invitee:
-                       raise tornado.web.HTTPError(400)
-
-               # Initiate call
-               self.talk.initiate_call(invitee.sip_id, conference_id)
-
-               self.render("talk/conference-invite.html", invitee=invitee,
-                       conference=conference)
-
-
-class TalkInitiateCallHandler(BaseHandler):
-       @tornado.web.authenticated
-       def get(self, called_id, caller=None):
-               if not self.current_user.sip_id:
-                       raise tornado.web.HTTPError(400)
-
-               called = self.accounts.get_by_sip_id(called_id)
-
-               self.talk.initiate_call(self.current_user, called_id)
-
-               next = self.get_argument("next", None)
-               if next is None:
-                       next = self.request.headers.get("Referer")
-
-               self.render("talk/initiate-call.html", caller=self.current_user,
-                       called=called, called_id=called_id, next=next)
-
-
 class TalkProfileHandler(BaseHandler):
        @tornado.web.authenticated
        def get(self):