Skip to main content

Implementation of FreeSWITCH Event Socket protocol with asyncio

Project description

Genesis

Tests badge Build badge License badge Pypi Version badge Pypi python version badge Pypi wheel badge

Genesis is a Python library designed to build asynchronous applications that interact with FreeSWITCH through the Event Socket Layer (ESL).

Features

  • Asynchronous by Design: Built with asyncio for 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.
  • Extensible and Customizable: Easily extend and customize the library to fit your needs.

Installation

Install Genesis using pip:

pip install genesis

Quickstart

Inbound Socket Mode

import asyncio
from genesis import Inbound

async def uptime():
    async with Inbound("127.0.0.1", 8021, "ClueCon") as client:
        return await client.send("uptime")

async def main():
    response = await uptime()
    print(response)

asyncio.run(main())

Consumer Mode

import asyncio
from genesis import Consumer

app = Consumer("127.0.0.1", 8021, "ClueCon")

@app.handle("HEARTBEAT")
async def handler(event):
    await asyncio.sleep(0.001)
    print(event)

asyncio.run(app.start())

Outbound Socket Mode

import asyncio
from genesis import Outbound

async def handler(session):
    await session.answer()
    await session.playback('ivr/ivr-welcome')
    await session.hangup()

app = Outbound("127.0.0.1", 5000, handler)

asyncio.run(app.start())

Documentation

Full documentation is available on the documentation website.

To preview the docs locally, install Hugo and run:

hugo server --source docs --disableFastRender

Running Tests

Install development dependencies with Poetry and execute the test suite using tox:

poetry install
tox

How to Contribute

Contributions 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.

Contributors

Vitor
Vitor Hugo
RL/
RL
Dongwoon
Dongwoon Kim

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

genesis-0.9.5.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genesis-0.9.5-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file genesis-0.9.5.tar.gz.

File metadata

  • Download URL: genesis-0.9.5.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.10.2 Linux/6.11.0-1018-azure

File hashes

Hashes for genesis-0.9.5.tar.gz
Algorithm Hash digest
SHA256 19d884cc5287fee5fe6bd4327aca45676c4ffc713a0e791b2905369052b7d2a2
MD5 f0f544e15f9e0a9559a392e838a3ad38
BLAKE2b-256 8c825a487031bd877c074c36af8acaafb01debb6045b0a12bd516e43d73175a0

See more details on using hashes here.

File details

Details for the file genesis-0.9.5-py3-none-any.whl.

File metadata

  • Download URL: genesis-0.9.5-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.10.2 Linux/6.11.0-1018-azure

File hashes

Hashes for genesis-0.9.5-py3-none-any.whl
Algorithm Hash digest
SHA256 95a38f73777ece1fe691a1c9678eb17d0d441ef51dbeb937811dc80661f58943
MD5 5f5402bd6ae80b29313c1b336f6f7eb3
BLAKE2b-256 e34361e74baeee6d1fd7c0e7881eab067de90c256c71805346c25fa0b5a6a8fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page