[OpenSIPS-Users] to connect mysql using avpops
Bogdan-Andrei Iancu
bogdan at opensips.org
Tue Jun 19 22:13:10 CEST 2012
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
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20120619/31b5695c/attachment.htm>
More information about the Users
mailing list