Skip to content

fix: hold/resume invite SDP direction negotiation and IP handling#126

Open
vyntro wants to merge 3 commits intoemiago:mainfrom
vyntro:main
Open

fix: hold/resume invite SDP direction negotiation and IP handling#126
vyntro wants to merge 3 commits intoemiago:mainfrom
vyntro:main

Conversation

@vyntro
Copy link

@vyntro vyntro commented Feb 10, 2026

Fix for the issue #125

I have observed the below three issue when i try to use the call hold on functionality.

1. SDP Direction Handling Issue
When a hold re-INVITE is received with a=sendonly in the SDP, the answer is incorrectly generated with a=sendrecv instead of a=recvonly. This causes the remote side to stop sending RTP/audio after resume, even though the call remains up. Correct SDP direction negotiation is critical: the answer must reflect the proper direction (sendonly → recvonly, recvonly → sendonly, etc.).

2. SDP Parser Bug (No Trailing Newline)
If the direction attribute (a=sendonly, a=recvonly, etc.) is the last line in the SDP and there is no trailing newline, the parser skips this line. As a result, the direction is not processed, and the answer defaults to a=sendrecv This causes incorrect media negotiation and RTP/audio failures after hold/resume.

3. IP Handling Issue
When answering a hold/resume re-INVITE, the 200 OK SDP sometimes uses c=IN IP6 :: or c=IN IP4 0.0.0.0 instead of the configured IPv4 address or ExternalIP. This can cause the remote side to reject the media or stop sending RTP.

Impact

  • RTP/audio is not received after hold/resume due to incorrect SDP direction and IP handling.
  • Calls remain up, but media is broken.
  • SIP traces show 200 OK answers with wrong direction and/or IP.

Expected

  • SDP direction attributes are always honored, even if they are the last line without a newline.
  • Answers to hold re-INVITE use a=recvonly when offer is a=sendonly.
  • 200 OK SDP uses the correct IPv4 address (ExternalIP) in the c= line.

Actual

  • SDP direction is skipped or defaults to a=sendrecv.
  • 200 OK SDP uses c=IN IP6 :: or c=IN IP4 0.0.0.0.
  • RTP/audio not received after resume

SIP trace (abridged)

INVITE (hold): SDP last line `a=sendonly` (no newline)
200 OK: SDP contains `a=sendrecv` (should be `recvonly`), c=IN IP6 :: or c=IN IP4 0.0.0.0
ACK
INVITE (resume): SDP `a=sendrecv`
200 OK: SDP `a=sendrecv`, c=IN IP6 :: or c=IN IP4 0.0.0.0
ACK
RTP/audio not received from remote

When a hold re-INVITE is received with ``a=sendonly`` in the SDP, the answer is incorrectly generated with ``a=sendrecv`` instead of ``a=recvonly``. This causes the remote side to stop sending RTP/audio after resume, even though the call remains up.
If the direction attribute (``a=sendonly``, ``a=recvonly``, etc.) is the last line in the SDP and there is no trailing newline, the parser skips this line. As a result, the direction is not processed, and the answer defaults to ``a=sendrecv`` This causes incorrect media negotiation and RTP/audio failures after hold/resume.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant