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

ingdavidcespedes at cable.net.co ingdavidcespedes at cable.net.co
Thu Nov 13 20:15:08 CET 2008


Hi

In which place of your main route are you writing var(i)=0. Maybe that's the problem, each time you enter in the main route you are setting the i variable to 0.

David Cespedes
-------------- next part --------------
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/c615ded4/attachment.htm 
-------------- next part --------------
_______________________________________________
Users mailing list
Users at lists.kamailio.org
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users


More information about the Users mailing list