[OpenSER-Users] Playing RTP Session

Chaitanya V.N.S schaitanya.v at pyronetworks.com
Tue Jun 24 16:29:40 CEST 2008


Hi,

    I got no replay for that. I have even put that question in rtpproxy 
form but no response.

I have appended the header (PCMA or PCMU) to that file using a java 
program and tried to play that file . It is playing but  the audio 
quality is very bad.

Java code that I wrote to apped header

-------------------------------------------------------------------------

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioFileFormat.Type;

/**
 *
 * @author chaitanya
 */
public class AudioFileWriter {
    public static void main(String args[])
    {
       
       
    File file1 = new File("/home/chaitanya/Desktop/a.rtp"); //RTP file 
recorded by rtp proxy
    File file = new File("/home/chaitanya/Desktop/a.wav");//Out put wave 
file
    AudioFormat af=new AudioFormat(new 
AudioFormat.Encoding("ULAW"),8000,8,1,4,8000,false); // ULAW or ALAW 
what ever u r using and there respective bit rates
   
        int length;
        try{
                AudioInputStream ais=new AudioInputStream(new 
FileInputStream(file1),af,AudioSystem.NOT_SPECIFIED);
               
                //ByteArrayInputStream bais=new 
ByteArrayInputStream(b,0,b.length);
                Type afft=new Type("WAVE","WAV");
               
                AudioSystem.write(ais,afft,file);
        }
        catch(Exception e){
            e.printStackTrace();
        }
               
      
    }

}
---------------------------------------------------------------------------------------------------

You can try this.

If you find any other solution please let me know.

regards,
Chaitu




More information about the Users mailing list