amigniter / mod_audio_stream

FreeSWITCH module to stream audio to websocket and receive response
MIT License
50 stars 26 forks source link

Stream Raw data with base64 encoded #36

Open Pandi1981 opened 5 days ago

Pandi1981 commented 5 days ago

How to send the live stream from freeswitch with base64 encoded in json format... What kind of configuration required in freeswitch

amigniter commented 5 days ago

mod_audio_stream sends raw audio in a binary form, although it can accept json with base64 encoded audio. It is not difficult to modify the streamer to send b64 audio as well but we didn't plan such a feature, again, because each endpoint needs to recognize the format of a json object to be able to parse it. It could be more like a custom feature but as I said, not planned for the reasons mentioned.

Pandi1981 commented 3 days ago

We could not able to send the live rtp stream when the call coming from drachtio sip recording server to freeswitch, but recording happening properly... Please help me in this...

amigniter commented 3 days ago

Will you please explain what exactly you want to achieve? You have incoming call from sip recording server, you can record it, but you can't send it again to next endpoint, is that correct?

Pandi1981 commented 3 days ago

Yes correct

amigniter commented 3 days ago

Why don't you just use _mod_audiostream to send it ? Does your ws endpoint require receiving b64 audio, you can't sent binary raw audio ?

Pandi1981 commented 3 days ago

Yes I am using mod_audio_stream only with raw data using uuid even though i send in some open source as well echo.Websocket not working... Shall I share freeswitch configuration.... If you make a call directly to freeswitch and it's working but the RTP stream comes from drachtio SRS not working

amigniter commented 3 days ago

yes, please share the config.

but the RTP stream comes from drachtio SRS not working

This is to be expected. You also said when rtp stream comes to FS, you can record it ?

Pandi1981 commented 3 days ago

FS_config.txt Please find the attachments yes I can able to record it!!!

amigniter commented 3 days ago

Please find the attachments yes I can able to record it!!!

Thank you. Yes, recording is fine. The issue you are facing when trying to stream the audio is that you are answering the channel (on api) and trying to stream using mixed mode but you only have single channel. In order to use mixed mode you need the B-leg as well, you need to bridge the channel and stream it in mixed mode. To stream the current incoming call you can try using this command (since you only have A-leg) <action application="set" data="api_on_answer=uuid_audio_stream ${my_uuid} start wss://echo.websocket.org mono 8k "/>

Pandi1981 commented 3 days ago

Thanks a lot!!! It is working fine... Please help me how to send base64 encoded format... With json body

amigniter commented 3 days ago

You're welcome.

Please help me how to send base64 encoded format... With json body

As I said, _mod_audiostream sends L16 audio as a raw binary , not as b64 encoded. I might implement it as a feature but can't promise when.