From 3860111654a4e862680dd2753e5689895be2c200 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 15 Mar 2017 18:54:36 +0000 Subject: [PATCH] talk: Drop functionality to initiate calls from webapp This really doesn't work well and brings ACL issues with it and so on... Signed-off-by: Michael Tremer --- templates/talk/conference-invite.html | 23 ---------------- templates/talk/index.html | 11 ++++---- templates/talk/initiate-call.html | 29 -------------------- templates/talk/phonebook-contact.html | 6 ++--- webapp/__init__.py | 2 -- webapp/backend/talk.py | 22 ---------------- webapp/handlers_talk.py | 38 --------------------------- 7 files changed, 8 insertions(+), 123 deletions(-) delete mode 100644 templates/talk/conference-invite.html delete mode 100644 templates/talk/initiate-call.html diff --git a/templates/talk/conference-invite.html b/templates/talk/conference-invite.html deleted file mode 100644 index e7ed0542..00000000 --- a/templates/talk/conference-invite.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends "../base.html" %} - -{% block title %}{{ _("Inviting %s to %s...") % (invitee.name, conference.name) }}{% end block %} - -{% block body %} -
-
-
- {{ invitee.name }} - -
-

{{ _("Inviting %s to %s...") % (invitee.name, conference.name) }}

-
-
- -

- - {{ _("Back") }} - -

-
-
-{% end block %} diff --git a/templates/talk/index.html b/templates/talk/index.html index e2bed372..6e99cc3f 100644 --- a/templates/talk/index.html +++ b/templates/talk/index.html @@ -30,11 +30,12 @@ {% else %}

{{ contact.called }}

{% end %} -

- -

+ + {% if contact.called_account and contact.called_account.sip_is_online() %} + {{ _("Online") }} + {% else %} + {{ _("Offline") }} + {% end %} diff --git a/templates/talk/initiate-call.html b/templates/talk/initiate-call.html deleted file mode 100644 index 1b5789f5..00000000 --- a/templates/talk/initiate-call.html +++ /dev/null @@ -1,29 +0,0 @@ -{% extends "../base.html" %} - -{% block title %}{{ _("Calling %s...") % called_id }}{% end block %} - -{% block body %} -
-
- {% if called %} -
- {{ called.name }} - -
-

{{ _("Calling %s...") % called.name }}

-
-
- {% else %} -

{{ _("Calling %s...") % called_id }}

- {% end %} - - {% if next %} -

- - {{ _("Back") }} - -

- {% end %} -
-
-{% end block %} diff --git a/templates/talk/phonebook-contact.html b/templates/talk/phonebook-contact.html index 7c109f14..facebf49 100644 --- a/templates/talk/phonebook-contact.html +++ b/templates/talk/phonebook-contact.html @@ -22,14 +22,12 @@

{% if account.uses_sip_forwarding() %} - {{ account.sip_id }} {% elif account.sip_is_online() %} - {{ account.sip_id }} {% else %} - - {{ account.sip_id }} + {% end %} + {{ account.sip_id }}

diff --git a/webapp/__init__.py b/webapp/__init__.py index b6db358b..b378188c 100644 --- a/webapp/__init__.py +++ b/webapp/__init__.py @@ -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), diff --git a/webapp/backend/talk.py b/webapp/backend/talk.py index 79520715..da2f0028 100644 --- a/webapp/backend/talk.py +++ b/webapp/backend/talk.py @@ -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 diff --git a/webapp/handlers_talk.py b/webapp/handlers_talk.py index f990aa88..ece823b0 100644 --- a/webapp/handlers_talk.py +++ b/webapp/handlers_talk.py @@ -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): -- 2.47.3