Summary: | ASTERISK-21131: [patch] - Asterisk creates SDP with (peer) unsupported audio codec | ||
Reporter: | nbougues (nbougues) | Labels: | |
Date Opened: | 2013-02-18 07:49:40.000-0600 | Date Closed: | 2013-10-23 06:12:03 |
Priority: | Minor | Regression? | |
Status: | Closed/Complete | Components: | Channels/chan_sip/CodecHandling |
Versions: | 1.8.20.1 | Frequency of Occurrence | Constant |
Related Issues: | |||
Environment: | Attachments: | ( 0) format-fix.patch ( 1) patch_unsupported_codec_1.8.patch | |
Description: | 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. | ||
Comments: | By: Matt Jordan (mjordan) 2013-02-18 21:15:27.542-0600 I'm sorry, but we cannot accept patches that are in the issue description or comments. Please create a patch and attach it to the issue after signing a license contributor agreement. By: nbougues (nbougues) 2013-02-19 01:33:09.697-0600 Fix patch against 1.8.20.1 By: Andreas Steinmetz (anstein) 2013-08-10 08:30:13.204-0500 Patch against 11.5.0 By: Andreas Steinmetz (anstein) 2013-08-10 08:30:57.088-0500 This bug is still present in 11.5.0. I have attached a patch fixing the issue. |