Skip to main content

What is Genesis?

Gitpod badge Tests badge Build badge License badge

Client implementation of FreeSWITCH Event Socket protocol with asyncio.

Inbound Socket Mode

In [1]: from genesis import Client

In [2]: async with Client("127.0.0.1", 8021, "ClueCon") as client:
            response = await client.send("uptime")

In [3]: print(response)
{'Content-Type': 'command/reply', 'Reply-Text': '6943047'}

Event handler

With just one line of code we can make the awaitable be called whenever we receive a certain event from the freeswitch.

Example

In [1]: from genesis import Consumer

In [2]: app = Consumer("127.0.0.1", 8021, "ClueCon")

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

In [4]: await app.run()

Comments

  • For some cases where the ESL brings values without an associated key, we take the liberty of creating custom keys to simplify the work. Examples: X-API-Reply-Text and X-Event-Content-Text.
  • If a key purposely repeats in an event (Example: Content-Length in BACKGROUND_JOB event), we store both values in a list, in the order they are received.
  • For practical reasons, every event handler should be awaitable.

What is FreeSwitch?

FreeSWITCH is a free and open-source application server for real-time communication, WebRTC, telecommunications, video and Voice over Internet Protocol (VoIP). Multiplatform, it runs on Linux, Windows, macOS and FreeBSD. It is used to build PBX systems, IVR services, videoconferencing with chat and screen sharing, wholesale least-cost routing, Session Border Controller (SBC) and embedded communication appliances. It has full support for encryption, ZRTP, DTLS, SIPS. It can act as a gateway between PSTN, SIP, WebRTC, and many other communication protocols. Its core library, libfreeswitch, can be embedded into other projects. It is licensed under the Mozilla Public License (MPL), a free software license.

By wikipedia.

What is ESL?

ESL is a way to communicate with FreeSwitch. See more details here.

Why asyncio?

Asynchronous programming is a type of parallel programming in which a unit of work is allowed to run separately from the primary application thread. When the work is complete, it notifies the main thread about completion or failure of the worker thread. There are numerous benefits to using it, such as improved application performance and enhanced responsiveness. We adopted this way of working, as integrating genesis with other applications is simpler, since you only need to deal with python's native asynchronous programming interface.

How to contribute?

If you are thinking of contributing in any way to the project, you will be very welcome. Whether it's improving existing documentation, suggesting new features or running existing bugs, it's only by working together that the project will grow.

Do not forget to see our Contributing Guide and our Code of Conduct to always be aligned with the ideas of the project.

Contributors

Will be welcome ❤️

Author


@Otoru

Release files for genesis 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genesis 0.2.1
File Size Uploaded
genesis-0.2.1.tar.gz 10.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for genesis 0.2.1
File Interpreter ABI Platform
genesis-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / genesis-0.2.1.tar.gz

Download URL genesis-0.2.1.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a7fdc35b09aedcb9271fbf9fe63d9627fda0e0fee5d0ad567aa9b65e42212be5
BLAKE2b-256 checksum
How to use checksums
9d77ad201f38c25ab8c7c0500afe45c19fd86a8aa0cc829d9aa8ae472ee3bb8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

Release files / genesis-0.2.1-py3-none-any.whl

Download URL genesis-0.2.1-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d2268a6d0d256021e3f56e614649e10c0e55ad2baa8e8bbb574f91d11003b29
BLAKE2b-256 checksum
How to use checksums
1371b8285ce3431ff97d0d3a7a3ecc972c8710fb453acd2b7c40304692196db6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page