Documentation
¶
Overview ¶
Package runner provides Redis-backed session store for horizontal scaling.
Package runner provides runner types and session management.
Package runner provides runner telephony WebSocket parsing and serializer construction.
Package runner provides runner types and session argument types for development runner.
Index ¶
- func BuildTelephonySerializer(data TelephonyCallData, getKey GetAPIKeyFunc) serialize.Serializer
- func ReadFirstTwoTextMessages(readFunc func() ([]byte, error)) (first, second []byte, err error)
- type DailyDialinRequest
- type DailyRunnerArgs
- type DialinSettings
- type GetAPIKeyFunc
- type LiveKitRunnerArgs
- type MemorySessionStore
- type RedisSessionStore
- type RedisSessionStoreOptions
- type RunnerArgs
- type Session
- type SessionStore
- type SmallWebRTCRunnerArgs
- type TelephonyCallData
- type WebSocketRunnerArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTelephonySerializer ¶
func BuildTelephonySerializer(data TelephonyCallData, getKey GetAPIKeyFunc) serialize.Serializer
BuildTelephonySerializer returns a Serializer for the given provider and call data. getKey is used to resolve account SID, auth token, API key, etc.
func ReadFirstTwoTextMessages ¶
ReadFirstTwoTextMessages reads up to two text messages from the WebSocket-style reader. It is used to parse the telephony handshake. The readFunc should read one message and return (payload, nil) or (nil, err).
Types ¶
type DailyDialinRequest ¶
type DailyDialinRequest struct {
DialinSettings DialinSettings `json:"dialin_settings"`
DailyAPIKey string `json:"daily_api_key"`
DailyAPIURL string `json:"daily_api_url"`
}
DailyDialinRequest is the request body for Daily PSTN dial-in webhook handler.
type DailyRunnerArgs ¶
type DailyRunnerArgs struct {
RunnerArgs
RoomURL string
Token string
}
DailyRunnerArgs holds Daily transport session arguments.
type DialinSettings ¶
type DialinSettings struct {
CallID string `json:"callId"`
CallDomain string `json:"callDomain"`
To string `json:"To,omitempty"`
From string `json:"From,omitempty"`
SIPHeaders map[string]string `json:"sipHeaders,omitempty"`
}
DialinSettings holds dial-in settings from the Daily webhook (PSTN/SIP). Matches runner cloud and Daily.co webhook payload structure (camelCase from webhook).
type GetAPIKeyFunc ¶
GetAPIKeyFunc returns an API key for a service (e.g. from config or env).
type LiveKitRunnerArgs ¶
type LiveKitRunnerArgs struct {
RunnerArgs
RoomName string
URL string
Token string
}
LiveKitRunnerArgs holds LiveKit transport session arguments.
type MemorySessionStore ¶
type MemorySessionStore struct {
// contains filtered or unexported fields
}
MemorySessionStore is an in-memory, concurrency-safe store for sessions by ID.
func NewMemorySessionStore ¶
func NewMemorySessionStore() *MemorySessionStore
NewMemorySessionStore returns a new in-memory session store.
func (*MemorySessionStore) Delete ¶
func (s *MemorySessionStore) Delete(id string) error
Delete removes the session for id. Idempotent.
type RedisSessionStore ¶
type RedisSessionStore struct {
// contains filtered or unexported fields
}
RedisSessionStore stores sessions in Redis with a configurable TTL and key prefix.
func NewRedisSessionStore ¶
func NewRedisSessionStore(client *redis.Client, opts RedisSessionStoreOptions) *RedisSessionStore
NewRedisSessionStore creates a session store backed by the given Redis client.
func (*RedisSessionStore) Delete ¶
func (s *RedisSessionStore) Delete(id string) error
Delete removes the session for id. Idempotent.
func (*RedisSessionStore) Get ¶
func (s *RedisSessionStore) Get(id string) (*Session, error)
Get returns the session for id, or (nil, nil) if not found.
type RedisSessionStoreOptions ¶
type RedisSessionStoreOptions struct {
// Prefix is prepended to session IDs for Redis keys (default: "voxray:session:").
Prefix string
// TTL is how long sessions live in Redis (default: 1 hour).
TTL time.Duration
}
RedisSessionStoreOptions configures a RedisSessionStore.
type RunnerArgs ¶
type RunnerArgs struct {
// HandleSigint indicates whether to handle SIGINT (default false).
HandleSigint bool
// HandleSigterm indicates whether to handle SIGTERM (default false).
HandleSigterm bool
// PipelineIdleTimeoutSecs is the pipeline idle timeout in seconds (default 300).
PipelineIdleTimeoutSecs int
// Body holds additional request data (e.g. custom parameters from /start or webhook).
Body map[string]interface{}
}
RunnerArgs holds common session arguments for the runner.
type Session ¶
type Session struct {
// Body is the optional request body from /start.
Body map[string]interface{}
// EnableDefaultIceServers is set when the client requested default ICE config in /start.
EnableDefaultIceServers bool
}
Session holds data for a runner session (created by POST /start).
type SessionStore ¶
type SessionStore interface {
Put(id string, sess *Session) error
Get(id string) (*Session, error)
Delete(id string) error
}
SessionStore is the interface for storing and retrieving sessions by ID. Implementations may be in-memory (single instance) or backed by Redis (horizontal scaling).
func NewSessionStoreFromConfig ¶
func NewSessionStoreFromConfig(cfg *config.Config) (SessionStore, error)
NewSessionStoreFromConfig returns a SessionStore based on cfg. When session_store is "" or "memory", returns an in-memory store (single instance / vertical scaling). When session_store is "redis", requires redis_url and returns a Redis-backed store (horizontal scaling).
type SmallWebRTCRunnerArgs ¶
type SmallWebRTCRunnerArgs struct {
RunnerArgs
// SDP is the WebRTC SDP offer string.
SDP string
// Type is the SDP type (e.g. "offer").
Type string
// PCID is the peer connection ID from the client.
PCID string
// RestartPC indicates whether the client requested a peer connection restart.
RestartPC bool
// RequestData is the session/request payload from the client.
RequestData map[string]interface{}
}
SmallWebRTCRunnerArgs holds Small WebRTC session arguments (e.g. from /sessions/{id}/api/offer).
type TelephonyCallData ¶
type TelephonyCallData struct {
Provider string
// Twilio
StreamSid string
CallSid string
Body map[string]interface{}
// Telnyx
StreamID string
CallControlID string
OutboundEnc string
InboundEnc string
From, To string
// Plivo
StreamIDPlivo string
CallID string
// Exotel
AccountSid string
}
TelephonyCallData holds provider-specific call identifiers and options. Used after ParseTelephonyMessage to build the appropriate serializer.
func ParseTelephonyMessage ¶
func ParseTelephonyMessage(firstMessage []byte, secondMessage []byte) (data TelephonyCallData, ok bool)
ParseTelephonyMessage parses the first WebSocket message(s) and detects the telephony provider. It returns the provider name ("twilio", "telnyx", "plivo", "exotel") and call data. Message structure is used to detect: Twilio (event/start/streamSid/callSid), Telnyx (stream_id/call_control_id), Plivo (start/streamId/callId), Exotel (event/start/stream_sid/call_sid/account_sid).
type WebSocketRunnerArgs ¶
type WebSocketRunnerArgs struct {
RunnerArgs
// Body is typically set from parsed telephony call data (stream_id, call_id, etc.).
Body map[string]interface{}
}
WebSocketRunnerArgs holds WebSocket (telephony) session arguments. The WebSocket connection and body are passed when handling /ws for telephony.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package daily provides Daily.co room and meeting token creation via the REST API (runner Daily integration).
|
Package daily provides Daily.co room and meeting token creation via the REST API (runner Daily integration). |
|
Package livekit provides LiveKit room URL and agent token configuration from environment (runner Livekit integration).
|
Package livekit provides LiveKit room URL and agent token configuration from environment (runner Livekit integration). |