Extend history functions for phoneinterface

This commit is contained in:
sqozz 2022-07-13 09:21:07 +02:00
parent 858ba7bc2c
commit 2f461c7b35
1 changed files with 7 additions and 2 deletions

View File

@ -94,18 +94,21 @@ class PhoneInterface(object):
def on_LinphoneCallIncomingReceived(self, event):
self.run_callbacks(PhoneEvent.CallIncoming)
self.current_call_id = event.call_id
self.__history.log_call(self.get_remote_number(), True)
self.current_history_id = self.__history.log_call(self.get_remote_number(), True)
def on_LinphoneCallOutgoingRinging(self, event):
self.run_callbacks(PhoneEvent.CallRinging)
self.__history.log_call(self.get_remote_number(), False)
self.current_history_id = self.__history.log_call(self.get_remote_number(), False)
def on_LinphoneCallConnected(self, event):
self.call_connected_time = time.time()
self.run_callbacks(PhoneEvent.CallAccepted)
def on_LinphoneCallEnd(self, event):
self.__history.set_call_duration(self.current_history_id, int(time.time() - self.call_connected_time))
self.run_callbacks(PhoneEvent.CallEnded)
self.current_call_id = None
self.current_history_id = None
def __pollthread(self):
while self.__running:
@ -146,9 +149,11 @@ class PhoneInterface(object):
self.__core.call(number)
def accept_call(self):
self.__history.accept_call(self.current_history_id)
self.__core.answer(self.current_call_id)
def decline_call(self):
self.__history.decline_call(self.current_history_id)
self.__core.decline_call(self.__core.current_call)
def end_call(self):