Hello,

thanks for the patch. Some remarks.

As you highlighted that the solution is not very efficient (due to no direct mapping between records and tcp connection), it should have a way to disable it (maybe via mod param for usrloc).

At this moment is hardcoded for 'location' table, but there can be other names used, since this value is given as parameter to save()/lookup(). It will have to iterate through all usrloc tables (called domains interanlly in the module).

Also, if I didn't get it wrong, it works only with in-memory records, if the usrloc is configured in db-only mode, it does not work with current patch, right?

I had in mind to implement such features, but using timer, to iterate through tcp connections and see if there is still an open connection for it. This will do delayed discovery, but I am not sure it will bring more benefits -- initially I thought is faster lookup done by a dedicated timer, presumly there are less tcp connections that usrloc records.

Anyhow, perhaps we should do some optimization here, we can store the connection id in usrloc structure and then match received address only if there is same conenction id. Or add received built from tcp connection close callback in a list that is used by usrloc expires timers.

Cheers,
Daniel

On 8/27/13 12:29 AM, Vitaliy Aleksandrov wrote:
Hello,

I've made a patch to kamailio-4.0.3 which removes stale registration when kamailio looses an incoming tcp connection.
Of course this patch needs more work.

Since the are no direct references between user location contacts and tcp connections callback function uses linear search through the whole location table using received field as a key.

Can anybody more experienced in kamailio internals check if I chose the right place to get information about lost tcp connections ?
Another thing I wanted to ask is maybe somebody can suggest a better way to tie a tcp connection to the user location information without complicating "usrloc" module by any heavy data structures.

If anybody else except me need this It would be great to fix known problems and add it to kamailio.


_______________________________________________
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

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Trainings - Berlin, Oct 21-24; Miami, Nov 11-13, 2013
  - more details about Kamailio trainings at http://www.asipto.com -