pub enum Node {
Greeting {
exits: Option<Exits>,
prompt: Prompt,
},
Hours {
exceptions: Vec<HoursException>,
exits: Option<Exits>,
schedule: WeeklySchedule,
timezone: String,
},
Menu {
exits: Option<Exits>,
options: HashMap<String, String>,
prompt: Prompt,
retries: u64,
timeout_secs: u64,
},
Ring {
exits: Option<Exits>,
timeout_secs: u64,
},
Message {
exits: Option<Exits>,
max_secs: u64,
prompt: Prompt,
tone: MessageTone,
},
Transfer {
exits: Option<Exits>,
target: String,
},
Hangup {
exits: Option<Exits>,
prompt: Option<Prompt>,
},
}Expand description
One node: a component (kind + its config) plus its wired exits. An internally-tagged union on kind.
JSON schema
{
"description": "One node: a component (kind + its config) plus its wired exits. An internally-tagged union on `kind`.",
"oneOf": [
{
"description": "Speak a prompt, then continue. Exit: next.",
"type": "object",
"required": [
"kind",
"prompt"
],
"properties": {
"exits": {
"$ref": "#/definitions/Exits"
},
"kind": {
"enum": [
"greeting"
]
},
"prompt": {
"$ref": "#/definitions/Prompt"
}
}
},
{
"description": "Branch on the business's weekly schedule + holiday overrides. Exits: open, closed.",
"type": "object",
"required": [
"kind",
"schedule",
"timezone"
],
"properties": {
"exceptions": {
"type": "array",
"items": {
"$ref": "#/definitions/HoursException"
}
},
"exits": {
"$ref": "#/definitions/Exits"
},
"kind": {
"enum": [
"hours"
]
},
"schedule": {
"$ref": "#/definitions/WeeklySchedule"
},
"timezone": {
"description": "IANA zone (America/New_York). Validated to resolve at load.",
"type": "string"
}
}
},
{
"description": "Speak a prompt and collect a DTMF choice. Exits: one per digit in options, plus no_input and invalid.",
"type": "object",
"required": [
"kind",
"options",
"prompt"
],
"properties": {
"exits": {
"$ref": "#/definitions/Exits"
},
"kind": {
"enum": [
"menu"
]
},
"options": {
"description": "Digit key → human label. The exit for a digit is exits[digit]. Valid digit keys are enforced by the validator.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"prompt": {
"$ref": "#/definitions/Prompt"
},
"retries": {
"default": 1,
"type": "integer",
"minimum": 0.0
},
"timeout_secs": {
"default": 5,
"type": "integer",
"minimum": 0.0
}
}
},
{
"description": "Ring the human for a window. answered is an implicit terminal; the only wired exit is no_answer.",
"type": "object",
"required": [
"kind",
"timeout_secs"
],
"properties": {
"exits": {
"$ref": "#/definitions/Exits"
},
"kind": {
"enum": [
"ring"
]
},
"timeout_secs": {
"type": "integer",
"minimum": 0.0
}
}
},
{
"description": "Voicemail: speak a prompt, record, transcribe, notify. Terminal.",
"type": "object",
"required": [
"kind",
"prompt"
],
"properties": {
"exits": {
"$ref": "#/definitions/Exits"
},
"kind": {
"enum": [
"message"
]
},
"max_secs": {
"default": 120,
"type": "integer",
"minimum": 0.0
},
"prompt": {
"$ref": "#/definitions/Prompt"
},
"tone": {
"default": "beep",
"allOf": [
{
"$ref": "#/definitions/MessageTone"
}
]
}
}
},
{
"description": "Blind-transfer to an external number. Terminal.",
"type": "object",
"required": [
"kind",
"target"
],
"properties": {
"exits": {
"$ref": "#/definitions/Exits"
},
"kind": {
"enum": [
"transfer"
]
},
"target": {
"type": "string"
}
}
},
{
"description": "Speak an optional goodbye and end the call. Terminal.",
"type": "object",
"required": [
"kind"
],
"properties": {
"exits": {
"$ref": "#/definitions/Exits"
},
"kind": {
"enum": [
"hangup"
]
},
"prompt": {
"$ref": "#/definitions/Prompt"
}
}
}
]
}Variants§
Greeting
Speak a prompt, then continue. Exit: next.
Hours
Branch on the business’s weekly schedule + holiday overrides. Exits: open, closed.
Menu
Speak a prompt and collect a DTMF choice. Exits: one per digit in options, plus no_input and invalid.
Fields
Ring
Ring the human for a window. answered is an implicit terminal; the only wired exit is no_answer.
Message
Voicemail: speak a prompt, record, transcribe, notify. Terminal.
Transfer
Blind-transfer to an external number. Terminal.
Hangup
Speak an optional goodbye and end the call. Terminal.
Implementations§
Source§impl Node
impl Node
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Whether a caller who reaches this node can have the call end here.
ring counts — its implicit answered hands the call to a human,
which ends the flow. Used by the “no caller is ever trapped” check.
Sourcepub fn required_exits(&self) -> Vec<String>
pub fn required_exits(&self) -> Vec<String>
The exit names this node must wire, given its config. Validation
checks the node’s exits keys are exactly this set — no missing exit
(a dead choice) and no stray exit (a typo the engine would never
follow).