From 52cff1474ea6e6865debf1420a847416ee6ca263 Mon Sep 17 00:00:00 2001 From: klonfish Date: Mon, 28 Dec 2020 20:02:39 +0000 Subject: [PATCH] Update function calls to pylinphone interface --- phoneinterface.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/phoneinterface.py b/phoneinterface.py index bf80fa8..ec0204c 100644 --- a/phoneinterface.py +++ b/phoneinterface.py @@ -119,23 +119,32 @@ class PhoneInterface(object): self.__event_cbs.append(cb) def call(self, number): - if '@' not in number and self.__core.default_proxy_config is None: - # Try to resolve prefix + if '@' not in number: + proxy = None + default_name = self.__config.default_proxy for p in self.__config.proxies: - if number.startswith(p.prefix): - number = number[len(p.prefix):] - number += '@' + p.realm + if p.name == default_name: + proxy = p break - self.__core.invite(number) + if proxy is None: + # Try to resolve prefix + for p in self.__config.proxies: + if number.startswith(p.prefix): + number = number[len(p.prefix):] + proxy = p + break + if proxy is not None: + number += '@' + proxy.realm + self.__core.call(number) def accept_call(self): - self.__core.accept_call(self.__core.current_call) + self.__core.answer() def decline_call(self): - self.__core.decline_call(self.__core.current_call, linphone.Reason.Busy) + self.__core.decline_call(self.__core.current_call) def end_call(self): - self.__core.terminate_call(self.__core.current_call) + self.__core.terminate() def play_dial_tone(self): self.stop_playing() @@ -169,7 +178,9 @@ class PhoneInterface(object): self.__ttsproc.stdin.flush() def get_remote_number(self): - return self.__core.current_call_remote_address.username + # FIXME + #return self.__core.current_call_remote_address.username + return '0000' if __name__ == '__main__': def event_cb(evt):