Hello!
I am trying to implement limit of active calls for subscribers. And for each subscriber this limit must be personal.
I find example route in presentation of Daniel-Constantin Mierla.
And i need to set $xavp(caller=>active_calls) = 1;
for each dialog. But i can't understand how to load this number of active calls from some-thing similar of user profile or subscriber table?
route[DIALOG] {
if (is_method("CANCEL") || (has_totag() && is_method("INVITE|BYE|ACK"))) {
dlg_manage();
return;
}
if (is_method("INVITE") && !has_totag() && !isflagset(WITH_ACTIVE_CALLS_LIMIT)) {
if( $xavp(caller[0]=>active_calls) != $null && $xavp(caller[0]=>active_calls) > 0 ) {
if(!get_profile_size("caller", "$fU@$fd", "$var(acsize)")) {
send_reply("500", "No more active calls");
exit;
}
if($var(acsize)>=$xavp(caller[0]=>active_calls)) {
send_reply("403", "No more active calls");
exit;
}
set_dlg_profile("caller", "$fU@$fd");
}
setflag(WITH_ACTIVE_CALLS_LIMIT);
dlg_manage();
}
}