Search code examples
siprtp

Why multiple ip-port pair are negotiated for rtp when signaling is done by SIP


Why multiple ip-port pair are negotiated for RTP when signaling is done by SIP. What is the maximum value of the number of ip-port negotiated.


Solution

  • Each media line in an SDP description describes one RTP stream for one media in an SDP description: For each media (audio, video, desktop-sharing, ...) you will need 2 connections: one for RTP (ip:port from c= line) and one for RTCP (ip:port+1). There is no maximum on the number of media lines.

    Additionnaly, the SDP can contains ICE (rfc5245) candidates, which may also provide alternative LOCAL ip:port and alternative DESTINATION ip:port to exchange media. For example:

    a=candidate:4273728266 1 udp 2122260223 192.168.1.125 43897 typ host generation 0
    a=candidate:4273728266 2 udp 2122260223 192.168.1.125 43897 typ host generation 0
    a=candidate:779251937 1 udp 2122194687 192.168.1.107 55273 typ host generation 0
    a=candidate:779251937 2 udp 2122194687 192.168.1.107 55273 typ host generation 0
    a=candidate:2956466170 1 tcp 1518280447 192.168.1.125 0 typ host generation 0
    a=candidate:2956466170 2 tcp 1518280447 192.168.1.125 0 typ host generation 0
    a=candidate:1626442769 1 tcp 1518214911 192.168.1.107 0 typ host generation 0
    a=candidate:1626442769 2 tcp 1518214911 192.168.1.107 0 typ host generation 0
    

    In more recent rfc, you can find SDP extension to minimize the number of connections. The a=rtcp-mux (defined in rfc5761) allow you to multiplex RTP and RTCP data on a single port. Then, instead of 2 ports per media, you just need one.

    A second extension, only published as a draft (draft-ietf-mmusic-sdp-bundle-negotiation), can be used with the SDP Offer/Answer mechanism to negotiate the usage of a single address:port combination (BUNDLE address) for receiving media, referred to as bundled media, associated with multiple SDP media descriptions ("m=" lines).

    With both those 2 last extensions, you can end-up with just one ip:port connection for all media lines and all RTP/RTCP streams of your SDP description.