[Kamailio-Users] Problems with counter $var(i)

Ricardo Martinez rmartinez at redvoiss.net
Thu Nov 13 19:38:26 CET 2008


Hello

I realized that the counter $var(i) in the failure_route[1] seems not to be resetting  to 0  when the 2nd , 3th ..etc call arrive.

So for the second call I have the counter 0 in the main route, the route(3), route(1)  but in the failure_route is set to 3 (the last values from the last call)

I keep trying to figure it out why this is happening..

 

Anyone?

 

Thanks,

Ricardo.-

 

 

De: users-bounces at lists.kamailio.org [mailto:users-bounces at lists.kamailio.org] En nombre de Ricardo Martinez
Enviado el: jueves, 13 de noviembre de 2008 11:46
Para: users at lists.kamailio.org
Asunto: [Kamailio-Users] Problems with counter $var(i)

 

Sorry ¡ i forgot to put the subject.

 

Hello list.

I'm having some problems trying to build a counter for my kamailio.cfg file.

This is what I have..

 

 

main()

...

       load avp from radius}

       var(i)=0;

       route(3);

...

 

route[1] {

 

        t_on_failure("1");

        if (!t_relay()) {

                sl_reply_error();

        };

        xlog("L_INFO","[$ci] $rm t_relay a $ru");

        exit;

}

route(3)

...

       $var(nr)=$avp(s:caller_nr);

       If ( var(i) < $var(nr) );

             $var(i) = $var(i) + 1;

              route(1);

       else

             exit;

 

 

failure_route[1] {

        xlog("L_INFO", "[$ci] $rm:$ru failure_route\n");

 

        if (t_was_cancelled()) {

                xlog("L_INFO", "[$ci] $rm:$ru t_was_cancelled en failure_route\n");

                exit;

        }

 

        if (!next_gw()) {

                xlog("L_INFO", "[$ci] No hay mas gateways para $rm:$ou\n");

route(3);

        } else  {

                xlog("L_INFO", "XXXXX");

        }

 

        t_on_failure("1");

        t_relay();

}

 

 

After I restart the service the first time a call arrives the counter seems to go OK, the counter goes from 0 to 2 (if the caller_nr=3).  But the second time the $var(i) at the main and route(3) it's = 0, but in the failure_route it keeps the value = 3.  What I'm doing wrong?

Can someone help me here?

 

Thanks

 

Ricardo Martinez.-

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/users/attachments/20081113/09c2ac59/attachment.htm 


More information about the Users mailing list