[asterisk-bugs] [JIRA] (ASTERISK-21220) [patch] - Asterisk creates SDP with (peer) unsupported audio codec

Matt Jordan (JIRA) noreply at issues.asterisk.org
Thu Mar 7 11:35:03 CST 2013


Matt Jordan created ASTERISK-21220:
--------------------------------------

             Summary: [patch] - Asterisk creates SDP with (peer) unsupported audio codec
                 Key: ASTERISK-21220
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-21220
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Channels/chan_sip/CodecHandling
    Affects Versions: 1.8.20.1
            Reporter: nbougues
            Assignee: Matt Jordan
            Severity: Minor


I believe that Asterisk misbehaves when trying to offer inbound's call preferred audio codec to the called party, when in presence of video (or maybe some other non audio codec). 

Asterisk sends a wrong SDP, stating an unsupported codec for the peer, and then drops the call when the peers chooses that codec (which is the right thing to do, at that point).


* How to reproduce :

On Asterisk 1 (A1), we only allow G711A and H264 for peer Asterisk 2 (A2)
On A2, we only allow G729 and H264 for sip phone (SP) peer

A1 invites A2, with an SDP set to G711A|H264
A2 invites SP, with SDP set to G711A|G729|H264 (<- this is wrong)
SP accepts, and replies with an SDP set to G711A only (this is OK)
A2 drops the call, seeing no compatible codec between its peer capability (G729|H264) and the SDP reply (G711A) (this is OK)

* Why is that ?

The problem lies in add_sdp() in chan_sip.c, line 11884 (for 1.8.20.1).

Here, Asterisk tries to build an SDP offer, and first tries to insert the best offered codec on the inbound call, if a bitwise AND between our peer caps and the inbound call caps matches.

However, in that case, the bitwise AND matches on the VIDEO codec, not the audio one. 

So what happens next is that it enters the if(), and it adds the preferred audio codec of the calling party. Which may not (as in this case) match the peer caps.

* Fix

The if() condition should filter on audio codecs only. See below :

\[Edit - inline patch removed by mjordan \]

* Other versions

Even if the way of handling capabilities has been changed in later version, it seems to me that the issue is probably still the same (ast_format_cap_has_joint() doesn't filter on audio codecs).

See line 13132 of chan_sip.c for Asterisk 11.2.1

I think the issue has been there for a long time.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list