Hi Prasad,

your problem is the way you do the test over the $avp(i:1) variable - the avp_db_query() function populates the value as string, so you should test is as string and not as integer .

Try:
    if ($avp(i:1)=="1")
instead of
    if(avp_check("$avp(i:1)", "eq/1/i"))

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com


On 06/19/2012 01:16 PM, prasad kelkar wrote:
hello,
I tried following in route script.

route{

    if (is_method("INVITET"))
    {
avp_db_query("select count from load_count where dest='1'","$avp(i:1)"); # avp_db_query("select count from load_count where dest='2'","$avp(i:2)");

    if(avp_check("$avp(i:1)", "eq/1/i"))
    {
        avp_db_query("update load_count set count='0' where dest='1';");

        forward("172.29.9.140:5060 <http://172.29.9.140:5060>");
        #forward();
        exit();
    }
    else
    {    avp_db_query("update load_count set count='1' where dest='1';");

       # forward();
        forward("172.29.9.136:5060 <http://172.29.9.136:5060>");
        exit;
    }
    }
   }

only else part is working. All calls are forwarded to 136 only.
I think it is not modifying database or its not persistent.
Please tell if that update query is correct and anything else i have to do to make db persistent?
thank you


_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to