Update function calls to pylinphone interface

This commit is contained in:
klonfish 2020-12-28 20:02:39 +00:00
parent 7e3d5a0b9d
commit 52cff1474e

View file

@ -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:
if '@' not in number:
proxy = None
default_name = self.__config.default_proxy
for p in self.__config.proxies:
if p.name == default_name:
proxy = p
break
if proxy is None:
# Try to resolve prefix
for p in self.__config.proxies:
if number.startswith(p.prefix):
number = number[len(p.prefix):]
number += '@' + p.realm
proxy = p
break
self.__core.invite(number)
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):