Module: sems Branch: master Commit: 8f835d9870ec3999415e62fa3112e6033173e688 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=8f835d9870ec3999415e62fa3112e6033173e688
Author: Carsten Bock <[email protected]> Committer: Carsten Bock <[email protected]> Date: Mon Aug 27 11:51:56 2012 +0200 b/f: Only apply SBC-SDP-Filter for the RTP/AVP or RTP/SAVP profile. For other media (e.g. image/udptl/t38) this will not work and will result in an empty media-session with no active streams. As result, the SEMS-SBC will reply with a "488 Not acceptable here". --- apps/sbc/SDPFilter.cpp | 43 ++++++++++++++++++++++--------------------- 1 files changed, 22 insertions(+), 21 deletions(-) diff --git a/apps/sbc/SDPFilter.cpp b/apps/sbc/SDPFilter.cpp index 1db1bd0..2163b36 100644 --- a/apps/sbc/SDPFilter.cpp +++ b/apps/sbc/SDPFilter.cpp @@ -37,32 +37,33 @@ int filterSDP(AmSdp& sdp, FilterType sdpfilter, const std::set<string>& sdpfilte for (std::vector<SdpMedia>::iterator m_it = sdp.media.begin(); m_it != sdp.media.end(); m_it++) { SdpMedia& media = *m_it; - - std::vector<SdpPayload> new_pl; - for (std::vector<SdpPayload>::iterator p_it = - media.payloads.begin(); p_it != media.payloads.end(); p_it++) { + if (media.transport == TP_RTPAVP || media.transport == TP_RTPSAVP) { + std::vector<SdpPayload> new_pl; + for (std::vector<SdpPayload>::iterator p_it = + media.payloads.begin(); p_it != media.payloads.end(); p_it++) { - string c = p_it->encoding_name; - std::transform(c.begin(), c.end(), c.begin(), ::tolower); + string c = p_it->encoding_name; + std::transform(c.begin(), c.end(), c.begin(), ::tolower); - bool is_filtered = (sdpfilter == Whitelist) ^ - (sdpfilter_list.find(c) != sdpfilter_list.end()); + bool is_filtered = (sdpfilter == Whitelist) ^ + (sdpfilter_list.find(c) != sdpfilter_list.end()); - // DBG("%s (%s) is_filtered: %s\n", p_it->encoding_name.c_str(), c.c_str(), - // is_filtered?"true":"false"); + // DBG("%s (%s) is_filtered: %s\n", p_it->encoding_name.c_str(), c.c_str(), + // is_filtered?"true":"false"); - if (!is_filtered) - new_pl.push_back(*p_it); - } - if (new_pl.empty()) { - // in case of SDP offer we could remove media line but in case of answer - // we should just reject the stream by setting port to 0 (at least one - // format must be given; see RFC 3264, sect. 6) - media.port = 0; - if (media.payloads.size() > 1) - media.payloads.erase(media.payloads.begin() + 1, media.payloads.end()); + if (!is_filtered) + new_pl.push_back(*p_it); + } + if (new_pl.empty()) { + // in case of SDP offer we could remove media line but in case of answer + // we should just reject the stream by setting port to 0 (at least one + // format must be given; see RFC 3264, sect. 6) + media.port = 0; + if (media.payloads.size() > 1) + media.payloads.erase(media.payloads.begin() + 1, media.payloads.end()); + } + else media.payloads = new_pl; } - else media.payloads = new_pl; } return 0; _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
