From: Michael Tremer Date: Wed, 15 Mar 2017 18:46:19 +0000 (+0000) Subject: talk: Fix caller ID when initiating call from webapp X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=731637a8804920019315ec7b57fef671cfac81ab;p=ipfire.org.git talk: Fix caller ID when initiating call from webapp Signed-off-by: Michael Tremer --- diff --git a/webapp/backend/asterisk.py b/webapp/backend/asterisk.py index 8f382579..34479e5c 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, callee_id=None, timeout=30000): + def call(self, caller, callee, caller_id=None, timeout=30000): res = self._send_action("Originate", { "Channel" : "SIP/%s@kamailio" % caller, "Exten" : callee, "Context" : "from-cli", "Priority" : 1, "Timeout" : timeout, - "CallerID" : callee_id or callee, + "CallerID" : caller_id or caller, }) return res diff --git a/webapp/backend/talk.py b/webapp/backend/talk.py index a029c371..79520715 100644 --- a/webapp/backend/talk.py +++ b/webapp/backend/talk.py @@ -181,10 +181,11 @@ class Talk(Object): return self._process_cdr(res, replace_sip_uris=True) - def initiate_call(self, caller, callee, callee_id=None): + def initiate_call(self, caller, callee): a = self.connect_to_asterisk() - return a.call(caller, callee, callee_id=callee_id) + return a.call(caller.sip_id, callee, + caller_id="%s <%s>" % (caller.name, caller.sip_id)) # Favourites diff --git a/webapp/handlers_talk.py b/webapp/handlers_talk.py index efb0307e..f990aa88 100644 --- a/webapp/handlers_talk.py +++ b/webapp/handlers_talk.py @@ -73,7 +73,7 @@ class TalkInitiateCallHandler(BaseHandler): called = self.accounts.get_by_sip_id(called_id) - self.talk.initiate_call(self.current_user.sip_id, called_id) + self.talk.initiate_call(self.current_user, called_id) next = self.get_argument("next", None) if next is None: