[SR-Users] implementing call-quota with dialog module
Daniel-Constantin Mierla
miconda at gmail.com
Mon Oct 8 16:09:22 CEST 2012
Hello,
what version are you using? at some point it was an issue adding a call
in a profile after creating its associated dialog.
Also, it might be better to check the quota before creating the dialog,
because if the limit is reached, then you will just reject the call, so
you avoid quite some internal operations -- but it is not really
something crucial.
Cheers,
Daniel
On 10/8/12 11:40 AM, Aft nix wrote:
> Hi,
>
> I'm trying to implement a "callquota" based on destination domains.
>
> The idea is following:
>
> every destation domain has a limit of, say 50 calls.
>
> As the sip clients are registered with the "destination domains", i've extracted
> the domain using "$fd" because it results as same value as destination domain.
>
> Problem is, i wanted to have separate quota for each domains. But it seems,
> that the quota is reached "as total" not as per domain basis.
>
> Another thing is, the number of calls reported by it is also unusually
> large than
> actual calls.
>
> This is implemenated as bellow:
>
>
> #!ifdef WITH_CALL_LIMIT
> modparam("dialog","enable_stats",1)
> modparam("dialog","dlg_flag", DLG_FLAG)
> modparam("dialog","hash_size", 4096)
> modparam("dialog", "profiles_with_value","callquota")
> modparam("dialog", "default_timeout", 300)
> modparam("dialog", "dlg_match_mode", 2)
> modparam("dialog", "detect_spirals", 1)
> modparam("dialog", "db_mode", 0)
> #!endif
>
> #!ifdef WITH_CALL_LIMIT
> if (is_method("INVITE")) {
> dlg_manage();
> $var(100) = 0;
> get_profile_size("callquota", "$fd", "$var(100)");
> if ($var(100) >= 50 ) {
> xdbg("DEBUG: Simultaneous calls limit reached");
> sl_send_reply("503","Simultaneous calls
> limit reached");
> exit;
> }
>
> set_dlg_profile("callquota","$fd");
> if (get_profile_size("callquota","$fd", "$var(100)")) {
> xdbg("DEBUG: there are $var(100) total calls
> for $fd");
> }
> }
> #!endif
>
> Thanks in advance.
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Nov 5-8, 2012 - http://asipto.com/u/kat
Kamailio Advanced Training, Miami, USA, Nov 12-14, 2012 - http://asipto.com/u/katu
More information about the sr-users
mailing list