Hello,


On 18.10.18 15:23, Володимир Іванець wrote:
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)

the variable seems to have only username@domain, not sip:username@domain (which is a valid sip uri). Try with:

unregister("location", "sip:$var(user_uri)")

Cheers,
Daniel

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!


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference -- www.kamailioworld.com
Kamailio Advanced Training, Nov 12-14, 2018, in Berlin -- www.asipto.com