<div dir="ltr"><p class=""><span style="font-family:&#39;Courier New&#39;">branch_route[2]
{<br>
      xlog(&quot;new branch at
$ru\n&quot;);<br>
<br>
        # values used for t1 and t2 and
the constants c1 and c2 and the threshold value <br>
<br>
        $var(t1)=1;<br>
        $var(t2)=60;<br>
        $var(c1)=1;<br>
        $var(c2)=3;<br>
        $var(ts)=500;<br>
<br>
<br>
        avp_db_query(&quot;select time
from acc where caller_id=$fu and max(time)&quot;,&quot;$avp(t)&quot;);<br>
<br>
        avp_db_query(&quot;select ps,pl,pt,sh
from acc where caller_id=$fu&quot; ,&quot;$avp(val)&quot;);<br>
     <br>
        avp_db_query(&quot;delete
ps,pl,pt,sh from acc where caller_id=$fu&quot;);<br>
<br>
       
$avp(diff)=$avp(t)-$(avp(val)[2]);<br>
<br>
        # calculation of long term gray
level <br>
<br>
        if ( ($var(t2) - $avp(diff) )
&gt; 0 )<br>
           $avp(l)= $(avp(val)[1]) +
$var(c2)*($(avp(val)[0])+1)*($var(t2)-$avp(diff))/$var(t2);<br>
<br>
        if ( ($var(t2) - $avp(diff) )
&lt;= 0 )<br>
           $avp(l)= $(avp(val)[1]) +
$var(c2)*(1-$(avp(val)[0]))/($(avp(val)[0])+1))*($var(t2)-$avp(diff))/$var(t2);<br>
<br>
        if ( $avp(l) &lt; 0 )<br>
           $avp(l) = 0;<br>
 <br>
        # calculation of short term gray
level #<br>
<br>
<br>
        if($avp(diff) &gt; 1)<br>
         {$avp(d)=$avp(diff);} <br>
        else <br>
         {$avp(d)=1;})<br>
<br>
        if($avp(d)&lt;$var(t1))<br>
         {$avp(r)=$avp(d);}<br>
        else<br>
       {$avp(r)=$var(t1);}<br>
<br>
        if ($avp(l) &lt; $var(ts))<br>
           $avp(s)=
$(avp(val)[3])+$var(c1)*($var(t1)-$avp(diff))/($avp(r));<br>
<br>
        if ($avp(s) &lt; 0)<br>
           $avp(s) = 0;<br>
<br>
        if ($avp(s) &gt;= $var(ts))<br>
         {<br>
           $avp(l)= $avp(s);<br>
           $avp(s)= 0 ;<br>
         }<br>
        <br>
         # updating spam history<br>
<br>
        if
((($(avp(val)[0])+$(avp(val)[1])) &lt; $var(ts) )&amp;&amp; (($avp(s)+$avp(l))
&gt; $var(ts)))<br>
           $(avp(val)[3])=
$(avp(val)[3])+1;<br>
<br>
        # blocking the call<br>
    <br>
        $avp(sum) =$avp(l) +
$avp(s);<br>
        if ($avp(sum) &gt; $avp(ts)
)<br>
           drop();<br>
<br>
       #updating database<br>
       <br>
       avp_db_query(&quot; insert
into  acc (ps,pl,pt,sh) values
($avp(s),$avp(l),$avp(t),$(avp(val)[3]))&quot;);<br>
<br>
}<br>
</span></p><p class=""><span style="font-family:&#39;Courier New&#39;"><br></span></p><p class=""><span style="font-family:&#39;Courier New&#39;"><br></span></p><p class="" style><span style="font-family:&#39;Courier New&#39;">I am getting syntax error in this code...can anyone help me out here ??please...</span></p>
</div>