Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Re-INVITE SDP handling when payload type changes #276

Open
rafaltelaczynski opened this issue Oct 18, 2024 · 1 comment
Open

Comments

@rafaltelaczynski
Copy link

Describe the bug

  • incoming INVITE without SDP
  • answer with the offer of all codecs presented in 200OK
  • ACK is received with single codec selected
  • Re-INVITE message is received with exactly the same codec definition but using different payload type
  • new payload type is ignored and response to that offer has the same payload type for this codec as was used in initial offer presented in 200OK

E.g.:
Initial offer presented in 200OK:

Message Body
    Session Description Protocol
        Session Description Protocol Version (v): 0
        Owner/Creator, Session Id (o): FreeSWITCH 1728449501 1728449502 IN IP4 172.240.0.1
        Session Name (s): FreeSWITCH
        Connection Information (c): IN IP4 127.0.0.1
        Time Description, active time (t): 0 0
        Media Description, name and address (m): audio 17010 RTP/AVP 102 103 0 8 104 105 101 13
        Media Attribute (a): rtpmap:102 AMR-WB/16000
        Media Attribute (a): fmtp:102 octet-align=0; mode-set=0,1,2; max-red=0; mode-change-capability=2
        Media Attribute (a): rtpmap:103 AMR/8000
        Media Attribute (a): fmtp:103 octet-align=0; mode-set=0,1,2
        Media Attribute (a): rtpmap:0 PCMU/8000
        Media Attribute (a): rtpmap:8 PCMA/8000
        Media Attribute (a): rtpmap:104 telephone-event/16000
        Media Attribute (a): fmtp:104 0-15
        Media Attribute (a): rtpmap:105 CN/16000
        Media Attribute (a): rtpmap:101 telephone-event/8000
        Media Attribute (a): fmtp:101 0-15
        Media Attribute (a): rtpmap:13 CN/8000
        Media Attribute (a): ptime:20

Initial answer in ACK:

Message Body
    Session Description Protocol
        Session Description Protocol Version (v): 0
        Owner/Creator, Session Id (o): - 3769329783 3769329783 IN IP4 127.0.0.1
        Session Name (s): test-session
        Connection Information (c): IN IP4 127.0.0.1
        Time Description, active time (t): 0 0
        Media Description, name and address (m): audio 8904 RTP/AVP 0
        Media Attribute (a): rtpmap:0 PCMU/8000

Re-INVITE offer(exactly the same as initial answer, only payload type is different):

Message Body
    Session Description Protocol
        Session Description Protocol Version (v): 0
        Owner/Creator, Session Id (o): - 3769329783 3769329783 IN IP4 127.0.0.1
        Session Name (s): test-session
        Connection Information (c): IN IP4 127.0.0.1
        Time Description, active time (t): 0 0
        Media Description, name and address (m): audio 8904 RTP/AVP 10
        Media Attribute (a): rtpmap:10 PCMU/8000

answer to Re-INVITE offer(new payload type ignored, using initial value):

Message Body
    Session Description Protocol
        Session Description Protocol Version (v): 0
        Owner/Creator, Session Id (o): FreeSWITCH 1728449501 1728449502 IN IP4 172.240.0.1
        Session Name (s): FreeSWITCH
        Connection Information (c): IN IP4 127.0.0.1
        Time Description, active time (t): 0 0
        Media Description, name and address (m): audio 17010 RTP/AVP 0 104 105 101 13
        Media Attribute (a): rtpmap:0 PCMU/8000
        Media Attribute (a): rtpmap:104 telephone-event/16000
        Media Attribute (a): fmtp:104 0-15
        Media Attribute (a): rtpmap:105 CN/16000
        Media Attribute (a): rtpmap:101 telephone-event/8000
        Media Attribute (a): fmtp:101 0-15
        Media Attribute (a): rtpmap:13 CN/8000
        Media Attribute (a): ptime:20

Intrestingly, new payload type is respected and is being used while sending RTP packets. This issue here is that the other party either rejects this answer as it is invalid(breaking RFC3264), or accepts it and starts sending RTP packets for this invalid payload type.

According to RFC 3264 8.3.2 this should be allowed:

The list of media formats used in the session MAY be changed.  To do
   this, the offerer creates a new media description, with the list of
   media formats in the "m=" line different from the corresponding media
   stream in the previous SDP.  This list MAY include new formats, and
   MAY remove formats present from the previous SDP.  However, in the
   case of RTP, the mapping from a particular dynamic payload type
   number to a particular codec within that media stream MUST NOT change
   for the duration of a session.  For example, if A generates an offer
   with G.711 assigned to dynamic payload type number 46, payload type
   number 46 MUST refer to G.711 from that point forward in any offers
   or answers for that media stream within the session.  However, it is
   acceptable for multiple payload type numbers to be mapped to the same
   codec, so that an updated offer could also use payload type number 72
   for G.711.

and it is working well in exactly the same scenario but when there is SDP present in initial INVITE, so the only difference between the two is that there is no offer in initial INVITE.

To Reproduce
Steps to reproduce the behavior:

  1. Plain call with no SDP in initial INVITE
  2. Call answered
  3. Re-INVITE from originating party with SDP using different payload

Expected behavior
Answer Re-INVITE with 200OK with valid payload type, e.g. 10 in the example

Package version or git hash

  • sofia-sip v1.13.17

Trace logs
freeswitch_invalid_payload_type.log

@rafaltelaczynski
Copy link
Author

Any idea what might be wrong in this case?

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

No branches or pull requests

1 participant