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
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -312,6 +312,34 @@ export interface components {
|
|||
*/
|
||||
disposition_codes: string[];
|
||||
};
|
||||
/**
|
||||
* ContextDestinationMappingConfig
|
||||
* @description Resolve an external-PBX destination from gathered context.
|
||||
*/
|
||||
ContextDestinationMappingConfig: {
|
||||
/**
|
||||
* Context Path
|
||||
* @description Gathered-context path or extracted-variable name used for routing.
|
||||
*/
|
||||
context_path: string;
|
||||
/** Routes */
|
||||
routes: components["schemas"]["ContextDestinationRoute"][];
|
||||
/**
|
||||
* Fallback Destination
|
||||
* @description Optional provider-native fallback destination.
|
||||
*/
|
||||
fallback_destination?: string | null;
|
||||
};
|
||||
/**
|
||||
* ContextDestinationRoute
|
||||
* @description Map one gathered-context value to an external-PBX destination.
|
||||
*/
|
||||
ContextDestinationRoute: {
|
||||
/** Context Value */
|
||||
context_value: string;
|
||||
/** Destination */
|
||||
destination: string;
|
||||
};
|
||||
/**
|
||||
* CreateToolRequest
|
||||
* @description Request schema for creating a reusable tool.
|
||||
|
|
@ -538,6 +566,16 @@ export interface components {
|
|||
/** @description End Call configuration. */
|
||||
config: components["schemas"]["EndCallConfig"];
|
||||
};
|
||||
/**
|
||||
* ExternalPBXFieldMapping
|
||||
* @description Map one gathered-context value to a provider-native field.
|
||||
*/
|
||||
ExternalPBXFieldMapping: {
|
||||
/** Context Path */
|
||||
context_path: string;
|
||||
/** Destination Field */
|
||||
destination_field: string;
|
||||
};
|
||||
/**
|
||||
* GraphConstraints
|
||||
* @description Per-node-type graph rules. WorkflowGraph enforces these at validation.
|
||||
|
|
@ -1092,11 +1130,11 @@ export interface components {
|
|||
TransferCallConfig: {
|
||||
/**
|
||||
* Destination Source
|
||||
* @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.
|
||||
* @default static
|
||||
* @enum {string}
|
||||
*/
|
||||
destination_source: "static" | "dynamic";
|
||||
destination_source: "static" | "dynamic" | "context_mapping";
|
||||
/**
|
||||
* Destination
|
||||
* @description Phone number, SIP endpoint, or template to transfer the call to, e.g. +1234567890, PJSIP/1234, or {{initial_context.transfer_destination}}.
|
||||
|
|
@ -1133,6 +1171,8 @@ export interface components {
|
|||
parameters?: components["schemas"]["ToolParameter"][] | null;
|
||||
/** @description Optional resolver that determines transfer routing at call time. */
|
||||
resolver?: components["schemas"]["HttpTransferResolverConfig"] | null;
|
||||
/** @description Optional gathered-context to external-PBX destination mapping. */
|
||||
context_mapping?: components["schemas"]["ContextDestinationMappingConfig"] | null;
|
||||
};
|
||||
/**
|
||||
* TransferCallToolDefinition
|
||||
|
|
@ -1230,6 +1270,8 @@ export interface components {
|
|||
* @default false
|
||||
*/
|
||||
context_compaction_enabled: boolean;
|
||||
/** External Pbx Field Mappings */
|
||||
external_pbx_field_mappings?: components["schemas"]["ExternalPBXFieldMapping"][];
|
||||
} & {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
|
@ -1303,6 +1345,8 @@ export interface components {
|
|||
export type AmbientNoiseConfigurationDefaults = components['schemas']['AmbientNoiseConfigurationDefaults'];
|
||||
export type CalculatorToolDefinition = components['schemas']['CalculatorToolDefinition'];
|
||||
export type CallDispositionCodes = components['schemas']['CallDispositionCodes'];
|
||||
export type ContextDestinationMappingConfig = components['schemas']['ContextDestinationMappingConfig'];
|
||||
export type ContextDestinationRoute = components['schemas']['ContextDestinationRoute'];
|
||||
export type CreateToolRequest = components['schemas']['CreateToolRequest'];
|
||||
export type CreateWorkflowRequest = components['schemas']['CreateWorkflowRequest'];
|
||||
export type CreatedByResponse = components['schemas']['CreatedByResponse'];
|
||||
|
|
@ -1312,6 +1356,7 @@ export type DocumentListResponseSchema = components['schemas']['DocumentListResp
|
|||
export type DocumentResponseSchema = components['schemas']['DocumentResponseSchema'];
|
||||
export type EndCallConfig = components['schemas']['EndCallConfig'];
|
||||
export type EndCallToolDefinition = components['schemas']['EndCallToolDefinition'];
|
||||
export type ExternalPbxFieldMapping = components['schemas']['ExternalPBXFieldMapping'];
|
||||
export type GraphConstraints = components['schemas']['GraphConstraints'];
|
||||
export type HttpValidationError = components['schemas']['HTTPValidationError'];
|
||||
export type HttpApiConfig = components['schemas']['HttpApiConfig'];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue