Add remote number reading

This commit is contained in:
sqozz 2021-02-24 23:56:23 +01:00
parent 522879216a
commit 8826ca6fb1

View file

@ -68,6 +68,8 @@ class PhoneInterface(object):
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
stdout=aplay.stdin) stdout=aplay.stdin)
self.current_call_id = None
# Set default parameters overriding the ones from the given config file # 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 # 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') #self.__core.set_user_agent('FeTAp 615', '0.1')
@ -89,6 +91,7 @@ class PhoneInterface(object):
def on_LinphoneCallIncomingReceived(self, event): def on_LinphoneCallIncomingReceived(self, event):
self.run_callbacks(PhoneEvent.CallIncoming) self.run_callbacks(PhoneEvent.CallIncoming)
self.current_call_id = event.call_id
def on_LinphoneCallOutgoingRinging(self, event): def on_LinphoneCallOutgoingRinging(self, event):
self.run_callbacks(PhoneEvent.CallRinging) self.run_callbacks(PhoneEvent.CallRinging)
@ -98,6 +101,7 @@ class PhoneInterface(object):
def on_LinphoneCallEnd(self, event): def on_LinphoneCallEnd(self, event):
self.run_callbacks(PhoneEvent.CallEnded) self.run_callbacks(PhoneEvent.CallEnded)
self.current_call_id = None
def __pollthread(self): def __pollthread(self):
while self.__running: while self.__running:
@ -178,9 +182,9 @@ class PhoneInterface(object):
self.__ttsproc.stdin.flush() self.__ttsproc.stdin.flush()
def get_remote_number(self): def get_remote_number(self):
# FIXME if self.current_call_id != None:
#return self.__core.current_call_remote_address.username status = self.__core.call_status(self.current_call_id)
return '0000' return status.get("from")
if __name__ == '__main__': if __name__ == '__main__':
def event_cb(evt): def event_cb(evt):