]> git.ipfire.org Git - ipfire.org.git/commitdiff
talk: Make click2call work again
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 15 Mar 2017 18:25:40 +0000 (18:25 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 15 Mar 2017 18:25:40 +0000 (18:25 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
templates/talk/diagnosis.html
webapp/backend/asterisk.py
webapp/backend/talk.py

index 052f789316cf87425be8e6b76ba725d61c87b4b1..2a5486d308deddcd27ca3445429149136f47bd92 100644 (file)
        <section id="test-call">
                <h3>{{ _("Test Call") }}</h3>
 
-               <div class="well">
-                       <span class="glyphicon glyphicon-earphone text-success"></span>
-                       <a href="/call/9999"">9999<span class="text-muted">@ipfire.org</span></a>
-                       - {{ _("A music playing service") }}
-               </div>
+               <ul class="list-unstyled">
+                       <li>
+                               <span class="glyphicon glyphicon-earphone text-success"></span>
+                               <a href="/call/991">991<span class="text-muted">@ipfire.org</span></a>
+                               - {{ _("Echo Test") }}
+                       </li>
+
+                       <li>
+                               <span class="glyphicon glyphicon-earphone text-success"></span>
+                               <a href="/call/992">992<span class="text-muted">@ipfire.org</span></a>
+                               - {{ _("A music playing service") }}
+                       </li>
+               </ul>
        </section>
 
        {% if current_user.is_admin() %}
index 782a77a933109c6ee0f5153fe752bc2afbf95b16..d404bbabbf65dbd59a39d61e3ab03b018ddb347f 100644 (file)
@@ -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
index d4e43f98f5d1c6579df52b278f2eb45f5bc22ea7..a029c37168b721c0dd5dd8d2a96deeb18481a33b 100644 (file)
@@ -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