Hi I wanted to use the mobicents rtsp client and tried to implement the code. As there are no codes for sending the request and also to process the response. So, i tried to implement the codes. I implemented it this way.
I created a different rtspcontroller for the client (called it RtspControllerClient) and implemented the onRtspResponse method to process incoming responses. Also in the start method of this class I included a code to send the first request to the media server. So far so good. I sent an OPTIONS request to Darwin and I get an OK response together with the Methods Darwin Supports (a proper response to options request). The problem comes now. As I mentioned above i included a code to send the other requests in the OnRtspResponse method. So, I use a variable that holds previous request and based on that I form the proper request for the current session and call the SendReuqest method but the SendRequest method raises exception. The following is the error I got:
70 [New I/O client worker #1-1] INFO org.mobicents.media.server.ctrl.rtsp.RtspController - Last request was ...OPTIONS
70 [New I/O client worker #1-1] INFO org.mobicents.media.server.ctrl.rtsp.RtspController - About to send the second request ...
70 [New I/O client worker #1-1] INFO org.mobicents.media.server.ctrl.rtsp.RtspController - The second request is ...DefaultHttpRequest(chunked: false)
DESCRIBE rtsp://
192.168.2.99:554/sample_100kbit.mp4 HTTP/1.1
Host: 192.168.2.20
Connection: close
Accept-Encoding: gzip
CSeq: 2
Content-Type: application/x-rtsp-tunnelled
70 [New I/O client worker #1-1] INFO org.mobicents.media.server.ctrl.rtsp.stack.RtspClientStackImpl - Inside SendRequest with rtspRequest...DefaultHttpRequest(chunked: false)
DESCRIBE rtsp://
192.168.2.99:554/sample_100kbit.mp4 HTTP/1.1
Host: 192.168.2.20
Connection: close
Accept-Encoding: gzip
CSeq: 2
Content-Type: application/x-rtsp-tunnelled
70 [New I/O client worker #1-1] INFO org.mobicents.media.server.ctrl.rtsp.stack.RtspClientStackImpl - And this is the second request
71 [New I/O client worker #1-1] ERROR org.mobicents.media.server.ctrl.rtsp.RtspController - Unexpected error during processing,Caused by
java.lang.NullPointerException at org.mobicents.media.server.ctrl.rtsp.stack.RtspClientStackImpl.sendRquest(RtspClientStackImpl.java:135)
at org.mobicents.media.server.ctrl.rtsp.RtspControllerClient.onRtspResponse(RtspControllerClient.java:171)
at org.mobicents.media.server.ctrl.rtsp.stack.RtspClientStackImpl.processRtspResponse(RtspClientStackImpl.java:85)
at org.mobicents.media.server.ctrl.rtsp.stack.RtspResponseHandler.messageReceived(RtspResponseHandler.java:28)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302)
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndfireMessageReceived(ReplayingDecoder.java:513)
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:497)
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:434)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:353)
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:277)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:197)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
I trace the error and it happens at the following line:
// Wait for the server to close the connection.
channel.getCloseFuture().awaitUninterruptibly();
channel = future.awaitUninterruptibly().getChannel();
// Shut down executor threads to exit.
bootstrap.releaseExternalResources();
And what surprises me is that the error is raised by the RtspController (the one you developed for teh Server) and not by the RsptControllerClient (the one that used for the client). And the code is running from the second class. I traced back the error and it is caused by the following statement:
channel = future.awaitUninterruptibly().getChannel(); // b/c there is a channel active and connected to the server.
Thank you.