[SR-Users] trouble counting dialogs

Gertjan Wolzak g.wolzak at foize.com
Tue Jul 23 09:58:26 CEST 2013


Well, can't stand needing to ask for help...

 

So, I keep trying . found it, well it works now.

 

This is the concurrent route that works:

 

route[CONCURRENT]

{

        xlog("SCRIPT: Conccurrent call check");

 

        if(!get_profile_size("caller","$fu","$avp(nrcalls)"))

        {

                sl_send_reply("403", "Call not matching profile");

                exit;

        }

        xlog("SCRIPT: caller value for $fu is $avp(nrcalls)");

        if($avp(nrcalls)>= 1)

        {

                sl_send_reply("403", "Active calls limit exceeded");

                exit;

        }

        dlg_manage();

        if(!set_dlg_profile("caller","$fu"))

        {

                sl_send_reply("500", "No new channels in this profile");

                exit;

        }

 

        xlog("SCRIPT: caller value for $fu is now $avp(nrcalls)");

 

}

 

 

Maybe someone else can be helped by it.

 

Thanks.

 

From: sr-users-bounces at lists.sip-router.org
[mailto:sr-users-bounces at lists.sip-router.org] On Behalf Of Gertjan Wolzak
Sent: dinsdag 23 juli 2013 7:58
To: sr-users at lists.sip-router.org
Subject: [SR-Users] trouble counting dialogs

 

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/61e21ece/attachment-0001.html>


More information about the sr-users mailing list