From 8826ca6fb15c36e70a53605891e17a8f838b0e7a Mon Sep 17 00:00:00 2001 From: sqozz Date: Wed, 24 Feb 2021 23:56:23 +0100 Subject: [PATCH] Add remote number reading --- phoneinterface.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/phoneinterface.py b/phoneinterface.py index ec0204c..ac1f61e 100644 --- a/phoneinterface.py +++ b/phoneinterface.py @@ -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):