[sr-dev] [kamailio/kamailio] SDP filtering issues with sdpops module (#2755)

Alessio Garzi notifications at github.com
Tue Jun 1 15:06:32 CEST 2021


In order to filter some specific codes from the SDP I am using this functions from sdpops module

- sdp_keep_codecs_by_name()
- sdp_remove_codecs_by_name()
- sdp_keep_codecs_by_id
- sdp_remove_codecs_by_id

and since they use the same code for filtering the problem I am going to describe affects all of them.

Let's say I have this data inside my SDP

```
...
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
```
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.

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.

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.
The sdp_remove_str_codec_id_attrs() will then remove the corresponding lines from the SDP but ONLY IF relative to rtpmap and fmtp.
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.

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.

https://github.com/kamailio/kamailio/blob/758c85a09ebb2848d0fd2ee82c48784b8544501a/src/core/parser/sdp/sdp.h#L90

This linked list is built at core level and only exposes rtp_payload and fmtp_string as described here.

https://github.com/kamailio/kamailio/blob/758c85a09ebb2848d0fd2ee82c48784b8544501a/src/core/parser/sdp/sdp.h#L39

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.

Another issue arises for the "m=video 9078 RTP/AVPF 96 97" line.
Here, since we are filtering 96 and 97, the line remains without ids, maybe it would be better to delete the whole line?

The final result after applying my filter is the following

```
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
```





-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2755
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20210601/30ef0769/attachment-0001.htm>


More information about the sr-dev mailing list