voiceblender

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 14 Imported by: 2 modules, 5 packages

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.

README

voiceblender-go

Go client library for the VoiceBlender API.

VoiceBlender bridges SIP and WebRTC voice calls with multi-party audio mixing, real-time speech-to-text, text-to-speech, AI agent integration, recording, and webhook-based event delivery.

Installation

go get github.com/VoiceBlender/voiceblender-go

Quick start

package main

import (
	"context"
	"fmt"
	"log"

	voiceblender "github.com/VoiceBlender/voiceblender-go"
)

func main() {
	c := voiceblender.New(voiceblender.WithBaseURL("http://localhost:8080/v1"))

	leg, err := c.CreateLeg(context.Background(), voiceblender.CreateLegRequest{
		Type: voiceblender.LegTypeSIPOutbound,
		URI:  "sip:alice@example.com",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("Created leg:", leg.ID)
}

Features

Legs

Manage individual voice participants (SIP inbound/outbound, WebRTC):

  • Lifecycle -- create, answer, early media, hang up
  • Audio control -- mute, hold, send DTMF
  • Playback -- play audio URLs or tones with volume control
  • Recording -- record to local storage or S3
  • Text-to-speech -- synthesize speech with configurable voice/provider
  • Speech-to-text -- real-time transcription with partial results
  • AI agents -- connect Deepgram, ElevenLabs, VAPI, or Pipecat agents
Rooms

Multi-party conference rooms with the same audio, playback, recording, speech, and agent capabilities as legs, plus participant management (add/remove legs).

WebRTC

SDP offer/answer exchange and ICE candidate management.

Events (VSI)

Real-time event streaming over WebSocket with typed Go structs for all 30 event types, automatic ping/pong handling, and a ParseEvent dispatcher.

Client options

// Custom base URL (default: http://localhost:8080/v1)
voiceblender.WithBaseURL("https://api.example.com/v1")

// Custom HTTP client
voiceblender.WithHTTPClient(myClient)

// Custom timeout (default: 30s)
voiceblender.WithTimeout(10 * time.Second)

Error handling

_, err := c.GetLeg(ctx, "leg-123")
if voiceblender.IsNotFound(err) {
	// 404
}
if voiceblender.IsBadRequest(err) {
	// 400
}
if voiceblender.IsConflict(err) {
	// 409
}

Playback

PlaybackRequest uses builder functions to ensure mutual exclusion between URL and tone playback:

// Play an audio file
c.PlayLeg(ctx, legID, voiceblender.PlayURL("https://example.com/audio.wav"))

// Play a tone
c.PlayLeg(ctx, legID, voiceblender.PlayTone("440", 5))

Real-time events (VSI WebSocket)

The VoiceBlender Streaming Interface (VSI) delivers all events over a WebSocket connection as typed Go structs. This is an alternative to HTTP webhooks and is useful for long-running processes that need to react to events in real time.

Listening for events
stream, err := c.Events(ctx)
if err != nil {
    log.Fatal(err)
}
defer stream.Close()

for {
    ev, err := stream.Next(ctx)
    if err != nil {
        log.Fatal(err)
    }

    switch e := ev.(type) {
    case *voiceblender.LegRingingEvent:
        fmt.Printf("Leg %s is ringing (from=%s)\n", e.LegID, e.From)

    case *voiceblender.LegConnectedEvent:
        fmt.Printf("Leg %s connected\n", e.LegID)

    case *voiceblender.LegDisconnectedEvent:
        fmt.Printf("Leg %s disconnected: %s (%.1fs)\n",
            e.LegID, e.Cdr.Reason, e.Cdr.DurationTotal)

    case *voiceblender.DTMFReceivedEvent:
        fmt.Printf("DTMF digit %s on leg %s\n", e.Digit, e.LegID)

    case *voiceblender.STTTextEvent:
        if e.IsFinal {
            fmt.Printf("[%s] %s\n", e.LegID, e.Text)
        }
    }
}
Filtering events by app ID

By default the VSI stream delivers every event for the instance. Tag your legs and rooms with an AppID, then pass WithAppFilter to have the server drop everything else — the events never cross the wire:

// Tag the legs your app owns. Every leg type accepts AppID, including WebRTC.
leg, _ := c.CreateLeg(ctx, voiceblender.CreateLegRequest{
    Type:  "sip",
    To:    "sip:alice@example.com",
    AppID: "my-app",
})

answer, _ := c.WebRTCOffer(ctx, voiceblender.WebRTCOfferRequest{
    SDP:   offerSDP,
    AppID: "my-app",
})

// Subscribe to just this app's events.
stream, err := c.Events(ctx, voiceblender.WithAppFilter("^my-app$"))

The filter is an RE2 regular expression matched against each event's app_id, so "^(my-app|my-other-app)$" subscribes to several apps at once. It is unanchored unless you anchor it: "my-app" also matches "my-app-staging".

An untagged leg emits events with an empty app_id, and a non-empty filter drops them — if you filter, tag every leg your app creates or it will silently miss its own events.

For finer-grained logic than a regex can express, the AppID field is also present on the events themselves, so you can still filter client-side:

switch e := ev.(type) {
case *voiceblender.LegConnectedEvent:
    if e.AppID != "my-app" {
        continue
    }
    // handle event
}
Call quality monitoring

The LegDisconnectedEvent includes CDR and RTP quality metrics:

case *voiceblender.LegDisconnectedEvent:
    fmt.Printf("Call %s ended: reason=%s total=%.1fs answered=%.1fs\n",
        e.LegID, e.Cdr.Reason, e.Cdr.DurationTotal, e.Cdr.DurationAnswered)

    if e.Quality != nil {
        fmt.Printf("  MOS=%.2f loss=%d jitter=%.1fms\n",
            e.Quality.MosScore, e.Quality.RtpPacketsLost, e.Quality.RtpJitterMs)
    }
Transfer tracking

Track the full lifecycle of a SIP REFER transfer:

case *voiceblender.LegTransferInitiatedEvent:
    fmt.Printf("Transfer started: leg=%s target=%s kind=%s\n",
        e.LegID, e.Target, e.Kind)

case *voiceblender.LegTransferProgressEvent:
    fmt.Printf("Transfer progress: leg=%s status=%d %s\n",
        e.LegID, e.StatusCode, e.Reason)

case *voiceblender.LegTransferCompletedEvent:
    fmt.Printf("Transfer completed: leg=%s\n", e.LegID)

case *voiceblender.LegTransferFailedEvent:
    fmt.Printf("Transfer failed: leg=%s reason=%s error=%s\n",
        e.LegID, e.Reason, e.Error)

Examples

See the examples/ directory for complete working examples:

  • IVR -- Interactive Voice Response system with menu navigation, department routing, hold music, TTS prompts, and Deepgram AI agent integration.

Code generation

Models, request types, response types, and event types are generated from openapi.yaml:

make generate   # regenerate from OpenAPI spec
make build      # build all packages
make vet        # run go vet and build

License

See LICENSE for details.

Documentation

Overview

Package voiceblender provides a Go client for the VoiceBlender API.

VoiceBlender bridges SIP and WebRTC voice calls with multi-party audio mixing, real-time speech-to-text, text-to-speech, AI agent integration, recording, and webhook-based event delivery.

Usage:

c := voiceblender.New(voiceblender.WithBaseURL("http://localhost:8080/v1"))
leg, err := c.CreateLeg(ctx, voiceblender.CreateLegRequest{
    Type: "sip",
    URI:  "sip:alice@example.com",
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBadRequest

func IsBadRequest(err error) bool

IsBadRequest reports whether err is a 400 API error.

func IsConflict

func IsConflict(err error) bool

IsConflict reports whether err is a 409 API error.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports whether err is a 404 API error.

func ParseEvent

func ParseEvent(data []byte) (interface{}, error)

ParseEvent unmarshals raw JSON into the appropriate typed event struct.

Types

type AMDBeepEvent

type AMDBeepEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Milliseconds from machine detection to beep tone detection.
	BeepMs int `json:"beep_ms,omitempty"`
}

AMDBeepEvent is fired when: voicemail beep tone detected after machine classification

type AMDParams

type AMDParams struct {
	// Max milliseconds of silence before declaring no_speech.
	InitialSilenceTimeout int `json:"initial_silence_timeout,omitempty"`
	// Speech duration threshold (ms) above which answerer is classified as machine.
	GreetingDuration int `json:"greeting_duration,omitempty"`
	// Silence duration (ms) after initial speech to declare human.
	AfterGreetingSilence int `json:"after_greeting_silence,omitempty"`
	// Max analysis window in milliseconds. A threshold longer than this window suppresses that verdict; a window shorter than all of initial_silence_timeout, greeting_duration and after_greeting_silence is rejected, since the call could only end not_sure.
	TotalAnalysisTime int `json:"total_analysis_time,omitempty"`
	// Minimum speech burst duration (ms) to count as a word.
	MinimumWordLength int `json:"minimum_word_length,omitempty"`
	// Max time (ms) to wait for the voicemail beep after machine detection. 0 or omitted = disabled.
	BeepTimeout int `json:"beep_timeout,omitempty"`
}

AMDParams is a AMD params.

type AMDResultEvent

type AMDResultEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Detection result: human, machine, no_speech, or not_sure.
	Result string `json:"result,omitempty"`
	// Milliseconds of silence before first speech.
	InitialSilenceMs int `json:"initial_silence_ms,omitempty"`
	// Milliseconds of speech in the greeting.
	GreetingDurationMs int `json:"greeting_duration_ms,omitempty"`
	// Total milliseconds of analysis before determination.
	TotalAnalysisMs int `json:"total_analysis_ms,omitempty"`
}

AMDResultEvent is fired when: answering machine detection completed

type APIError

type APIError struct {
	StatusCode int    `json:"-"`
	InstanceID string `json:"instance_id"`
	Message    string `json:"error"`
}

APIError is returned when the server responds with a 4xx or 5xx status code.

func (*APIError) Error

func (e *APIError) Error() string

type AcceptRegistrationPayload added in v0.10.0

type AcceptRegistrationPayload struct {
	ID         string `json:"id"`
	MaxExpires int    `json:"max_expires,omitempty"`
	AppID      string `json:"app_id,omitempty"`
}

AcceptRegistrationPayload is a accept registration payload.

type AcceptTransferPayload added in v0.11.0

type AcceptTransferPayload struct {
	ID string `json:"id"`
}

AcceptTransferPayload is a accept transfer payload.

type AddLegPayload

type AddLegPayload struct {
	RoomID     string `json:"room_id"`
	LegID      string `json:"leg_id"`
	Mute       bool   `json:"mute,omitempty"`
	Deaf       bool   `json:"deaf,omitempty"`
	AcceptDTMF bool   `json:"accept_dtmf,omitempty"`
	Role       string `json:"role,omitempty"`
}

AddLegPayload is a add leg payload.

type AddLegRequest

type AddLegRequest struct {
	// ID of the leg to add.
	LegID string `json:"leg_id"`
	// If set, apply this mute state to the leg atomically before it joins the mixer (no race where un-muted audio enters the mix). Omit to leave current state untouched (useful when moving between rooms).
	Mute *bool `json:"mute,omitempty"`
	// If set, apply this deaf state to the leg atomically before it joins the mixer. Omit to leave current state untouched.
	Deaf *bool `json:"deaf,omitempty"`
	// If set, control whether this leg receives DTMF digits broadcast from other legs in the same room. Omit to leave current state untouched (default for new legs is true).
	AcceptDTMF *bool `json:"accept_dtmf,omitempty"`
	// If set, apply this routing role to the leg atomically before it joins the mixer. The room's routing matrix (see PUT /v1/rooms/{id}/routing) decides which other legs this leg hears and is heard by based on roles. Pass "" to clear the role (full mesh). Omit to leave the current role untouched.
	Role string `json:"role,omitempty"`
	// Additional audio streams of the leg to mix into this room, each with its own routing role. Omit to add only the leg's primary stream. A stream already mixed elsewhere is moved here.
	Streams []AddRoomStream `json:"streams,omitempty"`
}

AddLegRequest is a add leg request.

type AddLegResponse

type AddLegResponse struct {
	InstanceID string `json:"instance_id,omitempty"`
	Status     string `json:"status"`
	From       string `json:"from,omitempty"`
	To         string `json:"to,omitempty"`
}

AddLegResponse is returned when a leg is added or moved to a room. The server returns either {status:"added"} or {status:"moved", from:..., to:...}.

type AddLegStreamRequest added in v0.12.1

type AddLegStreamRequest struct {
	// Media direction for the new stream, from this server's point of view. Defaults to sendrecv.
	Direction string `json:"direction,omitempty"`
	// BCP 47 language tag advertised as a=lang (RFC 8866), e.g. "es-ES" for a Spanish translation feed.
	Lang string `json:"lang,omitempty"`
	// Value advertised as a=content (RFC 4796). Use "main" for original audio and "alt" for an alternative feed such as a translation.
	Content string `json:"content,omitempty"`
	// Value advertised as a=label (RFC 4574), for correlating the stream with external metadata.
	Label string `json:"label,omitempty"`
	// If set, attach the new stream to this room once it is negotiated.
	RoomID string `json:"room_id,omitempty"`
	// Routing role to apply when room_id is set.
	Role string `json:"role,omitempty"`
}

AddLegStreamRequest is a add leg stream request.

type AddLegToRoomResult

type AddLegToRoomResult struct {
	Status string `json:"status"`
	RoomID string `json:"room_id"`
	LegID  string `json:"leg_id"`
}

AddLegToRoomResult is a add leg to room result.

type AddRoomStream added in v0.12.1

type AddRoomStream struct {
	// Stream identifier from GET /v1/legs/{id}/streams. The primary stream is not addressable here — it joins with the leg itself.
	StreamID string `json:"stream_id"`
	// Routing role for this stream inside the room.
	Role string `json:"role,omitempty"`
}

AddRoomStream is a add room stream.

type AgentAgentResponseEvent

type AgentAgentResponseEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// Agent response text.
	Text string `json:"text,omitempty"`
}

AgentAgentResponseEvent is fired when: agent generated a response

type AgentConnectedEvent

type AgentConnectedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// Provider-assigned conversation identifier.
	ConversationID string `json:"conversation_id,omitempty"`
}

AgentConnectedEvent is fired when: agent connected to provider

type AgentDeepgramPayload

type AgentDeepgramPayload struct {
	ID       string                 `json:"id"`
	Settings map[string]interface{} `json:"settings,omitempty"`
	Greeting string                 `json:"greeting,omitempty"`
	Language string                 `json:"language,omitempty"`
	APIKey   string                 `json:"api_key,omitempty"`
}

AgentDeepgramPayload is a agent deepgram payload.

type AgentDisconnectedEvent

type AgentDisconnectedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
}

AgentDisconnectedEvent is fired when: agent session ended

type AgentElevenLabsPayload

type AgentElevenLabsPayload struct {
	ID               string            `json:"id"`
	AgentID          string            `json:"agent_id"`
	FirstMessage     string            `json:"first_message,omitempty"`
	Language         string            `json:"language,omitempty"`
	DynamicVariables map[string]string `json:"dynamic_variables,omitempty"`
	APIKey           string            `json:"api_key,omitempty"`
}

AgentElevenLabsPayload is a agent eleven labs payload.

type AgentMessagePayload

type AgentMessagePayload struct {
	ID      string `json:"id"`
	Message string `json:"message"`
}

AgentMessagePayload is a agent message payload.

type AgentMessageRequest

type AgentMessageRequest struct {
	// Context or instruction to inject into the running agent session.
	Message string `json:"message"`
}

AgentMessageRequest is a agent message request.

type AgentMessageResult

type AgentMessageResult struct {
	Status string `json:"status"`
}

AgentMessageResult is a agent message result.

type AgentPipecatPayload

type AgentPipecatPayload struct {
	ID           string `json:"id"`
	WebsocketURL string `json:"websocket_url"`
}

AgentPipecatPayload is a agent pipecat payload.

type AgentStartLegResult

type AgentStartLegResult struct {
	Status string `json:"status"`
	LegID  string `json:"leg_id"`
}

AgentStartLegResult is a agent start leg result.

type AgentStartRoomResult

type AgentStartRoomResult struct {
	Status string `json:"status"`
	RoomID string `json:"room_id"`
}

AgentStartRoomResult is a agent start room result.

type AgentStopResult

type AgentStopResult struct {
	Status string `json:"status"`
}

AgentStopResult is a agent stop result.

type AgentUserTranscriptEvent

type AgentUserTranscriptEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// User speech text.
	Text string `json:"text,omitempty"`
}

AgentUserTranscriptEvent is fired when: user speech transcribed by agent

type AgentVAPIPayload

type AgentVAPIPayload struct {
	ID             string            `json:"id"`
	AssistantID    string            `json:"assistant_id"`
	FirstMessage   string            `json:"first_message,omitempty"`
	VariableValues map[string]string `json:"variable_values,omitempty"`
	APIKey         string            `json:"api_key,omitempty"`
}

AgentVAPIPayload is a agent VAPI payload.

type AnswerLegPayload

type AnswerLegPayload struct {
	ID              string            `json:"id"`
	SpeechDetection bool              `json:"speech_detection,omitempty"`
	Codec           string            `json:"codec,omitempty"`
	Streams         []AnswerLegStream `json:"streams,omitempty"`
	CustomData      interface{}       `json:"custom_data,omitempty"`
	Filters         []FilterSpec      `json:"filters,omitempty"`
}

AnswerLegPayload is a answer leg payload.

type AnswerLegRequest

type AnswerLegRequest struct {
	// If true, emit speaking.started and speaking.stopped events for this leg. If false, suppress them. Omit to use the server default (SPEECH_DETECTION_ENABLED env var, default false).
	SpeechDetection *bool `json:"speech_detection,omitempty"`
	// Ordered audio processing chain applied to audio arriving from this leg, before it reaches the room mixer and therefore before other legs, recordings and speech-to-text see it. Each entry names a built-in filter and may carry parameters. Omit the field to use the server default (AUDIO_FILTERS env var); send an empty array for no processing. Filters run in the order given, and corrective filters should precede effects. Known filters: denoise (background noise suppression), bandpass (low_hz, high_hz), gain (volume, -8 to 8 in ~3 dB steps). Noise suppression removes background noise, not competing speech.
	Filters []FilterSpec `json:"filters,omitempty"`
	// Explicit codec for the answer SDP. Must appear in the remote offer's offered_codecs list. Omit to use the server's default preference order.
	Codec string `json:"codec,omitempty"`
	// Rooms for the caller's additional audio streams, applied once the answer is negotiated. Positional: entry i addresses the i-th accepted stream beyond the primary, in m-line order — the caller's offer decides how many exist, so an entry with no matching stream is ignored. Use POST /v1/legs/{id}/streams/{streamId}/room to re-route a stream later.
	Streams []AnswerLegStream `json:"streams,omitempty"`
	// Opaque application JSON attached to the leg. Any JSON value is accepted (object, array, string, number, boolean). It is echoed on the leg view and carried at the top level of every event published for this leg, so external state can be correlated without keeping a leg_id lookup table. Capped by CUSTOM_DATA_MAX_BYTES (default 1024 bytes, 0 = unlimited). Omit to leave any existing value untouched; send null to clear it.
	CustomData interface{} `json:"custom_data,omitempty"`
}

AnswerLegRequest is a answer leg request.

type AnswerLegStream added in v0.12.1

type AnswerLegStream struct {
	// Room to mix this stream into once the answer is negotiated. May differ from the room the leg itself joins.
	RoomID string `json:"room_id,omitempty"`
	// Routing role for this stream inside its room.
	Role string `json:"role,omitempty"`
}

AnswerLegStream is a answer leg stream.

type AttachStreamRoomRequest added in v0.12.1

type AttachStreamRoomRequest struct {
	// Room to mix this stream into. May differ from the leg's own room.
	RoomID string `json:"room_id"`
	// Routing role for the stream inside that room. The room's routing matrix decides who hears it.
	Role string `json:"role,omitempty"`
}

AttachStreamRoomRequest is a attach stream room request.

type BridgeCreatePayload

type BridgeCreatePayload struct {
	RoomID     string `json:"room_id"`
	BridgeID   string `json:"bridge_id,omitempty"`
	PeerRoomID string `json:"peer_room_id"`
	Direction  string `json:"direction,omitempty"`
}

BridgeCreatePayload is a bridge create payload.

type BridgeListPayload

type BridgeListPayload struct {
	RoomID string `json:"room_id"`
}

BridgeListPayload is a bridge list payload.

type BridgeRefPayload

type BridgeRefPayload struct {
	RoomID   string `json:"room_id"`
	BridgeID string `json:"bridge_id"`
}

BridgeRefPayload is a bridge ref payload.

type BridgeUpdatePayload

type BridgeUpdatePayload struct {
	RoomID    string `json:"room_id"`
	BridgeID  string `json:"bridge_id"`
	Direction string `json:"direction"`
}

BridgeUpdatePayload is a bridge update payload.

type BridgeView

type BridgeView struct {
	// Bridge identifier.
	ID string `json:"id"`
	// The peer room joined to the room in the path.
	RoomID string `json:"room_id"`
	// Audio flow relative to the room in the path: bidirectional, send, receive, or none.
	Direction string `json:"direction"`
	// Shared mixer sample rate in Hz (both rooms must match).
	SampleRate int `json:"sample_rate"`
}

BridgeView is a bridge view.

type ChallengeLegPayload added in v0.10.0

type ChallengeLegPayload struct {
	ID         string   `json:"id"`
	Realm      string   `json:"realm"`
	Username   string   `json:"username,omitempty"`
	Password   string   `json:"password,omitempty"`
	Ha1        string   `json:"ha1,omitempty"`
	Algorithm  string   `json:"algorithm,omitempty"`
	Qop        []string `json:"qop,omitempty"`
	MaxExpires int      `json:"max_expires,omitempty"`
	AppID      string   `json:"app_id,omitempty"`
}

ChallengeLegPayload is a challenge leg payload.

type ChallengeRegistrationPayload added in v0.10.0

type ChallengeRegistrationPayload struct {
	ID         string   `json:"id"`
	Realm      string   `json:"realm"`
	Username   string   `json:"username,omitempty"`
	Password   string   `json:"password,omitempty"`
	Ha1        string   `json:"ha1,omitempty"`
	Algorithm  string   `json:"algorithm,omitempty"`
	Qop        []string `json:"qop,omitempty"`
	MaxExpires int      `json:"max_expires,omitempty"`
	AppID      string   `json:"app_id,omitempty"`
}

ChallengeRegistrationPayload is a challenge registration payload.

type ChallengeRequest added in v0.10.0

type ChallengeRequest struct {
	Realm      string   `json:"realm"`
	Username   string   `json:"username,omitempty"`
	Password   string   `json:"password,omitempty"`
	Ha1        string   `json:"ha1,omitempty"`
	Algorithm  string   `json:"algorithm,omitempty"`
	Qop        []string `json:"qop,omitempty"`
	MaxExpires int      `json:"max_expires,omitempty"`
	AppID      string   `json:"app_id,omitempty"`
}

ChallengeRequest is a challenge request.

type ChannelInfo

type ChannelInfo struct {
	Channel int `json:"channel"`
	StartMs int `json:"start_ms"`
	EndMs   int `json:"end_ms"`
}

ChannelInfo is a channel info.

type Client

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

Client is the VoiceBlender API client.

func New

func New(opts ...Option) *Client

New creates a new Client with the given options.

func (*Client) AcceptRegistration added in v0.13.0

func (c *Client) AcceptRegistration(ctx context.Context, id string, req RegistrationAcceptRequest) (*StatusResponse, error)

AcceptRegistration accept a parked inbound REGISTER attempt

func (*Client) ChallengeRegistration added in v0.13.0

func (c *Client) ChallengeRegistration(ctx context.Context, id string, req ChallengeRequest) (*StatusResponse, error)

ChallengeRegistration challenge a parked inbound REGISTER with a 401 digest auth request

func (*Client) CreateLeg

func (c *Client) CreateLeg(ctx context.Context, req CreateLegRequest) (*Leg, error)

CreateLeg originate an outbound leg

func (*Client) CreateRoom

func (c *Client) CreateRoom(ctx context.Context, req CreateRoomRequest) (*Room, error)

CreateRoom create a room

func (*Client) CreateSIPTrunk added in v0.13.0

func (c *Client) CreateSIPTrunk(ctx context.Context, req CreateTrunkRequest) (*CreateTrunkResponse, error)

CreateSIPTrunk create a SIP trunk (REGISTER or static peering)

func (*Client) DeleteSIPRegistration added in v0.13.0

func (c *Client) DeleteSIPRegistration(ctx context.Context, aor string) (*StatusResponse, error)

DeleteSIPRegistration force-unbind an AOR (or a single contact within it)

func (*Client) DeleteSIPTrunk added in v0.13.0

func (c *Client) DeleteSIPTrunk(ctx context.Context, id string) (*StatusResponse, error)

DeleteSIPTrunk remove a SIP trunk

func (*Client) DeliverEvent

func (c *Client) DeliverEvent(ev interface{})

DeliverEvent feeds an event into the client's internal hub so that *Sync methods waiting on it can return. Use this from a webhook handler after decoding the request body with ParseEvent. If you instead consume events from the WebSocket VSI endpoint, use EventStream.PipeTo or Client.RunEventStream.

Delivery is non-blocking: events are queued in a buffered inbox and dispatched on a separate goroutine. If the inbox is full (slow matcher loop unable to keep up with a sustained burst) the event is dropped to keep the caller — typically the websocket reader — from stalling and causing the server to disconnect on its own send-buffer pressure.

func (*Client) Events

func (c *Client) Events(ctx context.Context, opts ...EventStreamOption) (*EventStream, error)

Events opens a WebSocket connection to the VSI endpoint and returns an EventStream. The caller must call Close when done. The returned stream blocks in Next until an event arrives or the context is cancelled.

func (*Client) GetLeg

func (c *Client) GetLeg(ctx context.Context, id string) (*Leg, error)

GetLeg get a single leg

func (*Client) GetRoom

func (c *Client) GetRoom(ctx context.Context, id string) (*Room, error)

GetRoom get a room with participants

func (*Client) GetSIPTrunk added in v0.13.0

func (c *Client) GetSIPTrunk(ctx context.Context, id string) (*TrunkView, error)

GetSIPTrunk get a single SIP trunk

func (*Client) Leg

func (c *Client) Leg(id string) *Leg

Leg wraps an existing leg ID without making any API call. The returned *Leg has only its ID and client back-reference populated; other fields (Type, State, etc.) are zero. Use this when you already know the ID (e.g. from an inbound webhook event) and just want to issue calls against it. Call leg.Refresh-style fetch via GetLeg if you need the server's current data.

func (*Client) ListLegs

func (c *Client) ListLegs(ctx context.Context) ([]Leg, error)

ListLegs list all active legs

func (*Client) ListRooms

func (c *Client) ListRooms(ctx context.Context) ([]Room, error)

ListRooms list all rooms with participants

func (*Client) ListSIPRegistrations added in v0.13.0

func (c *Client) ListSIPRegistrations(ctx context.Context) (*RegistrationsResponse, error)

ListSIPRegistrations list active SIP AOR registrations

func (*Client) ListSIPTrunks added in v0.13.0

func (c *Client) ListSIPTrunks(ctx context.Context) (*TrunksListResponse, error)

ListSIPTrunks list configured SIP trunks

func (*Client) MoqLeg added in v0.8.0

func (c *Client) MoqLeg(ctx context.Context) (*StatusResponse, error)

MoqLeg connect a MoQ (Media over QUIC) leg (WebTransport extended-CONNECT, experimental)

func (*Client) RejectRegistration added in v0.13.0

func (c *Client) RejectRegistration(ctx context.Context, id string, req RegistrationRejectRequest) (*StatusResponse, error)

RejectRegistration reject a parked inbound REGISTER attempt

func (*Client) Room

func (c *Client) Room(id string) *Room

Room wraps an existing room ID without making any API call. See Leg.

func (*Client) RunEventStream

func (c *Client) RunEventStream(ctx context.Context, opts ...EventStreamOption) error

RunEventStream is a convenience that opens a VSI WebSocket EventStream and pumps its events into the client's hub. It blocks until ctx is cancelled or the stream errors. Equivalent to:

s, err := c.Events(ctx, opts...)
if err != nil { return err }
defer s.Close()
return s.PipeTo(ctx, c)

func (*Client) Subscribe

func (c *Client) Subscribe(types ...WebhookEventType) *Subscription

Subscribe returns a Subscription that receives every event delivered to the client's hub, optionally filtered by event type. Use this to listen for events that are not yet associated with a known *Leg or *Room — e.g. the initial leg.ringing for an inbound call.

func (*Client) WebRTCOffer

func (c *Client) WebRTCOffer(ctx context.Context, req WebRTCOfferRequest) (*WebRTCOfferResponse, error)

WebRTCOffer establish a WebRTC leg via SDP offer/answer

func (*Client) WsLeg

func (c *Client) WsLeg(ctx context.Context) (*StatusResponse, error)

WsLeg connect a WebSocket as a leg (HTTP upgrade)

type CompleteTransferPayload added in v0.11.0

type CompleteTransferPayload struct {
	ID         string `json:"id"`
	Success    bool   `json:"success"`
	StatusCode int    `json:"status_code,omitempty"`
	Reason     string `json:"reason,omitempty"`
}

CompleteTransferPayload is a complete transfer payload.

type CreateLegRequest

type CreateLegRequest struct {
	// Transport to dial out on. WebRTC legs cannot be created here: the browser starts them via `POST /webrtc/offer`.
	Type string `json:"type"`
	// Destination. For sip legs, a SIP URI (e.g. "sip:alice@example.com"); a "sips:" URI or a ";transport=tls" param sends the INVITE over TLS, and ";transport=tcp" over TCP. For whatsapp legs, an E.164 phone number (with or without '+').
	To string `json:"to,omitempty"`
	// Deprecated alias for `to` (sip legs only). Prefer `to`.
	URI string `json:"uri,omitempty"`
	// Caller ID. A bare user-part (e.g. "+15551234567", "alice") sets the user of the SIP From header. A full SIP URI (e.g. "sip:alice@pbx.example.com") sets both the user and the host; otherwise the host comes from the matched trunk's AOR realm, falling back to SIP_DOMAIN.
	From string `json:"from,omitempty"`
	// Next-hop SIP proxy for this INVITE, attached as a loose "Route" header (the Request-URI is left unchanged). Overrides the matched trunk's outbound_proxy and SIP_OUTBOUND_PROXY. Ignored when "to" resolves to an AOR registered to this server, which is delivered to the registered contact instead. SIP legs only.
	OutboundProxy string `json:"outbound_proxy,omitempty"`
	// ID of the SIP trunk (POST /v1/sip/trunks) to place this call through. The trunk supplies the route to its upstream, its digest credentials and, unless "from" names a host, the From realm; when "from" is omitted the trunk's AOR is used. Takes precedence over selecting a trunk by matching "from" against trunk AORs. An unknown ID is rejected with 404. SIP legs only.
	TrunkID string `json:"trunk_id,omitempty"`
	// SIP Privacy header value (e.g. "id", "none").
	Privacy string `json:"privacy,omitempty"`
	// Seconds to wait for answer (sip) or for the handshake (websocket) before the leg is ended with reason ring_timeout. Defaults to 60 when omitted; 0 = no timeout.
	RingTimeout int `json:"ring_timeout,omitempty"`
	// Maximum call duration in seconds after connect. Automatically hung up when reached. 0 or omitted = no limit.
	MaxDuration int `json:"max_duration,omitempty"`
	// Codec preference order (sip legs only).
	Codecs []string `json:"codecs,omitempty"`
	// Custom headers to include in the outbound INVITE (sip/whatsapp) or the WebSocket upgrade request (websocket).
	Headers map[string]string `json:"headers,omitempty"`
	// Room ID to auto-add the leg to once media is ready (early_media or connected). If the room does not exist, it is automatically created.
	RoomID string `json:"room_id,omitempty"`
	// Digest auth credentials. Required for whatsapp legs (Meta-issued password; username defaults to `from` with '+' stripped). Optional for sip legs (sipgo retries on 401/407 challenge).
	Auth *SIPAuth `json:"auth,omitempty"`
	// Route all events for this leg exclusively to this URL instead of global webhooks.
	WebhookURL string `json:"webhook_url,omitempty"`
	// HMAC-SHA256 signing secret for the per-leg webhook.
	WebhookSecret string `json:"webhook_secret,omitempty"`
	// Enable Answering Machine Detection on outbound calls. Include the object (even empty) to enable with defaults; omit to disable.
	AMD *AMDParams `json:"amd,omitempty"`
	// If false, this leg will not receive DTMF digits broadcast from other legs in the same room. Defaults to true.
	AcceptDTMF *bool `json:"accept_dtmf,omitempty"`
	// Application identifier. Carried through to all events for this leg. Use to filter the WebSocket event stream by app.
	AppID string `json:"app_id,omitempty"`
	// If true, emit speaking.started and speaking.stopped events for this leg. If false, suppress them. Omit to use the server default (SPEECH_DETECTION_ENABLED env var, default false).
	SpeechDetection *bool `json:"speech_detection,omitempty"`
	// Ordered audio processing chain applied to audio arriving from this leg, before it reaches the room mixer and therefore before other legs, recordings and speech-to-text see it. Each entry names a built-in filter and may carry parameters. Omit the field to use the server default (AUDIO_FILTERS env var); send an empty array for no processing. Filters run in the order given, and corrective filters should precede effects. Known filters: denoise (background noise suppression), bandpass (low_hz, high_hz), gain (volume, -8 to 8 in ~3 dB steps), pitch (shifts the voice up or down in semitones; semitones, mix), robotic (metallic voice effect that keeps speech easy to follow; pitch_hz, depth, mix), vocoder (a stronger, fully synthetic robot voice that is noticeably harder to understand; carrier_hz, bands, mix). Noise suppression removes background noise, not competing speech.
	Filters []FilterSpec `json:"filters,omitempty"`
	// For sip legs: offer Real-Time Text (ITU-T T.140 over RTP per RFC 4103) alongside audio. For websocket legs: enable the bidirectional text-message channel. Default: false.
	RTT bool `json:"rtt,omitempty"`
	// SIP outbound only. true offers SDES-SRTP (RFC 4568): every audio section, and the text section when rtt is set, goes out as RTP/SAVP with its own a=crypto keys, and a peer that answers without an accepted key fails the call. false offers plain RTP/AVP. Either value holds for the whole call: a later re-offer on the other transport gets 488. Omit to follow SIP_SRTP, which offers SRTP only when it is "required". Rejected with 400 when it contradicts SIP_SRTP (true under "disabled", false under "required"). The keys travel in the SDP, so send the INVITE over TLS (a "sips:" URI or ";transport=tls").
	Srtp bool `json:"srtp,omitempty"`
	// Opaque application JSON attached to the leg. Any JSON value is accepted (object, array, string, number, boolean). It is echoed on the leg view and carried at the top level of every event published for this leg, so external state can be correlated without keeping a leg_id lookup table. Capped by CUSTOM_DATA_MAX_BYTES (default 1024 bytes, 0 = unlimited).
	CustomData interface{} `json:"custom_data,omitempty"`
	// SIP outbound only. Extra m=audio sections to offer alongside the call's primary bidirectional audio, so a multi-stream call is established by the first INVITE instead of a follow-up re-INVITE. Each entry binds its own RTP port and may be mixed into its own room. To add a stream to a call that is already up, use POST /v1/legs/{id}/streams instead.
	Streams []CreateLegStream `json:"streams,omitempty"`
	// WebSocket target URL (ws:// or wss://) for outbound websocket legs. Required when type=websocket.
	URL string `json:"url,omitempty"`
	// PCM sample rate for websocket legs. The room's mixer automatically resamples between this and the room rate.
	SampleRate int `json:"sample_rate,omitempty"`
	// Audio framing for websocket legs. `binary` ships raw PCM as WebSocket binary frames; `json_base64` wraps PCM as `{"type":"audio","audio":"<base64>"}` text frames (browser-friendly).
	WireFormat string `json:"wire_format,omitempty"`
	// On-the-wire PCM sample encoding for websocket legs. v1 only supports `s16le`.
	SampleFormat string `json:"sample_format,omitempty"`
	// LiveKit room join parameters (only used when type=livekit_room).
	Livekit interface{} `json:"livekit,omitempty"`
}

CreateLegRequest is a create leg request.

type CreateLegStream added in v0.12.1

type CreateLegStream struct {
	// Media direction for this stream, from this server's point of view. Defaults to sendrecv.
	Direction string `json:"direction,omitempty"`
	// BCP 47 language tag advertised as a=lang (RFC 8866), e.g. "es-ES" for a Spanish translation feed.
	Lang string `json:"lang,omitempty"`
	// Value advertised as a=content (RFC 4796). Use "alt" for an alternative feed such as a translation.
	Content string `json:"content,omitempty"`
	// Value advertised as a=label (RFC 4574), for correlating the stream with external metadata.
	Label string `json:"label,omitempty"`
	// Room to mix this stream into once the call connects. May differ from the leg's own room_id, which governs the primary stream.
	RoomID string `json:"room_id,omitempty"`
	// Routing role for this stream inside its room.
	Role string `json:"role,omitempty"`
}

CreateLegStream is a create leg stream.

type CreateRoomBridgeRequest added in v0.12.1

type CreateRoomBridgeRequest struct {
	// Custom bridge ID (auto-generated UUID if omitted).
	ID string `json:"id,omitempty"`
	// The other room to join. Must use the same sample rate as the room in the path.
	RoomID string `json:"room_id"`
	// Audio flow relative to the room in the path: bidirectional (both hear each other), send (path room → other only), receive (other → path room only), none (allocated but silent). Default: bidirectional.
	Direction string `json:"direction,omitempty"`
}

CreateRoomBridgeRequest is a create room bridge request.

type CreateRoomRequest

type CreateRoomRequest struct {
	// Custom room ID (auto-generated UUID if omitted).
	ID string `json:"id"`
	// Route all events for this room exclusively to this URL instead of global webhooks.
	WebhookURL string `json:"webhook_url,omitempty"`
	// HMAC-SHA256 signing secret for the per-room webhook.
	WebhookSecret string `json:"webhook_secret,omitempty"`
	// Application identifier. Carried through to all events for this room. Use to filter the WebSocket event stream by app.
	AppID string `json:"app_id,omitempty"`
	// Mixer sample rate in Hz. Allowed values: 8000, 16000, 48000. Default: 16000.
	SampleRate int `json:"sample_rate,omitempty"`
	// Inject low-level comfort noise (~-75 dBFS) into otherwise silent mixer frames for this room. Omit to use the server default (`COMFORT_NOISE_ENABLED`).
	ComfortNoise bool `json:"comfort_noise,omitempty"`
}

CreateRoomRequest is a create room request.

type CreateTrunkRequest added in v0.9.0

type CreateTrunkRequest struct {
	// Trunk type discriminator. `sip_register` REGISTERs to an upstream registrar; `ip_ip` peers with a fixed upstream without registering.
	Type string `json:"type"`
	// Application identifier carried through to every event emitted by this trunk.
	AppID string `json:"app_id,omitempty"`
	// SDES-SRTP policy for calls through this trunk, in both directions: outbound calls placed through it (by trunk_id or by from) and inbound calls it claims. Takes the SIP_SRTP values and replaces SIP_SRTP for those calls, stricter or looser: required makes every call through the trunk SRTP, disabled keeps it plain RTP even when SIP_SRTP is required. Omit to follow SIP_SRTP. Inbound calls are claimed by source address, which can be forged over UDP; a trunk that relaxes the server policy should use TLS.
	Srtp string `json:"srtp,omitempty"`
	// Required when type == "sip_register". Configures the outbound REGISTER (registrar URI, AOR, digest credentials, expiry).
	SIPRegister interface{} `json:"sip_register,omitempty"`
	// Required when type == "ip_ip". Configures static peering with a fixed upstream (peer URI, optional digest credentials, inbound source addresses, OPTIONS health check).
	IpIp interface{} `json:"ip_ip,omitempty"`
}

CreateTrunkRequest is a create trunk request.

type CreateTrunkResponse added in v0.9.0

type CreateTrunkResponse struct {
	ID     string `json:"id"`
	Type   string `json:"type"`
	Status string `json:"status"`
}

CreateTrunkResponse is a create trunk response.

type DTMFPayload

type DTMFPayload struct {
	ID     string `json:"id"`
	Digits string `json:"digits"`
}

DTMFPayload is a DTMF payload.

type DTMFReceivedEvent

type DTMFReceivedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// DTMF digit received.
	Digit string `json:"digit,omitempty"`
	Seq   int    `json:"seq,omitempty"`
}

DTMFReceivedEvent is fired when: dTMF digit received

type DTMFRequest

type DTMFRequest struct {
	// DTMF digits to send (0-9, *, #).
	Digits string `json:"digits"`
}

DTMFRequest is a DTMF request.

type DeclineTransferPayload added in v0.11.0

type DeclineTransferPayload struct {
	ID     string `json:"id"`
	Code   int    `json:"code,omitempty"`
	Reason string `json:"reason,omitempty"`
}

DeclineTransferPayload is a decline transfer payload.

type DeepgramAgentRequest

type DeepgramAgentRequest struct {
	// Full Deepgram agent settings object (agent.listen, agent.think, agent.speak, etc.). When omitted, sensible defaults are used (nova-3 STT, gpt-4o-mini LLM, aura-2-asteria-en TTS).
	Settings json.RawMessage `json:"settings,omitempty"`
	// Agent greeting message.
	Greeting string `json:"greeting,omitempty"`
	// Language code (e.g. "en", "es").
	Language string `json:"language,omitempty"`
	// API key override (falls back to DEEPGRAM_API_KEY env var).
	APIKey string `json:"api_key,omitempty"`
}

DeepgramAgentRequest is a deepgram agent request.

type DeleteLegPayload

type DeleteLegPayload struct {
	ID     string `json:"id"`
	Reason string `json:"reason,omitempty"`
}

DeleteLegPayload is a delete leg payload.

type DeleteLegRequest

type DeleteLegRequest struct {
	// Disconnect reason. Only honored for unanswered SIP inbound legs (state `ringing` or `early_media`); on connected legs the body is ignored and the leg is hung up with the legacy `api_hangup` reason. The value flows through to `leg.disconnected`'s `cdr.reason` and selects the SIP final response: `busy`→486, `declined`/`rejected`→603, `unavailable`→480, `not_found`→404, `forbidden`→403, `server_error`→500.
	Reason string `json:"reason,omitempty"`
}

DeleteLegRequest is a delete leg request.

type DeleteRegistrationPayload added in v0.10.0

type DeleteRegistrationPayload struct {
	Aor     string `json:"aor"`
	Contact string `json:"contact,omitempty"`
}

DeleteRegistrationPayload is a delete registration payload.

type EarlyMediaLegRequest

type EarlyMediaLegRequest struct {
	// Explicit codec for the 183 Session Progress SDP. Must appear in the remote offer's offered_codecs list. Omit to use the server's default preference order.
	Codec string `json:"codec,omitempty"`
	// Opaque application JSON attached to the leg. Any JSON value is accepted (object, array, string, number, boolean). It is echoed on the leg view and carried at the top level of every event published for this leg, so external state can be correlated without keeping a leg_id lookup table. Capped by CUSTOM_DATA_MAX_BYTES (default 1024 bytes, 0 = unlimited). Omit to leave any existing value untouched; send null to clear it.
	CustomData interface{} `json:"custom_data,omitempty"`
}

EarlyMediaLegRequest is a early media leg request.

type EarlyMediaPayload

type EarlyMediaPayload struct {
	ID         string      `json:"id"`
	Codec      string      `json:"codec,omitempty"`
	CustomData interface{} `json:"custom_data,omitempty"`
}

EarlyMediaPayload is a early media payload.

type ElevenLabsAgentRequest

type ElevenLabsAgentRequest struct {
	// ElevenLabs agent ID.
	AgentID string `json:"agent_id"`
	// Override the agent's first message.
	FirstMessage string `json:"first_message,omitempty"`
	// Language code (e.g. "en", "es").
	Language string `json:"language,omitempty"`
	// Key-value pairs passed to the agent as dynamic variables.
	DynamicVariables map[string]string `json:"dynamic_variables,omitempty"`
	// API key override (falls back to ELEVENLABS_API_KEY env var).
	APIKey string `json:"api_key,omitempty"`
}

ElevenLabsAgentRequest is a eleven labs agent request.

type Event

type Event struct {
	Type       WebhookEventType `json:"type"`
	Timestamp  time.Time        `json:"timestamp"`
	InstanceID string           `json:"instance_id,omitempty"`
}

Event is the base envelope for all webhook/WebSocket events.

type EventStream

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

EventStream receives real-time events from the VoiceBlender Streaming Interface (VSI) WebSocket endpoint and (when used as a *EventStream receiver) issues client-to-server commands over the same socket. Use Client.Events to create one.

func (*EventStream) AcceptLegDTMF

func (s *EventStream) AcceptLegDTMF(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

AcceptLegDTMF enable DTMF reception

func (*EventStream) AcceptLegRTT

func (s *EventStream) AcceptLegRTT(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

AcceptLegRTT enable RTT reception

func (*EventStream) AcceptRegistration added in v0.10.0

func (s *EventStream) AcceptRegistration(ctx context.Context, payload AcceptRegistrationPayload) (VSIStatusResponse, error)

AcceptRegistration accept a parked inbound REGISTER attempt (bind and reply 200 OK)

func (*EventStream) AcceptTransfer added in v0.11.0

func (s *EventStream) AcceptTransfer(ctx context.Context, payload AcceptTransferPayload) (VSIStatusResponse, error)

AcceptTransfer accept a parked inbound REFER (send 202 + NOTIFY 100 Trying)

func (*EventStream) AddLegToRoom

func (s *EventStream) AddLegToRoom(ctx context.Context, payload AddLegPayload) (AddLegToRoomResult, error)

AddLegToRoom add or move a leg into a room

func (*EventStream) AnswerLeg

func (s *EventStream) AnswerLeg(ctx context.Context, payload AnswerLegPayload) (VSIStatusResponse, error)

AnswerLeg answer a ringing inbound leg

func (*EventStream) BridgeCreate

func (s *EventStream) BridgeCreate(ctx context.Context, payload BridgeCreatePayload) (BridgeView, error)

BridgeCreate join two rooms' mixers

func (*EventStream) BridgeDelete

func (s *EventStream) BridgeDelete(ctx context.Context, payload BridgeRefPayload) (VSIStatusResponse, error)

BridgeDelete tear down a bridge

func (*EventStream) BridgeGet

func (s *EventStream) BridgeGet(ctx context.Context, payload BridgeRefPayload) (BridgeView, error)

BridgeGet get a bridge involving a room

func (*EventStream) BridgeList

func (s *EventStream) BridgeList(ctx context.Context, payload BridgeListPayload) ([]BridgeView, error)

BridgeList list bridges involving a room

func (*EventStream) BridgeUpdate

func (s *EventStream) BridgeUpdate(ctx context.Context, payload BridgeUpdatePayload) (BridgeView, error)

BridgeUpdate change a bridge's direction

func (*EventStream) CancelDrain added in v1.0.0

func (s *EventStream) CancelDrain(ctx context.Context) (InstanceStatus, error)

CancelDrain cancel a drain and accept new calls again

func (*EventStream) ChallengeLeg added in v0.10.0

func (s *EventStream) ChallengeLeg(ctx context.Context, payload ChallengeLegPayload) (VSIStatusResponse, error)

ChallengeLeg send a 401 digest challenge on a ringing inbound SIP leg (INVITE)

func (*EventStream) ChallengeRegistration added in v0.10.0

func (s *EventStream) ChallengeRegistration(ctx context.Context, payload ChallengeRegistrationPayload) (VSIStatusResponse, error)

ChallengeRegistration send a 401 digest challenge for a parked inbound REGISTER attempt

func (*EventStream) Close

func (s *EventStream) Close() error

Close gracefully closes the WebSocket connection by sending a stop message.

func (*EventStream) CompleteTransfer added in v0.11.0

func (s *EventStream) CompleteTransfer(ctx context.Context, payload CompleteTransferPayload) (VSIStatusResponse, error)

CompleteTransfer terminate an accepted inbound transfer with a final sipfrag NOTIFY (200 OK or failure)

func (*EventStream) CreateLeg

func (s *EventStream) CreateLeg(ctx context.Context, payload CreateLegRequest) (Leg, error)

CreateLeg originate an outbound leg

func (*EventStream) CreateRoom

func (s *EventStream) CreateRoom(ctx context.Context, payload CreateRoomRequest) (Room, error)

CreateRoom create a room

func (*EventStream) CreateSIPTrunk added in v0.9.0

func (s *EventStream) CreateSIPTrunk(ctx context.Context, payload CreateTrunkRequest) (CreateTrunkResponse, error)

CreateSIPTrunk create a SIP trunk (REGISTER or static peering)

func (*EventStream) DeafLeg

func (s *EventStream) DeafLeg(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

DeafLeg deafen a leg (stop receiving room audio)

func (*EventStream) DeclineTransfer added in v0.11.0

func (s *EventStream) DeclineTransfer(ctx context.Context, payload DeclineTransferPayload) (VSIStatusResponse, error)

DeclineTransfer reject a parked (not-yet-accepted) inbound REFER (603 by default)

func (*EventStream) DeleteLeg

func (s *EventStream) DeleteLeg(ctx context.Context, payload DeleteLegPayload) (VSIStatusResponse, error)

DeleteLeg hang up a leg

func (*EventStream) DeleteLegCustomData added in v0.13.0

func (s *EventStream) DeleteLegCustomData(ctx context.Context, payload IDPayload) (Leg, error)

DeleteLegCustomData clear a leg's custom_data

func (*EventStream) DeleteRoom

func (s *EventStream) DeleteRoom(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

DeleteRoom delete a room

func (*EventStream) DeleteSIPRegistration added in v0.10.0

func (s *EventStream) DeleteSIPRegistration(ctx context.Context, payload DeleteRegistrationPayload) (VSIStatusResponse, error)

DeleteSIPRegistration force-unbind an AOR (or a single contact under it)

func (*EventStream) DeleteSIPTrunk added in v0.9.0

func (s *EventStream) DeleteSIPTrunk(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

DeleteSIPTrunk remove a SIP trunk

func (*EventStream) GetLeg

func (s *EventStream) GetLeg(ctx context.Context, payload IDPayload) (Leg, error)

GetLeg get a single leg by id

func (*EventStream) GetRoom

func (s *EventStream) GetRoom(ctx context.Context, payload IDPayload) (Room, error)

GetRoom get a single room by id

func (*EventStream) GetSIPTrunk added in v0.9.0

func (s *EventStream) GetSIPTrunk(ctx context.Context, payload IDPayload) (TrunkView, error)

GetSIPTrunk get a single SIP trunk

func (*EventStream) HoldLeg

func (s *EventStream) HoldLeg(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

HoldLeg put a SIP leg on hold

func (*EventStream) LegAMDStart

func (s *EventStream) LegAMDStart(ctx context.Context, payload LegAMDStartPayload) (VSIStatusResponse, error)

LegAMDStart start Answering Machine Detection on a connected SIP leg

func (*EventStream) LegAgentDeepgram

func (s *EventStream) LegAgentDeepgram(ctx context.Context, payload AgentDeepgramPayload) (AgentStartLegResult, error)

LegAgentDeepgram attach a Deepgram Voice Agent to a leg

func (*EventStream) LegAgentElevenlabs

func (s *EventStream) LegAgentElevenlabs(ctx context.Context, payload AgentElevenLabsPayload) (AgentStartLegResult, error)

LegAgentElevenlabs attach an ElevenLabs Conversational AI agent to a leg

func (*EventStream) LegAgentMessage

func (s *EventStream) LegAgentMessage(ctx context.Context, payload AgentMessagePayload) (AgentMessageResult, error)

LegAgentMessage inject a text message into a leg agent session

func (*EventStream) LegAgentPipecat

func (s *EventStream) LegAgentPipecat(ctx context.Context, payload AgentPipecatPayload) (AgentStartLegResult, error)

LegAgentPipecat attach a Pipecat bot to a leg

func (*EventStream) LegAgentStop

func (s *EventStream) LegAgentStop(ctx context.Context, payload IDPayload) (AgentStopResult, error)

LegAgentStop detach the agent attached to a leg

func (*EventStream) LegAgentVapi

func (s *EventStream) LegAgentVapi(ctx context.Context, payload AgentVAPIPayload) (AgentStartLegResult, error)

LegAgentVapi attach a VAPI agent to a leg

func (*EventStream) LegEarlyMedia

func (s *EventStream) LegEarlyMedia(ctx context.Context, payload EarlyMediaPayload) (VSIStatusResponse, error)

LegEarlyMedia enable early media (183 Session Progress) on a SIP inbound leg

func (*EventStream) LegPlayStart

func (s *EventStream) LegPlayStart(ctx context.Context, payload PlaybackStartPayload) (PlaybackStartResult, error)

LegPlayStart start audio playback on a leg

func (*EventStream) LegPlayStop

func (s *EventStream) LegPlayStop(ctx context.Context, payload PlaybackTargetPayload) (PlaybackStopResult, error)

LegPlayStop stop a leg playback

func (*EventStream) LegPlayVolume

func (s *EventStream) LegPlayVolume(ctx context.Context, payload PlaybackVolumePayload) (VSIStatusResponse, error)

LegPlayVolume adjust the volume of an active leg playback

func (*EventStream) LegRecordPause

func (s *EventStream) LegRecordPause(ctx context.Context, payload IDPayload) (RecordingPauseResumeResult, error)

LegRecordPause pause a leg recording

func (*EventStream) LegRecordResume

func (s *EventStream) LegRecordResume(ctx context.Context, payload IDPayload) (RecordingPauseResumeResult, error)

LegRecordResume resume a paused leg recording

func (*EventStream) LegRecordStart

func (s *EventStream) LegRecordStart(ctx context.Context, payload RecordStartPayload) (RecordingStartResult, error)

LegRecordStart start recording a leg (stereo when in a room or SIP, mono otherwise)

func (*EventStream) LegRecordStop

func (s *EventStream) LegRecordStop(ctx context.Context, payload IDPayload) (RecordingStopLegResult, error)

LegRecordStop stop a leg recording

func (*EventStream) LegRing

func (s *EventStream) LegRing(ctx context.Context, payload RingLegPayload) (VSIStatusResponse, error)

LegRing send a 180 Ringing on a SIP inbound leg

func (*EventStream) LegSTTFinalize added in v0.12.1

func (s *EventStream) LegSTTFinalize(ctx context.Context, payload IDPayload) (STTFinalizeResult, error)

LegSTTFinalize flush the speech-to-text buffer on a leg and emit a final transcript without stopping STT

func (*EventStream) LegSTTStart

func (s *EventStream) LegSTTStart(ctx context.Context, payload STTStartPayload) (STTStartLegResult, error)

LegSTTStart start speech-to-text on a leg

func (*EventStream) LegSTTStop

func (s *EventStream) LegSTTStop(ctx context.Context, payload IDPayload) (STTStopResult, error)

LegSTTStop stop speech-to-text on a leg

func (*EventStream) LegSiprecStart added in v0.12.1

func (s *EventStream) LegSiprecStart(ctx context.Context, payload RoomSIPRECStartPayload) (Leg, error)

LegSiprecStart fork a single call to an external SIPREC recording server

func (*EventStream) LegStreamAdd added in v0.12.1

func (s *EventStream) LegStreamAdd(ctx context.Context, payload LegStreamAddPayload) (LegStreamView, error)

LegStreamAdd negotiate an additional m=audio section on a live dialog via re-INVITE

func (*EventStream) LegStreamAttachRoom added in v0.12.1

func (s *EventStream) LegStreamAttachRoom(ctx context.Context, payload LegStreamRoomPayload) (LegStreamView, error)

LegStreamAttachRoom mix one of a leg's audio streams into a room (may differ from the leg's own room)

func (*EventStream) LegStreamDetachRoom added in v0.12.1

func (s *EventStream) LegStreamDetachRoom(ctx context.Context, payload LegStreamPayload) (LegStreamView, error)

LegStreamDetachRoom remove one of a leg's audio streams from whichever room mixes it

func (*EventStream) LegStreamGet added in v0.12.1

func (s *EventStream) LegStreamGet(ctx context.Context, payload LegStreamPayload) (LegStreamView, error)

LegStreamGet get one of a SIP leg's audio streams

func (*EventStream) LegStreamList added in v0.12.1

func (s *EventStream) LegStreamList(ctx context.Context, payload IDPayload) ([]LegStreamView, error)

LegStreamList list a SIP leg's negotiated audio streams

func (*EventStream) LegStreamRemove added in v0.12.1

func (s *EventStream) LegStreamRemove(ctx context.Context, payload LegStreamPayload) (VSIStatusResponse, error)

LegStreamRemove disable one of a leg's audio streams with a port-0 re-INVITE

func (*EventStream) LegStreamUpdate added in v0.12.1

func (s *EventStream) LegStreamUpdate(ctx context.Context, payload LegStreamUpdatePayload) (LegStreamView, error)

LegStreamUpdate change one of a leg's audio streams' routing role in place

func (*EventStream) LegTTS

func (s *EventStream) LegTTS(ctx context.Context, payload TTSStartPayload) (TTSStartResult, error)

LegTTS synthesize speech and play it on a leg

func (*EventStream) LegTTSCommit added in v0.12.1

func (s *EventStream) LegTTSCommit(ctx context.Context, payload TTSTargetPayload) (TTSStartResult, error)

LegTTSCommit play a staged TTS utterance

func (*EventStream) LegTTSDiscard added in v0.12.1

func (s *EventStream) LegTTSDiscard(ctx context.Context, payload TTSTargetPayload) (TTSDiscardResult, error)

LegTTSDiscard drop a staged TTS utterance without playing it

func (*EventStream) LegTTSPreflight added in v0.12.1

func (s *EventStream) LegTTSPreflight(ctx context.Context, payload TTSStartPayload) (TTSStartResult, error)

LegTTSPreflight synthesize speech and hold it for a later commit

func (*EventStream) LegTransfer

func (s *EventStream) LegTransfer(ctx context.Context, payload TransferLegPayload) (TransferLegResult, error)

LegTransfer initiate a SIP REFER transfer (blind or attended)

func (*EventStream) ListLegs

func (s *EventStream) ListLegs(ctx context.Context) ([]Leg, error)

ListLegs list all active legs

func (*EventStream) ListRooms

func (s *EventStream) ListRooms(ctx context.Context) ([]Room, error)

ListRooms list all rooms

func (*EventStream) ListSIPRegistrations added in v0.8.0

func (s *EventStream) ListSIPRegistrations(ctx context.Context) (RegistrationsResponse, error)

ListSIPRegistrations list active SIP AOR registrations

func (*EventStream) ListSIPTrunks added in v0.9.0

func (s *EventStream) ListSIPTrunks(ctx context.Context) (TrunksListResponse, error)

ListSIPTrunks list configured SIP trunks

func (*EventStream) MuteLeg

func (s *EventStream) MuteLeg(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

MuteLeg mute a leg

func (*EventStream) Next

func (s *EventStream) Next(ctx context.Context) (interface{}, error)

Next reads the next event from the stream. It blocks until an event is available, the context is cancelled, or the connection is closed. Ping frames from the server are automatically answered with pong, and command responses (`<cmd>.result` / `error` for in-flight VSI commands) are transparently routed to the waiting caller and not surfaced as events.

func (*EventStream) PipeTo

func (s *EventStream) PipeTo(ctx context.Context, c *Client) error

PipeTo runs Next in a loop and dispatches every event into the client's internal hub so that *Sync methods (e.g. Leg.PlayTTSSync) can be unblocked. It blocks until ctx is cancelled or the stream errors, and returns that error. Typical usage is to start it in a goroutine alongside the main flow:

stream, _ := client.Events(ctx)
go stream.PipeTo(ctx, client)

func (*EventStream) ProgressTransfer added in v0.11.0

func (s *EventStream) ProgressTransfer(ctx context.Context, payload ProgressTransferPayload) (VSIStatusResponse, error)

ProgressTransfer send an interim sipfrag NOTIFY (e.g. 180 Ringing) on an accepted inbound transfer

func (*EventStream) RejectLegDTMF

func (s *EventStream) RejectLegDTMF(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

RejectLegDTMF disable DTMF reception

func (*EventStream) RejectLegRTT

func (s *EventStream) RejectLegRTT(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

RejectLegRTT disable RTT reception

func (*EventStream) RejectRegistration added in v0.10.0

func (s *EventStream) RejectRegistration(ctx context.Context, payload RejectRegistrationPayload) (VSIStatusResponse, error)

RejectRegistration reject a parked inbound REGISTER attempt (reply 403 by default)

func (*EventStream) RemoveLegFromRoom

func (s *EventStream) RemoveLegFromRoom(ctx context.Context, payload RoomLegPayload) (VSIStatusResponse, error)

RemoveLegFromRoom remove a leg from a room

func (*EventStream) RoomAgentDeepgram

func (s *EventStream) RoomAgentDeepgram(ctx context.Context, payload AgentDeepgramPayload) (AgentStartRoomResult, error)

RoomAgentDeepgram attach a Deepgram Voice Agent to a room

func (*EventStream) RoomAgentElevenlabs

func (s *EventStream) RoomAgentElevenlabs(ctx context.Context, payload AgentElevenLabsPayload) (AgentStartRoomResult, error)

RoomAgentElevenlabs attach an ElevenLabs Conversational AI agent to a room

func (*EventStream) RoomAgentMessage

func (s *EventStream) RoomAgentMessage(ctx context.Context, payload AgentMessagePayload) (AgentMessageResult, error)

RoomAgentMessage inject a text message into a room agent session

func (*EventStream) RoomAgentPipecat

func (s *EventStream) RoomAgentPipecat(ctx context.Context, payload AgentPipecatPayload) (AgentStartRoomResult, error)

RoomAgentPipecat attach a Pipecat bot to a room

func (*EventStream) RoomAgentStop

func (s *EventStream) RoomAgentStop(ctx context.Context, payload IDPayload) (AgentStopResult, error)

RoomAgentStop detach the agent attached to a room

func (*EventStream) RoomAgentVapi

func (s *EventStream) RoomAgentVapi(ctx context.Context, payload AgentVAPIPayload) (AgentStartRoomResult, error)

RoomAgentVapi attach a VAPI agent to a room

func (*EventStream) RoomPlayStart

func (s *EventStream) RoomPlayStart(ctx context.Context, payload PlaybackStartPayload) (PlaybackStartResult, error)

RoomPlayStart start audio playback on a room mix

func (*EventStream) RoomPlayStop

func (s *EventStream) RoomPlayStop(ctx context.Context, payload PlaybackTargetPayload) (PlaybackStopResult, error)

RoomPlayStop stop a room playback

func (*EventStream) RoomPlayVolume

func (s *EventStream) RoomPlayVolume(ctx context.Context, payload PlaybackVolumePayload) (VSIStatusResponse, error)

RoomPlayVolume adjust the volume of an active room playback

func (*EventStream) RoomRecordPause

func (s *EventStream) RoomRecordPause(ctx context.Context, payload IDPayload) (RecordingPauseResumeResult, error)

RoomRecordPause pause a room recording

func (*EventStream) RoomRecordResume

func (s *EventStream) RoomRecordResume(ctx context.Context, payload IDPayload) (RecordingPauseResumeResult, error)

RoomRecordResume resume a paused room recording

func (*EventStream) RoomRecordStart

func (s *EventStream) RoomRecordStart(ctx context.Context, payload RecordStartPayload) (RecordingStartResult, error)

RoomRecordStart start recording the full room mix (mono; multi_channel adds per-participant tracks)

func (*EventStream) RoomRecordStop

func (s *EventStream) RoomRecordStop(ctx context.Context, payload IDPayload) (RecordingStopRoomResult, error)

RoomRecordStop stop a room recording

func (*EventStream) RoomRoutingGet

func (s *EventStream) RoomRoutingGet(ctx context.Context, payload IDPayload) (RoomRoutingView, error)

RoomRoutingGet get a room's audio routing matrix

func (*EventStream) RoomRoutingSet

func (s *EventStream) RoomRoutingSet(ctx context.Context, payload RoomRoutingSetPayload) (RoomRoutingView, error)

RoomRoutingSet replace a room's audio routing matrix

func (*EventStream) RoomRoutingUpdate

func (s *EventStream) RoomRoutingUpdate(ctx context.Context, payload RoomRoutingUpdatePayload) (RoomRoutingView, error)

RoomRoutingUpdate update selected rows of a room's audio routing matrix

func (*EventStream) RoomSTTStart

func (s *EventStream) RoomSTTStart(ctx context.Context, payload STTStartPayload) (STTStartRoomResult, error)

RoomSTTStart start speech-to-text on every participant of a room (auto-extends to legs that join later)

func (*EventStream) RoomSTTStop

func (s *EventStream) RoomSTTStop(ctx context.Context, payload IDPayload) (STTStopResult, error)

RoomSTTStop stop speech-to-text on a room

func (*EventStream) RoomSiprecStart added in v0.12.1

func (s *EventStream) RoomSiprecStart(ctx context.Context, payload RoomSIPRECStartPayload) (Leg, error)

RoomSiprecStart fork a room's participants to an external SIPREC recording server

func (*EventStream) RoomTTS

func (s *EventStream) RoomTTS(ctx context.Context, payload TTSStartPayload) (TTSStartResult, error)

RoomTTS synthesize speech and play it into a room mix

func (*EventStream) SendLegDTMF

func (s *EventStream) SendLegDTMF(ctx context.Context, payload DTMFPayload) (VSIStatusResponse, error)

SendLegDTMF send DTMF digits on a leg

func (*EventStream) SendLegRTT

func (s *EventStream) SendLegRTT(ctx context.Context, payload RTTPayload) (VSIStatusResponse, error)

SendLegRTT send Real-Time Text (T.140) on a SIP leg

func (*EventStream) SetLegCustomData added in v0.13.0

func (s *EventStream) SetLegCustomData(ctx context.Context, payload SetLegCustomDataPayload) (Leg, error)

SetLegCustomData replace a leg's custom_data (carried on every subsequent event for the leg)

func (*EventStream) SetLegFilters added in v0.15.0

func (s *EventStream) SetLegFilters(ctx context.Context, payload SetLegFiltersPayload) (Leg, error)

SetLegFilters replace the audio filter chain running on a live leg

func (*EventStream) SetLegRole

func (s *EventStream) SetLegRole(ctx context.Context, payload SetLegRolePayload) (Leg, error)

SetLegRole change a leg's routing role (recomputes the room matrix if the leg is in a room)

func (*EventStream) SiprecGet added in v0.12.1

func (s *EventStream) SiprecGet(ctx context.Context, payload IDPayload) (SIPRECSessionView, error)

SiprecGet get an inbound SIPREC recording session's participants, streams and metadata

func (*EventStream) StartDrain added in v1.0.0

func (s *EventStream) StartDrain(ctx context.Context, payload StartDrainRequest) (InstanceStatus, error)

StartDrain start draining: refuse new SIP calls and let current calls end

func (*EventStream) UndeafLeg

func (s *EventStream) UndeafLeg(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

UndeafLeg undeafen a leg

func (*EventStream) UnholdLeg

func (s *EventStream) UnholdLeg(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

UnholdLeg resume a held SIP leg

func (*EventStream) UnmuteLeg

func (s *EventStream) UnmuteLeg(ctx context.Context, payload IDPayload) (VSIStatusResponse, error)

UnmuteLeg unmute a leg

func (*EventStream) WebRTCAddCandidate

func (s *EventStream) WebRTCAddCandidate(ctx context.Context, payload VSIWebRTCAddCandidatePayload) (VSIStatusResponse, error)

WebRTCAddCandidate add a remote ICE candidate to a WebRTC leg

func (*EventStream) WebRTCGetCandidates

func (s *EventStream) WebRTCGetCandidates(ctx context.Context, payload IDPayload) (WebRTCCandidatesResult, error)

WebRTCGetCandidates drain server-gathered ICE candidates for a WebRTC leg

func (*EventStream) WebRTCICERestart added in v0.15.0

func (s *EventStream) WebRTCICERestart(ctx context.Context, payload VSIWebRTCICERestartPayload) (WebRTCOfferResult, error)

WebRTCICERestart restart ICE on a WebRTC leg

func (*EventStream) WebRTCOffer

func (s *EventStream) WebRTCOffer(ctx context.Context, payload WebRTCOfferRequest) (WebRTCOfferResult, error)

WebRTCOffer establish a WebRTC leg via SDP offer/answer

type EventStreamOption

type EventStreamOption func(*eventStreamConfig)

EventStreamOption configures an EventStream.

func WithAppFilter added in v0.11.1

func WithAppFilter(pattern string) EventStreamOption

WithAppFilter restricts the stream to events whose app_id matches the given RE2 regular expression, e.g. "^ptt$" for one app or "^(ptt|dispatch)$" for several. The pattern is unanchored unless you anchor it, so "ptt" also matches "ptt-staging".

Legs are tagged by passing app_id when they are created; events from untagged legs have an empty app_id and are dropped by any non-empty filter. An invalid pattern fails the dial with a 400 from the server.

func WithEventHTTPClient

func WithEventHTTPClient(hc *http.Client) EventStreamOption

WithEventHTTPClient overrides the HTTP client used for the WebSocket dial.

func WithFrameLogger added in v0.10.0

func WithFrameLogger(fn func(dir string, data []byte)) EventStreamOption

WithFrameLogger installs a callback invoked for every raw VSI frame sent to or received from the server (dir is "send" or "recv"). Intended for debug tracing of the wire protocol. The callback runs on the read/write path, so it must be cheap and non-blocking.

type FilterSpec added in v0.15.0

type FilterSpec struct {
	// Filter name.
	Type string `json:"type"`
	// Filter parameters as name/value pairs. Unknown names are ignored; out-of-range values are rejected. bandpass takes low_hz (default 300) and high_hz (default 3400); gain takes volume (-8 to 8, ~3 dB per step); pitch takes semitones (-12 to 12, default -5) and mix (0-1, default 1); robotic takes pitch_hz (50-500, default 110), depth (0-0.95, default 0.75) and mix (0-1, default 1); vocoder takes carrier_hz (40-400, default 110), bands (4-32, default 20) and mix (0-1, default 1); denoise and denoise_gtcrn take none.
	Params map[string]float64 `json:"params,omitempty"`
}

FilterSpec is a filter spec.

type ICECandidateInit

type ICECandidateInit struct {
	Candidate        string  `json:"candidate"`
	SDPMid           *string `json:"sdpMid,omitempty"`
	SDPMLineIndex    *uint16 `json:"sdpMLineIndex,omitempty"`
	UsernameFragment *string `json:"usernameFragment,omitempty"`
}

ICECandidateInit is a WebRTC ICE candidate initialisation struct.

type ICECandidatesResponse

type ICECandidatesResponse struct {
	InstanceID string             `json:"instance_id,omitempty"`
	Candidates []ICECandidateInit `json:"candidates"`
	Done       bool               `json:"done"`
}

ICECandidatesResponse contains locally gathered ICE candidates for a WebRTC leg.

type IDPayload

type IDPayload struct {
	ID string `json:"id"`
}

IDPayload is a ID payload.

type IPIPTrunkSpec added in v0.9.0

type IPIPTrunkSpec struct {
	// SIP URI of the peer (e.g. "sip:203.0.113.10:5060" or "sips:sbc.carrier.example:5061"). Outbound calls placed through this trunk are routed here: with a loose `Route` header when the call's Request-URI names another host, and with none when it already targets the peer. Transport is taken from the URI: a "sips:" scheme or a ";transport=tls" parameter selects TLS, ";transport=tcp" selects TCP, otherwise UDP. Any user part is ignored. When the host is an IP literal it is also matched against the source of inbound INVITEs.
	PeerURI string `json:"peer_uri"`
	// Next-hop SIP proxy for this trunk's outbound INVITEs and OPTIONS pings. When set, the INVITE carries a single loose `Route` naming the proxy, so the peer is only reached if the call's Request-URI names it. Defaults to `SIP_OUTBOUND_PROXY`; when neither is set, requests go straight to `peer_uri`. A proxy is never treated as an inbound source — list its address in `inbound_sources` if the peer's calls arrive through it.
	OutboundProxy string `json:"outbound_proxy,omitempty"`
	// Optional identity this trunk presents (e.g. "sip:acme@carrier.example"). An outbound call whose `from` matches it, as a full URI or by user-part, is placed through this trunk without naming `trunk_id`; its host becomes the From / P-Asserted-Identity realm when `from` names none. Also used to tell apart several trunks that share an inbound source, by the To header.
	Aor string `json:"aor,omitempty"`
	// Digest auth username for outbound INVITEs the peer challenges. Requires `password`. Defaults to the `aor` user-part when a password is set.
	Username string `json:"username,omitempty"`
	// Digest auth password for outbound INVITEs the peer challenges. Optional — omit for a peer that authenticates by source address. Never returned in any response.
	Password string `json:"password,omitempty"`
	// IP addresses and CIDR ranges (IPv4 or IPv6) that inbound INVITEs from this peer arrive from, e.g. ["198.51.100.0/24", "203.0.113.7"]. An inbound call whose source address falls in one is tagged with this trunk's `trunk_id` and inherits its `app_id`; when several trunks match, the longest prefix wins. This is a matching rule, not an access list: calls from other addresses are still accepted. The `peer_uri` host is included automatically when it is an IP literal; hostnames are never resolved. At most 64 entries; a /0 range is rejected.
	InboundSources []string `json:"inbound_sources,omitempty"`
	// Seconds between OPTIONS health checks sent to the peer; 0 (the default) disables them. With checks on, the trunk's status follows the peer — `active` when it answers, `failed` when it does not — and `sip.trunk_up` / `sip.trunk_down` are published on each change. Any reply counts as up, including 404 or 405, except 408 and 5xx other than 501; no reply within 5 seconds counts as down. With checks off the trunk stays `active`. Status is informational: calls are attempted on a `failed` trunk too.
	OptionsPingIntervalSeconds int `json:"options_ping_interval_seconds,omitempty"`
	// Accept this trunk's next-hop certificate without verifying it, for a `sips:` / `;transport=tls` peer or outbound proxy whose certificate is self-signed or privately signed. Scoped to that peer's hostname — every other TLS peer is still verified in full. Ignored (with a logged warning) when the next hop is not TLS or is named by IP literal; use `SIP_TLS_CA_FILE` or `SIP_TLS_INSECURE_SKIP_VERIFY` there.
	TlsInsecureSkipVerify bool `json:"tls_insecure_skip_verify,omitempty"`
}

IPIPTrunkSpec is a IPIP trunk spec.

type IPIPTrunkView added in v0.9.0

type IPIPTrunkView struct {
	PeerURI                    string   `json:"peer_uri"`
	OutboundProxy              string   `json:"outbound_proxy,omitempty"`
	Aor                        string   `json:"aor,omitempty"`
	Username                   string   `json:"username,omitempty"`
	InboundSources             []string `json:"inbound_sources"`
	OptionsPingIntervalSeconds int      `json:"options_ping_interval_seconds,omitempty"`
	LastPingAt                 string   `json:"last_ping_at,omitempty"`
	LastPingStatusCode         int      `json:"last_ping_status_code,omitempty"`
	TlsInsecureSkipVerify      bool     `json:"tls_insecure_skip_verify,omitempty"`
}

IPIPTrunkView is a IPIP trunk view.

type InstanceStatus added in v1.0.0

type InstanceStatus struct {
	// Instance identifier.
	InstanceID      string `json:"instance_id,omitempty"`
	Status          string `json:"status"`
	Version         string `json:"version,omitempty"`
	UptimeSeconds   int    `json:"uptime_seconds"`
	DrainingSince   string `json:"draining_since,omitempty"`
	DrainSource     string `json:"drain_source,omitempty"`
	ExitWhenDrained bool   `json:"exit_when_drained"`
	DrainDeadline   string `json:"drain_deadline,omitempty"`
	Legs            int    `json:"legs"`
	Rooms           int    `json:"rooms"`
}

InstanceStatus is a instance status.

type Leg

type Leg struct {
	// Instance identifier.
	InstanceID string `json:"instance_id,omitempty"`
	// Unique leg identifier (UUID).
	ID string `json:"id"`
	// Leg type. Covers inbound and outbound legs of every transport; `POST /legs` creates only some of them (see `CreateLegRequest.type`).
	Type LegType `json:"type"`
	// Leg state.
	State LegState `json:"state"`
	// Room ID if the leg is in a room, empty otherwise.
	RoomID string `json:"room_id,omitempty"`
	// Whether the leg is muted (cannot be heard by others).
	Muted bool `json:"muted"`
	// Whether the leg is deaf (cannot hear others).
	Deaf bool `json:"deaf"`
	// Whether the leg receives DTMF digits broadcast from other legs in the same room. Defaults to true.
	AcceptDTMF bool `json:"accept_dtmf"`
	// Whether the call is on hold (SIP legs only).
	Held bool `json:"held"`
	// Routing role used by the room's audio routing matrix (e.g. "customer", "agent", "supervisor"). Empty string means unroled (full mesh).
	Role string `json:"role,omitempty"`
	// Application identifier for event stream filtering.
	AppID string `json:"app_id,omitempty"`
	// Deprecated: X-/P- headers from the inbound INVITE. Only present on sip_inbound legs. Use `headers` for new code; it carries the same map plus surfaces handshake headers for websocket legs.
	SIPHeaders map[string]string `json:"sip_headers,omitempty"`
	// Custom protocol headers exposed by the leg's transport — X-/P- headers from a SIP INVITE, the WebSocket upgrade request, or supplied at outbound dial time. On an inbound INVITE the prefix is matched in any case and names are reported as received.
	Headers map[string]string `json:"headers,omitempty"`
	// Opaque application JSON attached to the leg. Any JSON value is accepted (object, array, string, number, boolean). It is echoed on the leg view and carried at the top level of every event published for this leg, so external state can be correlated without keeping a leg_id lookup table. Capped by CUSTOM_DATA_MAX_BYTES (default 1024 bytes, 0 = unlimited).
	CustomData interface{} `json:"custom_data,omitempty"`
	// The ingress audio filter chain that actually runs for this leg, after applying the server default and dropping any filter whose backing resource is unavailable. Absent when no processing is applied. Compare with the `filters` sent at creation to see what was dropped.
	Filters []FilterSpec `json:"filters,omitempty"`
	// contains filtered or unexported fields
}

Leg is a leg.

func (*Leg) AcceptRTTLeg

func (l *Leg) AcceptRTTLeg(ctx context.Context) (*StatusResponse, error)

AcceptRTTLeg enable RTT reception on a leg

func (*Leg) AcceptTransfer added in v0.11.0

func (l *Leg) AcceptTransfer(ctx context.Context) (*StatusResponse, error)

AcceptTransfer accept a parked inbound REFER

func (*Leg) AddICECandidate

func (l *Leg) AddICECandidate(ctx context.Context, req ICECandidateInit) (*StatusResponse, error)

AddICECandidate send a remote ICE candidate to a WebRTC leg (trickle ICE)

func (*Leg) AddLegStream added in v0.12.1

func (l *Leg) AddLegStream(ctx context.Context, req AddLegStreamRequest) (*LegStreamView, error)

AddLegStream add an audio stream to a live call

func (*Leg) AgentMessage

func (l *Leg) AgentMessage(ctx context.Context, req AgentMessageRequest) (*StatusResponse, error)

AgentMessage inject a message into a running agent session on a leg

func (*Leg) Answer

func (l *Leg) Answer(ctx context.Context, req AnswerLegRequest) (*StatusResponse, error)

Answer answer a ringing or early-media inbound SIP leg (asynchronous)

func (*Leg) AttachLegStreamRoom added in v0.12.1

func (l *Leg) AttachLegStreamRoom(ctx context.Context, streamId string, req AttachStreamRoomRequest) (*LegStreamView, error)

AttachLegStreamRoom mix an audio stream into a room

func (*Leg) ChallengeLeg added in v0.10.0

func (l *Leg) ChallengeLeg(ctx context.Context, req ChallengeRequest) (*StatusResponse, error)

ChallengeLeg challenge a ringing inbound SIP leg with a 401 digest auth request

func (*Leg) CommitTTSLeg added in v0.12.1

func (l *Leg) CommitTTSLeg(ctx context.Context, ttsID string) (*StatusResponse, error)

CommitTTSLeg play a staged TTS utterance

func (*Leg) CompleteTransfer added in v0.11.0

func (l *Leg) CompleteTransfer(ctx context.Context, req TransferCompleteRequest) (*StatusResponse, error)

CompleteTransfer complete an accepted inbound transfer

func (*Leg) DeafLeg added in v0.13.0

func (l *Leg) DeafLeg(ctx context.Context) (*StatusResponse, error)

DeafLeg deafen a leg

func (*Leg) DeclineTransfer added in v0.11.0

func (l *Leg) DeclineTransfer(ctx context.Context, req TransferDeclineRequest) (*StatusResponse, error)

DeclineTransfer decline a parked inbound REFER

func (*Leg) DeepgramAgent

func (l *Leg) DeepgramAgent(ctx context.Context, req DeepgramAgentRequest) (*StatusResponse, error)

DeepgramAgent attach a Deepgram Voice Agent to a leg

func (*Leg) DeepgramAgentSync

func (l *Leg) DeepgramAgentSync(ctx context.Context, req DeepgramAgentRequest) (*StatusResponse, error)

func (*Leg) DeleteLegCustomData added in v0.13.0

func (l *Leg) DeleteLegCustomData(ctx context.Context) (*Leg, error)

DeleteLegCustomData clear a leg's custom data

func (*Leg) DetachLegStreamRoom added in v0.12.1

func (l *Leg) DetachLegStreamRoom(ctx context.Context, streamId string) (*LegStreamView, error)

DetachLegStreamRoom remove an audio stream from its room

func (*Leg) DisableDTMF

func (l *Leg) DisableDTMF(ctx context.Context) (*StatusResponse, error)

DisableDTMF disable DTMF reception on a leg

func (*Leg) DiscardTTSLeg added in v0.12.1

func (l *Leg) DiscardTTSLeg(ctx context.Context, ttsID string) (*StatusResponse, error)

DiscardTTSLeg drop a staged TTS utterance without playing it

func (*Leg) EarlyMedia

func (l *Leg) EarlyMedia(ctx context.Context, req EarlyMediaLegRequest) (*StatusResponse, error)

EarlyMedia enable early media on a ringing inbound SIP leg (asynchronous)

func (*Leg) ElevenLabsAgent

func (l *Leg) ElevenLabsAgent(ctx context.Context, req ElevenLabsAgentRequest) (*StatusResponse, error)

ElevenLabsAgent attach an ElevenLabs ConvAI agent to a leg

func (*Leg) ElevenLabsAgentSync

func (l *Leg) ElevenLabsAgentSync(ctx context.Context, req ElevenLabsAgentRequest) (*StatusResponse, error)

func (*Leg) EnableDTMF

func (l *Leg) EnableDTMF(ctx context.Context) (*StatusResponse, error)

EnableDTMF enable DTMF reception on a leg

func (*Leg) FinalizeSTTLeg added in v0.12.1

func (l *Leg) FinalizeSTTLeg(ctx context.Context) (*StatusResponse, error)

FinalizeSTTLeg flush the STT buffer on a leg without stopping STT

func (*Leg) GetICECandidates

func (l *Leg) GetICECandidates(ctx context.Context) (*ICECandidatesResponse, error)

GetICECandidates get server-side ICE candidates for a WebRTC leg (trickle ICE)

func (*Leg) GetLegStream added in v0.12.1

func (l *Leg) GetLegStream(ctx context.Context, streamId string) (*LegStreamView, error)

GetLegStream get one of a leg's audio streams

func (*Leg) GetSIPRECSession added in v0.12.1

func (l *Leg) GetSIPRECSession(ctx context.Context) (*SIPRECSessionView, error)

GetSIPRECSession get a SIPREC recording session

func (*Leg) Hangup

func (l *Leg) Hangup(ctx context.Context, req DeleteLegRequest) (*StatusResponse, error)

Hangup hang up a leg (asynchronous)

func (*Leg) Hold

func (l *Leg) Hold(ctx context.Context) (*StatusResponse, error)

Hold put a SIP call on hold (asynchronous)

func (*Leg) ListLegStreams added in v0.12.1

func (l *Leg) ListLegStreams(ctx context.Context) ([]LegStreamView, error)

ListLegStreams list a leg's audio streams

func (*Leg) Mute

func (l *Leg) Mute(ctx context.Context) (*StatusResponse, error)

Mute mute a leg

func (*Leg) PauseRecord

func (l *Leg) PauseRecord(ctx context.Context) (*StatusResponse, error)

PauseRecord pause a leg recording

func (*Leg) PipecatAgent

func (l *Leg) PipecatAgent(ctx context.Context, req PipecatAgentRequest) (*StatusResponse, error)

PipecatAgent attach a Pipecat bot to a leg

func (*Leg) PipecatAgentSync

func (l *Leg) PipecatAgentSync(ctx context.Context, req PipecatAgentRequest) (*StatusResponse, error)

func (*Leg) Play

func (l *Leg) Play(ctx context.Context, req PlaybackRequest) (*PlaybackResponse, error)

Play start audio playback to a leg

func (*Leg) PlaySync

func (l *Leg) PlaySync(ctx context.Context, req PlaybackRequest) (*PlaybackResponse, error)

PlaySync starts a playback on the leg and blocks until playback.finished (or playback.error) arrives for the response's PlaybackID, or ctx cancels.

func (*Leg) PlayTTS

func (l *Leg) PlayTTS(ctx context.Context, req TTSRequest) (*TTSResponse, error)

PlayTTS synthesize speech and play it on a leg

func (*Leg) PlayTTSSync

func (l *Leg) PlayTTSSync(ctx context.Context, req TTSRequest) (*TTSResponse, error)

PlayTTSSync issues a TTS prompt and blocks until tts.finished (or tts.error) arrives for the response's TTSID, or ctx cancels.

func (*Leg) PreflightTTSLeg added in v0.12.1

func (l *Leg) PreflightTTSLeg(ctx context.Context, req TTSRequest) (*StatusResponse, error)

PreflightTTSLeg synthesize speech and hold it for a later commit

func (*Leg) Record

func (l *Leg) Record(ctx context.Context, req RecordingRequest) (*RecordingResponse, error)

Record start recording a leg to a WAV file

func (*Leg) RecordSync

func (l *Leg) RecordSync(ctx context.Context, req RecordingRequest) (*RecordingResponse, error)

RecordSync starts a recording on the leg and blocks until recording.finished arrives, or ctx cancels. Recording typically ends when StopRecord is called or the leg disconnects, whichever comes first. Note: the spec doesn't carry a recording-ID on either the response or the event, so this matches by leg-scope only — only one recording per leg can be in flight.

func (*Leg) RejectRTTLeg

func (l *Leg) RejectRTTLeg(ctx context.Context) (*StatusResponse, error)

RejectRTTLeg disable RTT reception on a leg

func (*Leg) RemoveLegStream added in v0.12.1

func (l *Leg) RemoveLegStream(ctx context.Context, streamId string) (*StatusResponse, error)

RemoveLegStream remove an audio stream from a live call

func (*Leg) RestartICE added in v0.15.0

func (l *Leg) RestartICE(ctx context.Context, req WebRTCICERestartRequest) (*WebRTCOfferResult, error)

RestartICE restart ICE on a WebRTC leg

func (*Leg) ResumeRecord

func (l *Leg) ResumeRecord(ctx context.Context) (*StatusResponse, error)

ResumeRecord resume a paused leg recording

func (*Leg) Ring

func (l *Leg) Ring(ctx context.Context, req RingLegRequest) (*StatusResponse, error)

Ring send 180 Ringing on a ringing inbound SIP leg (asynchronous)

func (*Leg) STT

func (l *Leg) STT(ctx context.Context, req STTRequest) (*StatusResponse, error)

STT start real-time speech-to-text on a leg

func (*Leg) SendDTMF

func (l *Leg) SendDTMF(ctx context.Context, req DTMFRequest) (*StatusResponse, error)

SendDTMF send DTMF digits on a leg

func (*Leg) SendRTT

func (l *Leg) SendRTT(ctx context.Context, req RTTRequest) (*StatusResponse, error)

SendRTT send Real-Time Text (T.140) on a SIP leg

func (*Leg) SetLegCustomData added in v0.13.0

func (l *Leg) SetLegCustomData(ctx context.Context, req SetLegCustomDataRequest) (*Leg, error)

SetLegCustomData replace a leg's custom data

func (*Leg) SetLegFilters added in v0.15.0

func (l *Leg) SetLegFilters(ctx context.Context, req SetLegFiltersRequest) (*Leg, error)

SetLegFilters replace a leg's audio filter chain

func (*Leg) SetRole

func (l *Leg) SetRole(ctx context.Context, req SetLegRoleRequest) (*Leg, error)

SetRole change a leg's routing role

func (*Leg) StartAMD

func (l *Leg) StartAMD(ctx context.Context, req AMDParams) (*StatusResponse, error)

StartAMD start answering machine detection on a connected leg

func (*Leg) StartLegSIPREC added in v0.12.1

func (l *Leg) StartLegSIPREC(ctx context.Context, req StartSIPRECRequest) (*Leg, error)

StartLegSIPREC fork a single call to an external SIPREC recording server

func (*Leg) StopAgent

func (l *Leg) StopAgent(ctx context.Context) (*StatusResponse, error)

StopAgent detach the agent from a leg

func (*Leg) StopPlay

func (l *Leg) StopPlay(ctx context.Context, playbackID string) (*StatusResponse, error)

StopPlay stop audio playback on a leg

func (*Leg) StopRecord

func (l *Leg) StopRecord(ctx context.Context) (*RecordingResponse, error)

StopRecord stop recording a leg

func (*Leg) StopSTT

func (l *Leg) StopSTT(ctx context.Context) (*StatusResponse, error)

StopSTT stop speech-to-text on a leg

func (*Leg) Subscribe

func (l *Leg) Subscribe(types ...WebhookEventType) *Subscription

Subscribe returns a Subscription that receives every event scoped to this leg (matched by leg_id). If one or more event types are passed, only events with those types are delivered. Pass no types to receive all leg-scoped events.

Requires an event source feeding the client's hub — start one via Client.RunEventStream (WebSocket VSI) or call Client.DeliverEvent for each event your webhook handler receives.

sub := leg.Subscribe(voiceblender.EventDTMFReceived)
defer sub.Close()
for ev := range sub.Events() {
    if d, ok := ev.(*voiceblender.DTMFReceivedEvent); ok { ... }
}

func (*Leg) Transfer

func (l *Leg) Transfer(ctx context.Context, req TransferRequest) (*StatusResponse, error)

Transfer transfer a SIP leg via REFER (asynchronous)

func (*Leg) TransferProgress added in v0.11.0

func (l *Leg) TransferProgress(ctx context.Context, req TransferProgressRequest) (*StatusResponse, error)

TransferProgress report interim transfer progress

func (*Leg) UndeafLeg added in v0.13.0

func (l *Leg) UndeafLeg(ctx context.Context) (*StatusResponse, error)

UndeafLeg undeafen a leg

func (*Leg) Unhold

func (l *Leg) Unhold(ctx context.Context) (*StatusResponse, error)

Unhold resume a held SIP call (asynchronous)

func (*Leg) Unmute

func (l *Leg) Unmute(ctx context.Context) (*StatusResponse, error)

Unmute unmute a leg

func (*Leg) UpdateLegStream added in v0.12.1

func (l *Leg) UpdateLegStream(ctx context.Context, streamId string, req UpdateLegStreamRequest) (*LegStreamView, error)

UpdateLegStream change an audio stream's routing role

func (*Leg) VAPIAgent

func (l *Leg) VAPIAgent(ctx context.Context, req VAPIAgentRequest) (*StatusResponse, error)

VAPIAgent attach a VAPI agent to a leg

func (*Leg) VAPIAgentSync

func (l *Leg) VAPIAgentSync(ctx context.Context, req VAPIAgentRequest) (*StatusResponse, error)

func (*Leg) VolumePlay

func (l *Leg) VolumePlay(ctx context.Context, playbackID string, req VolumeRequest) (*StatusResponse, error)

VolumePlay change the volume of an active leg playback

type LegAMDStartPayload

type LegAMDStartPayload struct {
	ID                    string `json:"id"`
	InitialSilenceTimeout int    `json:"initial_silence_timeout,omitempty"`
	GreetingDuration      int    `json:"greeting_duration,omitempty"`
	AfterGreetingSilence  int    `json:"after_greeting_silence,omitempty"`
	TotalAnalysisTime     int    `json:"total_analysis_time,omitempty"`
	MinimumWordLength     int    `json:"minimum_word_length,omitempty"`
	BeepTimeout           int    `json:"beep_timeout,omitempty"`
}

LegAMDStartPayload is a leg AMD start payload.

type LegCommandFailedEvent

type LegCommandFailedEvent struct {
	Event
	LegID   string `json:"leg_id,omitempty"`
	AppID   string `json:"app_id,omitempty"`
	Command string `json:"command,omitempty"`
	Error   string `json:"error,omitempty"`
}

LegCommandFailedEvent is fired when: an asynchronous leg command (202 Accepted) failed during execution

type LegConnectedEvent

type LegConnectedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Leg type (e.g. sip_inbound, sip_outbound, webrtc).
	LegType string `json:"leg_type,omitempty"`
}

LegConnectedEvent is fired when: leg answered/connected

type LegDeafEvent

type LegDeafEvent struct {
	Event
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
}

LegDeafEvent is fired when: leg deafened (stops receiving room audio)

type LegDisconnectedEvent

type LegDisconnectedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	Cdr   struct {
		// Disconnect reason. Common SIP failures are mapped to named reasons; unmapped 4xx/5xx/6xx codes appear as sip_{code}. This is an open set — treat an unrecognized value as a new reason rather than an error. Known values: api_hangup, room_deleted, remote_bye, caller_cancel, max_duration, session_expired, rtp_timeout, busy, declined, rejected, unavailable, not_found, forbidden, server_error, ring_timeout, unauthorized, timeout, cancelled, not_acceptable, service_unavailable, invite_failed, connect_failed, challenged, transfer_completed, transfer_originate_failed, transfer_connect_failed, bad_answer, siprec_answer_failed, mixer_panic, hangup, peer_slow, connection_reset, ws_error, ws_dial_failed, moq_error, ice_failure, ice_failed, ice_disconnected, peer_closed, dtls_failed, livekit_client_initiated, livekit_duplicate_identity, livekit_server_shutdown, livekit_kicked, livekit_room_deleted, livekit_state_mismatch, livekit_join_failure, livekit_migration, livekit_signal_close, livekit_room_closed, livekit_user_unavailable, livekit_user_rejected, livekit_token_expired, livekit_media_failure, livekit_disconnected, livekit_client_closed, livekit_signal_closed, livekit_signal_error, livekit_pc_setup_failed, livekit_add_track_failed, livekit_publisher_failed, livekit_subscriber_failed, livekit_signal_loop_exit, livekit_set_remote_desc_failed, livekit_create_answer_failed, livekit_set_local_desc_failed, livekit_signal_send_failed, livekit_set_publisher_remote_failed, livekit_participant_left.
		Reason string `json:"reason"`
		// Seconds from leg creation to disconnect.
		DurationTotal float64 `json:"duration_total"`
		// Seconds from answer to disconnect (0 if never answered).
		DurationAnswered float64 `json:"duration_answered"`
	} `json:"cdr,omitempty"`
	// RTP quality metrics. Omitted for WebRTC legs or unanswered legs with no media.
	Quality *struct {
		// Mean Opinion Score (1.0–5.0) estimated via simplified E-model (ITU-T G.107) from packet loss and jitter.
		MosScore float64 `json:"mos_score"`
		// Total inbound RTP audio packets received.
		RtpPacketsReceived int `json:"rtp_packets_received"`
		// Estimated lost packets based on sequence number gaps.
		RtpPacketsLost int `json:"rtp_packets_lost"`
		// Inter-arrival jitter in milliseconds (RFC 3550 §A.8).
		RtpJitterMs float64 `json:"rtp_jitter_ms"`
	} `json:"quality,omitempty"`
}

LegDisconnectedEvent is fired when: leg hung up (CDR-style nested structure)

type LegEarlyMediaEvent

type LegEarlyMediaEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Leg type (e.g. sip_outbound).
	LegType string `json:"leg_type,omitempty"`
}

LegEarlyMediaEvent is fired when: outbound leg received 183 Session Progress with SDP; media pipeline active

type LegHoldEvent

type LegHoldEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Hold direction: "local" (we put them on hold) or "remote" (they put us on hold).
	LegType string `json:"leg_type,omitempty"`
}

LegHoldEvent is fired when: leg put on hold (local or remote)

type LegICEInterruptedEvent added in v0.15.0

type LegICEInterruptedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Leg type; always "webrtc".
	LegType string `json:"leg_type,omitempty"`
}

LegICEInterruptedEvent is fired when: webRTC leg lost ICE connectivity; the leg is kept so the peer can restart ICE

type LegICERestoredEvent added in v0.15.0

type LegICERestoredEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Leg type; always "webrtc".
	LegType string `json:"leg_type,omitempty"`
}

LegICERestoredEvent is fired when: webRTC leg regained ICE connectivity after leg.ice_interrupted

type LegJoinedRoomEvent

type LegJoinedRoomEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
}

LegJoinedRoomEvent is fired when: leg added to a room

type LegLeftRoomEvent

type LegLeftRoomEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
}

LegLeftRoomEvent is fired when: leg removed from a room

type LegMutedEvent

type LegMutedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
}

LegMutedEvent is fired when: leg muted

type LegRingingEvent

type LegRingingEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Leg type (e.g. sip_inbound, sip_outbound).
	LegType string `json:"leg_type,omitempty"`
	// Dialed SIP URI (outbound only).
	URI string `json:"uri,omitempty"`
	// Caller URI (inbound) or From header value (outbound, if set).
	From string `json:"from,omitempty"`
	// Callee URI (inbound only).
	To string `json:"to,omitempty"`
	// X-/P- custom SIP headers (matched in any case, keyed as received), if present.
	SIPHeaders    map[string]string `json:"sip_headers,omitempty"`
	OfferedCodecs []OfferedCodec    `json:"offered_codecs,omitempty"`
	TrunkID       string            `json:"trunk_id,omitempty"`
	SourceAddress string            `json:"source_address,omitempty"`
	Authenticated bool              `json:"authenticated,omitempty"`
	AuthUsername  string            `json:"auth_username,omitempty"`
}

LegRingingEvent is fired when: sIP call ringing (inbound or outbound)

type LegRoleChangedEvent

type LegRoleChangedEvent struct {
	Event
	LegID   string `json:"leg_id,omitempty"`
	RoomID  string `json:"room_id,omitempty"`
	AppID   string `json:"app_id,omitempty"`
	OldRole string `json:"old_role,omitempty"`
	NewRole string `json:"new_role,omitempty"`
}

LegRoleChangedEvent is fired when: a leg's routing role changed

type LegState

type LegState string

LegState is the current state of a leg.

const (
	// LegStatePending is the "pending" LegState value.
	LegStatePending LegState = "pending"
	// LegStateRinging is the "ringing" LegState value.
	LegStateRinging LegState = "ringing"
	// LegStateEarlyMedia is the "early_media" LegState value.
	LegStateEarlyMedia LegState = "early_media"
	// LegStateConnected is the "connected" LegState value.
	LegStateConnected LegState = "connected"
	// LegStateHeld is the "held" LegState value.
	LegStateHeld LegState = "held"
	// LegStateHungUp is the "hung_up" LegState value.
	LegStateHungUp LegState = "hung_up"
)

type LegStreamAddPayload added in v0.12.1

type LegStreamAddPayload struct {
	LegID     string `json:"leg_id"`
	Direction string `json:"direction,omitempty"`
	Lang      string `json:"lang,omitempty"`
	Content   string `json:"content,omitempty"`
	Label     string `json:"label,omitempty"`
	RoomID    string `json:"room_id,omitempty"`
	Role      string `json:"role,omitempty"`
}

LegStreamAddPayload is a leg stream add payload.

type LegStreamAddedEvent added in v0.12.1

type LegStreamAddedEvent struct {
	Event
	LegID     string `json:"leg_id,omitempty"`
	AppID     string `json:"app_id,omitempty"`
	StreamID  string `json:"stream_id,omitempty"`
	Mid       string `json:"mid,omitempty"`
	Direction string `json:"direction,omitempty"`
	Lang      string `json:"lang,omitempty"`
	RoomID    string `json:"room_id,omitempty"`
	Role      string `json:"role,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

LegStreamAddedEvent is fired when: an additional m=audio stream was negotiated on a live dialog

type LegStreamFailedEvent added in v0.12.1

type LegStreamFailedEvent struct {
	Event
	LegID     string `json:"leg_id,omitempty"`
	AppID     string `json:"app_id,omitempty"`
	StreamID  string `json:"stream_id,omitempty"`
	Mid       string `json:"mid,omitempty"`
	Direction string `json:"direction,omitempty"`
	Lang      string `json:"lang,omitempty"`
	RoomID    string `json:"room_id,omitempty"`
	Role      string `json:"role,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

LegStreamFailedEvent is fired when: an audio stream's media loop failed and the stream was torn down; the call continues on its remaining streams

type LegStreamPayload added in v0.12.1

type LegStreamPayload struct {
	LegID    string `json:"leg_id"`
	StreamID string `json:"stream_id"`
}

LegStreamPayload is a leg stream payload.

type LegStreamRejectedEvent added in v0.12.1

type LegStreamRejectedEvent struct {
	Event
	LegID     string `json:"leg_id,omitempty"`
	AppID     string `json:"app_id,omitempty"`
	StreamID  string `json:"stream_id,omitempty"`
	Mid       string `json:"mid,omitempty"`
	Direction string `json:"direction,omitempty"`
	Lang      string `json:"lang,omitempty"`
	RoomID    string `json:"room_id,omitempty"`
	Role      string `json:"role,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

LegStreamRejectedEvent is fired when: the peer refused an additional audio stream, or it could not be negotiated; the call is unaffected

type LegStreamRemovedEvent added in v0.12.1

type LegStreamRemovedEvent struct {
	Event
	LegID     string `json:"leg_id,omitempty"`
	AppID     string `json:"app_id,omitempty"`
	StreamID  string `json:"stream_id,omitempty"`
	Mid       string `json:"mid,omitempty"`
	Direction string `json:"direction,omitempty"`
	Lang      string `json:"lang,omitempty"`
	RoomID    string `json:"room_id,omitempty"`
	Role      string `json:"role,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

LegStreamRemovedEvent is fired when: an audio stream was disabled with a port-0 re-INVITE; its m-line slot survives as a tombstone

type LegStreamRoleChangedEvent added in v0.12.1

type LegStreamRoleChangedEvent struct {
	Event
	LegID     string `json:"leg_id,omitempty"`
	AppID     string `json:"app_id,omitempty"`
	StreamID  string `json:"stream_id,omitempty"`
	Mid       string `json:"mid,omitempty"`
	Direction string `json:"direction,omitempty"`
	Lang      string `json:"lang,omitempty"`
	RoomID    string `json:"room_id,omitempty"`
	Role      string `json:"role,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

LegStreamRoleChangedEvent is fired when: an audio stream's routing role changed; the room's allow-sets were recomputed atomically

type LegStreamRoomChangedEvent added in v0.12.1

type LegStreamRoomChangedEvent struct {
	Event
	LegID     string `json:"leg_id,omitempty"`
	AppID     string `json:"app_id,omitempty"`
	StreamID  string `json:"stream_id,omitempty"`
	Mid       string `json:"mid,omitempty"`
	Direction string `json:"direction,omitempty"`
	Lang      string `json:"lang,omitempty"`
	RoomID    string `json:"room_id,omitempty"`
	Role      string `json:"role,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

LegStreamRoomChangedEvent is fired when: an audio stream was attached to or detached from a room (an empty room_id means detached)

type LegStreamRoomPayload added in v0.12.1

type LegStreamRoomPayload struct {
	LegID    string `json:"leg_id"`
	StreamID string `json:"stream_id"`
	RoomID   string `json:"room_id"`
	Role     string `json:"role,omitempty"`
}

LegStreamRoomPayload is a leg stream room payload.

type LegStreamUpdatePayload added in v0.12.1

type LegStreamUpdatePayload struct {
	LegID    string `json:"leg_id"`
	StreamID string `json:"stream_id"`
	Role     string `json:"role,omitempty"`
}

LegStreamUpdatePayload is a leg stream update payload.

type LegStreamView added in v0.12.1

type LegStreamView struct {
	// Stream identifier, stable for the life of the dialog. The primary stream is always "0".
	ID string `json:"id"`
	// The stream's SDP a=mid token (RFC 5888), used to correlate it across offer/answer.
	Mid string `json:"mid,omitempty"`
	// Position of the stream's m= line in the SDP. Fixed for the life of the dialog (RFC 3264 §8).
	Index int `json:"index"`
	// True for the call's main bidirectional audio stream, which cannot be removed or attached to a room independently.
	Primary bool `json:"primary"`
	// Negotiation state.
	State string `json:"state"`
	// Negotiated media direction from this server's point of view.
	Direction string `json:"direction"`
	// Direction requested by the application. Survives hold/unhold, unlike the negotiated direction.
	DesiredDirection string `json:"desired_direction,omitempty"`
	// Codec the stream's media pipeline is actually running, which after a mid-call re-INVITE is the renegotiated one. Streams on one leg may use different codecs.
	Codec string `json:"codec,omitempty"`
	// Native sample rate of the codec the stream is running, in Hz. It follows a mid-call codec renegotiation.
	SampleRate int `json:"sample_rate,omitempty"`
	// Local RTP port. Each stream binds its own port; a shared transport is undefined without BUNDLE (RFC 9143).
	LocalPort int `json:"local_port,omitempty"`
	// Remote RTP address media is currently sent to.
	RemoteAddr string `json:"remote_addr,omitempty"`
	// True while the stream's media is encrypted with SDES-SRTP (RFC 4568). Omitted for plain RTP, and for an added stream until the peer has answered it.
	Srtp bool `json:"srtp,omitempty"`
	// The stream's a=label value (RFC 4574), for correlating it with external metadata.
	Label string `json:"label,omitempty"`
	// The stream's a=content value (RFC 4796), e.g. "main" for original audio and "alt" for a translated feed.
	Content string `json:"content,omitempty"`
	// The stream's a=lang value (RFC 8866): a BCP 47 language tag such as "en" or "es-ES".
	Lang string `json:"lang,omitempty"`
	// Room this stream's audio is mixed into. A secondary stream may sit in a different room than its leg.
	RoomID string `json:"room_id,omitempty"`
	// Routing role of this stream within its room. Streams carry their own role, independent of their leg's.
	Role string `json:"role,omitempty"`
}

LegStreamView is a leg stream view.

type LegTransferCompletedEvent

type LegTransferCompletedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Final 2xx SIP status from the NOTIFY sipfrag.
	StatusCode int `json:"status_code,omitempty"`
	// Reason phrase.
	Reason string `json:"reason,omitempty"`
}

LegTransferCompletedEvent is fired when: transfer reached terminal 2xx

type LegTransferFailedEvent

type LegTransferFailedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Final non-2xx SIP status (when applicable).
	StatusCode int `json:"status_code,omitempty"`
	// Reason phrase.
	Reason string `json:"reason,omitempty"`
	// Local error message (when no SIP status applies).
	Error string `json:"error,omitempty"`
}

LegTransferFailedEvent is fired when: transfer failed (REFER rejected, sipfrag non-2xx, or local error)

type LegTransferInitiatedEvent

type LegTransferInitiatedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Transfer kind: "blind" or "attended".
	Kind string `json:"kind,omitempty"`
	// SIP URI to which the leg is being transferred.
	Target string `json:"target,omitempty"`
	// Leg whose dialog is replaced (attended transfer only).
	ReplacesLegID string `json:"replaces_leg_id,omitempty"`
}

LegTransferInitiatedEvent is fired when: we sent a SIP REFER (transfer initiated by the operator)

type LegTransferProgressEvent

type LegTransferProgressEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Provisional SIP status from the NOTIFY sipfrag.
	StatusCode int `json:"status_code,omitempty"`
	// Reason phrase.
	Reason string `json:"reason,omitempty"`
}

LegTransferProgressEvent is fired when: transfer progress reported via NOTIFY sipfrag

type LegTransferRequestedEvent

type LegTransferRequestedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Transfer kind: "blind" or "attended".
	Kind string `json:"kind,omitempty"`
	// SIP URI requested by the peer.
	Target string `json:"target,omitempty"`
	// Call-ID present in the Refer-To Replaces parameter (attended only).
	ReplacesCallID string `json:"replaces_call_id,omitempty"`
	// Vestigial (always false); retained for wire compatibility. The outcome now flows via leg.transfer_completed / leg.transfer_failed after the app decides.
	Declined bool `json:"declined,omitempty"`
}

LegTransferRequestedEvent is fired when: we received a SIP REFER from the peer; decide via accept_transfer/decline_transfer (unless SIP_REFER_AUTO_DIAL=true)

type LegType

type LegType string

LegType identifies the type of a voice leg.

const (
	// LegTypeSIPInbound is the "sip_inbound" LegType value.
	LegTypeSIPInbound LegType = "sip_inbound"
	// LegTypeSIPOutbound is the "sip_outbound" LegType value.
	LegTypeSIPOutbound LegType = "sip_outbound"
	// LegTypeWebRTC is the "webrtc" LegType value.
	LegTypeWebRTC LegType = "webrtc"
	// LegTypeWhatsappIn is the "whatsapp_in" LegType value.
	LegTypeWhatsappIn LegType = "whatsapp_in"
	// LegTypeWhatsappOut is the "whatsapp_out" LegType value.
	LegTypeWhatsappOut LegType = "whatsapp_out"
	// LegTypeWebsocketIn is the "websocket_in" LegType value.
	LegTypeWebsocketIn LegType = "websocket_in"
	// LegTypeWebsocketOut is the "websocket_out" LegType value.
	LegTypeWebsocketOut LegType = "websocket_out"
	// LegTypeMoqIn is the "moq_in" LegType value.
	LegTypeMoqIn LegType = "moq_in"
	// LegTypeLivekitPublish is the "livekit_publish" LegType value.
	LegTypeLivekitPublish LegType = "livekit_publish"
	// LegTypeLivekitParticipant is the "livekit_participant" LegType value.
	LegTypeLivekitParticipant LegType = "livekit_participant"
)

type LegUndeafEvent

type LegUndeafEvent struct {
	Event
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
}

LegUndeafEvent is fired when: leg undeafened (resumes receiving room audio)

type LegUnholdEvent

type LegUnholdEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// Hold direction: "local" or "remote".
	LegType string `json:"leg_type,omitempty"`
}

LegUnholdEvent is fired when: leg taken off hold (local or remote)

type LegUnmutedEvent

type LegUnmutedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
}

LegUnmutedEvent is fired when: leg unmuted

type LiveKitParams added in v0.12.1

type LiveKitParams struct {
	// LiveKit server endpoint (wss://...). Overrides LIVEKIT_URL.
	URL string `json:"url,omitempty"`
	// Pre-signed LiveKit JWT. Mutually exclusive with `room`/`identity` (mint mode); if both are present the token wins.
	Token string `json:"token,omitempty"`
	// LiveKit room name. Required when minting (i.e. `token` is empty AND LIVEKIT_TOKEN_SIGNING_ENABLED=true).
	Room string `json:"room,omitempty"`
	// LiveKit participant identity. Required when minting.
	Identity string `json:"identity,omitempty"`
	// Display name for the participant; surfaces in LK Room UIs.
	ParticipantName string `json:"participant_name,omitempty"`
	// LiveKit grant flags. Nil pointers default to publish=true, subscribe=true, data=false, admin=false.
	Permissions interface{} `json:"permissions,omitempty"`
	// Go duration string (e.g. "30m", "6h"). Used only when minting. Defaults to LIVEKIT_DEFAULT_TOKEN_TTL (6h).
	TokenTtl string `json:"token_ttl,omitempty"`
	// Override LIVEKIT_OPUS_BITRATE for this leg. 6000..510000.
	OpusBitrate int `json:"opus_bitrate,omitempty"`
}

LiveKitParams is a live kit params.

type LiveKitPermissions added in v0.12.1

type LiveKitPermissions struct {
	// Allow publishing tracks. Default true.
	CanPublish bool `json:"can_publish,omitempty"`
	// Allow subscribing to remote tracks. Default true.
	CanSubscribe bool `json:"can_subscribe,omitempty"`
	// Allow publishing data channel messages. Default false (audio bridge does not use data).
	CanPublishData bool `json:"can_publish_data,omitempty"`
	// Grant admin actions on the room (e.g., server-side MuteTrack of remote participants). Default false.
	RoomAdmin bool `json:"room_admin,omitempty"`
}

LiveKitPermissions is a live kit permissions.

type OfferedCodec

type OfferedCodec struct {
	Name        string `json:"name"`
	PayloadType int    `json:"payload_type"`
	ClockRate   int    `json:"clock_rate"`
	Priority    int    `json:"priority"`
}

OfferedCodec is a offered codec.

type Option

type Option func(*Client)

Option configures a Client.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL sets the API base URL (default: http://localhost:8080/v1).

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient replaces the default HTTP client.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the HTTP client timeout.

type ParticipantInfo added in v0.12.1

type ParticipantInfo struct {
	ID   string `json:"id"`
	Aor  string `json:"aor,omitempty"`
	Name string `json:"name,omitempty"`
}

ParticipantInfo is a participant info.

type PipecatAgentRequest

type PipecatAgentRequest struct {
	// WebSocket URL of the Pipecat bot (e.g. ws://my-bot:8765).
	WebsocketURL string `json:"websocket_url"`
}

PipecatAgentRequest is a pipecat agent request.

type PlaybackErrorEvent

type PlaybackErrorEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// Playback identifier.
	PlaybackID string `json:"playback_id,omitempty"`
	// Error message.
	Error string `json:"error,omitempty"`
}

PlaybackErrorEvent is fired when: playback failed

type PlaybackFinishedEvent

type PlaybackFinishedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// Playback identifier.
	PlaybackID string `json:"playback_id,omitempty"`
	// Why playback ended: 'completed' (reached the end of the audio) or 'stopped' (did not reach the end, for any reason).
	Reason string `json:"reason,omitempty"`
	// Milliseconds of audio actually played, accumulated across repeat iterations.
	PlayedMs int `json:"played_ms,omitempty"`
}

PlaybackFinishedEvent is fired when: playback ended

type PlaybackRequest

type PlaybackRequest struct {
	Repeat int `json:"repeat,omitempty"`
	Volume int `json:"volume,omitempty"`
	// contains filtered or unexported fields
}

PlaybackRequest plays audio on a leg or room. Use PlayURL or PlayTone constructors — url and tone are mutually exclusive.

func PlayTone

func PlayTone(tone string) PlaybackRequest

PlayTone returns a PlaybackRequest that generates a named telephone tone. Format: {country}_{type} or bare {type} (defaults to US). Examples: us_ringback, gb_busy, dial.

func PlayURL

func PlayURL(url, mimeType string) PlaybackRequest

PlayURL returns a PlaybackRequest that streams audio from url.

func (PlaybackRequest) MarshalJSON

func (p PlaybackRequest) MarshalJSON() ([]byte, error)

MarshalJSON encodes PlaybackRequest, choosing url or tone as appropriate.

type PlaybackResponse

type PlaybackResponse struct {
	InstanceID string `json:"instance_id,omitempty"`
	PlaybackID string `json:"playback_id"`
	Status     string `json:"status"`
}

PlaybackResponse is returned when audio playback is started on a leg or room.

type PlaybackStartPayload

type PlaybackStartPayload struct {
	ID       string `json:"id"`
	URL      string `json:"url"`
	Tone     string `json:"tone"`
	MimeType string `json:"mime_type"`
	Repeat   int    `json:"repeat"`
	Volume   int    `json:"volume"`
}

PlaybackStartPayload is a playback start payload.

type PlaybackStartResult

type PlaybackStartResult struct {
	PlaybackID string `json:"playback_id"`
	Status     string `json:"status"`
}

PlaybackStartResult is a playback start result.

type PlaybackStartedEvent

type PlaybackStartedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// Playback identifier.
	PlaybackID string `json:"playback_id,omitempty"`
}

PlaybackStartedEvent is fired when: playback began

type PlaybackStopResult

type PlaybackStopResult struct {
	Status string `json:"status"`
}

PlaybackStopResult is a playback stop result.

type PlaybackTargetPayload

type PlaybackTargetPayload struct {
	ID         string `json:"id"`
	PlaybackID string `json:"playback_id"`
}

PlaybackTargetPayload is a playback target payload.

type PlaybackVolumePayload

type PlaybackVolumePayload struct {
	ID         string `json:"id"`
	PlaybackID string `json:"playback_id"`
	Volume     int    `json:"volume"`
}

PlaybackVolumePayload is a playback volume payload.

type ProgressTransferPayload added in v0.11.0

type ProgressTransferPayload struct {
	ID         string `json:"id"`
	StatusCode int    `json:"status_code"`
	Reason     string `json:"reason,omitempty"`
}

ProgressTransferPayload is a progress transfer payload.

type RTTPayload

type RTTPayload struct {
	ID   string `json:"id"`
	Text string `json:"text"`
}

RTTPayload is a RTT payload.

type RTTReceivedEvent

type RTTReceivedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	AppID string `json:"app_id,omitempty"`
	// UTF-8 text chunk received from the remote.
	Text string `json:"text,omitempty"`
	// Per-leg monotonic sequence (independent of RTP sequence numbers).
	Seq int `json:"seq,omitempty"`
	// True when a U+FFFD has been prepended to indicate text was lost beyond what RFC 2198 redundancy could recover.
	LossMarker bool `json:"loss_marker,omitempty"`
}

RTTReceivedEvent is fired when: real-Time Text (T.140 / RFC 4103) chunk received from the remote

type RTTRequest

type RTTRequest struct {
	// UTF-8 text to send. May be one or more characters and may include T.140 control codes (e.g. backspace U+0008, CR/LF).
	Text string `json:"text"`
}

RTTRequest is a RTT request.

type RecordStartPayload

type RecordStartPayload struct {
	ID                  string `json:"id"`
	Storage             string `json:"storage"`
	MultiChannel        bool   `json:"multi_channel"`
	S3Bucket            string `json:"s3_bucket"`
	S3Region            string `json:"s3_region"`
	S3Endpoint          string `json:"s3_endpoint"`
	S3Prefix            string `json:"s3_prefix"`
	S3AccessKey         string `json:"s3_access_key"`
	S3SecretKey         string `json:"s3_secret_key"`
	GcsBucket           string `json:"gcs_bucket"`
	GcsObjectNamePrefix string `json:"gcs_object_name_prefix"`
	Filename            string `json:"filename"`
}

RecordStartPayload is a record start payload.

type RecordingFinishedEvent

type RecordingFinishedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// Recording file path or S3 URI.
	File             string                 `json:"file,omitempty"`
	MultiChannelFile string                 `json:"multi_channel_file,omitempty"`
	Channels         map[string]ChannelInfo `json:"channels,omitempty"`
	// Participants whose audio is missing from multi_channel_file because their capture failed. Absent when the recording is complete.
	OmittedLegs []string `json:"omitted_legs,omitempty"`
}

RecordingFinishedEvent is fired when: recording ended

type RecordingPauseResumeResult

type RecordingPauseResumeResult struct {
	Status string `json:"status"`
}

RecordingPauseResumeResult is a recording pause resume result.

type RecordingPausedEvent

type RecordingPausedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	File   string `json:"file,omitempty"`
}

RecordingPausedEvent is fired when: recording paused (audio replaced with silence)

type RecordingRequest

type RecordingRequest struct {
	// "file" (default) — local disk, "s3" — upload to S3 after recording stops, "gcs" — upload to Google Cloud Storage via the native GCS API (Application Default Credentials / Workload Identity).
	Storage string `json:"storage"`
	// When true, record each participant to a separate mono WAV file in addition to the full mix. Only applies to room recordings.
	MultiChannel bool `json:"multi_channel"`
	// S3 bucket name. Overrides S3_BUCKET env var. Required if env var is not set.
	S3Bucket string `json:"s3_bucket"`
	// AWS region. Overrides S3_REGION env var. Default us-east-1.
	S3Region string `json:"s3_region"`
	// Custom S3 endpoint (MinIO, etc.). Overrides S3_ENDPOINT env var.
	S3Endpoint string `json:"s3_endpoint"`
	// Key prefix (e.g. recordings/). Overrides S3_PREFIX env var.
	S3Prefix string `json:"s3_prefix"`
	// AWS access key ID. Overrides default credential chain.
	S3AccessKey string `json:"s3_access_key"`
	// AWS secret access key. Must be set together with s3_access_key.
	S3SecretKey string `json:"s3_secret_key"`
	// GCS bucket name. Overrides GCS_BUCKET env var. Required if env var is not set when storage=gcs.
	GcsBucket string `json:"gcs_bucket"`
	// Object name prefix (e.g. recordings or recordings/). Overrides GCS_OBJECT_NAME_PREFIX env var. A trailing slash is added automatically when missing.
	GcsObjectNamePrefix string `json:"gcs_object_name_prefix"`
	// Optional output basename for the WAV file. A .wav suffix is added when missing. Must be a single path segment (no directories). Dots inside the name are preserved (only a trailing .wav is treated as the extension). Rejected with 409 if the file already exists or another recording is using the same name. When omitted, a timestamped name is generated.
	Filename string `json:"filename"`
}

RecordingRequest is a recording request.

type RecordingResponse

type RecordingResponse struct {
	InstanceID string `json:"instance_id,omitempty"`
	Status     string `json:"status"`
	File       string `json:"file"`
}

RecordingResponse is returned when recording is started or stopped.

type RecordingResumedEvent

type RecordingResumedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	File   string `json:"file,omitempty"`
}

RecordingResumedEvent is fired when: recording resumed from a paused state

type RecordingStartResult

type RecordingStartResult struct {
	Status string `json:"status"`
	File   string `json:"file"`
}

RecordingStartResult is a recording start result.

type RecordingStartedEvent

type RecordingStartedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// Recording file path or S3 URI — does not exist yet; the path only appears when the recording stops.
	File string `json:"file,omitempty"`
}

RecordingStartedEvent is fired when: recording began

type RecordingStopLegResult

type RecordingStopLegResult struct {
	Status string `json:"status"`
	File   string `json:"file"`
}

RecordingStopLegResult is a recording stop leg result.

type RecordingStopRoomResult

type RecordingStopRoomResult struct {
	Status           string                 `json:"status"`
	File             string                 `json:"file"`
	MultiChannelFile string                 `json:"multi_channel_file,omitempty"`
	Channels         map[string]ChannelInfo `json:"channels,omitempty"`
	OmittedLegs      []string               `json:"omitted_legs,omitempty"`
}

RecordingStopRoomResult is a recording stop room result.

type RegistrationAcceptRequest added in v0.12.1

type RegistrationAcceptRequest struct {
	MaxExpires int    `json:"max_expires,omitempty"`
	AppID      string `json:"app_id,omitempty"`
}

RegistrationAcceptRequest is a registration accept request.

type RegistrationRejectRequest added in v0.12.1

type RegistrationRejectRequest struct {
	Code   int    `json:"code,omitempty"`
	Reason string `json:"reason,omitempty"`
}

RegistrationRejectRequest is a registration reject request.

type RegistrationView added in v0.8.0

type RegistrationView struct {
	Aor                   string `json:"aor"`
	Contact               string `json:"contact"`
	Socket                string `json:"socket"`
	Transport             string `json:"transport"`
	UserAgent             string `json:"user_agent,omitempty"`
	CallID                string `json:"call_id,omitempty"`
	AppID                 string `json:"app_id,omitempty"`
	CreatedAt             string `json:"created_at"`
	LastRefresh           string `json:"last_refresh"`
	ExpiresAt             string `json:"expires_at"`
	GrantedExpiresSeconds int    `json:"granted_expires_seconds"`
}

RegistrationView is a registration view.

type RegistrationsResponse added in v0.8.0

type RegistrationsResponse struct {
	Bindings []RegistrationView `json:"bindings"`
}

RegistrationsResponse is a registrations response.

type RejectRegistrationPayload added in v0.10.0

type RejectRegistrationPayload struct {
	ID     string `json:"id"`
	Code   int    `json:"code,omitempty"`
	Reason string `json:"reason,omitempty"`
}

RejectRegistrationPayload is a reject registration payload.

type RingLegPayload added in v0.13.0

type RingLegPayload struct {
	ID         string      `json:"id"`
	CustomData interface{} `json:"custom_data,omitempty"`
}

RingLegPayload is a ring leg payload.

type RingLegRequest added in v0.13.0

type RingLegRequest struct {
	// Opaque application JSON attached to the leg. Any JSON value is accepted (object, array, string, number, boolean). It is echoed on the leg view and carried at the top level of every event published for this leg, so external state can be correlated without keeping a leg_id lookup table. Capped by CUSTOM_DATA_MAX_BYTES (default 1024 bytes, 0 = unlimited). Omit to leave any existing value untouched; send null to clear it.
	CustomData interface{} `json:"custom_data,omitempty"`
}

RingLegRequest is a ring leg request.

type Room

type Room struct {
	// Instance identifier.
	InstanceID string `json:"instance_id,omitempty"`
	// Room identifier.
	ID string `json:"id"`
	// Application identifier for event stream filtering.
	AppID string `json:"app_id,omitempty"`
	// Mixer sample rate in Hz (8000, 16000, or 48000).
	SampleRate int `json:"sample_rate"`
	// Legs currently in this room.
	Participants []Leg `json:"participants"`
	// contains filtered or unexported fields
}

Room is a room.

func (*Room) AddLeg

func (r *Room) AddLeg(ctx context.Context, req AddLegRequest) (*AddLegResponse, error)

AddLeg add or move a leg to a room

func (*Room) AgentMessage

func (r *Room) AgentMessage(ctx context.Context, req AgentMessageRequest) (*StatusResponse, error)

AgentMessage inject a message into a running agent session on a room

func (*Room) CreateRoomBridge added in v0.13.0

func (r *Room) CreateRoomBridge(ctx context.Context, req CreateRoomBridgeRequest) (*BridgeView, error)

CreateRoomBridge bridge this room's mixer to another room's mixer

func (*Room) DeepgramAgent

func (r *Room) DeepgramAgent(ctx context.Context, req DeepgramAgentRequest) (*StatusResponse, error)

DeepgramAgent attach a Deepgram Voice Agent to a room

func (*Room) DeepgramAgentSync

func (r *Room) DeepgramAgentSync(ctx context.Context, req DeepgramAgentRequest) (*StatusResponse, error)

func (*Room) Delete

func (r *Room) Delete(ctx context.Context) (*StatusResponse, error)

Delete delete a room

func (*Room) DeleteRoomBridge added in v0.13.0

func (r *Room) DeleteRoomBridge(ctx context.Context, bridgeID string) (*StatusResponse, error)

DeleteRoomBridge tear down a bridge

func (*Room) ElevenLabsAgent

func (r *Room) ElevenLabsAgent(ctx context.Context, req ElevenLabsAgentRequest) (*StatusResponse, error)

ElevenLabsAgent attach an ElevenLabs ConvAI agent to a room

func (*Room) ElevenLabsAgentSync

func (r *Room) ElevenLabsAgentSync(ctx context.Context, req ElevenLabsAgentRequest) (*StatusResponse, error)

func (*Room) GetRoomBridge added in v0.13.0

func (r *Room) GetRoomBridge(ctx context.Context, bridgeID string) (*BridgeView, error)

GetRoomBridge get a bridge involving this room

func (*Room) GetRouting

func (r *Room) GetRouting(ctx context.Context) (*RoomRoutingView, error)

GetRouting get the room's audio routing matrix

func (*Room) ListRoomBridges added in v0.13.0

func (r *Room) ListRoomBridges(ctx context.Context) ([]BridgeView, error)

ListRoomBridges list bridges involving this room

func (*Room) PauseRecord

func (r *Room) PauseRecord(ctx context.Context) (*StatusResponse, error)

PauseRecord pause a room recording

func (*Room) PipecatAgent

func (r *Room) PipecatAgent(ctx context.Context, req PipecatAgentRequest) (*StatusResponse, error)

PipecatAgent attach a Pipecat bot to a room

func (*Room) PipecatAgentSync

func (r *Room) PipecatAgentSync(ctx context.Context, req PipecatAgentRequest) (*StatusResponse, error)

func (*Room) Play

func (r *Room) Play(ctx context.Context, req PlaybackRequest) (*PlaybackResponse, error)

Play play audio to a room

func (*Room) PlaySync

func (r *Room) PlaySync(ctx context.Context, req PlaybackRequest) (*PlaybackResponse, error)

PlaySync starts a playback in the room and blocks until completion.

func (*Room) PlayTTS

func (r *Room) PlayTTS(ctx context.Context, req TTSRequest) (*TTSResponse, error)

PlayTTS synthesize speech and play it into a room

func (*Room) PlayTTSSync

func (r *Room) PlayTTSSync(ctx context.Context, req TTSRequest) (*TTSResponse, error)

PlayTTSSync issues a TTS prompt in the room and blocks until completion.

func (*Room) Record

func (r *Room) Record(ctx context.Context, req RecordingRequest) (*RecordingResponse, error)

Record start recording the room mix to a WAV file

func (*Room) RecordSync

func (r *Room) RecordSync(ctx context.Context, req RecordingRequest) (*RecordingResponse, error)

RecordSync starts a recording in the room and blocks until completion.

func (*Room) RemoveLeg

func (r *Room) RemoveLeg(ctx context.Context, legID string) (*StatusResponse, error)

RemoveLeg remove a leg from a room

func (*Room) ResumeRecord

func (r *Room) ResumeRecord(ctx context.Context) (*StatusResponse, error)

ResumeRecord resume a paused room recording

func (*Room) STT

func (r *Room) STT(ctx context.Context, req STTRequest) (*StatusResponse, error)

STT start speech-to-text on all room participants

func (*Room) SetRouting

func (r *Room) SetRouting(ctx context.Context, req RoomRoutingRequest) (*RoomRoutingView, error)

SetRouting replace the room's audio routing matrix

func (*Room) StartRoomSIPREC added in v0.12.1

func (r *Room) StartRoomSIPREC(ctx context.Context, req StartSIPRECRequest) (*Leg, error)

StartRoomSIPREC fork a room to an external SIPREC recording server

func (*Room) StopAgent

func (r *Room) StopAgent(ctx context.Context) (*StatusResponse, error)

StopAgent detach the agent from a room

func (*Room) StopPlay

func (r *Room) StopPlay(ctx context.Context, playbackID string) (*StatusResponse, error)

StopPlay stop room playback

func (*Room) StopRecord

func (r *Room) StopRecord(ctx context.Context) (*RecordingResponse, error)

StopRecord stop room recording

func (*Room) StopSTT

func (r *Room) StopSTT(ctx context.Context) (*StatusResponse, error)

StopSTT stop speech-to-text on a room

func (*Room) Subscribe

func (r *Room) Subscribe(types ...WebhookEventType) *Subscription

Subscribe returns a Subscription that receives every event scoped to this room (matched by room_id). See Leg.Subscribe.

func (*Room) UpdateRoomBridge added in v0.13.0

func (r *Room) UpdateRoomBridge(ctx context.Context, bridgeID string, req UpdateRoomBridgeRequest) (*BridgeView, error)

UpdateRoomBridge change a bridge's audio flow direction

func (*Room) UpdateRouting

func (r *Room) UpdateRouting(ctx context.Context, req RoomRoutingUpdateRequest) (*RoomRoutingView, error)

UpdateRouting replace selected rows of the room's audio routing matrix

func (*Room) VAPIAgent

func (r *Room) VAPIAgent(ctx context.Context, req VAPIAgentRequest) (*StatusResponse, error)

VAPIAgent attach a VAPI agent to a room

func (*Room) VAPIAgentSync

func (r *Room) VAPIAgentSync(ctx context.Context, req VAPIAgentRequest) (*StatusResponse, error)

func (*Room) VolumePlay

func (r *Room) VolumePlay(ctx context.Context, playbackID string, req VolumeRequest) (*StatusResponse, error)

VolumePlay change the volume of an active room playback

type RoomBridgeUpdatedEvent

type RoomBridgeUpdatedEvent struct {
	Event
	// Bridge identifier.
	BridgeID string `json:"bridge_id,omitempty"`
	// First bridged room.
	RoomAID string `json:"room_a_id,omitempty"`
	// Second bridged room.
	RoomBID string `json:"room_b_id,omitempty"`
	AppID   string `json:"app_id,omitempty"`
	// New canonical direction relative to room_a_id.
	Direction string `json:"direction,omitempty"`
}

RoomBridgeUpdatedEvent is fired when: a bridge's audio flow direction changed

type RoomBridgedEvent

type RoomBridgedEvent struct {
	Event
	// Bridge identifier.
	BridgeID string `json:"bridge_id,omitempty"`
	// First bridged room.
	RoomAID string `json:"room_a_id,omitempty"`
	// Second bridged room.
	RoomBID string `json:"room_b_id,omitempty"`
	AppID   string `json:"app_id,omitempty"`
	// Canonical direction relative to room_a_id: "bidirectional", "a_to_b", "b_to_a", or "none".
	Direction string `json:"direction,omitempty"`
}

RoomBridgedEvent is fired when: two rooms' mixers were joined

type RoomCreatedEvent

type RoomCreatedEvent struct {
	Event
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
}

RoomCreatedEvent is fired when: room created

type RoomDeletedEvent

type RoomDeletedEvent struct {
	Event
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
}

RoomDeletedEvent is fired when: room deleted

type RoomLegPayload

type RoomLegPayload struct {
	RoomID string `json:"room_id"`
	LegID  string `json:"leg_id"`
}

RoomLegPayload is a room leg payload.

type RoomRoutingChangedEvent

type RoomRoutingChangedEvent struct {
	Event
	RoomID string              `json:"room_id,omitempty"`
	AppID  string              `json:"app_id,omitempty"`
	Matrix map[string][]string `json:"matrix,omitempty"`
	Reason string              `json:"reason,omitempty"`
}

RoomRoutingChangedEvent is fired when: the room's audio routing matrix changed

type RoomRoutingRequest

type RoomRoutingRequest struct {
	// Listener-role → list of allowed source roles. Omitted listener roles default to full mesh. Empty list = hears nothing.
	Matrix map[string][]string `json:"matrix"`
}

RoomRoutingRequest is a room routing request.

type RoomRoutingSetPayload

type RoomRoutingSetPayload struct {
	RoomID string              `json:"room_id"`
	Matrix map[string][]string `json:"matrix"`
}

RoomRoutingSetPayload is a room routing set payload.

type RoomRoutingUpdatePayload

type RoomRoutingUpdatePayload struct {
	RoomID  string             `json:"room_id"`
	Updates []RoutingRowUpdate `json:"updates"`
}

RoomRoutingUpdatePayload is a room routing update payload.

type RoomRoutingUpdateRequest

type RoomRoutingUpdateRequest struct {
	// Per-listener-role row replacements applied as a single atomic update.
	Updates []RoutingRowUpdate `json:"updates"`
}

RoomRoutingUpdateRequest is a room routing update request.

type RoomRoutingView

type RoomRoutingView struct {
	// Listener-role → list of allowed source roles. Roles absent from the matrix default to full mesh.
	Matrix map[string][]string `json:"matrix"`
}

RoomRoutingView is a room routing view.

type RoomSIPRECStartPayload added in v0.12.1

type RoomSIPRECStartPayload struct {
	ID           string            `json:"id"`
	SrsURI       string            `json:"srs_uri"`
	LegIds       []string          `json:"leg_ids,omitempty"`
	SessionID    string            `json:"session_id,omitempty"`
	AppID        string            `json:"app_id,omitempty"`
	AuthUsername string            `json:"auth_username,omitempty"`
	AuthPassword string            `json:"auth_password,omitempty"`
	Headers      map[string]string `json:"headers,omitempty"`
}

RoomSIPRECStartPayload is a room SIPREC start payload.

type RoomUnbridgedEvent

type RoomUnbridgedEvent struct {
	Event
	// Bridge identifier.
	BridgeID string `json:"bridge_id,omitempty"`
	// First bridged room.
	RoomAID string `json:"room_a_id,omitempty"`
	// Second bridged room.
	RoomBID string `json:"room_b_id,omitempty"`
	AppID   string `json:"app_id,omitempty"`
	// Empty for an explicit delete, or "room_deleted" when a bridged room was deleted.
	Reason string `json:"reason,omitempty"`
}

RoomUnbridgedEvent is fired when: a bridge was torn down

type RoutingRowUpdate

type RoutingRowUpdate struct {
	// The role whose row is being replaced.
	ListenerRole string `json:"listener_role"`
	// New list of allowed source roles for this listener role. Pass null to clear the row (full mesh).
	Sources []string `json:"sources"`
}

RoutingRowUpdate is a routing row update.

type SIPAuth

type SIPAuth struct {
	// Digest auth username. Optional for whatsapp legs (defaults to `from` with '+' stripped, per Meta's spec).
	Username string `json:"username,omitempty"`
	// Digest auth password.
	Password string `json:"password"`
}

SIPAuth is a SIP auth.

type SIPOutboundRegistrationActiveEvent added in v0.9.0

type SIPOutboundRegistrationActiveEvent struct {
	Event
	AppID                 string `json:"app_id,omitempty"`
	TrunkID               string `json:"trunk_id,omitempty"`
	Aor                   string `json:"aor,omitempty"`
	Registrar             string `json:"registrar,omitempty"`
	Contact               string `json:"contact,omitempty"`
	GrantedExpiresSeconds int    `json:"granted_expires_seconds,omitempty"`
	ExpiresAt             string `json:"expires_at,omitempty"`
	CallID                string `json:"call_id,omitempty"`
	SourceAddress         string `json:"source_address,omitempty"`
}

SIPOutboundRegistrationActiveEvent is fired when: outbound SIP trunk REGISTER accepted (initial or refresh)

type SIPOutboundRegistrationExpiredEvent added in v0.9.0

type SIPOutboundRegistrationExpiredEvent struct {
	Event
	AppID     string `json:"app_id,omitempty"`
	TrunkID   string `json:"trunk_id,omitempty"`
	Aor       string `json:"aor,omitempty"`
	Registrar string `json:"registrar,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

SIPOutboundRegistrationExpiredEvent is fired when: outbound SIP trunk removed (DELETE, shutdown, or refresh failed past granted lifetime)

type SIPOutboundRegistrationFailedEvent added in v0.9.0

type SIPOutboundRegistrationFailedEvent struct {
	Event
	AppID      string `json:"app_id,omitempty"`
	TrunkID    string `json:"trunk_id,omitempty"`
	Aor        string `json:"aor,omitempty"`
	Registrar  string `json:"registrar,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	Reason     string `json:"reason,omitempty"`
	Error      string `json:"error,omitempty"`
}

SIPOutboundRegistrationFailedEvent is fired when: outbound SIP trunk REGISTER failed (transport error, non-2xx response, or digest auth rejected)

type SIPRECParticipantView added in v0.12.1

type SIPRECParticipantView struct {
	// The participant_id attribute from the recording metadata document.
	ParticipantID string `json:"participant_id"`
	// The participant's address of record, e.g. "sip:alice@example.com".
	Aor string `json:"aor,omitempty"`
	// The participant's display name, when the metadata carries one.
	Name string `json:"name,omitempty"`
}

SIPRECParticipantView is a SIPREC participant view.

type SIPRECSessionView added in v0.12.1

type SIPRECSessionView struct {
	// Leg carrying the recording session.
	LegID string `json:"leg_id"`
	// Communication session being recorded, from the metadata's sessionrecordingassoc.
	SessionID string `json:"session_id,omitempty"`
	// Data mode of the most recently applied metadata document (RFC 7865 §6.1).
	DataMode string `json:"data_mode,omitempty"`
	// Room this session's streams were attached to, when SIPREC_ROOM_MODE placed them in one.
	RoomID string `json:"room_id,omitempty"`
	// Every party currently recorded by this session.
	Participants []SIPRECParticipantView `json:"participants"`
	// Every negotiated media stream, joined to the participant it carries.
	Streams []SIPRECStreamView `json:"streams"`
	// The raw rs-metadata XML document as most recently received.
	Metadata string `json:"metadata,omitempty"`
	// What could be disproved about the metadata by the SDP it arrived with. Non-empty means the participant attributed to a stream may be wrong; the session is still recorded. Empty means nothing was disproved, which is not an assertion that the mapping is correct — an offer with no labels or no a=ssrc cname gives nothing to check against.
	Warnings []string `json:"warnings,omitempty"`
}

SIPRECSessionView is a SIPREC session view.

type SIPRECStream added in v0.12.1

type SIPRECStream struct {
	Label           string `json:"label,omitempty"`
	LegStreamID     string `json:"leg_stream_id,omitempty"`
	ParticipantID   string `json:"participant_id,omitempty"`
	ParticipantAor  string `json:"participant_aor,omitempty"`
	ParticipantName string `json:"participant_name,omitempty"`
}

SIPRECStream is a SIPREC stream.

type SIPRECStreamView added in v0.12.1

type SIPRECStreamView struct {
	// Identifier of the leg stream carrying this recorded media, as used by /v1/legs/{id}/streams.
	LegStreamID string `json:"leg_stream_id"`
	// The stream's SDP a=mid token (RFC 5888).
	Mid string `json:"mid,omitempty"`
	// The stream's a=label value (RFC 4574). This is the key that binds the m= section to the recording metadata.
	Label string `json:"label,omitempty"`
	// Negotiated media direction. Always recvonly or inactive: a recording server never transmits.
	Direction string `json:"direction,omitempty"`
	// Codec negotiated for this stream.
	Codec string `json:"codec,omitempty"`
	// Room this stream's audio is mixed into, when it has been attached to one.
	RoomID string `json:"room_id,omitempty"`
	// Routing role of this stream within its room. Defaults to the participant's identity.
	Role string `json:"role,omitempty"`
	// Participant whose audio arrives on this stream, from the metadata's participantstreamassoc send binding.
	ParticipantID string `json:"participant_id,omitempty"`
	// Address of record of the participant sending on this stream.
	ParticipantAor string `json:"participant_aor,omitempty"`
	// Display name of the participant sending on this stream.
	ParticipantName string `json:"participant_name,omitempty"`
}

SIPRECStreamView is a SIPREC stream view.

type SIPRegisterTrunkSpec added in v0.9.0

type SIPRegisterTrunkSpec struct {
	// Upstream registrar SIP URI (e.g. "sip:pbx.example.com:5060" or "sips:pbx.example.com:5061"). Transport is taken from the URI: a "sips:" scheme or a ";transport=tls" parameter selects TLS, ";transport=tcp" selects TCP, otherwise UDP. Note that "transport" is a URI parameter (";"), not a URI header ("?") — RFC 3261 section 19.1.
	RegistrarURI string `json:"registrar_uri"`
	// Next-hop SIP proxy for this trunk's REGISTER and for outbound INVITEs placed from its AOR, attached as a loose `Route` header (the Request-URI is left unchanged, and digest auth still targets `registrar_uri`). E.g. "sip:edge.example.com:5060;transport=tcp". Defaults to `SIP_OUTBOUND_PROXY`; when neither is set, requests go straight to `registrar_uri`.
	OutboundProxy string `json:"outbound_proxy,omitempty"`
	// Address-of-record this trunk REGISTERs (e.g. "sip:alice@pbx.example.com"). Becomes the From URI on outbound REGISTER, and the From / P-Asserted-Identity host on outbound INVITEs placed `from` this AOR.
	Aor string `json:"aor"`
	// Digest auth username. Defaults to the AOR user-part when empty.
	Username string `json:"username,omitempty"`
	// Digest auth password. Required. Never returned in any response.
	Password string `json:"password"`
	// Override the user-part of the Contact header sent in REGISTER. Defaults to the AOR user-part.
	ContactUser string `json:"contact_user,omitempty"`
	// Requested registration lifetime in seconds. Clamped to [SIP_OUTBOUND_REGISTRATION_MIN_EXPIRES_SECONDS, SIP_OUTBOUND_REGISTRATION_MAX_EXPIRES_SECONDS]. Default: SIP_OUTBOUND_REGISTRATION_DEFAULT_EXPIRES_SECONDS (3600).
	ExpiresSeconds int `json:"expires_seconds,omitempty"`
	// Accept this trunk's next-hop certificate without verifying it, for a `sips:` / `;transport=tls` registrar or outbound proxy whose certificate is self-signed, privately signed, or carries no SAN (`x509: certificate relies on legacy Common Name field`). Scoped to that peer's hostname — every other TLS peer is still verified in full, unlike the server-wide `SIP_TLS_INSECURE_SKIP_VERIFY`. Ignored (with a logged warning) when the next hop is not TLS, or when it is named by IP literal: such a dial sends no SNI and cannot be told apart from any other, so use `SIP_TLS_CA_FILE` or `SIP_TLS_INSECURE_SKIP_VERIFY` there. Prefer `SIP_TLS_CA_FILE` when the peer's CA can simply be trusted.
	TlsInsecureSkipVerify bool `json:"tls_insecure_skip_verify,omitempty"`
	// Unregister (REGISTER with Expires: 0) when the instance starts draining, so the provider stops sending new calls here, and register again if the drain is cancelled. Calls already up and new outbound calls through the trunk are not affected. Set false for providers that end live calls, or refuse outbound calls, from a client that is no longer registered. Defaults to true.
	UnregisterOnDrain bool `json:"unregister_on_drain,omitempty"`
}

SIPRegisterTrunkSpec is a SIP register trunk spec.

type SIPRegisterTrunkView added in v0.9.0

type SIPRegisterTrunkView struct {
	RegistrarURI            string `json:"registrar_uri"`
	OutboundProxy           string `json:"outbound_proxy,omitempty"`
	Aor                     string `json:"aor"`
	Username                string `json:"username,omitempty"`
	ContactURI              string `json:"contact_uri,omitempty"`
	RequestedExpiresSeconds int    `json:"requested_expires_seconds"`
	GrantedExpiresSeconds   int    `json:"granted_expires_seconds,omitempty"`
	LastRegisteredAt        string `json:"last_registered_at,omitempty"`
	NextRefreshAt           string `json:"next_refresh_at,omitempty"`
	CallID                  string `json:"call_id,omitempty"`
	Cseq                    int    `json:"cseq,omitempty"`
	SourceAddress           string `json:"source_address,omitempty"`
	TlsInsecureSkipVerify   bool   `json:"tls_insecure_skip_verify,omitempty"`
	UnregisterOnDrain       bool   `json:"unregister_on_drain"`
}

SIPRegisterTrunkView is a SIP register trunk view.

type SIPRegistrationActiveEvent added in v0.8.0

type SIPRegistrationActiveEvent struct {
	Event
	AppID string `json:"app_id,omitempty"`
	// Canonical Address of Record (e.g. sip:alice@vb.example).
	Aor string `json:"aor,omitempty"`
	// Contact URI registered by the UA.
	Contact string `json:"contact,omitempty"`
	// Transport-layer socket (ip:port) the REGISTER arrived on.
	Socket string `json:"socket,omitempty"`
	// Transport: udp | tcp | tls.
	Transport string `json:"transport,omitempty"`
	// User-Agent header from the REGISTER, if present.
	UserAgent string `json:"user_agent,omitempty"`
	// Call-ID of the most recent REGISTER.
	CallID string `json:"call_id,omitempty"`
	// Expiry granted to the binding (clamped to SIP_REGISTRATION_MAX_EXPIRES_SECONDS).
	GrantedExpiresSeconds int `json:"granted_expires_seconds,omitempty"`
	// Absolute expiry time (RFC 3339).
	ExpiresAt string `json:"expires_at,omitempty"`
}

SIPRegistrationActiveEvent is fired when: sIP AOR registration created or refreshed (one event per Contact)

type SIPRegistrationAttemptEvent added in v0.10.0

type SIPRegistrationAttemptEvent struct {
	Event
	AppID            string `json:"app_id,omitempty"`
	AttemptID        string `json:"attempt_id,omitempty"`
	Aor              string `json:"aor,omitempty"`
	Contact          string `json:"contact,omitempty"`
	SourceAddress    string `json:"source_address,omitempty"`
	Transport        string `json:"transport,omitempty"`
	UserAgent        string `json:"user_agent,omitempty"`
	CallID           string `json:"call_id,omitempty"`
	HasAuthorization bool   `json:"has_authorization,omitempty"`
}

SIPRegistrationAttemptEvent is fired when: inbound REGISTER surfaced for a challenge/accept/reject decision (auto-accepts on consult timeout)

type SIPRegistrationExpiredEvent added in v0.8.0

type SIPRegistrationExpiredEvent struct {
	Event
	AppID string `json:"app_id,omitempty"`
	// Canonical Address of Record.
	Aor string `json:"aor,omitempty"`
	// Contact URI that was unbound.
	Contact string `json:"contact,omitempty"`
	// Transport-layer socket that held the binding.
	Socket string `json:"socket,omitempty"`
	// Why the binding was removed: ttl, unregistered, forced, or replaced.
	Reason string `json:"reason,omitempty"`
}

SIPRegistrationExpiredEvent is fired when: sIP AOR registration removed (TTL, explicit unregister, force-delete, or single-binding replacement)

type SIPTrunkDownEvent added in v0.15.0

type SIPTrunkDownEvent struct {
	Event
	AppID      string `json:"app_id,omitempty"`
	TrunkID    string `json:"trunk_id,omitempty"`
	TrunkType  string `json:"trunk_type,omitempty"`
	PeerURI    string `json:"peer_uri,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	Reason     string `json:"reason,omitempty"`
}

SIPTrunkDownEvent is fired when: sIP trunk peer failed its OPTIONS health check (no reply, transport error, 408, or 5xx other than 501)

type SIPTrunkUpEvent added in v0.15.0

type SIPTrunkUpEvent struct {
	Event
	AppID      string `json:"app_id,omitempty"`
	TrunkID    string `json:"trunk_id,omitempty"`
	TrunkType  string `json:"trunk_type,omitempty"`
	PeerURI    string `json:"peer_uri,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	Reason     string `json:"reason,omitempty"`
}

SIPTrunkUpEvent is fired when: sIP trunk peer answered its OPTIONS health check (first answer, or recovery after sip.trunk_down)

type STTFinalizeResult added in v0.12.1

type STTFinalizeResult struct {
	Status string `json:"status"`
}

STTFinalizeResult is a STT finalize result.

type STTRequest

type STTRequest struct {
	// Language code (e.g. "en", "es").
	Language string `json:"language"`
	// Emit partial (non-final) transcripts.
	Partial bool `json:"partial"`
	// STT provider: "elevenlabs" (default), "deepgram" (/v1/listen), "deepgram_flux" (/v2/listen, conversational turn detection), "azure" or "speechmatics".
	Provider string `json:"provider,omitempty"`
	// API key override (falls back to ELEVENLABS_API_KEY, DEEPGRAM_API_KEY, AZURE_SPEECH_KEY or SPEECHMATICS_API_KEY env var depending on provider).
	APIKey string `json:"api_key,omitempty"`
	// Provider-specific model. Deepgram: default "nova-3". Deepgram Flux: "flux-general-en" (default) or "flux-general-multi". Speechmatics: "standard" (default) or "enhanced".
	Model string `json:"model,omitempty"`
	// Terms to boost recognition of (Deepgram, Deepgram Flux, and Speechmatics — where they become additional_vocab).
	Keyterms []string `json:"keyterms,omitempty"`
	// Deepgram: milliseconds of silence before a segment is finalized; 0 disables endpointing. Speechmatics: maps to max_delay, clamped to 700-4000 ms; 0 leaves the provider default.
	Endpointing int `json:"endpointing,omitempty"`
	// Deepgram: milliseconds of silence after which an stt.turn event with event=utterance_end is emitted. Deepgram requires interim results for this, which are requested automatically and still suppressed unless partial is true. Speechmatics: milliseconds of silence that close a turn and emit an stt.turn event with event=end_of_turn — default 600, capped at 2000, and 0 disables turn detection.
	UtteranceEndMs int `json:"utterance_end_ms,omitempty"`
	// Deepgram Flux only: end-of-turn confidence that fires an eager_end_of_turn stt.turn event, enabling speculative generation. Must be between 0.3 and 0.9. When unset, no eager_end_of_turn or turn_resumed events are emitted at all.
	EagerEotThreshold float64 `json:"eager_eot_threshold,omitempty"`
	// Deepgram Flux only: end-of-turn confidence required to close a turn. Deepgram default 0.7.
	EotThreshold float64 `json:"eot_threshold,omitempty"`
	// Deepgram Flux only: milliseconds of silence after which a turn is closed regardless of confidence. Deepgram default 5000.
	EotTimeoutMs int `json:"eot_timeout_ms,omitempty"`
	// Deepgram Flux only: candidate language codes for the "flux-general-multi" model.
	LanguageHints []string `json:"language_hints,omitempty"`
}

STTRequest is a STT request.

type STTStartLegResult

type STTStartLegResult struct {
	Status string `json:"status"`
	LegID  string `json:"leg_id"`
}

STTStartLegResult is a STT start leg result.

type STTStartPayload

type STTStartPayload struct {
	ID                string   `json:"id"`
	Language          string   `json:"language"`
	Partial           bool     `json:"partial"`
	Provider          string   `json:"provider,omitempty"`
	APIKey            string   `json:"api_key,omitempty"`
	Model             string   `json:"model,omitempty"`
	Keyterms          []string `json:"keyterms,omitempty"`
	Endpointing       int      `json:"endpointing,omitempty"`
	UtteranceEndMs    int      `json:"utterance_end_ms,omitempty"`
	EagerEotThreshold float64  `json:"eager_eot_threshold,omitempty"`
	EotThreshold      float64  `json:"eot_threshold,omitempty"`
	EotTimeoutMs      int      `json:"eot_timeout_ms,omitempty"`
	LanguageHints     []string `json:"language_hints,omitempty"`
}

STTStartPayload is a STT start payload.

type STTStartRoomResult

type STTStartRoomResult struct {
	Status string   `json:"status"`
	RoomID string   `json:"room_id"`
	LegIds []string `json:"leg_ids"`
}

STTStartRoomResult is a STT start room result.

type STTStopResult

type STTStopResult struct {
	Status string `json:"status"`
}

STTStopResult is a STT stop result.

type STTTextEvent

type STTTextEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// Which of the leg's audio streams this came from. Empty when the leg's audio is the call itself; set for a recording session, where each stream is a different party. Resolve it through GET /v1/legs/{id}/siprec.
	StreamID string `json:"stream_id,omitempty"`
	// Transcribed text.
	Text string `json:"text,omitempty"`
	// Whether this is a final or partial transcript.
	IsFinal bool `json:"is_final,omitempty"`
	// Whether the speaker stopped talking, as opposed to is_final's 'this segment will not change again'. Deepgram only; always false for providers that do not report it.
	SpeechFinal bool `json:"speech_final,omitempty"`
	// Where in the stream this was said, in milliseconds from the first audio the transcriber was given. Absent when the provider reports no timing. Not the same as the event's arrival time, which is when the provider finished rather than when the words were spoken.
	AudioStartMs int `json:"audio_start_ms,omitempty"`
	// End of the span audio_start_ms opens.
	AudioEndMs int `json:"audio_end_ms,omitempty"`
}

STTTextEvent is fired when: speech-to-text transcript

type STTTurnEvent added in v0.12.1

type STTTurnEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// Which of the leg's audio streams this turn belongs to. Empty when the leg's audio is the call itself. See stt.text.stream_id.
	StreamID string `json:"stream_id,omitempty"`
	// Turn boundary: start_of_turn, update, eager_end_of_turn, turn_resumed or end_of_turn (Deepgram Flux), or utterance_end (Deepgram, when utterance_end_ms is set). New values may be added.
	TurnEvent string `json:"event,omitempty"`
	// Index of the turn within the session, incrementing after each end_of_turn.
	TurnIndex int `json:"turn_index,omitempty"`
	// Transcript of the turn so far. Empty on utterance_end.
	Text string `json:"text,omitempty"`
	// How confident the model is that the turn has ended.
	EndOfTurnConfidence float64 `json:"end_of_turn_confidence,omitempty"`
	// Start of the audio window this transcript covers.
	AudioWindowStartMs int `json:"audio_window_start_ms,omitempty"`
	// End of the audio window this transcript covers.
	AudioWindowEndMs int `json:"audio_window_end_ms,omitempty"`
	// When the last word ended (utterance_end only).
	LastWordEndMs int `json:"last_word_end_ms,omitempty"`
	// Per-word transcript with timings and confidence, when the provider supplies it.
	Words []STTWord `json:"words,omitempty"`
	// Languages detected in the turn.
	Languages []string `json:"languages,omitempty"`
}

STTTurnEvent is fired when: speech-to-text turn boundary

type STTWord added in v0.12.1

type STTWord struct {
	Word       string  `json:"word"`
	Confidence float64 `json:"confidence"`
	StartMs    int     `json:"start_ms"`
	EndMs      int     `json:"end_ms"`
}

STTWord is a STT word.

type SetLegCustomDataPayload added in v0.13.0

type SetLegCustomDataPayload struct {
	ID         string      `json:"id"`
	CustomData interface{} `json:"custom_data"`
}

SetLegCustomDataPayload is a set leg custom data payload.

type SetLegCustomDataRequest added in v0.13.0

type SetLegCustomDataRequest struct {
	// New opaque application JSON for the leg. Any JSON value is accepted (object, array, string, number, boolean). Replaces the existing value outright — there is no merge. Sending null clears it, the same as DELETE. Required: omitting the field is rejected with 400. Capped by CUSTOM_DATA_MAX_BYTES (default 1024 bytes, 0 = unlimited).
	CustomData interface{} `json:"custom_data"`
}

SetLegCustomDataRequest is a set leg custom data request.

type SetLegFiltersPayload added in v0.15.0

type SetLegFiltersPayload struct {
	ID      string       `json:"id"`
	Filters []FilterSpec `json:"filters"`
}

SetLegFiltersPayload is a set leg filters payload.

type SetLegFiltersRequest added in v0.15.0

type SetLegFiltersRequest struct {
	// The chain to run from now on, replacing whatever is running. Send an empty array to stop all processing. Any change is allowed, including enabling or disabling denoise, which runs at the rate the leg and room already agreed on and so adds no resampling. denoise_gtcrn runs only at 8, 12 or 16 kHz, so in a 48 kHz room it moves the chain to 16 kHz and band-limits the leg to 8 kHz. A change that did alter the chain's working rate rebuilds the resamplers behind a short fade instead of being refused. The change is staged and takes effect on the next audio block.
	Filters []FilterSpec `json:"filters"`
}

SetLegFiltersRequest is a set leg filters request.

type SetLegRolePayload

type SetLegRolePayload struct {
	LegID string `json:"leg_id"`
	Role  string `json:"role"`
}

SetLegRolePayload is a set leg role payload.

type SetLegRoleRequest

type SetLegRoleRequest struct {
	// New routing role for the leg. The room's routing matrix decides which other legs this leg hears and is heard by based on roles. Pass an empty string to clear the role (full mesh).
	Role string `json:"role"`
}

SetLegRoleRequest is a set leg role request.

type SiprecMetadataUpdatedEvent added in v0.12.1

type SiprecMetadataUpdatedEvent struct {
	Event
	LegID              string         `json:"leg_id,omitempty"`
	AppID              string         `json:"app_id,omitempty"`
	SessionID          string         `json:"session_id,omitempty"`
	DataMode           string         `json:"data_mode,omitempty"`
	ParticipantsJoined []string       `json:"participants_joined,omitempty"`
	ParticipantsLeft   []string       `json:"participants_left,omitempty"`
	StreamsAdded       []string       `json:"streams_added,omitempty"`
	StreamsRemoved     []string       `json:"streams_removed,omitempty"`
	Streams            []SIPRECStream `json:"streams,omitempty"`
}

SiprecMetadataUpdatedEvent is fired when: a SIPREC recording session's metadata document was updated on a re-INVITE

type SiprecParticipantJoinedEvent added in v0.12.1

type SiprecParticipantJoinedEvent struct {
	Event
	LegID           string `json:"leg_id,omitempty"`
	AppID           string `json:"app_id,omitempty"`
	SessionID       string `json:"session_id,omitempty"`
	Label           string `json:"label,omitempty"`
	LegStreamID     string `json:"leg_stream_id,omitempty"`
	ParticipantID   string `json:"participant_id,omitempty"`
	ParticipantAor  string `json:"participant_aor,omitempty"`
	ParticipantName string `json:"participant_name,omitempty"`
}

SiprecParticipantJoinedEvent is fired when: a party joined the call being recorded by a SIPREC session

type SiprecParticipantLeftEvent added in v0.12.1

type SiprecParticipantLeftEvent struct {
	Event
	LegID           string `json:"leg_id,omitempty"`
	AppID           string `json:"app_id,omitempty"`
	SessionID       string `json:"session_id,omitempty"`
	Label           string `json:"label,omitempty"`
	LegStreamID     string `json:"leg_stream_id,omitempty"`
	ParticipantID   string `json:"participant_id,omitempty"`
	ParticipantAor  string `json:"participant_aor,omitempty"`
	ParticipantName string `json:"participant_name,omitempty"`
}

SiprecParticipantLeftEvent is fired when: a party left the call being recorded by a SIPREC session

type SiprecSessionEndedEvent added in v0.12.1

type SiprecSessionEndedEvent struct {
	Event
	LegID     string `json:"leg_id,omitempty"`
	AppID     string `json:"app_id,omitempty"`
	SessionID string `json:"session_id,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

SiprecSessionEndedEvent is fired when: a SIPREC recording session ended

type SiprecSessionStartedEvent added in v0.12.1

type SiprecSessionStartedEvent struct {
	Event
	LegID        string            `json:"leg_id,omitempty"`
	AppID        string            `json:"app_id,omitempty"`
	SessionID    string            `json:"session_id,omitempty"`
	DataMode     string            `json:"data_mode,omitempty"`
	Participants []ParticipantInfo `json:"participants,omitempty"`
	Streams      []SIPRECStream    `json:"streams,omitempty"`
}

SiprecSessionStartedEvent is fired when: an inbound SIPREC recording session was accepted; carries the participants and the stream-to-participant bindings

type SpeakingStartedEvent

type SpeakingStartedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier (present only when the leg is in a room).
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
}

SpeakingStartedEvent is fired when: participant started speaking

type SpeakingStoppedEvent

type SpeakingStoppedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier (present only when the leg is in a room).
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
}

SpeakingStoppedEvent is fired when: participant stopped speaking

type StartDrainRequest added in v1.0.0

type StartDrainRequest struct {
	TimeoutSeconds int `json:"timeout_seconds,omitempty"`
}

StartDrainRequest is a start drain request.

type StartSIPRECRequest added in v0.12.1

type StartSIPRECRequest struct {
	// SIP URI of the session recording server, e.g. "sip:srs@recorder.example.com:5060;transport=tcp". A recording session carries the metadata document alongside the SDP and exceeds the UDP message limit, so the target should accept TCP. The transport comes from the URI: ";transport=tcp", or "sips:" / ";transport=tls" for TLS.
	SrsURI string `json:"srs_uri"`
	// Which participants to record. Each entry is either a leg ID (that leg's own audio) or "<legID>#<streamID>" for one of a leg's secondary audio streams mixed into the room. Empty or absent records every participant. An entry that is not in the room is a 404.
	LegIds []string `json:"leg_ids,omitempty"`
	// Communication session identifier put in the recording metadata. Defaults to the room ID.
	SessionID string `json:"session_id,omitempty"`
	// Application identifier tagged onto the resulting leg and its events.
	AppID string `json:"app_id,omitempty"`
	// SIP digest username, when the recording server challenges the INVITE.
	AuthUsername string `json:"auth_username,omitempty"`
	// SIP digest password, when the recording server challenges the INVITE.
	AuthPassword string `json:"auth_password,omitempty"`
	// Extra SIP headers to include in the INVITE. Require: siprec is always sent.
	Headers map[string]string `json:"headers,omitempty"`
}

StartSIPRECRequest is a start SIPREC request.

type StatusResponse

type StatusResponse struct {
	// Instance identifier.
	InstanceID string `json:"instance_id,omitempty"`
	Status     string `json:"status"`
}

StatusResponse is a status response.

type Subscription

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

Subscription is a stream of events delivered to a subscriber. Values are typed event pointers (e.g. *LegConnectedEvent, *TTSFinishedEvent); use a type switch to handle them. Close the subscription when done — until then, the goroutine on the producer side will keep matching events against it.

func (*Subscription) Close

func (s *Subscription) Close()

Close ends the subscription and closes the events channel. Idempotent.

func (*Subscription) Events

func (s *Subscription) Events() <-chan interface{}

Events returns a receive-only channel of events. The channel is closed when Close is called, so a `for ev := range sub.Events()` loop exits cleanly. The channel buffer is sized so well-behaved consumers won't drop; if the consumer falls far behind, dispatched events are silently dropped for this subscription.

func (*Subscription) Next

func (s *Subscription) Next(ctx context.Context) (interface{}, error)

Next is a convenience for consumers that prefer a blocking read with cancellation over ranging the channel. It returns the next event, or an error if ctx is cancelled or the subscription is closed.

type TTSDiscardResult added in v0.12.1

type TTSDiscardResult struct {
	Status string `json:"status"`
}

TTSDiscardResult is a TTS discard result.

type TTSDiscardedEvent added in v0.12.1

type TTSDiscardedEvent struct {
	Event
	// Leg identifier.
	LegID  string `json:"leg_id,omitempty"`
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// TTS playback identifier.
	TTSID string `json:"tts_id,omitempty"`
	// Why the staged utterance was dropped: 'app' (explicitly discarded), 'expired' (TTS_PREFLIGHT_TTL elapsed) or 'leg_gone' (the leg ended while it was staged).
	Reason string `json:"reason,omitempty"`
}

TTSDiscardedEvent is fired when: staged TTS was dropped without being played

type TTSErrorEvent

type TTSErrorEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// TTS playback identifier.
	TTSID string `json:"tts_id,omitempty"`
	// Error message.
	Error string `json:"error,omitempty"`
	// Failure category: permanent_auth, permanent_input, rate_limited, service_unavailable, retryable, canceled or unknown for a synthesis failure, playback for a failure while streaming the audio. New values may be added; treat an unrecognised value as unknown.
	Category string `json:"category,omitempty"`
}

TTSErrorEvent is fired when: tTS synthesis or playback failed

type TTSFinishedEvent

type TTSFinishedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// TTS playback identifier.
	TTSID string `json:"tts_id,omitempty"`
	// Why the utterance ended: 'completed' (reached the end of the audio) or 'stopped' (did not reach the end, for any reason).
	Reason string `json:"reason,omitempty"`
	// Milliseconds of audio actually played.
	PlayedMs int `json:"played_ms,omitempty"`
}

TTSFinishedEvent is fired when: tTS synthesis finished playing

type TTSRequest

type TTSRequest struct {
	// Text to synthesize.
	Text string `json:"text"`
	// Provider-specific voice identifier. ElevenLabs: voice name or ID. AWS Polly: voice ID (e.g. Joanna, Matthew). Google Cloud: voice name — either full format (e.g. en-US-Neural2-F) or short name for Gemini models (e.g. Achernar, Kore). Deepgram: model name (e.g. aura-2-asteria-en).
	Voice string `json:"voice"`
	// Provider-specific model/engine. ElevenLabs: model ID. AWS Polly: engine (standard, neural, long-form, generative; default neural). Google Cloud: model name (e.g. gemini-2.5-pro-tts, chirp3-hd).
	ModelID string `json:"model_id"`
	// Language code (e.g. "en-US", "pl-pl"). Required for Google Gemini TTS voices that use short names (e.g. Achernar). Auto-extracted from full voice names like en-US-Neural2-F.
	Language string `json:"language,omitempty"`
	// Style/tone instruction for promptable voice models (Google Gemini TTS only). E.g. "Read aloud in a warm, welcoming tone.".
	Prompt string `json:"prompt,omitempty"`
	// Volume adjustment in dB (-8 to 8).
	Volume int `json:"volume"`
	// TTS provider: "elevenlabs" (default), "aws", "google", or "deepgram".
	Provider string `json:"provider,omitempty"`
	// ElevenLabs: API key override (falls back to ELEVENLABS_API_KEY env var). AWS: optional ACCESS_KEY:SECRET_KEY override (falls back to default AWS credential chain). Google Cloud: optional API key override (falls back to Application Default Credentials). Deepgram: API key override (falls back to DEEPGRAM_API_KEY env var).
	APIKey string `json:"api_key,omitempty"`
}

TTSRequest is a TTS request.

type TTSResponse

type TTSResponse struct {
	InstanceID string `json:"instance_id,omitempty"`
	TTSID      string `json:"tts_id"`
	Status     string `json:"status"`
}

TTSResponse is returned when TTS playback is started on a leg or room.

type TTSStagedEvent added in v0.12.1

type TTSStagedEvent struct {
	Event
	// Leg identifier.
	LegID  string `json:"leg_id,omitempty"`
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// TTS playback identifier, to commit or discard.
	TTSID string `json:"tts_id,omitempty"`
	// Size of the buffered audio.
	Bytes int `json:"bytes,omitempty"`
	// How long the buffered audio will play for. 0 when the duration is not derivable from the audio format.
	DurationMs int `json:"duration_ms,omitempty"`
}

TTSStagedEvent is fired when: preflight TTS finished synthesizing and is ready to commit

type TTSStartPayload

type TTSStartPayload struct {
	ID       string `json:"id"`
	Text     string `json:"text"`
	Voice    string `json:"voice"`
	ModelID  string `json:"model_id"`
	Language string `json:"language,omitempty"`
	Prompt   string `json:"prompt,omitempty"`
	Volume   int    `json:"volume"`
	Provider string `json:"provider,omitempty"`
	APIKey   string `json:"api_key,omitempty"`
}

TTSStartPayload is a TTS start payload.

type TTSStartResult

type TTSStartResult struct {
	TTSID  string `json:"tts_id"`
	Status string `json:"status"`
}

TTSStartResult is a TTS start result.

type TTSStartedEvent

type TTSStartedEvent struct {
	Event
	// Leg identifier.
	LegID string `json:"leg_id,omitempty"`
	// Room identifier.
	RoomID string `json:"room_id,omitempty"`
	AppID  string `json:"app_id,omitempty"`
	// TTS playback identifier.
	TTSID string `json:"tts_id,omitempty"`
}

TTSStartedEvent is fired when: tTS synthesis began playing

type TTSTargetPayload added in v0.12.1

type TTSTargetPayload struct {
	ID    string `json:"id"`
	TTSID string `json:"tts_id"`
}

TTSTargetPayload is a TTS target payload.

type TransferCompleteRequest added in v0.11.0

type TransferCompleteRequest struct {
	Success    bool   `json:"success"`
	StatusCode int    `json:"status_code,omitempty"`
	Reason     string `json:"reason,omitempty"`
}

TransferCompleteRequest is a transfer complete request.

type TransferDeclineRequest added in v0.11.0

type TransferDeclineRequest struct {
	Code   int    `json:"code,omitempty"`
	Reason string `json:"reason,omitempty"`
}

TransferDeclineRequest is a transfer decline request.

type TransferLegPayload

type TransferLegPayload struct {
	ID             string            `json:"id"`
	Target         string            `json:"target"`
	ReplacesLegID  string            `json:"replaces_leg_id,omitempty"`
	ReferToHeaders map[string]string `json:"refer_to_headers,omitempty"`
	Headers        map[string]string `json:"headers,omitempty"`
}

TransferLegPayload is a transfer leg payload.

type TransferLegResult

type TransferLegResult struct {
	Status string `json:"status"`
}

TransferLegResult is a transfer leg result.

type TransferProgressRequest added in v0.11.0

type TransferProgressRequest struct {
	StatusCode int    `json:"status_code"`
	Reason     string `json:"reason,omitempty"`
}

TransferProgressRequest is a transfer progress request.

type TransferRequest

type TransferRequest struct {
	// SIP URI to transfer the call to (e.g. "sip:bob@example.com").
	Target string `json:"target"`
	// ID of an existing connected SIP leg whose dialog should be replaced (attended transfer). Omit for blind transfer.
	ReplacesLegID string `json:"replaces_leg_id,omitempty"`
	// SIP headers to carry to the transfer target, embedded as URI headers in the Refer-To (RFC 3261 §19.1.1), e.g. `<sip:bob@example.com?User-to-User=...>`; the peer copies them into the INVITE it sends to the target. Values are percent-encoded for you. Whether a peer honours them is peer-specific. Dialog and routing headers (RFC 3261 §19.1.5), `body` and `Replaces` are rejected — use `replaces_leg_id` for attended transfer.
	ReferToHeaders map[string]string `json:"refer_to_headers,omitempty"`
	// SIP headers to set on the REFER request itself, read by the peer that receives the REFER. A `Referred-By` given here replaces the default one. `Refer-To`, `Contact` and the dialog and routing headers are rejected.
	Headers map[string]string `json:"headers,omitempty"`
}

TransferRequest is a transfer request.

type TrunkView added in v0.9.0

type TrunkView struct {
	ID          string      `json:"id"`
	Type        string      `json:"type"`
	AppID       string      `json:"app_id,omitempty"`
	Status      string      `json:"status"`
	LastError   string      `json:"last_error,omitempty"`
	Srtp        string      `json:"srtp,omitempty"`
	CreatedAt   string      `json:"created_at"`
	SIPRegister interface{} `json:"sip_register,omitempty"`
	IpIp        interface{} `json:"ip_ip,omitempty"`
}

TrunkView is a trunk view.

type TrunksListResponse added in v0.9.0

type TrunksListResponse struct {
	Trunks []TrunkView `json:"trunks"`
}

TrunksListResponse is a trunks list response.

type UpdateLegStreamRequest added in v0.12.1

type UpdateLegStreamRequest struct {
	// New routing role for this stream inside its room. The room's routing matrix decides who hears it. Pass an empty string to clear the role (full mesh). Omit to leave it untouched. Applied atomically — the room's allow-sets are recomputed in a single mixer-mutex acquisition, so no audio bleeds through mid-change.
	Role string `json:"role,omitempty"`
}

UpdateLegStreamRequest is a update leg stream request.

type UpdateRoomBridgeRequest added in v0.12.1

type UpdateRoomBridgeRequest struct {
	// New audio flow relative to the room in the path: bidirectional, send, receive, or none.
	Direction string `json:"direction"`
}

UpdateRoomBridgeRequest is a update room bridge request.

type VAPIAgentRequest

type VAPIAgentRequest struct {
	// VAPI assistant ID.
	AssistantID string `json:"assistant_id"`
	// Override the agent's first message.
	FirstMessage string `json:"first_message,omitempty"`
	// Key-value pairs passed as VAPI variable values (assistantOverrides.variableValues).
	VariableValues map[string]string `json:"variable_values,omitempty"`
	// API key override (falls back to VAPI_API_KEY env var).
	APIKey string `json:"api_key,omitempty"`
}

VAPIAgentRequest is a VAPI agent request.

type VSIError

type VSIError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

VSIError is the error returned by VSI command methods when the server replies with an `error` frame.

func (*VSIError) Error

func (e *VSIError) Error() string

type VSIStatusResponse

type VSIStatusResponse struct {
	Status string `json:"status"`
}

VSIStatusResponse is a VSI status response.

type VSIWebRTCAddCandidatePayload

type VSIWebRTCAddCandidatePayload struct {
	ID        string           `json:"id"`
	Candidate ICECandidateInit `json:"candidate"`
}

VSIWebRTCAddCandidatePayload is a VSI web RTC add candidate payload.

type VSIWebRTCICERestartPayload added in v0.15.0

type VSIWebRTCICERestartPayload struct {
	ID  string `json:"id"`
	SDP string `json:"sdp"`
}

VSIWebRTCICERestartPayload is a VSI web RTCICE restart payload.

type VolumeRequest

type VolumeRequest struct {
	// Volume adjustment (-8 to 8, ~3dB per step, 0 = unchanged).
	Volume int `json:"volume"`
}

VolumeRequest is a volume request.

type WebRTCCandidatesResult

type WebRTCCandidatesResult struct {
	Candidates []ICECandidateInit `json:"candidates"`
	Done       bool               `json:"done"`
}

WebRTCCandidatesResult is a web RTC candidates result.

type WebRTCICERestartRequest added in v0.15.0

type WebRTCICERestartRequest struct {
	SDP string `json:"sdp"`
}

WebRTCICERestartRequest is a web RTCICE restart request.

type WebRTCOfferRequest

type WebRTCOfferRequest struct {
	// SDP offer from the browser.
	SDP string `json:"sdp"`
	// Application identifier. Carried through to all events emitted for this leg, and matched against the VSI `app_id` filter.
	AppID string `json:"app_id,omitempty"`
	// Opaque application JSON attached to the leg. Any JSON value is accepted (object, array, string, number, boolean). It is echoed on the leg view and carried at the top level of every event published for this leg, so external state can be correlated without keeping a leg_id lookup table. Capped by CUSTOM_DATA_MAX_BYTES (default 1024 bytes, 0 = unlimited).
	CustomData interface{} `json:"custom_data,omitempty"`
}

WebRTCOfferRequest is a web RTC offer request.

type WebRTCOfferResponse

type WebRTCOfferResponse struct {
	InstanceID string `json:"instance_id,omitempty"`
	LegID      string `json:"leg_id"`
	SDP        string `json:"sdp"`
}

WebRTCOfferResponse contains the SDP answer and leg ID returned by /webrtc/offer.

type WebRTCOfferResult

type WebRTCOfferResult struct {
	LegID string `json:"leg_id"`
	SDP   string `json:"sdp"`
}

WebRTCOfferResult is a web RTC offer result.

type WebhookEventType

type WebhookEventType string

WebhookEventType is the type of a webhook event.

const (
	// EventLegRinging is the "leg.ringing" WebhookEventType value.
	EventLegRinging WebhookEventType = "leg.ringing"
	// EventLegEarlyMedia is the "leg.early_media" WebhookEventType value.
	EventLegEarlyMedia WebhookEventType = "leg.early_media"
	// EventLegConnected is the "leg.connected" WebhookEventType value.
	EventLegConnected WebhookEventType = "leg.connected"
	// EventLegDisconnected is the "leg.disconnected" WebhookEventType value.
	EventLegDisconnected WebhookEventType = "leg.disconnected"
	// EventLegJoinedRoom is the "leg.joined_room" WebhookEventType value.
	EventLegJoinedRoom WebhookEventType = "leg.joined_room"
	// EventLegLeftRoom is the "leg.left_room" WebhookEventType value.
	EventLegLeftRoom WebhookEventType = "leg.left_room"
	// EventLegMuted is the "leg.muted" WebhookEventType value.
	EventLegMuted WebhookEventType = "leg.muted"
	// EventLegUnmuted is the "leg.unmuted" WebhookEventType value.
	EventLegUnmuted WebhookEventType = "leg.unmuted"
	// EventLegDeaf is the "leg.deaf" WebhookEventType value.
	EventLegDeaf WebhookEventType = "leg.deaf"
	// EventLegUndeaf is the "leg.undeaf" WebhookEventType value.
	EventLegUndeaf WebhookEventType = "leg.undeaf"
	// EventLegHold is the "leg.hold" WebhookEventType value.
	EventLegHold WebhookEventType = "leg.hold"
	// EventLegUnhold is the "leg.unhold" WebhookEventType value.
	EventLegUnhold WebhookEventType = "leg.unhold"
	// EventLegCommandFailed is the "leg.command_failed" WebhookEventType value.
	EventLegCommandFailed WebhookEventType = "leg.command_failed"
	// EventLegICEInterrupted is the "leg.ice_interrupted" WebhookEventType value.
	EventLegICEInterrupted WebhookEventType = "leg.ice_interrupted"
	// EventLegICERestored is the "leg.ice_restored" WebhookEventType value.
	EventLegICERestored WebhookEventType = "leg.ice_restored"
	// EventLegStreamAdded is the "leg.stream_added" WebhookEventType value.
	EventLegStreamAdded WebhookEventType = "leg.stream_added"
	// EventLegStreamRemoved is the "leg.stream_removed" WebhookEventType value.
	EventLegStreamRemoved WebhookEventType = "leg.stream_removed"
	// EventLegStreamRejected is the "leg.stream_rejected" WebhookEventType value.
	EventLegStreamRejected WebhookEventType = "leg.stream_rejected"
	// EventLegStreamFailed is the "leg.stream_failed" WebhookEventType value.
	EventLegStreamFailed WebhookEventType = "leg.stream_failed"
	// EventLegStreamRoomChanged is the "leg.stream_room_changed" WebhookEventType value.
	EventLegStreamRoomChanged WebhookEventType = "leg.stream_room_changed"
	// EventLegStreamRoleChanged is the "leg.stream_role_changed" WebhookEventType value.
	EventLegStreamRoleChanged WebhookEventType = "leg.stream_role_changed"
	// EventSiprecSessionStarted is the "siprec.session_started" WebhookEventType value.
	EventSiprecSessionStarted WebhookEventType = "siprec.session_started"
	// EventSiprecSessionEnded is the "siprec.session_ended" WebhookEventType value.
	EventSiprecSessionEnded WebhookEventType = "siprec.session_ended"
	// EventSiprecMetadataUpdated is the "siprec.metadata_updated" WebhookEventType value.
	EventSiprecMetadataUpdated WebhookEventType = "siprec.metadata_updated"
	// EventSiprecParticipantJoined is the "siprec.participant_joined" WebhookEventType value.
	EventSiprecParticipantJoined WebhookEventType = "siprec.participant_joined"
	// EventSiprecParticipantLeft is the "siprec.participant_left" WebhookEventType value.
	EventSiprecParticipantLeft WebhookEventType = "siprec.participant_left"
	// EventDTMFReceived is the "dtmf.received" WebhookEventType value.
	EventDTMFReceived WebhookEventType = "dtmf.received"
	// EventRTTReceived is the "rtt.received" WebhookEventType value.
	EventRTTReceived WebhookEventType = "rtt.received"
	// EventSpeakingStarted is the "speaking.started" WebhookEventType value.
	EventSpeakingStarted WebhookEventType = "speaking.started"
	// EventSpeakingStopped is the "speaking.stopped" WebhookEventType value.
	EventSpeakingStopped WebhookEventType = "speaking.stopped"
	// EventPlaybackStarted is the "playback.started" WebhookEventType value.
	EventPlaybackStarted WebhookEventType = "playback.started"
	// EventPlaybackFinished is the "playback.finished" WebhookEventType value.
	EventPlaybackFinished WebhookEventType = "playback.finished"
	// EventPlaybackError is the "playback.error" WebhookEventType value.
	EventPlaybackError WebhookEventType = "playback.error"
	// EventTTSStarted is the "tts.started" WebhookEventType value.
	EventTTSStarted WebhookEventType = "tts.started"
	// EventTTSFinished is the "tts.finished" WebhookEventType value.
	EventTTSFinished WebhookEventType = "tts.finished"
	// EventTTSError is the "tts.error" WebhookEventType value.
	EventTTSError WebhookEventType = "tts.error"
	// EventTTSStaged is the "tts.staged" WebhookEventType value.
	EventTTSStaged WebhookEventType = "tts.staged"
	// EventTTSDiscarded is the "tts.discarded" WebhookEventType value.
	EventTTSDiscarded WebhookEventType = "tts.discarded"
	// EventRecordingStarted is the "recording.started" WebhookEventType value.
	EventRecordingStarted WebhookEventType = "recording.started"
	// EventRecordingFinished is the "recording.finished" WebhookEventType value.
	EventRecordingFinished WebhookEventType = "recording.finished"
	// EventRecordingPaused is the "recording.paused" WebhookEventType value.
	EventRecordingPaused WebhookEventType = "recording.paused"
	// EventRecordingResumed is the "recording.resumed" WebhookEventType value.
	EventRecordingResumed WebhookEventType = "recording.resumed"
	// EventLegTransferInitiated is the "leg.transfer_initiated" WebhookEventType value.
	EventLegTransferInitiated WebhookEventType = "leg.transfer_initiated"
	// EventLegTransferRequested is the "leg.transfer_requested" WebhookEventType value.
	EventLegTransferRequested WebhookEventType = "leg.transfer_requested"
	// EventLegTransferProgress is the "leg.transfer_progress" WebhookEventType value.
	EventLegTransferProgress WebhookEventType = "leg.transfer_progress"
	// EventLegTransferCompleted is the "leg.transfer_completed" WebhookEventType value.
	EventLegTransferCompleted WebhookEventType = "leg.transfer_completed"
	// EventLegTransferFailed is the "leg.transfer_failed" WebhookEventType value.
	EventLegTransferFailed WebhookEventType = "leg.transfer_failed"
	// EventRoomCreated is the "room.created" WebhookEventType value.
	EventRoomCreated WebhookEventType = "room.created"
	// EventRoomDeleted is the "room.deleted" WebhookEventType value.
	EventRoomDeleted WebhookEventType = "room.deleted"
	// EventRoomBridged is the "room.bridged" WebhookEventType value.
	EventRoomBridged WebhookEventType = "room.bridged"
	// EventRoomBridgeUpdated is the "room.bridge_updated" WebhookEventType value.
	EventRoomBridgeUpdated WebhookEventType = "room.bridge_updated"
	// EventRoomUnbridged is the "room.unbridged" WebhookEventType value.
	EventRoomUnbridged WebhookEventType = "room.unbridged"
	// EventRoomRoutingChanged is the "room.routing_changed" WebhookEventType value.
	EventRoomRoutingChanged WebhookEventType = "room.routing_changed"
	// EventLegRoleChanged is the "leg.role_changed" WebhookEventType value.
	EventLegRoleChanged WebhookEventType = "leg.role_changed"
	// EventSTTText is the "stt.text" WebhookEventType value.
	EventSTTText WebhookEventType = "stt.text"
	// EventSTTTurn is the "stt.turn" WebhookEventType value.
	EventSTTTurn WebhookEventType = "stt.turn"
	// EventAgentConnected is the "agent.connected" WebhookEventType value.
	EventAgentConnected WebhookEventType = "agent.connected"
	// EventAgentDisconnected is the "agent.disconnected" WebhookEventType value.
	EventAgentDisconnected WebhookEventType = "agent.disconnected"
	// EventAgentUserTranscript is the "agent.user_transcript" WebhookEventType value.
	EventAgentUserTranscript WebhookEventType = "agent.user_transcript"
	// EventAgentAgentResponse is the "agent.agent_response" WebhookEventType value.
	EventAgentAgentResponse WebhookEventType = "agent.agent_response"
	// EventAMDResult is the "amd.result" WebhookEventType value.
	EventAMDResult WebhookEventType = "amd.result"
	// EventAMDBeep is the "amd.beep" WebhookEventType value.
	EventAMDBeep WebhookEventType = "amd.beep"
	// EventSIPRegistrationAttempt is the "sip.registration_attempt" WebhookEventType value.
	EventSIPRegistrationAttempt WebhookEventType = "sip.registration_attempt"
	// EventSIPRegistrationActive is the "sip.registration_active" WebhookEventType value.
	EventSIPRegistrationActive WebhookEventType = "sip.registration_active"
	// EventSIPRegistrationExpired is the "sip.registration_expired" WebhookEventType value.
	EventSIPRegistrationExpired WebhookEventType = "sip.registration_expired"
	// EventSIPOutboundRegistrationActive is the "sip.outbound_registration_active" WebhookEventType value.
	EventSIPOutboundRegistrationActive WebhookEventType = "sip.outbound_registration_active"
	// EventSIPOutboundRegistrationFailed is the "sip.outbound_registration_failed" WebhookEventType value.
	EventSIPOutboundRegistrationFailed WebhookEventType = "sip.outbound_registration_failed"
	// EventSIPOutboundRegistrationExpired is the "sip.outbound_registration_expired" WebhookEventType value.
	EventSIPOutboundRegistrationExpired WebhookEventType = "sip.outbound_registration_expired"
	// EventSIPTrunkUp is the "sip.trunk_up" WebhookEventType value.
	EventSIPTrunkUp WebhookEventType = "sip.trunk_up"
	// EventSIPTrunkDown is the "sip.trunk_down" WebhookEventType value.
	EventSIPTrunkDown WebhookEventType = "sip.trunk_down"
	// EventInstanceStatusChanged is the "instance.status_changed" WebhookEventType value.
	EventInstanceStatusChanged WebhookEventType = "instance.status_changed"
)

Directories

Path Synopsis
examples
dialer command
Command dialer originates a configurable number of outbound SIP calls through an SBC at a configurable rate, with Answering Machine Detection enabled, and applies a simple post-answer policy per call:
Command dialer originates a configurable number of outbound SIP calls through an SBC at a configurable rate, with Answering Machine Detection enabled, and applies a simple post-answer policy per call:
pstn command
Command pstn is a tiny "fake PSTN" service useful for exercising upstream SBCs / dialers.
Command pstn is a tiny "fake PSTN" service useful for exercising upstream SBCs / dialers.
rtt command
Command rtt is a Real-Time Text (T.140 / RFC 4103) demo for VoiceBlender, extended with a WebRTC audio bridge so a browser can join the same room as the inbound SIP caller.
Command rtt is a Real-Time Text (T.140 / RFC 4103) demo for VoiceBlender, extended with a WebRTC audio bridge so a browser can join the same room as the inbound SIP caller.
sbc command
Command sbc is a tiny Session Border Controller (B2BUA) built on VoiceBlender.
Command sbc is a tiny Session Border Controller (B2BUA) built on VoiceBlender.

Jump to

Keyboard shortcuts

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