Thanks Daniel for your usual help, it is really appreciated !
I've inserted the following block on the failure route:
if (t_check_status("401|407")) {
xlog("L_INFO","failure_route(ROUTEFAIL) @@ call to uac_auth()\n");
uac_auth();
t_relay();
exit;
}
Logs show:
Sep 26 15:29:08 kamailio /usr/sbin/kamailio[108044]: INFO: <script>: failure_route(ROUTEFAIL) @@ call to uac_auth()
Sep 26 15:29:08 kamailio /usr/sbin/kamailio[108044]: ERROR: tm [t_fwd.c:1723]: t_forward_nonack(): no branches for forwarding
Sep 26 15:29:08 kamailio /usr/sbin/kamailio[108044]: ERROR: tm [tm.c:1433]: _w_t_relay_to(): t_forward_noack failed
Here is the 401 received - to me, there is the challenge:
2017/09/26 15:32:16.410800 pro.vid.er.ip:5060 -> my.kam.ailio.ip:5060
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP my.kam.ailio.ip;branch=z9hG4bK2edf.049073b8bcb252b5f7b5e6fffcd8b498.0;received= my.kam.ailio.ip;rport=5060
Via: SIP/2.0/UDP 46.105.145.36:5060;branch=z9hG4bK53167350
To: <sip:100622222222@ my.kam.ailio.ip>;tag=as61ddd570
Call-ID: 242842785528c07b7fd56dc660b8c377@my.asterisk.ip:5060
CSeq: 102 INVITE
Server: OpenVoice-8
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces
Content-Length: 0