Hi,
I didn't understand from your mail if you are calling uac_replace_to()  in a branch route also for the first request or only when you hit the failure route.
Just in case, you need to call it in a branch route for the initial request too so to have a "clean" message when you run the failure route, otherwise the effect will be the one you observed, kind of garbage in the header.

Best regards,

Federico

On Mon, Sep 17, 2018 at 2:32 PM Yuriy Gorlichenko <ovoshlook@gmail.com> wrote:
all is default
Maybe I need to set up something there?
I jsut did not found anything about it at the docs

пн, 17 сент. 2018 г. в 14:42, Sergiu Pojoga <pojogas@gmail.com>:
Ok, what are your UAC parameters?

On Mon, Sep 17, 2018 at 7:34 AM Yuriy Gorlichenko <ovoshlook@gmail.com> wrote:
No. Tried from branch route. 

пн, 17 сент. 2018 г., 14:25 Sergiu Pojoga <pojogas@gmail.com>:
From which route are you calling uac_replace_to(), failure_route?

"This function can be used from REQUEST_ROUTE and from BRANCH_ROUTE"

On Mon, Sep 17, 2018 at 6:05 AM Yuriy Gorlichenko <ovoshlook@gmail.com> wrote:
I tried uac_replace_to() 
But no luck

пн, 17 сент. 2018 г. в 12:28, Alex Balashov <abalashov@evaristesys.com>:
That is not a safe way to change the To header, since proxies aren't supposed to modify the To or From headers.

The proper approach conceals the fact that modifications have taken place from the caller:

https://kamailio.org/docs/modules/5.1.x/modules/uac.html#uac.f.uac_replace_to

--
Sent from mobile. Apologies for brevity and errors.

-----Original Message-----
From: Mojtaba <mespio@gmail.com>
To: "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Sent: Mon, 17 Sep 2018 5:23 AM
Subject: Re: [SR-Users] issue with rewrite to domain in failure route

The $td is read-only variable, and yoou could not change it's value.
If you want to change domain in To header, You should use testops
module in kamialio and replace domain in To header. for example:
subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1$avp(sip_address)\2/ig')
With Regards.Mojtaba

On Mon, Sep 17, 2018 at 1:19 PM Yuriy Gorlichenko <ovoshlook@gmail.com> wrote:
>
> Hi
> I'm building some system with failover trunk
> but my providers requires to set their doamin in domain part of To Header
>
> so when I rewrite it at the my failure_route
>
> $td = FAILOVER_PROVIDER
> my To filed looks like
> To: <sip: 123@my.failover.providermy.main.provider>
> what i tried:
> Move this change to BRANCH_ROUTE:
> here tried as
> $td =  as
> uac_replace_to('',"newToFieldValue)
>
> Move to the my custom route with both variants
> But result is the same
> kamailio 5.1
>
> version: kamailio 5.1.5 (x86_64/linux) d06080
> flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
> ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
> poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
> id: d06080
> compiled on 00:43:08 Aug 23 2018 with gcc 6.3.0
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users



--
--Mojtaba Esfandiari.S

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users