CyCoreSystems / audiosocket

Simple bidirectional audio protocol
Apache License 2.0
67 stars 35 forks source link

Add support for async processing #19

Open nadirhamid opened 11 months ago

nadirhamid commented 11 months ago

I have noticed that the module currently runs synchronously and I was somewhat interested in knowing the design decisions that led to this. I am inclined to want to integrate a option that allows users to run Audiosocket async.

It would then be possible to integrate other Asterisk apps while running Audiosocket. Currently this is not possible.

In an effort to address this minor shortcoming for me, I created a fork where I started integrating some of the changes. So far I have mostly integrated posix threads and have made minor modifications to the code so it can fully utilize the Asterisk core methods.

It seems to work mostly, but there are some small discrepancies. For example, I cannot call certain Asterisk applications and play audio with Audiosocket at the same time. These issues are minor however.

You can view my fork at: https://github.com/nadirhamid/audiosocket

Here is the commit: https://github.com/nadirhamid/audiosocket/commit/2dcd3cb5bc7cb9385846cbfa1b6b3a4b2d67949e

I did not create a PR yet but I can tidy up this code and try that if its beneficial in anyway.

I wanted to get your thoughts on this first.

Do you think there are any plans to integrate a detached mode to Audiosocket in the near future ?

Looking forward to your feedback.

Ulexus commented 11 months ago

Running each AudioSocket connection in a separate thread is a great idea, but the C/Asterisk code in this repository is long out of date and no longer maintained. It has been included directly in Asterisk for many years, now, and it has migrated a lot since that inclusion, with many features and changes. So while I'm happy to accept a PR here for this, it would be best to submit it to the Asterisk project itself.