Hello,


there is a statistic value giving the active tcp connections (which include the tls connections) and then you can get the value via $stat(...) variable:


  - https://www.kamailio.org/wikidocs/cookbooks/5.7.x/pseudovariables/#statname-statistics


I don't recall right now if the name of the stat is with its group id or without, you have to try.


Cheers,
Daniel


On 06.02.24 12:02, Sebastian Damm via sr-users wrote:
Hello,

My plan is to reject new inbound requests if there is already a certain number of open connections on one Kamailio server. I could answer with a 503 and directly close the connection forcing the client to reconnect and the loadbalancer to send traffic to a different node on the next connect. It's just a last-resort measure to prevent Kamailio from running into the configured TCP connection limit (workarounding a poorly-implemented external load balancer).

Since I didn't find anything in the docs: Is there a pseudovariable containing the current number of open tcp/tls connections on this Kamailio? I can (and already do) query them via kamcmd or rpc, but can I access the variable from inside the routing script as well?

Regards,
Sebastian

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Kamailio Advanced Training, February 20-22, 2024 -- asipto.com
Kamailio World Conference, April 18-19, 2024, Berlin -- kamailioworld.com