Hello Datiel,

Just tested and it works. Thank you very much!

пт, 19 жовт. 2018 о 09:50 Daniel-Constantin Mierla <miconda@gmail.com> пише:

Hello,

can you try with latest version from branch 5.1 or master? The event route is using a faked message and its From/To headers were without sip schema. I pushed a commit to fix that.

Cheers,
Daniel


On 18.10.18 19:24, Володимир Іванець wrote:
Hello Daniel!

Thank you for the responce. It has "sip:" in the front. Here is how it gets created: $var(user_uri) = "sip:" + $var(user) + "@127.0.0.1" and here is debug log:

DEBUG: <script>: == TRACE. websocket:closed
DEBUG: <script>: == TRACE. websocket:closed. WebSocket connection from 127.0.0.1:48640 has closed. User: 100-test
DEBUG: <script>: == TRACE. websocket:closed. user_uri: sip:100-test@127.0.0.1
DEBUG: registrar [lookup.c:256]: lookup_helper(): contact for [100-test] found by address                 <== lookup("location", "$var(user_uri)");
DEBUG: <core> [core/parser/parse_addr_spec.c:864]: parse_addr_spec(): end of header reached, state=10
DEBUG: <core> [core/parser/msg_parser.c:171]: get_hdr_field(): <To> [20]; uri=[you@kamailio.org]
DEBUG: <core> [core/parser/msg_parser.c:172]: get_hdr_field(): to body [<you@kamailio.org>
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

чт, 18 жовт. 2018 о 18:29 Daniel-Constantin Mierla <miconda@gmail.com> пише:

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

-- 
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