<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<tt>Hi Dmitry,<br>
<br>
<tt>In order to p<tt>us<tt>h per-<tt>bra<tt>nch changes (changes w<tt>hich
are <tt>speci<tt>fic only <tt>to a certain<tt>
branch and not to all of them), you need to
use the branch route<tt> - see
<a class="moz-txt-link-freetext" href="http://www.opensips.org/Documentation/Script-Routes-2-3#toc2">http://www.opensips.org/Documentation/Script-Routes-2-3#toc2</a><br>
<br>
<tt>So, put the code for chan<tt>ging the
body via rtpengin<tt>e into a branch
route.</tt></tt></tt><br>
</tt></tt></tt></tt></tt></tt></tt></tt></tt></tt></tt><br>
<tt>Regards,</tt><br>
</tt>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>
OpenSIPS Summit 2018
<a class="moz-txt-link-freetext" href="http://www.opensips.org/events/Summit-2018Amsterdam">http://www.opensips.org/events/Summit-2018Amsterdam</a>
</pre>
<div class="moz-cite-prefix">On 02/02/2018 12:53 PM, Dmitry wrote:<br>
</div>
<blockquote type="cite"
cite="mid:429c01d39c14$087d3a60$1977af20$@gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
tt
{mso-style-priority:99;
font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;
mso-fareast-language:EN-US;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;
color:black;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;
color:black;}
span.EmailStyle22
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle23
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle24
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:2.0cm 42.5pt 2.0cm 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Hi
Bogdan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">I
change both of them. The first INVITE and the second (after
488).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">The
first apply successfully, but the second (that in the
failure_route) does not.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">My
script looks like this:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">route
{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
t_on_reply("ONREPLY”);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
if (isbflagset(NAT_BFLAG) && af!=INET6) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
force_rport(); # add rport to first line Via:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
route(RTPENGINE_OFFER); # make offer<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
t_relay();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">route[RTPENGINE_OFFER]
{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
$avp(rtp_profile) = "trust-address replace-origin
replace-session-connection ICE=remove DTLS=off </span><span
style="color:red" lang="EN-US">RTP/SAVP</span><span
style="color:#1F497D" lang="EN-US">";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
if
(rtpengine_offer("$avp(rtp_profile)","$avp(rtp_socket)","$avp(rtp_body)"))
{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
remove_body_part();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
add_body_part("$avp(rtp_body)", "application/sdp"); # </span><span
style="color:#0070C0" lang="EN-US">first changing leg-B -
successfully</span><span style="color:#1F497D" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">onreply_route[ONREPLY]
{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
t_on_reply("RTPENGINE_ANSWER"); # positive<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
t_on_failure("RTPENGINE_488"); # negative<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">failure_route[RTPENGINE_488]
{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
if (t_check_status("488") ) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
# </span><span style="color:#0070C0" lang="EN-US">try to
change SDP in leg-B after 488 received - unsuccessfully</span><span
style="color:#1F497D" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
# </span><span style="color:red" lang="EN-US">it returns:
ERROR:rtpengine:rtpe_function_call: can't extract body from
the message. <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"> </span><span
style="color:windowtext"> </span><span style="color:#002060"
lang="EN-US"># f</span><span style="color:#002060">rom which
message?</span><span style="color:windowtext" lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
if (rtpengine_offer("trust-address replace-origin
replace-session-connection ICE=remove DTLS=off </span><span
style="color:red" lang="EN-US">RTP/AVP</span><span
style="color:#1F497D" lang="EN-US">","$avp(rtp_socket)","$avp(rtp_body)"))
{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
remove_body_part();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
add_body_part("$avp(rtp_body)", "application/sdp");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
# <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
# </span><span style="color:#002060" lang="EN-US">just
replace with re.subst</span><span style="color:#1F497D"
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
$avp(rtp_body) = $(avp(rtp_body){re.subst,/</span><span
style="color:red" lang="EN-US">SAVP/AVP</span><span
style="color:#1F497D" lang="EN-US">/g});<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
$avp(rtp_body) = $(avp(rtp_body){re.subst,/a=crypto.*//g});<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
# </span><span style="color:red" lang="EN-US">if I use
remove_body_part(), then add_body_part() is not adds
content. INVITE sends without body</span><span
style="color:#1F497D" lang="EN-US">.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
remove_body_part();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
# </span><span style="color:red" lang="EN-US">if I don’t
use remove_body_part(), then INVITE contains TWO sdp body
with RTP/SAVP and RTP/AVP</span><span style="color:#1F497D"
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
add_body_part("$avp(rtp_body)", "application/sdp");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
#<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
xlog("rtp_body=$avp(rtp_body)\n");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
# xlog for $avp(rtp_body) shows unchanged content (with
RTP/SAVP)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
t_relay();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">
}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="color:windowtext;mso-fareast-language:RU"
lang="EN-US">From:</span></b><span
style="color:windowtext;mso-fareast-language:RU"
lang="EN-US"> Bogdan-Andrei Iancu
[<a class="moz-txt-link-freetext" href="mailto:bogdan@opensips.org">mailto:bogdan@opensips.org</a>] <br>
<b>Sent:</b> Thursday, February 1, 2018 7:51 PM<br>
<b>To:</b> Dmitry <a class="moz-txt-link-rfc2396E" href="mailto:netaskd@gmail.com"><netaskd@gmail.com></a>; 'OpenSIPS
users mailling list' <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] Handling 488 on a
leg B<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><tt><span style="font-size:10.0pt">Hi
Dmitry,</span></tt><span
style="font-size:10.0pt;font-family:"Courier New""><br>
<br>
<tt>In failure route you re-process the original request
(INVITE) and not the 488 reply - the reply is just the
trigger.</tt><br>
<tt>Do you change the INVITE SDP before the first attempt
(which ends with 488) ? Or you change it for the first
time in the failure route ?</tt><br>
<br>
<tt>Regards,</tt><br>
<br>
</span><span style="font-size:12.0pt;mso-fareast-language:RU"><o:p></o:p></span></p>
<pre>Bogdan-Andrei Iancu<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>OpenSIPS Founder and Developer<o:p></o:p></pre>
<pre> <a href="http://www.opensips-solutions.com" moz-do-not-send="true">http://www.opensips-solutions.com</a><o:p></o:p></pre>
<pre>OpenSIPS Summit 2018<o:p></o:p></pre>
<pre> <a href="http://www.opensips.org/events/Summit-2018Amsterdam" moz-do-not-send="true">http://www.opensips.org/events/Summit-2018Amsterdam</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 02/01/2018 05:34 PM, Dmitry wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Hello
Bogdan,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Thank
you for advice.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">I
catched 488 and can send INVITE from failure_route, but I
can’t modify body inside it.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">The
main goal is change SAVP profile to AVP when 488 received.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">I
tried to do it via rtpengine_offer function. It doesn’t
work. I guess, it try to read the body from response (488
in my case) but not from request.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">I
tried to rewrite body via remove_body_part and
add_body_part functions, it also doesn’t work.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">So,
I don’t understand how exactly rewrite body in
failure_route before do t_relay().</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">In
addition, I tried making a new branch (via append_branch
function and via branch_route). It just duplicate my
re-INVITE without changing the body.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Could
you please drop a hint (example on few lines of code) how
to do it?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Thanks.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="color:windowtext;mso-fareast-language:RU"
lang="EN-US">From:</span></b><span
style="color:windowtext;mso-fareast-language:RU"
lang="EN-US"> Bogdan-Andrei Iancu [<a
href="mailto:bogdan@opensips.org"
moz-do-not-send="true">mailto:bogdan@opensips.org</a>]
<br>
<b>Sent:</b> Wednesday, January 31, 2018 6:55 PM<br>
<b>To:</b> OpenSIPS users mailling list <a
href="mailto:users@lists.opensips.org"
moz-do-not-send="true"><users@lists.opensips.org></a>;
Dmitry <a href="mailto:netaskd@gmail.com"
moz-do-not-send="true"><netaskd@gmail.com></a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] Handling 488 on a
leg B</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><tt><span style="font-size:10.0pt">Hello
Dmitry,</span></tt><span
style="font-size:10.0pt;font-family:"Courier
New""><br>
<br>
<tt>What you want to do is called (in SIP) serial forking.
Use failure_route{} to catch the 488 and to add a create
a new branch (with modified body) .</tt><br>
<br>
<tt>See: <a
href="http://www.opensips.org/Documentation/Script-Routes-2-3#toc3"
moz-do-not-send="true">http://www.opensips.org/Documentation/Script-Routes-2-3#toc3</a></tt><br>
<br>
<tt>Regards,</tt><br>
<br>
<br>
</span><o:p></o:p></p>
<pre>Bogdan-Andrei Iancu<o:p></o:p></pre>
<pre> <o:p></o:p></pre>
<pre>OpenSIPS Founder and Developer<o:p></o:p></pre>
<pre> <a href="http://www.opensips-solutions.com" moz-do-not-send="true">http://www.opensips-solutions.com</a><o:p></o:p></pre>
<pre>OpenSIPS Summit 2018<o:p></o:p></pre>
<pre> <a href="http://www.opensips.org/events/Summit-2018Amsterdam" moz-do-not-send="true">http://www.opensips.org/events/Summit-2018Amsterdam</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 01/30/2018 02:56 PM, Dmitry wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-US">Hello all,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Could you say how
can I re-send INVITE with changed SDP to B-leg after
receive 488 from it?</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Call flow:</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">-> A-leg INVITE</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"><- A-leg 100</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">-> B-leg INVITE</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"><- B-leg 100</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"><- B-leg 488 – I
catch it, and want to send INVITE again with properly
SDP</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">-> B-leg ACK</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"><-A-leg 488</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">-> B-leg ACK</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Thanks for any
advice.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Cheers!</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><br>
<br>
<br>
<br>
</span><o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Users mailing list<o:p></o:p></pre>
<pre><a href="mailto:Users@lists.opensips.org" moz-do-not-send="true">Users@lists.opensips.org</a><o:p></o:p></pre>
<pre><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt"> </span><o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman",serif;mso-fareast-language:RU"><o:p> </o:p></span></p>
</div>
</blockquote>
<br>
</body>
</html>