7
votes

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 ?

2
are you going to create your own RTP stack? Or use an existing one like Gstreamer?Benjamin Trent
I saw few opensource Java implementation. Maybe I will implement it from scratch.Anton
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
@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, a project I'm part of, an the github repos and see for yourself.igracia
@igracia I saw few open source implementation. However they are all written in C. I would like to have Java solutionAnton

2 Answers

0
votes

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.

-1
votes

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