Hello!
I have some misunderstanding regarding the processing of SIP ACK on local
Kamailio 4xx reply (eg 407 Proxy Authentication Required).
In the picture below you can see that such a message just goes through the
proxy and moreover gets into the *request_route* section.
I expect this SIP ACK to be consumed by the sl module without hitting
script logic.
[image: image.png]
I put the part below to the very top of the *request_route* section:
*request_route* {
if ( is_method("ACK") ) {
t_check_trans();
$var(error) = $rc;
xlog("L_ERR", "[CATCH_ACK] m=$rm cseq=$cs ru=$ru err=$var(error)
[$ci]");
}
....
And as a result, I detected in syslog:
May 7 16:15:34 test-edge /usr/sbin/kamailio[11642]: ERROR: <script>:
[CATCH_ACK] m=ACK cseq=153 ru=sip:mod_sofia@10.0.7.3:5060 err=-1
[051e7c50-0b10-1239-2996-001dd8b71cb2]
*SIP re-INVITE (hold) from Phone:*
2020/05/07 16:15:34.629973 176.6.4.6:1024 -> 185.9.7.7:5060
INVITE sip:mod_sofia@10.0.7.3:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.11.111:5060
;branch=z9hG4bK00475de2da8eea118ec67caaaddc98fb;rport
Route: <sip:185.9.7.7;r2=on;lr=on;did=f98.f3f4>
Route: <sip:10.0.7.5;r2=on;lr=on;did=f98.f3f4>
Route: <sip:10.0.7.6;lr=on;did=f98.fbe>
From: <sip:312222222222@10.0.7.6>;tag=00dfd3d8da8eea118ec67caaaddc98fb
To: "Denys VOIP" <sip:5008@185.9.7.7>;tag=54Q0XNHgXBUvp
Call-ID: 051e7c50-0b10-1239-2996-001dd8b71cb2
CSeq: 153 INVITE
Contact: <sip:312222222222@192.168.11.111:5060
;gr=00DCB21F-BD8E-EA11-8E88-7CAAADDC98FB>
Content-Type: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, INFO, MESSAGE, NOTIFY, OPTIONS, REFER,
UPDATE, PRACK
Max-Forwards: 70
Supported: 100rel, replaces, from-change, gruu
User-Agent: SIPPER for PhonerLite
Content-Length: 313
v=0
o=- 3858283927 2 IN IP4 192.168.11.111
s=SIPPER for PhonerLite
c=IN IP4 192.168.11.111
t=0 0
m=audio 5062 RTP/AVP 8 0 9 107 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:9 G722/8000
a=rtpmap:107 opus/48000/2
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ssrc:782125221
a=sendonly
*SIP 407 from Kamailio:*
2020/05/07 16:15:34.632298 185.9.7.7:5060 -> 176.6.4.6:1024
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 192.168.11.111:5060
;branch=z9hG4bK00475de2da8eea118ec67caaaddc98fb;rport=1024;received=176.6.4.6
From: <sip:312222222222@10.0.7.6>;tag=00dfd3d8da8eea118ec67caaaddc98fb
To: "Denys VOIP" <sip:5008@185.9.7.7>;tag=54Q0XNHgXBUvp
Call-ID: 051e7c50-0b10-1239-2996-001dd8b71cb2
CSeq: 153 INVITE
Proxy-Authenticate: Digest realm="185.9.7.7",
nonce="XrQaXjfjyrftyrtiyrft7uO"
Server: kamailio (5.2.2 (x86_64/linux))
Content-Length: 0
*SIP ACK from Phone:*
2020/05/07 16:15:34.672872 176.6.4.6:1024 -> 185.9.7.7:5060
ACK sip:mod_sofia@10.0.7.3:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.11.111:5060
;branch=z9hG4bK00475de2da8eea118ec67caaaddc98fb;rport
Route: <sip:185.9.7.7;r2=on;lr=on;did=f98.f3f4>
Route: <sip:10.0.7.5;r2=on;lr=on;did=f98.f3f4>
Route: <sip:10.0.7.6;lr=on;did=f98.fbe>
From: <sip:312222222222@10.0.7.6>;tag=00dfd3d8da8eea118ec67caaaddc98fb
To: "Denys VOIP" <sip:5008@185.9.7.7>;tag=54Q0XNHgXBUvp
Call-ID: 051e7c50-0b10-1239-2996-001dd8b71cb2
CSeq: 153 ACK
Content-Length: 0
*SIP ACK (unwanted) from Kamailio to Core:*
2020/05/07 16:15:34.675546 10.0.7.5:5060 -> 10.0.7.6:5060
ACK sip:mod_sofia@10.0.7.3:5060 SIP/2.0
Max-Forwards: 10
Via: SIP/2.0/UDP
10.0.7.5;branch=z9hG4bK0d46.c33c3556c3cffbac49e717352b3575f6.0
Via: SIP/2.0/UDP 192.168.11.111:5060
;received=176.6.4.6;branch=z9hG4bK00475de2da8eea118ec67caaaddc98fb;rport=1024
Route: <sip:10.0.7.6;lr=on;did=f98.fbe>
From: <sip:312222222222@10.0.7.6>;tag=00dfd3d8da8eea118ec67caaaddc98fb
To: "Denys VOIP" <sip:5008@185.9.7.7>;tag=54Q0XNHgXBUvp
Call-ID: 051e7c50-0b10-1239-2996-001dd8b71cb2
CSeq: 153 ACK
Content-Length: 0
loose-route: done
*IP addresses and call-flow:*
Core (10.0.7.6) --> [ Kamailio (10.0.7.5) -> Kamailio (185.9.7.7) ] -->
Phone (176.6.4.6)
[root@test-edge kamailio]$ kamailio -v
version: kamailio 5.2.2 (x86_64/linux)
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
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 on 19:29:40 Jun 20 2019 with gcc 4.8.5
--
BR,
Denys Pozniak