voicemail

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: 6 Imported by: 0

Documentation

Overview

Package voicemail detects whether an outbound call reached a person or a voicemail system. The Processor watches the LLM's classification output for a decision tag — <voicemail></voicemail> or <human></human> — and fires the matching callback, so the app can leave a message and hang up, or start the conversation. Drive it with an LLM prompted to emit one of those tags after hearing the first utterance. The decision tags are stripped from the output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// OnVoicemailDetected is called when the classifier decides the call reached
	// voicemail. It fires after VoicemailDelay.
	OnVoicemailDetected func()
	// OnConversationDetected is called when the classifier decides a person
	// answered.
	OnConversationDetected func()
	// VoicemailDelay delays the voicemail callback — for example to let the
	// greeting finish before leaving a message; 0 fires immediately.
	VoicemailDelay time.Duration
}

Config configures a voicemail Processor.

type Processor

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

Processor classifies a call as voicemail or human from the LLM's decision tag and fires the matching callback exactly once. It strips the decision tags from the forwarded text.

func New

func New(cfg Config) *Processor

New builds a voicemail Processor.

func (*Processor) Cleanup

func (p *Processor) Cleanup(ctx context.Context) error

Cleanup stops the pending voicemail timer and tears down the processor.

func (*Processor) ProcessFrame

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

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

Jump to

Keyboard shortcuts

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