How otoru/genesis works
Genesis is an asyncio Python library for connecting applications to FreeSWITCH over ESL. The main workflows are inbound clients issuing commands, consumers registering event handlers, and outbound servers accepting call sessions for application callbacks. Internally, the protocol layer reads and parses ESL traffic, processes and routes events, while channel and session abstractions support call operations; ring groups add coordinated dialing. The README documents the three modes and event handling; some implementation links below are limited to relationships visible in the supplied excerpts or source index.
Main entry points: base.py Protocol engine · session.py Call session · inbound.py Inbound client · outbound.py Outbound server
Components 22
Application interfaces
- Inbound client
genesis/inbound.py - Event consumer
genesis/consumer.py - Outbound server
genesis/outbound.py - Consumer CLI
genesis/cli/consumer.py - Outbound CLI
genesis/cli/outbound.py
Call operations
- Channel operations
genesis/channel.py - Call session
genesis/session.py - Ring groups
genesis/group/ring.py - Load balancing
genesis/group/load_balancer.py
ESL protocol
- Protocol engine
genesis/protocol/base.py - Lifecycle processing
genesis/protocol/lifecycle.py - Event processors
genesis/protocol/processors.py - Reader state machine
genesis/protocol/reader_fsm.py - ESL parser
genesis/protocol/parser.py - Event routing
genesis/protocol/routing - Async queue
genesis/queue/core.py
Observability and runtime
- Protocol metrics
genesis/protocol/metrics.py - Tracing telemetry
genesis/protocol/telemetry.py - OpenTelemetry setup
genesis/observability/otel_config.py - Structured logging
genesis/observability/logger.py
Other components
- Application developer
- FreeSWITCH ESL
Connections 29
- Application developer → Inbound client: opens connection
- Application developer → Event consumer: registers handlers
- Application developer → Outbound server: provides callback
- Inbound client → FreeSWITCH ESL: sends ESL commands
- Event consumer → Inbound client: uses connection
genesis/consumer.py - Outbound server → FreeSWITCH ESL: accepts ESL sessions
- Outbound server → Call session: creates sessions
genesis/outbound.py - Call session → Channel operations: associates channel
genesis/session.py - Ring groups → Channel operations: creates channels
genesis/group/ring.py - Ring groups → Load balancing: selects destination
genesis/group/ring.py - Consumer CLI → Event consumer: starts app
genesis/cli/consumer.py - Outbound CLI → Outbound server: starts app
genesis/cli/outbound.py - Protocol engine → Reader state machine: reads frames
genesis/protocol/base.py - Reader state machine → ESL parser: parses payload
genesis/protocol/reader_fsm.py - Protocol engine → ESL parser: parses events
genesis/protocol/base.py - Protocol engine → Event processors: processes events
genesis/protocol/base.py - Event processors → Lifecycle processing: dispatches lifecycle
genesis/protocol/processors.py - Protocol engine → Event routing: routes events
genesis/protocol/base.py - Event routing → ESL parser: consumes events
genesis/protocol/routing/channel.py - Protocol engine → Protocol metrics: records metrics
genesis/protocol/base.py - Channel operations → Protocol metrics: records metrics
genesis/channel.py - Call session → Protocol metrics: records metrics
genesis/session.py - Protocol engine → Tracing telemetry: instruments events
genesis/protocol/base.py - OpenTelemetry setup → Tracing telemetry: configures tracing
- Protocol engine → Structured logging: logs activity
genesis/protocol/base.py - Inbound client → Protocol engine: uses protocol
genesis/inbound.py - Channel operations → Protocol engine: issues commands
genesis/channel.py - Call session → Protocol engine: sends commands
genesis/session.py - Protocol engine → Async queue: queues events