[SR-Users] Call limit through shared database

Daniel Tryba d.tryba at pocos.nl
Mon Sep 30 14:55:44 CEST 2019


On Sun, Sep 29, 2019 at 11:03:47AM +0300, Olli Attila wrote:
> modparam("dialog", "profiles_with_value", "concurrent_calls")
> modparam("dialog", "dlg_flag", 4)
> modparam("dialog", "db_url", DBURL)
> modparam("dialog", "db_mode", 1)
 
Have you tested with a lower value of
https://kamailio.org/docs/modules/5.1.x/modules/dialog.html#dialog.p.update_period
I have it set to 5, but for some reason I'm not using get_profile_size

For inbound:
$var(maxchannels) = 0;
sql_xquery("ca", "select count(id) as c from dialog where xdata like '%maxchannels%$rU%' and timeout>unix_timestamp()", "ra");
$var(maxchannels)=$xavp(ra=>c);
sql_result_free("ra");

For outbound:
sql_xquery("ca", "select count(id) as c from dialog where xdata like '%maxchannels%$au%' and timeout>unix_timestamp()", "ra");
$var(maxchannels)=$xavp(ra=>c);
sql_result_free("ra");

Pasting the code here I see this isn't that secure since a user foo also
gets the number of calls for foobar counted against him! Off to put a "
before/after the username.
 



More information about the sr-users mailing list