[SR-Users] Disabling video rtp proxing

Yuriy Gorlichenko ovoshlook at gmail.com
Fri Aug 26 08:49:44 CEST 2022


The easiest way I see is:
Set up mod parameters for rtpengine
Read_avp and write_avp
During the request processing get $rb and put it into read_avp

Change/remove needed lines from the sdp in avp using regexp or
lua/js/python (do not use sdpos as it works with initial sdp, so it won't
affect the data in avp )

Call rtpengine_manage
Use write_avp after in the call of set_body to apply updated value

https://www.kamailio.org/docs/modules/devel/modules/textops.html#textops.f.set_body

Then you get your changes.

On Fri, 26 Aug 2022, 01:23 mayamatakeshi, <mayamatakeshi at gmail.com> wrote:

> Hi,
> Yes, I tried.
> I had this code in my cfg file:
>
>     sdp_remove_media("video");
>     append_hf("P-hint: video removed\r\n");
>     rtpengine_offer("symetric direction=pub direction=priv
> codec-transcode=PCMU codec-transcode=PCMA codec-transcode=GSM
> codec-transcode=G729");
>
> But when I check the INVITE going out from kamailio,
> I see the P-hint header but the m=video line is still there in the SDP:
>
> INVITE sip:user2 at 10.255.255.1997072 SIP/2.0
> Max-Forwards: 70
> Record-Route:
> <sip:192.168.2.198;lr=on;ftag=837235;vsf=AAAAAEVGVUMAcUVUQkUAbhcKHnQxLmNvbQ--;did=662.4f01>
> To:  <sip:05022222222 at 192.168.2.198>
> From:  05011111111 <sip:05011111111 at test1.com>;tag=837235
> Call-ID: 368391
> CSeq: 14806 INVITE
> Content-Type: application/sdp
> Contact:  <sip:user1 at 192.168.2.50:7070>
> User-Agent: Zoiper
> Allow-Events: presence, kpml, talk
> Via: SIP/2.0/UDP
> 192.168.2.198;branch=z9hG4bK82de.2d1517380038597f70a08f7217851c70.0
> Via: SIP/2.0/UDP 10.255.255.199:7070
> ;received=192.168.2.50;branch=z9hG4bK794289;rport=7070
> Content-Length: 518
> P-hint: video removed
>
> v=0
> v=0
> o=71924084 8000 8001 IN IP4 192.168.2.110
> s=SIP Call
> c=IN IP4 192.168.2.198
> t=0 0
> m=audio 48882 RTP/AVP 0 8 3 18 101
> a=rtpmap:0 PCMU/8000
> a=rtpmap:8 PCMA/8000
> a=rtpmap:3 GSM/8000
> a=rtpmap:18 G729/8000
> a=fmtp:18 annexb=no
> a=rtpmap:101 telephone-event/8000
> a=fmtp:101 0-15
> a=sendrecv
> a=rtcp:48883
> a=ptime:20
> m=video 48912 RTP/AVP 105
> b=AS:704
> a=rtcp-fb:* nack pli
> a=rtcp-fb:* ccm fira=rtpmap:105 H264/90000
> a=fmtp:105 profile-level-id=428016; packetization-mode=1
> a=sendrecv
> a=rtcp:48913
>
> I also tried doing the removal after rtpengine_offer()/rtpengine_manage()
> but the same thing happens.
> I also tried to use
>   msg_apply_changes();
> with the same results.
>
> So it seems rtpengine_offer() is executed later in the processing and over
> the original SDP.
>
> Checking the docs what eventually worked was this:
>
> # set rtpengine to read the body from an AVP:
> modparam("rtpengine", "read_sdp_pv", "$avp(sdp)")
>
> # set $avp(sdp) to a copy of $rb and replace the m=video line:
> $avp(sdp) = $rb;
> subst_attr("$sdp","/m=video [0-9]*/m=video 0/");
>
> So rtpengine would operate on a
>   m=video 0 RTP/AVP XXX
> line and so it would not set up rtp proxying for it.
>
> Then the original SDP line:
>   m=video 10004 RTP/AVP 105
> became this in the forwarded SDP:
>   m=video 0 RTP/AVP 0
>
> Thanks.
>
> On Thu, Aug 25, 2022 at 3:39 PM Henning Westerholt <hw at gilawa.com> wrote:
>
>> Hello,
>>
>>
>>
>> already tried the sdpops module?
>>
>>
>> https://kamailio.org/docs/modules/5.5.x/modules/sdpops.html#sdpops.f.sdp_remove_media
>>
>>
>>
>> Cheers,
>>
>>
>>
>> Henning
>>
>>
>>
>> --
>>
>> Henning Westerholt – https://skalatan.de/blog/
>>
>> Kamailio services – https://gilawa.com
>>
>>
>>
>> *From:* sr-users <sr-users-bounces at lists.kamailio.org> *On Behalf Of *
>> mayamatakeshi
>> *Sent:* Thursday, August 25, 2022 1:49 AM
>> *To:* Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
>> *Subject:* [SR-Users] Disabling video rtp proxing
>>
>>
>>
>> Hi,
>>
>> I'm using rtpengine for RTP proxying with kamailio.
>>
>> I use it just for audio.
>>
>> But eventually some terminal reinvites offering video.
>>
>> I don't want to refuse the request but just disable RTP proxying for
>> video as my employer has limited bandwidth and want to reserve it only for
>> audio.
>>
>> So I checked the rtpengine module documentation but it seems there is no
>> way to restrict RTP proxying to be performed only for m=audio.
>>
>> I tried some things like
>>
>>     replace_body("^m=video [0-9]+", "m=video 0");
>>
>> and
>>     subst_body('/^m=video [0-9]+ /m=video 0 /');
>>
>> and
>>
>>     msg_apply_changes();
>>
>> but still the RTP proxying  for video is set up.
>>
>>
>>
>> Any hints on how to solve this?
>>
>>
>>
>>
>>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220826/416d14c4/attachment.htm>


More information about the sr-users mailing list