<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>changing content in SIP headers is practically done as two
operations:</p>
<p> - delete old value<br>
- insert the new value where the old value started</p>
<p>By doing two changes to the same content (without an intermediate
msg apply changes), practically you insert two new values where
the old value started. The result being that the two new values
appear one after the other.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div class="moz-cite-prefix">On 17.10.19 22:11, Jurijs Ivolga wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOrA2UbqPGP0FZy-itZyy_z6TJx_9H4eRFT1x5cKdMn=UPDuHQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div>
<div dir="auto">Hi Daniel,</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">I got that changes are not applied immediately.
When I check SIP packet itself what was sent out I see that from
header has user part equal to "1234567+123456". I think this
might be a bug...</div>
<div dir="auto"><br>
</div>
<div dir="auto">Thank you!</div>
<div><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, 17. Oct 2019 at
22:22, Daniel-Constantin Mierla <<a
href="mailto:miconda@gmail.com" moz-do-not-send="true">miconda@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>assigning to $fn, $fu or $fU is offered as a
convenience way to update parts of From header, but the
changes are not applied immediately, like the other
operations done over the SIP headers -- see more details
in the FAQ:</p>
<p> - <a
href="https://www.kamailio.org/wiki/tutorials/faq/main#why_changes_made_to_headers_or"
target="_blank" moz-do-not-send="true">https://www.kamailio.org/wiki/tutorials/faq/main#why_changes_made_to_headers_or</a></p>
<p>In your case, try to do those changes only in
branch_route.</p>
<p>Cheers,<br>
Daniel<br>
</p>
</div>
<div text="#000000" bgcolor="#FFFFFF">
<div>On 17.10.19 20:59, Jurijs Ivolga wrote:<br>
</div>
</div>
<div text="#000000" bgcolor="#FFFFFF">
<blockquote type="cite">
<div dir="ltr">
<div>Hi,</div>
<div><br>
</div>
<div>Just to add one more point that $fU & $fn I'm
checking not in script but in SIP packet. So using
sngrep i see in SIP packet from header where $fU and
$fn are "1234567+123456".</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr" data-smartmail="gmail_signature">
<div dir="ltr">Jurijs<br>
</div>
</div>
</div>
<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Oct 17, 2019
at 1:06 PM Jurijs Ivolga <<a
href="mailto:jurijs.ivolga@gmail.com"
target="_blank" moz-do-not-send="true">jurijs.ivolga@gmail.com</a>>
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">Hi! <br>
<br>
I have small problem. When I assign $fU or $fn in
request-route and then one more time I make new
assignment in branch_route. Instead of rewriting
it is just concatenate needed value at the end.
lets assume $avp(cli)=1234567 and
$avp(cliplus)=+1234567. So if in request_route I
do $fU=$avp(cli); and then in
branch_route $fU=$avp(cliplus);. $fU becomes one
string: "1234567+1234567". Is it a bug or I
missing something?
<div><br>
</div>
<div>Here is config snippet:</div>
<div><br>
</div>
<div>request_route {</div>
<div>...</div>
<div>route(MY);<br>
</div>
<div>...<br>
</div>
<div>}<br>
</div>
<div><br>
</div>
<div>route[MY] {<br>
<br>
...<br>
$avp(cli) = "1234567"<br>
$avp(cliplus) = "+"+$avp(cli);<br>
$fU=$avp(cli); # here $fU=1234567<br>
$fn=$avp(cli); # here $fn=1234567<br>
route(LCR_ROUTE);<br>
exit;<br>
}<br>
<br>
route[LCR_ROUTE]<br>
{<br>
if(!is_method("INVITE"))<br>
return;<br>
if (!load_gws("1",$rU,$avp(cli))) {<br>
send_reply("503", "Error loading
gateways");<br>
exit;<br>
}<br>
<br>
$var(i)=0;<br>
while($(avp(lcr_gw_uri)[$var(i)])!=
$null){<br>
xlog("L_INFO", "loaded
gw_uri_avp[$var(i)]=$(avp(lcr_gw_uri)[$var(i)])
\n");<br>
$var(i) = $var(i)+1;<br>
}<br>
<br>
if (!next_gw()) {<br>
send_reply("503", "No available
gateways");<br>
exit;<br>
}<br>
<br>
xlog("L_INFO", "request-uri $ru \n");<br>
xlog("L_INFO", "$avp(lcr_gw_uri),
$avp(lcr_id)\n");<br>
<br>
xlog("L_INFO", "flag $avp(lcr_flag)
\n");<br>
<br>
t_set_fr(0, 4000);<br>
t_on_failure("RTF_LCR_ROUTE");<br>
t_on_branch("BRANCH_CUST");<br>
route(RELAY);<br>
exit;<br>
}<br>
<br>
branch_route[BRANCH_CUST] {<br>
if ( $avp(lcr_flag) == 4) {<br>
$fU=$avp(cliplus); #here
$fU=1234567+1234567<br>
$fn=$avp(cliplus); #here
$fn=1234567+1234567<br>
}<br>
}</div>
<div><br>
</div>
<div>
<div dir="ltr">
<div dir="ltr">Jurijs<br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<fieldset></fieldset>
</blockquote>
</div>
<div text="#000000" bgcolor="#FFFFFF">
<blockquote type="cite">
<pre>_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
</div>
<div text="#000000" bgcolor="#FFFFFF">
<blockquote type="cite"> </blockquote>
<pre cols="72">--
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank" moz-do-not-send="true">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Oct 21-23, 2019, Berlin, Germany -- <a href="https://asipto.com/u/kat" target="_blank" moz-do-not-send="true">https://asipto.com/u/kat</a></pre>
</div>
</blockquote>
</div>
</div>
-- <br>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">Jurijs<br>
</div>
</div>
</blockquote>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Oct 21-23, 2019, Berlin, Germany -- <a class="moz-txt-link-freetext" href="https://asipto.com/u/kat">https://asipto.com/u/kat</a></pre>
</body>
</html>