<div dir="ltr">Forgot to add:<br><div><br></div><div><font face="monospace">root@csbc01:~# kamailio -V<br>version: kamailio 5.3.0-dev7 (x86_64/linux)<br>flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES<br>ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB<br>poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.<br>id: unknown<br>compiled with gcc 8.3.0<br>root@csbc01:~#</font><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 12, 2019 at 2:13 PM Joel Serrano <<a href="mailto:joel@textplus.com">joel@textplus.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello, <br><div><br></div><div>I'm playing around with the unregister() function from the registrar module:</div><div><br></div><div><a href="https://www.kamailio.org/docs/modules/devel/modules/registrar.html#registrar.f.unregister" target="_blank">https://www.kamailio.org/docs/modules/devel/modules/registrar.html#registrar.f.unregister</a><br></div><div><br></div><div>Docs say that that it can be used in REQUEST_ROUTE or FAILURE_ROUTE.</div><div><br></div><div>I needed it in REPLY_ROUTE, and before reading the docs I tried it and got this error:</div><div><br></div><div>Aug 12 15:52:44 csbc01 kamailio: CRITICAL: <core> [core/cfg.y:3526]: yyerror_at(): parse error in config file /etc/kamailio/csbc/reply_routes.cfg, line 27, column 71: Command cannot be used in the block#012<br>Aug 12 15:52:44 csbc01 kamailio[12737]: ERROR: bad config file (1 errors)<br></div><div><br></div><div>But, I have this working on another setup, I compared, and my difference is that I'm running unregister() inside a route, and calling that route from reply_route, and that works (and by works, I mean it also does what it is supposed to do, which is unregister the AoR).</div><div><br></div><div>So this doesn't work:</div><div><font face="monospace"><br></font></div><div><font face="monospace">...</font></div><div><font face="monospace">onreply_route[MANAGE_REG_REPLY] {<br></font></div><div><font face="monospace">     if(status=~"2[0-9][0-9]") {<br>         if(($sel(contact.expires)==0) || ($hdr(Expires)==0)){<br>            if (unregister("location", "$sht(sipserver=>$fU::contact)")) {<br>                xlog("L_NOTICE", "[usrloc] removed user location\n");<br>            }<br>            route(DEL_SIPSERVER);<br></font></div><div><font face="monospace">}</font></div><div><font face="monospace">...</font></div><div><br></div><div>But this works:</div><div><br></div><div><div><font face="monospace">...</font></div><div><font face="monospace">onreply_route[MANAGE_REG_REPLY] {<br></font></div><div><font face="monospace">     if(status=~"2[0-9][0-9]") {<br>         if(($sel(contact.expires)==0) || ($hdr(Expires)==0)){</font></div><div><font face="monospace">            route(UNREG_CUSTOMER);<br>            route(DEL_SIPSERVER);<br></font></div><div><font face="monospace">}</font></div><div><font face="monospace">...</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">...</font></div><div><div><font face="monospace">route[UNREG_CUSTOMER] {</font></div></div><div><font face="monospace">            if (unregister("location", "$sht(sipserver=>$fU::contact)")) {<br>                xlog("L_NOTICE", "[usrloc] removed user location\n");<br>            }<br></font></div><div><font face="monospace">}</font></div><div><font face="monospace">...</font></div></div><div><br></div><div><br></div><div><br></div><div>So I'm in no-mans-land right now, docs say it's not allowed in REPLY_ROUTE, and if I try it it will fail, but if I try it inside a route, it woks (hack?).</div><div><br></div><div>What is the correct approach here? Should unregister() be valid in reply_route (like other similar functions, for example: save()) and therefor docs should be updated and the error in the logs should also be updated, or if it's really not supported, shouldn't Kamailio not let me use it anywhere that a ends up being called from reply_route?</div><div><br></div><div>I hope I have explained myself correctly. As always, please let me know if this should be a GH issue instead and I'll happily create it.</div><div><br></div><div>Thanks, </div><div>Joel.</div><div><br></div><div><br></div><div><br></div><div></div></div></div></div>
</blockquote></div>