sipwise / rtpengine

The Sipwise media proxy for Kamailio
GNU General Public License v3.0
785 stars 368 forks source link

reuse the master key for SRTP when DTLS restarts #1772

Closed hajekmi closed 9 months ago

hajekmi commented 9 months ago

Call setup:

  1. WebRTC client (DTLS-SRTP)
  2. Kam + RTPEngine latest
  3. RTPEngine decrypt and send to Asterisk over SIP + RTP/RTCP
  4. WebRTC client change IP address during the call
  5. Client restart ICE and send renegotiate (new handshake DTLS and Re-INVITE)
  6. The master key (SRTP) remains the same (on Chrome, Firefox, Safari)
  7. WebRTC client send SRTP to RTPEngine with same master key for SRTP
  8. RTPEngine have issue with encrypt and decrypt this S/RTP (from WebRTC and from Asterisk)

Issue is in the RTPEngine, when restart DTLS make clean Master key for SRTP. This behaviour has been addressed here in Chromium https://bugs.chromium.org/p/webrtc/issues/detail?id=5205 I attached fix.

rfuchs commented 9 months ago

Would line 916/917 also need to be removed? https://github.com/sipwise/rtpengine/pull/1772/files#diff-d701009e80a993f1a5f7309566fe3e0bd6dd2f7be97a1aa2cc36f8b93ed674c1R916

sfd->crypto holds the SRTP context for ingress media