[sr-dev] db version of nat pinger

Juha Heinanen jh at tutpro.com
Sat Sep 15 18:29:01 CEST 2012

Juha Heinanen writes:

> thanks for your reply.  the above proposal sounds very promising
> indeed. regarding socket, it could be a module param that can be set on
> the dispatcher host to override socket value in location table.


in fact, nathelper already has natping_socket param that can be used to
force dispatcher socket.

i tried to make dispatcher generate nat pings by setting usrloc and
nathelper params as follows:

# -- usrlog params
modparam("usrloc", "db_url", "mysql://foo:bar@")
modparam("usrloc", "use_domain", 1)
modparam("usrloc", "db_mode", 3)
modparam("usrloc", "timer_interval", 0)
modparam("usrloc", "nat_bflag", 1)

# -- nathelper params
modparam("nathelper", "natping_interval", 20)
modparam("nathelper", "ping_nated_only", 0)
modparam("nathelper", "natping_socket", "")

then i registered one sip phone over udp and checked that its contact
exists in ser/location table in db pointed by db_url param.  the result
was that there was no sign of udp ping packets.

i added some debugging to nathelper/nathelper.c and saw that nathelper
makes once per second call:

	rval = ul.get_all_ucontacts(buf, cblen, (ping_nated_only?ul.nat_flag:0),
		((unsigned int)(unsigned long)timer_idx)*natping_interval+iteration,

but does not get any records back.

i then turned on mysql debug on mysql server and found that after initial
connects to db, dispatcher is not sending any requests to db.  so there
is no way that i could return something to nathelper.

could it be that in db_mode=3, ul.get_all_ucontacts does not work at
all?  any other ideas?

-- juha

More information about the sr-dev mailing list