Genesis is a Python library designed to build asynchronous applications that interact with FreeSWITCH through the Event Socket Layer (ESL).
- Asynchronous by Design: Built with
asynciofor high-performance, non-blocking I/O. - Inbound, Outbound, and Consumer Modes: Supports all major ESL modes for comprehensive FreeSWITCH integration.
- Decorator-Based Event Handling: A simple and intuitive way to handle FreeSWITCH events.
- OpenTelemetry Support: Built-in instrumentation for tracing connections and commands.
- Extensible and Customizable: Easily extend and customize the library to fit your needs.
Install Genesis using pip:
pip install genesisFor better asyncio performance on Unix (Linux and macOS), use the optional uvloop extra: pip install genesis[uvloop]. See the Installation Guide for details.
importasynciofromgenesisimportInboundasyncdefuptime():
asyncwithInbound("127.0.0.1", 8021, "ClueCon") asclient:
returnawaitclient.send("uptime")
asyncdefmain():
response=awaituptime()
print(response)
asyncio.run(main())importasynciofromgenesisimportConsumerapp=Consumer("127.0.0.1", 8021, "ClueCon")
@app.handle("HEARTBEAT")asyncdefhandler(event):
awaitasyncio.sleep(0.001)
print(event)
asyncio.run(app.start())importasynciofromgenesisimportOutboundasyncdefhandler(session):
awaitsession.answer()
awaitsession.playback('ivr/ivr-welcome')
awaitsession.hangup()
app=Outbound(handler, "127.0.0.1", 5000)
asyncio.run(app.start())Full documentation is available on the documentation website.
To preview the docs locally, install Hugo and run:
hugo server --source docs --disableFastRenderInstall development dependencies with Poetry and execute the test suite using tox:
poetry install
toxContributions are welcome! Whether it's improving documentation, suggesting new features, or fixing bugs, your help is appreciated.
Please read our Contributing Guide and Code of Conduct to get started.
Vitor Hugo | RL | Dongwoon Kim |
This project is licensed under the MIT License - see the LICENSE.md file for details.