[OpenSIPS-Users] About usint integer variable

prasad kelkar durga144 at gmail.com
Wed May 9 07:28:17 CEST 2012


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.



More information about the Users mailing list