Hello. At first- I think header of my message doesn't explain my porblem but I can not say about it with different terms)

So. I have construction Asterisk --> Kamailio --> Providers

My provisers registered with UAC modure and stored at UACREG table.

Problem scenario is:

I ring from asterisk to provider

Asterisk --> Kamailio --> Providers

Call from asterisk come to kamailio with 
furi(Asterisk_clinet_local_number@asterisk)
turi(external_number@kamailio)

Then, to forward INVITE to provider that Needed I use some manipulations to choose provider (it does not matter, it is only sql_queryes to some tables), and then modify invite with this code:

#$var(prov) - my.provider.ip
#$var(trunk) - name_of_trunk 

$rd=$var(prov);
$rp="5060";
$fU=$var(trunk);
$fd=$var(prov);
$td=$var(prov);

remove_hf("Contact");
append_hf("Contact:<$var(trunk)@my.kamailio.domain:5068>\n","Contact");


So -after this manipulation I have write packet, that goues to my provider.

Then Provier sends me 407 answer and packet goes to failure_route

if (t_check_status("401|407")){
        xlog("L_INFO", "Reply from provider on failure: $rs");
        
        if  (uac_auth()){
                     #my query to get avp for uac
                     #modparam("uac","auth_realm_avp","$avp(s:realm)")
                     #modparam("uac","auth_username_avp","avp(s:uname)")
                     #modparam("uac","auth_password_avp","$avp(s:passwd))") 
 
sql_pvquery("ca","select auth_username, auth_password, realm from uacreg where auth_username='$fU'","$var(uname), $var(passwd), $var(realm)");        
                xlog("L_INFO", "username=$var(uname), password=$var(passwd), realm=$var(realm) for {$fU}");

pv_printf("$avp(s:uname)","$var(uname)");
                      pv_printf("$avp(s:passwd)","$var(passwd)");
                      pv_printf("$avp(s:realm)","$var(realm)");
 

                      xlog("L_INFO", "UAC_AUTH(): $rs"); 
                       append_branch();
                       t_relay();
        
            }
        }
if (t_is_canceled()) {
exit;
}
So After changes Before Provider answer 407 my $fU = name_of_trunk, but at failure route my fU is Asterisk_clinet_local_number and it so strange because I see this packet at TCPDUMP and it have trunkname at fU
Because of It I can not take from table needed vars for auth and avp`s Have 0.

So packet for Auth (407) goes to Asterisk (with trunkname!!!! at fU), but t must stops at kamailio and must be ralayed to provider.

So this my problem- I can not understand: Why fU at reply 407 have old parameters?