voicertc

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0 Imports: 67 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package voicertc implements WebRTC voice sessions through the voice gateway protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bridge

type Bridge struct {
	// contains filtered or unexported fields
}

Bridge manages voice choices and sessions on one shared WebRTC transport.

func NewBridge

func NewBridge(ctx context.Context, cfg *voicegateway.ResolvedConfig, webrtc voicegateway.WebRTCConfig, activityLogDir string) (*Bridge, error)

NewBridge creates a Bridge that multiplexes WebRTC traffic through a single UDP port and, unless webrtc.DisableUPnP, eagerly verifies its UPnP publication.

Credentials use each provider's native environment variables or, for OpenAI Codex authentication, the file-backed Codex login. Configured choices share the UDP listener on webrtc.UDPPort and advertise webrtc.STUNServers to clients; the caller validates webrtc with its configuration.

Choice discovery and transport setup happen during construction. Managed local model runtimes load on first use through the shared capacity and idle-eviction pool. A construction failure closes all backends already initialized.

func (*Bridge) Close

func (b *Bridge) Close(sessionID string)

Close tears down a session by ID. No-op if not found. It waits at most five seconds; cleanup and the close callback may continue after it returns.

func (*Bridge) CloseAll

func (b *Bridge) CloseAll(ctx context.Context)

CloseAll tears down all sessions and the UDP mux. Called on server shutdown.

func (*Bridge) DiagnoseVoiceRTC

func (b *Bridge) DiagnoseVoiceRTC(_ context.Context, sessionID string, client *voicev2.VoiceRTCClientDiagnostics) voicev2.VoiceRTCDiagnosticsResp

DiagnoseVoiceRTC returns structured connectivity diagnostics for a session.

func (*Bridge) HandleChoiceOffer

func (b *Bridge) HandleChoiceOffer(ctx context.Context, sdpOffer, choiceID string) (sdpAnswer, sessionID string, err error)

HandleChoiceOffer opens a session bound to the selected backend.

func (*Bridge) HandleOffer

func (b *Bridge) HandleOffer(ctx context.Context, sdpOffer string) (sdpAnswer, sessionID string, err error)

HandleOffer processes a WebRTC SDP offer and returns the SDP answer.

func (*Bridge) HasSession

func (b *Bridge) HasSession(sessionID string) bool

HasSession reports whether the bridge still owns the session ID.

func (*Bridge) ServeTextChoice

func (b *Bridge) ServeTextChoice(ctx context.Context, w http.ResponseWriter, r *http.Request, choiceID string) error

ServeTextChoice runs a text session bound to the selected backend.

func (*Bridge) ServeTextSession

func (b *Bridge) ServeTextSession(ctx context.Context, w http.ResponseWriter, r *http.Request) error

ServeTextSession upgrades the HTTP request to a client-speech text session that shares the bridge's language model. When the configured backend has no language model, it writes a 503 response and returns the error.

func (*Bridge) SetOnSessionClosed

func (b *Bridge) SetOnSessionClosed(callback func(string))

SetOnSessionClosed registers a callback for every session removed from this bridge. The callback runs outside the session lock after resources close.

func (*Bridge) VoiceChoices

func (b *Bridge) VoiceChoices() voicev2.VoiceChoicesResp

VoiceChoices returns the choices available on this bridge.

func (*Bridge) VoiceRTCError

func (b *Bridge) VoiceRTCError(sessionID string) string

VoiceRTCError returns the latest gateway error retained for v1 diagnostics.

Directories

Path Synopsis
Package data defines persisted voice activity records independently of the session protocol.
Package data defines persisted voice activity records independently of the session protocol.

Jump to

Keyboard shortcuts

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