# Direct communication with RTSP server

**URL:** <https://community.wowza.com/t/direct-communication-with-rtsp-server/39564>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [January 27, 2013, 6:51pm UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564 "2013-01-27T18:51:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrei\_Varanovich](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@Andrei\_Varanovich](https://community.wowza.com/u/Andrei_Varanovich)\
**Post date:** [January 27, 2013, 6:51pm UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564/1 "2013-01-27T18:51:42Z")

</div>

Hello,

I want to directly (using some custom piece of code) communicate with my RTSP server, to get session descriptors and start RTP streams.

Does wowza allow such level of customization?

My use case is that I have RTSP server deployed over NAT, and obviously, Wowza cannot directly connect to it from outside. I can only do port mapping for UDP, not TCP.

I am thinking about providing Wowza with the Socket already connected to the server, then it can use it to communicate with RTSP.

Another option, is that I handle RTSP part by my custom code, and provide Wowza with the session description (SDP) to start RTP.

So my constrain is that I cannot use TCP. Do you think one of the above scenarios possible? Any other suggestions?

Thanks,

Andrei

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [January 27, 2013, 11:32pm UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564/2 "2013-01-27T23:32:55Z")

</div>

Andrei,

Take a look at IRTSPActionNotify:

[https://www.wowza.com/docs/how-to-use-the-irtspactionnotify-interface-to-listen-for-rtsp-stream-events](https://www.wowza.com/docs/how-to-use-the-irtspactionnotify-interface-to-listen-for-rtsp-stream-events)

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [January 28, 2013, 1:42pm UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564/3 "2013-01-28T13:42:19Z")

</div>

Some encoders do RTSP announce, which is where you enter Wowza URL and application name in the encoder and it sends sdp file to Wowza. But your encoder is not one of those, and I’m not sure how to do what you are suggesting.

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [January 28, 2013, 5:15pm UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564/4 "2013-01-28T17:15:16Z")

</div>

Andrei,

Yes, in this case the encoder starts by connecting to Wowza and sending the .sdp file over the wire, which Wowza then uses to initiate streaming as it would if the .sdp file were in the /content folder.

This is the basic guide for this kind of encoder:

[https://www.wowza.com/docs/how-to-set-up-live-streaming-using-an-rtsp-rtp-based-encoder](https://www.wowza.com/docs/how-to-set-up-live-streaming-using-an-rtsp-rtp-based-encoder)

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [January 30, 2013, 5:55pm UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564/5 "2013-01-30T17:55:57Z")

</div>

For RTSP announce you have to connect to a specific Wowza application, that exists.

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [February 1, 2013, 3:21pm UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564/6 "2013-02-01T15:21:39Z")

</div>

The [generic instructions](https://www.wowza.com/docs/how-to-set-up-live-streaming-using-an-rtsp-rtp-based-encoder) indicates only ip address + port, no protocol. And the application name is included with the stream name.

Host Address: [wowza-address]:1935

Stream Name: live/myStream.sdp

That is how you do it in Wirecast using the “RTSP/RTP based streaming” method. Take a look at the 2nd example in this old (1.7 forum) [Wirecast guide](http://community.wowza.com/t/-/71%28RTMP-or-RTSP-RTP%29)

Richard

---

<div class="post-metadata">

**Author:** ![Andrei\_Varanovich](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@Andrei\_Varanovich](https://community.wowza.com/u/Andrei_Varanovich)\
**Post date:** [January 28, 2013, 9:38am UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564/7 "2013-01-28T09:38:41Z")

</div>

Hi Richard,

thanks for the pointer. However, if I understand the documentation correctly, this interface provides callbacks for RTSP actions for _already_ created RTSP session.

Say, I have a RTSP server published on some port, which is not visible for Wowza. Once I start a stream (say defined by \*.stream file, e.g. rtsp://192.168.1.10), Wowza will not be able to create an initial RTSP session.

**Idea 1:** I was thinking about implementing NAT traversal, and provide Wowza with the socket accepted by RTSP server.

**Idea 2:** I can publish SDP from the server to Wowza through UDP. The question is how to start RTP streaming from my custom handler. It is done through UDP in my case.

Here is some kind of flow:

1. Wowza -\> Server. Request SDP by doing UDP request.

2. Server -\> Wowza. Return SDP and start RTP session.

3. Wowza -\> ???

Thanks,

Andrei

---

<div class="post-metadata">

**Author:** ![Andrei\_Varanovich](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@Andrei\_Varanovich](https://community.wowza.com/u/Andrei_Varanovich)\
**Post date:** [January 28, 2013, 5:53pm UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564/8 "2013-01-28T17:53:49Z")

</div>

Richard,

I am in full control of my encoder code, so I can implement RTSP Announce. Sounds very cool suggestion!

Does that also mean that Wowza listens for RTSP announcements and automatically starts re-streaming? (I need to support these streamers: cupertinostreaming, smoothstreaming, sanjosestreaming). Any pointers to documentation? Because at the moment I publish \*.stream file just with RTSP and configure my Application.xml accordingly.

–andrei

---

<div class="post-metadata">

**Author:** ![Andrei\_Varanovich](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@Andrei\_Varanovich](https://community.wowza.com/u/Andrei_Varanovich)\
**Post date:** [January 30, 2013, 12:24pm UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564/9 "2013-01-30T12:24:04Z")

</div>

Richard,

I made the following changes in VHost.xml: 554, 1935

Also created rtplive application, with the following in the Application.xml:

rtp-live

…

0.0.0.0

127.0.0.1

with no authentication:

none

none

If I create a TCP connection to Wowza

Socket socket = new Socket(“127.0.0.1”, 554);

and publish the RTSP announcement, I get

WARN server comment - Application folder ([install-location]/applications/_defapp_) is missing

It seems I am missing something trivial, but how should I publish my SDP to reach the _rtplive_ application, which I defined in XML?

---

<div class="post-metadata">

**Author:** ![Andrei\_Varanovich](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@Andrei\_Varanovich](https://community.wowza.com/u/Andrei_Varanovich)\
**Post date:** [February 1, 2013, 1:05pm UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564/10 "2013-02-01T13:05:00Z")

</div>

I am still a bit puzzled, RTSP is not HTTP, I can only connect to a certain IP address and a port. It is not clear, how I can specify _the application_.

Should I send RTSP announce by using HTTP POST to smth. like [http://127.0.0.1:1935/rtplive](http://127.0.0.1:1935/rtplive) ?

---

<div class="post-metadata">

**Author:** ![Andrei\_Varanovich](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@Andrei\_Varanovich](https://community.wowza.com/u/Andrei_Varanovich)\
**Post date:** [February 4, 2013, 10:48pm UTC](https://community.wowza.com/t/direct-communication-with-rtsp-server/39564/11 "2013-02-04T22:48:43Z")

</div>

My Wowza server has the following IP:192.168.1.101

Encoder’s IP: 192.168.1.105

I am sending the following ANNOUNCE request to Wowza port 554:

ANNOUNCE rtsp://192.168.1.101:1935/rtplive/myStream.sdp RTSP/1.0

Cseq: 0

Content-Type: application/sdp

Session: 12345678

Content-Length: 299

v=0

o=- 1360014152814 1360014152814 IN IP4 192.168.1.105

s=Stream-0

i=N/A

c=IN IP4 192.168.1.101

t=0 0

a=recvonly

m=video 5006 RTP/AVP 96

b=RR:0

a=rtpmap:96 H264/90000

a=fmtp:96 packetization-mode=1;profile-level-id=42801e;sprop-parameter-sets=Z0KAHukBQHsg,aM4G4g==;

a=control:trackID=0

The first line in the request should indicate _the actual Wowza application_, right? So my RTSP announce is correct.

After the announcement is published, I see the following in the log:

NFO rtsp connect 938250587 -

INFO server comment - sortPackets[2]: sortBufferSize:500

INFO stream create - -

INFO rtsp announce 938250587 -

WARN server comment - RTPStream.idle[938250587:rtplive/_definst_:]: Close RTSP/RTP session. Session timeout: 90000

INFO stream unpublish - -

INFO server comment - MediaStreamMediaCasterPlay: close

INFO stream destroy - -

INFO rtsp disconnect 938250587 -

I did some experiments with Wirecast encoder, the log is the following after publishing (to the same Wowza application):

INFO rtsp connect 344217766 -

INFO server comment - sortPackets[1]: sortBufferSize:500

INFO stream create - -

INFO rtsp announce 344217766 -

INFO server comment - RTPUDPTransport.bind[rtplive/_definst_]: 0.0.0.0/0.0.0.0:6970

INFO server comment - RTPUDPTransport.bind[rtplive/_definst_]: 0.0.0.0/0.0.0.0:6971

INFO server comment - RTPUDPTransport.bind[rtplive/_definst_]: 0.0.0.0/0.0.0.0:6972

INFO server comment - RTPUDPTransport.bind[rtplive/_definst_]: 0.0.0.0/0.0.0.0:6973

INFO stream publish myStream.sdp -

INFO rtsp publish 344217766 -

INFO server comment - UDPTransport.firstPacket: bind:0.0.0.0/0.0.0.0:6970 msg:/192.168.1.101:57954

Do I need perhaps also send RTSP PLAY request?
