Documentation
¶
Overview ¶
Package dtmf aggregates the DTMF keypresses a caller makes into a string a language model can read. Aggregator collects the keys and flushes them on a terminator key or an idle timeout.
Generating the tones for a key is a separate concern and lives in audio/dtmf, which is what an output transport sounds when it has to carry a keypress as audio.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
Aggregator collects the DTMF keys received from the transport into a string and emits it downstream as a TranscriptionFrame — so an LLM can react to the entered sequence — when the terminator key is pressed or the idle timeout elapses. It forwards the InputDTMFFrames it sees unchanged.
func NewAggregator ¶
func NewAggregator(cfg AggregatorConfig) *Aggregator
NewAggregator builds a DTMF Aggregator.
func (*Aggregator) Cleanup ¶
func (a *Aggregator) Cleanup(ctx context.Context) error
Cleanup stops the idle timer and tears down the processor.
func (*Aggregator) ProcessFrame ¶
func (a *Aggregator) ProcessFrame(ctx context.Context, f frames.Frame, dir processor.Direction) error
ProcessFrame aggregates DTMF keypresses and forwards every frame.
type AggregatorConfig ¶
type AggregatorConfig struct {
// Terminator is the key that flushes the collected digits; empty uses '#'.
Terminator frames.KeypadEntry
// Timeout flushes the collected digits after this idle period even without a
// terminator; 0 disables the timeout (flush on the terminator only).
Timeout time.Duration
// Prefix is prepended to the emitted transcription, e.g. "User pressed: ".
Prefix string
}
AggregatorConfig configures a DTMF Aggregator.