afterhours-shift-manager/src/shared/python/shared/ring_scheduler.py
Adam Moussa 954ac018ce Switch from RingGroup API to Queue API at extension 801
The 3CX routing was changed from ring group 800 to queue 801 in a
previous PR on ring-scheduler-3cx. Updates all callers and the SAM
template parameter default accordingly.
2026-05-12 16:23:24 -04:00

33 lines
907 B
Python

"""Core queue routing logic shared between the scheduled Lambda and the Slack bot."""
import logging
from shared.three_cx_client import ThreeCXClient
logger = logging.getLogger(__name__)
def update_queue_routing(
extension: str,
queue_number: str,
domain: str,
client_id: str,
client_secret: str,
) -> dict:
"""Update 3CX queue forwarding to route calls to the given extension."""
client = ThreeCXClient(
domain=domain,
auth_mode="oauth",
client_id=client_id,
client_secret=client_secret,
)
queue = client.get_queue(queue_number)
client.update_queue_forwarding(
queue_id=queue["Id"],
closed_destination=extension,
holiday_destination=extension,
)
logger.info(
"Updated queue %s to forward to Ext %s", queue_number, extension
)
return {"extension": extension, "queue": queue_number}