Browse Source

Update function calls to pylinphone interface

pylinphone
klonfish 3 years ago
parent
commit
52cff1474e
  1. 31
      phoneinterface.py

31
phoneinterface.py

@ -119,23 +119,32 @@ class PhoneInterface(object): @@ -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): @@ -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):

Loading…
Cancel
Save