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