Problem with Transmitting media using JMF
Hello Everyone !!
I am working on an application called SIPSpeaker which listens for incoming calls, answer the call and plays a message. I am done with the first two parts of the application, i.e. it can successfully answers the call. I am now facing problem with transmitting audio to the SIP Phone (the caller). I am using JMF and I am trying to send the audio over RTP.
My code looks something like this....
locator =new MediaLocator("rtp://130.237.214.124:" + port +"/audio");
f =new File("C:/1.wav");
try{
ds = Manager.createDataSource(f.toURL());
}catch (NoDataSourceException ex){
ex.printStackTrace();
}catch (MalformedURLException ex){
ex.printStackTrace();
}catch (IOException ex){
ex.printStackTrace();
}
format =new Format[]{new AudioFormat(AudioFormat.GSM_RTP,8000,8,1)};
contentDesc =new ContentDescriptor(ContentDescriptor.RAW_RTP);
processor = Manager.createProcessor(ds);
waitForState(processor,Processor.Configured);
processor.setContentDescriptor(contentDesc);
processor.getTrackControls()[0].setFormat(format[0]);
waitForState(processor,Processor.Realized);
try{
sink = Manager.createDataSink(processor.getDataOutput(),locator);
System.out.println("6");
}catch (NotRealizedError ex){
ex.printStackTrace();
}catch (NoDataSinkException ex){
ex.printStackTrace();
}
}
processor.start();
try{
sink.open();
sink.start();
}catch (SecurityException ex){
ex.printStackTrace();
}catch (IOException ex){
ex.printStackTrace();
}
we are required to work with a .wav file as input ....
i am new to java and to JMF and i have absolutely no idea whats going wrong...
please help me
Regards,
Sanjay !!

