Browse Source

Update function calls to pylinphone interface

pylinphone
klonfish 4 years ago
parent
commit
52cff1474e
  1. 25
      phoneinterface.py

25
phoneinterface.py

@ -119,23 +119,32 @@ class PhoneInterface(object):
self.__event_cbs.append(cb) self.__event_cbs.append(cb)
def call(self, number): 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 # Try to resolve prefix
for p in self.__config.proxies: for p in self.__config.proxies:
if number.startswith(p.prefix): if number.startswith(p.prefix):
number = number[len(p.prefix):] number = number[len(p.prefix):]
number += '@' + p.realm proxy = p
break break
self.__core.invite(number) if proxy is not None:
number += '@' + proxy.realm
self.__core.call(number)
def accept_call(self): def accept_call(self):
self.__core.accept_call(self.__core.current_call) self.__core.answer()
def decline_call(self): 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): def end_call(self):
self.__core.terminate_call(self.__core.current_call) self.__core.terminate()
def play_dial_tone(self): def play_dial_tone(self):
self.stop_playing() self.stop_playing()
@ -169,7 +178,9 @@ class PhoneInterface(object):
self.__ttsproc.stdin.flush() self.__ttsproc.stdin.flush()
def get_remote_number(self): 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__': if __name__ == '__main__':
def event_cb(evt): def event_cb(evt):

Loading…
Cancel
Save