Command-Line Interface
Command-Line Interface
The Genesis CLI provides commands to run and manage your FreeSWITCH ESL applications. It automatically detects your application code and supports both development and production modes.
Global Options
| Option | Description |
|---|---|
--version | Show the version and exit. |
--json | Output logs in JSON format. |
genesis consumer
Run an ESL event consumer application.
Commands
genesis consumer dev- Development mode with auto-reloadgenesis consumer run- Production mode
Options
| Option | Description | Default | Env Var |
|---|---|---|---|
--host | FreeSWITCH host to connect to. | 127.0.0.1 | ESL_HOST |
--port | FreeSWITCH port to connect to. | 8021 | ESL_PORT |
--password | Password for authentication. | ClueCon | ESL_PASSWORD |
--app | Variable name containing the Consumer app (defaults to app or first Consumer found). | None | ESL_APP_NAME |
--loglevel | Logging level (debug, info, warning, error). | info | ESL_LOG_LEVEL |
Examples
Development mode with auto-reload:
genesis consumer dev ./my_app.py --host 192.168.1.100 --password MySecretPasswordProduction mode:
genesis consumer run ./my_app.py --host 192.168.1.100 --password MySecretPasswordgenesis outbound
Run an outbound service application.
Commands
genesis outbound dev- Development mode with auto-reloadgenesis outbound run- Production mode
Options
| Option | Description | Default | Env Var |
|---|---|---|---|
--host | Host to serve on. | 127.0.0.1 | ESL_APP_HOST |
--port | Port to serve on. | 9000 | ESL_APP_PORT |
--app | Variable name containing the Outbound app (defaults to app or first Outbound found). | None | ESL_APP_NAME |
--loglevel | Logging level (debug, info, warning, error). | info | ESL_LOG_LEVEL |
Examples
Development mode with auto-reload:
genesis outbound dev ./my_outbound.py --host 0.0.0.0 --port 5000Production mode:
genesis outbound run ./my_outbound.py --host 0.0.0.0 --port 5000Application Discovery
The CLI automatically discovers your application - no manual configuration needed!
Path
Imports the module from the file or directory path provided.
App Detection
Looks for a variable named app, or the first Consumer/Outbound instance found.
Custom App Name
Use --app to specify a different variable name.
Example
# my_app.py
from genesis import Consumer
app = Consumer("127.0.0.1", 8021, "ClueCon")
@app.handle("HEARTBEAT")
async def handler(event):
print(event)genesis consumer dev my_app.py