1
votes

I am implementing a java gateway for the compatibility between webrtc and sip. I have done sdp exchange part. But now i am stuck in media part. So far i assume that i need to implement dtls-srtp handshake and then the encryption, decryption part. So can anyone please suggest any java library for

  1. DTLS handshake
  2. SRTP <--> RTP conversion

Or specific way to do this.
Edit: I am using JsSIP for webrtc to sip end. And Pangolin for sip client.

1
Before you get into DTLS / SRTP, you will first need to implement (or find a library) Interactive Connectivity Establishment, the mechanism by which both parties try to find a pair of (host, port) candidates which they can use to communicate.Jeremy
@jeremy: Thank you. Can you please suggest any library.Rashed
I found jstun library and used it. but it can not parse all the attribute and throw exception. Now i am trying to use pjnath stun library using jna( java native access). Can you please give any advice?Rashed

1 Answers

1
votes

I've done this before. Check out my project jPhoneLite. It uses BouncyCastle for the DTLS part.

https://github.com/pquiring/javaforce/blob/master/src/javaforce/voip/SRTPChannel.java

But I want to convert it to Java9 which now includes DTLS but I'm not sure if it will work.

The DTLS is NOT actually used to transmit any data. The client/server connect, negotiate keys and then use the keys to encode data in the normal RTP channel. The DTLS connection is dropped as soon as keys are exchanged.

See RFC 5705 where DTLS is used only to get a key which is what my code supports.

See RFC 5764 where DTLS "is" used to send/receive the actual data. My code currently does NOT support this method.