[prev in list] [next in list] [prev in thread] [next in thread] 

List:       serusers
Subject:    Re: [SR-Users] Disabling video rtp proxing
From:       mayamatakeshi <mayamatakeshi () gmail ! com>
Date:       2022-08-31 12:51:47
Message-ID: CABaNFCZDmRCJpYq0QFTMZx20g+QEwpjccZn1h7PodJbT6mxM7g () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


That's what I'm using.
Thanks.

On Fri, Aug 26, 2022 at 3:54 PM Yuriy Gorlichenko <ovoshlook@gmail.com>
wrote:

> 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@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@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@192.168.2.198>
>> From:  05011111111 <sip:05011111111@test1.com>;tag=837235
>> Call-ID: 368391
>> CSeq: 14806 INVITE
>> Content-Type: application/sdp
>> Contact:  <sip:user1@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@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@lists.kamailio.org> *On Behalf Of *
>>> mayamatakeshi
>>> *Sent:* Thursday, August 25, 2022 1:49 AM
>>> *To:* Kamailio (SER) - Users Mailing List <sr-users@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@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
>>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users@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
>

[Attachment #5 (text/html)]

<div dir="ltr"><div>That&#39;s what I&#39;m using.</div><div>Thanks.</div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 26, 2022 at 3:54 PM \
Yuriy Gorlichenko &lt;<a \
href="mailto:ovoshlook@gmail.com">ovoshlook@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div \
dir="auto"></div>The easiest way I see is:<div dir="auto">Set up mod parameters for \
rtpengine</div><div dir="auto">Read_avp and write_avp</div><div dir="auto">During the \
request processing get $rb and put it into read_avp</div><div \
dir="auto"><br></div><div dir="auto">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&#39;t affect the data in avp )</div><div dir="auto"><br></div><div \
dir="auto">Call rtpengine_manage</div><div dir="auto">Use write_avp after in the call \
of set_body to apply updated value</div><div dir="auto"><br></div><div dir="auto"><a \
href="https://www.kamailio.org/docs/modules/devel/modules/textops.html#textops.f.set_body" \
target="_blank">https://www.kamailio.org/docs/modules/devel/modules/textops.html#textops.f.set_body</a><br></div><div \
dir="auto"><br></div><div dir="auto">Then you get your changes.</div><div \
dir="auto"><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" \
class="gmail_attr">On Fri, 26 Aug 2022, 01:23 mayamatakeshi, &lt;<a \
href="mailto:mayamatakeshi@gmail.com" rel="noreferrer noreferrer" \
target="_blank">mayamatakeshi@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><font \
face="monospace">Hi,</font></div><div><font face="monospace">Yes, I \
tried.</font></div><div><font face="monospace">I had this code in my cfg \
file:</font></div><div><font face="monospace"><br></font></div><div><div><font \
face="monospace"><font size="1">      sdp_remove_media(&quot;video&quot;);<br>      \
append_hf(&quot;P-hint: video \
removed\r\n&quot;);</font><br></font></div></div><div><font size="1" \
face="monospace">      rtpengine_offer(&quot;symetric direction=pub direction=priv \
codec-transcode=PCMU codec-transcode=PCMA codec-transcode=GSM \
codec-transcode=G729&quot;);<br></font></div><div><font size="1" \
face="monospace"><br></font></div><div><font face="monospace">But when I check the \
INVITE going out from kamailio,  </font></div><div><font face="monospace">I see the \
P-hint header but the m=video line is still there in the SDP:</font></div><div><font \
size="1" face="monospace"><br></font></div><div><font face="monospace"><font \
size="1">INVITE sip:user2@10.255.255.1997072 SIP/2.0<br>Max-Forwards: \
70<br>Record-Route: &lt;sip:192.168.2.198;lr=on;ftag=837235;vsf=AAAAAEVGVUMAcUVUQkUAbhcKHnQxLmNvbQ--;did=662.4f01&gt;<br>To: \
&lt;<a href="mailto:sip%3A05022222222@192.168.2.198" rel="noreferrer noreferrer \
noreferrer" target="_blank">sip:05022222222@192.168.2.198</a>&gt;<br>From:   \
05011111111 &lt;<a href="mailto:sip%3A05011111111@test1.com" rel="noreferrer \
noreferrer noreferrer" \
target="_blank">sip:05011111111@test1.com</a>&gt;;tag=837235<br>Call-ID: \
368391<br>CSeq: 14806 INVITE<br>Content-Type: application/sdp<br>Contact:   &lt;<a \
href="http://sip:user1@192.168.2.50:7070" rel="noreferrer noreferrer noreferrer" \
target="_blank">sip:user1@192.168.2.50:7070</a>&gt;<br>User-Agent: \
Zoiper<br>Allow-Events: presence, kpml, talk<br>Via: SIP/2.0/UDP \
192.168.2.198;branch=z9hG4bK82de.2d1517380038597f70a08f7217851c70.0<br>Via: \
SIP/2.0/UDP 10.255.255.199:7070;received=192.168.2.50;branch=z9hG4bK794289;rport=7070<br>Content-Length: \
518<br><font color="#38761d">P-hint: video \
removed<br></font><br>v=0<br>v=0<br>o=71924084 8000 8001 IN IP4 \
192.168.2.110<br>s=SIP Call<br>c=IN IP4 192.168.2.198<br>t=0 0<br>m=audio 48882 \
RTP/AVP 0 8 3 18 101<br>a=rtpmap:0 PCMU/8000<br>a=rtpmap:8 PCMA/8000<br>a=rtpmap:3 \
GSM/8000<br>a=rtpmap:18 G729/8000<br>a=fmtp:18 annexb=no<br>a=rtpmap:101 \
telephone-event/8000<br>a=fmtp:101 \
0-15<br>a=sendrecv<br>a=rtcp:48883<br>a=ptime:20<br><font color="#ff0000">m=video \
48912 RTP/AVP 105<br></font>b=AS:704<br>a=rtcp-fb:* nack pli<br>a=rtcp-fb:* ccm \
fira=rtpmap:105 H264/90000<br>a=fmtp:105 profile-level-id=428016; \
packetization-mode=1<br>a=sendrecv<br>a=rtcp:48913</font><br></font></div><div><font \
face="monospace"><br></font></div><div><font face="monospace">I also tried doing the \
removal after rtpengine_offer()/rtpengine_manage() but the same thing \
happens.</font></div><div><font face="monospace">I also tried to \
use</font></div><div><font face="monospace" size="1">    \
msg_apply_changes();</font></div><div><font face="monospace">with the same \
results.</font></div><div><font face="monospace"><br></font></div><div><font \
face="monospace">So it seems rtpengine_offer() is executed later in the processing \
and over the original SDP.</font></div><div><font \
face="monospace"><br></font></div><div><font face="monospace">Checking the docs what \
eventually worked was this:</font></div><div><font size="1" \
face="monospace"><br></font></div><div><font size="1" face="monospace"># set \
rtpengine to read the body from an AVP:</font></div><div><font size="1" \
face="monospace">modparam(&quot;rtpengine&quot;, &quot;read_sdp_pv&quot;, \
&quot;$avp(sdp)&quot;)<br></font></div><div><font size="1" \
face="monospace"><br></font></div><div><font size="1" face="monospace"># set \
$avp(sdp) to a copy of $rb and replace the m=video line:</font></div><div><span \
style="font-size:x-small;font-family:monospace">$avp(sdp) = \
$rb;</span><br></div><font face="monospace"><font \
size="1">subst_attr(&quot;$sdp&quot;,&quot;/m=video [0-9]*/m=video \
0/&quot;);</font><br></font><div><font face="monospace"><br></font></div><div><font \
face="monospace">So rtpengine would operate on a</font></div><div><font \
face="monospace" size="1">   m=video 0 RTP/AVP XXX</font></div><div><font \
face="monospace">line and so it would not set up rtp proxying for \
it.</font></div><div><font face="monospace"><br></font></div><div><font \
face="monospace">Then the original SDP line:<br><font size="1">   m=video 10004 \
RTP/AVP 105</font><br>became this in the forwarded SDP:<br><font size="1">   m=video \
0 RTP/AVP 0<br></font></font></div><div><font \
face="monospace"><br></font></div><div><font \
face="monospace">Thanks.</font></div><font face="monospace"><br></font><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr"><font face="monospace">On Thu, \
Aug 25, 2022 at 3:39 PM Henning Westerholt &lt;<a href="mailto:hw@gilawa.com" \
rel="noreferrer noreferrer noreferrer" target="_blank">hw@gilawa.com</a>&gt; \
wrote:<br></font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>





<div lang="DE">
<div>
<p class="MsoNormal"><span><font \
face="monospace">Hello,<u></u><u></u></font></span></p> <p \
class="MsoNormal"><span><font face="monospace"><u></u>  <u></u></font></span></p> <p \
class="MsoNormal"><span lang="EN-GB"><font face="monospace">already tried the sdpops \
module?<u></u><u></u></font></span></p> <p class="MsoNormal"><span lang="EN-GB"><font \
face="monospace"><a href="https://kamailio.org/docs/modules/5.5.x/modules/sdpops.html#sdpops.f.sdp_remove_media" \
rel="noreferrer noreferrer noreferrer" \
target="_blank">https://kamailio.org/docs/modules/5.5.x/modules/sdpops.html#sdpops.f.sdp_remove_media</a><u></u><u></u></font></span></p>
 <p class="MsoNormal"><span lang="EN-GB"><font face="monospace"><u></u>  \
<u></u></font></span></p> <p class="MsoNormal"><span lang="EN-GB"><font \
face="monospace">Cheers,<u></u><u></u></font></span></p> <p class="MsoNormal"><span \
lang="EN-GB"><font face="monospace"><u></u>  <u></u></font></span></p> <p \
class="MsoNormal"><span lang="EN-GB"><font \
face="monospace">Henning<u></u><u></u></font></span></p> <p class="MsoNormal"><span \
lang="EN-GB"><font face="monospace"><u></u>  <u></u></font></span></p> <p \
class="MsoNormal"><span lang="EN-GB"><font face="monospace">-- <u></u> \
<u></u></font></span></p> <p class="MsoNormal"><font face="monospace"><span \
lang="EN-GB">Henning Westerholt – </span><span><a href="https://skalatan.de/blog/" \
rel="noreferrer noreferrer noreferrer" target="_blank"><span lang="EN-GB" \
style="color:rgb(5,99,193)">https://skalatan.de/blog/</span></a></span><span \
lang="EN-GB"><u></u><u></u></span></font></p> <p class="MsoNormal"><font \
face="monospace"><span lang="EN-GB">Kamailio services – </span><span><a \
href="https://gilawa.com/" rel="noreferrer noreferrer noreferrer" \
target="_blank"><span lang="EN-GB" \
style="color:rgb(5,99,193)">https://gilawa.com</span></a></span><span \
lang="EN-GB"><u></u><u></u></span></font></p> <p class="MsoNormal"><span \
lang="EN-GB"><font face="monospace"><u></u>  <u></u></font></span></p> <div \
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid \
rgb(225,225,225);padding:3pt 0cm 0cm"> <p class="MsoNormal" \
style="margin-left:35.4pt"><font face="monospace"><b>From:</b> sr-users &lt;<a \
href="mailto:sr-users-bounces@lists.kamailio.org" rel="noreferrer noreferrer \
noreferrer" target="_blank">sr-users-bounces@lists.kamailio.org</a>&gt; <b>On Behalf \
Of </b>mayamatakeshi<br> <b>Sent:</b> Thursday, August 25, 2022 1:49 AM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List &lt;<a \
href="mailto:sr-users@lists.kamailio.org" rel="noreferrer noreferrer noreferrer" \
target="_blank">sr-users@lists.kamailio.org</a>&gt;<br> <b>Subject:</b> [SR-Users] \
Disabling video rtp proxing<u></u><u></u></font></p> </div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace"><u></u>  \
<u></u></font></p> <div>
<p class="MsoNormal" style="margin-left:35.4pt"><font \
face="monospace">Hi,<u></u><u></u></font></p> <div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">I&#39;m using \
rtpengine for RTP proxying with kamailio.<u></u><u></u></font></p> <div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">I use it just \
for audio.<u></u><u></u></font></p> </div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">But eventually \
some terminal reinvites offering video.<u></u><u></u></font></p> </div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">I don&#39;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.<u></u><u></u></font></p> \
</div> <div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">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.<u></u><u></u></font></p> </div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">I tried some \
things like<u></u><u></u></font></p> </div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">      \
replace_body(&quot;^m=video [0-9]+&quot;, &quot;m=video \
0&quot;);<u></u><u></u></font></p> </div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">and<br>
      subst_body(&#39;/^m=video [0-9]+ /m=video 0 /&#39;);<u></u><u></u></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">and  \
<u></u><u></u></font></p> </div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">      \
msg_apply_changes();<u></u><u></u></font></p> </div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">but still the \
RTP proxying   for video is set up.<u></u><u></u></font></p> </div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace"><u></u>  \
<u></u></font></p> </div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace">Any hints on \
how to solve this?<u></u><u></u></font></p> </div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace"><u></u>  \
<u></u></font></p> <div>
<p class="MsoNormal" style="margin-left:35.4pt"><font face="monospace"><u></u>  \
</font><u></u></p> </div>
</div>
</div>
</div>
</div>
</div>

</div></blockquote></div></div>
__________________________________________________________<br>
Kamailio - Users Mailing List - Non Commercial Discussions<br>
   * <a href="mailto:sr-users@lists.kamailio.org" rel="noreferrer noreferrer \
                noreferrer" target="_blank">sr-users@lists.kamailio.org</a><br>
Important: keep the mailing list in the recipients, do not reply only to the \
sender!<br> Edit mailing list options or unsubscribe:<br>
   * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" \
rel="noreferrer noreferrer noreferrer noreferrer" \
target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br> \
</blockquote></div></div></div></div> \
__________________________________________________________<br> Kamailio - Users \
                Mailing List - Non Commercial Discussions<br>
   * <a href="mailto:sr-users@lists.kamailio.org" \
                target="_blank">sr-users@lists.kamailio.org</a><br>
Important: keep the mailing list in the recipients, do not reply only to the \
sender!<br> Edit mailing list options or unsubscribe:<br>
   * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" \
rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
 </blockquote></div></div>



__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic