[OpenSIPS-Users] replace_body() issue

Miha miha at softnet.si
Fri Jun 18 11:21:17 EST 2021


I have without ^ and $ before, i have now tried again like you suggested 
but it does not work.
It goes in the if loop ("search_body") but it does not replace inactive 
with sendonly.
I have also look at return code from replace_body and it gives me "-1".

Stas Kobzar je 6/18/2021 ob 1:04 PM napisal:
> Hello,
> Just do not use ^ and $ in the search pattern. It is probably trying 
> to match the whole SDP packet, not single line.
>
> On Fri, Jun 18, 2021 at 5:09 AM Miha via Users 
> <users at lists.opensips.org <mailto:users at lists.opensips.org>> wrote:
>
>     Hello
>
>      have issue with replace_body as it does not change SDP.
>     My code looks like this:
>
>     if (has_body("application/sdp")){
>                 if(search_body("a=inactive")){
>     *replace_body("^a=inactive$", "a=sendonly");*
>
>                 }
>
>                      $var(rtpengine_flags) ="trust-address
>     replace-origin replace-session-connection  ICE=remove RTP/AVP
>     rtcp-mux-demux";
>                      rtpengine_offer("$var(rtpengine_flags)");
>
>                       if(is_audio_on_hold()) {
>
>                         rtpengine_play_media("callee
>     file=/home/ringback.wav");
>                       }
>
>                  t_on_reply("1");
>     }
>
>     What could be wrong that inactive is not replaced by sendonly?
>     On a leg I can see "a=inactive" and also on b leg "a=inactive".
>
>
>     thank you
>     miha
>     _______________________________________________
>     Users mailing list
>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>     <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20210618/bdc467c3/attachment-0001.html>


More information about the Users mailing list