<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<tt>Hi Anton,<br>
<br>
by default, the module does auto restore of the FROM/TO hdr. The
restoring is done in the traffic flowing in the opposite direction
than the initial request. So, the uac_restore_xx() is NOT an
uac_undo_xx() !<br>
<br>
As I understand, you do serial forking and for you want to do
different, or not to do, uac_replaces for each branch. If this is
the case, you need to do the uac_replace_xx() in the branch_route
- by doing this, the change will impact only that branch, without
any effect on the other branches.<br>
<br>
<br>
branch_route[change_from]<br>
{<br>
if (</tt><tt><tt><tt>$avp(furi)!=NULL)<br>
</tt></tt> uac_replace_from("</tt><tt><tt>$avp(furi)</tt>");<br>
}<br>
<br>
route {<br>
$avp(furi) = "...";<br>
t_on_branch("change_from");<br>
</tt><tt>t_on_failure("missed_call");<br>
}<br>
<br>
</tt><br>
<tt>failure_route[missed_call]<br>
{<br>
$ru = "..";<br>
</tt><br>
<tt><tt> $avp(furi) = "...";</tt> # if you want a different FROM
URI<br>
</tt><tt><tt><tt>$avp(furi) = NULL; # if you want to keep the
original URI<br>
<br>
....<br>
</tt></tt>}<br>
<br>
Regards,<br>
</tt>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Summit, Amsterdam, May 2020
<a class="moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2020Amsterdam/">https://www.opensips.org/events/Summit-2020Amsterdam/</a>
OpenSIPS Bootcamp, Miami, March 2020
<a class="moz-txt-link-freetext" href="https://opensips.org/training/OpenSIPS_Bootcamp_2020/">https://opensips.org/training/OpenSIPS_Bootcamp_2020/</a>
</pre>
<div class="moz-cite-prefix">On 2/4/20 3:39 PM, Антон Ершов wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAMp8X_vJC_2o_SzrQ=3+M1hQqxPsE5P-d+ygveWjecxhC80cCQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hello friends<br>
Help me to understand. In request_route i make replace from and
to fields.
<div>After an unsuccessful attempt to invite, I try to direct
the call to another place and again I need to replace the from
and to fields. But instead of replacing, new values are simply
added<br>
</div>
<div><br>
</div>
<div>route {</div>
<div> ...</div>
<div> route(rewrite_header);</div>
<div> ...</div>
<div>}</div>
<div>failure_route[missed_call] {<br>
</div>
<div> setflag(need_uac_restore);</div>
<div> ...</div>
<div> route(rewrite_header);</div>
<div>}</div>
<div>route[rewrite_header] {<br>
</div>
<div> if (isflagset(need_uac_restore)) {<br>
xlog("L_INFO", "[ $ci ] - restore from and to
fields\n");<br>
uac_restore_from();<br>
uac_restore_to();<br>
}<br>
</div>
<div>
uac_replace_from("",<a class="moz-txt-link-rfc2396E" href="sip:$avp(fromuser)@$avp(fromdomain)">"sip:$avp(fromuser)@$avp(fromdomain)"</a>);</div>
<div> uac_replace_to("",<a class="moz-txt-link-rfc2396E" href="sip:$avp(touser)@$avp(todomain)">"sip:$avp(touser)@$avp(todomain)"</a>);</div>
<div>}</div>
<div><br>
</div>
<div>in the end I get such fields<br>
</div>
<div><br>
</div>
<div>From: <<a href="mailto:sip%3A2220222@10.10.10.10"
moz-do-not-send="true">sip:2220222@10.10.10.10</a>><a class="moz-txt-link-rfc2396E" href="sip:5274274@sipofon.loc"><sip:5274274@sipofon.loc></a>;tag=fe654d87-7565-408f-9925-98a5bac99e1c<br>
To: <<a href="mailto:sip%3A3865071@10.10.10.10"
moz-do-not-send="true">sip:3865071@10.10.10.10</a>><a class="moz-txt-link-rfc2396E" href="sip:3865071@sipofon.loc"><sip:3865071@sipofon.loc></a><br>
</div>
<div><br>
</div>
<div>it simply appends the new value to the old and does not
replace it<br>
</div>
<div>changing replace modes in uac module does not change
behavior<br>
</div>
<div>in debug log i see this</div>
<div><br>
</div>
<div>DBG:uac:replace_uri: uri to replace [<<a
href="mailto:sip%3A2220222@10.23.100.40"
moz-do-not-send="true">sip:2220222@10.23.100.40</a>>],
replacement is [<<a
href="mailto:sip%3A79385274274@multifon.ru"
moz-do-not-send="true">sip:79385274274@multifon.ru</a>>]<br>
DBG:dialog:new_dlg_val: inserting
<739823>=<<a class="moz-txt-link-rfc2396E" href="sip:5274274@sipofon.loc"><sip:5274274@sipofon.loc></a>><br>
DBG:dialog:store_dlg_value_unsafe: var found-> <<<a
href="mailto:sip%3A2220222@10.10.10.10"
moz-do-not-send="true">sip:2220222@10.10.10.10</a>>>!<br>
DBG:uac:replace_uri: uri to replace [<<a
href="mailto:sip%3A3865071@10.100.100.100"
moz-do-not-send="true">sip:3865071@10.100.100.100</a>>],
replacement is [<a class="moz-txt-link-rfc2396E" href="sip:3865071@sipofon.loc"><sip:3865071@sipofon.loc></a>]<br>
DBG:dialog:new_dlg_val: inserting
<739824>=<<a class="moz-txt-link-rfc2396E" href="sip:3865071@sipofon.loc"><sip:3865071@sipofon.loc></a>><br>
DBG:dialog:store_dlg_value_unsafe: var found-> <<<a
href="mailto:sip%3A3865071@10.10.10.10"
moz-do-not-send="true">sip:3865071@10.10.10.10</a>>>!<br>
</div>
<div><br>
</div>
<div>10.23.100.40 - call initiator</div>
<div>10.10.10.10 - where should the call go first<br>
</div>
<div>10.100.100.100 - opensips<br>
</div>
<div>sipofon.loc - where should the call go after failure_route
has worked<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>