From: Michael Tremer Date: Wed, 15 Mar 2017 18:25:40 +0000 (+0000) Subject: talk: Make click2call work again X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=909b9713ef79c8e27aa3ebfe6ac5722748f925f8;p=ipfire.org.git talk: Make click2call work again Signed-off-by: Michael Tremer --- diff --git a/templates/talk/diagnosis.html b/templates/talk/diagnosis.html index 052f7893..2a5486d3 100644 --- a/templates/talk/diagnosis.html +++ b/templates/talk/diagnosis.html @@ -10,11 +10,19 @@

{{ _("Test Call") }}

-
- - 9999@ipfire.org - - {{ _("A music playing service") }} -
+
{% if current_user.is_admin() %} diff --git a/webapp/backend/asterisk.py b/webapp/backend/asterisk.py index 782a77a9..d404bbab 100644 --- a/webapp/backend/asterisk.py +++ b/webapp/backend/asterisk.py @@ -107,14 +107,14 @@ class AsteriskManager(object): return res["Ping"] == "Pong" - def call(self, caller, callee, caller_id=None, timeout=30000): + def call(self, caller, callee, callee_id=None, timeout=30000): res = self._send_action("Originate", { - "Channel" : caller, + "Channel" : "SIP/%s@kamailio" % caller, "Exten" : callee, "Context" : "from-cli", "Priority" : 1, "Timeout" : timeout, - "CallerID" : caller_id or callee, + "CallerID" : callee_id or callee, }) return res diff --git a/webapp/backend/talk.py b/webapp/backend/talk.py index d4e43f98..a029c371 100644 --- a/webapp/backend/talk.py +++ b/webapp/backend/talk.py @@ -181,9 +181,10 @@ class Talk(Object): return self._process_cdr(res, replace_sip_uris=True) - def initiate_call(self, caller, called, when=None): - self.db.execute("INSERT INTO dialout(caller, called, not_before) \ - VALUES(%s, %s, %s)", caller, called, when) + def initiate_call(self, caller, callee, callee_id=None): + a = self.connect_to_asterisk() + + return a.call(caller, callee, callee_id=callee_id) # Favourites