[SR-Users] trouble counting dialogs

Gertjan Wolzak g.wolzak at foize.com
Tue Jul 23 07:58:25 CEST 2013


Hello,

 

I am trying to limit the number of concurrent calls to 1 per user..

 

But I can't get the dialogs to be counted.

 

Can anybody tell me what I am doing wrong..?

 

Kamailio version 3.2.3

 

# ------ dialog params -------

 

modparam("dialog", "enable_stats", 1)

modparam("dialog", "profiles_with_value", "caller")

modparam("dialog", "dlg_flag", 24)

modparam("dialog", "dlg_match_mode", 1)

modparam("dialog", "default_timeout", 3600)

modparam("dialog", "db_url", "mysql://xxxxx:xxxxxx@127.0.0.1/dbname")

modparam("dialog", "db_mode", 1)

 

request_route {

 

                               .

 

                               # Check if caller is in call

                               if(is_method("INVITE") && !has_totag())

                               {

                                               route(CONCURRENT);

                               }

 

                               .

 

                               }

 

 

route[CONCURRENT]

{

        xlog("SCRIPT: Conccurrent call check");

 

        get_profile_size("caller", "$fu", "$var(SIZE)");

        xlog("SCRIPT:  profile size is $var(SIZE)");

 

        if( $var(SIZE) >= 1 )

        {

                sl_send_reply("503", "Simultaneous calls limit reached");

                exit;

        }

 

        set_dlg_profile("caller","$fu");

 

        get_profile_size("caller", "$fu", "$var(SIZE)");

        xlog("SCRIPT:  profile size is now $var(SIZE)");

 

        xlog("SCRIPT: No concurrent call");

 

}

 

I feel I should do a dlg_setflag(), but I am not sure and even if I have to,
not sure where to place it. Hope someone can point me in the right
direction.

 

Thanks.

 

Gertjan Wolzak

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130723/c4e7a5ba/attachment-0001.html>


More information about the sr-users mailing list