How to convert UDP packets to a file like wav
I set webphoneobj。
webphoneobj.API_SetParameter("sendmedia_type","0");
webphoneobj.API_SetParameter("sendmediain_to","6666");
I can only play sound use this.
//import required libraries import java.io.*; import javax.sound.sampled.*; //initialize audio AudioFormat format = new AudioFormat(8000, 16, 1, true, false); //you need to use 8000 for narrowband input or 16000 for wide-band DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); SourceDataLine line = (SourceDataLine)AudioSystem.getLine(info); line.open(format); line.start(); //playback (you can pass the UDP packets as-is as received from JVoIP) //this is usually called many times from your UDP socket thread or on UDP packet received event line.write(buffer, 0, length); //close line.flush(); line.stop(); line.close();
How to save as UDP packets a file
You just need to add a valid wave header. There are open source java libraries which can do this or contact our support for help.
You need to register / login to be able to post in the forum
Forum home