From 1276f64c40b54732aa3c3218565de6a366aabd1d Mon Sep 17 00:00:00 2001 From: Joan Cano Date: Sun, 6 Aug 2023 08:24:44 +0000 Subject: [PATCH] Audio condition updated to yes/no --- telemovris/telemovris.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/telemovris/telemovris.py b/telemovris/telemovris.py index 8f7f335..6127537 100644 --- a/telemovris/telemovris.py +++ b/telemovris/telemovris.py @@ -66,8 +66,11 @@ async def main(user, message_text, audio): logging.info(f"Calling {user}") call = await voip_service.start_call(user) await client.send_message(user, message_text) - if audio: - call.play(f"/data/audio/{audio_name}.raw") + try: + if audio == 'yes': + call.play(f"/data/audio/{audio_name}.raw") + except Exception as e: + logging.error(f"Error: {e}") call_has_ended = False @call.on_call_state_changed @@ -106,4 +109,4 @@ while True: loop.run_until_complete(main(f"@{user}", message, audio)) logging.info("Call finished") except Exception as e: - logging.info(f"Error: {e}") \ No newline at end of file + logging.info(f"Error: {e}")