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(a)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