CyCoreSystems / audiosocket

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

Audio received by AudioSocket app is not played #4

Closed eduardoHoefel closed 4 years ago

eduardoHoefel commented 4 years ago

I setup a server that receives audio from AudioSocket, plays with the bytes for a white and then sends the data back to the same socket connection. image I added a few debug lines to check what was happening with the data. Apparently the socket is receiving correctly, but it doesn't play for some reason. The data sent by the Asterisk is correct. I saved the bytes received to a file and was able to play it. The problem is that asterisk is not playing back what it receives.

Ulexus commented 4 years ago

Can you supply the relevant dialplan and app (or clarify what it is doing... I don't understand "plays with the bytes for a white and then sends the data back")?

eduardoHoefel commented 4 years ago

This is my dialplan: exten => _X.,1,Answer() ; Answer the line exten => _X.,n,AudioSocket(854ede9a-27bb-4441-8328-b006de37414e,localhost:9092)

I have a server listening localhost:9092. It reads the data, encodes with OPUS, decodes, and sends it back.

I checked that the app is reading it correctly res/res_audiosocket.c, function ast_audiosocket_receive_frame. I have a debug line that tells me how many bytes it received. And it didnt fall in any of the ifs that catch errors.

Ulexus commented 4 years ago

I would still suspect this is the echo canceler in action. Running the audio through a codec is not going to trick the echo canceler into thinking it is not echo... echo cancelers are designed to handle lossy codecs and bad lines.

I would suggest starting with a playback-and-record app first, to eliminate the echo canceler as a possibility. There is a playback test in the examples/playfile directory of this repository.

eduardoHoefel commented 4 years ago

There must be something wrong with my asterisk config or the app itself. I started the example you mentioned and still didnt hear anything. just changed to use port 9092. Does it work for you? Do you any any kind of configuration or modification in your project?

Ulexus commented 4 years ago

Yes, I use this across a great many installations and projects. There is nothing special that I can think of about my setups. I have a pretty barebones setup I use for testing.

Ulexus commented 4 years ago

Since I'm trying to get this included in upstream Asterisk, I would like to know why it isn't working for you. Have you verified basic functionality of your system? For instance:

exten => _X.,1,Answer() ; Answer the line
exten => _X.,n,Playback(tt-monkeys) ; play a file
eduardoHoefel commented 4 years ago

Sorry, I know what is happening. The monkey audio wasnt played. My network is blocking one machine to reach the other. One of them is a VM, which cannot reach the host.

I'll change to two VMs and update you

eduardoHoefel commented 4 years ago

I also had some misconfiguration in sip.conf. Solved everything and now works perfectly!

confinality commented 9 months ago

Hi, can you tell how exactly it worked for you? I am trying to do the same and there is no error in the audiosocket, however it doesn't play the audio in the asterisk. I am playing a greeting message as well which is being played fine. Thank you.