7

I'm going to implement Java VoiP server to work with WebRtc. Implementation of browser p2p connection is really straightforward. Server to client connection is slightly more tricky.

After a quick look at RFC I wrote down what should be done to make Java server as browser. Kindly help me to complete list below.

  1. Implement STUN server. Server should be abke to respond binding request and keep-alive pings.
  2. Implement DTLS protocol along with DTLS handshake. After the DTLS handshake shared secret will be used as keying material within SRTP and SRTCP.
  3. Support multiplexing of SRTP and SRTCP stream. SRTP and SRTCP use same port to adress NAT issue.
  4. Not sure whether should I implement SRTCP. I believe connection will not be broken, if server does not send SRTCP reports to client.
  5. Decode SRTP stream to RTP.

Questions:

  1. Is there anything else which should be done on server-side ?
  2. How webRtc handles SRTCP reports ? Does it adjust sample rate/bit rate depends on SRTCP report?
  3. WebRtc claims that following issues will be addressed:

    • packet loss concealment
    • echo cancellation
    • bandwidth adaptivity
    • dynamic jitter buffering
    • automatic gain control
    • noise reduction and suppression

    Is is webRtc internals or codec(Opus) internals? Do I need to do anything on server side to handle this issues, for example variable bitrate etc ?

Anton
  • 5,831
  • 3
  • 35
  • 45
  • are you going to create your own RTP stack? Or use an existing one like Gstreamer? – Benjamin Trent Aug 19 '14 at 20:19
  • I saw few opensource Java implementation. Maybe I will implement it from scratch. – Anton Aug 20 '14 at 09:50
  • Finally browser is able to send SRTP stream to server. It was not very easy though. Stream flows only from broswer to server so far. – Anton Oct 19 '14 at 15:19
  • @Anton Have you considered using an existing MCU and WebRTC server? There are some open source implementations around. You could have a look at their code and see what they are doing. Anyway, I can tell you that what you are planning is not trivial at all. Have a look at [Kurento](http://kurento.org), a project I'm part of, an the [github repos](https://github.com/Kurento/) and see for yourself. – igracia Oct 21 '14 at 08:03
  • @igracia I saw few open source implementation. However they are all written in C. I would like to have Java solution – Anton Oct 21 '14 at 10:09
  • For now, SRTP stream is decoded and can be written to wav file. However when I send SRTP stream back to browser, browser does not play it. Dunno why yet – Anton Nov 06 '14 at 13:04
  • Finally SRTP stream is decoded and sent back. I can hear my own voice in headphones. It works fine without SRTCP. I still have no clue, whether I really need to implement SRTCP. – Anton Nov 10 '14 at 10:47
  • @Anton We tested the GStreamer Java bindings, and it was really slow, that's why the media server is implemented in C++. In any case, Kurento Media Server provides Java and Javascript APIs, so you don't have to bother with the implementation of the media server, just work with the APIs. – igracia Feb 05 '15 at 09:55
  • @igracia I do not use GStreamer. We have own rtp/rtcp stack implementation. And pure java WebRtc server is already working fine in production. – Anton Feb 05 '15 at 12:37
  • @Anton cool! And how is the performance? I'm really curious about how it scales. – igracia Feb 17 '15 at 11:03
  • @igracia well it can hold up to 500 concurrent connections. Did not try more though. Anyway it does not very important since it can be scaled horizontally. You can call to 12345678 at call2friends.com to test the quality of the call. – Anton Mar 26 '15 at 12:45

2 Answers2

0

The first step would be to implement Interactive Connectivity Establishement (RFC 5245). Whether you make use of a STUN/TURN server or not is irrelevant, your code needs to issue connectivity checks (which use STUN messages) to the browser and respond to the brower's connectivity checks. ICE is a fairly complex state machine, but it's doable.

Jeremy
  • 1,308
  • 10
  • 11
-1

You don't have to reinvent the wheel. STUN / TURN servers are external components. Use as they are. WebRTC source code is available which you can use in your application code and call the related methods.

Pls. refer to similar post - Server as WebRTC data channel peer

Community
  • 1
  • 1