<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello,</p>
<p>the problem here is that the ACK has Route headers and looks like
the ACK inside dialog.</p>
<p>The 407 is for a re-INVITE, so the To-tag is present, it is not
generated by sl module to be able to filter it out. It gets to
config where the requests are routed using loose_route() like a
request part of a dialog.</p>
<p>I haven't checked the specs right not for a 100% accurate answer,
but ACK for a failure code is hop-by-hop, it should have no Route
headers, being intended for next hop only, and I expect most UA
implementation do it like this, not having similar reports in more
or less 20 years.</p>
<p>If the ACK will be without Route headers, it should be stopped
locally. You can try to play with the order of checks for
transaction and use of other tm functions to detect such case
(eventually combined with htable) and drop the ACK.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div class="moz-cite-prefix">On 07.05.20 17:10, Denys Pozniak wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CA+x3Axpm9e71e6sskkiyesEynu8Jk=xLBJcUEuCXu0sMCXJ_pg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hello!
<div><br>
</div>
<div>I have some misunderstanding regarding the processing of
SIP ACK on local Kamailio 4xx reply (eg 407 Proxy
Authentication Required).<br>
</div>
<div>In the picture below you can see that such a message just
goes through the proxy and moreover gets into the <b>request_route</b>
section.<br>
</div>
<div>I expect this SIP ACK to be consumed by the sl module
without hitting script logic.</div>
<div><br>
</div>
<div>
<div>
<div><br>
</div>
</div>
</div>
<div><br>
</div>
<div>I put the part below to the very top of the <b>request_route</b>
section:</div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><b>request_route</b> {</div>
<div><br>
</div>
<div>if ( is_method("ACK") ) {</div>
<div> t_check_trans();</div>
<div> $var(error) = $rc;</div>
<div> xlog("L_ERR", "[CATCH_ACK] m=$rm cseq=$cs ru=$ru
err=$var(error) [$ci]");</div>
<div>}</div>
<div>....</div>
</blockquote>
<div><br>
</div>
<div>And as a result, I detected in syslog:</div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>May 7 16:15:34 test-edge /usr/sbin/kamailio[11642]:
ERROR: <script>: [CATCH_ACK] m=ACK cseq=153 ru=<a
href="http://sip:mod_sofia@10.0.7.3:5060"
moz-do-not-send="true">sip:mod_sofia@10.0.7.3:5060</a>
err=-1 [051e7c50-0b10-1239-2996-001dd8b71cb2]</div>
</blockquote>
<div><br>
</div>
<div><b>SIP re-INVITE (hold) from Phone:</b><br>
</div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>2020/05/07 16:15:34.629973 <a
href="http://176.6.4.6:1024" moz-do-not-send="true">176.6.4.6:1024</a>
-> <a href="http://185.9.7.7:5060"
moz-do-not-send="true">185.9.7.7:5060</a></div>
<div>INVITE <a href="http://sip:mod_sofia@10.0.7.3:5060"
moz-do-not-send="true">sip:mod_sofia@10.0.7.3:5060</a>
SIP/2.0</div>
<div>Via: SIP/2.0/UDP
192.168.11.111:5060;branch=z9hG4bK00475de2da8eea118ec67caaaddc98fb;rport</div>
<div>Route: <a class="moz-txt-link-rfc2396E" href="sip:185.9.7.7;r2=on;lr=on;did=f98.f3f4"><sip:185.9.7.7;r2=on;lr=on;did=f98.f3f4></a></div>
<div>Route: <a class="moz-txt-link-rfc2396E" href="sip:10.0.7.5;r2=on;lr=on;did=f98.f3f4"><sip:10.0.7.5;r2=on;lr=on;did=f98.f3f4></a></div>
<div>Route: <a class="moz-txt-link-rfc2396E" href="sip:10.0.7.6;lr=on;did=f98.fbe"><sip:10.0.7.6;lr=on;did=f98.fbe></a></div>
<div>From: <<a href="mailto:sip%3A312222222222@10.0.7.6"
moz-do-not-send="true">sip:312222222222@10.0.7.6</a>>;tag=00dfd3d8da8eea118ec67caaaddc98fb</div>
<div>To: "Denys VOIP" <<a
href="mailto:sip%3A5008@185.9.7.7" moz-do-not-send="true">sip:5008@185.9.7.7</a>>;tag=54Q0XNHgXBUvp</div>
<div>Call-ID: 051e7c50-0b10-1239-2996-001dd8b71cb2</div>
<div>CSeq: 153 INVITE</div>
<div>Contact:
<a class="moz-txt-link-rfc2396E" href="sip:312222222222@192.168.11.111:5060;gr=00DCB21F-BD8E-EA11-8E88-7CAAADDC98FB"><sip:312222222222@192.168.11.111:5060;gr=00DCB21F-BD8E-EA11-8E88-7CAAADDC98FB></a></div>
<div>Content-Type: application/sdp</div>
<div>Allow: INVITE, ACK, BYE, CANCEL, INFO, MESSAGE, NOTIFY,
OPTIONS, REFER, UPDATE, PRACK</div>
<div>Max-Forwards: 70</div>
<div>Supported: 100rel, replaces, from-change, gruu</div>
<div>User-Agent: SIPPER for PhonerLite</div>
<div>Content-Length: 313</div>
</blockquote>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>v=0</div>
<div>o=- 3858283927 2 IN IP4 192.168.11.111</div>
<div>s=SIPPER for PhonerLite</div>
<div>c=IN IP4 192.168.11.111</div>
<div>t=0 0</div>
<div>m=audio 5062 RTP/AVP 8 0 9 107 101</div>
<div>a=rtpmap:8 PCMA/8000</div>
<div>a=rtpmap:0 PCMU/8000</div>
<div>a=rtpmap:9 G722/8000</div>
<div>a=rtpmap:107 opus/48000/2</div>
<div>a=rtpmap:101 telephone-event/8000</div>
<div>a=fmtp:101 0-16</div>
<div>a=ssrc:782125221</div>
<div>a=sendonly</div>
</blockquote>
<div><br>
<b>SIP 407 from Kamailio:</b><br>
<br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>2020/05/07 16:15:34.632298 <a
href="http://185.9.7.7:5060" moz-do-not-send="true">185.9.7.7:5060</a>
-> <a href="http://176.6.4.6:1024"
moz-do-not-send="true">176.6.4.6:1024</a></div>
<div>SIP/2.0 407 Proxy Authentication Required</div>
<div>Via: SIP/2.0/UDP
192.168.11.111:5060;branch=z9hG4bK00475de2da8eea118ec67caaaddc98fb;rport=1024;received=176.6.4.6</div>
<div>From: <<a href="mailto:sip%3A312222222222@10.0.7.6"
moz-do-not-send="true">sip:312222222222@10.0.7.6</a>>;tag=00dfd3d8da8eea118ec67caaaddc98fb</div>
<div>To: "Denys VOIP" <<a
href="mailto:sip%3A5008@185.9.7.7" moz-do-not-send="true">sip:5008@185.9.7.7</a>>;tag=54Q0XNHgXBUvp</div>
<div>Call-ID: 051e7c50-0b10-1239-2996-001dd8b71cb2</div>
<div>CSeq: 153 INVITE</div>
<div>Proxy-Authenticate: Digest realm="185.9.7.7",
nonce="XrQaXjfjyrftyrtiyrft7uO"</div>
<div>Server: kamailio (5.2.2 (x86_64/linux))</div>
<div>Content-Length: 0</div>
</blockquote>
<div><br>
<b>SIP ACK from Phone:</b></div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>2020/05/07 16:15:34.672872 <a
href="http://176.6.4.6:1024" moz-do-not-send="true">176.6.4.6:1024</a>
-> <a href="http://185.9.7.7:5060"
moz-do-not-send="true">185.9.7.7:5060</a></div>
<div>ACK <a href="http://sip:mod_sofia@10.0.7.3:5060"
moz-do-not-send="true">sip:mod_sofia@10.0.7.3:5060</a>
SIP/2.0</div>
<div>Via: SIP/2.0/UDP
192.168.11.111:5060;branch=z9hG4bK00475de2da8eea118ec67caaaddc98fb;rport</div>
<div>Route: <a class="moz-txt-link-rfc2396E" href="sip:185.9.7.7;r2=on;lr=on;did=f98.f3f4"><sip:185.9.7.7;r2=on;lr=on;did=f98.f3f4></a></div>
<div>Route: <a class="moz-txt-link-rfc2396E" href="sip:10.0.7.5;r2=on;lr=on;did=f98.f3f4"><sip:10.0.7.5;r2=on;lr=on;did=f98.f3f4></a></div>
<div>Route: <a class="moz-txt-link-rfc2396E" href="sip:10.0.7.6;lr=on;did=f98.fbe"><sip:10.0.7.6;lr=on;did=f98.fbe></a></div>
<div>From: <<a href="mailto:sip%3A312222222222@10.0.7.6"
moz-do-not-send="true">sip:312222222222@10.0.7.6</a>>;tag=00dfd3d8da8eea118ec67caaaddc98fb</div>
<div>To: "Denys VOIP" <<a
href="mailto:sip%3A5008@185.9.7.7" moz-do-not-send="true">sip:5008@185.9.7.7</a>>;tag=54Q0XNHgXBUvp</div>
<div>Call-ID: 051e7c50-0b10-1239-2996-001dd8b71cb2</div>
<div>CSeq: 153 ACK</div>
<div>Content-Length: 0</div>
</blockquote>
<div><br>
</div>
<div><b>SIP ACK (unwanted) from Kamailio to Core:</b></div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>2020/05/07 16:15:34.675546 <a
href="http://10.0.7.5:5060" moz-do-not-send="true">10.0.7.5:5060</a>
-> <a href="http://10.0.7.6:5060" moz-do-not-send="true">10.0.7.6:5060</a></div>
<div>ACK <a href="http://sip:mod_sofia@10.0.7.3:5060"
moz-do-not-send="true">sip:mod_sofia@10.0.7.3:5060</a>
SIP/2.0</div>
<div>Max-Forwards: 10</div>
<div>Via: SIP/2.0/UDP
10.0.7.5;branch=z9hG4bK0d46.c33c3556c3cffbac49e717352b3575f6.0</div>
<div>Via: SIP/2.0/UDP
192.168.11.111:5060;received=176.6.4.6;branch=z9hG4bK00475de2da8eea118ec67caaaddc98fb;rport=1024</div>
<div>Route: <a class="moz-txt-link-rfc2396E" href="sip:10.0.7.6;lr=on;did=f98.fbe"><sip:10.0.7.6;lr=on;did=f98.fbe></a></div>
<div>From: <<a href="mailto:sip%3A312222222222@10.0.7.6"
moz-do-not-send="true">sip:312222222222@10.0.7.6</a>>;tag=00dfd3d8da8eea118ec67caaaddc98fb</div>
<div>To: "Denys VOIP" <<a
href="mailto:sip%3A5008@185.9.7.7" moz-do-not-send="true">sip:5008@185.9.7.7</a>>;tag=54Q0XNHgXBUvp</div>
<div>Call-ID: 051e7c50-0b10-1239-2996-001dd8b71cb2</div>
<div>CSeq: 153 ACK</div>
<div>Content-Length: 0</div>
<div>loose-route: done</div>
</blockquote>
<div><br>
<b>IP addresses and call-flow:</b><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>Core (10.0.7.6) --> [ Kamailio (10.0.7.5) ->
Kamailio (185.9.7.7) ] --> Phone (176.6.4.6)</div>
</blockquote>
<div><br>
</div>
<div>[root@test-edge kamailio]$ kamailio -v<br>
version: kamailio 5.2.2 (x86_64/linux)<br>
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<br>
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144
MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB<br>
poll method support: poll, epoll_lt, epoll_et, sigio_rt,
select.<br>
id: unknown<br>
compiled on 19:29:40 Jun 20 2019 with gcc 4.8.5<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr"><br>
<div>
<div>BR,</div>
<div>Denys Pozniak<br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
</body>
</html>