/* JVoIP - GStreamer integration Implement any kind of VoIP audio streaming JVoIP: https://www.mizu-voip.com/Software/SIPSDK/JavaSIPSDK.aspx GStreamer: https://gstreamer.freedesktop.org/ Workflow: 1. Launch GStreamer to listen on a specific port 2. Use the JVoIP Media notification events to capture audio packets from SIP and forward it to GStreamer listener port 3. Generate audio stream from GStreamer and send it to JVoIP with the API_StreamSoundBuff function GStreamer launch command line examples: gst-launch-1.0 -q tcpserversrc host=127.0.0.1 port=65432 ! rawaudioparse num-channels=1 pcm-format=s16le sample-rate=16000 ! audioconvert ! audioresample ! autoaudiosink gst-launch-1.0 -q audiotestsrc freq=440 wave=sine ! audio/x-raw, pcm-format=s16le, rate=8000,channels=1 ! tcpserversink host=127.0.0.1 port=65433 gst-launch-1.0 -q pulsesrc ! audioconvert ! audioresample ! audio/x-raw, pcm-format=s16le, rate=16000, channels=1 ! tcpserversink host=127.0.0.1 port=65433 gst-launch-1.0.exe -e audiotestsrc wave=sine freq=440 num-buffers=800 ! audio/x-raw, format=S16LE, channels=1, rate=8000 ! wavenc ! filesink location=sine_wave.wav C:\apps\gstreamer\bin\gst-launch-1.0.exe -q audiotestsrc freq=440 wave=sine ! audio/x-raw, pcm-format=s16le, rate=8000,channels=1 ! filesink location="test.wav" gst-launch-1.0 -v alsasrc ! wavenc ! C:\gstreamer\1.0\msvc_x86_64\bin\gst-launch-1.0.exe -q audiotestsrc freq=440 wave=sine ! audio/x-raw, pcm-format=s16le, rate=8000,channels=1 ! tcpserversink host=127.0.0.1 port=65433 */ //some code fragments: public void connect() { try { socket = new Socket(IP, PORT); inputStream = socket.getInputStream(); start(); } catch (Exception e1) { } } public void run() { ReceiveAudio(); } //call this function from your socket receiver thread void ReceiveAudio(InputStream inputStream) { try { byte[] buffer = new byte[320]; int bytesRead; while ((bytesRead = inputStream.read(buffer)) != -1) { boolean success = webphoneobj.API_StreamSoundBuff(1, -1, buffer, bytesRead); if (!success) { System.out.println("Error"); break; } } System.out.println("Terminated"); } catch (Exception e) { } }