<p></p>
<p dir="auto">When using uac_reg_request_to and the first trunk fails (as invalid credentials) try a second trunk, but there is something not cleaned or just doesn't get the new trunk auth params.</p>
<p dir="auto">code example</p>
<pre class="notranslate"><code class="notranslate">failure_route[RETRY_OUTBOUND] {

        if (t_check_status("401|407")) {
                if(uac_reg_request_to("$rd", 0)) {
                        t_on_failure("RETRY_OUTBOUND");
                        xinfo("[RETRY_OUTBOUND] <$ci> | Doing authentication with $dd");
                        uac_auth();
                        t_relay();
                        exit;
                }
        }

        if (next_routing()) {
                $avp(out_trunk) = $rd;
                # t_relay();
                t_on_failure("RETRY_OUTBOUND");
                t_relay();
                exit;
        }
        
}

</code></pre>
<p dir="auto">running this code to those targets:</p>
<ul dir="auto">
<li>TRUNK 10.3.3.11 (invalid user/pass)</li>
<li>TRUNK 10.3.3.12 (correct user/pass)</li>
</ul>
<p dir="auto">produce this output in logs:</p>
<pre class="notranslate"><code class="notranslate">INFO:  [RETRY_OUTBOUND] <xxxx1xxx@10.3.3.11:5060> | Doing authentication with 10.3.3.10
INFO: uac [auth.c:450]: uac_auth_mode(): no credential for realm "10.3.3.11"
INFO:  [RETRY_OUTBOUND] <xxxx1yyyy@10.3.3.12:5060> | Doing authentication with 10.3.3.10
</code></pre>
<p dir="auto">but if I simply remove the first trunk those credential works on the second trunk. is like some stuff (like the $dd) is not cleaned up / refreshed?</p>
<p dir="auto">version:</p>
<pre class="notranslate"><code class="notranslate">version: kamailio 5.5.4 (x86_64/linux) 
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, 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_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
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: unknown 
compiled with gcc 8.3.0
</code></pre>
<p dir="auto">running with drouting module to get next trunk</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/3166">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZLNI56ROSJO7UYXCZDVRHLRLANCNFSM5Z6WZECA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/ABO7UZKF46Q3HORYN7VARELVRHLRLA5CNFSM5Z6WZECKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4TFE55VA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><kamailio/kamailio/issues/3166</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/3166",
"url": "https://github.com/kamailio/kamailio/issues/3166",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>