Runner

March 10, 2026 · View on GitHub

Package runner provides runner types, session storage, and telephony/WebRTC session argument types for the development runner (POST /start, /sessions/{id}, Daily, LiveKit, etc.).

Purpose

  • Session: Per-call/session data (Body from /start, EnableDefaultIceServers).
  • SessionStore: Put/Get/Delete sessions by ID; in-memory (single instance) or Redis (horizontal scaling).
  • Runner args: RunnerArgs, DailyRunnerArgs, WebSocketRunnerArgs, SmallWebRTCRunnerArgs, LiveKitRunnerArgs carry transport-specific parameters (room URL, token, SDP, etc.).
  • Telephony: TelephonyCallData, ParseTelephonyMessage detect provider (Twilio, Telnyx, Plivo, Exotel) and build the right frame serializer.
  • Dial-in: DialinSettings, DailyDialinRequest for Daily PSTN dial-in webhook.

Session lifecycle

stateDiagram-v2
    [*] --> Created : POST /start
    Created --> Active : transport connected
    Active --> Active : /sessions/id/api/offer etc.
    Active --> Ended : disconnect or timeout
    Ended --> [*] : Delete(session_id)
  • Server creates a session (e.g. on POST /start), stores it in SessionStore, returns session ID. Client uses the ID for WebRTC offer or WebSocket telephony. When the call ends, the server deletes the session.

Exported symbols

SymbolTypeDescription
SessionstructBody, EnableDefaultIceServers
SessionStoreinterfacePut(id, sess), Get(id), Delete(id)
MemorySessionStorestructIn-memory store; NewMemorySessionStore, Put, Get, Delete
RedisSessionStorestructRedis-backed store with TTL; RedisSessionStoreOptions, NewRedisSessionStore
NewSessionStoreFromConfig(cfg)funcReturns memory or Redis store from config (session_store, redis_url, session_ttl_secs)
RunnerArgsstructHandleSigint, HandleSigterm, PipelineIdleTimeoutSecs, Body
DailyRunnerArgsstructRunnerArgs + RoomURL, Token
WebSocketRunnerArgsstructRunnerArgs + Body (telephony)
SmallWebRTCRunnerArgsstructRunnerArgs + SDP, Type, PCID, RestartPC, RequestData
LiveKitRunnerArgsstructRunnerArgs + RoomName, URL, Token
DialinSettingsstructCallID, CallDomain, To, From, SIPHeaders (Daily dial-in)
DailyDialinRequeststructDialinSettings, DailyAPIKey, DailyAPIURL
TelephonyCallDatastructProvider, stream/call IDs, body (Twilio, Telnyx, Plivo, Exotel)
ParseTelephonyMessage(first, second []byte)funcDetects provider and returns TelephonyCallData
Serializer helpersfuncsBuild Twilio/Telnyx/Plivo/Exotel serializer from TelephonyCallData

Concurrency

  • MemorySessionStore: Protected by sync.RWMutex for Put/Get/Delete.
  • RedisSessionStore: Uses Redis client (safe for concurrent use); Put sets TTL.

Files

FileDescription
types.goRunnerArgs, DailyRunnerArgs, WebSocketRunnerArgs, SmallWebRTCRunnerArgs, LiveKitRunnerArgs, DialinSettings, DailyDialinRequest
session.goSession, SessionStore, MemorySessionStore
session_factory.goNewSessionStoreFromConfig
redis_session.goRedisSessionStore, RedisSessionStoreOptions, NewRedisSessionStore
telephony.goTelephonyCallData, ParseTelephonyMessage, serializer construction

Subpackages

PathDescription
daily/Daily.co transport integration (room, token, dial-in)
livekit/LiveKit transport integration

See also