<p></p>
<p>In order to filter some specific codes from the SDP I am using this functions from sdpops module</p>
<ul>
<li>sdp_keep_codecs_by_name()</li>
<li>sdp_remove_codecs_by_name()</li>
<li>sdp_keep_codecs_by_id</li>
<li>sdp_remove_codecs_by_id</li>
</ul>
<p>and since they use the same code for filtering the problem I am going to describe affects all of them.</p>
<p>Let's say I have this data inside my SDP</p>
<pre><code>...
a=rtcp-xr:rcvr-rtt=all:10000 stat-summary=loss,dup,jitt,TTL voip-metrics
m=audio 7078 RTP/AVPF 96 97 98 0 8 3 9 18 101 99 100
a=rtpmap:96 opus/48000/2
a=fmtp:96 useinbandfec=1
a=rtpmap:97 speex/16000
a=fmtp:97 vbr=on
a=rtpmap:98 speex/8000
a=fmtp:98 vbr=on
a=fmtp:18 annexb=yes
a=rtpmap:101 telephone-event/48000
a=rtpmap:99 telephone-event/16000
a=rtpmap:100 telephone-event/8000
a=rtcp-fb:* trr-int 1000
a=rtcp-fb:* ccm tmmbr
m=video 9078 RTP/AVPF 96 97
a=rtpmap:96 VP8/90000
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=42801F
a=rtcp-fb:* trr-int 1000
a=rtcp-fb:* ccm tmmbr
a=rtcp-fb:96 nack pli
a=rtcp-fb:96 nack sli
a=rtcp-fb:96 ack rpsi
a=rtcp-fb:96 ccm fir
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 ccm fir
</code></pre>
<p>The sdp_keep_codecs_by_id (and I assume all other analog filter functions) correctly detects 2 SDP sessions, one  for the audio and one for the video.</p>
<p>Now, let's say we want to allow only PCMA,PCMU,GSM,telephone-event ( id 8,0,3,100,99,101 ), this means for example that 96 and 97 codecs have to be stripped.</p>
<p>For this reason the functions sdp_remove_str_codec_id_attrs() and sdp_remove_str_codec_id() are executed passing the correct id we want to filter.<br>
The sdp_remove_str_codec_id_attrs() will then remove the corresponding lines from the SDP but ONLY IF relative to rtpmap and fmtp.<br>
This means that a=rtcp* lines will not be filtered even if they are relative to a filtered codec and this is not what the user expects.</p>
<p>Interestingly the sdp_remove_str_codec_id_attrs() function delete the lines only if there is a match with the sdp_payload_attr linked list.</p>
<p><a href="https://github.com/kamailio/kamailio/blob/758c85a09ebb2848d0fd2ee82c48784b8544501a/src/core/parser/sdp/sdp.h#L90">https://github.com/kamailio/kamailio/blob/758c85a09ebb2848d0fd2ee82c48784b8544501a/src/core/parser/sdp/sdp.h#L90</a></p>
<p>This linked list is built at core level and only exposes rtp_payload and fmtp_string as described here.</p>
<p><a href="https://github.com/kamailio/kamailio/blob/758c85a09ebb2848d0fd2ee82c48784b8544501a/src/core/parser/sdp/sdp.h#L39">https://github.com/kamailio/kamailio/blob/758c85a09ebb2848d0fd2ee82c48784b8544501a/src/core/parser/sdp/sdp.h#L39</a></p>
<p>So, in other words, the sdpops module has no clue of "a=rtcp-fb*" attributes and cannot be implemented to filter them in a neat way.</p>
<p>Another issue arises for the "m=video 9078 RTP/AVPF 96 97" line.<br>
Here, since we are filtering 96 and 97, the line remains without ids, maybe it would be better to delete the whole line?</p>
<p>The final result after applying my filter is the following</p>
<pre><code>m=video 23088 RTP/AVPF
a=rtcp-fb:* trr-int 1000
a=rtcp-fb:* ccm tmmbr
a=rtcp-fb:96 nack pli
a=rtcp-fb:96 nack sli
a=rtcp-fb:96 ack rpsi
a=rtcp-fb:96 ccm fir
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 ccm fir
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2755">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZJ62QOXWN2OJHG52I3TQTLNRANCNFSM454UIH3A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZPIAYNFLKN7XNFNRY3TQTLNRA5CNFSM454UIH3KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4NRDFA6A.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2755",
"url": "https://github.com/kamailio/kamailio/issues/2755",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>