Hi,
I am hitting bit of a wall here.
- I am setting bflags for NAT, and SIPPING before save("location") however, when I do "kamctl ul show", the Cflag is 0.
I also checked see if the bflags are set or not in the register routine - they are being set.
What am I missing?
snippets of the config files.
#!define FLB_NATB 6 #!define FLB_NATSIPPING 7 modparam("nathelper", "natping_interval", 30) modparam("nathelper", "ping_nated_only", 1) modparam("nathelper", "sipping_bflag", FLB_NATSIPPING) modparam("nathelper", "sipping_method", "INFO") modparam("nathelper", "sipping_from", "sip:pinger@50.62.1.7")
# params needed for NAT traversal in other modules modparam("nathelper|registrar|usrloc", "received_avp", "$avp(RECEIVED)") modparam("usrloc", "nat_bflag", FLB_NATB)
# Caller NAT detection route route[NAT] { #!ifdef WITH_NAT force_rport(); if (nat_uac_test("19")) { if (method=="REGISTER") { fix_nated_register(); } else { fix_nated_contact(); } setflag(FLT_NATS); setbflag(FLB_NATB); } #!endif return; }
# Handle SIP registrations route[REGISTRAR] { if (is_method("REGISTER")) { xlog("L_ALERT", "REGISTER: From $fU, $fd To $tU, $td"); if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) { setbflag(FLB_NATB); # uncomment next line to do SIP NAT pinging setbflag(FLB_NATSIPPING); } # 7/28/11 - make sure only one contact location is active # at any given time # unregister("location", "$rU"); if (isbflagset(FLB_NATB)) { xlog("L_ALERT", "REGISTRAR: For $fU, $fd FLB_NATB set"); }
if (isbflagset(FLB_NATSIPPING)) { xlog("L_ALERT", "REGISTRAR: For $fU, $fd FLB_NATSIPPING set"); }
if (!save("location")) { xlog("L_ALERT", "REGISTRAR: From $fU, $fd Location could not be saved"); sl_reply_error(); }
exit; } }
The debug log snippets ================== Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTER: From p_krishna_test_com, 50.62.1.7 To p_krishna_test_com, 50.62.1.7 Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTRAR: For p_krishna_test_com, 50.62.1.7 FLB_NATB set Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTRAR: For p_krishna_test_com, 50.62.1.7 FLB_NATSIPPING set Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: DEBUG: sl [sl.c:278]: reply in stateless mode (sl)
Output of kamctl command ==================== $ sudo kamctl ul show Domain:: location table=512 records=1 max_slot=1 AOR:: p_krishna_test_com Contact:: sip:p_krishna_test_com@75.62.17.45:50073;transport=tcp;ob Q= Expires:: 287 Callid:: ad2d3a7bf39a4345861db1661576a7f3 Cseq:: 54856 User-agent:: QliqDesktop 1.0.0 (pjproject 1.10.0/win32) State:: CS_NEW Flags:: 0 Cflag:: 0 <================= Cflag is not being set. Socket:: tcp:10.1.0.6:5060 Methods:: 8143
Thanks Krish Kura
I looked at the source code. Updating cflags seems straight forward. I even did upgrade of the kamailio to latest. The behavior is the same with the upgraded -the cflags in userlocation are not getting updated. Also, the received column is not being set either.
Domain:: location table=512 records=1 max_slot=1 AOR:: p_krishna_test_com Contact:: sip:p_krishna_test_com@75.62.17.45:55763;transport=tcp;ob Q= Expires:: 23 Callid:: 2f34414ed33149cb9ec750d98f311525 Cseq:: 40154 User-agent:: QliqDesktop 1.0.0 (pjproject 1.10.0/win32) State:: CS_SYNC Flags:: 0 Cflag:: 0 Socket:: tcp:10.1.0.6:5060 Methods:: 8143
My kamailio version is nightly build from yesterday
$kamailio -V version: kamailio 3.2.0-pre3 (x86_64/linux) flags: STATS: Off, USE_IPV6, USE_TCP, USE_TLS, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, DBG_QM_MALLOC, 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_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 4MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: unknown compiled on 04:45:31 Oct 2 2011 with gcc 4.4.3
On Sat, Oct 1, 2011 at 6:21 PM, Krishna Kurapati kkurapat@gmail.com wrote:
Hi,
I am hitting bit of a wall here.
- I am setting bflags for NAT, and SIPPING before save("location")
however, when I do "kamctl ul show", the Cflag is 0.
I also checked see if the bflags are set or not in the register routine - they are being set.
What am I missing?
snippets of the config files.
#!define FLB_NATB 6 #!define FLB_NATSIPPING 7 modparam("nathelper", "natping_interval", 30) modparam("nathelper", "ping_nated_only", 1) modparam("nathelper", "sipping_bflag", FLB_NATSIPPING) modparam("nathelper", "sipping_method", "INFO") modparam("nathelper", "sipping_from", "sip:pinger@50.62.1.7")
# params needed for NAT traversal in other modules modparam("nathelper|registrar|usrloc", "received_avp", "$avp(RECEIVED)") modparam("usrloc", "nat_bflag", FLB_NATB)
# Caller NAT detection route route[NAT] { #!ifdef WITH_NAT force_rport(); if (nat_uac_test("19")) { if (method=="REGISTER") { fix_nated_register(); } else { fix_nated_contact(); } setflag(FLT_NATS); setbflag(FLB_NATB); } #!endif return; }
# Handle SIP registrations route[REGISTRAR] { if (is_method("REGISTER")) { xlog("L_ALERT", "REGISTER: From $fU, $fd To $tU, $td"); if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) { setbflag(FLB_NATB); # uncomment next line to do SIP NAT pinging setbflag(FLB_NATSIPPING); } # 7/28/11 - make sure only one contact location is active # at any given time # unregister("location", "$rU"); if (isbflagset(FLB_NATB)) { xlog("L_ALERT", "REGISTRAR: For $fU, $fd FLB_NATB set"); }
if (isbflagset(FLB_NATSIPPING)) { xlog("L_ALERT", "REGISTRAR: For $fU, $fd
FLB_NATSIPPING set"); }
if (!save("location")) { xlog("L_ALERT", "REGISTRAR: From $fU, $fd Location
could not be saved"); sl_reply_error(); }
exit; }
}
The debug log snippets
Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTER: From p_krishna_test_com, 50.62.1.7 To p_krishna_test_com, 50.62.1.7 Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTRAR: For p_krishna_test_com, 50.62.1.7 FLB_NATB set Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTRAR: For p_krishna_test_com, 50.62.1.7 FLB_NATSIPPING set Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: DEBUG: sl [sl.c:278]: reply in stateless mode (sl)
Output of kamctl command
$ sudo kamctl ul show Domain:: location table=512 records=1 max_slot=1 AOR:: p_krishna_test_com Contact:: sip:p_krishna_test_com@75.62.17.45:50073;transport=tcp;ob Q= Expires:: 287 Callid:: ad2d3a7bf39a4345861db1661576a7f3 Cseq:: 54856 User-agent:: QliqDesktop 1.0.0 (pjproject 1.10.0/win32) State:: CS_NEW Flags:: 0 Cflag:: 0 <================= Cflag is not being set. Socket:: tcp:10.1.0.6:5060 Methods:: 8143
Thanks Krish Kura
Finally, I figured what is going on. The client is the culprit. I am using pjsip library which by default is configured to rewrite the Contact Header when it detects a change in IP address in response. It is basically Unregistering the Private address contact and Registering the public IP contact. This is erasing the Cflags recorded before.
Krish Kura
On Sat, Oct 1, 2011 at 6:21 PM, Krishna Kurapati kkurapat@gmail.com wrote:
Hi,
I am hitting bit of a wall here.
- I am setting bflags for NAT, and SIPPING before save("location")
however, when I do "kamctl ul show", the Cflag is 0.
I also checked see if the bflags are set or not in the register routine - they are being set.
What am I missing?
snippets of the config files.
#!define FLB_NATB 6 #!define FLB_NATSIPPING 7 modparam("nathelper", "natping_interval", 30) modparam("nathelper", "ping_nated_only", 1) modparam("nathelper", "sipping_bflag", FLB_NATSIPPING) modparam("nathelper", "sipping_method", "INFO") modparam("nathelper", "sipping_from", "sip:pinger@50.62.1.7")
# params needed for NAT traversal in other modules modparam("nathelper|registrar|usrloc", "received_avp", "$avp(RECEIVED)") modparam("usrloc", "nat_bflag", FLB_NATB)
# Caller NAT detection route route[NAT] { #!ifdef WITH_NAT force_rport(); if (nat_uac_test("19")) { if (method=="REGISTER") { fix_nated_register(); } else { fix_nated_contact(); } setflag(FLT_NATS); setbflag(FLB_NATB); } #!endif return; }
# Handle SIP registrations route[REGISTRAR] { if (is_method("REGISTER")) { xlog("L_ALERT", "REGISTER: From $fU, $fd To $tU, $td"); if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) { setbflag(FLB_NATB); # uncomment next line to do SIP NAT pinging setbflag(FLB_NATSIPPING); } # 7/28/11 - make sure only one contact location is active # at any given time # unregister("location", "$rU"); if (isbflagset(FLB_NATB)) { xlog("L_ALERT", "REGISTRAR: For $fU, $fd FLB_NATB set"); }
if (isbflagset(FLB_NATSIPPING)) { xlog("L_ALERT", "REGISTRAR: For $fU, $fd
FLB_NATSIPPING set"); }
if (!save("location")) { xlog("L_ALERT", "REGISTRAR: From $fU, $fd Location
could not be saved"); sl_reply_error(); }
exit; }
}
The debug log snippets
Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTER: From p_krishna_test_com, 50.62.1.7 To p_krishna_test_com, 50.62.1.7 Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTRAR: For p_krishna_test_com, 50.62.1.7 FLB_NATB set Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTRAR: For p_krishna_test_com, 50.62.1.7 FLB_NATSIPPING set Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: DEBUG: sl [sl.c:278]: reply in stateless mode (sl)
Output of kamctl command
$ sudo kamctl ul show Domain:: location table=512 records=1 max_slot=1 AOR:: p_krishna_test_com Contact:: sip:p_krishna_test_com@75.62.17.45:50073;transport=tcp;ob Q= Expires:: 287 Callid:: ad2d3a7bf39a4345861db1661576a7f3 Cseq:: 54856 User-agent:: QliqDesktop 1.0.0 (pjproject 1.10.0/win32) State:: CS_NEW Flags:: 0 Cflag:: 0 <================= Cflag is not being set. Socket:: tcp:10.1.0.6:5060 Methods:: 8143
Thanks Krish Kura
Looks like sipping does not work with TCP transport. I looked at the code it expects the client waits on UDP port.
code snippet from nathelper.c
if (curi.proto != PROTO_UDP && curi.proto != PROTO_NONE) continue;
I would like it to use TCP transport and send the packet to the client on the same socket that the client has connected to server with.
Any suggestions on how to do this?
Thanks Krish Kura
On Sat, Oct 1, 2011 at 6:21 PM, Krishna Kurapati kkurapat@gmail.com wrote:
Hi,
I am hitting bit of a wall here.
- I am setting bflags for NAT, and SIPPING before save("location")
however, when I do "kamctl ul show", the Cflag is 0.
I also checked see if the bflags are set or not in the register routine - they are being set.
What am I missing?
snippets of the config files.
#!define FLB_NATB 6 #!define FLB_NATSIPPING 7 modparam("nathelper", "natping_interval", 30) modparam("nathelper", "ping_nated_only", 1) modparam("nathelper", "sipping_bflag", FLB_NATSIPPING) modparam("nathelper", "sipping_method", "INFO") modparam("nathelper", "sipping_from", "sip:pinger@50.62.1.7")
# params needed for NAT traversal in other modules modparam("nathelper|registrar|usrloc", "received_avp", "$avp(RECEIVED)") modparam("usrloc", "nat_bflag", FLB_NATB)
# Caller NAT detection route route[NAT] { #!ifdef WITH_NAT force_rport(); if (nat_uac_test("19")) { if (method=="REGISTER") { fix_nated_register(); } else { fix_nated_contact(); } setflag(FLT_NATS); setbflag(FLB_NATB); } #!endif return; }
# Handle SIP registrations route[REGISTRAR] { if (is_method("REGISTER")) { xlog("L_ALERT", "REGISTER: From $fU, $fd To $tU, $td"); if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) { setbflag(FLB_NATB); # uncomment next line to do SIP NAT pinging setbflag(FLB_NATSIPPING); } # 7/28/11 - make sure only one contact location is active # at any given time # unregister("location", "$rU"); if (isbflagset(FLB_NATB)) { xlog("L_ALERT", "REGISTRAR: For $fU, $fd FLB_NATB set"); }
if (isbflagset(FLB_NATSIPPING)) { xlog("L_ALERT", "REGISTRAR: For $fU, $fd
FLB_NATSIPPING set"); }
if (!save("location")) { xlog("L_ALERT", "REGISTRAR: From $fU, $fd Location
could not be saved"); sl_reply_error(); }
exit; }
}
The debug log snippets
Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTER: From p_krishna_test_com, 50.62.1.7 To p_krishna_test_com, 50.62.1.7 Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTRAR: For p_krishna_test_com, 50.62.1.7 FLB_NATB set Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: ALERT: <script>: REGISTRAR: For p_krishna_test_com, 50.62.1.7 FLB_NATSIPPING set Oct 1 15:58:30 siptest /usr/sbin/kamailio[19515]: DEBUG: sl [sl.c:278]: reply in stateless mode (sl)
Output of kamctl command
$ sudo kamctl ul show Domain:: location table=512 records=1 max_slot=1 AOR:: p_krishna_test_com Contact:: sip:p_krishna_test_com@75.62.17.45:50073;transport=tcp;ob Q= Expires:: 287 Callid:: ad2d3a7bf39a4345861db1661576a7f3 Cseq:: 54856 User-agent:: QliqDesktop 1.0.0 (pjproject 1.10.0/win32) State:: CS_NEW Flags:: 0 Cflag:: 0 <================= Cflag is not being set. Socket:: tcp:10.1.0.6:5060 Methods:: 8143
Thanks Krish Kura