Add remote number reading

This commit is contained in:
sqozz 2021-02-24 23:56:23 +01:00
parent 522879216a
commit 8826ca6fb1
1 changed files with 7 additions and 3 deletions

View File

@ -68,6 +68,8 @@ class PhoneInterface(object):
stdin=subprocess.PIPE,
stdout=aplay.stdin)
self.current_call_id = None
# Set default parameters overriding the ones from the given config file
# TODO: figure out how to set at least some of these settings through the unix socket
#self.__core.set_user_agent('FeTAp 615', '0.1')
@ -89,6 +91,7 @@ class PhoneInterface(object):
def on_LinphoneCallIncomingReceived(self, event):
self.run_callbacks(PhoneEvent.CallIncoming)
self.current_call_id = event.call_id
def on_LinphoneCallOutgoingRinging(self, event):
self.run_callbacks(PhoneEvent.CallRinging)
@ -98,6 +101,7 @@ class PhoneInterface(object):
def on_LinphoneCallEnd(self, event):
self.run_callbacks(PhoneEvent.CallEnded)
self.current_call_id = None
def __pollthread(self):
while self.__running:
@ -178,9 +182,9 @@ class PhoneInterface(object):
self.__ttsproc.stdin.flush()
def get_remote_number(self):
# FIXME
#return self.__core.current_call_remote_address.username
return '0000'
if self.current_call_id != None:
status = self.__core.call_status(self.current_call_id)
return status.get("from")
if __name__ == '__main__':
def event_cb(evt):