4
votes

now I am make webrtc signal server, use SIP. I have big problem. how to get stream, and ICE candidate from remote SIP Client.?

  1. in webrtc client side, call getusermedia -> peerconnection -> createoffer -> receive stream

  2. and webrtc client send session description(SDP) To signal server.

  3. signal server create SIP Invite message, use webrtc client session description(SDP)

  4. signal server communicate SIP Message with SIP Client(like jitsi)

  5. webrtc client need to receive ICE candidate, and STREAM. how to get?

    can i make ICE candidate and stream from remote SDP Message?

1
the WebRTC client needs to receive ICE from the SIP client? Or the other way around?Benjamin Trent
yes WebRTC Client need to receive ICE from SIP client... and more question, if webrtc client is not receive ICE information, is this can communicate with sip client? is it possible? someone say sdp send ip, port information, but I don't knowbyungkyu

1 Answers

2
votes

SDP is its own protocol that SIP and WebRTC utilize. You can send an abundance of information in an SDP exchange.

SIP can most definitely send connection information over the SDP. You would have to make sure that the connection information is sound on the SIP side of things(have it negotiate against a STUN/TURN server) and once it has good information, you can simply write the SDP with that information and send it.

As for the media, you would have to handle the DTLS-SRTP key exchange process between your two parties so that the SRTP media can be encrypted/decrypted on both sides(both have the master-key).

Once you have the Master-Key on both sides, your connection information(ips/ports), and your media is negotiated(same codecs), then you can simply stream the codec that is agreed upon over the ips/ports that were negotiated.

You COULD create your own Ice Trickling and create Ice candidate objects as your SIP client communicates with an ICE server and simply send it to the other side but it may just be easier to wait until all ICE negotiation is finished before trying to negotiate the connection itself. You would have to figure out when the negotiation is finished on your SIP side but RTCPeerConnection has a signal in place for this already.

You may want to check out sipML5. You will have to do something similar to what they are doing to make all these moving parts work.

TL;DR notes:

  1. You negotiate against an ICE(stun or turn) server on both sides independently, get the good connection information from that, and write it to the SDP(you can parse the ICE candidates on the SIP side to get the good connection, and write to the SDP with all the candidates gathers on the SIP side)
  2. be careful with RTP/RTCP muxing. Make sure your media side can demux those packets(if communicating with chrome).
  3. You should read up on DTLS-SRTP Linky Linky2 Linky3
  4. Read up on SDP

EDIT: There is gateway that touts that it can do this already. Janus-Gateway may also be a good resource to see how you could do this. The SIP plugin seems to be able to communicate with a SIP device. And IMHO this source code is easier to understand than SIPML5's