[SR-Users] Call limit through shared database

Henning Westerholt hw at skalatan.de
Mon Sep 30 15:30:18 CEST 2019


Hello Olli,

you can synchronize dialog profile information between Kamailio servers with the DMQ replication mechanism. You basically load and configure the DMQ module and activate it also in the dialog module.

Cheers,

Henning

--
Henning Westerholt - https://skalatan.de/blog/
Kamailio services - https://skalatan.de/services

From: sr-users <sr-users-bounces at lists.kamailio.org> On Behalf Of Olli Attila
Sent: Sunday, September 29, 2019 10:04 AM
To: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
Subject: [SR-Users] Call limit through shared database

Hello,

I have 2 kam instances using one shared database and both kam servers running the same routing logic code. Kamailio servers are configured to use the same database as dialog backend.

I am limiting the concurrent dialogs in the following way but it seems that kamailio is using its own memory to read profile size rather than the db. Second kam is not aware of the dialog profiles that the first kam wrote to the shared db. Is there a way to get multiple kam instances to read profile size from the same database when calling the get_profile_size function?

modparam("dialog", "profiles_with_value", "concurrent_calls")
modparam("dialog", "dlg_flag", 4)
modparam("dialog", "db_url", DBURL)
modparam("dialog", "db_mode", 1)


route[LIMIT_CALLS] {

if (!dlg_isflagset("1")) { # $td – gateways, $fu - user
        if (get_profile_size("concurrent_calls", "$fu", "$avp(calls)")) {
                if ($avp(calls) >= 3) {
                        xlog("L_INFO", "Concurrent calls $fu at limit");
                        send_reply("503", "Calls limit reached"); exit;
                } else {
                        dlg_manage(); dlg_setflag("1");
                        set_dlg_profile("concurrent_calls", "$fu");
                }
        }
}
}

Cheers,
Olli

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


More information about the sr-users mailing list