SDP offer and answer

RFC 3264 matches streams by position. The answer has the same number of m-lines, in the same order.

Match on position

The answer must contain the same number of m-lines as the offer, and those lines stay in the same order. RFC 3264 uses that position to decide which answer stream belongs to which offered stream, so dropping a line or swapping two lines breaks the match.

The media type and the transport on an accepted line must match the offer. A second audio line in the offer is still a second audio line in the answer, even when the answerer only wants the first codec.

Rejection is not deletion

To refuse one stream, the answer sets that m-line port to 0 and still includes a media type, a protocol, and a format list. The refused stream occupies the same slot, which is why the following lines do not slide up.

A later offer in the same dialog keeps those positions. RFC 6337 is the usage document that shows how easy it is to break a call by rebuilding the m-line list from scratch.

Room: Same m-lines, same order

Sources and go deeper

© 2026 CypherMonkeyLabs 🐒

Open app · View repo