Add error handling to ring scheduler 3CX call

This commit is contained in:
Adam Moussa 2026-05-12 16:34:06 -04:00
parent dbaf99df49
commit eb8f397b9e

View file

@ -55,13 +55,18 @@ def handler(event, context):
extension = ext if source != "available" else FALLBACK_EXTENSION
secret_prefix = os.environ["TCX_SECRET_PREFIX"]
result = update_queue_routing(
extension=extension,
queue_number=os.environ["QUEUE_NUMBER"],
domain=get_secret(f"{secret_prefix}domain"),
client_id=get_secret(f"{secret_prefix}client-id"),
client_secret=get_secret(f"{secret_prefix}client-secret"),
)
try:
result = update_queue_routing(
extension=extension,
queue_number=os.environ["QUEUE_NUMBER"],
domain=get_secret(f"{secret_prefix}domain"),
client_id=get_secret(f"{secret_prefix}client-id"),
client_secret=get_secret(f"{secret_prefix}client-secret"),
)
except Exception:
logger.exception("Failed to update 3CX queue routing")
return {"error": True, "date": now.strftime("%Y-%m-%d"), "day": day_name}
result.update(
{
"date": now.strftime("%Y-%m-%d"),