[SR-Users] Check if user is registered before reply is routed

Daniel-Constantin Mierla miconda at gmail.com
Sat Aug 1 07:08:37 CEST 2015


Hello,

in onreply_route, $ru is not available, because it is the request-uri --
you can eventually use $tu instead of that, if it is what you expect.

There is a trick, put registered in a route[ABC] {} and call that route
from onreply_route. Use this kind of trick with caution.

I pushed a patch to relax the usage of registered(), allowing it from
onreply_route -- it is in master branch, to be future release 4.4.

Cheers,
Daniel

On 27/07/15 10:39, Dmytro Bogovych wrote:
> Greetings.
> Sorry for previous false letter.
>
> I want to check if user is registered before reply is routed to its
> target user agent.
>
> Imho it should be like this:
>
> onreply_route[MANAGE_REPLY] {
>   if ($rm=="INVITE") {
>     if (registered("location", $ru)) {
>       # Do job - pause for 15 seconds and give chance to reregister
>     }
>   }
> }
>
> But kamailio complains on registered function
>  0(6274) ERROR: <core> [cfg.y:3295]: yyparse(): misused command registered
>  0(6274) : <core> [cfg.y:3439]: yyerror_at(): parse error in config
> file /usr/local/etc/kamailio/kamailio.cfg, line 1121, column 35:
> Command cannot be used in the block
>
> Documentation confirms - registered() function can be used in
> REQUEST_ROUTE and FAILURE_ROUTE only.
>
> Is it possible to check if user is registered when reply is processed
> in scripts?
>
> Thank you!
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com




More information about the sr-users mailing list