mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-25 12:01:04 +02:00
feat: add vici dial controls from UI (#563)
* 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>
This commit is contained in:
parent
2f7b47a1b4
commit
d8cd34e8d2
51 changed files with 2886 additions and 102 deletions
|
|
@ -223,12 +223,70 @@ class HttpTransferResolverConfig(BaseModel):
|
|||
return v
|
||||
|
||||
|
||||
class ContextDestinationRoute(BaseModel):
|
||||
"""Map one gathered-context value to an external-PBX destination."""
|
||||
|
||||
context_value: str = Field(min_length=1, max_length=255)
|
||||
destination: str = Field(min_length=1, max_length=255)
|
||||
|
||||
@field_validator("context_value", "destination")
|
||||
@classmethod
|
||||
def strip_non_empty(cls, value: str) -> str:
|
||||
stripped = value.strip()
|
||||
if not stripped:
|
||||
raise ValueError("mapping values cannot be blank")
|
||||
return stripped
|
||||
|
||||
|
||||
class ContextDestinationMappingConfig(BaseModel):
|
||||
"""Resolve an external-PBX destination from gathered context."""
|
||||
|
||||
context_path: str = Field(
|
||||
min_length=1,
|
||||
max_length=255,
|
||||
description=(
|
||||
"Gathered-context path or extracted-variable name used for routing."
|
||||
),
|
||||
)
|
||||
routes: List[ContextDestinationRoute] = Field(min_length=1, max_length=100)
|
||||
fallback_destination: Optional[str] = Field(
|
||||
default=None,
|
||||
max_length=255,
|
||||
description="Optional provider-native fallback destination.",
|
||||
)
|
||||
|
||||
@field_validator("context_path")
|
||||
@classmethod
|
||||
def strip_context_path(cls, value: str) -> str:
|
||||
stripped = value.strip()
|
||||
if not stripped:
|
||||
raise ValueError("context path cannot be blank")
|
||||
return stripped
|
||||
|
||||
@field_validator("fallback_destination")
|
||||
@classmethod
|
||||
def normalize_fallback(cls, value: Optional[str]) -> Optional[str]:
|
||||
if value is None:
|
||||
return None
|
||||
return value.strip() or None
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_unique_values(self):
|
||||
values = [route.context_value.casefold() for route in self.routes]
|
||||
if len(values) != len(set(values)):
|
||||
raise ValueError("context mapping values must be unique")
|
||||
return self
|
||||
|
||||
|
||||
class TransferCallConfig(BaseModel):
|
||||
"""Configuration for Transfer Call tools."""
|
||||
|
||||
destination_source: Literal["static", "dynamic"] = Field(
|
||||
destination_source: Literal["static", "dynamic", "context_mapping"] = Field(
|
||||
default="static",
|
||||
description="Whether transfer destination is static/template or resolved by HTTP.",
|
||||
description=(
|
||||
"Whether the destination is static/template, resolved by HTTP, or "
|
||||
"mapped from gathered context to an external-PBX destination."
|
||||
),
|
||||
)
|
||||
destination: str = Field(
|
||||
default="",
|
||||
|
|
@ -263,6 +321,10 @@ class TransferCallConfig(BaseModel):
|
|||
default=None,
|
||||
description="Optional resolver that determines transfer routing at call time.",
|
||||
)
|
||||
context_mapping: Optional[ContextDestinationMappingConfig] = Field(
|
||||
default=None,
|
||||
description="Optional gathered-context to external-PBX destination mapping.",
|
||||
)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_destination_source_config(self):
|
||||
|
|
@ -270,6 +332,14 @@ class TransferCallConfig(BaseModel):
|
|||
raise ValueError(
|
||||
"config.resolver is required when destination_source is dynamic"
|
||||
)
|
||||
if (
|
||||
self.destination_source == "context_mapping"
|
||||
and self.context_mapping is None
|
||||
):
|
||||
raise ValueError(
|
||||
"config.context_mapping is required when destination_source is "
|
||||
"context_mapping"
|
||||
)
|
||||
return self
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue