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:
Abhishek 2026-07-20 21:57:34 +05:30 committed by GitHub
parent 2f7b47a1b4
commit d8cd34e8d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 2886 additions and 102 deletions

View file

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: dograh-openapi-XXXXXX.json.di0tn7Gw6b
# timestamp: 2026-07-15T13:20:43+00:00
# filename: dograh-openapi-XXXXXX.json.XxKaWUL4jA
# timestamp: 2026-07-20T15:51:54+00:00
from __future__ import annotations
@ -39,6 +39,26 @@ class CallDispositionCodes(BaseModel):
)
class FallbackDestination(RootModel[str]):
root: Annotated[str, Field(max_length=255, title='Fallback Destination')]
"""
Optional provider-native fallback destination.
"""
class ContextDestinationRoute(BaseModel):
"""
Map one gathered-context value to an external-PBX destination.
"""
context_value: Annotated[
str, Field(max_length=255, min_length=1, title='Context Value')
]
destination: Annotated[
str, Field(max_length=255, min_length=1, title='Destination')
]
class Category(Enum):
"""
Tool category. Must match definition.type.
@ -199,6 +219,19 @@ class EndCallToolDefinition(BaseModel):
"""
class ExternalPBXFieldMapping(BaseModel):
"""
Map one gathered-context value to a provider-native field.
"""
context_path: Annotated[
str, Field(max_length=255, min_length=1, title='Context Path')
]
destination_field: Annotated[
str, Field(pattern='^[A-Za-z][A-Za-z0-9_]{0,63}$', title='Destination Field')
]
class GraphConstraints(BaseModel):
"""
Per-node-type graph rules. WorkflowGraph enforces these at validation.
@ -536,11 +569,12 @@ class ToolResponse(BaseModel):
class DestinationSource(Enum):
"""
Whether transfer destination is static/template or resolved by HTTP.
Whether the destination is static/template, resolved by HTTP, or mapped from gathered context to an external-PBX destination.
"""
static = 'static'
dynamic = 'dynamic'
context_mapping = 'context_mapping'
class MessageType1(Enum):
@ -600,6 +634,10 @@ class WorkflowConfigurationDefaults(BaseModel):
context_compaction_enabled: Annotated[
bool | None, Field(title='Context Compaction Enabled')
] = False
external_pbx_field_mappings: Annotated[
list[ExternalPBXFieldMapping] | None,
Field(max_length=100, title='External Pbx Field Mappings'),
] = None
class WorkflowListResponse(BaseModel):
@ -636,6 +674,29 @@ class WorkflowResponse(BaseModel):
workflow_uuid: Annotated[str | None, Field(title='Workflow Uuid')] = None
class ContextDestinationMappingConfig(BaseModel):
"""
Resolve an external-PBX destination from gathered context.
"""
context_path: Annotated[
str, Field(max_length=255, min_length=1, title='Context Path')
]
"""
Gathered-context path or extracted-variable name used for routing.
"""
routes: Annotated[
list[ContextDestinationRoute],
Field(max_length=100, min_length=1, title='Routes'),
]
fallback_destination: Annotated[
FallbackDestination | None, Field(title='Fallback Destination')
] = None
"""
Optional provider-native fallback destination.
"""
class DocumentListResponseSchema(BaseModel):
"""
Response schema for list of documents.
@ -827,7 +888,7 @@ class TransferCallConfig(BaseModel):
DestinationSource | None, Field(title='Destination Source')
] = 'static'
"""
Whether transfer destination is static/template or resolved by HTTP.
Whether the destination is static/template, resolved by HTTP, or mapped from gathered context to an external-PBX destination.
"""
destination: Annotated[str | None, Field(title='Destination')] = ''
"""
@ -857,6 +918,10 @@ class TransferCallConfig(BaseModel):
"""
Optional resolver that determines transfer routing at call time.
"""
context_mapping: ContextDestinationMappingConfig | None = None
"""
Optional gathered-context to external-PBX destination mapping.
"""
class TransferCallToolDefinition(BaseModel):