ivr

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package ivr navigates automated phone menus (IVR systems). The Processor watches the LLM's streamed response for control tags: <dtmf>N</dtmf> presses keypad keys to make a menu selection, and <ivr>status</ivr> reports navigation progress. The tags are stripped from the spoken output. Drive it with an LLM prompted to emit those tags as it listens to the menu.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// OnStatusChanged is called when the LLM reports an IVR navigation status.
	OnStatusChanged func(status Status)
}

Config configures an IVR Processor.

type Processor

type Processor struct {
	*processor.Base
	// contains filtered or unexported fields
}

Processor navigates an IVR by acting on the control tags in the LLM's output: it emits an OutputDTMFFrame for each key in a <dtmf> tag and reports each <ivr> status through OnStatusChanged, forwarding the remaining text as speech.

func New

func New(cfg Config) *Processor

New builds an IVR Processor.

func (*Processor) ProcessFrame

func (p *Processor) ProcessFrame(ctx context.Context, f frames.Frame, dir processor.Direction) error

ProcessFrame strips and acts on the control tags in the LLM text stream.

type Status

type Status string

Status is the IVR navigation status the LLM reports through an <ivr> tag.

const (
	// StatusDetected means an IVR menu was detected and navigation has begun.
	StatusDetected Status = "detected"
	// StatusCompleted means navigation reached a human or the target option.
	StatusCompleted Status = "completed"
	// StatusStuck means the menu could not be navigated.
	StatusStuck Status = "stuck"
	// StatusWait means the system is waiting (e.g. on hold) before acting.
	StatusWait Status = "wait"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL