[Kamailio-Users] Problems with counter $var(i)
Ricardo Martinez
rmartinez at redvoiss.net
Thu Nov 13 15:46:03 CET 2008
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/eab47722/attachment.htm
More information about the Users
mailing list