Hello,
in kamailio there is a difference between exit and drop, while in ser is basically the same (exit functionality).
For kamailio, in request and failure route they are the same, stop processing of the actions. But in branch route and reply route drop does a bit more: drop current processed branch respectively reply, so they are not forwarded.
Addition of this functionality will affect core and tm. Any comments regarding this? i can create the patch for it, if nobody sees issues.
Cheers, Daniel
Daniel-Constantin Mierla writes:
i'm calling 'drop' in onreply_route if t_check_trans() fails on the reply. the idea is to discard the reply.
Addition of this functionality will affect core and tm. Any comments regarding this? i can create the patch for it, if nobody sees issues.
if the above functionality can be achieved in sr by some other means, i can switch to that. if not, 'drop' should be fixed so that it discards the reply.
-- juha
Hi,
as I know only t_drop_replies() function exists in tm module that does something similar, but it drops all the replies received so far, and it is usable only from failure_route.
Anyway, I think your particular problem can be solved with the on_sl_reply modparam:
modparam(tm, on_sl_reply, "stateless_reply");
onreply_route["stateless_reply"] { # This route is executes if tm module does not find # the transaction for the reply. # If 0 is returned then the reply is not forwarded. return 0; }
Miklos
On 07/01/2009 12:11 PM, Juha Heinanen wrote:
On 07/01/2009 02:25 PM, Juha Heinanen wrote:
No, you do not need to. tm module checks every incoming reply. If the transaction is not found for a reply and the above modparam is set then the route block, "stateless_reply" in my example, is executed. Depending on the return value of this route the processing continues or stops. t_on_reply() has an effect only if tm module finds the associated transaction of the reply, so it is another case.
if so, it is not very practical, because i currently call 'drop' in default onreply_route, which is executed automatically for each reply.
I see, so you did it before tm module saw the reply. In fact both solutions wrap to the same function, t_check(), so you should get the same result.
Miklos
-- juha
On Jul 01, 2009 at 16:56, Juha Heinanen jh@tutpro.com wrote:
You still need one in the sl_reply_route. It should contain only drop if you want to be equivalent to your if (!t_check_trans()) drop; in the onreply_route. If it doesn't contain a drop or a return 0, it won't drop the reply :-)
Note that in this case (top-level-route) drop is equivalent with return 0 (but not in other cases, return exists only from the current route, while drop or exit immediately stop all script processing even if the route is not top-level).
Andrei
On Jul 01, 2009 at 13:11, Juha Heinanen jh@tutpro.com wrote:
This works, because you are using it in the main reply route (onreply_route{} without a name) and you can drop replies in the main reply route. What you can't do right now is drop replies in tm onreply_routes, meaning onreply_routes set with t_on_reply("on reply route name"). The reason why this does not work is that we didn't find it useful to drop a reply to an existing transaction (you can drop it before in the main onreply_route like you do it or in the sl_reply route if you really want to, but it makes little sense to drop it after knowing that a transaction exists for it).
There's a similar reason for drop not being possible in the branch route. You can always drop any sent message in the onsend_route() (which is executed for any forwarded message before sending) if you need to do it for some security reason.
That being said I'm not opposed to introducing drop in the tm on_reply and branch routes (since there would be no performance hit, little code and it might help kamailio users to have an easier migration). I just not see any use-cases for them :-)
What you use already works, and is equivalent to what Miklos proposed (using a sl_reply_route which contains only a drop; ).
Andrei