Hi Alex
I tried using profile. I added below code to kamailio.cfg in route section.
if (is_method("INVITE")) {
if (!has_totag()) {
get_profile_size("caller", "$fu",
"$var(SIZE)");
if( $var(SIZE) >= MAX_NUMBER_OF_CALLS ) {
sl_send_reply("503", "Simultaneous calls
limit reached");
xlog("Rejected calls with 503 Simultaneous
calls limit reached\n");
exit;
}
else {
xlog("Max calls limit not reached yet\n");
}
}
}
set_dlg_profile("caller","$fu");
When I run kamailio, I get below error.
0(4925) CRITICAL: dialog [dialog.c:297]: profile <caller> not definited
0(4925) ERROR: <core> [route.c:1161]: fixing failed (code=-6) at
cfg:/usr/local/etc/kamailio/kamailio.cfg:423
0(4925) ERROR: <core> [route.c:1161]: fixing failed (code=-6) at
cfg:/usr/local/etc/kamailio/kamailio.cfg:433
0(4925) ERROR: <core> [route.c:1161]: fixing failed (code=-6) at
cfg:/usr/local/etc/kamailio/kamailio.cfg:434
ERROR: error -6 while trying to fix configuration
Any idea why this error comes and how to fix it.
-Regds
Austin
On Sat, Oct 29, 2011 at 8:27 AM, Austin Einter <austin.einter(a)gmail.com>wrote;wrote:
This is continuation with limiting number of calls per
Kamailio proxy
server.
I modified kamailio.cfg as below.
1. loadmodule "dialog.so"
2. modparam("dialog", "enable_stats", 1)
3. modparam("dialog", "dlg_flag", 4)
Next, as dialog module I can use either active_dialogs() or $DLG_count to
find number of calls present at any given point of time.
However if I use active_dialogs() I get parse error when I run kamailio
proxy.
Next I used $DLG_count , but always I am getting value of $DLG_count as 0.
In *route* section, I added code as below.
if (is_method("INVITE"))
{
if($DLG_count > 1)
{
sl_send_reply("503","RESOURCE UNAVAILABLE");
exit;
}
else
{
xlog("Dialog count = $DLG_count\n");
}
}
Everytime a new call starts , it prints $DLG_count as 0.
Kindly let me know whats going wrong here.
Regards
Austin