[SR-Users] Event route websocket:closed and function unregister

Daniel-Constantin Mierla miconda at gmail.com
Thu Oct 18 17:29:53 CEST 2018


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 at 127.0.0.1 <mailto:sip%3A100-test at 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 at kamailio.org
> <mailto:you at kamailio.org>> (16)/

the variable seems to have only username at domain, not sip:username at 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 at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20181018/ac13726e/attachment.html>


More information about the sr-users mailing list