About usint integer variable

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

About usint integer variable

group4
hello,
I used statistic module according to
"http://www.opensips.org/html/docs/modules/devel/statistics".
I wrote following code to do round robin distribution of calls between
two servers.
if (is_method("INVITET"))
        {
        $var(reg_counter) = "count";

        #if($stat(count)==1)
        if(!$var(reg_counter))
        {
                forward("172.29.9.131:5060");
                update_stat("count", "1");
               
                exit();
        }
        else
        {
                forward("172.29.9.136:5060");
                #update_stat("count", "1");
                reset_stat("count");
                exit;
        }
        if($stat(count))
        {
                forward("172.29.9.131:5060");
                $stat(count) = 0;

                exit();
        }
        else
        {
                forward("172.29.9.136:5060");
                #stat(count) = 1;
                exit;
        }
        }

In both stat(count) and $var(reg_counter) = "count" It is executing
only else part.
how to use variable count to compare values?
can this count variable be used for this purpose? or is there any other way.
I am doing it stateless mode.
Please help me.

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: About usint integer variable

Ali Pey
Consider using the Dispatcher or Load Balancer Modules. They give you a lot more flexibility and many more features in traffic distribution:



Regards,
Ali

On Wed, May 9, 2012 at 1:28 AM, prasad kelkar <[hidden email]> wrote:
hello,
I used statistic module according to
"http://www.opensips.org/html/docs/modules/devel/statistics".
I wrote following code to do round robin distribution of calls between
two servers.
if (is_method("INVITET"))
       {
       $var(reg_counter) = "count";

       #if($stat(count)==1)
       if(!$var(reg_counter))
       {
               forward("172.29.9.131:5060");
               update_stat("count", "1");

               exit();
       }
       else
       {
               forward("172.29.9.136:5060");
               #update_stat("count", "1");
               reset_stat("count");
               exit;
       }
       if($stat(count))
       {
               forward("172.29.9.131:5060");
               $stat(count) = 0;

               exit();
       }
       else
       {
               forward("172.29.9.136:5060");
               #stat(count) = 1;
               exit;
       }
       }

In both stat(count) and $var(reg_counter) = "count" It is executing
only else part.
how to use variable count to compare values?
can this count variable be used for this purpose? or is there any other way.
I am doing it stateless mode.
Please help me.

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users