Hello all!

I have event_route[websocket:closed] configured. By using $si, $sp variables and data from special hash table I can figure out information about account that was disconnected. I'm trying to use unregister function against but with no luck.

1. I'm creating variable which contains (as an example): "sip:100-test@127.0.0.1" string, where "100-test" is username.
2. lookup("location", "$var(user_uri)") - runs fine. I'm getting a match and lots of useful variables including $ruid are being set:
/usr/sbin/kamailio[27169]: DEBUG: registrar [lookup.c:256]: lookup_helper(): contact for [100-test] found by address

3. But unfortenately unregister with same variable does not work. unregister("location", "$var(user_uri)"):
DEBUG: <core> [core/parser/parse_uri.c:1282]: parse_uri(): bad uri,  state 0 parsed: <you@> (4) / <you@kamailio.org> (16)
ERROR: <core> [core/parser/parse_to.c:81]: parse_to_uri(): failed to parse To uri
ERROR: registrar [save.c:1040]: unregister(): failed to extract Address Of Record

I was trying to manipulate $var(user_uri) variable's content but could not make it work.

It's interesting that variant with $ruid - unregister("location", "", "$ruid") will work but unfortenately it works only with modparam("usrloc", "db_mode", 1):
ERROR: usrloc [urecord.c:655]: delete_urecord_by_ruid(): delete_urecord_by_ruid currently available only in db_mode=3

I was wonderring if someone could tell me if I'm just using unregister function with uri parameter in wrong format or there might be some other problem.

Thanks a lot!