mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-22 11:51:04 +02:00
* ViciDial Working * feat(telephony): add FreeSWITCH provider to upstream-PBX seam Generalize the upstream-PBX capture and control paths to dispatch by provider. FreeSWITCH bridges in with X-PBX-* headers and is driven over the Event Socket Library (uuid_kill / uuid_transfer) by the channel UUID, alongside the existing VICIdial ra_call_control path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * add vici specific configs * feat(telephony): env-based VICIdial config + address3 post-call routing Move VICIdial agent/non-agent API and FreeSWITCH ESL connection settings out of hardcoded POC values into environment variables so the same image works against a PBX on another server. Add VICIdial update_lead forwarding: X-VICI-UPDATE-LEAD_* extracted variables are mapped to lead columns and pushed via the non-agent API before a transfer, with reserved API-control params dropped. Add hardcoded address3 disposition routing (Y/N -> in-group transfer, else hang up) and a synchronous final variable extraction so the transfer path sees the freshest conversation state. Skip upstream_pbx capture on non-PJSIP channels to avoid Asterisk 500s. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: run formatter * feat: make vici configurable from UI * chore: clean up PR * fix: incorporate review comments * chore: incorporate review comments * chore: generate client * chore: incporporate review comments * chore: incorporate review comments --------- Co-authored-by: Dograh POC <payment@dograh.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""Registry for drop-in external-PBX adapters."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Callable
|
|
from typing import Any
|
|
|
|
from .base import ExternalPBXAdapter
|
|
|
|
AdapterFactory = Callable[[dict[str, Any]], ExternalPBXAdapter]
|
|
_FACTORIES: dict[str, AdapterFactory] = {}
|
|
|
|
|
|
def register_adapter(pbx_type: str, factory: AdapterFactory) -> None:
|
|
normalized = pbx_type.strip().lower()
|
|
if not normalized:
|
|
raise ValueError("External PBX type cannot be empty")
|
|
if normalized in _FACTORIES:
|
|
raise ValueError(f"External PBX adapter already registered: {normalized}")
|
|
_FACTORIES[normalized] = factory
|
|
|
|
|
|
def create_adapter(config: dict[str, Any] | None) -> ExternalPBXAdapter | None:
|
|
if not config:
|
|
return None
|
|
pbx_type = str(config.get("type", "")).strip().lower()
|
|
factory = _FACTORIES.get(pbx_type)
|
|
if factory is None:
|
|
raise ValueError(f"Unsupported external PBX type: {pbx_type or '<empty>'}")
|
|
return factory(config)
|
|
|
|
|
|
def registered_adapter_types() -> tuple[str, ...]:
|
|
return tuple(sorted(_FACTORIES))
|