Replies: 8 comments 6 replies
-
|
I've moved that from the "Merging inbound/outbound methods" discussion to here. Both are related in the way that if we implement channels we break the API, so we can also break connection handling API by merging inbound/outbound 😀 |
Beta Was this translation helpful? Give feedback.
-
|
I really like this idea, this level of control would be really nice to have and I think it would be worth the risk of adding some breaking changes to the lib. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Contributions are always welcome, but we just need to make sure they don't harm the scope of the project. My goal with Genesis is to enable this level of abstraction in the work, but not to do all the work. The idea is for it to be a framework for developing apps for FreeSwitch and not an application in its own right. So having APIs at the code level for fine-grained call control could be interesting, but we're not going to actually implement a web server that does this. |
Beta Was this translation helpful? Give feedback.
-
|
Still work in progress, but i wanted to show you what i have so far: https://github.com/Netzvamp/Genesis/tree/channels Look at the examples, especially the outbound_originate.py: https://github.com/Netzvamp/Genesis/tree/channels/examples That shows the flexibility of the approach: We can answer, do playback, originate a second channel that gets a playback before we bridge them together. Then we unbridge them again to play every leg a different file and then bridge them again together. It's possible with current genesis, but the python dialplan would be a mess 😉 There are still many things to do:
There may be some breaking changes, but i can't tell since my code base is already migrated. I don't have a timeline yet for the todos but i'll update you here. So, what do you think? |
Beta Was this translation helpful? Give feedback.
-
|
Since i've already implemented breaking changes, i can continue with that 😉 After bgapi i looked more into async and how to handle tasks. Using a block parameter in an async library is generally not a good idea and does not conform to standard practices in the Python asyncio ecosystem.
## Before:
# Fire off the command and get a future-like object
result_future = await channel.playback("file.wav", block=False)
# Do other work...
# Wait for the command to complete later
await result_future
## After:
# Create a task to run the command in the background
playback_task = asyncio.create_task(channel.playback("file.wav"))
# Do other work...
# Wait for the task to complete later
result = await playback_task
## General handling example:
# Create a task to run the operation in the background
task = asyncio.create_task(long_running_operation())
# Loop until the task is done, checking periodically
while not task.done():
print("Checking task status... not done yet.")
# Yield control to the event loop for a short time
await asyncio.sleep(0.5)
print("Task is complete!")
# Safely get the result after the task is done
result = await task
print(f"Result: {result}")There are many more async task managing methods usable to execute these task in different ways: I think it would be a benefit to remove the block parameter for clarity and standard compliance with python and other libraries. |
Beta Was this translation helpful? Give feedback.
-
|
I made a significant improvement to the project, which also includes the beginning of a channel abstraction for inbound and outbound connections. This is just the start of what we had in mind and can certainly be improved. I'm closing this topic because some time has passed and we haven't had any interactions, but each suggestion for improvement to the new abstraction can become a new topic or a pull request for the project. |
Beta Was this translation helpful? Give feedback.
-
|
I'm also prepairing channels abstraction. What i've done some months ago is to incompatible with the current master branch, so i've redone it and made it a optional addon API that doesn't interfere with existing API. My plan is to test it tomorrow in real life conditions and make a pull request next week. |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
-
I would love to implement channels into genesis. That way we could address each leg of a call or a newly originate call with it's own uuid. We could filter by channels and get clean separated events for every freeswitch phone/user. And we could also get new channel objects out of inbound connections. Currently we filter by "Unique-ID" header with
myevents, but that way we only separate events by sessions, not by channels/legs. Andmyeventsprevents to ever get events with different "Unique-ID"s, so originate a new channel is nearly impossible.(I never use
myeventin my stuff and manuell usefilterto add known UUIDs, then i can originate a call and can handle this call parallel to the initial call. That could be the default, so we could create new channels by manually set UUIDs and filter them.)With channels we could implement very pythonic APIs(dummy code, don't care to much about syntax 😉):
result, channel_b = session.channel.bridge("dialstring", <options>)result = session.channel.bridge(session.originate("my origination dial string"), )`This might be a more logical way to handle what happens to which call member and when.
I've already implemented something like that into my own library and would love to get this to the genesis level.
The problem is with API compatibility. It would definitively break something.
Beta Was this translation helpful? Give feedback.
All reactions