[OpenSIPS-Users] load_balance debugging

Alexandr A. Alexandrov shurrman at gmail.com
Fri Oct 22 14:53:58 CEST 2010


Hi!

I have a strange problem with trying to use avps in load_balance function.

I'm trying to do balancing like this:

         avp_db_query("select phone, resource from phone_resource where 
phone like '%$fU%'", "$avp(i:111);$avp(i:112)");
         avp_print();
         xlog("L_INFO","$fu = $avp(i:111)");
         if ($fu=~$avp(i:111)) {
                 xlog("L_INFO", "AAA detected!\n");
                 load_balance("1", "$avp(i:112)");

Here is what I get in logs:

Oct 22 16:35:44 kzo2 /usr/local/sbin/opensips[8214]: 
INFO:avpops:ops_print_avp: #011#011#011id=<112>
Oct 22 16:35:44 kzo2 /usr/local/sbin/opensips[8214]: 
INFO:avpops:ops_print_avp: #011#011#011val_str=<aaa / 3>
Oct 22 16:35:44 kzo2 /usr/local/sbin/opensips[8214]: 
INFO:avpops:ops_print_avp: p=0x7f73f6b251e8, flags=0x0002
Oct 22 16:35:44 kzo2 /usr/local/sbin/opensips[8214]: 
INFO:avpops:ops_print_avp: #011#011#011id=<111>
Oct 22 16:35:44 kzo2 /usr/local/sbin/opensips[8214]: 
INFO:avpops:ops_print_avp: #011#011#011val_str=<1234565677 / 10>
Oct 22 16:35:44 kzo2 /usr/local/sbin/opensips[8214]: 
sip:1234565677 at xx.xxx.xxx.xxx;user=phone = 1234565677
Oct 22 16:35:44 kzo2 /usr/local/sbin/opensips[8214]: AAA detected!
Oct 22 16:35:44 kzo2 /usr/local/sbin/opensips[8214]: 
ERROR:load_balancer:do_load_balance: unknown resource in input string
Oct 22 16:35:44 kzo2 /usr/local/sbin/opensips[8214]: 
DBG:core:comp_scriptvar: int 26 : -1 / 0

If I write the resource directly, like
                 load_balance("1", "aaa");
everything works fine.
In the above log you can see that $avp(i:112) contains exactly the same 
resource string.
What is the correct way to do this, or is there a way to debug how load 
balancer searches for resources defined in database?

Thanks in advance,
Alexandr A. Alexandrov



More information about the Users mailing list