I have Kamailio in a local network with RTPPROXY and NAT MANAGE
I have seen an issue with ACK as show when Asterisk sends ACK to Kamailio, it sends to advertised Address instead to Kamailio IP address.
What could i add to solve this?
route[WITHINDLG] {
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
if (is_method("BYE")) {
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the transaction fails
dlg_manage();
}
if ( is_method("ACK") ) {
# ACK is forwarded statelessy
route(NATMANAGE);
}
route(RELAY);
} else {
if (is_method("SUBSCRIBE") && uri == myself) {
# in-dialog subscribe requests
route(PRESENCE);
exit;
}
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# no loose-route, but stateful ACK;
# must be an ACK after a 487
# or e.g. 404 from upstream server
t_relay();
exit;
} else {
# ACK without matching transaction ... ignore and discard
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}
}
BR
Alberto,
On 07/28/2015 06:22 AM, Alberto Sagredo wrote:
I have seen an issue with ACK as show when Asterisk sends ACK to Kamailio, it sends to advertised Address instead to Kamailio IP address.
When you say "advertised address", do you mean the value of the advertised_address core configuration parameter in Kamailio, or do you mean the source IP address that detects Kamailio SIP messages to be coming from? If so, is there a layer of NAT involved between Kamailio and Asterisk? Is Asterisk not on the same network as Kamailio?
Hi Alex. Both Kamailio and Asterisk are in same network.
Asterisk and Kamailio are behind NAT
Im working with record route.. to see if i solve this
if (is_method("INVITE") && is_ip_rfc1918("$si")) {
record_route_preset("192.168.0.170:8002;nat=no");
xlog("L_INFO", "Source IP : $si \n");
}
if (is_method("INVITE|SUBSCRIBE") && !is_ip_rfc1918("$si") ){
xlog("L_INFO", "Source IP : $si \n");
record_route();
}
Any other recommendation is well appreciated
BR
2015-07-29 9:10 GMT+02:00 Alex Balashov abalashov@evaristesys.com:
Alberto,
On 07/28/2015 06:22 AM, Alberto Sagredo wrote:
I have seen an issue with ACK as show when Asterisk sends ACK to
Kamailio, it sends to advertised Address instead to Kamailio IP address.
When you say "advertised address", do you mean the value of the advertised_address core configuration parameter in Kamailio, or do you mean the source IP address that detects Kamailio SIP messages to be coming from? If so, is there a layer of NAT involved between Kamailio and Asterisk? Is Asterisk not on the same network as Kamailio?
-- Alex Balashov | Principal | Evariste Systems LLC 303 Perimeter Center North, Suite 300 Atlanta, GA 30346 United States
Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Alberto,
1. What are the literal (natively homed) IP addresses of Asterisk and Kamailio?
2. What is the Request Line (first line) of the ACK request being sent from Asterisk, i.e.
ACK sip:... SIP/2.0
3. To what IP and port is the ACK being sent by Asterisk?
Hi Alex
1.- Kamailio -> 172.26.101.50:8002 (Floating IP)
Asterisk -> 172.26.101.10:5080
2.- Transmitting (no NAT) to 192.168.0.170:8002:
ACK sip:110@IP_PUBLIC_IP:5066 SIP/2.0
Via: SIP/2.0/UDP 172.26.101.10:5080;branch=z9hG4bK0a330ae6
Route: sip:192.168.0.170:8002;nat=no;ftag=as14d7523e;lr=on
Max-Forwards: 70
From: "asterisk" sip:110@172.26.101.10:5080;tag=as14d7523e
To: sip:110@172.26.101.50:8002;tag=1749303708
Contact: sip:110@172.26.101.10:5080
Call-ID: 7e723f1c64086e964df79e493350a2a4@172.26.101.10:5080
CSeq: 102 ACK
User-Agent: ast01
Content-Length: 0
With code i posted before i have now issue to answer calls from ast (generated by asterisk)
200 From Phone arrives fine to Kamailio
<--- SIP read from UDP:172.26.101.50:8002 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.26.101.10:5080;rport=5080;branch=z9hG4bK125b3b98
Record-Route: sip:192.168.0.170:8002;nat=no;ftag=as14d7523e;lr=on
From: "asterisk" sip:110@172.26.101.10:5080;tag=as14d7523e
To: sip:110@172.26.101.50:8002;tag=1749303708
Call-ID: 7e723f1c64086e964df79e493350a2a4@172.26.101.10:5080
CSeq: 102 INVITE
Contact: sip:110@PUBLIC.IP:5066
Supported: replaces, path, timer, eventlist
User-Agent: Grandstream GXV3275 1.0.3.37
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Type: application/sdp
Content-Length: 255
v=0
o=110 8003 8000 IN IP4 172.26.101.41
s=SIP Call
c=IN IP4 172.26.101.41
t=0 0
m=audio 8424 RTP/AVP 0 8 101
a=sendrecv
a=rtpmap:0 PCMU/8000
a=ptime:20
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sdp_proxied:yes
<------------->
I see 200 OK sent to Asterisk
Asterisk sent to me ACK but Kamailio seems to do not send to Phone behind nat
3.- 192.168.0.170:8002
Thanks
2015-07-29 9:18 GMT+02:00 Alex Balashov abalashov@evaristesys.com:
Alberto,
- What are the literal (natively homed) IP addresses of Asterisk and
Kamailio?
- What is the Request Line (first line) of the ACK request being sent
from Asterisk, i.e.
ACK sip:... SIP/2.0
- To what IP and port is the ACK being sent by Asterisk?
-- Alex Balashov | Principal | Evariste Systems LLC 303 Perimeter Center North, Suite 300 Atlanta, GA 30346 United States
Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Alberto,
Based on the 200 OK you included, the end-to-end ACK from Asterisk to Kamailio would be expected to go to 192.168.0.170:8002 and to have a request URI of
sip:110@PUBLIC.IP:5066
This is precisely where Kamailio will try to send the ACK. Does sending it to PUBLIC.IP:5066 not cause it to reach the phone?
-- Alex
Umm Alex
I see ACK sent to Kamailio from Asterisk, but not seen it send again.
Will take some more traces. and let you know back
Could be Kamailio discarding this ACK In anyway?
2015-07-29 9:40 GMT+02:00 Alex Balashov abalashov@evaristesys.com:
Alberto,
Based on the 200 OK you included, the end-to-end ACK from Asterisk to Kamailio would be expected to go to 192.168.0.170:8002 and to have a request URI of
sip:110@PUBLIC.IP:5066
This is precisely where Kamailio will try to send the ACK. Does sending it to PUBLIC.IP:5066 not cause it to reach the phone?
-- Alex
-- Alex Balashov | Principal | Evariste Systems LLC 303 Perimeter Center North, Suite 300 Atlanta, GA 30346 United States
Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 07/29/2015 03:44 AM, Alberto Sagredo wrote:
Could be Kamailio discarding this ACK In anyway?
It's possible, but have you made absolute sure that it's not trying to send it to PUBLIC_IP:5066?
Yes Alex.
I see ACK sent to 192.168.0.170:8002 from Asterisk as follows:
set_destination: Parsing sip:192.168.0.170:8002;nat=no;ftag=as2e5fc0a0;lr=on for address/port to send to
set_destination: set destination to 192.168.0.170:8002
Transmitting (no NAT) to 192.168.0.170:8002:
ACK sip:110@PUBLIC.IP:5066 SIP/2.0
Via: SIP/2.0/UDP 172.26.101.10:5080;branch=z9hG4bK1ea10df7
Route: sip:192.168.0.170:8002;nat=no;ftag=as2e5fc0a0;lr=on
Max-Forwards: 70
From: "asterisk" sip:110@172.26.101.10:5080;tag=as2e5fc0a0
To: sip:110@172.26.101.50:8002;tag=1581756788
Contact: sip:110@172.26.101.10:5080
Call-ID: 394e67ee58605adc1986c1276312c686@172.26.101.10:5080
CSeq: 102 ACK
User-Agent: ast01
Content-Length: 0
And no ACK to Public IP Sent, so it dies at 32 secs without beeing answered insted of answered call (No ACK for 200 OK issue) as expected
2015-07-29 9:44 GMT+02:00 Alex Balashov abalashov@evaristesys.com:
On 07/29/2015 03:44 AM, Alberto Sagredo wrote:
Could be Kamailio discarding this ACK In anyway?
It's possible, but have you made absolute sure that it's not trying to send it to PUBLIC_IP:5066?
-- Alex Balashov | Principal | Evariste Systems LLC 303 Perimeter Center North, Suite 300 Atlanta, GA 30346 United States
Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
If you take a raw capture on the Kamailio box:
tcpdump -i any -A -s 0 -n udp port 8002 and host PUBLIC_IP
Does it not show Kamailio attempting to relay it there?
No. ACK seems to do not arrive to Kamailio
I will review some things and let you know back.
2015-07-29 9:52 GMT+02:00 Alex Balashov abalashov@evaristesys.com:
If you take a raw capture on the Kamailio box:
tcpdump -i any -A -s 0 -n udp port 8002 and host PUBLIC_IP
Does it not show Kamailio attempting to relay it there?
-- Alex Balashov | Principal | Evariste Systems LLC 303 Perimeter Center North, Suite 300 Atlanta, GA 30346 United States
Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 07/29/2015 04:19 AM, Alberto Sagredo wrote:
No. ACK seems to do not arrive to Kamailio
The 'tcpdump' filter I gave you won't show you that. It was designed specifically to capture packet flow between Kamailio and the phone.
To see whether it arrives at Kamailio, you'll need to liberalise the parameters:
tcpdump -i any -A -s 0 -n udp port 8002
Yes
i made a tcpdump..
as packet is with 172.26.x.x and arrives to 192.168.0.170, seems to discard
08:14:30.154820 IP 172.26.101.10.5080 > 192.168.0.170.8002: UDP, length 456
E...v...@./...e
.......B..v.ACK sip:110@PUBLIC IP:5066 SIP/2.0
Via: SIP/2.0/UDP 172.26.101.10:5080;branch=z9hG4bK6f81f8cd
Route: sip:192.168.0.170:8002;nat=no;ftag=as346dc29d;lr=on
Max-Forwards: 70
From: "asterisk" sip:110@172.26.101.10:5080;tag=as346dc29d
To: sip:110@172.26.101.50:8002;tag=608896762
Contact: sip:110@172.26.101.10:5080
Call-ID: 0a0d09e612cf4f9401698baf112dc644@172.26.101.10:5080
CSeq: 102 ACK
User-Agent: ast01
Content-Length: 0
Network issue as i see here :/.
2015-07-29 10:20 GMT+02:00 Alex Balashov abalashov@evaristesys.com:
On 07/29/2015 04:19 AM, Alberto Sagredo wrote:
No. ACK seems to do not arrive to Kamailio
The 'tcpdump' filter I gave you won't show you that. It was designed specifically to capture packet flow between Kamailio and the phone.
To see whether it arrives at Kamailio, you'll need to liberalise the parameters:
tcpdump -i any -A -s 0 -n udp port 8002
-- Alex Balashov | Principal | Evariste Systems LLC 303 Perimeter Center North, Suite 300 Atlanta, GA 30346 United States
Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Is it possible you have a default OS 'iptables' configuration that is blocking receipt of the packet by Kamailio at the application layer?
Please check/feel free to send the output of: iptables -L -n
Thanks Alex. Finally i made two kamailio.cfg depending on which case, behind NAT or not, and advertise address to local when no NAT.
Will look for a clean solution later
Thanks for your attention
2015-07-29 10:25 GMT+02:00 Alex Balashov abalashov@evaristesys.com:
Is it possible you have a default OS 'iptables' configuration that is blocking receipt of the packet by Kamailio at the application layer?
Please check/feel free to send the output of: iptables -L -n
-- Alex Balashov | Principal | Evariste Systems LLC 303 Perimeter Center North, Suite 300 Atlanta, GA 30346 United States
Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users