<div dir="ltr"><div>Hello,</div><div><br></div><div>I try to register on provider`s pbx</div><div><br></div><div>version: kamailio 5.7.0-dev0 (x86_64/linux) <br></div><div><br></div><div>modparam("uac", "reg_db_url", "mysql://kamailio:123@localhost/kamailio")<br>modparam("uac", "reg_contact_addr", "<a href="http://1.1.1.1:5060">1.1.1.1:5060</a>")<br>modparam("uac", "reg_retry_interval", 120); # for failed registrations<br>modparam("uac", "reg_keep_callid", 1)<br>modparam("uac","restore_mode","auto")</div><div><br></div><div>uacreg table:<br></div><div>+----+---------+------------+-----------+----------------+-----------------+-------+----------------+------------------+----------+---------------------+---------+-------+-----------+--------------+------------------+<br>| id | l_uuid  | l_username | l_domain  | r_username     | r_domain        | realm | auth_username  | auth_password    | auth_ha1 | auth_proxy          | expires | flags | reg_delay | contact_addr | socket           |<br>+----+---------+------------+-----------+----------------+-----------------+-------+----------------+------------------+----------+---------------------+---------+-------+-----------+--------------+------------------+<br>|  1 | 1234567 | pbx        | 127.0.0.1 | login | <a href="http://ip.provider.ru">ip.provider.ru</a>   |       | login | password|          | sip:...com   |     120 |     0 |         0 |              | <a href="http://10.130.0.23:5060">10.130.0.23:5060</a> |</div><div><br></div><div>I see this two 401 replies <br></div><div><img src="cid:ii_l5l6zjcv0" alt="изображение.png" style="margin-right: 0px;" width="366" height="137"></div><div><br></div><div>1st REGISTER</div><div>Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK589d.8183f2e6000000000000000000000000.0<br>To: <<a href="mailto:sip%3Alogin@ip.provider.com">sip:login@ip.provider.com</a>><br>From: <<a href="mailto:sip%3Alogin@ip.provider.com">sip:login@ip.provider.com</a>>;tag=f9cf84029bbf24b61836c3d9fef7b7ae-78a2ffe1<br>CSeq: 10 REGISTER<br>Call-ID: <a href="mailto:6818f1b436befce1-21980@10.130.0.23">6818f1b436befce1-21980@10.130.0.23</a><br>Max-Forwards: 70<br>Content-Length: 0<br>User-Agent: server<br>Contact: <<a href="http://sip:1234567@1.1.1.1:5060">sip:1234567@1.1.1.1:5060</a>><br>Expires: 120</div><div><br></div><div>1st 401</div><div>WWW-Authenticate: Digest algorithm=MD5,realm=".......org",nonce="<b>56806a6f32c49a3afea043c2fa42381f</b>",domain="sip:......org",qop="auth",<b>stale=FALSE</b></div><div><br></div><div>2nd REGISTER</div><div>Authorization: Digest username="login", realm=".....", nonce="<b>56806a6f32c49a3afea043c2fa42381f</b>", uri="sip:......com", qop=auth, nc=00000001, cnonce="357420659", response="6e300c9f7f4d81095f29b5408f8d5191", algorithm=MD5</div><div><br></div><div>2nd 401</div><div>WWW-Authenticate: Digest algorithm=MD5,realm=".....org",nonce="<b>3b9586f6d31a76e509eb204d8a030415</b>",domain="sip:.....org",qop="auth",<b>stale=TRUE</b></div><div><br></div><div>I think kamailio need to sent 3nd REGISTER with a new nonce, because stale=true. But it interrupts register with error:<br></div><div><br></div><div>Jul 14 18:41:00 opensips kamailio[21936]: 10(21949) DEBUG: {2 11 REGISTER <a href="mailto:6818f1b436befcf7-21980@10.130.0.23">6818f1b436befcf7-21980@10.130.0.23</a>} uac [uac_reg.c:852]: uac_reg_tm_callback(): completed with status 401 [uuid: 1234567]<br>Jul 14 18:41:00 opensips kamailio[21936]: 10(21949) ERROR: {2 11 REGISTER <a href="mailto:6818f1b436befcf7-21980@10.130.0.23">6818f1b436befcf7-21980@10.130.0.23</a>} uac [uac_reg.c:933]: uac_reg_tm_callback(): authentication failed for <1234567></div><div><br></div><div>Can I get kamailio to send REGISTER after the second 401-reply?</div><div>Can I intercept this REGISTER and 401 in kamailio.conf? Is there any examples?<br></div><div>I know about this instruction <a href="https://kamailio.org/docs/modules/5.7.x/modules/uac.html">https://kamailio.org/docs/modules/5.7.x/modules/uac.html</a> :)<br></div><div><br></div><div>Itried in request_route</div><div>xlog("L_NOTICE", "uac 114411 1 remote fU $fU user [$rU] on [$rd] via [$du] $Ri \n");<br>if (uac_reg_request_to("$fU", 0)) {<br>                xlog("L_NOTICE", "uac 114411 Found remote user [$rU] on [$rd] via [$du]\n");<br>                t_on_failure("REMOTE_AUTH");<br><br>                #t_relay();<br>        }</div><div><br></div><div>And failure_route<br></div><div>failure_route[REMOTE_AUTH] {<br>        if ($T_reply_code == 401 or $T_reply_code == 407) {<br>                xlog("L_NOTICE", "uac 114411 Remote asked for authentication\n");<br>                uac_auth();<br>        }<br>}</div><div><br></div><div>but I haven't got logs on register request, 401 reply.<br></div><div><br></div><div><br></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Best regards,</div><div class="gmail_signature" data-smartmail="gmail_signature">Alex</div><div class="gmail_signature" data-smartmail="gmail_signature"><br></div></div>