Can't you achieve the desired manipulations using the SDPOPS module? 


https://www.kamailio.org/docs/modules/devel/modules/sdpops.html


On Mon, May 29, 2023, 5:39 a.m. Patrick Karton <patrickarton@hotmail.com> wrote:
Hello kamailio community,

i know its an unusual query but i would like to know if there is a cleaner/proper.right way to disable some  (or all) media streams in SDP. 

i have come with a solution by sdpops module with subst_body function like this.

route[SDP_DISABLE_UNAUTHORIZED_MEDIA]{
      
      # disable text,media and video media streams
      subst_body('#^m=(video|text|audio)[ ]+[0-9/]+(.*)$#m=\1 0 \2#ig');

      # update originator ip address
      subst_body('#^o=([^ ]+)[ ]+([^ ]+)[ ]+([^ ]+)[ ]+([^ ]+)[ ]+([^ ]+)[ ]+([^ ]+)$#o=\1 \2 \3 \4 \5 7.7.7.7#ig');
      #                         1                2                2              4                5          6
      #                        name           sid             snumber    network    net-type    addr

      # update connection ip address
      subst_body('#^c=([^ ]+)[ ]+([^ ]+)[ ]+([^ ]+)$#c=\1 \2 7.7.7.7#ig');
      #                         1           2         3
      #                       network    net-type        addr

      #remove all media attributes
      sdp_remove_line_by_prefix("a=fmtp");
      sdp_remove_line_by_prefix("a=X-");
      sdp_remove_line_by_prefix("a=rtcp");
      sdp_remove_line_by_prefix("a=ssrc");
      sdp_remove_line_by_prefix("a=sendrecv");
      sdp_remove_line_by_prefix("a=sendonly");
      sdp_remove_line_by_prefix("a=recvonly");
      sdp_remove_line_by_prefix("a=inactive");  
      sdp_remove_line_by_prefix("b=");
      

}


is it the right way to do it. if not can someone provide me an alternative solution.

Thanks :)

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe: