Add first history function to phoneinterface

This commit is contained in:
sqozz 2022-07-13 08:50:37 +02:00
parent ca370e60d3
commit 463f2f3a8b
1 changed files with 4 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import time
import threading
import subprocess
from pylinphone.pylinphone import LinphoneCommunicationSocket
from history import History
class PhoneProxyConfiguration(object):
@ -51,6 +52,7 @@ class PhoneInterface(object):
self.__config = config
self.__core = LinphoneCommunicationSocket("/var/tmp/debian-sid/tmp/linphone")
self.__history = History()
self.__core.onLinphoneCallIncomingReceived = self.on_LinphoneCallIncomingReceived
self.__core.onLinphoneCallOutgoingRinging = self.on_LinphoneCallOutgoingRinging
@ -92,9 +94,11 @@ 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)
def on_LinphoneCallOutgoingRinging(self, event):
self.run_callbacks(PhoneEvent.CallRinging)
self.__history.log_call(self.get_remote_number(), False)
def on_LinphoneCallConnected(self, event):
self.run_callbacks(PhoneEvent.CallAccepted)