24 juni 2022 kl. 17:34 skrev Patrick Karton <patrickarton@hotmail.com>:

if something is still  appended to From User thats means you updated $fU also before update it in branch_route. 

surely you update $fU also in route[IMP_ROUTE_TO_CORE] thats why.

all updates to $fU must be done once otherwise you concatenate it.
Is this documented anywhere? If not, we need to add it to docs.

/O






De : Benoît Panizzon <benoit.panizzon@imp.ch>
Envoyé : vendredi 24 juin 2022 16:10
À : Patrick Karton <patrickarton@hotmail.com>
Cc : Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Objet : Re: [SR-Users] How to handle a 301 redirect request from a client?
 
Salut Patrick

> since you want to apply manipulation on the new user received from
> 300 response you need to use branch_route for this. thats one of his
> purpose.

So that is what I attempted...

        if (t_check_status("(301)|(302)") or (t_branch_timeout() and !t_branch_replied())) {
                t_on_branch("TEST_BR");
                route(IMP_ROUTE_TO_CORE);
                exit;
        }

branch_route[TEST_BR]
{
        xlog("L_ERR", "$cfg(route): HERE WE ARE\n"); # To verify via logs this was triggered
        $fU = "+41441234567";
}

I still end up with +41441234567 being appended to the From User HF I
have set previously for the invite towards the CPE which then replied
with 302

For better understanding, this is the situation: 

We want to use e164 on the 'core' as this is the format we have defined
as 'normalized' format and which is also in use on IC to other TSP.
Only to/from the customer CPE we translate numbers to from the mostly
used national format.

Basically replacing +41 with '0' and + with '00' and the other way round.

So in this example From user is +41441234567 and location lookup is performed.
Then From user is translated to 0441234567 to reflect the national
notation and display the callerID in a usual format to the customer.

But when I get a 302 from that CPE and need to send the call back on an
IC. I want to preserve the original From: username and translate
it back to e164. But as I already have set $fU = "0441234567" when I do an
additional $fU = "+41441234567" in branch_route, I and up with

From: "John Doe" <0441234567+41441234567@sip.example.com>;user=phone

as setting $fU is APPENDING. No matter if I do this on a failure route
or a branch route.

Or did I miss a trick? :-)

Would I need to also use branch_route to send the initial call towards
the customer CPE and set the 'localized' $fU there? Is this message
being dropped and the original one used again when triggering
failure_route? Is this how it's supposed to work?

-- 
Mit freundlichen Grüssen

-Benoît Panizzon- @ HomeOffice und normal erreichbar
-- 
I m p r o W a r e   A G    -    Leiter Commerce Kunden
______________________________________________________

Zurlindenstrasse 29             Tel  +41 61 826 93 00
CH-4133 Pratteln                Fax  +41 61 826 93 01
Schweiz                         Web  http://www.imp.ch
______________________________________________________
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
 * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
 * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users