mirror of
https://github.com/Sea-Haven-Industries/afterhours-shift-manager.git
synced 2026-10-02 09:43:11 +00:00
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.
33 lines
907 B
Python
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}
|