<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
if something is still  appended to From User thats means you updated $fU also before update it in branch_route. </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
surely you update $fU also in route[<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.6667px;background-color:rgb(255, 255, 255);display:inline !important">IMP_ROUTE_TO_CORE]
 thats why.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.6667px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.6667px;background-color:rgb(255, 255, 255);display:inline !important">all
 updates to $fU must be done once otherwise you concatenate it.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.6667px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.6667px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.6667px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b><br>
</b></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De :</b> Benoît Panizzon <benoit.panizzon@imp.ch><br>
<b>Envoyé :</b> vendredi 24 juin 2022 16:10<br>
<b>À :</b> Patrick Karton <patrickarton@hotmail.com><br>
<b>Cc :</b> Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org><br>
<b>Objet :</b> Re: [SR-Users] How to handle a 301 redirect request from a client?</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Salut Patrick<br>
<br>
> since you want to apply manipulation on the new user received from<br>
> 300 response you need to use branch_route for this. thats one of his<br>
> purpose.<br>
<br>
So that is what I attempted...<br>
<br>
        if (t_check_status("(301)|(302)") or (t_branch_timeout() and !t_branch_replied())) {<br>
                t_on_branch("TEST_BR");<br>
                route(IMP_ROUTE_TO_CORE);<br>
                exit;<br>
        }<br>
<br>
branch_route[TEST_BR]<br>
{<br>
        xlog("L_ERR", "$cfg(route): HERE WE ARE\n"); # To verify via logs this was triggered<br>
        $fU = "+41441234567";<br>
}<br>
<br>
I still end up with +41441234567 being appended to the From User HF I<br>
have set previously for the invite towards the CPE which then replied<br>
with 302<br>
<br>
For better understanding, this is the situation: <br>
<br>
We want to use e164 on the 'core' as this is the format we have defined<br>
as 'normalized' format and which is also in use on IC to other TSP.<br>
Only to/from the customer CPE we translate numbers to from the mostly<br>
used national format.<br>
<br>
Basically replacing +41 with '0' and + with '00' and the other way round.<br>
<br>
So in this example From user is +41441234567 and location lookup is performed.<br>
Then From user is translated to 0441234567 to reflect the national<br>
notation and display the callerID in a usual format to the customer.<br>
<br>
But when I get a 302 from that CPE and need to send the call back on an<br>
IC. I want to preserve the original From: username and translate<br>
it back to e164. But as I already have set $fU = "0441234567" when I do an<br>
additional $fU = "+41441234567" in branch_route, I and up with<br>
<br>
From: "John Doe" <0441234567+41441234567@sip.example.com>;user=phone<br>
<br>
as setting $fU is APPENDING. No matter if I do this on a failure route<br>
or a branch route.<br>
<br>
Or did I miss a trick? :-)<br>
<br>
Would I need to also use branch_route to send the initial call towards<br>
the customer CPE and set the 'localized' $fU there? Is this message<br>
being dropped and the original one used again when triggering<br>
failure_route? Is this how it's supposed to work?<br>
<br>
-- <br>
Mit freundlichen Grüssen<br>
<br>
-Benoît Panizzon- @ HomeOffice und normal erreichbar<br>
-- <br>
I m p r o W a r e   A G    -    Leiter Commerce Kunden<br>
______________________________________________________<br>
<br>
Zurlindenstrasse 29             Tel  +41 61 826 93 00<br>
CH-4133 Pratteln                Fax  +41 61 826 93 01<br>
Schweiz                         Web  <a href="http://www.imp.ch">http://www.imp.ch</a><br>
______________________________________________________<br>
</div>
</span></font></div>
</body>
</html>