callmanager constructor

This commit is contained in:
2024-03-12 23:30:26 +01:00
parent 2c5773426a
commit 6bd5838c24
2 changed files with 11 additions and 11 deletions

View File

@@ -10,16 +10,16 @@ OP_PING = 'PING'.encode()
OP_OK = 'OK'.encode()
OP_ERROR = 'ERROR'.encode()
config = yaml.safe_load(open("intercom.yml"))
class CallManager:
state = NO_CALL
station = None
call_process = None
def __init__(self, config):
self.config = config
self.state = NO_CALL
self.station = None
self.call_process = None
def call(self, station):
try:
self.call_process = subprocess.Popen(['parole', '-c', station['host'], '-d', config['audio device']])
self.call_process = subprocess.Popen(['parole', '-c', station['host'], '-d', self.config['audio device']])
s = socket.socket()
s.connect((station['host'], station['port']))
s.send(OP_CALL)