[SR-Users] implementing call-quota with dialog module

Aft nix aftnix at gmail.com
Mon Oct 8 11:40:16 CEST 2012


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.
-- 
-aft



More information about the sr-users mailing list