SipServletResponse resp = invite.createResponse(
SipServletResponse.SC_SERVER_INTERNAL_ERROR);
resp.send();
return;
}
Player player = new Player(file.getAbsolutePath(),
rtpConnection.getHost(), rtpConnection.getPort(),
payloadType);
player.addEventListener(this);
try {
player.init();
} catch (Exception e) {
SipServletResponse resp = invite.createResponse(
SipServletResponse.SC_SERVER_INTERNAL_ERROR);
resp.send();
return;
}
int localPort = player.getLocalPort();
Recorder recorder = new Recorder(localPort);
Map<Integer, Recorder> recorders = (Map<Integer, Recorder>)
servletContext.getAttribute(Recorder.class.getName());
recorders.put(localPort, recorder);
invite.getApplicationSession(true).setAttribute(
Player.class.getName(), player);
SipServletResponse resp =
invite.createResponse(SipServletResponse.SC_OK);
String sdpAnswer = "v=0\r\n"
+ "o=user1 123 456 IN IP4 127.0.0.1\r\n"
+ "s=-\r\n"
+ "c=IN IP4 127.0.0.1\r\n"
+ "t=0 0\r\n"
+ "m=audio " + player.getLocalPort() + " RTP/AVP "
+ payloadType + "\r\n"
+ "a=rtpmap:0 PCMU/8000\r\n";
resp.setContent(sdpAnswer.getBytes(charset), "application/sdp");
resp.send();