chore: push remaining local changes

This commit is contained in:
Yera All
2026-04-16 02:31:57 +05:00
parent 5af47991dc
commit 1206ff91ac
2 changed files with 67 additions and 1 deletions
+17 -1
View File
@@ -213,6 +213,16 @@ def ai_voice_queue_config() -> dict[str, dict[str, Any]]:
return result
def _legacy_voice_start_profile(queue_code: str, *, stage: str | None, agent_profile: str) -> tuple[str | None, str]:
if stage or agent_profile != "voice_support":
return stage, agent_profile
# Backward compatibility for deployed IVR AI queues that predate the
# explicit voice_start stage/profile fields.
if queue_code.startswith("ivr_") and "_ai_" in queue_code:
return "voice_start", "voice_start"
return stage, agent_profile
def ai_voice_config_for_queue(queue_code: str | None) -> dict[str, Any] | None:
key = str(queue_code or "").strip()
if not key or not ai_voice_enabled():
@@ -223,6 +233,12 @@ def ai_voice_config_for_queue(queue_code: str | None) -> dict[str, Any] | None:
if str(item.get("mode") or "ai_first").strip().lower() != "ai_first":
return None
stage = str(item.get("stage") or "").strip() or None
agent_profile = str(item.get("agent_profile") or "voice_support").strip() or "voice_support"
stage, agent_profile = _legacy_voice_start_profile(
key,
stage=stage,
agent_profile=agent_profile,
)
next_queue_code = str(item.get("next_queue_code") or "").strip() or None
next_queue_id = str(item.get("next_queue_id") or "").strip() or None
handoff_queue_code = str(item.get("handoff_queue_code") or next_queue_code or key).strip() or key
@@ -234,7 +250,7 @@ def ai_voice_config_for_queue(queue_code: str | None) -> dict[str, Any] | None:
return {
"queue_code": key,
"mode": "ai_first",
"agent_profile": str(item.get("agent_profile") or "voice_support").strip() or "voice_support",
"agent_profile": agent_profile,
"language": str(item.get("language") or "").strip() or None,
"stage": stage,
"next_queue_code": next_queue_code,